// @bun
var{defineProperty:T,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,Q=Object.prototype.hasOwnProperty;function X(S){return this[S]}var u=(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 C=(S,A)=>()=>(S&&(A=S(S=0)),A);var p={};V(p,{groupByToArray:()=>G,groupByMultiple:()=>U,groupBy:()=>R,getUniqueTags:()=>O,getUniqueOwners:()=>q,getUniqueDomains:()=>a,filterBy:()=>h,GroupingStrategies:()=>b});function h(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(b.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 G(S,A){let E=R(S,A);return Array.from(E.entries()).map(([N,H])=>({key:N,items:H}))}function U(S,A){let E=new Map;for(let N of S){let H=A(N);for(let I of H){let M=E.get(I);if(M)M.push(N);else E.set(I,[N])}}return E}function O(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 a(S){let A=new Set;for(let E of S)A.add(b.byDomain(E));return Array.from(A).sort()}var b;var W=C(()=>{b={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"},k=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 l}from"compare-versions";var F=(S)=>`${S.meta.key}.v${S.meta.version}`;class x{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,H]of this.items.entries()){if(!N.startsWith(`${S}.v`))continue;if(!E||l(H.meta.version,E.meta.version)>0)E=H}return E}has(S,A){return!!this.get(S,A)}filter(S){return h(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 O(this.list())}}function d(S){return S}var t=(S,A)=>`${S}.v${A}`;class c extends x{constructor(S){super("event",S)}}var B="harness",P=["platform.harness"],j=[D.Automation,"harness","evidence","evaluation"],z=Y.Experimental;import{ScalarTypeEnum as _,SchemaModel as v}from"@contractspec/lib.schema";var o=new v({name:"HarnessStepBlockedPayload",fields:{runId:{type:_.ID(),isOptional:!1},stepId:{type:_.ID(),isOptional:!1},blockedAt:{type:_.DateTime(),isOptional:!1},reason:{type:_.String_unsecure(),isOptional:!1}}}),HS=d({meta:{key:"harness.step.blocked",version:"1.0.0",description:"Emitted when a harness step is blocked by policy.",domain:B,owners:P,tags:[...j,"step","blocked"],stability:z},payload:o});export{o as HarnessStepBlockedPayload,HS as HarnessStepBlockedEvent};
