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