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