// @bun
var{defineProperty:T,getOwnPropertyNames:z,getOwnPropertyDescriptor:J}=Object,K=Object.prototype.hasOwnProperty;function Q(S){return this[S]}var o=(S)=>{var A=(W??=new WeakMap).get(S),E;if(A)return A;if(A=T({},"__esModule",{value:!0}),S&&typeof S==="object"||typeof S==="function"){for(var N of z(S))if(!K.call(A,N))T(A,N,{get:Q.bind(S,N),enumerable:!(E=J(S,N))||E.enumerable})}return W.set(S,A),A},W;var X=(S)=>S;function Z(S,A){this[S]=X.bind(null,A)}var $=(S,A)=>{for(var E in A)T(S,E,{get:A[E],enumerable:!0,configurable:!0,set:Z.bind(A,E)})};var V=(S,A)=>()=>(S&&(A=S(S=0)),A);var w={};$(w,{groupByToArray:()=>B,groupByMultiple:()=>G,groupBy:()=>R,getUniqueTags:()=>D,getUniqueOwners:()=>U,getUniqueDomains:()=>q,filterBy:()=>O,GroupingStrategies:()=>h});function O(S,A){return S.filter((E)=>{if(A.tags?.length){if(!A.tags.some((H)=>E.meta.tags?.includes(H)))return!1}if(A.owners?.length){if(!A.owners.some((H)=>E.meta.owners?.includes(H)))return!1}if(A.stability?.length){if(!A.stability.includes(E.meta.stability??"stable"))return!1}if(A.domain){if(h.byDomain(E)!==A.domain)return!1}if(A.keyPattern){let N=E.meta.key??E.meta.key??"",H=A.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${H}$`,"i").test(N))return!1}return!0})}function R(S,A){let E=new Map;for(let N of S){let H=A(N),I=E.get(H);if(I)I.push(N);else E.set(H,[N])}return E}function B(S,A){let E=R(S,A);return Array.from(E.entries()).map(([N,H])=>({key:N,items:H}))}function G(S,A){let E=new Map;for(let N of S){let H=A(N);for(let I of H){let L=E.get(I);if(L)L.push(N);else E.set(I,[N])}}return E}function D(S){let A=new Set;for(let E of S)for(let N of E.meta.tags??[])A.add(N);return Array.from(A).sort()}function U(S){let A=new Set;for(let E of S)for(let N of E.meta.owners??[])A.add(N);return Array.from(A).sort()}function q(S){let A=new Set;for(let E of S)A.add(h.byDomain(E));return Array.from(A).sort()}var h;var Y=V(()=>{h={byTag:(S)=>S.meta.tags?.[0]??"untagged",byAllTags:(S)=>S.meta.tags?.length?S.meta.tags:["untagged"],byOwner:(S)=>S.meta.owners?.[0]??"unowned",byDomain:(S)=>{return(S.meta.key??S.meta.key??"").split(".")[0]??"default"},byStability:(S)=>S.meta.stability??"stable",byUrlPath:(S)=>(A)=>{if(!A.path)return"root";return A.path.split("/").filter(Boolean).slice(0,S).join("/")||"root"}}});var b={Idea:"idea",InCreation:"in_creation",Experimental:"experimental",Beta:"beta",Stable:"stable",Deprecated:"deprecated"},a={PlatformCore:"platform.core",PlatformSigil:"platform.sigil",PlatformMarketplace:"platform.marketplace",PlatformMessaging:"platform.messaging",PlatformContent:"platform.content",PlatformFeatureFlags:"platform.featureflags",PlatformFinance:"platform.finance"},y=a,x={Spots:"spots",Collectivity:"collectivity",Marketplace:"marketplace",Sellers:"sellers",Auth:"auth",Login:"login",Signup:"signup",Guide:"guide",Docs:"docs",I18n:"i18n",Incident:"incident",Automation:"automation",Hygiene:"hygiene"},k=x;Y();import{compareVersions as F}from"compare-versions";var l=(S)=>`${S.meta.key}.v${S.meta.version}`;class M{contractType;items=new Map;constructor(S,A){this.contractType=S;if(A)A.forEach((E)=>this.register(E))}register(S){let A=l(S);if(this.items.has(A))throw Error(`Duplicate contract \`${this.contractType}\` ${A}`);return this.items.set(A,S),this}count(){return this.items.size}list(){return[...this.items.values()]}get(S,A){if(A!=null)return this.items.get(`${S}.v${A}`);let E;for(let[N,H]of this.items.entries()){if(!N.startsWith(`${S}.v`))continue;if(!E||F(H.meta.version,E.meta.version)>0)E=H}return E}has(S,A){return!!this.get(S,A)}filter(S){return O(this.list(),S)}listByTag(S){return this.list().filter((A)=>A.meta.tags?.includes(S))}listByOwner(S){return this.list().filter((A)=>A.meta.owners?.includes(S))}groupBy(S){return R(this.list(),S)}getUniqueTags(){return D(this.list())}}function p(S){return S}var t=(S,A)=>`${S}.v${A}`;class u extends M{constructor(S){super("event",S)}}var C="harness",P=["platform.harness"],d=[x.Automation,"harness","evidence","evaluation"],j=b.Experimental;import{ScalarTypeEnum as _,SchemaModel as v}from"@contractspec/lib.schema";var c=new v({name:"HarnessStepCompletedPayload",fields:{runId:{type:_.ID(),isOptional:!1},stepId:{type:_.ID(),isOptional:!1},completedAt:{type:_.DateTime(),isOptional:!1},summary:{type:_.String_unsecure(),isOptional:!0}}}),HS=p({meta:{key:"harness.step.completed",version:"1.0.0",description:"Emitted when a harness step completes.",domain:C,owners:P,tags:[...d,"step","completed"],stability:j},payload:c});export{c as HarnessStepCompletedPayload,HS as HarnessStepCompletedEvent};
