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