@unbrained/pm-cli 2026.9.14 → 2026.9.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +12 -0
- package/dist/cli-bundle/bundle-manifest.json +148 -148
- package/dist/cli-bundle/chunks/{chunk-5JIJAWIF.js → chunk-3AHONKLL.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DBHQIS6Z.js → chunk-3RB6Z7XE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZYRN2OG3.js → chunk-5P5PYCZX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-B6W5LIXK.js → chunk-BOZ4HVYL.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-J4DRE3WN.js +237 -0
- package/dist/cli-bundle/chunks/{chunk-GQMILIC5.js → chunk-RKPUO75B.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-O7SRS7Y3.js → chunk-RM2OGG65.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-D5AJQU7F.js → chunk-UKLOSZV6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XEV7BHH3.js → chunk-WDF7PP4P.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-A2Q64TGR.js → chunk-WLJJ4MAU.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BY3ID7QI.js → chunk-Y2P3DSSO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-NYE6EREL.js → chunk-YMMLKKEP.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-B2U36YWL.js → register-list-query-IWSPNFFD.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-GX42CQYR.js → register-mutation-3DVF4R64.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-ZV34KX5E.js → register-operations-LXP3MECQ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-W4OS7IZW.js → register-setup-KFQSNBDX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GGDO6VBT.js → chunk-4YTDKIPF.js} +17 -17
- package/dist/cli-bundle/focused-chunks/{chunk-ZFNRD7EN.js → chunk-533DCWPY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FNLAQJES.js → chunk-5SBU4QDC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-KWP3QTN7.js → chunk-63YRRGKX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-N23WTRCC.js → chunk-6C3CUU2G.js} +3 -3
- package/dist/cli-bundle/focused-chunks/{chunk-ENJH7CBZ.js → chunk-AXDAIBT3.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6WZBO4VQ.js → chunk-BMATJLPT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FHQLQOUZ.js → chunk-JKJYXCT6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-D4FQV6TY.js → chunk-MD7ADLME.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-7BUJABHB.js → chunk-OGGF2RBL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CPQQIVDL.js → chunk-PBJC2ZNA.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UFSMYVZF.js → chunk-SHF57M2H.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-C5NQVXKE.js → chunk-UACMCSCC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LFGTCEHX.js → chunk-YBQTVE5S.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-O4EROPO3.js → chunk-ZHX3433X.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZOE2NSJB.js +20 -0
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +40 -40
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/core/extensions/index.d.ts +7 -0
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/lock/lock.js +2 -2
- package/dist/core/telemetry/policy.d.ts +2 -0
- package/dist/core/telemetry/policy.js +1 -1
- package/dist/core/telemetry/read-sampling.d.ts +8 -0
- package/dist/core/telemetry/read-sampling.js +3 -0
- package/dist/core/telemetry/runtime.js +2 -2
- package/docs/CONFIGURATION.md +6 -2
- package/marketplace.json +2 -2
- package/package.json +1 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/dist/cli-bundle/chunks/chunk-33PER336.js +0 -236
- package/dist/cli-bundle/focused-chunks/chunk-CMCSUANO.js +0 -20
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Qb as x,Rb as F,Tb as b,Wb as J,Xa as B,Yb as W,Zb as V}from"./chunk-B6W5LIXK.js";import{b as K}from"./chunk-5JIJAWIF.js";import{Bd as C,D as O,Fl as j,Il as P,Mi as D,O as c,Oi as G,Q as d,ec as $,ff as U,fn as L,ln as z,oa as k,zd as N}from"./chunk-33PER336.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4175f7f5-a689-5d05-982a-f92e21bc83e7")}catch{}})();import ce from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d6ceb51a-6085-5d65-aebe-31d09ea4d1d6")}catch{}})();var R=["op","id","reason","options"],Y=[...R,"ref"],q=["schema_version","mutations"],oe="[a-z][a-z0-9._-]{0,63}",H=new RegExp(`^${oe}$`,"u"),re=new RegExp(`(^|,)id=@(${oe})(?=,|$)`,"gu"),X=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,o)=>o.toUpperCase()),E=["item","linked","schedule","claim_state","children","omission_receipt","row_contract","context_intent"],ne=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),de=new Set([...ne,"completed_at","id"]),_=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...O,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]),Z={create:j.map(e=>e.target),update:P.map(e=>e.target),close:L.map(e=>X(e.flag)).filter(e=>e!=="reason"),release:z.map(e=>X(e.flag))};function St(e){let t={},o=e.createCompensation;if(o!==void 0){if(o!=="close"&&o!=="delete")throw new d("createCompensation must be close or delete.",c.USAGE);t.createCompensation=o}for(let r of["lockTtlSeconds","lockWaitMs"]){let n=e[r];if(n===void 0)continue;let i=typeof n=="number"||typeof n=="string"&&n.trim().length>0?Number(n):Number.NaN;if(!Number.isSafeInteger(i)||i<=0)throw new d(`${r} must be a positive safe integer.`,c.USAGE);t[r]=i}return t}function p(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function g(e,t){let o=Math.max(1,Math.min(3,Math.floor(e.length/4)+1)),r;for(let n of t){let i=k(e,n,o);i!==null&&(r===void 0||i<r.distance)&&(r={key:n,distance:i})}return r?.key}function y(e,t,o){let r=g(t,o);return new d(r===void 0?`${e} does not recognize key "${t}". Allowed keys: ${o.join(", ")}.`:`${e} does not recognize key "${t}". Did you mean "${r}"?`,c.USAGE,{code:"stdin_json_unknown_key",required:`Use documented ${e} keys only.`,why:"Strict structured input prevents silent typos from creating incomplete or unintended mutations.",nextSteps:[r===void 0?`Remove or correct "${t}".`:`Replace "${t}" with "${r}".`]})}function I(e,t){try{return JSON.parse(e)}catch(o){let r=o instanceof Error?o.message:String(o);throw new d(`${t} must be valid JSON: ${r}`,c.USAGE,{code:"stdin_json_invalid",required:`Pipe one valid JSON ${t.toLowerCase()} into stdin.`,why:"Structured mutation input must parse deterministically before any tracker write begins."})}}function ue(e,t){if(!p(e))throw new d(`Mutation ${t+1} must be an object.`,c.USAGE);for(let o of Object.keys(e))if(!R.includes(o))throw y(`mutation ${t+1}`,o,R);return e}function pe(e,t,o){if(e!==void 0){if(!p(e))throw new d(`Mutation ${o+1} options must be an object.`,c.USAGE);for(let r of Object.keys(e))if(!Z[t].includes(r))throw y(`mutation ${o+1} ${t} options`,r,Z[t]);return e}}function le(e,t){let o=ue(e,t),{op:r,id:n,reason:i}=o;if(r!=="create"&&r!=="update"&&r!=="close"&&r!=="release")throw new d(`Mutation ${t+1} op must be create, update, close, or release.`,c.USAGE);let s=pe(o.options,r,t);if(typeof n!="string"||n.trim().length===0)throw new d(`Mutation ${t+1} requires a non-empty id.`,c.USAGE);let a=n.trim();if(r==="close"){if(typeof i!="string"||i.trim().length===0)throw new d(`Mutation ${t+1} close requires a non-empty reason.`,c.USAGE);return{op:r,id:a,reason:i.trim(),...s===void 0?{}:{options:s}}}if(r==="release")return{op:r,id:a,...s===void 0?{}:{options:s}};if(!p(s))throw new d(`Mutation ${t+1} ${r} requires an options object.`,c.USAGE);return{op:r,id:a,options:s}}function ie(e){let t=I(e,"Mutation batch"),o=Array.isArray(t)?t:p(t)&&Array.isArray(t.mutations)?t.mutations:void 0;if(o===void 0||o.length===0)throw new d("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.",c.USAGE);return o.map((r,n)=>{let i=le(r,n);return i.options!==void 0&&N(i.options),i})}function me(e,t,o){let r=ce.createHash("sha256").update(e).update("\0").update(t).digest("hex"),n=BigInt(`0x${r.slice(0,16)}`).toString(36).padStart(13,"0").slice(-12);return`${D(o)}${n}`}function Q(e,t){if(typeof e!="string"||!e.startsWith("@"))return e;let o=e.slice(1),r=t[o];if(r===void 0)throw new d(`Unknown mutation reference "${e}".`,c.USAGE);return r}function ee(e,t){if(typeof e!="string")return e;let o=e.replace(re,(r,n,i)=>{let s=t[i];if(s===void 0)throw new d(`Unknown mutation reference "@${i}".`,c.USAGE);return`${n}id=${s}`});if(/(^|,)id=@/u.test(o))throw new d(`Malformed mutation reference in dependency "${e}".`,c.USAGE);return o}function fe(e){return typeof e!="string"?[]:e.startsWith("@")?[e.slice(1)]:[...e.matchAll(re)].map(t=>t[1]).filter(t=>t!==void 0)}function ye(e){let t=new Map;for(let i of e){if(i.op!=="create"||typeof i.ref!="string")continue;let s=p(i.options)?i.options:{},a=Array.isArray(s.dep)?s.dep:s.dep===void 0?[]:[s.dep];t.set(i.ref,[s.parent,s.blockedBy,...a].flatMap(fe))}let o=new Set,r=new Set,n=i=>{if(o.has(i))throw new d(`Mutation reference cycle includes "@${i}".`,c.USAGE);if(!r.has(i)){o.add(i);for(let s of t.get(i))t.has(s)&&n(s);o.delete(i),r.add(i)}};for(let i of t.keys())n(i)}function he(e){let t=I(e,"Mutation document"),o=Array.isArray(t)?{schema_version:1,mutations:t}:t;if(!p(o))throw new d("Mutation document must be a JSON array or object.",c.USAGE);for(let r of Object.keys(o))if(!q.includes(r))throw y("mutation document",r,q);if(o.schema_version!==void 0&&o.schema_version!==1)throw new d("Mutation document schema_version must be 1.",c.USAGE);if(!Array.isArray(o.mutations)||o.mutations.length===0)throw new d("Mutation document requires a non-empty mutations array.",c.USAGE);return o.mutations.map((r,n)=>{if(!p(r))throw new d(`Mutation ${n+1} must be an object.`,c.USAGE);for(let i of Object.keys(r))if(!Y.includes(i))throw y(`mutation ${n+1}`,i,Y);return{...r}})}function we(e,t){let o=Object.create(null);for(let[r,n]of e.entries())if(n.ref!==void 0){if(n.op!=="create")throw new d(`Mutation ${r+1} ref is only valid for create operations.`,c.USAGE);if(typeof n.ref!="string"||!H.test(n.ref))throw new d(`Mutation ${r+1} ref must match ${H.source}.`,c.USAGE);if(o[n.ref]!==void 0)throw new d(`Duplicate mutation ref "${n.ref}".`,c.USAGE);o[n.ref]=typeof n.id=="string"&&n.id.trim().length>0?G(n.id,t.idPrefix):me(t.transactionId,n.ref,t.idPrefix)}return o}function bt(e,t){let o=he(e),r=we(o,t);ye(o);let n=o.map(a=>{let u={...a},f=typeof u.ref=="string"?u.ref:void 0;if(delete u.ref,f!==void 0?u.id=r[f]:u.id=Q(u.id,r),p(u.options)){let l={...u.options};for(let w of["parent","blockedBy"])l[w]!==void 0&&(l[w]=Q(l[w],r));Array.isArray(l.dep)?l.dep=l.dep.map(w=>ee(w,r)):l.dep!==void 0&&(l.dep=ee(l.dep,r)),u.options=l}return u}),i=ie(JSON.stringify(n)),s=i.filter(a=>a.op==="create").map(a=>a.id);if(new Set(s).size!==s.length)throw new d("Duplicate resolved create id in mutation document.",c.USAGE);return{schema_version:1,mutations:i,references:r}}function se(e,t){return t.filter(o=>e[o]!==void 0&&e[o]!==null).map(o=>{let r=String(e[o]);return`${o}=${/[",\n\r\\]/u.test(r)?JSON.stringify(r):r}`}).join(",")}function _e(e,t,o){if(e!==void 0){if(!Array.isArray(e)||!e.every(p))throw new d(`${o} must be an array of objects.`,c.USAGE);return e.map(r=>se(r,t))}}function Ee(e,t){return e==="tags"&&Array.isArray(t)&&t.every(o=>typeof o=="string")?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"?String(t):t}function te(e,t,o=!1){let r=[["dependencies","dep",["id","kind","created_at","author","source_kind"]],["comments","comment",["text","created_at","author"]],["notes","note",["text","created_at","author"]],["learnings","learning",["text","created_at","author"]],["files","file",["path","scope","note"]],["tests","test",["command","scope","timeout_seconds"]],["docs","doc",["path","scope","note"]],["reminders","reminder",["at","text","created_at"]],["events","event",["start_at","end_at","title","location"]],["type_options","typeOption",["key","value"]]];for(let[n,i,s]of r){let a=t[n],u=_e(o&&["comments","notes","learnings"].includes(n)&&Array.isArray(a)?a.filter(f=>!p(f)||f.created_at===void 0):a,s,n);u!==void 0&&u.length>0&&(e[i]=u)}}function ge(e,t){for(let o of Object.keys(e)){if(t){if(!E.includes(o))throw y("item envelope",o,E);continue}if(!_.has(o)&&g(o,[..._])===void 0&&g(o,E)==="item")throw y("item envelope",o,E)}}function Ae(e){let t=Object.hasOwn(e,"item");ge(e,t);let o=t?e.item:e;if(!p(o))throw new d("Item document item must be an object.",c.USAGE);return{item:o,...t&&p(e.linked)?{linked:e.linked}:{}}}function Te(e,t,o,r){if(!(r==="update"?de:ne).has(t)){if(!_.has(t)){if(g(t,[..._])!==void 0)throw y("item document",t,[..._]);let s=Array.isArray(e.field)?e.field:[];s.push(se({key:t,value:typeof o=="string"?o:JSON.stringify(o)},["key","value"])),e.field=s;return}["dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"].includes(t)||(e[t.replaceAll(/_([a-z])/gu,(i,s)=>s.toUpperCase())]=Ee(t,o))}}function Rt(e,t,o={}){let r=I(e,"Item document");if(!p(r))throw new d("Item document must be a JSON object.",c.USAGE);let{item:n,linked:i}=Ae(r),s={};for(let[a,u]of Object.entries(n))Te(s,a,u,t);return te(s,n,t==="update"),i!==void 0&&te(s,i),{...s,...Object.fromEntries(Object.entries(o).filter(([,a])=>a!==void 0)),stdinJson:void 0}}function It(e){return ie(JSON.stringify(e))}import Se from"node:crypto";import be from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4b7656bd-36a9-5b97-971f-60f717e8e81f")}catch{}})();function A(e,t){let o={...e,...t};return e===void 0?o:C(e,o)}async function m(e,t){try{let r=(await B(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(o){if(o instanceof d&&o.exitCode===c.NOT_FOUND)return;throw o}}function v(e,t){let o=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=Se.createHash("sha256").update($(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${o}-${r}`}function Re(e,t){let o=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${o}`}function h(e,t,o){return`bulk-item-transaction ${e} ${t} ${o}`}async function T(e,t,o,r){let n=await U(be.join(e,"history",`${t}.jsonl`),t),i=h(o,r,"apply"),s=h(o,r,"compensate");for(let a=n.length-1;a>=0;a-=1){let u=n[a].message;if(u===i)return!0;if(u===s)return!1}return!1}async function M(e,t){let o=await m(e,t.id);if(o?.updatedAt===void 0)throw new d(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,c.NOT_FOUND);return{target_updated_at:o.updatedAt}}async function S(e,t,o,r){let n=r!==null&&typeof r=="object"&&!Array.isArray(r)?r.target_updated_at:void 0;typeof n=="string"&&await m(e.pmRoot,t)!==void 0&&await V(t,n,{force:!0,author:e.author,message:h(e.transactionId,o,"compensate")},{pmRoot:e.pmRoot})}function ae(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"create"}}},async apply(){let n=(await x(A(t.options,{author:e.author,id:t.id}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"create"}},async compensate(){let r=await m(e.pmRoot,t.id);if(r!==void 0){if(e.createCompensation==="delete"){await W(t.id,{force:!0,author:e.author,message:`Compensate interrupted bulk transaction ${e.transactionId}`},{pmRoot:e.pmRoot});return}r.closedAt===void 0&&await b(t.id,`Compensated: interrupted bulk transaction ${e.transactionId}`,{force:!0,author:e.author},{pmRoot:e.pmRoot})}}}}function Ie(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await T(e.pmRoot,r.id,e.transactionId,o)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let n=(await F(t.id,A(t.options,{author:e.author,message:h(e.transactionId,o,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"update"}},async compensate(r){await S(e,t.id,o,r)}}}function ve(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await T(e.pmRoot,r.id,e.transactionId,o)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let n=(await b(t.id,t.reason,A(t.options,{author:e.author,message:h(e.transactionId,o,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"close"}},async compensate(r){await S(e,t.id,o,r)}}}function Me(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await T(e.pmRoot,r.id,e.transactionId,o)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let n=(await J(t.id,A(t.options,{author:e.author,message:h(e.transactionId,o,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"release"}},async compensate(r){await S(e,t.id,o,r)}}}function Oe(e,t,o){let r=v(t,o);switch(t.op){case"create":return ae(e,t,r);case"update":return Ie(e,t,r);case"close":return ve(e,t,r);case"release":return Me(e,t,r)}}function ke(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`)}async function $e(e){let t=[...e.mutations];if(t.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");for(let[s,a]of t.entries())ke(a,s);let o=e.createCompensation??"close";if(!["close","delete"].includes(o))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let r={pmRoot:e.pmRoot,author:e.author,transactionId:e.transactionId,createCompensation:o},n=await K({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,steps:t.map((s,a)=>Oe(r,s,a)),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),i={};for(let[s,a]of t.entries()){let u=v(a,s),f=n.results[u];i[Re(a,s)]=f}return{transactionId:n.transactionId,status:"committed",recovered:n.recovered,results:i}}function Ne(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function jt(e){return $e({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:Ne(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Pt={buildCreateStep:ae,bulkHistoryMarker:h,compensateByRestore:S,deriveStepId:v,isUpdateMarkerApplied:T,readItemSnapshot:m};export{St as a,ie as b,bt as c,Rt as d,It as e,$e as f,Ne as g,jt as h,Pt as i};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{Qb as x,Rb as F,Tb as b,Wb as J,Xa as B,Yb as W,Zb as V}from"./chunk-BOZ4HVYL.js";import{b as K}from"./chunk-3AHONKLL.js";import{Bd as C,D as O,Fl as j,Il as P,Mi as D,O as c,Oi as G,Q as d,ec as $,ff as U,fn as L,ln as z,oa as k,zd as N}from"./chunk-J4DRE3WN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4175f7f5-a689-5d05-982a-f92e21bc83e7")}catch{}})();import ce from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d6ceb51a-6085-5d65-aebe-31d09ea4d1d6")}catch{}})();var R=["op","id","reason","options"],Y=[...R,"ref"],q=["schema_version","mutations"],oe="[a-z][a-z0-9._-]{0,63}",H=new RegExp(`^${oe}$`,"u"),re=new RegExp(`(^|,)id=@(${oe})(?=,|$)`,"gu"),X=e=>e.slice(2).replaceAll(/-([a-z])/gu,(t,o)=>o.toUpperCase()),E=["item","linked","schedule","claim_state","children","omission_receipt","row_contract","context_intent"],ne=new Set(["created_at","updated_at","closed_at","version","format_version","path","author","collection_counts","notes_count","tests_count"]),de=new Set([...ne,"completed_at","id"]),_=new Set(["id","title","description","type","status","priority","tags","body","deadline","estimated_minutes","acceptance_criteria","definition_of_ready","order","rank","assignee",...O,"affected_version","fixed_version","component","regression","customer_impact","close_reason","completed_at","dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"]),Z={create:j.map(e=>e.target),update:P.map(e=>e.target),close:L.map(e=>X(e.flag)).filter(e=>e!=="reason"),release:z.map(e=>X(e.flag))};function St(e){let t={},o=e.createCompensation;if(o!==void 0){if(o!=="close"&&o!=="delete")throw new d("createCompensation must be close or delete.",c.USAGE);t.createCompensation=o}for(let r of["lockTtlSeconds","lockWaitMs"]){let n=e[r];if(n===void 0)continue;let i=typeof n=="number"||typeof n=="string"&&n.trim().length>0?Number(n):Number.NaN;if(!Number.isSafeInteger(i)||i<=0)throw new d(`${r} must be a positive safe integer.`,c.USAGE);t[r]=i}return t}function p(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function g(e,t){let o=Math.max(1,Math.min(3,Math.floor(e.length/4)+1)),r;for(let n of t){let i=k(e,n,o);i!==null&&(r===void 0||i<r.distance)&&(r={key:n,distance:i})}return r?.key}function y(e,t,o){let r=g(t,o);return new d(r===void 0?`${e} does not recognize key "${t}". Allowed keys: ${o.join(", ")}.`:`${e} does not recognize key "${t}". Did you mean "${r}"?`,c.USAGE,{code:"stdin_json_unknown_key",required:`Use documented ${e} keys only.`,why:"Strict structured input prevents silent typos from creating incomplete or unintended mutations.",nextSteps:[r===void 0?`Remove or correct "${t}".`:`Replace "${t}" with "${r}".`]})}function I(e,t){try{return JSON.parse(e)}catch(o){let r=o instanceof Error?o.message:String(o);throw new d(`${t} must be valid JSON: ${r}`,c.USAGE,{code:"stdin_json_invalid",required:`Pipe one valid JSON ${t.toLowerCase()} into stdin.`,why:"Structured mutation input must parse deterministically before any tracker write begins."})}}function ue(e,t){if(!p(e))throw new d(`Mutation ${t+1} must be an object.`,c.USAGE);for(let o of Object.keys(e))if(!R.includes(o))throw y(`mutation ${t+1}`,o,R);return e}function pe(e,t,o){if(e!==void 0){if(!p(e))throw new d(`Mutation ${o+1} options must be an object.`,c.USAGE);for(let r of Object.keys(e))if(!Z[t].includes(r))throw y(`mutation ${o+1} ${t} options`,r,Z[t]);return e}}function le(e,t){let o=ue(e,t),{op:r,id:n,reason:i}=o;if(r!=="create"&&r!=="update"&&r!=="close"&&r!=="release")throw new d(`Mutation ${t+1} op must be create, update, close, or release.`,c.USAGE);let s=pe(o.options,r,t);if(typeof n!="string"||n.trim().length===0)throw new d(`Mutation ${t+1} requires a non-empty id.`,c.USAGE);let a=n.trim();if(r==="close"){if(typeof i!="string"||i.trim().length===0)throw new d(`Mutation ${t+1} close requires a non-empty reason.`,c.USAGE);return{op:r,id:a,reason:i.trim(),...s===void 0?{}:{options:s}}}if(r==="release")return{op:r,id:a,...s===void 0?{}:{options:s}};if(!p(s))throw new d(`Mutation ${t+1} ${r} requires an options object.`,c.USAGE);return{op:r,id:a,options:s}}function ie(e){let t=I(e,"Mutation batch"),o=Array.isArray(t)?t:p(t)&&Array.isArray(t.mutations)?t.mutations:void 0;if(o===void 0||o.length===0)throw new d("Mutation batch must be a non-empty JSON array or an object with a non-empty mutations array.",c.USAGE);return o.map((r,n)=>{let i=le(r,n);return i.options!==void 0&&N(i.options),i})}function me(e,t,o){let r=ce.createHash("sha256").update(e).update("\0").update(t).digest("hex"),n=BigInt(`0x${r.slice(0,16)}`).toString(36).padStart(13,"0").slice(-12);return`${D(o)}${n}`}function Q(e,t){if(typeof e!="string"||!e.startsWith("@"))return e;let o=e.slice(1),r=t[o];if(r===void 0)throw new d(`Unknown mutation reference "${e}".`,c.USAGE);return r}function ee(e,t){if(typeof e!="string")return e;let o=e.replace(re,(r,n,i)=>{let s=t[i];if(s===void 0)throw new d(`Unknown mutation reference "@${i}".`,c.USAGE);return`${n}id=${s}`});if(/(^|,)id=@/u.test(o))throw new d(`Malformed mutation reference in dependency "${e}".`,c.USAGE);return o}function fe(e){return typeof e!="string"?[]:e.startsWith("@")?[e.slice(1)]:[...e.matchAll(re)].map(t=>t[1]).filter(t=>t!==void 0)}function ye(e){let t=new Map;for(let i of e){if(i.op!=="create"||typeof i.ref!="string")continue;let s=p(i.options)?i.options:{},a=Array.isArray(s.dep)?s.dep:s.dep===void 0?[]:[s.dep];t.set(i.ref,[s.parent,s.blockedBy,...a].flatMap(fe))}let o=new Set,r=new Set,n=i=>{if(o.has(i))throw new d(`Mutation reference cycle includes "@${i}".`,c.USAGE);if(!r.has(i)){o.add(i);for(let s of t.get(i))t.has(s)&&n(s);o.delete(i),r.add(i)}};for(let i of t.keys())n(i)}function he(e){let t=I(e,"Mutation document"),o=Array.isArray(t)?{schema_version:1,mutations:t}:t;if(!p(o))throw new d("Mutation document must be a JSON array or object.",c.USAGE);for(let r of Object.keys(o))if(!q.includes(r))throw y("mutation document",r,q);if(o.schema_version!==void 0&&o.schema_version!==1)throw new d("Mutation document schema_version must be 1.",c.USAGE);if(!Array.isArray(o.mutations)||o.mutations.length===0)throw new d("Mutation document requires a non-empty mutations array.",c.USAGE);return o.mutations.map((r,n)=>{if(!p(r))throw new d(`Mutation ${n+1} must be an object.`,c.USAGE);for(let i of Object.keys(r))if(!Y.includes(i))throw y(`mutation ${n+1}`,i,Y);return{...r}})}function we(e,t){let o=Object.create(null);for(let[r,n]of e.entries())if(n.ref!==void 0){if(n.op!=="create")throw new d(`Mutation ${r+1} ref is only valid for create operations.`,c.USAGE);if(typeof n.ref!="string"||!H.test(n.ref))throw new d(`Mutation ${r+1} ref must match ${H.source}.`,c.USAGE);if(o[n.ref]!==void 0)throw new d(`Duplicate mutation ref "${n.ref}".`,c.USAGE);o[n.ref]=typeof n.id=="string"&&n.id.trim().length>0?G(n.id,t.idPrefix):me(t.transactionId,n.ref,t.idPrefix)}return o}function bt(e,t){let o=he(e),r=we(o,t);ye(o);let n=o.map(a=>{let u={...a},f=typeof u.ref=="string"?u.ref:void 0;if(delete u.ref,f!==void 0?u.id=r[f]:u.id=Q(u.id,r),p(u.options)){let l={...u.options};for(let w of["parent","blockedBy"])l[w]!==void 0&&(l[w]=Q(l[w],r));Array.isArray(l.dep)?l.dep=l.dep.map(w=>ee(w,r)):l.dep!==void 0&&(l.dep=ee(l.dep,r)),u.options=l}return u}),i=ie(JSON.stringify(n)),s=i.filter(a=>a.op==="create").map(a=>a.id);if(new Set(s).size!==s.length)throw new d("Duplicate resolved create id in mutation document.",c.USAGE);return{schema_version:1,mutations:i,references:r}}function se(e,t){return t.filter(o=>e[o]!==void 0&&e[o]!==null).map(o=>{let r=String(e[o]);return`${o}=${/[",\n\r\\]/u.test(r)?JSON.stringify(r):r}`}).join(",")}function _e(e,t,o){if(e!==void 0){if(!Array.isArray(e)||!e.every(p))throw new d(`${o} must be an array of objects.`,c.USAGE);return e.map(r=>se(r,t))}}function Ee(e,t){return e==="tags"&&Array.isArray(t)&&t.every(o=>typeof o=="string")?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"?String(t):t}function te(e,t,o=!1){let r=[["dependencies","dep",["id","kind","created_at","author","source_kind"]],["comments","comment",["text","created_at","author"]],["notes","note",["text","created_at","author"]],["learnings","learning",["text","created_at","author"]],["files","file",["path","scope","note"]],["tests","test",["command","scope","timeout_seconds"]],["docs","doc",["path","scope","note"]],["reminders","reminder",["at","text","created_at"]],["events","event",["start_at","end_at","title","location"]],["type_options","typeOption",["key","value"]]];for(let[n,i,s]of r){let a=t[n],u=_e(o&&["comments","notes","learnings"].includes(n)&&Array.isArray(a)?a.filter(f=>!p(f)||f.created_at===void 0):a,s,n);u!==void 0&&u.length>0&&(e[i]=u)}}function ge(e,t){for(let o of Object.keys(e)){if(t){if(!E.includes(o))throw y("item envelope",o,E);continue}if(!_.has(o)&&g(o,[..._])===void 0&&g(o,E)==="item")throw y("item envelope",o,E)}}function Ae(e){let t=Object.hasOwn(e,"item");ge(e,t);let o=t?e.item:e;if(!p(o))throw new d("Item document item must be an object.",c.USAGE);return{item:o,...t&&p(e.linked)?{linked:e.linked}:{}}}function Te(e,t,o,r){if(!(r==="update"?de:ne).has(t)){if(!_.has(t)){if(g(t,[..._])!==void 0)throw y("item document",t,[..._]);let s=Array.isArray(e.field)?e.field:[];s.push(se({key:t,value:typeof o=="string"?o:JSON.stringify(o)},["key","value"])),e.field=s;return}["dependencies","comments","notes","learnings","files","tests","docs","reminders","events","type_options"].includes(t)||(e[t.replaceAll(/_([a-z])/gu,(i,s)=>s.toUpperCase())]=Ee(t,o))}}function Rt(e,t,o={}){let r=I(e,"Item document");if(!p(r))throw new d("Item document must be a JSON object.",c.USAGE);let{item:n,linked:i}=Ae(r),s={};for(let[a,u]of Object.entries(n))Te(s,a,u,t);return te(s,n,t==="update"),i!==void 0&&te(s,i),{...s,...Object.fromEntries(Object.entries(o).filter(([,a])=>a!==void 0)),stdinJson:void 0}}function It(e){return ie(JSON.stringify(e))}import Se from"node:crypto";import be from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4b7656bd-36a9-5b97-971f-60f717e8e81f")}catch{}})();function A(e,t){let o={...e,...t};return e===void 0?o:C(e,o)}async function m(e,t){try{let r=(await B(t,{},{pmRoot:e})).item;return{id:r.id,closedAt:r.closed_at,updatedAt:r.updated_at,assignee:r.assignee,claimPrincipal:r.claim_principal}}catch(o){if(o instanceof d&&o.exitCode===c.NOT_FOUND)return;throw o}}function v(e,t){let o=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_"),r=Se.createHash("sha256").update($(e)).digest("hex").slice(0,12);return`${t+1}-${e.op}-${o}-${r}`}function Re(e,t){let o=e.id.replaceAll(/[^a-zA-Z0-9._-]/gu,"_");return`${t+1}-${e.op}-${o}`}function h(e,t,o){return`bulk-item-transaction ${e} ${t} ${o}`}async function T(e,t,o,r){let n=await U(be.join(e,"history",`${t}.jsonl`),t),i=h(o,r,"apply"),s=h(o,r,"compensate");for(let a=n.length-1;a>=0;a-=1){let u=n[a].message;if(u===i)return!0;if(u===s)return!1}return!1}async function M(e,t){let o=await m(e,t.id);if(o?.updatedAt===void 0)throw new d(`Bulk ${t.op} target ${t.id} does not exist or has no restorable version`,c.NOT_FOUND);return{target_updated_at:o.updatedAt}}async function S(e,t,o,r){let n=r!==null&&typeof r=="object"&&!Array.isArray(r)?r.target_updated_at:void 0;typeof n=="string"&&await m(e.pmRoot,t)!==void 0&&await V(t,n,{force:!0,author:e.author,message:h(e.transactionId,o,"compensate")},{pmRoot:e.pmRoot})}function ae(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"create"}}},async apply(){let n=(await x(A(t.options,{author:e.author,id:t.id}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"create"}},async compensate(){let r=await m(e.pmRoot,t.id);if(r!==void 0){if(e.createCompensation==="delete"){await W(t.id,{force:!0,author:e.author,message:`Compensate interrupted bulk transaction ${e.transactionId}`},{pmRoot:e.pmRoot});return}r.closedAt===void 0&&await b(t.id,`Compensated: interrupted bulk transaction ${e.transactionId}`,{force:!0,author:e.author},{pmRoot:e.pmRoot})}}}}function Ie(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await T(e.pmRoot,r.id,e.transactionId,o)?{state:"applied",result:{id:r.id,op:"update"}}:{state:"pending"}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let n=(await F(t.id,A(t.options,{author:e.author,message:h(e.transactionId,o,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"update"}},async compensate(r){await S(e,t.id,o,r)}}}function ve(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await T(e.pmRoot,r.id,e.transactionId,o)?{state:"applied",result:{id:r.id,op:"close"}}:r.closedAt===void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"close"}}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let n=(await b(t.id,t.reason,A(t.options,{author:e.author,message:h(e.transactionId,o,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"close"}},async compensate(r){await S(e,t.id,o,r)}}}function Me(e,t,o){return{id:o,async inspect(){let r=await m(e.pmRoot,t.id);return r===void 0?{state:"pending"}:await T(e.pmRoot,r.id,e.transactionId,o)?{state:"applied",result:{id:r.id,op:"release"}}:r.assignee!==void 0||r.claimPrincipal!==void 0?{state:"pending"}:{state:"applied",result:{id:r.id,op:"release"}}},async prepareCompensation(){return M(e.pmRoot,t)},async apply(){let n=(await J(t.id,A(t.options,{author:e.author,message:h(e.transactionId,o,"apply")}),{pmRoot:e.pmRoot})).item;return{id:String(n.id),op:"release"}},async compensate(r){await S(e,t.id,o,r)}}}function Oe(e,t,o){let r=v(t,o);switch(t.op){case"create":return ae(e,t,r);case"update":return Ie(e,t,r);case"close":return ve(e,t,r);case"release":return Me(e,t,r)}}function ke(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`Bulk mutation ${t+1} must be an object`);if(!["create","update","close","release"].includes(e.op))throw new TypeError(`Bulk mutation ${t+1} op must be create, update, close, or release`);if(typeof e.id!="string"||e.id.trim().length===0)throw new TypeError(`Bulk mutation ${t+1} requires a non-empty id`);if(e.op==="close"&&(typeof e.reason!="string"||e.reason.trim().length===0))throw new TypeError(`Bulk close mutation ${t+1} requires a non-empty reason`)}async function $e(e){let t=[...e.mutations];if(t.length===0)throw new TypeError("Bulk item transaction requires at least one mutation");for(let[s,a]of t.entries())ke(a,s);let o=e.createCompensation??"close";if(!["close","delete"].includes(o))throw new TypeError("Bulk item transaction createCompensation must be close or delete");let r={pmRoot:e.pmRoot,author:e.author,transactionId:e.transactionId,createCompensation:o},n=await K({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,steps:t.map((s,a)=>Oe(r,s,a)),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}}),i={};for(let[s,a]of t.entries()){let u=v(a,s),f=n.results[u];i[Re(a,s)]=f}return{transactionId:n.transactionId,status:"committed",recovered:n.recovered,results:i}}function Ne(e){let t=[];return e.evidence!==void 0&&Object.keys(e.evidence).length>0&&t.push({op:"update",id:e.id,options:e.evidence}),t.push({op:"close",id:e.id,reason:e.reason,...e.closeOptions===void 0?{}:{options:e.closeOptions}},{op:"release",id:e.id,...e.releaseOptions===void 0?{}:{options:e.releaseOptions}}),t}function jt(e){return $e({pmRoot:e.pmRoot,transactionId:e.transactionId,author:e.author,mutations:Ne(e),...e.lockTtlSeconds===void 0?{}:{lockTtlSeconds:e.lockTtlSeconds},...e.lockWaitMs===void 0?{}:{lockWaitMs:e.lockWaitMs},...e.onTransition===void 0?{}:{onTransition:e.onTransition}})}var Pt={buildCreateStep:ae,bulkHistoryMarker:h,compensateByRestore:S,deriveStepId:v,isUpdateMarkerApplied:T,readItemSnapshot:m};export{St as a,ie as b,bt as c,Rt as d,It as e,$e as f,Ne as g,jt as h,Pt as i};
|
|
2
|
+
//# sourceMappingURL=chunk-3RB6Z7XE.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{$ as le,Sa as pe,f as ce}from"./chunk-B6W5LIXK.js";import{Aa as fe,h as R}from"./chunk-5JIJAWIF.js";import{Ac as oe,C,Db as v,Eb as D,Fb as H,Gb as L,Gc as ie,Hb as K,Rb as x,Sb as q,X as b,Y as B,dc as U,hc as V,hd as se,ic as z,jc as W,kc as G,lc as Y,mc as X,md as ae,nc as J,nd as de,oc as Q,od as me,pc as Z,qc as ee,rc as re,sc as te,zc as ne}from"./chunk-33PER336.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="c06f3fb3-4b1f-5fdb-a9ce-bce8f88704aa")}catch{}})();function Ir(r){return r}function Mr(r){return r}function Ce(r,e){for(let t of e.commands??[])r.registerCommand(t);for(let[t,n]of Object.entries(e.commandOverrides??{}))r.registerCommand(t,n);for(let[t,n]of Object.entries(e.flags??{}))r.registerFlags(t,n);for(let[t,n]of Object.entries(e.parsers??{}))r.registerParser(t,n);for(let[t,n]of Object.entries(e.renderers??{}))if(typeof n=="function")r.registerRenderer(t,n);else{let{run:s,...o}=n;r.registerRenderer(t,s,o)}for(let[t,n]of Object.entries(e.services??{}))r.registerService(t,n)}function Re(r,e){for(let o of e.preflights??[])r.registerPreflight(o);let t=e.itemTypes??[];t.length>0&&r.registerItemTypes(t);let n=e.itemFields??[];n.length>0&&r.registerItemFields(n);let s=e.relationshipKinds??[];s.length>0&&r.registerRelationshipKinds(s);for(let o of e.migrations??[])r.registerMigration(o);for(let o of e.profiles??[])r.registerProfile(o)}function Ne(r,e){for(let t of e.searchProviders??[])r.registerSearchProvider(t);for(let t of e.vectorStoreAdapters??[])r.registerVectorStoreAdapter(t);for(let t of e.assuranceProviders??[])r.registerAssuranceMeasurementProvider(t);for(let t of e.importers??[])r.registerImporter(t.name,t.importer,t.options);for(let t of e.exporters??[])r.registerExporter(t.name,t.exporter,t.options)}function Se(r,e){for(let t of e.beforeCommand??[])r.hooks.beforeCommand(t);for(let t of e.beforeMutation??[])r.hooks.beforeMutation(t);for(let t of e.afterCommand??[])r.hooks.afterCommand(t);for(let t of e.onWrite??[])r.hooks.onWrite(t);for(let t of e.onRead??[])r.hooks.onRead(t);for(let t of e.onIndex??[])r.hooks.onIndex(t)}function Oe(r){let t={activate:async n=>{Ce(n,r),Re(n,r),Ne(n,r),Se(n,r.hooks??{}),await r.activate?.(n)}};return r.manifest&&(t.manifest=r.manifest),r.deactivate&&(t.deactivate=r.deactivate),t}function h(r){let e=r.flatMap(t=>t??[]);return e.length>0?e:void 0}function _(r){let e=Object.assign({},...r.map(t=>t??{}));return Object.keys(e).length>0?e:void 0}function Ae(r){let e={};for(let t of r)for(let[n,s]of Object.entries(t??{}))e[n]=[...e[n]??[],...s];return Object.keys(e).length>0?e:void 0}var Fe=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function Pe(r,e,t){let n=e.map(o=>o?.[t]),s=h(n);if(s!==void 0){let o=r;o[t]=s}}function Te(r){let e={};for(let t of Fe)Pe(e,r,t);return Object.keys(e).length>0?e:void 0}function jr(...r){let e={},t=(i,a)=>{a!==void 0&&(e[i]=a)};t("commands",h(r.map(i=>i.commands))),t("commandOverrides",_(r.map(i=>i.commandOverrides))),t("flags",Ae(r.map(i=>i.flags))),t("parsers",_(r.map(i=>i.parsers))),t("renderers",_(r.map(i=>i.renderers))),t("services",_(r.map(i=>i.services))),t("preflights",h(r.map(i=>i.preflights))),t("itemTypes",h(r.map(i=>i.itemTypes))),t("itemFields",h(r.map(i=>i.itemFields))),t("relationshipKinds",h(r.map(i=>i.relationshipKinds))),t("migrations",h(r.map(i=>i.migrations))),t("profiles",h(r.map(i=>i.profiles))),t("searchProviders",h(r.map(i=>i.searchProviders))),t("vectorStoreAdapters",h(r.map(i=>i.vectorStoreAdapters))),t("assuranceProviders",h(r.map(i=>i.assuranceProviders))),t("importers",h(r.map(i=>i.importers))),t("exporters",h(r.map(i=>i.exporters))),t("hooks",Te(r.map(i=>i.hooks)));let n;for(let i of r)i.manifest&&(n=i.manifest);t("manifest",n);let s=r.some(i=>i.activate);t("activate",s?async i=>{for(let a of r)a.activate&&await a.activate(i)}:void 0);let o=r.some(i=>i.deactivate);return t("deactivate",o?async()=>{let i=[];for(let a of[...r].reverse())if(a.deactivate)try{await a.deactivate()}catch(d){i.push(d)}if(i.length>0)throw i.length>1?new AggregateError(i,"Multiple extension blueprint deactivate hooks failed."):i[0]}:void 0),e}var Ie=[["commands","commands"],["commandOverrides","commands"],["flags","schema"],["itemTypes","schema"],["itemFields","schema"],["relationshipKinds","schema"],["migrations","schema"],["profiles","schema"],["parsers","parser"],["renderers","renderers"],["services","services"],["preflights","preflight"],["searchProviders","search"],["vectorStoreAdapters","search"],["assuranceProviders","services"],["importers","importers"],["exporters","importers"]];function $(r){return r?Array.isArray(r)?r.length>0:Object.keys(r).length>0:!1}function N(r){let e=new Set;for(let[s,o]of Ie)$(r[s])&&e.add(o);(r.commands??[]).filter(w).some(s=>s.flags!==void 0)&&e.add("schema");let t=[...r.importers??[],...r.exporters??[]].filter(w);t.some(s=>s?.options?.flags!==void 0)&&e.add("schema"),t.some(s=>typeof s=="object")&&e.add("commands");let n=r.hooks??{};return[n.beforeCommand,n.beforeMutation,n.afterCommand,n.onWrite,n.onRead,n.onIndex].some($)&&e.add("hooks"),[...e].sort((s,o)=>s.localeCompare(o))}var Me=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function l(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function w(r){return r!=null}function S(r){return v(`${r.name} import`)}function O(r){return v(`${r.name} export`)}function je(r,e,t){return[...r.map(n=>v(n.name)),...e.filter(n=>n.options!==void 0).map(S),...t.filter(n=>n.options!==void 0).map(O)]}function Be(r,e,t,n){return[...Object.keys(r.flags??{}).map(s=>v(s)),...e.filter(s=>s.flags!==void 0).map(s=>v(s.name)),...t.filter(s=>s.options?.flags!==void 0).map(S),...n.filter(s=>s.options?.flags!==void 0).map(O)]}function De(r){return Me.filter(([e])=>(r[e]?.length??0)>0).map(([,e])=>e)}function He(r){let e=Object.entries(r??{}).filter(([,t])=>typeof t!="function"&&((t.commands?.length??0)>0||t.resultDiscriminator!==void 0)).map(([t,n])=>{let s=n;return{format:t,commands:l((s.commands??[]).map(o=>v(o))),result_discriminator:s.resultDiscriminator!==void 0}}).sort((t,n)=>t.format.localeCompare(n.format));return e.length>0?{renderer_ownership:e}:{}}function Le(r){return!r||r.length===0?{}:{assurance_providers:l(r.map(e=>e.id))}}function Ke(r,e,t){return{item_types:l((r.itemTypes??[]).map(n=>n.name)),item_fields:l((r.itemFields??[]).map(n=>n.name)),...(r.relationshipKinds?.length??0)>0?{relationship_kinds:l(r.relationshipKinds.map(n=>n.kind))}:{},migrations:l((r.migrations??[]).flatMap(n=>typeof n.id=="string"?[n.id]:[])),profiles:l((r.profiles??[]).map(n=>n.name)),importers:l(e.map(n=>v(n.name))),exporters:l(t.map(n=>v(n.name))),search_providers:l((r.searchProviders??[]).map(n=>n.name)),vector_store_adapters:l((r.vectorStoreAdapters??[]).map(n=>n.name)),...Le(r.assuranceProviders),parser_overrides:l(Object.keys(r.parsers??{}).map(n=>v(n))),service_overrides:l(Object.keys(r.services??{}).map(n=>String(n).trim().toLowerCase())),renderer_overrides:l(Object.keys(r.renderers??{}).map(n=>String(n).trim().toLowerCase())),...He(r.renderers),preflight_overrides:(r.preflights??[]).length,preflight_ownership:(r.preflights??[]).map(n=>({commands:[...n.commands??[]]}))}}function qe(r){let e=(r.commands??[]).filter(w),t=(r.importers??[]).filter(w),n=(r.exporters??[]).filter(w),s=t.map(S),o=n.map(O),i=je(e,t,n),a=Be(r,e,t,n),d=r.hooks??{},c=Ke(r,t,n);return{capabilities:N(r),commands:l(i),command_overrides:l(Object.keys(r.commandOverrides??{}).map(E=>v(E))),command_handlers:l([...i,...s,...o]),hooks:De(d),flag_commands:l(a),...c}}var Ue=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function Ve(r){return(r.itemFields??[]).filter(e=>typeof e?.name=="string"&&se.has(e.name.trim())).map(e=>({code:"reserved_item_field",severity:"error",message:`Item field "${e.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:e.name}))}function ze(r){return[...Object.values(r.flags??{}).flat(),...(r.commands??[]).flatMap(t=>t.flags??[]),...(r.importers??[]).flatMap(t=>t.options?.flags??[]),...(r.exporters??[]).flatMap(t=>t.options?.flags??[])].flatMap(t=>{if(typeof t?.long!="string"&&typeof t?.short!="string")return[];let n=D(t.long,t.short);if(n===null)return[];let{token:s,failure:o}=n;return[{code:o,severity:"error",message:`Flag "${s}" ${H(s,o)}.`,field:s}]})}function ge(r){let e=new Set;for(let t of r){let n=q(t)??x(t);n!==null&&e.add(n)}return[...e].sort((t,n)=>t.localeCompare(n))}function We(r,e){let t=[];if(e===null)return r.length>0&&t.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${r.length===1?"capability":"capabilities"} [${r.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),t;let n=new Set(e),s=new Set(r);for(let o of r)n.has(o)||t.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${o}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${o}" to the manifest capabilities.`,capability:o});for(let o of e)s.has(o)||t.push({code:"capability_unused",severity:"warning",message:`Capability "${o}" is declared but no blueprint surface exercises it; drop it to keep the manifest least-privilege (pm package doctor reports this as extension_capability_unused).`,capability:o});return t}function Ge(r){let e=[],t=new Map;for(let s of r.commands??[]){let o=v(s.name);t.set(o,(t.get(o)??0)+1)}for(let[s,o]of t)o>1&&e.push({code:"duplicate_command",severity:"warning",message:`Command "${s}" is declared ${o} times in commands; the later registration shadows the earlier one at dispatch.`,command:s});let n=new Set(Object.keys(r.commandOverrides??{}).map(s=>v(s)));for(let s of t.keys())n.has(s)&&e.push({code:"command_override_conflict",severity:"warning",message:`Command "${s}" is declared both as a new command definition and as a command override; register one or the other.`,command:s});return e}function Ye(r){let e=[];for(let t of Ue)t in r&&!$(r[t])&&e.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${t}" is present but empty; remove it or populate it.`,field:t});if("hooks"in r){let t=r.hooks??{};[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some($)||e.push({code:"empty_surface",severity:"warning",message:'Blueprint field "hooks" is present but registers no lifecycle hooks; remove it or populate it.',field:"hooks"})}return e}function k(r,e={}){let t=N(r),n=e.declaredCapabilities??r.manifest?.capabilities,s=Array.isArray(n)?ge(n):null,o=[...We(t,s),...Ge(r),...ze(r),...Ve(r),...Ye(r)];return{ok:o.every(i=>i.severity!=="error"),findings:o,used:t,declared:s}}function ve(r,e){let{additionalCapabilities:t,...n}=e,s=Array.isArray(t)?ge(t):[],o=[...new Set([...N(r),...s])].sort((i,a)=>i.localeCompare(a));return{...n,capabilities:o}}function Br(r,e){let t=ve(r,e);return{module:Oe({...r,manifest:t}),manifest:t}}function ue(r,e){if(r.status==="absent"||r.status==="ok")return null;let t=`${r.kind}_${r.status}`,n="";switch(t){case"pm_min_version_invalid":n=`pm_min_version "${r.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":n=`pm_min_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_min_version_unmet":n=`Requires pm >= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_invalid":n=`pm_max_version "${r.required}" is not a valid inclusive upper bound (version ranges are not allowed); the extension is treated as incompatible and the loader skips it.`;break;case"pm_max_version_unchecked":n=`pm_max_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_max_version_exceeded":n=`Allows pm <= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":n=`Target pm ${e} is newer than pm_max_version ${r.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:t,severity:r.allowed?"warning":"error",constraint:r.kind,required:r.required,current:e,message:n}}function A(r,e){let t=L(r.pm_min_version,e.pmVersion),n=K(r.pm_max_version,e.pmVersion,e.pmMaxVersionExceededMode??"block"),o=U(r).findings.map(c=>({code:c.code,severity:"warning",constraint:"manifest",required:c.code==="manifest_unknown_key"?c.path:"pm_min_version",current:e.pmVersion,path:c.path,...c.suggested_key?{suggested_key:c.suggested_key}:{},message:c.message})),i=[],a=ue(t,e.pmVersion);a!==null&&i.push(a);let d=ue(n,e.pmVersion);return d!==null&&i.push(d),{compatible:t.allowed&&n.allowed,findings:[...o,...i],pmVersion:e.pmVersion}}var Xe=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function he(r,e={}){let t=k(r,{declaredCapabilities:e.declaredCapabilities}),n=e.identity?ve(r,e.identity):null,s=e.target?A(n??r.manifest??{},e.target):null,a=[...(n!==null&&e.declaredCapabilities===void 0?t.findings.filter(d=>!Xe.has(d.code)):t.findings).map(d=>({source:"blueprint",severity:d.severity,code:d.code,message:d.message})),...(s?.findings??[]).map(d=>({source:"compatibility",severity:d.severity,code:d.code,message:d.message}))];return{ok:a.every(d=>d.severity!=="error"),capabilities:t.used,blueprint:t,manifest:n,compatibility:s,findings:a}}(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="fa9e95e5-7782-509d-96af-093a47daaed7")}catch{}})();function g(r,e){return r.name??e??""}var Je={before_command:"beforeCommand",before_mutation:"beforeMutation",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"},F={before_command:"beforeCommand",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"};function p(r){return r.trim().toLowerCase()}function ye(r){return p(r).replaceAll("-","_")}function u(r){return r?` from extension "${r}"`:""}function f(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function y(r){if(typeof r!="string")throw new Error('A command name string is required. Pass it via the options object, e.g. runRegisteredCommandForTest(activation, { command: "my command" }) \u2014 positional command arguments are not supported.');return r.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0).join(" ")}function m(r){return r.length>0?r.join(", "):"(none)"}function be(r,e,t){let n=new Set(r??[]),s=f(e.filter(o=>!n.has(o)));if(s.length>0)throw new Error(`Expected package manifest ${t} to include ${s.join(", ")}; available: ${m(f(r??[]))}`)}function we(r){let e=new Set;for(let t of r)typeof t.long=="string"&&t.long.trim().length>0&&e.add(t.long.trim()),typeof t.short=="string"&&t.short.trim().length>0&&e.add(t.short.trim());return e}function P(r){let e=b(r);if(!e)return{};let t=b(e.manifest);if(t)return t;let n=b(e.default),s=b(n?.manifest);return s||(n&&typeof e.default!="function"&&("name"in n||"capabilities"in n)?n:typeof r!="function"&&("name"in e||"capabilities"in e)?e:{})}function T(r,e){return e??(typeof r.name=="string"&&r.name.trim().length>0?r.name.trim():"test-extension")}function Ee(r,e){return Array.isArray(e.capabilities)?[...e.capabilities]:Array.isArray(r.capabilities)?r.capabilities.filter(t=>typeof t=="string"):[]}function xe(r,e,t){return{disabled_by_flag:!1,roots:{global:"",project:""},configured_enabled:[],configured_disabled:[],discovered:[],effective:[],warnings:[],policy:t.policy,failed:[],loaded:[{layer:t.layer,directory:"",manifest_path:"",name:t.name,version:typeof e.version=="string"?e.version:"0.0.0",entry:typeof e.entry=="string"?e.entry:"./index.js",priority:typeof e.priority=="number"?e.priority:0,entry_path:"",capabilities:t.capabilities,manifest_version:typeof e.manifest_version=="number"?e.manifest_version:void 0,pm_min_version:typeof e.pm_min_version=="string"?e.pm_min_version:void 0,pm_max_version:typeof e.pm_max_version=="string"?e.pm_max_version:void 0,engines:e.engines,trusted:e.trusted,provenance:e.provenance,sandbox_profile:e.sandbox_profile,permissions:e.permissions,activation:e.activation,module:r}]}}async function Qe(r,e={}){let t=P(r);return oe(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:Ee(t,e),policy:e.policy??C()}))}async function Ze(r,e={}){let t=P(r);return ne(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:Ee(t,{}),policy:C()}),e.activation,e.deactivateTimeoutMs===void 0?{}:{deactivate_timeout_ms:e.deactivateTimeoutMs})}async function I(r,e){let t=y(e.command);if(t.length===0)throw new Error("Expected command name must be a non-empty string");if(!r.handlers.some(a=>a.command===t)){let a=f(r.handlers.map(d=>d.command));throw new Error(`Expected a registered command handler for "${t}" to invoke. Available command handlers: ${m(a)}`)}if(e.sdk!==void 0&&e.sdkFactory!==void 0)throw new TypeError("runRegisteredCommandForTest accepts sdk or sdkFactory, not both");let s=e.pmRoot??"",o={json:!0,quiet:!0,noPager:!0,...e.global},i=e.sdk??e.sdkFactory?.({pmRoot:s,global:o})??(s.length>0?ce(s,new pe({pmRoot:s})):void 0);return J(r,{command:t,args:e.args?[...e.args]:[],options:e.options?{...e.options}:{},global:o,pm_root:s,...i===void 0?{}:{sdk:i}})}async function er(r,e){if((r.beforeMutation?.length??0)===0)throw new Error("Expected a registered before_mutation hook to invoke");await z(r,e.context)}async function rr(r,e){let t=e.kind;if(t==="before_mutation")throw new Error("Invoke before_mutation hooks with runRegisteredMutationGuardForTest so denials and failures retain fail-closed semantics.");if((r[F[t]]?.length??0)===0){let n=f(Object.keys(F).filter(s=>(r[F[s]]?.length??0)>0));throw new Error(`Expected a registered "${t}" hook to invoke. Hook kinds with registrations: ${m(n)}`)}switch(e.kind){case"before_command":return V(r,e.context);case"after_command":return W(r,e.context);case"on_read":return Y(r,e.context);case"on_write":return G(r,e.context);case"on_index":return X(r,e.context)}}async function tr(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered parser override for command "${t}" to invoke. Available parser override commands: ${m(f(r.overrides.map(n=>n.command)))}`);return Q(r,e)}async function nr(r,e){if(r.overrides.length===0)throw new Error("Expected a registered preflight override to invoke, but none are registered.");return Z(r,e)}async function or(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered command override for command "${t}" to invoke. Available command override commands: ${m(f(r.overrides.map(n=>n.command)))}`);return re(r,e)}async function ir(r,e){if(!r.overrides.some(t=>t.format===e.format))throw new Error(`Expected a registered renderer override for format "${e.format}" to invoke. Available renderer override formats: ${m(f(r.overrides.map(t=>t.format)))}`);return te(r,e)}async function sr(r,e){if(!r.overrides.some(t=>t.service===e.service))throw new Error(`Expected a registered service override for service "${e.service}" to invoke. Available service override services: ${m(f(r.overrides.map(t=>t.service)))}`);return ee(r,e)}var ar={query:["query"],embed:["embed"],embedBatch:["embedBatch","embed_batch"],queryExpansion:["queryExpansion","query_expansion"],rerank:["rerank"]};async function dr(r,e){let t=ae(r,e.provider);if(!t){let o=f(r.search_providers.map(i=>i.definition.name));throw new Error(`Expected a registered search provider "${e.provider}" to invoke. Available search providers: ${m(o)}`)}let n=t.runtime_definition,s=ar[e.operation].map(o=>n[o]).find(o=>typeof o=="function");if(typeof s!="function")throw new Error(`Registered search provider "${e.provider}" does not implement the "${e.operation}" operation.`);return await s(e.context)}async function mr(r,e){let t=de(r,e.adapter);if(!t){let s=f(r.vector_store_adapters.map(o=>o.definition.name));throw new Error(`Expected a registered vector store adapter "${e.adapter}" to invoke. Available vector store adapters: ${m(s)}`)}let n=t.runtime_definition[e.operation];if(typeof n!="function")throw new Error(`Registered vector store adapter "${e.adapter}" does not implement the "${e.operation}" operation.`);return await n(e.context)}async function cr(r,e){let t=ke(r,{migration:e.migration,extensionName:e.extensionName}),n=me(t).run;if(typeof n!="function")throw new Error(`Registered migration "${e.migration}" does not implement a run function to invoke.`);let s=t.definition.status,o={id:t.definition.id,command:"migration",layer:t.layer,extension:t.name,pm_root:e.pmRoot??"",status:(typeof s=="string"?s.trim().toLowerCase():"")||"pending"};return await n(o)}async function fr(r,e){let t=_e(r.registrations,{importer:e.importer,extensionName:e.extensionName});return I(r.commands,{command:`${t.importer} import`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}async function lr(r,e){let t=$e(r.registrations,{exporter:e.exporter,extensionName:e.extensionName});return I(r.commands,{command:`${t.exporter} export`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}function Qr(r,e={}){let t=e.deactivated??1;if(r.deactivated!==t)throw new Error(`Expected ${t} extension${t===1?"":"s"} to deactivate cleanly, but ${r.deactivated} did.`);let n=e.failed??0;if(r.failed.length!==n){let s=r.failed.map(o=>`${o.layer}:${o.name} (${o.error})`).join(", ");throw new Error(`Expected ${n} teardown failure${n===1?"":"s"}, but observed ${r.failed.length}${s.length>0?`: ${s}`:""}.`)}return r}function Zr(r,e){if(e.packageName!==void 0&&r.package_name!==e.packageName)throw new Error(`Expected package manifest package_name to be "${e.packageName}"; received "${r.package_name??"(none)"}"`);if(e.aliases!==void 0&&be(r.aliases,e.aliases,"aliases"),e.resources!==void 0)for(let[t,n]of Object.entries(e.resources))be(r.resources[t],n,`pm.${t}`);return r}function pr(r,e){let t=y(g(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.commands.filter(i=>i.command===t),s=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!s){let i=r.commands.map(d=>d.command).sort((d,c)=>d.localeCompare(c)),a=e.extensionName?` from extension "${e.extensionName}"`:"";throw new Error(`Expected extension command "${t}"${a} to be registered. Available commands: ${m(i)}`)}if(e.action!==void 0&&s.action!==e.action)throw new Error(`Expected extension command "${t}" action "${e.action}", received "${s.action}"`);if(e.arguments!==void 0){let i=(s.arguments??[]).map(d=>d.name),a=e.arguments.filter(d=>!i.includes(d));if(a.length>0)throw new Error(`Expected extension command "${t}" arguments ${m(e.arguments)}; missing ${m(a)}; available ${m(i)}`)}let o=r.flags.filter(i=>i.target_command===t&&(e.extensionName===void 0||i.name===e.extensionName)).flatMap(i=>i.flags);if(e.flags!==void 0){let i=we(o),a=e.flags.filter(d=>!i.has(d));if(a.length>0)throw new Error(`Expected extension command "${t}" flags ${m(e.flags)}; missing ${m(a)}; available ${m([...i].sort((d,c)=>d.localeCompare(c)))}`)}return{command:s,flags:o}}function ur(r,e){let t=y(g(e,e.targetCommand));if(t.length===0)throw new Error("Expected target command name must be a non-empty string");let n=r.flags.filter(o=>o.target_command===t),s;if(e.extensionName)s=n.find(o=>o.name===e.extensionName);else if(n.length===1)s=n[0];else if(n.length>1){let o=f(n.map(i=>i.name));throw new Error(`Expected flags for target command "${t}" matched multiple extensions: ${m(o)}. Specify extensionName to choose one registration.`)}if(!s){let o=f(r.flags.map(a=>a.target_command)),i=f(n.map(a=>a.name));throw new Error(`Expected flags for target command "${t}"${u(e.extensionName)} to be registered. Available flag target commands: ${m(o)}; matching extensions: ${m(i)}`)}if(e.flags!==void 0){let o=we(s.flags),i=e.flags.filter(a=>!o.has(a));if(i.length>0)throw new Error(`Expected flags for target command "${t}" to include ${m(e.flags)}; missing ${m(i)}; available ${m([...o].sort((a,d)=>a.localeCompare(d)))}`)}return s}function gr(r,e){let t=Je[e.kind],n=r[t]??[],s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(n.map(i=>i.name));throw new Error(`Expected a "${e.kind}" hook${u(e.extensionName)} to be registered. Available "${e.kind}" hooks: ${m(o)}`)}return s}function vr(r,e){let t=p(g(e,e.provider));if(t.length===0)throw new Error("Expected search provider name must be a non-empty string");let n=r.search_providers.filter(o=>p(o.definition.name)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.search_providers.map(i=>i.definition.name));throw new Error(`Expected search provider "${t}"${u(e.extensionName)} to be registered. Available search providers: ${m(o)}`)}return s}function hr(r,e){let t=p(g(e,e.adapter));if(t.length===0)throw new Error("Expected vector store adapter name must be a non-empty string");let n=r.vector_store_adapters.filter(o=>p(o.definition.name)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.vector_store_adapters.map(i=>i.definition.name));throw new Error(`Expected vector store adapter "${t}"${u(e.extensionName)} to be registered. Available vector store adapters: ${m(o)}`)}return s}function _e(r,e){let t=p(g(e,e.importer));if(t.length===0)throw new Error("Expected importer name must be a non-empty string");let n=r.importers.filter(o=>p(o.importer)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.importers.map(i=>i.importer));throw new Error(`Expected importer "${t}"${u(e.extensionName)} to be registered. Available importers: ${m(o)}`)}return s}function $e(r,e){let t=p(g(e,e.exporter));if(t.length===0)throw new Error("Expected exporter name must be a non-empty string");let n=r.exporters.filter(o=>p(o.exporter)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.exporters.map(i=>i.exporter));throw new Error(`Expected exporter "${t}"${u(e.extensionName)} to be registered. Available exporters: ${m(o)}`)}return s}function yr(r,e){let t=p(g(e,e.field));if(t.length===0)throw new Error("Expected item field name must be a non-empty string");let s=r.item_fields.filter(o=>e.extensionName===void 0||o.name===e.extensionName).map(o=>({registration:o,field:o.fields.find(i=>p(i.name)===t)})).filter(o=>o.field!==void 0).find(o=>e.type===void 0||o.field.type===e.type);if(!s){let o=f(r.item_fields.flatMap(i=>i.fields.map(a=>`${a.name}:${a.type}`)));throw new Error(`Expected item field "${t}"${u(e.extensionName)} to be registered. Available item fields: ${m(o)}`)}return s}function br(r,e){let t=p(g(e,e.itemType));if(t.length===0)throw new Error("Expected item type name must be a non-empty string");let s=r.item_types.filter(o=>e.extensionName===void 0||o.name===e.extensionName).map(o=>({registration:o,itemType:o.types.find(i=>p(i.name)===t)})).filter(o=>o.itemType!==void 0).find(o=>e.folder===void 0||o.itemType.folder===e.folder);if(!s){let o=f(r.item_types.flatMap(i=>i.types.map(a=>`${a.name}:${a.folder}`)));throw new Error(`Expected item type "${t}"${u(e.extensionName)} to be registered. Available item types: ${m(o)}`)}return s}function wr(r,e){let t=ye(g(e,e.profile));if(t.length===0)throw new Error("Expected profile name must be a non-empty string");let n=r.profiles.filter(s=>e.extensionName===void 0||s.name===e.extensionName).find(s=>ye(s.profile.name)===t);if(!n){let s=f(r.profiles.map(o=>o.profile.name));throw new Error(`Expected profile "${t}"${u(e.extensionName)} to be registered. Available profiles: ${m(s)}`)}return{registration:n,profile:n.profile}}function Er(r,e){let t=y(g(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(o=>o.command===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.command));throw new Error(`Expected command override "${t}"${u(e.extensionName)} to be registered. Available command overrides: ${m(o)}`)}return s}function xr(r,e){let t=y(g(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(o=>o.command===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.command));throw new Error(`Expected parser override "${t}"${u(e.extensionName)} to be registered. Available parser overrides: ${m(o)}`)}return s}function _r(r,e={}){let t=e.extensionName?r.overrides.find(n=>n.name===e.extensionName):r.overrides[0];if(!t){let n=f(r.overrides.map(s=>s.name));throw new Error(`Expected a preflight override${u(e.extensionName)} to be registered. Available preflight overrides: ${m(n)}`)}return t}function $r(r,e){let t=p(g(e,e.format));if(t.length===0)throw new Error("Expected renderer format must be a non-empty string");let n=r.overrides.filter(o=>o.format===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.format));throw new Error(`Expected renderer override "${t}"${u(e.extensionName)} to be registered. Available renderer overrides: ${m(o)}`)}return s}function kr(r,e){let t=p(g(e,e.service));if(t.length===0)throw new Error("Expected service name must be a non-empty string");let n=r.overrides.filter(o=>p(o.service)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.service));throw new Error(`Expected service override "${t}"${u(e.extensionName)} to be registered. Available service overrides: ${m(o)}`)}return s}function ke(r,e){let t=p(g(e,e.migration));if(t.length===0)throw new Error("Expected migration id must be a non-empty string");let n=r.migrations.filter(a=>(e.extensionName===void 0||a.name===e.extensionName)&&typeof a.definition.id=="string"&&p(a.definition.id)===t),s=n.find(a=>e.mandatory===void 0||(a.definition.mandatory??!1)===e.mandatory);if(s)return s;let o=n[0];if(o!==void 0)throw new Error(`Expected migration "${t}"${u(e.extensionName)} to have mandatory=${e.mandatory}, but it is mandatory=${o.definition.mandatory??!1}.`);let i=f(r.migrations.map(a=>`${typeof a.definition.id=="string"&&a.definition.id.trim().length>0?a.definition.id.trim():"(unnamed)"}:${a.definition.mandatory===!0}`));throw new Error(`Expected migration "${t}"${u(e.extensionName)} to be registered. Available migrations: ${m(i)}`)}function Cr(r,e){let t=(d,c)=>{let E=new Set;for(let M of d){let j=x(M);if(j===null)throw new Error(`Expected ${c} capability "${M}" to be a known extension capability. Use canonical capability names (see manifest.capabilities).`);E.add(j)}return E},n=[...t(e.declared,"declared")].sort((d,c)=>d.localeCompare(c)),s=t(e.allowUnused??[],"allowUnused"),o=ie(r,{extensionName:e.extensionName}),i=new Set(o),a=n.filter(d=>!i.has(d)&&!s.has(d));if(a.length>0){let d=u(e.extensionName);throw new Error(`Expected every declared capability${d} to be exercised, but [${a.join(", ")}] ${a.length===1?"is":"are"} declared yet never registered against. Remove ${a.length===1?"it":"them"} from manifest.capabilities for least privilege, or pass allowUnused for capabilities registered only behind a runtime flag.`)}return{declared:n,used:o,unused:a}}function et(r,e={}){let t=k(r,e);if(!t.ok){let n=t.findings.filter(s=>s.severity==="error");throw new Error(`Extension blueprint failed preflight with ${n.length} ${n.length===1?"error":"errors"}:
|
|
1
|
+
import{$ as le,Sa as pe,f as ce}from"./chunk-BOZ4HVYL.js";import{Aa as fe,h as R}from"./chunk-3AHONKLL.js";import{Ac as oe,C,Db as v,Eb as D,Fb as H,Gb as L,Gc as ie,Hb as K,Rb as x,Sb as q,X as b,Y as B,dc as U,hc as V,hd as se,ic as z,jc as W,kc as G,lc as Y,mc as X,md as ae,nc as J,nd as de,oc as Q,od as me,pc as Z,qc as ee,rc as re,sc as te,zc as ne}from"./chunk-J4DRE3WN.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="c06f3fb3-4b1f-5fdb-a9ce-bce8f88704aa")}catch{}})();function Ir(r){return r}function Mr(r){return r}function Ce(r,e){for(let t of e.commands??[])r.registerCommand(t);for(let[t,n]of Object.entries(e.commandOverrides??{}))r.registerCommand(t,n);for(let[t,n]of Object.entries(e.flags??{}))r.registerFlags(t,n);for(let[t,n]of Object.entries(e.parsers??{}))r.registerParser(t,n);for(let[t,n]of Object.entries(e.renderers??{}))if(typeof n=="function")r.registerRenderer(t,n);else{let{run:s,...o}=n;r.registerRenderer(t,s,o)}for(let[t,n]of Object.entries(e.services??{}))r.registerService(t,n)}function Re(r,e){for(let o of e.preflights??[])r.registerPreflight(o);let t=e.itemTypes??[];t.length>0&&r.registerItemTypes(t);let n=e.itemFields??[];n.length>0&&r.registerItemFields(n);let s=e.relationshipKinds??[];s.length>0&&r.registerRelationshipKinds(s);for(let o of e.migrations??[])r.registerMigration(o);for(let o of e.profiles??[])r.registerProfile(o)}function Ne(r,e){for(let t of e.searchProviders??[])r.registerSearchProvider(t);for(let t of e.vectorStoreAdapters??[])r.registerVectorStoreAdapter(t);for(let t of e.assuranceProviders??[])r.registerAssuranceMeasurementProvider(t);for(let t of e.importers??[])r.registerImporter(t.name,t.importer,t.options);for(let t of e.exporters??[])r.registerExporter(t.name,t.exporter,t.options)}function Se(r,e){for(let t of e.beforeCommand??[])r.hooks.beforeCommand(t);for(let t of e.beforeMutation??[])r.hooks.beforeMutation(t);for(let t of e.afterCommand??[])r.hooks.afterCommand(t);for(let t of e.onWrite??[])r.hooks.onWrite(t);for(let t of e.onRead??[])r.hooks.onRead(t);for(let t of e.onIndex??[])r.hooks.onIndex(t)}function Oe(r){let t={activate:async n=>{Ce(n,r),Re(n,r),Ne(n,r),Se(n,r.hooks??{}),await r.activate?.(n)}};return r.manifest&&(t.manifest=r.manifest),r.deactivate&&(t.deactivate=r.deactivate),t}function h(r){let e=r.flatMap(t=>t??[]);return e.length>0?e:void 0}function _(r){let e=Object.assign({},...r.map(t=>t??{}));return Object.keys(e).length>0?e:void 0}function Ae(r){let e={};for(let t of r)for(let[n,s]of Object.entries(t??{}))e[n]=[...e[n]??[],...s];return Object.keys(e).length>0?e:void 0}var Fe=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function Pe(r,e,t){let n=e.map(o=>o?.[t]),s=h(n);if(s!==void 0){let o=r;o[t]=s}}function Te(r){let e={};for(let t of Fe)Pe(e,r,t);return Object.keys(e).length>0?e:void 0}function jr(...r){let e={},t=(i,a)=>{a!==void 0&&(e[i]=a)};t("commands",h(r.map(i=>i.commands))),t("commandOverrides",_(r.map(i=>i.commandOverrides))),t("flags",Ae(r.map(i=>i.flags))),t("parsers",_(r.map(i=>i.parsers))),t("renderers",_(r.map(i=>i.renderers))),t("services",_(r.map(i=>i.services))),t("preflights",h(r.map(i=>i.preflights))),t("itemTypes",h(r.map(i=>i.itemTypes))),t("itemFields",h(r.map(i=>i.itemFields))),t("relationshipKinds",h(r.map(i=>i.relationshipKinds))),t("migrations",h(r.map(i=>i.migrations))),t("profiles",h(r.map(i=>i.profiles))),t("searchProviders",h(r.map(i=>i.searchProviders))),t("vectorStoreAdapters",h(r.map(i=>i.vectorStoreAdapters))),t("assuranceProviders",h(r.map(i=>i.assuranceProviders))),t("importers",h(r.map(i=>i.importers))),t("exporters",h(r.map(i=>i.exporters))),t("hooks",Te(r.map(i=>i.hooks)));let n;for(let i of r)i.manifest&&(n=i.manifest);t("manifest",n);let s=r.some(i=>i.activate);t("activate",s?async i=>{for(let a of r)a.activate&&await a.activate(i)}:void 0);let o=r.some(i=>i.deactivate);return t("deactivate",o?async()=>{let i=[];for(let a of[...r].reverse())if(a.deactivate)try{await a.deactivate()}catch(d){i.push(d)}if(i.length>0)throw i.length>1?new AggregateError(i,"Multiple extension blueprint deactivate hooks failed."):i[0]}:void 0),e}var Ie=[["commands","commands"],["commandOverrides","commands"],["flags","schema"],["itemTypes","schema"],["itemFields","schema"],["relationshipKinds","schema"],["migrations","schema"],["profiles","schema"],["parsers","parser"],["renderers","renderers"],["services","services"],["preflights","preflight"],["searchProviders","search"],["vectorStoreAdapters","search"],["assuranceProviders","services"],["importers","importers"],["exporters","importers"]];function $(r){return r?Array.isArray(r)?r.length>0:Object.keys(r).length>0:!1}function N(r){let e=new Set;for(let[s,o]of Ie)$(r[s])&&e.add(o);(r.commands??[]).filter(w).some(s=>s.flags!==void 0)&&e.add("schema");let t=[...r.importers??[],...r.exporters??[]].filter(w);t.some(s=>s?.options?.flags!==void 0)&&e.add("schema"),t.some(s=>typeof s=="object")&&e.add("commands");let n=r.hooks??{};return[n.beforeCommand,n.beforeMutation,n.afterCommand,n.onWrite,n.onRead,n.onIndex].some($)&&e.add("hooks"),[...e].sort((s,o)=>s.localeCompare(o))}var Me=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function l(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function w(r){return r!=null}function S(r){return v(`${r.name} import`)}function O(r){return v(`${r.name} export`)}function je(r,e,t){return[...r.map(n=>v(n.name)),...e.filter(n=>n.options!==void 0).map(S),...t.filter(n=>n.options!==void 0).map(O)]}function Be(r,e,t,n){return[...Object.keys(r.flags??{}).map(s=>v(s)),...e.filter(s=>s.flags!==void 0).map(s=>v(s.name)),...t.filter(s=>s.options?.flags!==void 0).map(S),...n.filter(s=>s.options?.flags!==void 0).map(O)]}function De(r){return Me.filter(([e])=>(r[e]?.length??0)>0).map(([,e])=>e)}function He(r){let e=Object.entries(r??{}).filter(([,t])=>typeof t!="function"&&((t.commands?.length??0)>0||t.resultDiscriminator!==void 0)).map(([t,n])=>{let s=n;return{format:t,commands:l((s.commands??[]).map(o=>v(o))),result_discriminator:s.resultDiscriminator!==void 0}}).sort((t,n)=>t.format.localeCompare(n.format));return e.length>0?{renderer_ownership:e}:{}}function Le(r){return!r||r.length===0?{}:{assurance_providers:l(r.map(e=>e.id))}}function Ke(r,e,t){return{item_types:l((r.itemTypes??[]).map(n=>n.name)),item_fields:l((r.itemFields??[]).map(n=>n.name)),...(r.relationshipKinds?.length??0)>0?{relationship_kinds:l(r.relationshipKinds.map(n=>n.kind))}:{},migrations:l((r.migrations??[]).flatMap(n=>typeof n.id=="string"?[n.id]:[])),profiles:l((r.profiles??[]).map(n=>n.name)),importers:l(e.map(n=>v(n.name))),exporters:l(t.map(n=>v(n.name))),search_providers:l((r.searchProviders??[]).map(n=>n.name)),vector_store_adapters:l((r.vectorStoreAdapters??[]).map(n=>n.name)),...Le(r.assuranceProviders),parser_overrides:l(Object.keys(r.parsers??{}).map(n=>v(n))),service_overrides:l(Object.keys(r.services??{}).map(n=>String(n).trim().toLowerCase())),renderer_overrides:l(Object.keys(r.renderers??{}).map(n=>String(n).trim().toLowerCase())),...He(r.renderers),preflight_overrides:(r.preflights??[]).length,preflight_ownership:(r.preflights??[]).map(n=>({commands:[...n.commands??[]]}))}}function qe(r){let e=(r.commands??[]).filter(w),t=(r.importers??[]).filter(w),n=(r.exporters??[]).filter(w),s=t.map(S),o=n.map(O),i=je(e,t,n),a=Be(r,e,t,n),d=r.hooks??{},c=Ke(r,t,n);return{capabilities:N(r),commands:l(i),command_overrides:l(Object.keys(r.commandOverrides??{}).map(E=>v(E))),command_handlers:l([...i,...s,...o]),hooks:De(d),flag_commands:l(a),...c}}var Ue=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function Ve(r){return(r.itemFields??[]).filter(e=>typeof e?.name=="string"&&se.has(e.name.trim())).map(e=>({code:"reserved_item_field",severity:"error",message:`Item field "${e.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:e.name}))}function ze(r){return[...Object.values(r.flags??{}).flat(),...(r.commands??[]).flatMap(t=>t.flags??[]),...(r.importers??[]).flatMap(t=>t.options?.flags??[]),...(r.exporters??[]).flatMap(t=>t.options?.flags??[])].flatMap(t=>{if(typeof t?.long!="string"&&typeof t?.short!="string")return[];let n=D(t.long,t.short);if(n===null)return[];let{token:s,failure:o}=n;return[{code:o,severity:"error",message:`Flag "${s}" ${H(s,o)}.`,field:s}]})}function ge(r){let e=new Set;for(let t of r){let n=q(t)??x(t);n!==null&&e.add(n)}return[...e].sort((t,n)=>t.localeCompare(n))}function We(r,e){let t=[];if(e===null)return r.length>0&&t.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${r.length===1?"capability":"capabilities"} [${r.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),t;let n=new Set(e),s=new Set(r);for(let o of r)n.has(o)||t.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${o}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${o}" to the manifest capabilities.`,capability:o});for(let o of e)s.has(o)||t.push({code:"capability_unused",severity:"warning",message:`Capability "${o}" is declared but no blueprint surface exercises it; drop it to keep the manifest least-privilege (pm package doctor reports this as extension_capability_unused).`,capability:o});return t}function Ge(r){let e=[],t=new Map;for(let s of r.commands??[]){let o=v(s.name);t.set(o,(t.get(o)??0)+1)}for(let[s,o]of t)o>1&&e.push({code:"duplicate_command",severity:"warning",message:`Command "${s}" is declared ${o} times in commands; the later registration shadows the earlier one at dispatch.`,command:s});let n=new Set(Object.keys(r.commandOverrides??{}).map(s=>v(s)));for(let s of t.keys())n.has(s)&&e.push({code:"command_override_conflict",severity:"warning",message:`Command "${s}" is declared both as a new command definition and as a command override; register one or the other.`,command:s});return e}function Ye(r){let e=[];for(let t of Ue)t in r&&!$(r[t])&&e.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${t}" is present but empty; remove it or populate it.`,field:t});if("hooks"in r){let t=r.hooks??{};[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some($)||e.push({code:"empty_surface",severity:"warning",message:'Blueprint field "hooks" is present but registers no lifecycle hooks; remove it or populate it.',field:"hooks"})}return e}function k(r,e={}){let t=N(r),n=e.declaredCapabilities??r.manifest?.capabilities,s=Array.isArray(n)?ge(n):null,o=[...We(t,s),...Ge(r),...ze(r),...Ve(r),...Ye(r)];return{ok:o.every(i=>i.severity!=="error"),findings:o,used:t,declared:s}}function ve(r,e){let{additionalCapabilities:t,...n}=e,s=Array.isArray(t)?ge(t):[],o=[...new Set([...N(r),...s])].sort((i,a)=>i.localeCompare(a));return{...n,capabilities:o}}function Br(r,e){let t=ve(r,e);return{module:Oe({...r,manifest:t}),manifest:t}}function ue(r,e){if(r.status==="absent"||r.status==="ok")return null;let t=`${r.kind}_${r.status}`,n="";switch(t){case"pm_min_version_invalid":n=`pm_min_version "${r.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":n=`pm_min_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_min_version_unmet":n=`Requires pm >= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_invalid":n=`pm_max_version "${r.required}" is not a valid inclusive upper bound (version ranges are not allowed); the extension is treated as incompatible and the loader skips it.`;break;case"pm_max_version_unchecked":n=`pm_max_version "${r.required}" could not be compared against pm ${e}; compatibility is unverified.`;break;case"pm_max_version_exceeded":n=`Allows pm <= ${r.required} but the target is pm ${e}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":n=`Target pm ${e} is newer than pm_max_version ${r.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:t,severity:r.allowed?"warning":"error",constraint:r.kind,required:r.required,current:e,message:n}}function A(r,e){let t=L(r.pm_min_version,e.pmVersion),n=K(r.pm_max_version,e.pmVersion,e.pmMaxVersionExceededMode??"block"),o=U(r).findings.map(c=>({code:c.code,severity:"warning",constraint:"manifest",required:c.code==="manifest_unknown_key"?c.path:"pm_min_version",current:e.pmVersion,path:c.path,...c.suggested_key?{suggested_key:c.suggested_key}:{},message:c.message})),i=[],a=ue(t,e.pmVersion);a!==null&&i.push(a);let d=ue(n,e.pmVersion);return d!==null&&i.push(d),{compatible:t.allowed&&n.allowed,findings:[...o,...i],pmVersion:e.pmVersion}}var Xe=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function he(r,e={}){let t=k(r,{declaredCapabilities:e.declaredCapabilities}),n=e.identity?ve(r,e.identity):null,s=e.target?A(n??r.manifest??{},e.target):null,a=[...(n!==null&&e.declaredCapabilities===void 0?t.findings.filter(d=>!Xe.has(d.code)):t.findings).map(d=>({source:"blueprint",severity:d.severity,code:d.code,message:d.message})),...(s?.findings??[]).map(d=>({source:"compatibility",severity:d.severity,code:d.code,message:d.message}))];return{ok:a.every(d=>d.severity!=="error"),capabilities:t.used,blueprint:t,manifest:n,compatibility:s,findings:a}}(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="fa9e95e5-7782-509d-96af-093a47daaed7")}catch{}})();function g(r,e){return r.name??e??""}var Je={before_command:"beforeCommand",before_mutation:"beforeMutation",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"},F={before_command:"beforeCommand",after_command:"afterCommand",on_read:"onRead",on_write:"onWrite",on_index:"onIndex"};function p(r){return r.trim().toLowerCase()}function ye(r){return p(r).replaceAll("-","_")}function u(r){return r?` from extension "${r}"`:""}function f(r){return[...new Set(r)].sort((e,t)=>e.localeCompare(t))}function y(r){if(typeof r!="string")throw new Error('A command name string is required. Pass it via the options object, e.g. runRegisteredCommandForTest(activation, { command: "my command" }) \u2014 positional command arguments are not supported.');return r.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0).join(" ")}function m(r){return r.length>0?r.join(", "):"(none)"}function be(r,e,t){let n=new Set(r??[]),s=f(e.filter(o=>!n.has(o)));if(s.length>0)throw new Error(`Expected package manifest ${t} to include ${s.join(", ")}; available: ${m(f(r??[]))}`)}function we(r){let e=new Set;for(let t of r)typeof t.long=="string"&&t.long.trim().length>0&&e.add(t.long.trim()),typeof t.short=="string"&&t.short.trim().length>0&&e.add(t.short.trim());return e}function P(r){let e=b(r);if(!e)return{};let t=b(e.manifest);if(t)return t;let n=b(e.default),s=b(n?.manifest);return s||(n&&typeof e.default!="function"&&("name"in n||"capabilities"in n)?n:typeof r!="function"&&("name"in e||"capabilities"in e)?e:{})}function T(r,e){return e??(typeof r.name=="string"&&r.name.trim().length>0?r.name.trim():"test-extension")}function Ee(r,e){return Array.isArray(e.capabilities)?[...e.capabilities]:Array.isArray(r.capabilities)?r.capabilities.filter(t=>typeof t=="string"):[]}function xe(r,e,t){return{disabled_by_flag:!1,roots:{global:"",project:""},configured_enabled:[],configured_disabled:[],discovered:[],effective:[],warnings:[],policy:t.policy,failed:[],loaded:[{layer:t.layer,directory:"",manifest_path:"",name:t.name,version:typeof e.version=="string"?e.version:"0.0.0",entry:typeof e.entry=="string"?e.entry:"./index.js",priority:typeof e.priority=="number"?e.priority:0,entry_path:"",capabilities:t.capabilities,manifest_version:typeof e.manifest_version=="number"?e.manifest_version:void 0,pm_min_version:typeof e.pm_min_version=="string"?e.pm_min_version:void 0,pm_max_version:typeof e.pm_max_version=="string"?e.pm_max_version:void 0,engines:e.engines,trusted:e.trusted,provenance:e.provenance,sandbox_profile:e.sandbox_profile,permissions:e.permissions,activation:e.activation,module:r}]}}async function Qe(r,e={}){let t=P(r);return oe(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:Ee(t,e),policy:e.policy??C()}))}async function Ze(r,e={}){let t=P(r);return ne(xe(r,t,{name:T(t,e.name),layer:e.layer??"project",capabilities:Ee(t,{}),policy:C()}),e.activation,e.deactivateTimeoutMs===void 0?{}:{deactivate_timeout_ms:e.deactivateTimeoutMs})}async function I(r,e){let t=y(e.command);if(t.length===0)throw new Error("Expected command name must be a non-empty string");if(!r.handlers.some(a=>a.command===t)){let a=f(r.handlers.map(d=>d.command));throw new Error(`Expected a registered command handler for "${t}" to invoke. Available command handlers: ${m(a)}`)}if(e.sdk!==void 0&&e.sdkFactory!==void 0)throw new TypeError("runRegisteredCommandForTest accepts sdk or sdkFactory, not both");let s=e.pmRoot??"",o={json:!0,quiet:!0,noPager:!0,...e.global},i=e.sdk??e.sdkFactory?.({pmRoot:s,global:o})??(s.length>0?ce(s,new pe({pmRoot:s})):void 0);return J(r,{command:t,args:e.args?[...e.args]:[],options:e.options?{...e.options}:{},global:o,pm_root:s,...i===void 0?{}:{sdk:i}})}async function er(r,e){if((r.beforeMutation?.length??0)===0)throw new Error("Expected a registered before_mutation hook to invoke");await z(r,e.context)}async function rr(r,e){let t=e.kind;if(t==="before_mutation")throw new Error("Invoke before_mutation hooks with runRegisteredMutationGuardForTest so denials and failures retain fail-closed semantics.");if((r[F[t]]?.length??0)===0){let n=f(Object.keys(F).filter(s=>(r[F[s]]?.length??0)>0));throw new Error(`Expected a registered "${t}" hook to invoke. Hook kinds with registrations: ${m(n)}`)}switch(e.kind){case"before_command":return V(r,e.context);case"after_command":return W(r,e.context);case"on_read":return Y(r,e.context);case"on_write":return G(r,e.context);case"on_index":return X(r,e.context)}}async function tr(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered parser override for command "${t}" to invoke. Available parser override commands: ${m(f(r.overrides.map(n=>n.command)))}`);return Q(r,e)}async function nr(r,e){if(r.overrides.length===0)throw new Error("Expected a registered preflight override to invoke, but none are registered.");return Z(r,e)}async function or(r,e){let t=y(e.command);if(!r.overrides.some(n=>n.command===t))throw new Error(`Expected a registered command override for command "${t}" to invoke. Available command override commands: ${m(f(r.overrides.map(n=>n.command)))}`);return re(r,e)}async function ir(r,e){if(!r.overrides.some(t=>t.format===e.format))throw new Error(`Expected a registered renderer override for format "${e.format}" to invoke. Available renderer override formats: ${m(f(r.overrides.map(t=>t.format)))}`);return te(r,e)}async function sr(r,e){if(!r.overrides.some(t=>t.service===e.service))throw new Error(`Expected a registered service override for service "${e.service}" to invoke. Available service override services: ${m(f(r.overrides.map(t=>t.service)))}`);return ee(r,e)}var ar={query:["query"],embed:["embed"],embedBatch:["embedBatch","embed_batch"],queryExpansion:["queryExpansion","query_expansion"],rerank:["rerank"]};async function dr(r,e){let t=ae(r,e.provider);if(!t){let o=f(r.search_providers.map(i=>i.definition.name));throw new Error(`Expected a registered search provider "${e.provider}" to invoke. Available search providers: ${m(o)}`)}let n=t.runtime_definition,s=ar[e.operation].map(o=>n[o]).find(o=>typeof o=="function");if(typeof s!="function")throw new Error(`Registered search provider "${e.provider}" does not implement the "${e.operation}" operation.`);return await s(e.context)}async function mr(r,e){let t=de(r,e.adapter);if(!t){let s=f(r.vector_store_adapters.map(o=>o.definition.name));throw new Error(`Expected a registered vector store adapter "${e.adapter}" to invoke. Available vector store adapters: ${m(s)}`)}let n=t.runtime_definition[e.operation];if(typeof n!="function")throw new Error(`Registered vector store adapter "${e.adapter}" does not implement the "${e.operation}" operation.`);return await n(e.context)}async function cr(r,e){let t=ke(r,{migration:e.migration,extensionName:e.extensionName}),n=me(t).run;if(typeof n!="function")throw new Error(`Registered migration "${e.migration}" does not implement a run function to invoke.`);let s=t.definition.status,o={id:t.definition.id,command:"migration",layer:t.layer,extension:t.name,pm_root:e.pmRoot??"",status:(typeof s=="string"?s.trim().toLowerCase():"")||"pending"};return await n(o)}async function fr(r,e){let t=_e(r.registrations,{importer:e.importer,extensionName:e.extensionName});return I(r.commands,{command:`${t.importer} import`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}async function lr(r,e){let t=$e(r.registrations,{exporter:e.exporter,extensionName:e.extensionName});return I(r.commands,{command:`${t.exporter} export`,args:e.args,options:e.options,global:e.global,pmRoot:e.pmRoot})}function Qr(r,e={}){let t=e.deactivated??1;if(r.deactivated!==t)throw new Error(`Expected ${t} extension${t===1?"":"s"} to deactivate cleanly, but ${r.deactivated} did.`);let n=e.failed??0;if(r.failed.length!==n){let s=r.failed.map(o=>`${o.layer}:${o.name} (${o.error})`).join(", ");throw new Error(`Expected ${n} teardown failure${n===1?"":"s"}, but observed ${r.failed.length}${s.length>0?`: ${s}`:""}.`)}return r}function Zr(r,e){if(e.packageName!==void 0&&r.package_name!==e.packageName)throw new Error(`Expected package manifest package_name to be "${e.packageName}"; received "${r.package_name??"(none)"}"`);if(e.aliases!==void 0&&be(r.aliases,e.aliases,"aliases"),e.resources!==void 0)for(let[t,n]of Object.entries(e.resources))be(r.resources[t],n,`pm.${t}`);return r}function pr(r,e){let t=y(g(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.commands.filter(i=>i.command===t),s=e.extensionName?n.find(i=>i.name===e.extensionName):n[0];if(!s){let i=r.commands.map(d=>d.command).sort((d,c)=>d.localeCompare(c)),a=e.extensionName?` from extension "${e.extensionName}"`:"";throw new Error(`Expected extension command "${t}"${a} to be registered. Available commands: ${m(i)}`)}if(e.action!==void 0&&s.action!==e.action)throw new Error(`Expected extension command "${t}" action "${e.action}", received "${s.action}"`);if(e.arguments!==void 0){let i=(s.arguments??[]).map(d=>d.name),a=e.arguments.filter(d=>!i.includes(d));if(a.length>0)throw new Error(`Expected extension command "${t}" arguments ${m(e.arguments)}; missing ${m(a)}; available ${m(i)}`)}let o=r.flags.filter(i=>i.target_command===t&&(e.extensionName===void 0||i.name===e.extensionName)).flatMap(i=>i.flags);if(e.flags!==void 0){let i=we(o),a=e.flags.filter(d=>!i.has(d));if(a.length>0)throw new Error(`Expected extension command "${t}" flags ${m(e.flags)}; missing ${m(a)}; available ${m([...i].sort((d,c)=>d.localeCompare(c)))}`)}return{command:s,flags:o}}function ur(r,e){let t=y(g(e,e.targetCommand));if(t.length===0)throw new Error("Expected target command name must be a non-empty string");let n=r.flags.filter(o=>o.target_command===t),s;if(e.extensionName)s=n.find(o=>o.name===e.extensionName);else if(n.length===1)s=n[0];else if(n.length>1){let o=f(n.map(i=>i.name));throw new Error(`Expected flags for target command "${t}" matched multiple extensions: ${m(o)}. Specify extensionName to choose one registration.`)}if(!s){let o=f(r.flags.map(a=>a.target_command)),i=f(n.map(a=>a.name));throw new Error(`Expected flags for target command "${t}"${u(e.extensionName)} to be registered. Available flag target commands: ${m(o)}; matching extensions: ${m(i)}`)}if(e.flags!==void 0){let o=we(s.flags),i=e.flags.filter(a=>!o.has(a));if(i.length>0)throw new Error(`Expected flags for target command "${t}" to include ${m(e.flags)}; missing ${m(i)}; available ${m([...o].sort((a,d)=>a.localeCompare(d)))}`)}return s}function gr(r,e){let t=Je[e.kind],n=r[t]??[],s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(n.map(i=>i.name));throw new Error(`Expected a "${e.kind}" hook${u(e.extensionName)} to be registered. Available "${e.kind}" hooks: ${m(o)}`)}return s}function vr(r,e){let t=p(g(e,e.provider));if(t.length===0)throw new Error("Expected search provider name must be a non-empty string");let n=r.search_providers.filter(o=>p(o.definition.name)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.search_providers.map(i=>i.definition.name));throw new Error(`Expected search provider "${t}"${u(e.extensionName)} to be registered. Available search providers: ${m(o)}`)}return s}function hr(r,e){let t=p(g(e,e.adapter));if(t.length===0)throw new Error("Expected vector store adapter name must be a non-empty string");let n=r.vector_store_adapters.filter(o=>p(o.definition.name)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.vector_store_adapters.map(i=>i.definition.name));throw new Error(`Expected vector store adapter "${t}"${u(e.extensionName)} to be registered. Available vector store adapters: ${m(o)}`)}return s}function _e(r,e){let t=p(g(e,e.importer));if(t.length===0)throw new Error("Expected importer name must be a non-empty string");let n=r.importers.filter(o=>p(o.importer)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.importers.map(i=>i.importer));throw new Error(`Expected importer "${t}"${u(e.extensionName)} to be registered. Available importers: ${m(o)}`)}return s}function $e(r,e){let t=p(g(e,e.exporter));if(t.length===0)throw new Error("Expected exporter name must be a non-empty string");let n=r.exporters.filter(o=>p(o.exporter)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.exporters.map(i=>i.exporter));throw new Error(`Expected exporter "${t}"${u(e.extensionName)} to be registered. Available exporters: ${m(o)}`)}return s}function yr(r,e){let t=p(g(e,e.field));if(t.length===0)throw new Error("Expected item field name must be a non-empty string");let s=r.item_fields.filter(o=>e.extensionName===void 0||o.name===e.extensionName).map(o=>({registration:o,field:o.fields.find(i=>p(i.name)===t)})).filter(o=>o.field!==void 0).find(o=>e.type===void 0||o.field.type===e.type);if(!s){let o=f(r.item_fields.flatMap(i=>i.fields.map(a=>`${a.name}:${a.type}`)));throw new Error(`Expected item field "${t}"${u(e.extensionName)} to be registered. Available item fields: ${m(o)}`)}return s}function br(r,e){let t=p(g(e,e.itemType));if(t.length===0)throw new Error("Expected item type name must be a non-empty string");let s=r.item_types.filter(o=>e.extensionName===void 0||o.name===e.extensionName).map(o=>({registration:o,itemType:o.types.find(i=>p(i.name)===t)})).filter(o=>o.itemType!==void 0).find(o=>e.folder===void 0||o.itemType.folder===e.folder);if(!s){let o=f(r.item_types.flatMap(i=>i.types.map(a=>`${a.name}:${a.folder}`)));throw new Error(`Expected item type "${t}"${u(e.extensionName)} to be registered. Available item types: ${m(o)}`)}return s}function wr(r,e){let t=ye(g(e,e.profile));if(t.length===0)throw new Error("Expected profile name must be a non-empty string");let n=r.profiles.filter(s=>e.extensionName===void 0||s.name===e.extensionName).find(s=>ye(s.profile.name)===t);if(!n){let s=f(r.profiles.map(o=>o.profile.name));throw new Error(`Expected profile "${t}"${u(e.extensionName)} to be registered. Available profiles: ${m(s)}`)}return{registration:n,profile:n.profile}}function Er(r,e){let t=y(g(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(o=>o.command===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.command));throw new Error(`Expected command override "${t}"${u(e.extensionName)} to be registered. Available command overrides: ${m(o)}`)}return s}function xr(r,e){let t=y(g(e,e.command));if(t.length===0)throw new Error("Expected command name must be a non-empty string");let n=r.overrides.filter(o=>o.command===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.command));throw new Error(`Expected parser override "${t}"${u(e.extensionName)} to be registered. Available parser overrides: ${m(o)}`)}return s}function _r(r,e={}){let t=e.extensionName?r.overrides.find(n=>n.name===e.extensionName):r.overrides[0];if(!t){let n=f(r.overrides.map(s=>s.name));throw new Error(`Expected a preflight override${u(e.extensionName)} to be registered. Available preflight overrides: ${m(n)}`)}return t}function $r(r,e){let t=p(g(e,e.format));if(t.length===0)throw new Error("Expected renderer format must be a non-empty string");let n=r.overrides.filter(o=>o.format===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.format));throw new Error(`Expected renderer override "${t}"${u(e.extensionName)} to be registered. Available renderer overrides: ${m(o)}`)}return s}function kr(r,e){let t=p(g(e,e.service));if(t.length===0)throw new Error("Expected service name must be a non-empty string");let n=r.overrides.filter(o=>p(o.service)===t),s=e.extensionName?n.find(o=>o.name===e.extensionName):n[0];if(!s){let o=f(r.overrides.map(i=>i.service));throw new Error(`Expected service override "${t}"${u(e.extensionName)} to be registered. Available service overrides: ${m(o)}`)}return s}function ke(r,e){let t=p(g(e,e.migration));if(t.length===0)throw new Error("Expected migration id must be a non-empty string");let n=r.migrations.filter(a=>(e.extensionName===void 0||a.name===e.extensionName)&&typeof a.definition.id=="string"&&p(a.definition.id)===t),s=n.find(a=>e.mandatory===void 0||(a.definition.mandatory??!1)===e.mandatory);if(s)return s;let o=n[0];if(o!==void 0)throw new Error(`Expected migration "${t}"${u(e.extensionName)} to have mandatory=${e.mandatory}, but it is mandatory=${o.definition.mandatory??!1}.`);let i=f(r.migrations.map(a=>`${typeof a.definition.id=="string"&&a.definition.id.trim().length>0?a.definition.id.trim():"(unnamed)"}:${a.definition.mandatory===!0}`));throw new Error(`Expected migration "${t}"${u(e.extensionName)} to be registered. Available migrations: ${m(i)}`)}function Cr(r,e){let t=(d,c)=>{let E=new Set;for(let M of d){let j=x(M);if(j===null)throw new Error(`Expected ${c} capability "${M}" to be a known extension capability. Use canonical capability names (see manifest.capabilities).`);E.add(j)}return E},n=[...t(e.declared,"declared")].sort((d,c)=>d.localeCompare(c)),s=t(e.allowUnused??[],"allowUnused"),o=ie(r,{extensionName:e.extensionName}),i=new Set(o),a=n.filter(d=>!i.has(d)&&!s.has(d));if(a.length>0){let d=u(e.extensionName);throw new Error(`Expected every declared capability${d} to be exercised, but [${a.join(", ")}] ${a.length===1?"is":"are"} declared yet never registered against. Remove ${a.length===1?"it":"them"} from manifest.capabilities for least privilege, or pass allowUnused for capabilities registered only behind a runtime flag.`)}return{declared:n,used:o,unused:a}}function et(r,e={}){let t=k(r,e);if(!t.ok){let n=t.findings.filter(s=>s.severity==="error");throw new Error(`Extension blueprint failed preflight with ${n.length} ${n.length===1?"error":"errors"}:
|
|
2
2
|
`+n.map(s=>` - [${s.code}] ${s.message}`).join(`
|
|
3
3
|
`))}return t}function rt(r,e={}){let t=le(r),n=t.findings.filter(s=>s.severity==="error"||e.strict===!0&&s.severity==="warning");if(n.length>0)throw new Error(`Project profile "${t.profile}" failed lint with ${n.length} ${n.length===1?"issue":"issues"}:
|
|
4
4
|
`+n.map(s=>` - ${s.severity} [${s.code}] ${s.message}`).join(`
|
|
5
5
|
`));return t}function tt(r,e){let t=Array.isArray(r.capabilities)?r.capabilities:[],n=k(e,{declaredCapabilities:t}),s=n.declared,o=new Set(s),i=new Set(n.used),a=n.used.filter(c=>!o.has(c)),d=s.filter(c=>!i.has(c));if(a.length>0||d.length>0){let c=[];throw a.length>0&&c.push(`missing [${a.join(", ")}] (the blueprint registers ${a.length===1?"a surface":"surfaces"} requiring ${a.length===1?"it":"them"}; activation throws extension_capability_missing)`),d.length>0&&c.push(`unused [${d.join(", ")}] (declared but no surface exercises ${d.length===1?"it":"them"}; drop for least privilege)`),new Error(`Manifest capabilities do not match the blueprint: ${c.join("; ")}. Set capabilities to synthesizeExtensionManifest(blueprint, identity).capabilities to stay in sync.`)}return{used:n.used,declared:s,missing:a,unused:d,findings:n.findings}}function nt(r,e){let t=A(r,e),n=t.findings.filter(s=>s.severity==="error");if(n.length>0)throw new Error(`Extension manifest is not compatible with pm ${t.pmVersion}: ${n.map(s=>s.message).join("; ")}`);return t}function ot(r,e={}){let t=he(r,e);if(!t.ok){let n=t.findings.filter(s=>s.severity==="error");throw new Error(`Extension failed preflight with ${n.length} ${n.length===1?"error":"errors"}:
|
|
6
6
|
`+n.map(s=>` - [${s.source}:${s.code}] ${s.message}`).join(`
|
|
7
7
|
`))}return t}function Rr(r){if(!B(r))throw new Error("createExtensionTestHarness received a module with no activate export. Pass the extension module (with an activate(api) function on the module or its default export) as the first argument, and options second.")}async function it(r,e={}){Rr(r);let t=P(r),n=T(t,e.name),s=e.layer??"project",o=await Qe(r,e);if(o.failed.length>0){let i=o.failed.map(a=>{let d=a.trace?.missing_capability,c=d?`${a.error}; missing capability "${d}"`:a.error;return`${a.layer}:${a.name} (${c})`}).join(", ");throw new Error(`createExtensionTestHarness could not activate the extension cleanly: ${i}. Declare the required capability in the manifest (or pass it via options.capabilities), or use activateExtensionForTest directly to inspect a failed activation.`)}return{module:r,name:n,layer:s,activation:o,activationSummary(i){return R(o,i)},renderMarkdown(i={}){let{extensionName:a,...d}=i??{};return fe(R(o,{extensionName:a}),d)},assertCommandContract(i){return pr(o.registrations,i)},assertFlags(i){return ur(o.registrations,i)},assertItemField(i){return yr(o.registrations,i)},assertItemType(i){return br(o.registrations,i)},assertProfile(i){return wr(o.registrations,i)},assertHook(i){return gr(o.hooks,i)},assertCommandOverride(i){return Er(o.commands,i)},assertParserOverride(i){return xr(o.parsers,i)},assertPreflightOverride(i){return _r(o.preflight,i)},assertRendererOverride(i){return $r(o.renderers,i)},assertServiceOverride(i){return kr(o.services,i)},assertSearchProvider(i){return vr(o.registrations,i)},assertVectorStoreAdapter(i){return hr(o.registrations,i)},assertImporter(i){return _e(o.registrations,i)},assertExporter(i){return $e(o.registrations,i)},assertMigration(i){return ke(o.registrations,i)},assertCapabilityUsage(i){return Cr(o,i)},runCommand(i){return I(o.commands,i)},runHook(i){return rr(o.hooks,i)},runMutationGuard(i){return er(o.hooks,i)},runCommandOverride(i){return or(o.commands,i)},runParserOverride(i){return tr(o.parsers,i)},runPreflightOverride(i){return nr(o.preflight,i)},runRendererOverride(i){return ir(o.renderers,i)},runServiceOverride(i){return sr(o.services,i)},runSearchProvider(i){return dr(o.registrations,i)},runVectorStoreAdapter(i){return mr(o.registrations,i)},runMigration(i){return cr(o.registrations,i)},runImporter(i){return fr(o,i)},runExporter(i){return lr(o,i)},deactivate(i={}){return Ze(r,{name:n,layer:s,activation:o,deactivateTimeoutMs:i.deactivateTimeoutMs})}}}export{Ir as a,Mr as b,Oe as c,jr as d,N as e,qe as f,k as g,ve as h,Br as i,A as j,he as k,Qe as l,Ze as m,I as n,er as o,rr as p,tr as q,nr as r,or as s,ir as t,sr as u,dr as v,mr as w,cr as x,fr as y,lr as z,Qr as A,Zr as B,pr as C,ur as D,gr as E,vr as F,hr as G,_e as H,$e as I,yr as J,br as K,wr as L,Er as M,xr as N,_r as O,$r as P,kr as Q,ke as R,Cr as S,et as T,rt as U,tt as V,nt as W,ot as X,it as Y};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-5P5PYCZX.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as gc,b as Ye,c as an,d as bc,e as wc,h as vc}from"./chunk-NYE6EREL.js";import{J as vo,L as Ic,M as Lc,O as Dc,Q as Nc,R as jc,a as kt,b as co,d as $e,e as _c,j as hc,p as wo}from"./chunk-BY3ID7QI.js";import{$ as io,Bc as Tc,Cc as xc,Dc as Oc,Eb as St,Ec as $c,Ed as Io,F as bt,Fb as fo,Fc as Pc,Fd as Eo,G as g,H as ca,Hb as dc,Hc as Fc,Hd as zc,I as la,Ic as Mc,K as Z,L as da,M as Yt,Ma as tc,Mb as _o,Mc as ko,N as ma,Na as so,O as eo,Od as Hc,P as Jt,Pa as nc,Pd as Wc,Q as to,Qa as oc,R as Ce,Ra as ao,S as pa,T as no,Tc as Uc,U as V,Uc as Gc,V as oo,W as G,Wc as qc,X as ua,Y as fa,Z as ro,_ as _a,bb as on,cc as It,dc as ho,ec as mc,fc as pc,gc as Ke,ha,hc as uc,ib as rc,ic as fc,ja as Xa,jb as rn,jc as go,kb as ic,kc as yo,lc as bo,ld as So,ma as Za,mb as Ve,na as Qa,nb as sc,ob as lo,pb as sn,rb as Be,sa as vt,tc as Pe,vb as ac,vc as yc,wb as cc,wc as Ac,xb as lc,xc as Rc,yc as Cc}from"./chunk-XEV7BHH3.js";import{$ as Ma,A as Xt,B as wa,C as xe,D as va,E as Zt,F as ka,G as Qt,Ga as Ua,M as Sa,P as Ia,Qa as en,R as Ea,S as Aa,T as Ra,U as Ca,Ua as kc,V as Ta,W as xa,X as Oa,Xa as Sc,Y as $a,Z as Pa,_ as Fa,aa as La,b as oa,ba as Da,ca as Na,da as ja,q as ga,w as ya,y as Te,z as ba,za as wt}from"./chunk-5JIJAWIF.js";import{Ac as mo,Ia as Ga,Ja as qa,Ka as za,Na as Ha,Oa as Wa,Ob as me,Pa as Va,Qa as Ba,Sa as Oe,Ta as Ka,U as sa,Ua as Ya,Uc as po,Xa as tn,Za as Ja,Zc as uo,ad as Ec,bb as ve,cb as ec,d as ta,db as nn,f as na,s as ra,t as ia,za as aa}from"./chunk-D5AJQU7F.js";import{$b as si,$d as pt,$j as de,$n as we,A as Br,Aa as xn,Ac as jt,Ad as wi,Ak as fs,Am as Es,B as Kr,Bd as mt,Bk as yt,Cc as ci,Ck as _s,Cn as js,Dd as vi,Dk as Vt,E as Yr,Ed as ki,Ek as hs,Em as As,Fk as Jn,Gd as Ut,Gh as zi,Gk as Xn,Gn as Us,Hk as gs,Hl as ws,Hn as Gs,Ic as li,Id as Si,Ii as We,In as qs,Jd as Ii,Jh as He,Jm as Rs,Jn as zs,Kb as Lt,Kc as Ln,Kd as Ei,Km as Cs,Kn as Hs,Lc as Dn,Le as Oi,Lf as Fi,Mc as Nn,Me as $i,Mm as Ts,Mn as Ws,Nc as jn,Ne as Pi,Nh as Hi,Nj as ts,Nn as Vs,O as p,Oc as Un,Of as Mi,Oi as Vn,On as Bs,Pb as Ue,Pc as Gn,Pi as Bn,Pm as xs,Pn as Ks,Q as m,Qa as On,Qc as qn,Qn as Ys,Ra as $n,Rc as $,Rf as Li,Rn as Js,S as Jr,Sa as Pn,Sd as qe,T as ye,Ta as Fn,Td as Ee,Ud as Ai,Uj as ns,Un as Xs,Vb as ei,Vd as Ri,Vi as Wi,Vn as Kt,Wb as ti,Wc as di,Wd as Ae,Wj as os,Wn as Zs,Xb as ni,Xc as mi,Xd as Ci,Xj as rs,Xn as Qs,Yb as oi,Z as Tn,Zb as ri,Zd as H,Zi as Vi,Zj as is,_b as ii,_c as z,_j as P,ab as F,ae as Ti,ak as be,ao as A,ba as S,bb as Mt,bf as Wn,bg as zt,bj as Bi,cd as pi,cf as C,dd as ui,de as xi,df as te,dk as ht,dn as Os,ec as lt,ej as le,f as oe,fa as Xr,fc as ai,gk as Wt,gn as $s,h as Rn,ha as Zr,hj as Ki,hm as vs,hn as Ps,ia as Ot,ib as E,id as Ge,ij as Yi,j as zr,ja as $t,ji as ft,jk as gt,ka as Pt,ke as Re,kh as Ui,ki as _t,kj as Ht,kk as ss,kl as Zn,la as Ft,lb as ct,mb as Mn,md as fi,me as ze,mj as Ji,mk as Kn,ml as Qn,nd as _i,nh as Gi,o as ge,ob as Ie,of as W,ok as Yn,oo as ea,p as je,pf as qt,pn as Fs,q as Cn,qa as ce,qd as dt,qe as Gt,qm as ks,r as ae,rd as hi,re as ut,rn as Ms,s as re,sd as gi,se as Hn,sk as as,sm as Ss,t as st,td as yi,tj as Xi,tk as cs,tm as Bt,u as Hr,ud as bi,uk as ls,um as Is,vg as Di,vk as ds,wg as Ni,wj as R,wk as ms,wl as ys,xa as Qr,xj as Zi,xl as bs,xn as Ls,y as Wr,ya as at,yc as Dt,yh as qi,yj as Qi,yk as ps,yn as Ds,z as Vr,zc as Nt,zd as zn,zg as ji,zj as es,zk as us,zn as Ns}from"./chunk-33PER336.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cde4f476-6821-53be-b70e-62794fa2ae52")}catch{}})();var Cg=Hr,Tg=Wr,xg=Kr,Og=Vr,$g=Br;function Vc(e,t,n,o){let r=e.flag.slice(2).replace(/[-_]([a-z])/gu,(s,a)=>a.toUpperCase()),i=n.has(r);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:i?"string":"boolean",...i?{value_name:e.value_name??"value"}:{}}}function Bc(e,t=[]){let n=new Set(t.flatMap(r=>r.keys)),o=[];for(let r of ks(e.map(i=>({...i})))){o.push(Vc(r,r.flag,n,r.short));for(let i of r.aliases??[])o.push(Vc(r,i,n))}return o}var Pg=Bc(Bt,ys),sm=Bc(Kt,bs);import{AsyncLocalStorage as qh}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="176b4ac2-2c47-50d6-beee-62e1d3dc9281")}catch{}})();function Kc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function am(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Ao(e,t){let n=am(t),o=n==="brief"?n:Kc(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Kc(e.filters)?e.filters:{},projection:o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3046466c-614c-5e2b-a156-df96fba8c483")}catch{}})();async function Yc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return ht(n,o.item_format,F(o,null).type_to_folder,void 0,o.schema)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f6e02611-4b44-5aa3-b762-9fd984aa12bc")}catch{}})();var cm=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],cn=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",sdk:"await client.listAllComplete()"}}}};function Ro(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function M(e,t,n,o){t&&e.push({code:n,message:o})}function lm(e,t){let n=pe(e.completeness)?e.completeness:{};M(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),M(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=n.unreadable_item_count,r=n.unreadable_directory_count;M(t,n.status==="complete"&&(o!==0||r!==0)&&Number.isSafeInteger(o)&&Number.isSafeInteger(r),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),M(t,n.status==="complete"&&(!Number.isSafeInteger(o)||!Number.isSafeInteger(r)||Number(o)<0||Number(r)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let i=pe(e.filters)?e.filters:{},s=pe(i.runtime_filters)?i.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return M(t,i.status!=="all"||Object.keys(s).length>0||Object.keys(i).some(c=>!a.has(c)),"filtered_corpus","The list did not explicitly select every lifecycle status."),M(t,i.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),M(t,i.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),i}function dm(e,t,n){M(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),M(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=pe(e.projection)?e.projection:{};M(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let r=pe(e.omission_receipt)?e.omission_receipt:void 0;M(n,r===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),M(n,r!==void 0&&(r.has_omissions!==!1||r.omitted_field_group_count!==0||!Number.isSafeInteger(r.omitted_field_group_count)||!Array.isArray(r.omitted_field_groups)||r.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),M(n,r?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function mm(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function pm(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function um(e,t){let n=pe(e.read_output)?e.read_output:void 0;M(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),M(t,n!==void 0&&mm(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),M(t,n!==void 0&&!pm(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),M(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=pe(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;M(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),M(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function fm(e,t){let n=e.map(o=>pe(o)&&typeof o.id=="string"?o.id.trim():"");M(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),M(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function Jc(e){if(!pe(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:cm[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=lm(t,n);return dm(t,o,n),um(t,n),fm(t.items,n),{ok:n.length===0,findings:n}}function ln(e){let t=Jc(e);if(!t.ok)throw new cn(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function _m(e){ln(e)}import el from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c84b11c-502f-5c33-a757-5757402357b4")}catch{}})();function Xc(e){return e.map(t=>({key:t.key,optionName:Ti(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function Zc(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard",family:t.family??"extensions"}))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e8137f8b-745a-5ef5-9e7e-14b7d032c1ea")}catch{}})();var hm=50,ke=new Map;function Co(){ke.clear()}function Qc(e,t){let n=ke.get(e);if(n!==void 0)return n;if(ke.size>=hm){let r=ke.keys().next().value;ke.delete(r)}let o=t().catch(r=>{throw ke.get(e)===o&&ke.delete(e),r});return ke.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b841f903-6276-5067-842f-6a6bff114cec")}catch{}})();function gm(e,t,n){return JSON.stringify([el.resolve(e),el.resolve(n??process.cwd()),t.extensions.enabled,t.extensions.disabled,t.extensions.policy])}async function ym(e,t,n){let o=gm(e,t,n);return Qc(o,()=>wm(e,t,n))}async function bm(e,t={}){let n=await R(e),o=t.extensionRegistrations??(t.noExtensions===!0?null:await ym(e,n,t.cwd)),r=F(n,o),i=H(n.schema),s=pt(n.schema);return{types:[...r.types],statuses:i.definitions.map(a=>a.id),openStatus:i.open_status,closeStatus:i.close_status,canceledStatus:i.canceled_status,fields:Xc(s.definitions),extensionCommands:Zc(o?.commands??[])}}async function wm(e,t,n){let o=await Dt({pmRoot:e,settings:t,cwd:n??process.cwd(),noExtensions:!1}),r=await jt(o);try{return r.registrations}finally{try{await Nt(o,r)}catch{}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c7a926a-46a2-560c-ae95-33b92b8c820e")}catch{}})();var vm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function tl(e){return Object.fromEntries(Di.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var To={ctx:{action:"context"},...vm,...tl("extension"),...tl("package"),...Object.fromEntries(Ni.map(e=>[`package-${e}`,{action:e}]))};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var nl="PmCliError";function km(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=p.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function Sm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new m(e,km(t.exitCode??p.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function xo(e){if(!(e instanceof Error)||e.name!==nl)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as Et}from"node:fs";import{lstat as ol,mkdir as $o,open as rl}from"node:fs/promises";import ue from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e57a9bca-1190-5ffd-bb7d-d76a22fc9e57")}catch{}})();function Oo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Po(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function Im(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function Em(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=o.incomingOne.get(`${r.kind}\0${e.target}`);if(s!==void 0&&s!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let a=Po(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function Am(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function Rm(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=Oo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:Oo(e.relationshipId,"relationshipId"),author:Oo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Cm(e,t,n,o,r,i){let s=n.has(t);if(e.action==="add"&&s)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let l=new Ue([a,c],[e.edge],r).edges()[0];return Em(l,t,r,i),Im(l)}var At=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Lt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,s;for(let a of this.stream({...o,batchSize:256}))for(let c of a)r=n(r,c),i+=1,s=c;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...s===void 0?{}:{asOf:s.timestamp}})}#s(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(Po(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Po(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=Rm(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=Cm(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#s(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(s=>Date.parse(s.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=Am(n),r=new Ue(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Fi("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Mi(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Li(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Tm="relationship-event-store",il=Et.O_NOFOLLOW;function dn(e){return te(e,Tm,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Fe(e,t="relationships/events.jsonl"){let n=ue.resolve(e),o=ue.resolve(n,t),r=ue.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${ue.sep}`)||ue.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await $o(n,{recursive:!0}),(await ol(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let s=n;for(let a of r.split(ue.sep)){s=ue.join(s,a);try{if((await ol(s)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Cn(c))break;throw c}}return o}async function mn(e,t,n){let o=new At(t,{registry:n}),r,i;try{i=await rl(e,Et.O_RDONLY|il),r=await i.readFile("utf8")}catch(a){if(Cn(a))return{log:o,raw:""};throw a}finally{await i?.close()}let s=r.split(`
|
|
1
|
+
import{a as gc,b as Ye,c as an,d as bc,e as wc,h as vc}from"./chunk-YMMLKKEP.js";import{J as vo,L as Ic,M as Lc,O as Dc,Q as Nc,R as jc,a as kt,b as co,d as $e,e as _c,j as hc,p as wo}from"./chunk-Y2P3DSSO.js";import{$ as io,Bc as Tc,Cc as xc,Dc as Oc,Eb as St,Ec as $c,Ed as Io,F as bt,Fb as fo,Fc as Pc,Fd as Eo,G as g,H as ca,Hb as dc,Hc as Fc,Hd as zc,I as la,Ic as Mc,K as Z,L as da,M as Yt,Ma as tc,Mb as _o,Mc as ko,N as ma,Na as so,O as eo,Od as Hc,P as Jt,Pa as nc,Pd as Wc,Q as to,Qa as oc,R as Ce,Ra as ao,S as pa,T as no,Tc as Uc,U as V,Uc as Gc,V as oo,W as G,Wc as qc,X as ua,Y as fa,Z as ro,_ as _a,bb as on,cc as It,dc as ho,ec as mc,fc as pc,gc as Ke,ha,hc as uc,ib as rc,ic as fc,ja as Xa,jb as rn,jc as go,kb as ic,kc as yo,lc as bo,ld as So,ma as Za,mb as Ve,na as Qa,nb as sc,ob as lo,pb as sn,rb as Be,sa as vt,tc as Pe,vb as ac,vc as yc,wb as cc,wc as Ac,xb as lc,xc as Rc,yc as Cc}from"./chunk-WDF7PP4P.js";import{$ as Ma,A as Xt,B as wa,C as xe,D as va,E as Zt,F as ka,G as Qt,Ga as Ua,M as Sa,P as Ia,Qa as en,R as Ea,S as Aa,T as Ra,U as Ca,Ua as kc,V as Ta,W as xa,X as Oa,Xa as Sc,Y as $a,Z as Pa,_ as Fa,aa as La,b as oa,ba as Da,ca as Na,da as ja,q as ga,w as ya,y as Te,z as ba,za as wt}from"./chunk-3AHONKLL.js";import{Ac as mo,Ia as Ga,Ja as qa,Ka as za,Na as Ha,Oa as Wa,Ob as me,Pa as Va,Qa as Ba,Sa as Oe,Ta as Ka,U as sa,Ua as Ya,Uc as po,Xa as tn,Za as Ja,Zc as uo,ad as Ec,bb as ve,cb as ec,d as ta,db as nn,f as na,s as ra,t as ia,za as aa}from"./chunk-UKLOSZV6.js";import{$b as si,$d as pt,$j as de,$n as we,A as Br,Aa as xn,Ac as jt,Ad as wi,Ak as fs,Am as Es,B as Kr,Bd as mt,Bk as yt,Cc as ci,Ck as _s,Cn as js,Dd as vi,Dk as Vt,E as Yr,Ed as ki,Ek as hs,Em as As,Fk as Jn,Gd as Ut,Gh as zi,Gk as Xn,Gn as Us,Hk as gs,Hl as ws,Hn as Gs,Ic as li,Id as Si,Ii as We,In as qs,Jd as Ii,Jh as He,Jm as Rs,Jn as zs,Kb as Lt,Kc as Ln,Kd as Ei,Km as Cs,Kn as Hs,Lc as Dn,Le as Oi,Lf as Fi,Mc as Nn,Me as $i,Mm as Ts,Mn as Ws,Nc as jn,Ne as Pi,Nh as Hi,Nj as ts,Nn as Vs,O as p,Oc as Un,Of as Mi,Oi as Vn,On as Bs,Pb as Ue,Pc as Gn,Pi as Bn,Pm as xs,Pn as Ks,Q as m,Qa as On,Qc as qn,Qn as Ys,Ra as $n,Rc as $,Rf as Li,Rn as Js,S as Jr,Sa as Pn,Sd as qe,T as ye,Ta as Fn,Td as Ee,Ud as Ai,Uj as ns,Un as Xs,Vb as ei,Vd as Ri,Vi as Wi,Vn as Kt,Wb as ti,Wc as di,Wd as Ae,Wj as os,Wn as Zs,Xb as ni,Xc as mi,Xd as Ci,Xj as rs,Xn as Qs,Yb as oi,Z as Tn,Zb as ri,Zd as H,Zi as Vi,Zj as is,_b as ii,_c as z,_j as P,ab as F,ae as Ti,ak as be,ao as A,ba as S,bb as Mt,bf as Wn,bg as zt,bj as Bi,cd as pi,cf as C,dd as ui,de as xi,df as te,dk as ht,dn as Os,ec as lt,ej as le,f as oe,fa as Xr,fc as ai,gk as Wt,gn as $s,h as Rn,ha as Zr,hj as Ki,hm as vs,hn as Ps,ia as Ot,ib as E,id as Ge,ij as Yi,j as zr,ja as $t,ji as ft,jk as gt,ka as Pt,ke as Re,kh as Ui,ki as _t,kj as Ht,kk as ss,kl as Zn,la as Ft,lb as ct,mb as Mn,md as fi,me as ze,mj as Ji,mk as Kn,ml as Qn,nd as _i,nh as Gi,o as ge,ob as Ie,of as W,ok as Yn,oo as ea,p as je,pf as qt,pn as Fs,q as Cn,qa as ce,qd as dt,qe as Gt,qm as ks,r as ae,rd as hi,re as ut,rn as Ms,s as re,sd as gi,se as Hn,sk as as,sm as Ss,t as st,td as yi,tj as Xi,tk as cs,tm as Bt,u as Hr,ud as bi,uk as ls,um as Is,vg as Di,vk as ds,wg as Ni,wj as R,wk as ms,wl as ys,xa as Qr,xj as Zi,xl as bs,xn as Ls,y as Wr,ya as at,yc as Dt,yh as qi,yj as Qi,yk as ps,yn as Ds,z as Vr,zc as Nt,zd as zn,zg as ji,zj as es,zk as us,zn as Ns}from"./chunk-J4DRE3WN.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cde4f476-6821-53be-b70e-62794fa2ae52")}catch{}})();var Cg=Hr,Tg=Wr,xg=Kr,Og=Vr,$g=Br;function Vc(e,t,n,o){let r=e.flag.slice(2).replace(/[-_]([a-z])/gu,(s,a)=>a.toUpperCase()),i=n.has(r);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:i?"string":"boolean",...i?{value_name:e.value_name??"value"}:{}}}function Bc(e,t=[]){let n=new Set(t.flatMap(r=>r.keys)),o=[];for(let r of ks(e.map(i=>({...i})))){o.push(Vc(r,r.flag,n,r.short));for(let i of r.aliases??[])o.push(Vc(r,i,n))}return o}var Pg=Bc(Bt,ys),sm=Bc(Kt,bs);import{AsyncLocalStorage as qh}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="176b4ac2-2c47-50d6-beee-62e1d3dc9281")}catch{}})();function Kc(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function am(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Ao(e,t){let n=am(t),o=n==="brief"?n:Kc(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Kc(e.filters)?e.filters:{},projection:o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3046466c-614c-5e2b-a156-df96fba8c483")}catch{}})();async function Yc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return ht(n,o.item_format,F(o,null).type_to_folder,void 0,o.schema)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f6e02611-4b44-5aa3-b762-9fd984aa12bc")}catch{}})();var cm=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],cn=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded --json",sdk:"await client.listAllComplete()"}}}};function Ro(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function pe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function M(e,t,n,o){t&&e.push({code:n,message:o})}function lm(e,t){let n=pe(e.completeness)?e.completeness:{};M(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),M(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=n.unreadable_item_count,r=n.unreadable_directory_count;M(t,n.status==="complete"&&(o!==0||r!==0)&&Number.isSafeInteger(o)&&Number.isSafeInteger(r),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),M(t,n.status==="complete"&&(!Number.isSafeInteger(o)||!Number.isSafeInteger(r)||Number(o)<0||Number(r)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let i=pe(e.filters)?e.filters:{},s=pe(i.runtime_filters)?i.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return M(t,i.status!=="all"||Object.keys(s).length>0||Object.keys(i).some(c=>!a.has(c)),"filtered_corpus","The list did not explicitly select every lifecycle status."),M(t,i.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),M(t,i.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),i}function dm(e,t,n){M(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),M(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=pe(e.projection)?e.projection:{};M(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let r=pe(e.omission_receipt)?e.omission_receipt:void 0;M(n,r===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),M(n,r!==void 0&&(r.has_omissions!==!1||r.omitted_field_group_count!==0||!Number.isSafeInteger(r.omitted_field_group_count)||!Array.isArray(r.omitted_field_groups)||r.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),M(n,r?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function mm(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function pm(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function um(e,t){let n=pe(e.read_output)?e.read_output:void 0;M(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),M(t,n!==void 0&&mm(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),M(t,n!==void 0&&!pm(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),M(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=pe(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;M(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),M(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function fm(e,t){let n=e.map(o=>pe(o)&&typeof o.id=="string"?o.id.trim():"");M(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),M(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function Jc(e){if(!pe(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:cm[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=lm(t,n);return dm(t,o,n),um(t,n),fm(t.items,n),{ok:n.length===0,findings:n}}function ln(e){let t=Jc(e);if(!t.ok)throw new cn(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function _m(e){ln(e)}import el from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c84b11c-502f-5c33-a757-5757402357b4")}catch{}})();function Xc(e){return e.map(t=>({key:t.key,optionName:Ti(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function Zc(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard",family:t.family??"extensions"}))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e8137f8b-745a-5ef5-9e7e-14b7d032c1ea")}catch{}})();var hm=50,ke=new Map;function Co(){ke.clear()}function Qc(e,t){let n=ke.get(e);if(n!==void 0)return n;if(ke.size>=hm){let r=ke.keys().next().value;ke.delete(r)}let o=t().catch(r=>{throw ke.get(e)===o&&ke.delete(e),r});return ke.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b841f903-6276-5067-842f-6a6bff114cec")}catch{}})();function gm(e,t,n){return JSON.stringify([el.resolve(e),el.resolve(n??process.cwd()),t.extensions.enabled,t.extensions.disabled,t.extensions.policy])}async function ym(e,t,n){let o=gm(e,t,n);return Qc(o,()=>wm(e,t,n))}async function bm(e,t={}){let n=await R(e),o=t.extensionRegistrations??(t.noExtensions===!0?null:await ym(e,n,t.cwd)),r=F(n,o),i=H(n.schema),s=pt(n.schema);return{types:[...r.types],statuses:i.definitions.map(a=>a.id),openStatus:i.open_status,closeStatus:i.close_status,canceledStatus:i.canceled_status,fields:Xc(s.definitions),extensionCommands:Zc(o?.commands??[])}}async function wm(e,t,n){let o=await Dt({pmRoot:e,settings:t,cwd:n??process.cwd(),noExtensions:!1}),r=await jt(o);try{return r.registrations}finally{try{await Nt(o,r)}catch{}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c7a926a-46a2-560c-ae95-33b92b8c820e")}catch{}})();var vm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function tl(e){return Object.fromEntries(Di.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var To={ctx:{action:"context"},...vm,...tl("extension"),...tl("package"),...Object.fromEntries(Ni.map(e=>[`package-${e}`,{action:e}]))};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var nl="PmCliError";function km(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=p.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function Sm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new m(e,km(t.exitCode??p.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function xo(e){if(!(e instanceof Error)||e.name!==nl)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as Et}from"node:fs";import{lstat as ol,mkdir as $o,open as rl}from"node:fs/promises";import ue from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e57a9bca-1190-5ffd-bb7d-d76a22fc9e57")}catch{}})();function Oo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Po(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function Im(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function Em(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let s=o.incomingOne.get(`${r.kind}\0${e.target}`);if(s!==void 0&&s!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let a=Po(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function Am(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function Rm(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=Oo(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:Oo(e.relationshipId,"relationshipId"),author:Oo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function Cm(e,t,n,o,r,i){let s=n.has(t);if(e.action==="add"&&s)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!s)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let l=new Ue([a,c],[e.edge],r).edges()[0];return Em(l,t,r,i),Im(l)}var At=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??Lt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,s;for(let a of this.stream({...o,batchSize:256}))for(let c of a)r=n(r,c),i+=1,s=c;return Object.freeze({state:r,version:s?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...s===void 0?{}:{asOf:s.timestamp}})}#s(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(Po(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Po(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=Rm(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=Cm(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#s(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(s=>Date.parse(s.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=Am(n),r=new Ue(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Fi("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Mi(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Li(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Tm="relationship-event-store",il=Et.O_NOFOLLOW;function dn(e){return te(e,Tm,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function Fe(e,t="relationships/events.jsonl"){let n=ue.resolve(e),o=ue.resolve(n,t),r=ue.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${ue.sep}`)||ue.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await $o(n,{recursive:!0}),(await ol(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let s=n;for(let a of r.split(ue.sep)){s=ue.join(s,a);try{if((await ol(s)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Cn(c))break;throw c}}return o}async function mn(e,t,n){let o=new At(t,{registry:n}),r,i;try{i=await rl(e,Et.O_RDONLY|il),r=await i.readFile("utf8")}catch(a){if(Cn(a))return{log:o,raw:""};throw a}finally{await i?.close()}let s=r.split(`
|
|
2
2
|
`);for(let a=0;a<s.length;a+=1){let c=s[a].trim();if(!c)continue;let l;try{l=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${a+1}`)}if(l.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${a+1}`);o.append({eventId:l.eventId,relationshipId:l.relationshipId,action:l.action,...l.edge===void 0?{}:{edge:l.edge},author:l.author,timestamp:l.timestamp,...l.reason===void 0?{}:{reason:l.reason},expectedVersion:o.version})}return{log:o,raw:r}}function xm(e,t,n,o){let r=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new Ue(n,[t.edge],o).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(r)&&e.timestamp===new Date(r).toISOString()&&e.reason===(t.reason?.trim()||void 0)&<(e.edge)===lt(i)}var pn=class e{#t;#n;#o;#i;#e;constructor(t,n,o,r){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#i=o,this.#e=r}static async open(t){let n=Object.freeze([...t.nodes]),o=await Fe(t.pmRoot,t.relativePath),r=await dn(t.pmRoot);try{await Fe(t.pmRoot,o);let{log:i}=await mn(o,n,t.registry);return new e(t,n,o,i)}finally{await r()}}get path(){return this.#i}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(t){let n=await dn(this.#t);try{let o=await Fe(this.#t,this.#i),{log:r}=await mn(o,this.#n,this.#o),i=r.append(t);await $o(ue.dirname(o),{recursive:!0}),await Fe(this.#t,o);let s=await rl(o,Et.O_APPEND|Et.O_CREAT|Et.O_WRONLY|il);try{await s.appendFile(`${JSON.stringify(i)}
|
|
3
3
|
`,"utf8")}finally{await s.close()}return this.#e=r,i}finally{await n()}}async appendBatch(t,n={}){let o=await dn(this.#t);try{let r=await Fe(this.#t,this.#i),{log:i,raw:s}=await mn(r,this.#n,this.#o),a=i.version,c=new Map(i.events().map(d=>[d.eventId,d])),l=[],u=[];for(let d of t){let f=d.eventId.trim(),h=c.get(f);if(h!==void 0){if(n.existingEventPolicy==="skip_identical"&&xm(h,d,this.#n,this.#o)){u.push(h.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let w=i.append(d);c.set(w.eventId,w),l.push(w)}if(l.length>0){let d=s.length===0||s.endsWith(`
|
|
4
4
|
`)?s:`${s}
|
|
@@ -2244,4 +2244,4 @@ end`}var _h={bash:'Add to ~/.bashrc or ~/.bash_profile: eval "$(pm completion ba
|
|
|
2244
2244
|
`);N(e.progressEnabled,"writing keyword artifacts"),await re(t,`${JSON.stringify(e.manifest,null,2)}
|
|
2245
2245
|
`),await re(n,`${r}
|
|
2246
2246
|
`);let i=[];if(e.mode!=="keyword")try{N(e.progressEnabled,"writing vectorization status ledger"),await gs(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(s){i.push(`search_vectorization_status_ledger_write_failed:${s instanceof Error?s.message:String(s)}`)}return i}async function Gh(e,t){let n=wh(e.mode),o=bh(e),r=e.full===!0;N(o,`start mode=${n}`);let i=E(process.cwd(),t.path);await P(i);let s=Qi(await R(i)).settings,a=null;try{a=await te(i,es,s.locks.ttl_seconds,C(void 0,"pm-reindex"),!1,s.governance.force_required_for_stale_lock,s.locks.wait_ms)}catch(c){throw c instanceof m&&c.exitCode===p.CONFLICT?new m("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",p.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=Sh(s),l=Ih(s),u=xh({requestedMode:n,pmRoot:i,settings:s,extensionEmbedding:c,extensionVectorAdapter:l}),d=n;N(o,"loading item corpus");let f=await Oh({pmRoot:i,settings:s}),h=f.warnings,{documentCandidates:w,metadataDocuments:k}=f;N(o,`loaded_items=${k.length}`);let y=S(),v=Th(d,y,k),_=xt.join(i,Dr),I=xt.join(i,Nr),x=d==="keyword"?await Ur(i,w,s.schema,h):k,L=[],q={},O=null,K=Ch(d);if(d==="keyword"&&await $h({pmRoot:i,settings:s,forceFullSemantic:r,extensionEmbedding:c,reindexWarnings:h}),d!=="keyword"){let ne=await jh({pmRoot:i,settings:s,requestedMode:n,activeEmbeddingProvider:u.activeEmbeddingProvider,activeVectorStore:u.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:l,documentCandidates:w,metadataDocuments:k,documentsForKeywordArtifacts:x,forceFullSemantic:r,reindexWarnings:h,semanticWarnings:L,semanticSummary:K,progressEnabled:o});x=ne.documentsForKeywordArtifacts,q=ne.vectorizationLedgerEntries,O=ne.vectorizationEmbeddingMetadata}let T=await Uh({pmRoot:i,mode:d,manifest:v,documentsForKeywordArtifacts:x,settings:s,vectorizationLedgerEntries:q,vectorizationEmbeddingMetadata:O,progressEnabled:o}),ee=[...await z({path:_,scope:"project",op:"reindex:manifest"}),...await z({path:I,scope:"project",op:"reindex:embeddings"}),...await pi({mode:d,total_items:k.length})];return N(o,"done"),{ok:!0,mode:d,total_items:k.length,semantic:K,artifacts:{manifest:Dr,embeddings:Nr},warnings:[...h,...L,...T,...ee],generated_at:y}}finally{await a?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2a537d27-e794-5aa6-946f-4b2a3102b0ab")}catch{}})();var em=Symbol("pm.active-extension-host-context");function X(e){return{fullChangedFields:!0,options:e}}var b=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[em]=!0,n}run(t,n={}){return Vh({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return Yc(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return ln(await this.list(Ro(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}append(t,n,o={}){return this.runTyped("append",{id:t,...X(bt(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,r,i={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...r===void 0?{}:{value:r},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,o={}){return this.runTyped("schema",{name:n,options:{...o,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,r){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...r?{fieldTypeScope:r}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},r,i){return this.runTyped("plan",{...n===void 0?{}:{id:n},...r===void 0?{}:{stepRef:r},...i===void 0?{}:{reorderTo:i},options:bt(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,r={}){return this.plan("reorder-step",t,r,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",X(t))}update(t,n={}){return this.runTyped("update",{id:t,...X(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...X(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...X(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...X(t)})}release(t,n={}){return this.runTyped("release",{id:t,...X(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...X(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...X(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...X(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...X(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...X(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...X(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function rA(e={},t={}){return new b(t).context(e)}function iA(e={},t={}){return new b(t).list(e)}function sA(e={},t={}){return new b(t).listAllComplete(e)}function aA(e,t={},n={}){return new b(n).search(e,t)}function cA(e,t={},n={}){return new b(n).get(e,t)}function lA(e={},t={}){return new b(t).next(e)}function dA(e={},t={}){return new b(t).aggregate(e)}function mA(e={},t={}){return new b(t).stats(e)}function pA(e={},t={}){return new b(t).duplicates(e)}function uA(e,t={},n={}){return new b(n).comments(e,t)}function fA(e,t={},n={}){return new b(n).notes(e,t)}function _A(e,t={},n={}){return new b(n).learnings(e,t)}function hA(e,t={},n={}){return new b(n).files(e,t)}function gA(e,t={},n={}){return new b(n).filesDiscover(e,t)}function yA(e,t={}){return new b(t).filesLookup(e)}function bA(e,t={},n={}){return new b(n).docs(e,t)}function wA(e,t={},n={}){return new b(n).deps(e,t)}function vA(e,t={},n={},o={}){return new b(o).graph(e,t,n)}function kA(e,t,n={},o={}){return new b(o).append(e,t,n)}function SA(e,t={},n={}){return new b(n).init(e,t)}function IA(e,t,n,o,r={},i={}){return new b(i).config(e,t,n,o,r)}function EA(e,t={},n={}){return new b(n).schema(e,t)}function AA(e={}){return new b(e).schemaList()}function RA(e,t={}){return new b(t).schemaShow(e)}function CA(e,t={},n={}){return new b(n).schemaAddType(e,t)}function TA(e,t={},n={}){return new b(n).schemaRemoveType(e,t)}function xA(e,t={},n={}){return new b(n).schemaAddStatus(e,t)}function OA(e,t={},n={}){return new b(n).schemaRemoveStatus(e,t)}function $A(e,t={},n={}){return new b(n).schemaAddField(e,t)}function PA(e,t={},n={}){return new b(n).schemaRemoveField(e,t)}function FA(e={}){return new b(e).schemaListFields()}function MA(e,t={}){return new b(t).schemaShowField(e)}function LA(e,t={},n={}){return new b(n).schemaApplyPreset(e,t)}function DA(e={},t={}){return new b(t).schemaInferTypes(e)}function NA(e,t,n,o={}){return new b(o).schemaRenameType(e,t,n)}function jA(e,t,n,o,r={}){return new b(r).schemaRenameField(e,t,n,o)}function UA(e,t,n,o={}){return new b(o).schemaRemapStatus(e,t,n)}function GA(e,t={}){return new b(t).schemaShowStatus(e)}function qA(e,t={},n={}){return new b(n).profile(e,t)}function zA(e={}){return new b(e).profileList()}function HA(e,t={}){return new b(t).profileShow(e)}function WA(e,t={},n={}){return new b(n).profileApply(e,t)}function VA(e,t={}){return new b(t).profileLint(e)}function BA(e={},t={}){return new b(t).validate(e)}function KA(e={},t={}){return new b(t).health(e)}function YA(e={},t={}){return new b(t).gc(e)}function JA(e,t,n={}){return new b(n).historyRedact(e,t)}function XA(e,t={},n={}){return new b(n).historyRepair(e,t)}function ZA(e={},t={}){return new b(t).historyRepairAll(e)}function QA(e,t={},n={}){return new b(n).historyCompact(e,t)}function eR(e,t={}){return new b(t).historyCompactBulk(e)}function tR(e={},t={}){return new b(t).create(e)}function nR(e,t={},n={}){return new b(n).update(e,t)}function oR(e,t,n={},o={}){return new b(o).reopen(e,t,n)}function rR(e,t,n={},o={}){return new b(o).close(e,t,n)}function iR(e,t={},n={}){return new b(n).claim(e,t)}function sR(e={},t={}){return new b(t).claimNext(e)}function aR(e,t={},n={}){return new b(n).release(e,t)}function cR(e,t={},n={}){return new b(n).copy(e,t)}function lR(e,t={},n={}){return new b(n).delete(e,t)}function dR(e,t,n={},o={}){return new b(o).restore(e,t,n)}function mR(e,t={},n={}){return new b(n).focus(e,t)}function pR(e,t={},n={}){return new b(n).startTask(e,t)}function uR(e,t={},n={}){return new b(n).pauseTask(e,t)}function fR(e,t,n={},o={}){return new b(o).closeTask(e,t,n)}function _R(e,t={},n={}){return new b(n).extension(e,t)}function hR(e={},t={}){return new b(t).extensionList(e)}function gR(e,t={},n={}){return new b(n).extensionActivate(e,t)}function yR(e,t={},n={}){return new b(n).extensionDeactivate(e,t)}function bR(e,t={},n={}){return new b(n).package(e,t)}function wR(e={},t={}){return new b(t).packageList(e)}function vR(e,t={},n={}){return new b(n).packageInstall(e,t)}function kR(e,t={},n={}){return new b(n).packageUninstall(e,t)}function SR(e={},t={}){return new b(t).packageDoctor(e)}function IR(e,t={},n={}){return new b(n).packageManage(e,t)}function ER(e,t={},n={}){return new b(n).packageDescribe(e,t)}function AR(e={},t={}){return new b(t).packageReload(e)}function RR(e={},t={}){return new b(t).packageCatalog(e)}function CR(e,t={},n={}){return new b(n).packageActivate(e,t)}function TR(e,t={},n={}){return new b(n).packageDeactivate(e,t)}function xR(e,t={},n={}){return new b(n).upgrade(e,t)}async function OR(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return So(n,o)}function se(e,t){let n=g(e,t);if(!n)throw new m(`Missing required argument: ${t}`,64);return n}var Zd=ci(),tm=new qh;function En(){Ln(ei()),Dn(ti()),Nn(ni()),jn(oi()),Un(ri()),Gn(ii()),qn(si())}async function nm(e,t,n,o){return li(()=>t===void 0?Zd.read(()=>Qd(e,n,o)):Zd.write(()=>Hh(t,()=>Qd(e,n,o))))}async function $R(e,t){let n=e.cwd,o=n??process.cwd();return nm(Yt({path:e.path,noExtensions:e.noExtensions}),n,o,()=>tm.run(!0,t))}async function Qd(e,t,n){let o=E(t,e.path);if(e.noExtensions)return En(),Lo({pmRoot:o},()=>n(null));if(!await ge(ct(o)))return En(),n(null);let r=null,i;try{let s=await R(o),a=await Dt({pmRoot:o,settings:s,cwd:t,noExtensions:!1}),c=await jt({...a,loaded:a.loaded});i={loadResult:a,activationResult:c},Ln(c.hooks),Dn(c.commands),Nn(c.parsers),jn(c.preflight),Un(c.services),Gn(c.renderers),qn(c.registrations),r={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:a.loaded}}catch(s){En(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",s)}try{return await Lo({pmRoot:o,packages:r?.packages},()=>n(r))}finally{En(),i&&await Nt(i.loadResult,i.activationResult).catch(()=>{})}}async function zh(e,t,n,o,r){if(!r)throw new m(`Unsupported native pm action: ${e}`,p.USAGE);let i=Ce(e),a=r.registrations.commands.find(l=>Ce(l.action)===i)?.command??r.commands.handlers.find(l=>Ce(l.command)===i)?.command;if(!a)throw new m(`Unsupported native pm action: ${e}`,p.USAGE);let c=await ui({command:no(a),args:V(n.args??t.args),options:oo(t,n),global:o,pm_root:r.pmRoot,sdk:sl(r.pmRoot,b.forActiveExtensionHost({pmRoot:r.pmRoot,author:typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension"}))});if(!c.handled){let l=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new m(`Unsupported native pm action: ${e}${l}`,p.USAGE)}return c.result}async function Hh(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function Wh(e){let t=se(e,"action"),n=Ce(t),o=it(To,n),r=o?.action??n,i={...e,action:r};return o?.options!==void 0&&(i.options={...o.options,...Tn(e.options)}),r==="package"&&(i.options={...Tn(i.options),vocabulary:"package"}),{action:r,args:i}}async function Vh(e){let t=Wh(e),n=Yt(t.args),o=pa(t.action),r=g(t.args,"cwd"),i=r??process.cwd();t.action==="init"&&(n[kc]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=E(i,n.path));try{return t.action==="history-attest"?await Gr(t.action,t.args,n,null):e[em]===!0||tm.getStore()===!0?await Gr(t.action,t.args,n,null):await nm(n,r,i,s=>Gr(t.action,t.args,n,s))}finally{o&&Co()}}function it(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function An(e){return g(e.args,"target")??g(e.options,"target")}function U(e,t=e.options){return e.id??se(t,"id")}async function Bh(e){let t=He("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Ao(await me(g(e.args,"status")??g(t,"status"),t,e.global),t)}async function Kh(e){let t=se(e.args,"query"),n=He("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),Ao(await vo(t,n,e.global),n)}async function Yh(e){let{changedFields:t,idOnly:n,runnerOptions:o}=G(e.args,e.options);return W(await It(o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Jh(e){let{changedFields:t,idOnly:n,runnerOptions:o}=G(e.args,e.options),r={...o,...o.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...o.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return W(await er(U(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function Xh(e){let{changedFields:t,idOnly:n,runnerOptions:o}=G(e.args,e.options);return W(await Ke(U(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function Zh(e){let t=rn(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),_l(U(e),t,e.global)}function om(e,t){return oc(kd(e.options,t,Z),e.global)}function Qh(e){let t=V(e.options.lookupPath);if(t&&t.length>0)return om(e,t);let n=U(e);return e.options.discover===!0?ao(n,to(e.options),e.global):nc(n,Jt(e.options),e.global)}function eg(e){return zc({subcommand:g(e.args,"subcommand")??g(e.options,"subcommand"),limit:da(e.args,e.options)},e.global)}function tg(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),vt(e.global,t)}function ng(e){let t=g(e.args,"configAction")??g(e.options,"configAction")??g(e.options,"action");if(t===void 0)throw new m("Missing required argument: configAction",64);let n=g(e.args,"value")??g(e.options,"value"),o=g(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return vc(g(e.args,"scope")??g(e.options,"scope")??"project",t,g(e.args,"key")??g(e.options,"key"),o,e.global,g(e.options,"policy")===void 0?n:void 0)}function og(e){let t=e.options;return ia(ra(t),e.global)}function rg(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new m(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new m(`${t} must be a finite integer.`,64);let o=Number.parseInt(n,10);if(!Number.isInteger(o))throw new m(`${t} must be a finite integer.`,64);return o}}function ig(e){let t=g(e.args,"subcommand")??se(e.options,"subcommand"),n=e.options;return Ml({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:sg(e),reorderTo:rg(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function sg(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function ag(e){let t=g(e.args,"subcommand")??se(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:g(e.args,"name")??g(e.options,"name"),author:g(e.args,"author")??g(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:V(n)}}function cg(e){let{ctx:t,subcommand:n,name:o,author:r,force:i}=e,a=it({list:()=>Oa(t.global),show:()=>$a(o,t.global),"show-status":()=>Pa(o,t.global),"list-fields":()=>La(t.global),"show-field":()=>Da(o,t.global),"remove-type":()=>Ra(o,{author:r,force:i},t.global),"remove-field":()=>Ma(o,{author:r,force:i},t.global),"remove-status":()=>xa(o,{author:r,force:i},t.global),"apply-preset":()=>Na(g(t.args,"typePreset")??g(t.options,"typePreset"),{author:r,force:i},t.global)},n);return a?a():null}function lg(e){let{ctx:t,name:n,author:o,force:r,aliases:i}=e,s=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return Fa(n,{type:g(t.args,"fieldType")??g(t.options,"fieldType"),commands:s===void 0?void 0:V(s),description:g(t.args,"description")??g(t.options,"description"),cliFlag:g(t.args,"cliFlag")??g(t.options,"cliFlag"),alias:i,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:V(a),author:o,force:r},t.global)}function dg(e){let{ctx:t,name:n,author:o,force:r,aliases:i}=e,s=t.args.role??t.options.role;return Ta(n,{role:s===void 0?void 0:V(s),alias:i,description:g(t.args,"description")??g(t.options,"description"),order:Z(t.args.order??t.options.order,"schema add-status order"),author:o,force:r},t.global)}function mg(e){let{ctx:t,name:n,author:o,force:r,aliases:i}=e;return Aa(n,{description:g(t.args,"description")??g(t.options,"description"),defaultStatus:g(t.args,"defaultStatus")??g(t.args,"default_status")??g(t.options,"defaultStatus")??g(t.options,"default_status"),folder:g(t.args,"folder")??g(t.options,"folder"),alias:i,author:o,force:r},t.global)}function pg(e){let{ctx:t,subcommand:n,name:o,author:r,force:i}=e,s=g(t.args,"to")??se(t.options,"to"),a=g(t.args,"migrationId")??g(t.args,"migration_id")??g(t.options,"migrationId")??g(t.options,"migration_id"),c=g(t.args,"fieldTypeScope")??g(t.options,"fieldTypeScope")??g(t.args,"type")??g(t.options,"type"),l=n==="rename-type"?{kind:"rename-type",from:o??"",to:s}:n==="rename-field"?{kind:"rename-field",from:o??"",to:s,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:o??"",to:s};return Ia(l,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:r,force:i},t.global)}function ug(e){let t=ag(e),n=zt.find(r=>r===t.subcommand);if(n)return Sa(n,t.name,{definition:e.args.definition??e.options.definition,policy:g(e.args,"policy")??g(e.options,"policy"),message:g(e.args,"message")??g(e.options,"message"),author:t.author,dryRun:e.args.dryRun===!0||e.options.dryRun===!0},e.global);let o=cg(t);if(o!==null)return o;if(["rename-type","rename-field","remap-status"].includes(t.subcommand))return pg(t);if(t.subcommand==="add-field")return lg(t);if(t.subcommand==="add-status")return dg(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?ja({minCount:Z(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):mg(t);throw ce({command_path:"schema",token:t.subcommand,allowed:Ea,exit_code:64})}function fg(e){let t=g(e.args,"subcommand")??se(e.options,"subcommand"),n=t.trim().toLowerCase(),o=g(e.args,"name")??g(e.options,"name"),i=it({list:()=>pd(),show:()=>ud(o),lint:()=>fd(o),apply:()=>_d(o,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:g(e.args,"author")??g(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!i)throw ce({command_path:"profile",token:t,allowed:md,exit_code:64});return i()}async function _g(e){let{changedFields:t,idOnly:n,runnerOptions:o}=G(e.args,e.options);return W(await dl(U(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function hg(e){let{changedFields:t,runnerOptions:n}=G(e.args,e.options);return W(await kl(io(n),e.global),{changedFields:t})}async function gg(e){let{changedFields:t,runnerOptions:n}=G(e.args,e.options),o=g(e.args,"reason"),r=o!==void 0&&n.reason===void 0?{...n,reason:o}:{...n};return e.force&&r.force===void 0&&(r.force=!0),W(await fl(ro(r),e.global),{changedFields:t})}async function yg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=G(e.args,e.options),r=g(o,"target")??se(e.args,"target");return W(await $e(U(e,o),r,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function bg(e){let t={...e.args,...e.options};return aa(se(t,"subcommand"),g(t,"id")??e.id,g(t,"target"),fa(t),e.global)}function wg(e){return ha(E(process.cwd(),e.global.path),{...e.args,...e.options})}var rm={init:e=>Sc(g(e.args,"prefix"),e.global,e.options),context:e=>po(He("context",e.options),e.global),next:e=>uo(He("next",e.options),e.global),eval:ql,events:zl,merge:Hl,workspace:Wl,meet:hn,event:hn,remind:hn,list:Bh,get:e=>{let t=U(e);return wo(t,e.global,He("get",e.options,[t]))},search:Kh,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:V(e.options.status);return Eo(e.global,{exhaustive:e.options.exhaustive===!0,...t.length===0?{}:{status:t},since:g(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:Z(e.options.limit,"limit")})},create:Yh,copy:Jh,focus:e=>nr(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:Xh,"item-reopen":vd,restore:yg,claim:yd,release:wd,"start-task":e=>Le(e,"start_task"),"pause-task":e=>Le(e,"pause_task"),"close-task":e=>Le(e,"close_task"),close:bd,comments:Zh,notes:e=>gl(U(e),rn(e.options),e.global),learnings:e=>hl(U(e),rn(e.options),e.global),files:Qh,docs:e=>tc(U(e),Jt(e.options),e.global),test:e=>Hc(U(e),e.options,e.global),"test-all":e=>Wc(e.options,e.global),telemetry:eg,validate:e=>on(e.options,e.global,{runUpdate:(t,n,o)=>Ke(t,n,o)}),health:tg,assurance:e=>rc(e.args,e.options,e.global),contracts:e=>So(e.options,e.global),config:ng,activity:og,aggregate:e=>co(e.options,e.global),extension:e=>en(An(e),e.options,e.global),package:e=>en(An(e),e.options,e.global),install:e=>en(An(e),{...e.options,install:!0},e.global),upgrade:e=>gc(An(e),e.options,e.global),delete:e=>tr(U(e),e.options,e.global),deps:e=>sa(U(e),e.options,e.global),graph:bg,"files-discover":e=>ao(U(e),e.options,e.global),"files-lookup":e=>om(e,V(e.options.paths)),history:e=>_c(U(e),e.options,e.global),"history-redact":e=>Lc(U(e),e.options,e.global),"history-repair":hd,"history-compact":gd,"history-attest":e=>hc(e.options,e.global),"history-author-acknowledge":wg,plan:ig,schema:ug,profile:fg,stats:e=>Io(e.global,Sd(e.options)),append:_g,"update-many":hg,"close-many":gg,gc:e=>yc(e.global,e.options)};function PR(e=ji){return e.map(t=>{let n=Ce(t),o=it(To,n),r=o?.action??n,i=it(rm,r)!==void 0;return{action:t,resolved_action:r,covered:i,route:i?o?"alias":"native":"missing"}})}async function Gr(e,t,n,o){let r=eo(t,e);Ui(e,r),Gi(e,r);let i={action:e,args:t,options:r,id:g(t,"id"),force:t.force===!0||r.force===!0,global:n,activeExtensions:o},s=it(rm,e),a=s?await s(i):await zh(e,t,r,n,o);if(e==="history-attest")return a;{r.resolvedOutputFormat="json";let c=Hi(e,r,a);return await al(E(process.cwd(),n.path),c),c}}var vg={closeManyOptionsFromFlat:ro,extensionOptionsFromArgs:oo,globalOptions:Yt,mutationListOptions:ua,normalizeActionName:Ce,normalizeCommandPath:no,normalizeMcpUpdateOptions:_a,normalizeMcpOptionsArrays:ma,optionsWithAuthor:eo,readRequiredString:se,readScalarString:ca,readScalarStringAllowBlank:la,readStringArray:V,updateManyOptionsFromFlat:io,withAddNoteOption:Jt,withFilesDiscoveryOptions:to,withMutationCompaction:G};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=vg);export{nl as a,Sm as b,xo as c,At as d,pn as e,sl as f,Cg as g,Tg as h,xg as i,Og as j,$g as k,Bc as l,Pg as m,sm as n,cm as o,cn as p,Ro as q,Jc as r,ln as s,_m as t,Co as u,bm as v,Mo as w,cl as x,Fm as y,Lm as z,Dm as A,Lo as B,dl as C,fl as D,_l as E,hl as F,gl as G,kl as H,Wp as I,Sl as J,Vo as K,Ml as L,er as M,tr as N,nr as O,Dl as P,Nl as Q,Gl as R,Qe as S,rr as T,tf as U,kw as V,Sw as W,ar as X,Bl as Y,jw as Z,Uw as _,Yl as $,Zl as aa,iv as ba,bf as ca,fr as da,vf as ea,kf as fa,md as ga,pd as ha,ud as ia,fd as ja,_d as ka,xv as la,Ov as ma,$v as na,Pv as oa,_r as pa,Ff as qa,Mf as ra,Lf as sa,j as ta,Df as ua,Nf as va,jf as wa,Uf as xa,yr as ya,Id as za,tt as Aa,gr as Ba,Ed as Ca,Gf as Da,Ad as Ea,qf as Fa,zf as Ga,Hf as Ha,Wf as Ia,Vf as Ja,Qf as Ka,xd as La,e_ as Ma,a_ as Na,f_ as Oa,h_ as Pa,hh as Qa,Gh as Ra,b as Sa,rA as Ta,iA as Ua,sA as Va,aA as Wa,cA as Xa,lA as Ya,dA as Za,mA as _a,pA as $a,uA as ab,fA as bb,_A as cb,hA as db,gA as eb,yA as fb,bA as gb,wA as hb,vA as ib,kA as jb,SA as kb,IA as lb,EA as mb,AA as nb,RA as ob,CA as pb,TA as qb,xA as rb,OA as sb,$A as tb,PA as ub,FA as vb,MA as wb,LA as xb,DA as yb,NA as zb,jA as Ab,UA as Bb,GA as Cb,qA as Db,zA as Eb,HA as Fb,WA as Gb,VA as Hb,BA as Ib,KA as Jb,YA as Kb,JA as Lb,XA as Mb,ZA as Nb,QA as Ob,eR as Pb,tR as Qb,nR as Rb,oR as Sb,rR as Tb,iR as Ub,sR as Vb,aR as Wb,cR as Xb,lR as Yb,dR as Zb,mR as _b,pR as $b,uR as ac,fR as bc,_R as cc,hR as dc,gR as ec,yR as fc,bR as gc,wR as hc,vR as ic,kR as jc,SR as kc,IR as lc,ER as mc,AR as nc,RR as oc,CR as pc,TR as qc,xR as rc,OR as sc,se as tc,$R as uc,Vh as vc,PR as wc};
|
|
2247
|
-
//# sourceMappingURL=chunk-
|
|
2247
|
+
//# sourceMappingURL=chunk-BOZ4HVYL.js.map
|