var D=Object.defineProperty;var F=(j)=>j;function H(j,k){this[j]=F.bind(null,k)}var M=(j,k)=>{for(var q in k)D(j,q,{get:k[q],enumerable:!0,configurable:!0,set:H.bind(k,q)})};var Q=(j,k)=>()=>(j&&(k=j(j=0)),k);import{definePrompt as I,defineResourceTemplate as B,PromptRegistry as J,ResourceRegistry as K}from"@contractspec/lib.contracts-spec";import w from"zod";var L=["@contractspec"],x=["contracts","mcp"];function Y(j){let k=new K;return k.register(B({meta:{uriTemplate:"contracts://list",title:"Contract specs list",description:"JSON list of all contract specs in the workspace.",mimeType:"application/json",tags:x},input:w.object({}),resolve:async()=>{let q=await j.listSpecs();return{uri:"contracts://list",mimeType:"application/json",data:JSON.stringify(q,null,2)}}})),k.register(B({meta:{uriTemplate:"contracts://spec/{path}",title:"Contract spec content",description:"Read a single contract spec file by path.",mimeType:"text/plain",tags:x},input:w.object({path:w.string()}),resolve:async({path:q})=>{let C=await j.getSpec(q);if(!C)return{uri:`contracts://spec/${encodeURIComponent(q)}`,mimeType:"text/plain",data:`Spec not found: ${q}`};return{uri:`contracts://spec/${encodeURIComponent(q)}`,mimeType:"text/plain",data:C.content}}})),k.register(B({meta:{uriTemplate:"contracts://registry/manifest",title:"Remote registry manifest",description:"Contract registry manifest from the remote server.",mimeType:"application/json",tags:x},input:w.object({}),resolve:async()=>{let q=await j.fetchRegistryManifest();return{uri:"contracts://registry/manifest",mimeType:"application/json",data:JSON.stringify(q,null,2)}}})),k.register(B({meta:{uriTemplate:"adoption://catalog",title:"ContractSpec adoption catalog",description:"Bundled ContractSpec adoption catalog used by Connect and MCP.",mimeType:"application/json",tags:x},input:w.object({}),resolve:async()=>{let q=await j.searchAdoptionCatalog({query:"contractspec"});return{uri:"adoption://catalog",mimeType:"application/json",data:JSON.stringify(q,null,2)}}})),k.register(B({meta:{uriTemplate:"adoption://policy/{family}",title:"ContractSpec adoption policy",description:"Family-aware adoption recommendation and verdict policy.",mimeType:"application/json",tags:x},input:w.object({family:w.string()}),resolve:async({family:q})=>{let C=await j.resolveAdoption({family:q,query:q});return{uri:`adoption://policy/${encodeURIComponent(q)}`,mimeType:"application/json",data:JSON.stringify(C,null,2)}}})),k}function Z(){let j=new J;return j.register(I({meta:{key:"contracts.editor",version:"1.0.0",title:"Contract editing guide",description:"Guide AI agents through reading, editing, and validating contracts.",tags:x,stability:"beta",owners:L},args:[{name:"goal",description:"What the agent wants to achieve with the contract.",required:!1,schema:w.string().optional()}],input:w.object({goal:w.string().optional()}),render:async({goal:k})=>[{type:"text",text:["Contract editing workflow:","1. Use contracts.list to discover specs","2. Use contracts.get to read a spec","3. Edit content and call contracts.update","4. Run contracts.validate to verify changes","5. Run contracts.build to regenerate artifacts","6. Use adoption.resolve to prefer existing workspace or ContractSpec surfaces before inventing new ones",k?`Agent goal: ${k}`:""].filter(Boolean).join(`
`)},{type:"resource",uri:"contracts://list",title:"Available contracts"}]})),j}export{Y as buildContractsResources,Z as buildContractsPrompts};
