// @bun
var{defineProperty:T,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,Q=Object.prototype.hasOwnProperty;function X(S){return this[S]}var o=(S)=>{var A=(L??=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 J(S))if(!Q.call(A,N))T(A,N,{get:X.bind(S,N),enumerable:!(E=K(S,N))||E.enumerable})}return L.set(S,A),A},L;var Z=(S)=>S;function $(S,A){this[S]=Z.bind(null,A)}var V=(S,A)=>{for(var E in A)T(S,E,{get:A[E],enumerable:!0,configurable:!0,set:$.bind(A,E)})};var B=(S,A)=>()=>(S&&(A=S(S=0)),A);var a={};V(a,{groupByToArray:()=>G,groupByMultiple:()=>U,groupBy:()=>_,getUniqueTags:()=>x,getUniqueOwners:()=>q,getUniqueDomains:()=>u,filterBy:()=>O,GroupingStrategies:()=>h});function O(S,A){return S.filter((E)=>{if(A.tags?.length){if(!A.tags.some((R)=>E.meta.tags?.includes(R)))return!1}if(A.owners?.length){if(!A.owners.some((R)=>E.meta.owners?.includes(R)))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??"",R=A.keyPattern.replace(/\*/g,".*").replace(/\?/g,".");if(!new RegExp(`^${R}$`,"i").test(N))return!1}return!0})}function _(S,A){let E=new Map;for(let N of S){let R=A(N),H=E.get(R);if(H)H.push(N);else E.set(R,[N])}return E}function G(S,A){let E=_(S,A);return Array.from(E.entries()).map(([N,R])=>({key:N,items:R}))}function U(S,A){let E=new Map;for(let N of S){let R=A(N);for(let H of R){let C=E.get(H);if(C)C.push(N);else E.set(H,[N])}}return E}function x(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 q(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 u(S){let A=new Set;for(let E of S)A.add(h.byDomain(E));return Array.from(A).sort()}var h;var W=B(()=>{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 Y={Idea:"idea",InCreation:"in_creation",Experimental:"experimental",Beta:"beta",Stable:"stable",Deprecated:"deprecated"},w={PlatformCore:"platform.core",PlatformSigil:"platform.sigil",PlatformMarketplace:"platform.marketplace",PlatformMessaging:"platform.messaging",PlatformContent:"platform.content",PlatformFeatureFlags:"platform.featureflags",PlatformFinance:"platform.finance"},n=w,D={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"},y=D;W();import{compareVersions as p}from"compare-versions";var F=(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=F(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,R]of this.items.entries()){if(!N.startsWith(`${S}.v`))continue;if(!E||p(R.meta.version,E.meta.version)>0)E=R}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 _(this.list(),S)}getUniqueTags(){return x(this.list())}}function b(S){return S}var t=(S,A)=>`${S}.v${A}`;class l extends M{constructor(S){super("event",S)}}var P="harness",d=["platform.harness"],j=[D.Automation,"harness","evidence","evaluation"],z=Y.Experimental;import{ScalarTypeEnum as I,SchemaModel as v}from"@contractspec/lib.schema";var c=new v({name:"HarnessRunCompletedPayload",fields:{runId:{type:I.ID(),isOptional:!1},completedAt:{type:I.DateTime(),isOptional:!1},evidenceCount:{type:I.Int_unsecure(),isOptional:!1},status:{type:I.String_unsecure(),isOptional:!1}}}),RS=b({meta:{key:"harness.run.completed",version:"1.0.0",description:"Emitted when a harness run completes.",domain:P,owners:d,tags:[...j,"run","completed"],stability:z},payload:c});export{c as HarnessRunCompletedPayload,RS as HarnessRunCompletedEvent};
