@unbrained/pm-cli 2026.11.26 → 2026.11.27

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.
Files changed (112) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli-bundle/bundle-manifest.json +1 -1
  3. package/dist/cli-bundle/chunks/{chunk-LNZKNVMT.js → chunk-5CMR4R5V.js} +2 -2
  4. package/dist/cli-bundle/chunks/{chunk-7F3UFYZA.js → chunk-5M7UTO2G.js} +2 -2
  5. package/dist/cli-bundle/chunks/{chunk-B2GM6KOM.js → chunk-63AVXDZS.js} +2 -2
  6. package/dist/cli-bundle/chunks/{chunk-NDS4MXZX.js → chunk-66TNCHHG.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-5AAIRHNE.js → chunk-6NJ3BONB.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-HTGN24XM.js → chunk-AVHRMUXJ.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-KCRRTJ4X.js → chunk-HTT52JL3.js} +37 -37
  10. package/dist/cli-bundle/chunks/{chunk-GQXK4KKH.js → chunk-J25DZRYJ.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-QMM46SJM.js → chunk-J6TFG34A.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-IGW3RVJC.js → chunk-JX475QVU.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-MNFCJNQA.js → chunk-KP75JTTO.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-T3GJPXIZ.js → chunk-KS47NGMQ.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-PQSEEVOA.js → chunk-O23KTJL6.js} +5 -5
  16. package/dist/cli-bundle/chunks/{chunk-KES4VHU4.js → chunk-OFX2VA5Z.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-HOLQZ56F.js → chunk-QVDEZBSV.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-BITDGTAX.js → chunk-SIRZ4VMT.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-XRCE4QNL.js → chunk-VC4BJIA7.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-FWBR3OW7.js → chunk-W7SPEGSP.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-WY7467RY.js +3 -0
  22. package/dist/cli-bundle/chunks/{chunk-5FY2VHRF.js → chunk-X6TE47CS.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-5BPDT7G2.js → chunk-XB6QEVUK.js} +2 -2
  24. package/dist/cli-bundle/chunks/chunk-XYX4CXFR.js +2 -0
  25. package/dist/cli-bundle/chunks/{chunk-ZDL45VTB.js → chunk-Y5U7QCNX.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-CBBKXTJG.js → chunk-YGK6SA7P.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-DYL2N3OC.js → chunk-ZGV4ZXDS.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-WZOJSHJT.js → chunk-ZILIHDDY.js} +41 -41
  29. package/dist/cli-bundle/chunks/{field-option-collisions-CGRJEAPQ.js → field-option-collisions-UL6BIPAK.js} +2 -2
  30. package/dist/cli-bundle/chunks/{item-revision-FGDR5NSF.js → item-revision-WNUDY5DM.js} +2 -2
  31. package/dist/cli-bundle/chunks/item-transaction-ER3OWOPV.js +2 -0
  32. package/dist/cli-bundle/chunks/{mutation-actor-HGG47KXV.js → mutation-actor-SFYTD2ZB.js} +2 -2
  33. package/dist/cli-bundle/chunks/{mutation-admission-LLHIRY6O.js → mutation-admission-AVOOT3KH.js} +2 -2
  34. package/dist/cli-bundle/chunks/{register-list-query-EKSCZWEZ.js → register-list-query-Q7UW2EPV.js} +2 -2
  35. package/dist/cli-bundle/chunks/{register-mutation-ZIAOKKUJ.js → register-mutation-YNW7E3T4.js} +2 -2
  36. package/dist/cli-bundle/chunks/{register-operations-ECVBZ5FM.js → register-operations-DAUTQCIO.js} +2 -2
  37. package/dist/cli-bundle/chunks/{register-setup-3QYD5H4H.js → register-setup-VSURGF7V.js} +2 -2
  38. package/dist/cli-bundle/chunks/{stage-RSCSUYEJ.js → stage-N5GDBS5A.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-AAB3ZR7Z.js → chunk-24W63UPP.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-AVLB4L7M.js → chunk-2XGHBYDA.js} +5 -5
  41. package/dist/cli-bundle/focused-chunks/{chunk-JUG3BAZZ.js → chunk-3QRMY6KF.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/{chunk-RDELKGLS.js → chunk-4HLZOOZI.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-52PHSTGP.js +27 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-QNWNUQSJ.js → chunk-7FKGIJEB.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/{chunk-QSRXF6XS.js → chunk-7GZMOLQY.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-GQBWI4KA.js → chunk-AL47ODFZ.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-KEZ4VXYD.js → chunk-AN4NFFLL.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-FW5Q26HA.js → chunk-B2HJI6KA.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/{chunk-YNRW2FWB.js → chunk-C2HW7BSE.js} +2 -2
  50. package/dist/cli-bundle/focused-chunks/{chunk-IWEGGRRD.js → chunk-GISZWMBS.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-3GQRWIT5.js → chunk-GUAT4OAC.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-3BR5NWQI.js → chunk-H4JBS477.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/{chunk-NSFS3VWP.js → chunk-HGJ4MILN.js} +37 -37
  54. package/dist/cli-bundle/focused-chunks/{chunk-NXUFVQ33.js → chunk-HSWL6L2O.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-RMJKVQYE.js → chunk-I4GY7HAP.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/{chunk-UA2JNKMY.js → chunk-KMG4O2IU.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/{chunk-YSZZSV6M.js → chunk-N7ZAMULP.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-TNVLDU7Z.js → chunk-REORRDPH.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-WHHFPATO.js → chunk-SXWUKNTY.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-FQWKESMI.js → chunk-UGQ2EXTU.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/chunk-YPOATPTX.js +3 -0
  62. package/dist/cli-bundle/focused-chunks/{chunk-VV2QF5IE.js → chunk-ZZYJS74B.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{field-option-collisions-WV6GPYYP.js → field-option-collisions-BP7ILGQK.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/{item-revision-RPTXN7WW.js → item-revision-NOHVIOQQ.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/{item-transaction-A6MVNPT7.js → item-transaction-O26COBOJ.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{mutation-actor-6ZVW6OME.js → mutation-actor-HVJV5S76.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/{mutation-admission-2DA4CINP.js → mutation-admission-JRICEVYN.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/{stage-RG3PKST7.js → stage-NSX6ASBZ.js} +2 -2
  69. package/dist/cli-bundle/main.js +2 -2
  70. package/dist/cli-bundle/sdk-authoring.js +1 -1
  71. package/dist/cli-bundle/sdk-contracts.js +1 -1
  72. package/dist/cli-bundle/sdk-core.js +1 -1
  73. package/dist/cli-bundle/sdk-governance.js +1 -1
  74. package/dist/cli-bundle/sdk-graph.js +1 -1
  75. package/dist/cli-bundle/sdk-merge.js +51 -51
  76. package/dist/cli-bundle/sdk-query.js +1 -1
  77. package/dist/cli-bundle/sdk-runtime.js +1 -1
  78. package/dist/cli-bundle/sdk-testing.js +1 -1
  79. package/dist/cli-bundle/sdk.js +1 -1
  80. package/dist/core/extensions/index.js +1 -1
  81. package/dist/core/shared/command-line.d.ts +2 -2
  82. package/dist/core/shared/command-line.js +1 -1
  83. package/dist/core/shared/secret-rules.js +5 -5
  84. package/docs/CONFIGURATION.md +1 -1
  85. package/docs/MUTATION_INTEGRITY.md +47 -0
  86. package/docs/SDK.md +3 -1
  87. package/marketplace.json +1 -1
  88. package/package.json +1 -1
  89. package/packages/pm-beads/package.json +1 -1
  90. package/packages/pm-calendar/package.json +1 -1
  91. package/packages/pm-command-kit/package.json +1 -1
  92. package/packages/pm-digital-twin/package.json +1 -1
  93. package/packages/pm-governance-audit/package.json +1 -1
  94. package/packages/pm-guide-shell/package.json +1 -1
  95. package/packages/pm-kanban/package.json +1 -1
  96. package/packages/pm-lifecycle-hooks/package.json +1 -1
  97. package/packages/pm-linked-test-adapters/package.json +1 -1
  98. package/packages/pm-search-advanced/package.json +1 -1
  99. package/packages/pm-templates/package.json +1 -1
  100. package/packages/pm-todos/package.json +1 -1
  101. package/packages/pm-vcs/package.json +1 -1
  102. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  103. package/plugins/pm-claude/package.json +1 -1
  104. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  105. package/plugins/pm-codex/package.json +1 -1
  106. package/plugins/pm-codex/plugin.json +1 -1
  107. package/runtime-dependencies.json +1 -1
  108. package/dist/cli-bundle/chunks/chunk-DUJSME77.js +0 -3
  109. package/dist/cli-bundle/chunks/chunk-RFK3ERYX.js +0 -2
  110. package/dist/cli-bundle/chunks/item-transaction-C3KAMEYO.js +0 -2
  111. package/dist/cli-bundle/focused-chunks/chunk-R6QFPHWW.js +0 -3
  112. package/dist/cli-bundle/focused-chunks/chunk-RFJ3MEFP.js +0 -27
@@ -1,4 +1,4 @@
1
- import{a as Sa}from"./chunks/chunk-HZZLSBIJ.js";import"./chunks/chunk-SLFRSZK6.js";import{A as va,B as Ca,C as Wn,E as xa,F as ba,H as ka,I as Bn,a as jn,d as N,e as j,f as $,g as S,h as E,i as Br,n as pe,o as Tt,p as Vr,q as Jr,r as Qr,v as ea,w as ha,x as ya,y as _a,z as wa}from"./chunks/chunk-BITDGTAX.js";import{Wa as ga,f as Gr,k as zr}from"./chunks/chunk-PQSEEVOA.js";import{A as aa,B as sa,C as Nt,F as ca,G as la,H as Q,I as da,Qc as pa,Rd as fa,b as Te,ca as ma,l as Zr,r as Hn,s as Gn,t as oa,u as ia,v as ra,w as zn,x as $t,y as Qe}from"./chunks/chunk-GQXK4KKH.js";import"./chunks/chunk-MGJMQSN4.js";import"./chunks/chunk-CBBKXTJG.js";import"./chunks/chunk-HTGN24XM.js";import{k as Wr}from"./chunks/chunk-T3GJPXIZ.js";import"./chunks/chunk-LNZKNVMT.js";import"./chunks/chunk-KHFUHGL3.js";import"./chunks/chunk-AA52P34H.js";import"./chunks/chunk-5AAIRHNE.js";import"./chunks/chunk-MNFCJNQA.js";import"./chunks/chunk-6H36ZHMI.js";import{d as ua}from"./chunks/chunk-QMM46SJM.js";import{Ka as na,a as Kr,b as Yr,d as Xr,ma as It,na as Pt,oa as Un,pa as Ze,qa as A,ra as ta,sa as qn,wa as W}from"./chunks/chunk-5FY2VHRF.js";import{A as Ur,B as qr,C as Dn,D as Hr,n as Mn,p as Dr,u as Fn,w as jr}from"./chunks/chunk-KES4VHU4.js";import"./chunks/chunk-NDS4MXZX.js";import"./chunks/chunk-PZA7QECY.js";import{$b as An,Ac as $n,Ad as Ln,Bc as Rr,Bd as Mr,Cc as Or,Cd as Fr,Dc as Tr,Ec as Nn,Fc as Ir,Gc as Oe,Jc as Pr,K as Ni,Nc as $r,fc as Cr,ic as xr,jc as br,lc as kr,md as Ye,pc as Sr,pd as Nr,qb as kt,qc as Er,rb as vr,rc as Rn,tc as Ar,uc as me,vc as On,vd as Lr,wc as Tn,xc as In,yc as Pn,zc as St}from"./chunks/chunk-KCRRTJ4X.js";import{n as bt,q as yr,r as _r,u as Re,v as F,w as wr}from"./chunks/chunk-XRCE4QNL.js";import{$ as un,$d as bn,Af as x,Ah as re,Bh as ur,Ca as Ve,Ch as Sn,Dh as le,Eh as pr,Fh as vt,Ia as gn,Ih as Ae,Jh as de,Mg as or,Mh as fr,Na as _t,Nh as Ct,Qa as hn,S as mn,Sd as _n,Td as wn,Ud as Di,V as ce,Vd as ji,We as Ji,Wf as Xi,Wg as ir,Wh as En,X as Oi,Xd as vn,Xf as Zi,Xh as xt,Y as yt,Yd as Cn,Yf as Qi,Yg as rr,Yh as gr,Zd as xn,Zf as er,Zh as hr,_e as Ki,aa as Ti,ba as P,cc as Mi,da as Ii,dc as Fi,ea as X,jh as ar,kh as Je,lf as Z,mh as Ke,nc as wt,nh as sr,oe as Ui,pe as qi,r as ze,re as Hi,se as Gi,te as zi,ue as Wi,uf as Yi,va as Ee,ve as Bi,vf as ie,wa as We,we as Vi,wg as tr,wh as cr,xg as nr,xh as lr,ya as Be,yh as dr,zf as kn,zh as mr}from"./chunks/chunk-WZOJSHJT.js";import"./chunks/chunk-IGW3RVJC.js";import{E as Rt,F as ue,mb as Ot,nb as G,p as Et,r as Xe,s as At}from"./chunks/chunk-B2GM6KOM.js";import{G as Pi,H as $i,I as J,Z as Li,h as M,j as V,k as H,m as K,n as dn,o as D,p as Ai,x as _,y as pn,z as fn}from"./chunks/chunk-DUJSME77.js";import{Q as yn,a as Ri}from"./chunks/chunk-SX76UGEY.js";import{A as g,B as ht,C as I,E as Y}from"./chunks/chunk-6OIHST4I.js";import"./chunks/chunk-XAWE4EAK.js";import{AsyncLocalStorage as Jc}from"node:async_hooks";var Ie=new Jc;function Ea(e){let t=Ie.getStore();return t===void 0?e:t!==null}function fe(e,t=`warning:${e}`){let n=Ie.getStore();n?(!n.has(e)||t!==`warning:${e}`)&&n.set(e,t):x(t)}function et(e){let t=Ie.getStore();if(!t?.size)return e;let n=Reflect.get(e,"warnings"),o=[...t].filter(([a,s])=>s!==`warning:${a}`).map(([a,s])=>({code:a,message:s})),i=Reflect.get(e,"warning_details"),r={...e,warnings:[...Array.isArray(n)?n:[],...t.keys()],...o.length>0?{warning_details:[...Array.isArray(i)?i:[],...o]}:{}};return t.clear(),r}function Vn(e){if(!Ie.getStore()?.size)return e;let{token_accounting:t,...n}=et(JSON.parse(e));return JSON.stringify(t===void 0?n:Z(n,o=>`${JSON.stringify(o,null,2)}
1
+ import{a as Sa}from"./chunks/chunk-HZZLSBIJ.js";import"./chunks/chunk-SLFRSZK6.js";import{A as va,B as Ca,C as Wn,E as xa,F as ba,H as ka,I as Bn,a as jn,d as N,e as j,f as $,g as S,h as E,i as Br,n as pe,o as Tt,p as Vr,q as Jr,r as Qr,v as ea,w as ha,x as ya,y as _a,z as wa}from"./chunks/chunk-SIRZ4VMT.js";import{Wa as ga,f as Gr,k as zr}from"./chunks/chunk-O23KTJL6.js";import{A as aa,B as sa,C as Nt,F as ca,G as la,H as Q,I as da,Qc as pa,Rd as fa,b as Te,ca as ma,l as Zr,r as Hn,s as Gn,t as oa,u as ia,v as ra,w as zn,x as $t,y as Qe}from"./chunks/chunk-J25DZRYJ.js";import"./chunks/chunk-MGJMQSN4.js";import"./chunks/chunk-YGK6SA7P.js";import"./chunks/chunk-AVHRMUXJ.js";import{k as Wr}from"./chunks/chunk-KS47NGMQ.js";import"./chunks/chunk-5CMR4R5V.js";import"./chunks/chunk-KHFUHGL3.js";import"./chunks/chunk-AA52P34H.js";import"./chunks/chunk-6NJ3BONB.js";import"./chunks/chunk-KP75JTTO.js";import"./chunks/chunk-6H36ZHMI.js";import{d as ua}from"./chunks/chunk-J6TFG34A.js";import{Ka as na,a as Kr,b as Yr,d as Xr,ma as It,na as Pt,oa as Un,pa as Ze,qa as A,ra as ta,sa as qn,wa as W}from"./chunks/chunk-X6TE47CS.js";import{A as Ur,B as qr,C as Dn,D as Hr,n as Mn,p as Dr,u as Fn,w as jr}from"./chunks/chunk-OFX2VA5Z.js";import"./chunks/chunk-66TNCHHG.js";import"./chunks/chunk-PZA7QECY.js";import{$b as An,Ac as $n,Ad as Ln,Bc as Rr,Bd as Mr,Cc as Or,Cd as Fr,Dc as Tr,Ec as Nn,Fc as Ir,Gc as Oe,Jc as Pr,K as Ni,Nc as $r,fc as Cr,ic as xr,jc as br,lc as kr,md as Ye,pc as Sr,pd as Nr,qb as kt,qc as Er,rb as vr,rc as Rn,tc as Ar,uc as me,vc as On,vd as Lr,wc as Tn,xc as In,yc as Pn,zc as St}from"./chunks/chunk-HTT52JL3.js";import{n as bt,q as yr,r as _r,u as Re,v as F,w as wr}from"./chunks/chunk-VC4BJIA7.js";import{$ as un,$d as bn,Af as x,Ah as re,Bh as ur,Ca as Ve,Ch as Sn,Dh as le,Eh as pr,Fh as vt,Ia as gn,Ih as Ae,Jh as de,Mg as or,Mh as fr,Na as _t,Nh as Ct,Qa as hn,S as mn,Sd as _n,Td as wn,Ud as Di,V as ce,Vd as ji,We as Ji,Wf as Xi,Wg as ir,Wh as En,X as Oi,Xd as vn,Xf as Zi,Xh as xt,Y as yt,Yd as Cn,Yf as Qi,Yg as rr,Yh as gr,Zd as xn,Zf as er,Zh as hr,_e as Ki,aa as Ti,ba as P,cc as Mi,da as Ii,dc as Fi,ea as X,jh as ar,kh as Je,lf as Z,mh as Ke,nc as wt,nh as sr,oe as Ui,pe as qi,r as ze,re as Hi,se as Gi,te as zi,ue as Wi,uf as Yi,va as Ee,ve as Bi,vf as ie,wa as We,we as Vi,wg as tr,wh as cr,xg as nr,xh as lr,ya as Be,yh as dr,zf as kn,zh as mr}from"./chunks/chunk-ZILIHDDY.js";import"./chunks/chunk-JX475QVU.js";import{E as Rt,F as ue,mb as Ot,nb as G,p as Et,r as Xe,s as At}from"./chunks/chunk-63AVXDZS.js";import{G as Pi,H as $i,I as J,Z as Li,h as M,j as V,k as H,m as K,n as dn,o as D,p as Ai,x as _,y as pn,z as fn}from"./chunks/chunk-WY7467RY.js";import{Q as yn,a as Ri}from"./chunks/chunk-SX76UGEY.js";import{A as g,B as ht,C as I,E as Y}from"./chunks/chunk-6OIHST4I.js";import"./chunks/chunk-XAWE4EAK.js";import{AsyncLocalStorage as Jc}from"node:async_hooks";var Ie=new Jc;function Ea(e){let t=Ie.getStore();return t===void 0?e:t!==null}function fe(e,t=`warning:${e}`){let n=Ie.getStore();n?(!n.has(e)||t!==`warning:${e}`)&&n.set(e,t):x(t)}function et(e){let t=Ie.getStore();if(!t?.size)return e;let n=Reflect.get(e,"warnings"),o=[...t].filter(([a,s])=>s!==`warning:${a}`).map(([a,s])=>({code:a,message:s})),i=Reflect.get(e,"warning_details"),r={...e,warnings:[...Array.isArray(n)?n:[],...t.keys()],...o.length>0?{warning_details:[...Array.isArray(i)?i:[],...o]}:{}};return t.clear(),r}function Vn(e){if(!Ie.getStore()?.size)return e;let{token_accounting:t,...n}=et(JSON.parse(e));return JSON.stringify(t===void 0?n:Z(n,o=>`${JSON.stringify(o,null,2)}
2
2
  `),null,2)}async function Aa(e,t){if(!e){await Ie.run(null,t);return}let n=new Map;await Ie.run(n,async()=>{await t(),n.size>0&&ie(`${JSON.stringify(et({type:"warning"}))}
3
3
  `)})}import{AsyncLocalStorage as Kc}from"node:async_hooks";var Jn=new Kc,Ra=new WeakMap;function Yc(e){let t=e.outputFormat!==void 0?["--output-format",e.outputFormat]:e.json===!0?["--json"]:[];return{scopeArgs:Ee(e),outputArgs:t}}var Oa=new WeakMap;function Xc(e,t){let n=e.registeredArguments.findIndex(o=>o.name()==="id");if(!(n===-1||e.name()==="plan"&&t[0]==="create"))return t[n]}function Kn(e,t){return t.some(n=>n.path!==e.path||n.args.length!==e.args.length||n.args.some((o,i)=>o!==e.args[i]))}async function Yn(e){if(e.expectHash===void 0)return;let t=Mn(e.expectHash),n=e.commandPath.trim().toLowerCase();if(Dn(n,e.commandOptions),e.rewritten===!0)throw Fn();let o=Jn.getStore();if(o===void 0)throw new TypeError("--expect-hash was parsed outside an invocation revision scope");let i=await Dr(e.pmRoot,t,Xc(e.command,e.commandArgs));Qi(o,e.pmRoot,i),Oa.set(o,n),e.globalOptions!==void 0&&Ra.set(o,Yc(e.globalOptions))}function Xn(e,t,n){let o=Jn.getStore(),i=o===void 0?void 0:Oa.get(o);if(i!==void 0){if(Kn(e,[t]))throw Fn();Dn(i,n)}}function Ta(e,t){if(t!==void 0)throw Mn(t),Hr(e)}function Zc(e){for(let t of er(e).unchecked)fe(qr(t))}async function Qc(e,t){return e.pmRoot===void 0?t:jr(t,e.pmRoot,Ra.get(e))}async function Ia(e){let t=Xi();try{await e(n=>Jn.run(t,()=>Zi(t,n)))}catch(n){throw await Qc(t,n)}Zc(t)}import{Command as hi,CommanderError as gc}from"commander";function B(e){return`--${e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`}function ge(e){if(!e.startsWith("--"))return;let t=e.includes("=")?e.slice(0,e.indexOf("=")):e;return B(t)}function ee(e){let t=new Set,n=[];for(let o of e){let i=ge(o);i&&(t.has(i)||n.push(i),t.add(i))}return n}var Zn=new Set(["--fields","--output-include","--depth","--for","--token-budget"]),Lt=new Set(["--full","--brief","--compact"]);function el(e,t){return!!(e.flag==="--pm-path"||e.value_name||e.list||e.value_type==="number"||e.value_type==="string"||t.has(e.flag))}function Qn(e,t=E([...e])){let n=G(t),o=new Set([...Kr,...Yr,...Xr].flatMap(s=>s.keys.map(c=>`--${c.replace(/[A-Z]/g,l=>`-${l.toLowerCase()}`)}`))),i=new Map([...ue,...n].flatMap(s=>[s.flag,...s.aliases??[]].map(c=>[c,s.flag]))),r=new Map([...ue,...n].flatMap(s=>[s.flag,...s.aliases??[]].map(c=>[c,el(s,o)])));for(let s of Zn)r.set(s,!0);for(let s of Lt)r.set(s,!1);let a=new Map;for(let s=0;s<e.length;s+=1){let c=e[s];if(c==="--")break;if(!c.startsWith("-"))continue;let l=c.split("=")[0];if(!r.has(l)&&!c.includes("="))return;let d=r.get(l)===!0&&!c.includes("=");a.set(s,{flag:i.get(l)??l,consumesValue:d}),d&&(s+=1)}return a}function tl(e){let t=Qn(e);return t===void 0?void 0:new Map([...t].map(([n,{flag:o}])=>[n,o]))}function Pa(e,t,n){let o=new Set;for(let[i,r]of t)n.has(r)&&(o.add(i),Zn.has(r)&&!e[i].includes("=")&&o.add(i+1));return e.filter((i,r)=>!o.has(r))}function nl(e,t){let n=t.find(i=>Lt.has(i));if(n===void 0)return;let o=[...new Set(e.values())].filter(i=>Lt.has(i));return o.length===1?o[0]:n}function $a(e,t,n){if(!n||!["unknown_field_projection","projection_options_mutually_exclusive"].includes(t??""))return n;let o=n.suggested_retry_args,i={...n,suggested_retry:void 0,suggested_retry_args:void 0};if(!o)return i;let r=tl(e);if(!r)return i;let a;if(t==="unknown_field_projection"){let s=o.indexOf("--fields");if(s<0||o[s+1]===void 0)return i;let c=[...r].find(([l,d])=>d==="--fields")?.[0]??-1;if(c<0)return i;a=Pa(e,r,new Set(["--fields"])),a.splice(c,0,"--fields",o[s+1])}else{let s=nl(r,o);if(s===void 0||![...r.values()].includes(s))return i;let c=new Set([...Zn,...Lt].filter(l=>l!==s));a=Pa(e,r,c)}return{...n,suggested_retry:_(a),suggested_retry_args:a}}var Na=new Set(Gi);function ol(e){return e.includes("@")&&e.includes(":")}function il(e){let t=S([...e]);if(t===void 0)return;let n=e[t+1],o=n===void 0||n.startsWith("-")?void 0:`${e[t]} ${n}`;return o!==void 0&&Ot(o)?o:e[t]}function rl(e){let t=Te(e??"",G(e));return new Set(t.filter(n=>n.takes_value).flatMap(n=>[n.flag,...n.aliases??[]]))}function La(e,t,n,o=[],i=()=>!1){if(t!==Hi)return n;let r=n===void 0?void 0:{...n,suggested_retry:void 0,suggested_retry_args:void 0},a=il(e),s=Qn(e,a);if(s===void 0||o===null||e.some(ol)||i())return r;let c=al(e,s,rl(a));if(c===void 0||c.size===0)return r;let l=[...o,...e.filter((d,m)=>!c.has(m))];return{...n,suggested_retry:_(l),suggested_retry_args:l}}function al(e,t,n){let o=new Set;for(let[r,{flag:a,consumesValue:s}]of t){if(!Na.has(a))continue;let c=e[r-1];if(c!==void 0&&!c.includes("=")&&n.has(c)||s&&e[r+1]?.startsWith("-")===!0)return;o.add(r),s&&o.add(r+1)}return e.some((r,a)=>!o.has(a)&&Na.has(r.split("=",1)[0]))?void 0:o}var sl=new Set(["normalized_args","suggested_retry_args","provided_fields","parsed_positionals","normalizedInvocationArgs","providedOptionFlags","suggestedRetryArgs"]),cl=new Set(["code","original_code","type","recovery_mode","option_scope","diagnostic_class"]),Ma=`URL credentials in this invocation were replaced with ${pn}; restore them before replaying any command shown here.`;function ll(e){return`URL credentials in this invocation were replaced with ${pn}. Those in ${e} caused this refusal, so do not restore them: give ${e} a value without URL credentials, and restore any other redacted credentials before replaying.`}function he(e){return e.map(fn)}function dl(e,t){return e==="producer"||t==="details"?"producer":e==="schema"&&t==="recovery"?"schema":"typed"}function ml(e,t,n){let o=J(e);o!==e&&(n.changed=!0);let i=o;for(let r=2;Object.hasOwn(t,i);r+=1)i=`${o} (${r})`;return i}function ul(e,t,n){let o=J(n?fn(e):e);return o!==e&&(t.changed=!0),o}function pl(e,t,n){return e!=="schema"?!1:t==="urlCredentialsRejected"||cl.has(t)&&typeof n=="string"}function eo(e,t,n,o){if(typeof e=="string"&&t.ownSteps.has(e))return e;if(typeof e=="string")return ul(e,t,n);if(typeof e!="object"||e===null)return e;let i=t.copies.get(e);if(i!==void 0)return i;if(Array.isArray(e)){let a=[];t.copies.set(e,a);for(let s of e)a.push(eo(s,t,n,o));return a}let r={};t.copies.set(e,r);for(let[a,s]of Object.entries(e)){if(pl(o,a,s)){r[a]=s;continue}let c=o==="producer"?ml(a,r,t):a;r[c]=eo(s,t,n||sl.has(a),dl(o,a))}return r}function Mt(e){let t=e.urlCredentialsRejected,n=t===void 0?Ma:ll(t.source),o=new Set([Ma,n]),i={copies:new Map,changed:!1,ownSteps:o},r=eo(e,i,!1,"schema");if(!i.changed&&!$i())return e;r.recovery&&(r.recovery={...r.recovery,suggested_retry:void 0,suggested_retry_args:void 0});let a=(r.nextSteps??[]).filter(s=>!o.has(s));return r.nextSteps=[n,...a],r}var fl="project_schema_field_requires_declared_flag";function gl(e){let t=[];for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="--")break;o.startsWith("--field=")?t.push({index:n,width:1,assignment:o.slice(8)}):o==="--field"&&n+1<e.length&&(t.push({index:n,width:2,assignment:e[n+1]}),n+=1)}return t}function Fa(e,t,n,o){let i=o?.suggested_flags?.[0];if(t!==fl||n===void 0||i===void 0)return o;let r=gl(e).filter(({assignment:d})=>d.split("=",1)[0].trim()===n&&d.includes("="));if(r.length!==1)return o;let[a]=r,s=a.assignment.trim(),c=s.slice(s.indexOf("=")+1),l=[...e.slice(0,a.index),i,c,...e.slice(a.index+a.width)];return{...o,suggested_retry:_(l),suggested_retry_args:l}}var to=Zr;function hl(e,t,n,o,i){let r=[],a=e.indexOf(n,t);if(a<0||e.slice(t,a).some(s=>s.startsWith("-")))return r;for(let s=a+1;s<e.length;s+=1){let c=e[s];if(c==="--")break;c===`${o}=${i}`?r.push({index:s,width:1}):c===o&&e[s+1]===i&&(r.push({index:s,width:2}),s+=1)}return r}function Da(e,t,n,o,i=[]){let r=o?.suggested_flags?.[0];if(t!==to||n===void 0||r===void 0||o.suggested_retry_args===void 0)return o;let a={...o,suggested_retry:void 0,suggested_retry_args:void 0},s=S([...e]);if(s===void 0||i===null)return a;let c=o.suggested_retry_args,l=hl(e,s,c[0],n,r);if(l.length!==1)return a;let{index:d,width:m}=l[0],u=[...e.slice(0,d),r,...e.slice(d+m)];if(!yl(u,d,n,r,c))return a;let p=[...i,...u];return{...o,suggested_retry:_(p),suggested_retry_args:p}}function yl(e,t,n,o,i){let r=i.lastIndexOf(o);return r<0||i.slice(r).some((a,s)=>e[t+s]!==a)?!1:!e.some((a,s)=>s!==t&&(a===n||a.startsWith(`${n}=`)))}var no="close_validation_missing_fields";function _l(e,t,n,o){let i=e.slice(t+1);if(!i.includes("--"))return[...e,...o];if(!i.some(r=>n.has(r.split("=",1)[0])))return[...e.slice(0,t+1),...o,...i]}function wl(e,t){let n=e.slice(0,e.length-2*t),o=n.length;for(;o>0&&n[o-1].startsWith("--expect-hash=");)o-=1;return n.slice(o)}function ja(e,t,n,o=[]){let i=n?.missing;if(t!==no||i===void 0||i.length===0)return n;let r=n.suggested_retry_args;if(r===void 0)return n;let a={...n,suggested_retry:void 0,suggested_retry_args:void 0},s=S([...e]);if(s===void 0||o===null)return a;let c=G(e[s].trim().toLowerCase()),l=i.map(f=>c.find(y=>y.flag===f||y.aliases?.includes(f)===!0));if(l.some(f=>f===void 0))return a;let d=new Set(l.flatMap(f=>[f.flag,...f.aliases??[]])),m=wl(r,i.length),u=_l(e,s,d,[...i.flatMap(f=>[f,"<value>"]),...m]);if(u===void 0)return a;let p=[...o,...u];return{...n,suggested_retry:_(p),suggested_retry_args:p}}async function Ua(e,t){await Mr(e,{ok:t.ok,error:t.error,result:de(),exit_code:t.exit_code,error_code:t.error_code,error_category:t.error_category,command_resolution:t.command_resolution,resolution_stage:t.resolution_stage})}async function qa(e){if(process.env.PM_CONTEXT_USAGE_DISABLED==="1")return;let t;try{await Ji({pmRoot:e.pmRoot,result:de()})}catch(o){t=o}let n=await F(e.pmRoot);if(await Ki({pmRoot:e.pmRoot,author:wt(e.author,n.author_default),itemIds:e.itemIds,intent:e.intent}),t!==void 0)throw t}var Ha=new WeakMap;function Ft(e,t){Ha.set(e,t)}function ye(e){return Ha.get(e)}function Ga(e){return e.length>0?[e[0]]:[]}function vl(e){let t=["","Intent:",` ${e.why}`],n=Ga(e.examples);return n.length>0&&(t.push("","Example:"),t.push(` ${n[0]}`)),t.push("","Need deeper rationale and more examples?"),t.push(" Re-run with --explain."),t.join(`
4
4
  `)}function Cl(e){let t=["","Why use this command:",` ${e.why}`,"","Examples:",...e.examples.map(n=>` ${n}`)];return e.tips&&e.tips.length>0&&(t.push("","Tips:"),t.push(...e.tips.map(n=>` - ${n}`))),t.join(`
@@ -36,7 +36,7 @@ Extension command metadata:
36
36
  `)}return process.exitCode=g.SUCCESS,!0}function ou(e,t){let n=["","Type-aware option policies:"," pass --type <value> with --help to render required/disabled/hidden option policy details for that type.",` active type values: ${t.types.join("|")}`];return e==="create"&&n.push(" scheduling shortcut: use --schedule-preset lightweight for Reminder/Meeting/Event minimal create flows."),n.join(`
37
37
  `)}function iu(e,t){if(t.options.length===0){e.push(" type options: none");return}e.push(" type options:");for(let n of t.options){let o=n.required?" (required)":"",i=n.aliases??[];e.push(` - ${n.key}${o}`),e.push(` values: ${n.values.length>0?n.values.join("|"):"any non-empty string"}`),e.push(` aliases: ${i.length>0?i.join("|"):"none"}`),n.description&&n.description.trim().length>0&&e.push(` description: ${n.description.trim()}`)}}function ru(e,t){let n=e==="create"?new Set(["title","type"]):new Set,o=new Set(n);if(e==="create")for(let i of[...t.required_create_fields,...t.required_create_repeatables])o.add(i);return{progressive:n,strict:o}}function au(e,t,n,o){let i=new Set(n),r=o.filter(c=>!i.has(c)),a=c=>c.length>0?c.map(l=>mn("create",l)).join(", "):"none";e.push(` required in strict mode: ${a(r)}`);let s=r.map(pa).filter(c=>c!==void 0);e.push(` explicit empty assertion: ${s.length>0?s.join(", "):"none"}`),["Reminder","Meeting","Event"].includes(t.name)&&(e.push(" schedule preset: --schedule-preset lightweight switches schedule artifacts to progressive required-option policy."),e.push(" strict parity remains available via --create-mode strict."))}function su(e,t,n){let o=Jr(n);if(!o)return ou(e,t);let i=Oi(o,t);if(!i){let y=t.types.join("|");return["",`Type-aware option policies: type "${o}" is not in the active registry.`,` active type values: ${y}`].join(`
38
38
  `)}let r=n.indexOf("--"),a=r<0?n:n.slice(0,r),s=a.findIndex(y=>y==="--create-mode"||y.startsWith("--create-mode=")),c=s<0?void 0:a[s]?.startsWith("--create-mode=")?a[s]?.slice(14):a[s+1],l=e==="create"&&c?.toLowerCase()==="strict",d=ru(e,i),m=yt(i,e,d.progressive),u=yt(i,e,l?d.strict:d.progressive),p=y=>y.length>0?y.map(h=>mn(e,h)).join(", "):"none",f=["",`Type-aware option policies for ${i.name}:`,` required: ${p(u.required)}`,` disabled: ${p(u.disabled)}`,` hidden: ${p(u.hidden)}`];if(e==="create"){let y=yt(i,e,d.strict);au(f,i,m.required,y.required)}return iu(f,i),u.errors.length>0&&f.push(` config errors: ${u.errors.join("; ")}`),f.join(`
39
- `)}function Gs(e,t,n){let o=E(n);if(o!=="create"&&o!=="update")return;let i=rt(e,o);i&&i.addHelpText("after",su(o,t,n))}function cu(e,t){let n=Ve(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function lu(e){return Ve(e.status)?.toLowerCase()??"pending"}function du(e){return e.mandatory===!0}function mu(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function Bs(e){let t=[];return e.forEach((n,o)=>{if(!du(n.definition))return;let i=lu(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:cu(n.definition,o),status:i})}),t.sort(mu),t}function zs(e){return Array.isArray(e)&&e.length>0}var uu=new Set(["create","beads import","todos import"]),pu=new Set(["restore","update","close","delete","append","claim","release"]),fu=new Set(["comments","notes","learnings"]),gu=new Set(["files","docs","test"]),hu=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function No(e,t){let n=t.force===!0;return uu.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:pu.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:fu.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:gu.has(e)?{isMutation:zs(t.add)||zs(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function yu(e,t,n){if(No(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return $r(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>hu.has(i.trim().toLowerCase())):!1}function Ws(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function _u(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Ve(t[1])||i.push("source"),Ve(n.to)||i.push("--to"),i.length!==0)throw new I(`Schema migration requires ${i.join(", ")}.`,g.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function wu(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Ws(n.status)!==Ws(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=ce(i,le()),s=await kt(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let c=await vr(s,{schema:i.schema}),l=typeof n.assignee=="string"?n.assignee.trim():void 0;(l===void 0?c.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(l.toLowerCase())&&l)||x(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function Lo(e,t,n,o,i){if(!yu(e,t,n)||(_u(e,t,n),!await Y(X(i))))return;let r=await Re(i);Ea(o.json===!0)||await wu(e,t,n,i,r.settings);let a=Pr({author:wt(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)fe(s)}function Vs(e,t,n){if(n.length===0)return;let o=No(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new I(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,g.CONFLICT)}async function Mo(e,t,n,o){if(!No(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await Y(X(n)))return;let{settings:r,metadata:a,warnings:s}=await Re(n);for(let c of s)fe(c);if(!_r(r)&&(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(yr(r),await wr(n,r,"item_format:auto_select_default")),o.run_preflight_item_format_sync)){let c=ce(r,le());await Nr(n,r.item_format,"item_format:pre_mutation_sync",c.type_to_folder,r.schema)}}function Fo(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=v(n);o.length!==0&&t.push(o)}return t}function De(e){let t=v(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Fo(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,H(i)]))]}function Do(e,t){let n=v(e);if(n.length===0)return!1;let o=De(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function Vt(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...L(n.commands),...L(n.command_handlers),...L(n.command_overrides),...L(n.flag_commands),...L(n.parser_overrides),...Js(n.preflight_ownership),...Js(n.renderer_ownership)]:[]}function L(e){return e??[]}function Js(e){return L(e).flatMap(t=>t.commands)}function st(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Ks=new Set(["hooks","parser","preflight","renderers"]),Ys=new Set(["commands","schema","services","importers"]),vu=new Set(["reindex","search","search-advanced"]),Cu=new Set(["--template"]);function Fe(e,t){for(let n of t)if(e.has(n))return!0;return!1}function jo(e){let t=v(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return vu.has(n??t)}function Uo(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Jt(e){return v(e.commandPath??"")==="create"&&Uo(e,Cu)}function qo(e){return e.some(t=>{let n=v(t);return n==="templates"||n.startsWith("templates ")})}function Bt(e,t){return e.some(n=>Do(n,t))||Jt(t)&&qo(e)}function Ho(e){return[L(e.hooks).length,(e.preflight_overrides??0)-L(e.preflight_ownership).length,L(e.item_types).length,L(e.item_fields).length,L(e.relationship_kinds).length,L(e.service_overrides).length,L(e.assurance_providers).length,L(e.renderer_overrides).length-L(e.renderer_ownership).length].some(n=>n>0)}function Go(e,t){let n=e.activation?.commands??[];if(n.length>0)return Bt(n,t);let o=Vt(e);if(Bt(o,t)||st(e).has("search")&&jo(t.commandPath))return!0;if(e.contributions)return Ho(e.contributions)}function Kt(e,t){let n=Go(e,t);if(n!==void 0)return n;let o=st(e);return!!(Fe(o,Ks)||Fe(o,Ys))}function ct(e,t){return e.effective.length===0?!1:lt(t)!=="all"?e.effective.some(o=>Kt(o,t)):e.effective.some(o=>{let i=st(o);return Vt(o).length>0||Fe(i,Ks)||Fe(i,Ys)||i.has("search")})}function lt(e){if(v(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=De(e).filter(i=>i.split(" ").every(r=>!r.startsWith("-"))).sort((i,r)=>r.length-i.length)[0]??v(e.commandPath??"");if(t.length===0)return"all";let n=Jt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function zo(e){return lt(e)==="all"?void 0:t=>Kt(t,e)}function je(e){let t=$(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=j(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Wo(e){let t=e.args.map(String);if(v(A(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}return t}var Yt=Symbol.for("pm.readOutputInvocationProvenance"),xu=new Map(ue.filter(e=>e.reservation_scope==="root_only").map(e=>[$t({long:e.flag}),e.flag]));function se(e,t){let n=Reflect.get(e,Yt);n!==void 0&&Reflect.set(t,Yt,n)}function Bo(e,t,n){let o=qi(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(ee(r.slice(2))),s=Ui.find(d=>d.command===o),c=Object.values(s?.dimensions??{}).flatMap(d=>d.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),l=Reflect.get(n,Yt);Reflect.set(n,Yt,{canonical_include_modes:l?.canonical_include_modes??[],explicit_legacy_aliases:c,cli_invocation_observed:!0}),se(n,e)}function bu(e){let t=e.optsWithGlobals(),n=A(e);if(H(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of i.options){let a=r.attributeName(),s=i.getOptionValueSource(a)==="cli";if(s&&!e.options.some(c=>c.long===r.long))throw new I(`Unknown option '${r.long}' for ${n}`,g.USAGE,{code:"unknown_option",flag:r.long,required:`Use options declared by pm ${n} --help.`});if(s&&e.getOptionValueSource(a)!=="cli"){let c=i.getOptionValue(a);e.setOptionValueWithSource(a,c,"cli")}a in o?t[a]=o[a]:delete t[a]}return t}function Vo(e,t,n,o){Bo(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=Vi(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;se(o,e);let s=Bi(t);for(let l of a){let d=s.get(l),m=o[d];e.setOptionValueWithSource(d,m,"cli")}let c=r.length>0?r.join(","):void 0;c===void 0?delete n.outputInclude:n.outputInclude=c;for(let l=e;l;l=l.parent)l.setOptionValueWithSource("outputInclude",c,"cli");Pt(e,n)}function Ue(e,t,n=[],o){let r={...bu(e)};se(e,r),delete r.json,delete r.quiet,delete r.path,delete r.pmPath,delete r.noExtensions,delete r.extensions,delete r.profile,delete r.pager,delete r.changedFields,delete r.fullChangedFields,delete r.idOnly,delete r.lean,delete r.tokenAccounting,delete r.outputInclude,delete r.outputLimit,delete r.outputBudget,delete r.outputFormat,delete r.outputSession,delete r.expectHash;let a=ia(t);for(let[s,c]of Object.entries(a))r[s]===void 0&&(r[s]=c);if(n.length>0){let s=Hn(n),c=G(A(e)).map(u=>({long:u.flag,short:u.short,aliases:u.aliases})),l={...a};for(let u of s)r[u]!==void 0&&(l[u]=r[u]);Gn(l,[...c,...n],A(e),o);let d=sa(a,nc(e),n),m=oa(r,n,d,A(e));return se(r,m),m}return r}function Qs(e,t,n){let o=Hn(t.map(({long:a})=>({long:a}))),i=[...xu].find(([a])=>e[a]!==void 0&&!o.has(a));if(i===void 0)return;let r=i[1];throw new I(`Unknown option '${r}' for extension command '${n}'. ${r} is a root-only pm flag and this command does not declare it.`,g.USAGE,{code:"unknown_option",flag:r,required:`Remove ${r}, or use it on the root command (pm --help ${r}).`,nextSteps:[`Run pm contracts --command ${n} --flags-only --json to list the flags this command accepts.`]})}function dt(e,t,n){let o=Qe(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Qe(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Xt(e){return e.arguments??[]}function Xs(e){let t=Xt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function Jo(e,t){if(!e)return!1;let n=v(t);return e.importers.some(o=>v(`${o.importer} import`)===n)||e.exporters.some(o=>v(`${o.exporter} export`)===n)}var ec=Symbol("pm.commandOptionTokens"),Zs=Symbol("pm.capturesOptionTokens");function tc(e){if(Reflect.get(e,Zs)===!0)return;Reflect.set(e,Zs,!0);let t=e.parseOptions.bind(e);e.parseOptions=n=>(Reflect.set(e,ec,[...n]),t(n))}function ku(e){let t=new Map;for(let n of e.options){let o={arity:n.required?"required":n.optional?"optional":"none",key:n.attributeName(),variadic:n.variadic};for(let i of[n.short,n.long])i&&t.set(i,o)}return t}function Su(e){let t=Reflect.get(e,"_passThroughOptions")===!0;return!t&&Reflect.get(e,"_enablePositionalOptions")!==!0?{}:{stop:{atSubcommand:n=>e.commands.some(o=>o.name()===n||o.aliases().includes(n)),atFirstUnrecognized:t}}}function nc(e){let t=[];for(let o=e;o?.parent;o=o.parent)t.unshift(o);let n=[];for(let o of t){let i=Reflect.get(o,ec);if(i===void 0)continue;let r=ku(o),a=[];for(let s=o;s;s=s.parent)a.push(s);n.push({tokens:i,optionOf:s=>r.get(s),includesLooseFlags:o===e,negativeNumbersAreValues:!a.some(s=>s.options.some(c=>c.short!==void 0&&/^-\d$/u.test(c.short))),...Su(o)})}return n}function oc(e,t,n){t.length!==0&&aa(nc(e),t,n)}function Ko(e,t){let n=Xt(e),o=n.filter(c=>c.required).length,r=n.some(c=>c.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new I(`Missing required argument for extension command '${e.command}'. Usage: ${Xs(e)}${s}`,g.USAGE);if(t.length>r){let c=t.slice(r).join(" ");throw new I(`Too many arguments for extension command '${e.command}': ${c}. Usage: ${Xs(e)}${s}`,g.USAGE)}}function Eu(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function Zt(e,t){return{definitions:e,inheritedFlags:Rt({readOutput:t}).map(n=>n.flag)}}function Au(e,t,n){let o=Object.keys(e).filter(r=>e[r]!==void 0).sort().map(Eu);if(o.length===0)return;let{inheritedFlags:i}=Zt([],n);throw new I(`Unknown option '${o.join(", ")}' for extension command '${t}'. This command declares no flags; it accepts only the host flags ${i.join(", ")}.`,g.USAGE,{code:"unknown_option",flag:o[0],required:`Remove ${o.join(", ")}, or ask the package to declare it with api.registerFlags.`,nextSteps:[`Run pm contracts --command ${t} --flags-only --json to list the flags this command accepts.`]})}function Ru(e,t,n){let o=e.read_output_declared===!0;if(n.length>0){Gn(t,n,e.command,Zt(n,o));return}Au(t,e.command,o)}function Yo(e,t,n,o){e&&(Ko(e,t),Ru(e,n,o))}import{Command as ic}from"commander";var Ou=new Set(["--version","-V"]);function mt(e){let t;try{t=pe(e).argv}catch{return!1}let n=Vr(t),o=S(n);return o===void 0?!1:["package","packages","extension"].includes(n[o])&&["inventory","list"].includes(Tt(n.slice(o+1))??"")}function rc(e){if(j(e)[0]!=="item"||!e.includes("--dry-run"))return;let n=new ic().configureOutput({writeErr:()=>{}}).exitOverride(),o=new Set;for(let r of ue)for(let a of[r.flag,r.short,...r.aliases??[]]){if(a===void 0||o.has(a))continue;o.add(a);let s=r.value_name!==void 0||r.flag==="--pm-path";n.option(`${a}${s?" <value>":""}`)}try{n.parseOptions(e)}catch{}let i=n.opts();return{path:i.pmPath??i.path}}var Tu=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),Xo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),ac=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),Iu=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),Pu=new Set(["claim","close-task","pause-task","release","start-task","test"]),xe={setup:!0,listQuery:!0,mutation:!0,operation:!0},$u=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function ut(e){return e.some(t=>Ou.has(t))}function Nu(e,t){if(!M.some(o=>o.canonical_argv[0]===t))return;let n=new ic().configureOutput({writeErr:()=>{}}).exitOverride();for(let o of Te(t,G(t))){let i=o.takes_value?o.value_required?" <value>":" [value]":"";for(let r of[o.flag,o.short,...o.aliases??[]])r!==void 0&&n.option(`${r}${i}`)}try{let o=n.parseOptions(e.slice(1));if(o.unknown.length>0)return xe;let i=V([t,...o.operands])?.alias;if(M.some(r=>r.alias===i))return{...xe,targetCommandName:i}}catch{return xe}}function Zo(e){if(ut(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||$(e).requested)return xe;let t=E(e);if(!t)return xe;let n=t.trim().toLowerCase(),o=j(e),i=V(o)?.alias;if(M.some(a=>a.alias===i))return{...xe,targetCommandName:i};let r=Nu(o,n==="ctx"?"context":n);return r||(Tu.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:Xo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:ac.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:Iu.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:xe)}function Qo(e){return e.length===0||$(e).requested||e.includes("--explain")&&E(e)===void 0}function ei(e,t){return mt(t)||ut(t)?!1:ae(t)||$(t).requested?!0:!!E(t)}function ti(e){if(ut(e))return!1;let t=E(e);return t?$u.has(t):!1}function Lu(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(l=>{let d=l.indexOf("=");return d>=0?l.slice(0,d):l}).find(l=>l==="--literal"||l==="--regex"||l==="--replacement"),r=i?e.argv.map(l=>{let d=l.indexOf("=");return(d>=0?l.slice(0,d):l)===o?d>=0?`${i}${l.slice(d)}`:i:l}):e.argv,a=We(r),s=i&&n>=0?`${o}=[redacted]`:t,c=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:c,sourceDisplay:s}}function ni(e){let t=e.commandName;if(!t)return;let n=e.trace.find(l=>l.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(l=>l.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=ac.has(t)||Pu.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",c=Lu({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new I(`Refusing to auto-correct ${s} ${c.sourceDisplay} to ${c.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,g.USAGE,{code:a,examples:[_(c.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:c.argv,suggested_retry:_(c.argv)}})}var Mu=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),Fu=new Set(["parse","preflight","execute","unknown"]),Du=new Set(["usage","validation","conflict","runtime","unknown"]);function be(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function oi(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Qt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function ii(e){if(!e)return;let t=e.trim().toLowerCase();if(Mu.has(t))return t}function ri(e){if(!e)return;let t=e.trim().toLowerCase();if(Fu.has(t))return t}function ai(e){if(!e)return;let t=e.trim().toLowerCase();if(Du.has(t))return t}function si(e){let t=be(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(oi(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let i=Qt(e,"failed");if(typeof i=="number"&&i>0)return`failed_runs:${i}`;let r=e?.run_results;if(Array.isArray(r)){let a=r.filter(s=>gn(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function ci(e,t){if(!e)return t===g.USAGE?"invalid_command_usage":t===g.NOT_FOUND?"item_not_found":t===g.CONFLICT?"lock_conflict":t===g.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function li(){let e=gn(de()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Qt(e,"exit_code","exitCode"),o=t??n??g.SUCCESS,i=ma(o),r=be(e,"error_code","errorCode")??ci(i,o),a=ai(be(e,"error_category","errorCategory"))??(i?void 0:ht(r)),s=i?void 0:si(e)??`command_exit_${o}`,c=ii(be(e,"command_resolution","commandResolution"))??St({ok:i,errorCode:r,errorCategory:a}),l=ri(be(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:c,resolution_stage:l}}var di="PM_CLI_PACKAGE_ROOT",hc=Symbol("pm.deprecatedAliasInvocation"),nn=new Map;for(let e of K){let t=e.alias.split(" ")[0],n=nn.get(t)??[];n.push(e),nn.set(t,n)}for(let e of nn.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function ju(){return tr(import.meta.url,["../.."])}(typeof process.env[di]!="string"||process.env[di]?.trim().length===0)&&(process.env[di]=ju());var Se=null,q=null,on=null;function Uu(e){Se=e}function qu(e){T=e}var pt=null,ke=null,T=new Map,yi=250,Hu=new Set([g.USAGE,g.NOT_FOUND,g.CONFLICT]),Gu=new Set(["1","true","yes","on"]),zu=Ye(()=>import("./chunks/register-setup-3QYD5H4H.js")),Wu=Ye(()=>import("./chunks/register-list-query-EKSCZWEZ.js")),Bu=Ye(()=>import("./chunks/register-mutation-ZIAOKKUJ.js")),Vu=Ye(()=>import("./chunks/register-operations-ECVBZ5FM.js"));function tn(e){return _(e)}function yc(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>ge(o)??o))];return n.length>0?n:void 0}function Ju(e,t,n,o){if(n?.suggested_retry||o===no||o===to||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let i=ee(t),r=new Set(i.map(m=>ge(m)??m)),a=yc(e),s=t.find(m=>w.commands.some(u=>u.name()===m)),c=s?w.commands.find(m=>m.name()===s):void 0,l=new Set([...w.options,...c?.options??[]].flatMap(m=>m.flags.split(/[ ,|]+/).map(u=>ge(u)).filter(u=>u!==void 0))),d=a?.filter(m=>{let u=ge(m)??m;return r.has(u)?!1:l.has(u)||So(t,s,u,T)!==void 0});return d&&d.length>0?d:void 0}function Ku(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?ge(i):void 0,a=e.find(u=>w.commands.some(p=>p.name()===u)),s=a?w.commands.find(u=>u.name()===a):void 0,c=r?s?.options.find(u=>u.flags.split(/[ ,|]+/).includes(r)):void 0,l=So(e,a,r,T),d=r?c?.isBoolean()===!0||l===!1?[r]:[r,"<value>"]:[],m=r?tn([...e,...d]):t;return m===t?void 0:m}function Yu(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!==void 0&&(o==="allowed_values"||i!==null)&&(n[o]=i)}return n}function Xu(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Yu(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function sc(e,t){return{...e,recovery:t}}function Zu(e,t){if(t===void 0)return;let n=Fa(e,t.code,t.field,$a(e,t.code,t.recovery)),o=Qu(e),i=Da(e,t.code,t.field,n,o),r=La(e,t.code,i,o,()=>Ur(P(process.cwd(),N(e).path)));return ja(e,t.code,r,o)}var cc=" ";function Qu(e){let t=e.map(i=>i===""?cc:/^--(?:pm-)?path=$/u.test(i)?`${i}${cc}`:i),n=N(t).path;if(n!==void 0&&n.trim()!=="")return[];let o=Ee({});return n!==void 0&&o.length>0?null:o}function _c(e,t,n){let o=We(t),i=j(o),r=S(i),[a,s]=r===void 0?[]:i.slice(r,r+2),c=o.includes("--explain");e=e===void 0?void 0:xr(e);let l=Zu(o,e),d=l&&(a==="history-redact"||a==="history"&&s==="redact")?{...l,...l.attempted_command?{attempted_command:tn(o)}:{},...l.normalized_args?{normalized_args:[...o]}:{},...l.suggested_retry?{suggested_retry:tn(o)}:{},...l.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:l;if(d?.recovery_mode==="compact"&&!c)return sc(e,d);let m=tn(o),u=ee(o),p=Ju(n,o,d,e?.code),f=Ku(o,m,p,d),y=Xu({invocationArgv:o,attemptedCommand:m,providedFields:u,inferredMissing:p,suggestedRetry:f,existingRecovery:d});return sc(e,y)}async function ft(e){let t=q;q=null,await Ua(t,e);let n=Se;if(Se=null,!n){Ct();return}let o=[],i=fr();try{await qa({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await rr(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:de(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{Ct()}!n.globalOptions.json&&o.length>0&&x(`[pm] warning: afterCommand hook_warnings=${W(o)}`),n.profileEnabled&&o.length>0&&x(`profile:extensions hook_warnings=${W(o)}`)}async function wc(e,t){await Er();let n=q,o=Se,i=n?.command??o?.commandName??e,r=n??An(o?.globalOptions??t),a=T.get(v(i))?.source;$n(i,o?.commandArgs??[],{...o?.commandOptions,...o?.globalOptions},{source_context:r.source_context,source_context_source:r.source_context_source,pm_version:n?.pm_version??He,extension:a})}function vc(e){return Gu.has((process.env[e]??"").trim().toLowerCase())}function Cc(e){return vc("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!Hu.has(Math.trunc(e))}async function rn(e,t){return Cc(e.exit_code)?(await wc(e.command,t),Ir({...e,source_context:e.source_context??An(t).source_context}),!0):!1}async function xc(e){let t=J(me(e.error)),n=gs(t);e.bootstrapGlobal.json?x(JSON.stringify(et(ps(t,g.GENERIC_FAILURE)),null,2)):x(t),process.exitCode=g.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await wc(e.attemptedCommand,e.bootstrapGlobal),Nn(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:g.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,await cn(!1,t,{error_code:n.code,error_category:o,exit_code:g.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||x(`Failed to report error: ${me(r)}`)}try{await ft({ok:!1,error:t,exit_code:g.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||x(`Failed to run error hooks: ${me(r)}`)}try{await Oe()}catch(r){e.bootstrapGlobal.json||x(`Failed to flush error reporting: ${me(r)}`)}}var ep={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},mi=new Map;function ui(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function bc(e,t){return e.options.some(n=>n.long===t)}function kc(e,t){return e.options.some(n=>n.short===t)}function pi(e,t,n,o){let i=t.trim();if(!i||!Li(i))return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(kc(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,qn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!bc(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,qn);return}e.option(`${a} <value>`,r)}}async function Sc(e,t){let n=ep[e];if(!n)return[];let o=`${t}:${n}`,i=mi.get(o);if(i)return i;if(!await Y(X(t)))return mi.set(o,[]),[];let r=await F(t),s=(yn(r.schema).command_to_fields.get(n)??[]).flatMap(c=>[c.cli_flag,...c.cli_aliases].map(d=>({long:`--${d}`,type:ui(c.type),value_type:ui(c.type)})));return mi.set(o,s),s}async function Ec(e,t){let n=N(t),o=P(process.cwd(),n.path);if(!await Y(X(o)))return;let i=ke?.key===vi(o)?ke.snapshot:null,r=i===null?await F(o):i.settings,a=yn(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let c of s){let l=oe(e,c.path.split(" "));if(l)for(let d of a.command_to_fields.get(c.command)??[]){let m=d.description??"";pi(l,d.cli_flag,m,d.repeatable);for(let u of d.cli_aliases)pi(l,u,`Alias for --${d.cli_flag}`,d.repeatable)}}}async function _i(e,t,n,o,i){let r=E(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await F(t),s=ce(a,o);Gs(e,s,n)}catch{}}function fi(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function Ac(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function wi(e){return e.some(t=>t==="--profile")}function vi(e){return`pm-root:${e}`}function gi(e){for(let t of e)t.startsWith("settings_read_")&&fe(t,`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Rc(e,t){e.profile&&(x(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&x(`profile:extensions activation_warnings=${W(t.activationWarnings)}`))}function an(e,t,n){if(!e)return;let o=v(n.commandPath??"")||"<none>";x(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function sn(e,t=Re){let n=vi(e);if(ke?.key===n)return ke.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await ar({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return ke={key:n,snapshot:s},s}catch{return ke={key:n,snapshot:null},null}}async function Ge(e,t,n=F){let o=t?lt(t):"all",i=Ac(e,o);if(pt?.key===i)return pt.snapshot;try{let r=await n(e),a=await Je({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?zo(t):void 0}),s=await Ke({...a,loaded:a.loaded}),c=[...new Set(s.commands.handlers.map(p=>v(p.command)))].filter(p=>p.length>0).sort((p,f)=>p.localeCompare(f)),l=Es(s.registrations.flags),d=ks(s.commands.handlers,s.registrations.commands),m=Rs(c,s.registrations.commands,s.registrations.flags,d),u={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:c,commandFlagHelp:l,commandDescriptors:m,commandAliases:d,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:p,module:f})=>({name:p,module:f}))};return pt={key:i,snapshot:u},u}catch{return pt={key:i,snapshot:null},null}}async function Oc(e){let t=Ze(e);if(t.noExtensions){let a=P(process.cwd(),t.path);return await Y(X(a))&&gi((await Re(a)).warnings),null}let n=P(process.cwd(),t.path),o=await sn(n);if(!o)return null;gi(o.settingsReadWarnings);let i={commandPath:A(e),commandArgs:Wo(e)};if(!ct(o.discovery,i))return an(t.profile,o,i),null;let r=await Ge(n,i);return r?(Rc(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function Ci(e){let t=await Ge(e);return t?new Map(t.commandDescriptors):T}async function tp(e,t){return!e.requested||t.noExtensions||Le(w,e.commandPathTokens)?T:Ci(P(process.cwd(),t.path))}async function Tc(e,t){return(await Wr({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function Ic(e,t,n){let o=t.author;return zr(e,ga.forActiveExtensionHost({pmRoot:e,author:o}),o,v(n))}async function Pc(e,t,n,o=[]){let i=A(e),r=zn(e.args.map(String),o),a={...t};delete a.author;let s={...n},c=P(process.cwd(),n.path),l={args:[...r],path:n.path},d=await xt({command:i,args:r,options:a,global:s,pm_root:c});n.profile&&d.warnings.length>0&&x(`profile:extensions parser_warnings=${W(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,Xn(l,{args:r,path:s.path},a),Yo(T.get(v(i)),r,a,o),Ae(void 0),vt({command:i,args:r,options:{...a},global:{...s},pm_root:c});let m=await En({command:i,args:r,options:a,global:s,pm_root:c,sdk:Ic(c,s,i)});if(s.profile&&m.warnings.length>0&&x(`profile:extensions command_handler_warnings=${W(m.warnings)}`),!m.handled)throw m.warnings.length>0?Ar(i,m):new I(`Command "${i}" is provided by extensions and is not currently available.`,g.NOT_FOUND);return m.exitCode!==void 0&&(process.exitCode=m.exitCode),Ae(m.result),m.result}var lc=Symbol("pm.wrappedActionHandler");function np(e,t){let n=e[e.length-1];return n instanceof hi?n:t}function dc(e,t,n){e&&n.length>0&&x(`profile:extensions ${t}=${W(n)}`)}function op(e){let t=T.get(v(e.commandPath));if(!t||!Jo(e.activeRegistrations,e.commandPath))return;let n=Xt(t).length===0?ra(e.commandArgs):zn(e.commandArgs,e.extensionFlagDefinitions);Ko(t,n)}function ip(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function xi(e,t,n){if(!at(e))return;let o=T.get(v(t))?.read_output_declared===!0;return Zt(n,o)}function $c(e){let t=n=>{let o=n;if(tc(n),typeof o._actionHandler=="function"&&o[lc]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let s=np(a,n),c=Date.now();Un(s);let l=Ze(s),d=H(A(s));if(["package inventory","packages inventory","extension inventory"].includes(d))return Ta(d,l.expectHash),await i.apply(this,a);let m=P(process.cwd(),l.path),u=s.args.map(String),p=le(),f=p?dt(p,d,u):[],y=await Sc(d,m),h=xi(s,d,f),C=Ue(s,u,[...f,...y],h);oc(s,f,d),T.has(v(d))&&delete C.author,h!==void 0&&Qs(C,f,d);let R={args:[...u],path:l.path},O=await xt({command:d,args:u,options:C,global:l,pm_root:m});dc(l.profile,"parser_warnings",O.warnings),u=O.context.args,C=O.context.options,se(s,C),l=O.context.global,Xn(R,{args:u,path:l.path},C),op({activeRegistrations:p,commandPath:d,commandArgs:u,extensionFlagDefinitions:f}),l=await ta(l),Pt(s,l),ip(s,a,u),It(s,C),Ae(void 0),vt({command:d,args:u,options:{...C},global:{...l},pm_root:m});let k=await En({command:d,args:u,options:C,global:l,pm_root:m,sdk:Ic(m,l,d)});if(dc(l.profile,"command_handler_warnings",k.warnings),k.handled){Ae(k.result),kn(k.result,{...l,command:d,commandArgs:u,commandOptions:C,pmRoot:m}),l.profile&&x(`profile:command=${d} took_ms=${Date.now()-c}`);return}return await i.apply(this,a)},o[lc]=!0}for(let i of n.commands)t(i)};t(e)}async function en(e){T=new Map,re({overrides:[]}),e&&await _i(e.rootProgram,e.pmRoot,e.invocationArgv,or(),e.settings)}function rp(e,t,n,o){if(t?.flags&&t.flags.length>0){Ro(e,t.flags);let i=Oo(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);t&&at(e)&&e.addHelpText("after",Io(t)),o&&e.addHelpText("after",o)}function ap(e,t,n,o){t&&e.addHelpText("after",t),n&&e.addHelpText("after",Io(n)),o&&e.addHelpText("after",o)}function Nc(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),c=[...n.entries()].filter(([d])=>d===s||d.startsWith(`${s} `)).map(([,d])=>d),l=c.length===0?"standard":c.reduce((d,m)=>o[m.tier]<o[d]?m.tier:d,"internal");Ft(r,l);for(let d of r.commands)i(d,[...a,d.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function Lc(e,t){let n=N(t),o=P(process.cwd(),n.path);if(n.noExtensions){await en({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await sn(o),r=je(t);if(!i){await en();return}if(!ct(i.discovery,r)){await en({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),an(wi(t),i,r);return}let a=await Ge(o,r);if(!a){await en({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}re(a.services),T=new Map(a.commandDescriptors),await _i(e,o,t,a.registrations,a.settings);let s=Ls(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,d=>Ms(a.activationWarnings,x,d)),c=new Set(e.commands.map(d=>d.name())),l=d=>{let m=d.split(" ").filter(R=>R.length>0),u=a.commandDescriptors.get(d),p=oe(e,m),f=a.commandFlagHelp.get(d),y=u?$s(u):null;if(p){rp(p,u,f,y);return}let h=Ns(e,m);u?.description&&h.description(u.description);let C=f;u&&(Os(h,u),u.flags.length>0&&(Ro(h,u.flags),C=Oo(h,u.flags)??void 0)),ap(h,C,u,y),h.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...R)=>{let O=R[R.length-1],k=O instanceof hi?O:h,gt=Ze(k),Vc=Date.now(),ln=dt(a.registrations,d,k.args.map(String)),Si=Ue(k,k.args.map(String),ln,xi(k,d,ln)),Ei=await Pc(k,Si,gt,ln);await na(gt,Ei),kn(Ei,{...gt,command:d,commandArgs:k.args.map(String),commandOptions:Si,pmRoot:o}),gt.profile&&x(`profile:command=${d} took_ms=${Date.now()-Vc}`)})};for(let d of s)l(d);Nc(e,c,a.commandDescriptors)}var He=nr(import.meta.url,["../.."])??"0.0.0",w=jn(He);async function mc(e){if(!q)return;let t=Reflect.get(e,hc);typeof t=="string"&&await fa(t)}async function uc(e,t,n){let o=A(e);return["item mutate","item complete"].includes(o)&&e.optsWithGlobals().dryRun===!0?t:n()}async function pc(e,t,n){!q||!await Rn(!0)||($n(e,t,n,{source_context:q.source_context,source_context_source:q.source_context_source}),Rr(e),on=q)}async function cn(e,t,n){let o=on;if(!o)return;on=null;let i=!1;try{let r=await F(o.global_pm_root);i=r.telemetry.enabled&&r.telemetry.installation_id===o.installation_id}catch{}await Rn(i)?Tr(e,t,n):Or()}async function sp(e){let t=await Oc(e);return Sn(t?.registrations??null),t}function Mc(e,t){t&&mt(t)||(e.hook("preAction",async(n,o)=>{Se=null,q=null,on=null,Ct(),Un(o);let i=o.optsWithGlobals(),r=Ze(o),a=H(A(o)),s=o.args.map(String),c={args:[...s],path:r.path},l=Ue(o,s),d={...r},m=P(process.cwd(),r.path),u=await sp(o);if(Wi(a,{...l,...zi(a,o.processedArgs),outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),Vo(o,a,d,l),await uc(o,void 0,()=>Lr(a,d)),!u){Se=sr({commandName:a,commandArgs:s,commandOptions:l,globalOptions:d,pmRoot:m}),q=await Ln({command:a,pm_version:He,args:s,options:l,global:d,pm_root:m}),await mc(e),await pc(a,s,l),await Mo(a,l,m,fi()),await Lo(a,s,l,d,m),await Yn({command:o,commandPath:a,commandArgs:s,commandOptions:l,expectHash:r.expectHash,pmRoot:m,globalOptions:d});return}cr(u.hooks),lr(u.commands),dr(u.parsers),mr(u.preflight),re(u.services),ur(u.renderers),Sn(u.registrations);let p=dt(u.registrations,a,s);l=Ue(o,s,p,xi(o,a,p)),Vo(o,a,d,l);let f=await xt({command:a,args:s,options:l,global:d,pm_root:u.pmRoot});d.profile&&f.warnings.length>0&&x(`profile:extensions parser_warnings=${W(f.warnings)}`),s=f.context.args,l=f.context.options,se(o,l),d=f.context.global;let y={args:[...s],path:d.path};It(o,l);let h=await gr({command:a,args:s,options:l,global:d,pm_root:u.pmRoot,decision:fi()});d.profile&&h.warnings.length>0&&x(`profile:extensions preflight_warnings=${W(h.warnings)}`),s=h.context.args,l=h.context.options,se(o,l),d=h.context.global,It(o,l);let C=h.decision;await Mo(a,l,u.pmRoot,C),await Lo(a,s,l,d,u.pmRoot),await Yn({command:o,commandPath:a,commandArgs:c.args,commandOptions:l,expectHash:r.expectHash,pmRoot:u.pmRoot,rewritten:Kn(c,[y,{args:s,path:d.path}]),globalOptions:{...d,path:r.path,noExtensions:r.noExtensions}});let R=C.run_extension_migrations?await uc(o,[],()=>Tc(u.registrations.migrations,u.pmRoot)):[];d.profile&&R.length>0&&x(`profile:extensions migration_warnings=${W(R)}`);let O=Bs(u.registrations.migrations);Se={hooks:u.hooks,commandName:a,commandArgs:s,commandOptions:{...l},globalOptions:{...d},pmRoot:u.pmRoot,profileEnabled:!!d.profile,migrationBlockers:O},Ae(void 0),vt({command:a,args:s,options:{...l},global:{...d},pm_root:u.pmRoot}),q=await Ln({command:a,pm_version:He,args:s,options:l,global:d,pm_root:u.pmRoot}),await mc(e),await pc(a,s,l);let k=await ir(u.hooks,{command:a,args:s,options:{...l},global:{...d},pm_root:u.pmRoot});d.profile&&k.length>0&&x(`profile:extensions hook_warnings=${W(k)}`),C.enforce_mandatory_migration_gate&&Vs(a,l,O)}),e.hook("postAction",async()=>{let n=li();await cn(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await ft(n),await Oe()}))}Mc(w);var fc=Symbol("pmCliIdempotentTopLevelRegistration");function Fc(e){let t=e;if(t[fc])return;t[fc]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new hi(r):n(o,...i)})}async function cp(e,t){if(Fc(e),t.setup){let{registerSetupCommands:n}=await zu();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await Wu(),o=typeof t.targetCommandName=="string"&&Xo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Bu();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Vu();n(e)}}function qe(e){return e.rawInvocationArgv??e.invocationArgv}function lp(e){return async t=>{let n=ht(t.errorCode),o=St({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Fr({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:He,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function Dc(e){if(e.bootstrapGlobal.noExtensions||mt(e.invocationArgv))return;let t=je(e.invocationArgv),n=await sn(e.bootstrapPmRoot);if(n&&ct(n.discovery,t)){let o=await Ge(e.bootstrapPmRoot,t);jc(o);return}n&&an(wi(e.invocationArgv),n,t),re({overrides:[]})}function jc(e){if(!e){re({overrides:[]});return}re(e.services)}async function bi(e){await cn(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await ft({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Uc(){await cn(!0,void 0,{exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await ft({ok:!0,exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=g.SUCCESS}async function qc(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof I)&&(In(e.error)||!n))return!1;let o=J(me(e.error)),i=e.error instanceof I?e.error.exitCode:Tn(t),r=e.error instanceof I||Sr(e.error)?e.error.context:void 0,a=_c(r,e.invocationArgv,o),s=ms(o,a),c=et(e.bootstrapGlobal.lean?jt(yo(o,i,a)):yo(o,i,a)),l=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?Z(c,p=>`${JSON.stringify(p,null,2)}
39
+ `)}function Gs(e,t,n){let o=E(n);if(o!=="create"&&o!=="update")return;let i=rt(e,o);i&&i.addHelpText("after",su(o,t,n))}function cu(e,t){let n=Ve(e.id);return n||`migration-${String(t+1).padStart(3,"0")}`}function lu(e){return Ve(e.status)?.toLowerCase()??"pending"}function du(e){return e.mandatory===!0}function mu(e,t){let n=e.layer.localeCompare(t.layer);if(n!==0)return n;let o=e.name.localeCompare(t.name);return o!==0?o:e.id.localeCompare(t.id)}function Bs(e){let t=[];return e.forEach((n,o)=>{if(!du(n.definition))return;let i=lu(n.definition);i!=="applied"&&t.push({layer:n.layer,name:n.name,id:cu(n.definition,o),status:i})}),t.sort(mu),t}function zs(e){return Array.isArray(e)&&e.length>0}var uu=new Set(["create","beads import","todos import"]),pu=new Set(["restore","update","close","delete","append","claim","release"]),fu=new Set(["comments","notes","learnings"]),gu=new Set(["files","docs","test"]),hu=new Set(["activate","add","add-field","add-status","add-type","apply","compact","create","deactivate","delete","disable","edit","enable","import","infer","install","materialize","migrate","redact","remove","remove-field","remove-status","remove-type","remap-status","rename-field","rename-type","repair","run","save","set","unset","update","upgrade"]);function No(e,t){let n=t.force===!0;return uu.has(e)?{isMutation:!0,forceCapable:!1,forceRequested:!1}:pu.has(e)?{isMutation:!0,forceCapable:!0,forceRequested:n}:fu.has(e)?{isMutation:typeof t.add=="string",forceCapable:!0,forceRequested:n}:gu.has(e)?{isMutation:zs(t.add)||zs(t.remove),forceCapable:!0,forceRequested:n}:{isMutation:!1,forceCapable:!1,forceRequested:!1}}function yu(e,t,n){if(No(e,n).isMutation)return!0;let o=e.trim().toLowerCase();return $r(o)?["close-many","close-task","copy","delete","discover","focus","pause-task","start-task","update-many"].includes(o)?!0:t.some(i=>hu.has(i.trim().toLowerCase())):!1}function Ws(e){return(e??"in_progress").trim().toLowerCase().replaceAll("-","_")}function _u(e,t,n){let o=t[0]?.trim().toLowerCase()??"";if(e.trim().toLowerCase()!=="schema"||!["rename-type","rename-field","remap-status"].includes(o))return;let i=[];if(Ve(t[1])||i.push("source"),Ve(n.to)||i.push("--to"),i.length!==0)throw new I(`Schema migration requires ${i.join(", ")}.`,g.USAGE,{code:"schema_migration_input_required",required:i.join(","),why:"Schema migrations require a source and target. A workspace-bound stable migration id is derived automatically when --migration-id is omitted.",recovery:{recovery_mode:"compact",missing_required_fields:i,suggested_flags:i.filter(r=>r.startsWith("--")),suggested_retry:`pm schema ${o} <source> --to <target>`}})}async function wu(e,t,n,o,i){if(e.trim().toLowerCase()!=="update"||typeof n.status!="string"||Ws(n.status)!==Ws(i.schema.workflow.in_progress_status))return;let r=t[0];if(!r)return;let a=ce(i,le()),s=await kt(o,r,i.id_prefix,i.item_format,a.type_to_folder);if(!s)return;let c=await vr(s,{schema:i.schema}),l=typeof n.assignee=="string"?n.assignee.trim():void 0;(l===void 0?c.document.metadata.assignee?.trim():!["","none","null","undefined"].includes(l.toLowerCase())&&l)||x(`warning:in_progress_item_unclaimed:${s.id}:claim_with=pm claim ${s.id}`)}async function Lo(e,t,n,o,i){if(!yu(e,t,n)||(_u(e,t,n),!await Y(X(i))))return;let r=await Re(i);Ea(o.json===!0)||await wu(e,t,n,i,r.settings);let a=Pr({author:wt(o.author,r.settings.author_default),payload:{command:e,args:t,options:n},settings:r.settings.mutation_guard,force:o.force===!0||n.force===!0});for(let s of a.warnings)fe(s)}function Vs(e,t,n){if(n.length===0)return;let o=No(e,t);if(!o.isMutation||o.forceCapable&&o.forceRequested)return;let i=n.map(a=>`extension_migration_blocking:${a.layer}:${a.name}:${a.id}:${a.status}`),r=o.forceCapable?"Re-run this command with --force to bypass.":"This command path does not support --force bypass.";throw new I(`Write command "${e}" blocked by unresolved mandatory extension migrations (${i.join(",")}). ${r}`,g.CONFLICT)}async function Mo(e,t,n,o){if(!No(e,t).isMutation||!o.enforce_item_format_gate&&!o.run_preflight_item_format_sync||!await Y(X(n)))return;let{settings:r,metadata:a,warnings:s}=await Re(n);for(let c of s)fe(c);if(!_r(r)&&(o.enforce_item_format_gate&&!a.has_explicit_item_format&&(yr(r),await wr(n,r,"item_format:auto_select_default")),o.run_preflight_item_format_sync)){let c=ce(r,le());await Nr(n,r.item_format,"item_format:pre_mutation_sync",c.type_to_folder,r.schema)}}function Fo(e){let t=[];for(let n of e??[]){if(n.startsWith("-"))break;let o=v(n);o.length!==0&&t.push(o)}return t}function De(e){let t=v(e.commandPath??"");if(t.length===0)return[];let n=[t],o=t.split(" ").filter(i=>i.length>0);for(let i of Fo(e.commandArgs))o.push(...i.split(" ").filter(r=>r.length>0)),n.push(o.join(" "));return[...new Set(n.flatMap(i=>[i,H(i)]))]}function Do(e,t){let n=v(e);if(n.length===0)return!1;let o=De(t);for(let i of o)if(i===n||i.startsWith(`${n} `))return!0;return t.allowCommandPrefixMatch===!0?o.some(i=>n.startsWith(`${i} `)):!1}function Vt(e){let t=e.activation?.commands;if(t)return t;let n=e.contributions;return n?[...L(n.commands),...L(n.command_handlers),...L(n.command_overrides),...L(n.flag_commands),...L(n.parser_overrides),...Js(n.preflight_ownership),...Js(n.renderer_ownership)]:[]}function L(e){return e??[]}function Js(e){return L(e).flatMap(t=>t.commands)}function st(e){return new Set((e.capabilities??[]).map(t=>t.trim().toLowerCase()))}var Ks=new Set(["hooks","parser","preflight","renderers"]),Ys=new Set(["commands","schema","services","importers"]),vu=new Set(["reindex","search","search-advanced"]),Cu=new Set(["--template"]);function Fe(e,t){for(let n of t)if(e.has(n))return!0;return!1}function jo(e){let t=v(e??"");if(t.length===0)return!1;let[n]=t.split(" ");return vu.has(n??t)}function Uo(e,t){for(let n of e.commandArgs??[]){if(!n.startsWith("--"))continue;let[o]=n.split("=",1);if(t.has(o))return!0}return!1}function Jt(e){return v(e.commandPath??"")==="create"&&Uo(e,Cu)}function qo(e){return e.some(t=>{let n=v(t);return n==="templates"||n.startsWith("templates ")})}function Bt(e,t){return e.some(n=>Do(n,t))||Jt(t)&&qo(e)}function Ho(e){return[L(e.hooks).length,(e.preflight_overrides??0)-L(e.preflight_ownership).length,L(e.item_types).length,L(e.item_fields).length,L(e.relationship_kinds).length,L(e.service_overrides).length,L(e.assurance_providers).length,L(e.renderer_overrides).length-L(e.renderer_ownership).length].some(n=>n>0)}function Go(e,t){let n=e.activation?.commands??[];if(n.length>0)return Bt(n,t);let o=Vt(e);if(Bt(o,t)||st(e).has("search")&&jo(t.commandPath))return!0;if(e.contributions)return Ho(e.contributions)}function Kt(e,t){let n=Go(e,t);if(n!==void 0)return n;let o=st(e);return!!(Fe(o,Ks)||Fe(o,Ys))}function ct(e,t){return e.effective.length===0?!1:lt(t)!=="all"?e.effective.some(o=>Kt(o,t)):e.effective.some(o=>{let i=st(o);return Vt(o).length>0||Fe(i,Ks)||Fe(i,Ys)||i.has("search")})}function lt(e){if(v(e.commandPath??"").split(" ")[0]==="completion")return"all";let t=De(e).filter(i=>i.split(" ").every(r=>!r.startsWith("-"))).sort((i,r)=>r.length-i.length)[0]??v(e.commandPath??"");if(t.length===0)return"all";let n=Jt(e)?"--template":"";return`${e.allowCommandPrefixMatch===!0?"prefix":"exact"}:${t}:${n}`}function zo(e){return lt(e)==="all"?void 0:t=>Kt(t,e)}function je(e){let t=$(e);if(t.requested&&t.commandPathTokens.length>0){let[i,...r]=t.commandPathTokens;return{commandPath:i,commandArgs:r,allowCommandPrefixMatch:!0}}let n=j(e),o=n.findIndex(i=>i.trim().length>0&&!i.startsWith("-"));return o<0?{}:{commandPath:n[o],commandArgs:n.slice(o+1),allowCommandPrefixMatch:t.requested}}function Wo(e){let t=e.args.map(String);if(v(A(e))==="create"){let o=e.optsWithGlobals();typeof o.template=="string"&&o.template.trim().length>0&&t.push("--template")}return t}var Yt=Symbol.for("pm.readOutputInvocationProvenance"),xu=new Map(ue.filter(e=>e.reservation_scope==="root_only").map(e=>[$t({long:e.flag}),e.flag]));function se(e,t){let n=Reflect.get(e,Yt);n!==void 0&&Reflect.set(t,Yt,n)}function Bo(e,t,n){let o=qi(t,n);if(!o)return;let i=e;for(;i.parent;)i=i.parent;let r=i.rawArgs,a=new Set(ee(r.slice(2))),s=Ui.find(d=>d.command===o),c=Object.values(s?.dimensions??{}).flatMap(d=>d.legacy_aliases.flatMap(m=>a.has(m.flag)?[m.flag]:[])),l=Reflect.get(n,Yt);Reflect.set(n,Yt,{canonical_include_modes:l?.canonical_include_modes??[],explicit_legacy_aliases:c,cli_invocation_observed:!0}),se(n,e)}function bu(e){let t=e.optsWithGlobals(),n=A(e);if(H(n)===n)return t;let o=e.opts();for(let i=e.parent;i?.parent;i=i.parent)for(let r of i.options){let a=r.attributeName(),s=i.getOptionValueSource(a)==="cli";if(s&&!e.options.some(c=>c.long===r.long))throw new I(`Unknown option '${r.long}' for ${n}`,g.USAGE,{code:"unknown_option",flag:r.long,required:`Use options declared by pm ${n} --help.`});if(s&&e.getOptionValueSource(a)!=="cli"){let c=i.getOptionValue(a);e.setOptionValueWithSource(a,c,"cli")}a in o?t[a]=o[a]:delete t[a]}return t}function Vo(e,t,n,o){Bo(e,t,o);let i=n.outputInclude;if(i===void 0)return;let{selectors:r,modes:a}=Vi(t,i,o);if(t==="get"&&typeof o.fields=="string"&&e.setOptionValueWithSource("fields",o.fields,"cli"),a.length===0)return;se(o,e);let s=Bi(t);for(let l of a){let d=s.get(l),m=o[d];e.setOptionValueWithSource(d,m,"cli")}let c=r.length>0?r.join(","):void 0;c===void 0?delete n.outputInclude:n.outputInclude=c;for(let l=e;l;l=l.parent)l.setOptionValueWithSource("outputInclude",c,"cli");Pt(e,n)}function Ue(e,t,n=[],o){let r={...bu(e)};se(e,r),delete r.json,delete r.quiet,delete r.path,delete r.pmPath,delete r.noExtensions,delete r.extensions,delete r.profile,delete r.pager,delete r.changedFields,delete r.fullChangedFields,delete r.idOnly,delete r.lean,delete r.tokenAccounting,delete r.outputInclude,delete r.outputLimit,delete r.outputBudget,delete r.outputFormat,delete r.outputSession,delete r.expectHash;let a=ia(t);for(let[s,c]of Object.entries(a))r[s]===void 0&&(r[s]=c);if(n.length>0){let s=Hn(n),c=G(A(e)).map(u=>({long:u.flag,short:u.short,aliases:u.aliases})),l={...a};for(let u of s)r[u]!==void 0&&(l[u]=r[u]);Gn(l,[...c,...n],A(e),o);let d=sa(a,nc(e),n),m=oa(r,n,d,A(e));return se(r,m),m}return r}function Qs(e,t,n){let o=Hn(t.map(({long:a})=>({long:a}))),i=[...xu].find(([a])=>e[a]!==void 0&&!o.has(a));if(i===void 0)return;let r=i[1];throw new I(`Unknown option '${r}' for extension command '${n}'. ${r} is a root-only pm flag and this command does not declare it.`,g.USAGE,{code:"unknown_option",flag:r,required:`Remove ${r}, or use it on the root command (pm --help ${r}).`,nextSteps:[`Run pm contracts --command ${n} --flags-only --json to list the flags this command accepts.`]})}function dt(e,t,n){let o=Qe(e,t),i=[t],r=[];for(let a of n){if(a.startsWith("-"))break;i.push(a);let s=Qe(e,i.join(" "));s.length>0&&(r=s)}return r.length>0?r:o}function Xt(e){return e.arguments??[]}function Xs(e){let t=Xt(e).map(n=>{let o=n.variadic?`${n.name}...`:n.name;return n.required?`<${o}>`:`[${o}]`}).join(" ");return`pm ${e.command}${t?` ${t}`:""}`}function Jo(e,t){if(!e)return!1;let n=v(t);return e.importers.some(o=>v(`${o.importer} import`)===n)||e.exporters.some(o=>v(`${o.exporter} export`)===n)}var ec=Symbol("pm.commandOptionTokens"),Zs=Symbol("pm.capturesOptionTokens");function tc(e){if(Reflect.get(e,Zs)===!0)return;Reflect.set(e,Zs,!0);let t=e.parseOptions.bind(e);e.parseOptions=n=>(Reflect.set(e,ec,[...n]),t(n))}function ku(e){let t=new Map;for(let n of e.options){let o={arity:n.required?"required":n.optional?"optional":"none",key:n.attributeName(),variadic:n.variadic};for(let i of[n.short,n.long])i&&t.set(i,o)}return t}function Su(e){let t=Reflect.get(e,"_passThroughOptions")===!0;return!t&&Reflect.get(e,"_enablePositionalOptions")!==!0?{}:{stop:{atSubcommand:n=>e.commands.some(o=>o.name()===n||o.aliases().includes(n)),atFirstUnrecognized:t}}}function nc(e){let t=[];for(let o=e;o?.parent;o=o.parent)t.unshift(o);let n=[];for(let o of t){let i=Reflect.get(o,ec);if(i===void 0)continue;let r=ku(o),a=[];for(let s=o;s;s=s.parent)a.push(s);n.push({tokens:i,optionOf:s=>r.get(s),includesLooseFlags:o===e,negativeNumbersAreValues:!a.some(s=>s.options.some(c=>c.short!==void 0&&/^-\d$/u.test(c.short))),...Su(o)})}return n}function oc(e,t,n){t.length!==0&&aa(nc(e),t,n)}function Ko(e,t){let n=Xt(e),o=n.filter(c=>c.required).length,r=n.some(c=>c.variadic)?Number.POSITIVE_INFINITY:n.length,a=e.failure_hints??[],s=a.length>0?` ${a.join(" ")}`:"";if(t.length<o)throw new I(`Missing required argument for extension command '${e.command}'. Usage: ${Xs(e)}${s}`,g.USAGE);if(t.length>r){let c=t.slice(r).join(" ");throw new I(`Too many arguments for extension command '${e.command}': ${c}. Usage: ${Xs(e)}${s}`,g.USAGE)}}function Eu(e){return`--${e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/_/g,"-").toLowerCase()}`}function Zt(e,t){return{definitions:e,inheritedFlags:Rt({readOutput:t}).map(n=>n.flag)}}function Au(e,t,n){let o=Object.keys(e).filter(r=>e[r]!==void 0).sort().map(Eu);if(o.length===0)return;let{inheritedFlags:i}=Zt([],n);throw new I(`Unknown option '${o.join(", ")}' for extension command '${t}'. This command declares no flags; it accepts only the host flags ${i.join(", ")}.`,g.USAGE,{code:"unknown_option",flag:o[0],required:`Remove ${o.join(", ")}, or ask the package to declare it with api.registerFlags.`,nextSteps:[`Run pm contracts --command ${t} --flags-only --json to list the flags this command accepts.`]})}function Ru(e,t,n){let o=e.read_output_declared===!0;if(n.length>0){Gn(t,n,e.command,Zt(n,o));return}Au(t,e.command,o)}function Yo(e,t,n,o){e&&(Ko(e,t),Ru(e,n,o))}import{Command as ic}from"commander";var Ou=new Set(["--version","-V"]);function mt(e){let t;try{t=pe(e).argv}catch{return!1}let n=Vr(t),o=S(n);return o===void 0?!1:["package","packages","extension"].includes(n[o])&&["inventory","list"].includes(Tt(n.slice(o+1))??"")}function rc(e){if(j(e)[0]!=="item"||!e.includes("--dry-run"))return;let n=new ic().configureOutput({writeErr:()=>{}}).exitOverride(),o=new Set;for(let r of ue)for(let a of[r.flag,r.short,...r.aliases??[]]){if(a===void 0||o.has(a))continue;o.add(a);let s=r.value_name!==void 0||r.flag==="--pm-path";n.option(`${a}${s?" <value>":""}`)}try{n.parseOptions(e)}catch{}let i=n.opts();return{path:i.pmPath??i.path}}var Tu=new Set(["config","extension","init","install","package","packages","templates","upgrade"]),Xo=new Set(["activity","aggregate","context","ctx","events","get","graph","history","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","search"]),ac=new Set(["append","close","close-many","comments","delete","deps","discover","docs","files","history-repair","history-redact","history-compact","learnings","notes","plan","restore","update","update-many","create"]),Iu=new Set(["claim","close-task","contracts","duplicates","gc","health","pause-task","release","start-task","stats","test","test-all","test-runs","test-runs-worker","validate"]),Pu=new Set(["claim","close-task","pause-task","release","start-task","test"]),xe={setup:!0,listQuery:!0,mutation:!0,operation:!0},$u=new Set(["create","update","update-many","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","search","calendar","context","templates"]);function ut(e){return e.some(t=>Ou.has(t))}function Nu(e,t){if(!M.some(o=>o.canonical_argv[0]===t))return;let n=new ic().configureOutput({writeErr:()=>{}}).exitOverride();for(let o of Te(t,G(t))){let i=o.takes_value?o.value_required?" <value>":" [value]":"";for(let r of[o.flag,o.short,...o.aliases??[]])r!==void 0&&n.option(`${r}${i}`)}try{let o=n.parseOptions(e.slice(1));if(o.unknown.length>0)return xe;let i=V([t,...o.operands])?.alias;if(M.some(r=>r.alias===i))return{...xe,targetCommandName:i}}catch{return xe}}function Zo(e){if(ut(e))return{setup:!1,listQuery:!1,mutation:!1,operation:!1};if(e.length===0||$(e).requested)return xe;let t=E(e);if(!t)return xe;let n=t.trim().toLowerCase(),o=j(e),i=V(o)?.alias;if(M.some(a=>a.alias===i))return{...xe,targetCommandName:i};let r=Nu(o,n==="ctx"?"context":n);return r||(Tu.has(n)?{setup:!0,listQuery:!1,mutation:!1,operation:!1,targetCommandName:n}:Xo.has(n)?{setup:!1,listQuery:!0,mutation:!1,operation:!1,targetCommandName:n}:ac.has(n)?{setup:!1,listQuery:!1,mutation:!0,operation:!1,targetCommandName:n}:Iu.has(n)?{setup:!1,listQuery:!1,mutation:!1,operation:!0,targetCommandName:n}:xe)}function Qo(e){return e.length===0||$(e).requested||e.includes("--explain")&&E(e)===void 0}function ei(e,t){return mt(t)||ut(t)?!1:ae(t)||$(t).requested?!0:!!E(t)}function ti(e){if(ut(e))return!1;let t=E(e);return t?$u.has(t):!1}function Lu(e){let t=String(e.rawFrom??""),n=t.indexOf("="),o=n>=0?t.slice(0,n):t,i=e.normalizedTokens.map(l=>{let d=l.indexOf("=");return d>=0?l.slice(0,d):l}).find(l=>l==="--literal"||l==="--regex"||l==="--replacement"),r=i?e.argv.map(l=>{let d=l.indexOf("=");return(d>=0?l.slice(0,d):l)===o?d>=0?`${i}${l.slice(d)}`:i:l}):e.argv,a=We(r),s=i&&n>=0?`${o}=[redacted]`:t,c=i&&e.normalizedDisplay.includes("=")?`${i}=[redacted]`:e.normalizedDisplay;return{argv:a,normalizedDisplay:c,sourceDisplay:s}}function ni(e){let t=e.commandName;if(!t)return;let n=e.trace.find(l=>l.reason==="flag_typo");if(!n)return;let o=Array.isArray(n.to)?n.to:[String(n.to??"")].filter(l=>l.length>0),i=o.length>0?o.join(" "):"the canonical flag",r=ac.has(t)||Pu.has(t),a=r?"mutating_flag_typo_requires_retry":"flag_typo_requires_retry",s=r?"mutating option":"option",c=Lu({argv:e.argv,normalizedDisplay:i,normalizedTokens:o,rawFrom:n.from});throw new I(`Refusing to auto-correct ${s} ${c.sourceDisplay} to ${c.normalizedDisplay}. Retry with the canonical flag so the command is explicit.`,g.USAGE,{code:a,examples:[_(c.argv)],nextSteps:["Retry the command with the canonical flag shown in examples."],recovery:{normalized_args:c.argv,suggested_retry:_(c.argv)}})}var Mu=new Set(["success","nonexistent_command","invalid_option","missing_required_option","missing_required_argument","invalid_usage","validation_failed","health_findings","validation_findings","conflict","runtime_failed","unknown_failed"]),Fu=new Set(["parse","preflight","execute","unknown"]),Du=new Set(["usage","validation","conflict","runtime","unknown"]);function be(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="string"){let i=o.trim();if(i.length>0)return i}}}function oi(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="boolean")return o}}function Qt(e,...t){if(e)for(let n of t){let o=e[n];if(typeof o=="number"&&Number.isFinite(o))return Math.max(0,Math.trunc(o))}}function ii(e){if(!e)return;let t=e.trim().toLowerCase();if(Mu.has(t))return t}function ri(e){if(!e)return;let t=e.trim().toLowerCase();if(Fu.has(t))return t}function ai(e){if(!e)return;let t=e.trim().toLowerCase();if(Du.has(t))return t}function si(e){let t=be(e,"error","message");if(t)return t;let n=e?.warnings;if(Array.isArray(n)){let a=n.find(s=>typeof s=="string"&&s.trim().length>0);if(typeof a=="string")return a.trim()}if(oi(e,"fail_on_skipped_triggered","failOnSkippedTriggered"))return"linked_test_fail_on_skipped_triggered";let i=Qt(e,"failed");if(typeof i=="number"&&i>0)return`failed_runs:${i}`;let r=e?.run_results;if(Array.isArray(r)){let a=r.filter(s=>gn(s)?.status==="failed").length;if(a>0)return`failed_runs:${a}`}}function ci(e,t){if(!e)return t===g.USAGE?"invalid_command_usage":t===g.NOT_FOUND?"item_not_found":t===g.CONFLICT?"lock_conflict":t===g.DEPENDENCY_FAILED?"dependency_failed":"command_failed"}function li(){let e=gn(de()),t=typeof process.exitCode=="number"&&Number.isFinite(process.exitCode)?Math.max(0,Math.trunc(process.exitCode)):void 0,n=Qt(e,"exit_code","exitCode"),o=t??n??g.SUCCESS,i=ma(o),r=be(e,"error_code","errorCode")??ci(i,o),a=ai(be(e,"error_category","errorCategory"))??(i?void 0:ht(r)),s=i?void 0:si(e)??`command_exit_${o}`,c=ii(be(e,"command_resolution","commandResolution"))??St({ok:i,errorCode:r,errorCategory:a}),l=ri(be(e,"resolution_stage","resolutionStage"))??"execute";return{ok:i,error:s,exit_code:o,error_code:r,error_category:a,command_resolution:c,resolution_stage:l}}var di="PM_CLI_PACKAGE_ROOT",hc=Symbol("pm.deprecatedAliasInvocation"),nn=new Map;for(let e of K){let t=e.alias.split(" ")[0],n=nn.get(t)??[];n.push(e),nn.set(t,n)}for(let e of nn.values())e.sort((t,n)=>n.alias.split(" ").length-t.alias.split(" ").length);function ju(){return tr(import.meta.url,["../.."])}(typeof process.env[di]!="string"||process.env[di]?.trim().length===0)&&(process.env[di]=ju());var Se=null,q=null,on=null;function Uu(e){Se=e}function qu(e){T=e}var pt=null,ke=null,T=new Map,yi=250,Hu=new Set([g.USAGE,g.NOT_FOUND,g.CONFLICT]),Gu=new Set(["1","true","yes","on"]),zu=Ye(()=>import("./chunks/register-setup-VSURGF7V.js")),Wu=Ye(()=>import("./chunks/register-list-query-Q7UW2EPV.js")),Bu=Ye(()=>import("./chunks/register-mutation-YNW7E3T4.js")),Vu=Ye(()=>import("./chunks/register-operations-DAUTQCIO.js"));function tn(e){return _(e)}function yc(e){let t=e.match(/--[a-zA-Z0-9][a-zA-Z0-9_-]*/g);if(!t||t.length===0)return;let n=[...new Set(t.map(o=>ge(o)??o))];return n.length>0?n:void 0}function Ju(e,t,n,o){if(n?.suggested_retry||o===no||o===to||e.includes("failed in extension handler (")||!/\b(?:missing|required|requires)\b/i.test(e))return;let i=ee(t),r=new Set(i.map(m=>ge(m)??m)),a=yc(e),s=t.find(m=>w.commands.some(u=>u.name()===m)),c=s?w.commands.find(m=>m.name()===s):void 0,l=new Set([...w.options,...c?.options??[]].flatMap(m=>m.flags.split(/[ ,|]+/).map(u=>ge(u)).filter(u=>u!==void 0))),d=a?.filter(m=>{let u=ge(m)??m;return r.has(u)?!1:l.has(u)||So(t,s,u,T)!==void 0});return d&&d.length>0?d:void 0}function Ku(e,t,n,o){if(o?.suggested_retry)return o.suggested_retry;let i=n?.[0],r=i?ge(i):void 0,a=e.find(u=>w.commands.some(p=>p.name()===u)),s=a?w.commands.find(u=>u.name()===a):void 0,c=r?s?.options.find(u=>u.flags.split(/[ ,|]+/).includes(r)):void 0,l=So(e,a,r,T),d=r?c?.isBoolean()===!0||l===!1?[r]:[r,"<value>"]:[],m=r?tn([...e,...d]):t;return m===t?void 0:m}function Yu(e){if(!e)return{};let t=["recovery_mode","missing_required_fields","suggested_flags","suggested_retry_args","allowed_values","candidate_commands","candidate_commands_total","candidate_commands_truncated","fallback_candidates","next_best_command"],n={};for(let o of t){let i=e[o];i!==void 0&&(o==="allowed_values"||i!==null)&&(n[o]=i)}return n}function Xu(e){let t=e.existingRecovery;return{attempted_command:t?.attempted_command??e.attemptedCommand,normalized_args:t?.normalized_args??[...e.invocationArgv],provided_fields:t?.provided_fields??(e.providedFields.length>0?e.providedFields:void 0),missing:t?.missing??e.inferredMissing,...Yu(t),...e.suggestedRetry?{suggested_retry:e.suggestedRetry}:{}}}function sc(e,t){return{...e,recovery:t}}function Zu(e,t){if(t===void 0)return;let n=Fa(e,t.code,t.field,$a(e,t.code,t.recovery)),o=Qu(e),i=Da(e,t.code,t.field,n,o),r=La(e,t.code,i,o,()=>Ur(P(process.cwd(),N(e).path)));return ja(e,t.code,r,o)}var cc=" ";function Qu(e){let t=e.map(i=>i===""?cc:/^--(?:pm-)?path=$/u.test(i)?`${i}${cc}`:i),n=N(t).path;if(n!==void 0&&n.trim()!=="")return[];let o=Ee({});return n!==void 0&&o.length>0?null:o}function _c(e,t,n){let o=We(t),i=j(o),r=S(i),[a,s]=r===void 0?[]:i.slice(r,r+2),c=o.includes("--explain");e=e===void 0?void 0:xr(e);let l=Zu(o,e),d=l&&(a==="history-redact"||a==="history"&&s==="redact")?{...l,...l.attempted_command?{attempted_command:tn(o)}:{},...l.normalized_args?{normalized_args:[...o]}:{},...l.suggested_retry?{suggested_retry:tn(o)}:{},...l.suggested_retry_args?{suggested_retry_args:[...o]}:{}}:l;if(d?.recovery_mode==="compact"&&!c)return sc(e,d);let m=tn(o),u=ee(o),p=Ju(n,o,d,e?.code),f=Ku(o,m,p,d),y=Xu({invocationArgv:o,attemptedCommand:m,providedFields:u,inferredMissing:p,suggestedRetry:f,existingRecovery:d});return sc(e,y)}async function ft(e){let t=q;q=null,await Ua(t,e);let n=Se;if(Se=null,!n){Ct();return}let o=[],i=fr();try{await qa({pmRoot:n.pmRoot,author:n.globalOptions.author,itemIds:e.ok?i?.map(r=>r.id)??[]:[],intent:n.commandName})}catch{o.push("context_usage_feedback_write_failed")}try{o.push(...await rr(n.hooks,{command:n.commandName,args:n.commandArgs,options:{...n.commandOptions},global:{...n.globalOptions},pm_root:n.pmRoot,ok:e.ok,error:e.error,result:de(),affected:i}))}catch(r){o=[`afterCommand hooks failed: ${r instanceof Error?r.message:String(r)}`]}finally{Ct()}!n.globalOptions.json&&o.length>0&&x(`[pm] warning: afterCommand hook_warnings=${W(o)}`),n.profileEnabled&&o.length>0&&x(`profile:extensions hook_warnings=${W(o)}`)}async function wc(e,t){await Er();let n=q,o=Se,i=n?.command??o?.commandName??e,r=n??An(o?.globalOptions??t),a=T.get(v(i))?.source;$n(i,o?.commandArgs??[],{...o?.commandOptions,...o?.globalOptions},{source_context:r.source_context,source_context_source:r.source_context_source,pm_version:n?.pm_version??He,extension:a})}function vc(e){return Gu.has((process.env[e]??"").trim().toLowerCase())}function Cc(e){return vc("PM_SENTRY_CAPTURE_EXPECTED_ERRORS")?!0:!Hu.has(Math.trunc(e))}async function rn(e,t){return Cc(e.exit_code)?(await wc(e.command,t),Ir({...e,source_context:e.source_context??An(t).source_context}),!0):!1}async function xc(e){let t=J(me(e.error)),n=gs(t);e.bootstrapGlobal.json?x(JSON.stringify(et(ps(t,g.GENERIC_FAILURE)),null,2)):x(t),process.exitCode=g.GENERIC_FAILURE;let o="runtime",i="runtime_failed";try{await wc(e.attemptedCommand,e.bootstrapGlobal),Nn(e.error);let r=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:n.code,errorMessage:n.detail,exitCode:g.GENERIC_FAILURE,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"});o=r.errorCategory,i=r.commandResolution,await cn(!1,t,{error_code:n.code,error_category:o,exit_code:g.GENERIC_FAILURE,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||x(`Failed to report error: ${me(r)}`)}try{await ft({ok:!1,error:t,exit_code:g.GENERIC_FAILURE,error_code:n.code,error_category:o,command_resolution:i,resolution_stage:"execute"})}catch(r){e.bootstrapGlobal.json||x(`Failed to run error hooks: ${me(r)}`)}try{await Oe()}catch(r){e.bootstrapGlobal.json||x(`Failed to flush error reporting: ${me(r)}`)}}var ep={create:"create",update:"update","update-many":"update_many",list:"list","list-all":"list","list-draft":"list","list-open":"list","list-in-progress":"list","list-blocked":"list","list-closed":"list","list-canceled":"list",search:"search",calendar:"calendar",context:"context","templates save":"create"},mi=new Map;function ui(e){return e==="number"?"number":e==="boolean"?"boolean":"string"}function bc(e,t){return e.options.some(n=>n.long===t)}function kc(e,t){return e.options.some(n=>n.short===t)}function pi(e,t,n,o){let i=t.trim();if(!i||!Li(i))return;let r=n.length>0?n:`Runtime schema field (${t})`;if(i.startsWith("-")&&!i.startsWith("--")){if(kc(e,i))return;if(o){e.option(`${i} <value>`,`${r} (repeatable)`,qn);return}e.option(`${i} <value>`,r);return}let a=i.startsWith("--")?i:`--${i}`;if(!bc(e,a)){if(o){e.option(`${a} <value>`,`${r} (repeatable)`,qn);return}e.option(`${a} <value>`,r)}}async function Sc(e,t){let n=ep[e];if(!n)return[];let o=`${t}:${n}`,i=mi.get(o);if(i)return i;if(!await Y(X(t)))return mi.set(o,[]),[];let r=await F(t),s=(yn(r.schema).command_to_fields.get(n)??[]).flatMap(c=>[c.cli_flag,...c.cli_aliases].map(d=>({long:`--${d}`,type:ui(c.type),value_type:ui(c.type)})));return mi.set(o,s),s}async function Ec(e,t){let n=N(t),o=P(process.cwd(),n.path);if(!await Y(X(o)))return;let i=ke?.key===vi(o)?ke.snapshot:null,r=i===null?await F(o):i.settings,a=yn(r.schema),s=[{path:"create",command:"create"},{path:"update",command:"update"},{path:"update-many",command:"update_many"},{path:"list",command:"list"},{path:"list-all",command:"list"},{path:"list-draft",command:"list"},{path:"list-open",command:"list"},{path:"list-in-progress",command:"list"},{path:"list-blocked",command:"list"},{path:"list-closed",command:"list"},{path:"list-canceled",command:"list"},{path:"search",command:"search"},{path:"calendar",command:"calendar"},{path:"context",command:"context"},{path:"templates save",command:"create"}];for(let c of s){let l=oe(e,c.path.split(" "));if(l)for(let d of a.command_to_fields.get(c.command)??[]){let m=d.description??"";pi(l,d.cli_flag,m,d.repeatable);for(let u of d.cli_aliases)pi(l,u,`Alias for --${d.cli_flag}`,d.repeatable)}}}async function _i(e,t,n,o,i){let r=E(n);if(!(r!=="create"&&r!=="update"))try{let a=i??await F(t),s=ce(a,o);Gs(e,s,n)}catch{}}function fi(){return{enforce_item_format_gate:!0,run_preflight_item_format_sync:!0,run_extension_migrations:!0,enforce_mandatory_migration_gate:!0}}function Ac(e,t="all"){return t==="all"?`pm-root:${e}`:`pm-root:${e}:activation:${t}`}function wi(e){return e.some(t=>t==="--profile")}function vi(e){return`pm-root:${e}`}function gi(e){for(let t of e)t.startsWith("settings_read_")&&fe(t,`[pm] warning: ${t} \u2014 settings.json could not be loaded and pm fell back to defaults; run pm health for remediation.`)}function Rc(e,t){e.profile&&(x(`profile:extensions loaded=${t.loadedCount} failed=${t.loadFailedCount} warnings=${t.loadWarnings.length} activation_failed=${t.activationFailedCount} hook_counts=before:${t.hooks.beforeCommand.length}|after:${t.hooks.afterCommand.length}|write:${t.hooks.onWrite.length}|read:${t.hooks.onRead.length}|index:${t.hooks.onIndex.length} command_overrides=${t.commands.overrides.length} command_handlers=${t.commands.handlers.length} parser_overrides=${t.parsers.overrides.length} preflight_overrides=${t.preflight.overrides.length} service_overrides=${t.services.overrides.length} renderer_overrides=${t.renderers.overrides.length}`),t.activationWarnings.length>0&&x(`profile:extensions activation_warnings=${W(t.activationWarnings)}`))}function an(e,t,n){if(!e)return;let o=v(n.commandPath??"")||"<none>";x(`profile:extensions activation=skipped command=${o} effective=${t.discovery.effective.length} warnings=${t.discovery.warnings.length} discovery_ms=${t.discoveryMs}`)}async function sn(e,t=Re){let n=vi(e);if(ke?.key===n)return ke.snapshot;try{let o=Date.now(),{settings:i,warnings:r}=await t(e),a=await ar({pmRoot:e,settings:i,cwd:process.cwd(),noExtensions:!1}),s={pmRoot:e,settings:i,discovery:a,discoveryMs:Date.now()-o,settingsReadWarnings:[...r]};return ke={key:n,snapshot:s},s}catch{return ke={key:n,snapshot:null},null}}async function Ge(e,t,n=F){let o=t?lt(t):"all",i=Ac(e,o);if(pt?.key===i)return pt.snapshot;try{let r=await n(e),a=await Je({pmRoot:e,settings:r,cwd:process.cwd(),noExtensions:!1,extensionFilter:t?zo(t):void 0}),s=await Ke({...a,loaded:a.loaded}),c=[...new Set(s.commands.handlers.map(p=>v(p.command)))].filter(p=>p.length>0).sort((p,f)=>p.localeCompare(f)),l=Es(s.registrations.flags),d=ks(s.commands.handlers,s.registrations.commands),m=Rs(c,s.registrations.commands,s.registrations.flags,d),u={hooks:s.hooks,commands:s.commands,parsers:s.parsers,preflight:s.preflight,services:s.services,renderers:s.renderers,registrations:s.registrations,pmRoot:e,settings:r,commandHandlers:c,commandFlagHelp:l,commandDescriptors:m,commandAliases:d,loadWarnings:[...a.warnings],activationWarnings:[...s.warnings],loadedCount:a.loaded.length,loadFailedCount:a.failed.length,activationFailedCount:s.failed.length,contextIntentPackages:a.loaded.map(({name:p,module:f})=>({name:p,module:f}))};return pt={key:i,snapshot:u},u}catch{return pt={key:i,snapshot:null},null}}async function Oc(e){let t=Ze(e);if(t.noExtensions){let a=P(process.cwd(),t.path);return await Y(X(a))&&gi((await Re(a)).warnings),null}let n=P(process.cwd(),t.path),o=await sn(n);if(!o)return null;gi(o.settingsReadWarnings);let i={commandPath:A(e),commandArgs:Wo(e)};if(!ct(o.discovery,i))return an(t.profile,o,i),null;let r=await Ge(n,i);return r?(Rc(t,r),{hooks:r.hooks,commands:r.commands,parsers:r.parsers,preflight:r.preflight,services:r.services,renderers:r.renderers,registrations:r.registrations,pmRoot:n}):null}async function Ci(e){let t=await Ge(e);return t?new Map(t.commandDescriptors):T}async function tp(e,t){return!e.requested||t.noExtensions||Le(w,e.commandPathTokens)?T:Ci(P(process.cwd(),t.path))}async function Tc(e,t){return(await Wr({pmRoot:t,migrations:e,author:"pm-extension-migration"})).migrations.filter(o=>o.outcome==="failed").map(o=>`extension_migration_failed:${o.layer}:${o.extension}:${o.id}`)}function Ic(e,t,n){let o=t.author;return zr(e,ga.forActiveExtensionHost({pmRoot:e,author:o}),o,v(n))}async function Pc(e,t,n,o=[]){let i=A(e),r=zn(e.args.map(String),o),a={...t};delete a.author;let s={...n},c=P(process.cwd(),n.path),l={args:[...r],path:n.path},d=await xt({command:i,args:r,options:a,global:s,pm_root:c});n.profile&&d.warnings.length>0&&x(`profile:extensions parser_warnings=${W(d.warnings)}`),r=d.context.args,a=d.context.options,s=d.context.global,Xn(l,{args:r,path:s.path},a),Yo(T.get(v(i)),r,a,o),Ae(void 0),vt({command:i,args:r,options:{...a},global:{...s},pm_root:c});let m=await En({command:i,args:r,options:a,global:s,pm_root:c,sdk:Ic(c,s,i)});if(s.profile&&m.warnings.length>0&&x(`profile:extensions command_handler_warnings=${W(m.warnings)}`),!m.handled)throw m.warnings.length>0?Ar(i,m):new I(`Command "${i}" is provided by extensions and is not currently available.`,g.NOT_FOUND);return m.exitCode!==void 0&&(process.exitCode=m.exitCode),Ae(m.result),m.result}var lc=Symbol("pm.wrappedActionHandler");function np(e,t){let n=e[e.length-1];return n instanceof hi?n:t}function dc(e,t,n){e&&n.length>0&&x(`profile:extensions ${t}=${W(n)}`)}function op(e){let t=T.get(v(e.commandPath));if(!t||!Jo(e.activeRegistrations,e.commandPath))return;let n=Xt(t).length===0?ra(e.commandArgs):zn(e.commandArgs,e.extensionFlagDefinitions);Ko(t,n)}function ip(e,t,n){e.args=[...n],"_processArguments"in e&&typeof e._processArguments=="function"&&e._processArguments(),t.length>0&&Array.isArray(t[0])&&(t[0]=[...e.processedArgs])}function xi(e,t,n){if(!at(e))return;let o=T.get(v(t))?.read_output_declared===!0;return Zt(n,o)}function $c(e){let t=n=>{let o=n;if(tc(n),typeof o._actionHandler=="function"&&o[lc]!==!0){let i=o._actionHandler;o._actionHandler=async function(...a){let s=np(a,n),c=Date.now();Un(s);let l=Ze(s),d=H(A(s));if(["package inventory","packages inventory","extension inventory"].includes(d))return Ta(d,l.expectHash),await i.apply(this,a);let m=P(process.cwd(),l.path),u=s.args.map(String),p=le(),f=p?dt(p,d,u):[],y=await Sc(d,m),h=xi(s,d,f),C=Ue(s,u,[...f,...y],h);oc(s,f,d),T.has(v(d))&&delete C.author,h!==void 0&&Qs(C,f,d);let R={args:[...u],path:l.path},O=await xt({command:d,args:u,options:C,global:l,pm_root:m});dc(l.profile,"parser_warnings",O.warnings),u=O.context.args,C=O.context.options,se(s,C),l=O.context.global,Xn(R,{args:u,path:l.path},C),op({activeRegistrations:p,commandPath:d,commandArgs:u,extensionFlagDefinitions:f}),l=await ta(l),Pt(s,l),ip(s,a,u),It(s,C),Ae(void 0),vt({command:d,args:u,options:{...C},global:{...l},pm_root:m});let k=await En({command:d,args:u,options:C,global:l,pm_root:m,sdk:Ic(m,l,d)});if(dc(l.profile,"command_handler_warnings",k.warnings),k.handled){Ae(k.result),kn(k.result,{...l,command:d,commandArgs:u,commandOptions:C,pmRoot:m}),l.profile&&x(`profile:command=${d} took_ms=${Date.now()-c}`);return}return await i.apply(this,a)},o[lc]=!0}for(let i of n.commands)t(i)};t(e)}async function en(e){T=new Map,re({overrides:[]}),e&&await _i(e.rootProgram,e.pmRoot,e.invocationArgv,or(),e.settings)}function rp(e,t,n,o){if(t?.flags&&t.flags.length>0){Ro(e,t.flags);let i=Oo(e,t.flags);i&&e.addHelpText("after",i)}else n&&e.addHelpText("after",n);t&&at(e)&&e.addHelpText("after",Io(t)),o&&e.addHelpText("after",o)}function ap(e,t,n,o){t&&e.addHelpText("after",t),n&&e.addHelpText("after",Io(n)),o&&e.addHelpText("after",o)}function Nc(e,t,n){let o={core:0,standard:1,full:2,internal:3},i=(r,a)=>{let s=a.join(" "),c=[...n.entries()].filter(([d])=>d===s||d.startsWith(`${s} `)).map(([,d])=>d),l=c.length===0?"standard":c.reduce((d,m)=>o[m.tier]<o[d]?m.tier:d,"internal");Ft(r,l);for(let d of r.commands)i(d,[...a,d.name()])};for(let r of e.commands)t.has(r.name())||i(r,[r.name()])}async function Lc(e,t){let n=N(t),o=P(process.cwd(),n.path);if(n.noExtensions){await en({rootProgram:e,pmRoot:o,invocationArgv:t});return}let i=await sn(o),r=je(t);if(!i){await en();return}if(!ct(i.discovery,r)){await en({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings}),an(wi(t),i,r);return}let a=await Ge(o,r);if(!a){await en({rootProgram:e,pmRoot:o,invocationArgv:t,settings:i.settings});return}re(a.services),T=new Map(a.commandDescriptors),await _i(e,o,t,a.registrations,a.settings);let s=Ls(e,a.commandHandlers,a.commandDescriptors,a.commandAliases,d=>Ms(a.activationWarnings,x,d)),c=new Set(e.commands.map(d=>d.name())),l=d=>{let m=d.split(" ").filter(R=>R.length>0),u=a.commandDescriptors.get(d),p=oe(e,m),f=a.commandFlagHelp.get(d),y=u?$s(u):null;if(p){rp(p,u,f,y);return}let h=Ns(e,m);u?.description&&h.description(u.description);let C=f;u&&(Os(h,u),u.flags.length>0&&(Ro(h,u.flags),C=Oo(h,u.flags)??void 0)),ap(h,C,u,y),h.allowUnknownOption(!0).allowExcessArguments(!0).action(async(...R)=>{let O=R[R.length-1],k=O instanceof hi?O:h,gt=Ze(k),Vc=Date.now(),ln=dt(a.registrations,d,k.args.map(String)),Si=Ue(k,k.args.map(String),ln,xi(k,d,ln)),Ei=await Pc(k,Si,gt,ln);await na(gt,Ei),kn(Ei,{...gt,command:d,commandArgs:k.args.map(String),commandOptions:Si,pmRoot:o}),gt.profile&&x(`profile:command=${d} took_ms=${Date.now()-Vc}`)})};for(let d of s)l(d);Nc(e,c,a.commandDescriptors)}var He=nr(import.meta.url,["../.."])??"0.0.0",w=jn(He);async function mc(e){if(!q)return;let t=Reflect.get(e,hc);typeof t=="string"&&await fa(t)}async function uc(e,t,n){let o=A(e);return["item mutate","item complete"].includes(o)&&e.optsWithGlobals().dryRun===!0?t:n()}async function pc(e,t,n){!q||!await Rn(!0)||($n(e,t,n,{source_context:q.source_context,source_context_source:q.source_context_source}),Rr(e),on=q)}async function cn(e,t,n){let o=on;if(!o)return;on=null;let i=!1;try{let r=await F(o.global_pm_root);i=r.telemetry.enabled&&r.telemetry.installation_id===o.installation_id}catch{}await Rn(i)?Tr(e,t,n):Or()}async function sp(e){let t=await Oc(e);return Sn(t?.registrations??null),t}function Mc(e,t){t&&mt(t)||(e.hook("preAction",async(n,o)=>{Se=null,q=null,on=null,Ct(),Un(o);let i=o.optsWithGlobals(),r=Ze(o),a=H(A(o)),s=o.args.map(String),c={args:[...s],path:r.path},l=Ue(o,s),d={...r},m=P(process.cwd(),r.path),u=await sp(o);if(Wi(a,{...l,...zi(a,o.processedArgs),outputInclude:i.outputInclude,outputLimit:i.outputLimit,outputBudget:i.outputBudget,outputFormat:i.outputFormat,outputSession:i.outputSession,outputCursor:i.outputCursor}),Vo(o,a,d,l),await uc(o,void 0,()=>Lr(a,d)),!u){Se=sr({commandName:a,commandArgs:s,commandOptions:l,globalOptions:d,pmRoot:m}),q=await Ln({command:a,pm_version:He,args:s,options:l,global:d,pm_root:m}),await mc(e),await pc(a,s,l),await Mo(a,l,m,fi()),await Lo(a,s,l,d,m),await Yn({command:o,commandPath:a,commandArgs:s,commandOptions:l,expectHash:r.expectHash,pmRoot:m,globalOptions:d});return}cr(u.hooks),lr(u.commands),dr(u.parsers),mr(u.preflight),re(u.services),ur(u.renderers),Sn(u.registrations);let p=dt(u.registrations,a,s);l=Ue(o,s,p,xi(o,a,p)),Vo(o,a,d,l);let f=await xt({command:a,args:s,options:l,global:d,pm_root:u.pmRoot});d.profile&&f.warnings.length>0&&x(`profile:extensions parser_warnings=${W(f.warnings)}`),s=f.context.args,l=f.context.options,se(o,l),d=f.context.global;let y={args:[...s],path:d.path};It(o,l);let h=await gr({command:a,args:s,options:l,global:d,pm_root:u.pmRoot,decision:fi()});d.profile&&h.warnings.length>0&&x(`profile:extensions preflight_warnings=${W(h.warnings)}`),s=h.context.args,l=h.context.options,se(o,l),d=h.context.global,It(o,l);let C=h.decision;await Mo(a,l,u.pmRoot,C),await Lo(a,s,l,d,u.pmRoot),await Yn({command:o,commandPath:a,commandArgs:c.args,commandOptions:l,expectHash:r.expectHash,pmRoot:u.pmRoot,rewritten:Kn(c,[y,{args:s,path:d.path}]),globalOptions:{...d,path:r.path,noExtensions:r.noExtensions}});let R=C.run_extension_migrations?await uc(o,[],()=>Tc(u.registrations.migrations,u.pmRoot)):[];d.profile&&R.length>0&&x(`profile:extensions migration_warnings=${W(R)}`);let O=Bs(u.registrations.migrations);Se={hooks:u.hooks,commandName:a,commandArgs:s,commandOptions:{...l},globalOptions:{...d},pmRoot:u.pmRoot,profileEnabled:!!d.profile,migrationBlockers:O},Ae(void 0),vt({command:a,args:s,options:{...l},global:{...d},pm_root:u.pmRoot}),q=await Ln({command:a,pm_version:He,args:s,options:l,global:d,pm_root:u.pmRoot}),await mc(e),await pc(a,s,l);let k=await ir(u.hooks,{command:a,args:s,options:{...l},global:{...d},pm_root:u.pmRoot});d.profile&&k.length>0&&x(`profile:extensions hook_warnings=${W(k)}`),C.enforce_mandatory_migration_gate&&Vs(a,l,O)}),e.hook("postAction",async()=>{let n=li();await cn(n.ok,n.error,{error_code:n.error_code,error_category:n.error_category,exit_code:n.exit_code,command_resolution:n.command_resolution,resolution_stage:n.resolution_stage}),await ft(n),await Oe()}))}Mc(w);var fc=Symbol("pmCliIdempotentTopLevelRegistration");function Fc(e){let t=e;if(t[fc])return;t[fc]=!0;let n=e.command.bind(e);e.command=((o,...i)=>{let r=o.split(/\s+/u)[0];return e.commands.some(a=>a.name()===r||a.aliases().includes(r))?new hi(r):n(o,...i)})}async function cp(e,t){if(Fc(e),t.setup){let{registerSetupCommands:n}=await zu();n(e)}if(t.listQuery){let{registerListQueryCommands:n}=await Wu(),o=typeof t.targetCommandName=="string"&&Xo.has(t.targetCommandName)?new Set([t.targetCommandName]):void 0;n(e,o?{commandFilter:o}:void 0)}if(t.mutation){let{registerMutationCommands:n}=await Bu();n(e,{targetCommandName:t.targetCommandName})}if(t.operation){let{registerOperationCommands:n}=await Vu();n(e)}}function qe(e){return e.rawInvocationArgv??e.invocationArgv}function lp(e){return async t=>{let n=ht(t.errorCode),o=St({ok:!1,errorCode:t.errorCode,errorCategory:n});return await Fr({command:t.command,args:e.invocationArgv,options:t.options,global:e.bootstrapGlobal,pm_version:He,pm_root:e.bootstrapPmRoot,error_code:t.errorCode,error_message:t.errorMessage,exit_code:t.exitCode,error_category:n,command_resolution:o,resolution_stage:t.resolutionStage}),{errorCategory:n,commandResolution:o}}}async function Dc(e){if(e.bootstrapGlobal.noExtensions||mt(e.invocationArgv))return;let t=je(e.invocationArgv),n=await sn(e.bootstrapPmRoot);if(n&&ct(n.discovery,t)){let o=await Ge(e.bootstrapPmRoot,t);jc(o);return}n&&an(wi(e.invocationArgv),n,t),re({overrides:[]})}function jc(e){if(!e){re({overrides:[]});return}re(e.services)}async function bi(e){await cn(!1,e.errorMessage,{error_code:e.classificationCode,error_category:e.errorCategory,exit_code:e.exitCode,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage}),await ft({ok:!1,error:e.errorMessage,exit_code:e.exitCode,error_code:e.classificationCode,error_category:e.errorCategory,command_resolution:e.commandResolution,resolution_stage:e.resolutionStage})}async function Uc(){await cn(!0,void 0,{exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),await ft({ok:!0,exit_code:g.SUCCESS,command_resolution:"success",resolution_stage:"parse"}),process.exitCode=g.SUCCESS}async function qc(e,t){let n=typeof t=="number"&&Number.isFinite(t);if(!(e.error instanceof I)&&(In(e.error)||!n))return!1;let o=J(me(e.error)),i=e.error instanceof I?e.error.exitCode:Tn(t),r=e.error instanceof I||Sr(e.error)?e.error.context:void 0,a=_c(r,e.invocationArgv,o),s=ms(o,a),c=et(e.bootstrapGlobal.lean?jt(yo(o,i,a)):yo(o,i,a)),l=e.jsonErrors?JSON.stringify(e.bootstrapGlobal.tokenAccounting?Z(c,p=>`${JSON.stringify(p,null,2)}
40
40
  `):c,null,2):ls(o,a,{lean:e.bootstrapGlobal.lean===!0});e.jsonErrors?ie(`${l}
41
41
  `):x(l);let{errorCategory:d,commandResolution:m}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:s.code,errorMessage:s.detail,exitCode:i,options:{bootstrap_global_options:e.bootstrapGlobal},resolutionStage:"execute"}),u=await rn({command:e.attemptedCommand,error_code:s.code,error_category:d,exit_code:i,error_message:s.detail,command_resolution:m,resolution_stage:"execute",source_context:q?.source_context},e.bootstrapGlobal);return await bi({errorMessage:o,exitCode:i,classificationCode:s.code,errorCategory:d,commandResolution:m,resolutionStage:"execute"}),u&&(Nn(Pn(e.error,o)),await Oe(yi)),process.exitCode=i,!0}async function Hc(e,t){let n=$(e.invocationArgv).commandPathTokens.join(" ")||vo(e.invocationArgv),o=H(n),i=`unknown command '${n}'`,r=P(process.cwd(),e.bootstrapGlobal.path),a=e.bootstrapGlobal.noExtensions?T:await Ci(r),s=je(e.invocationArgv),c=e.bootstrapGlobal.noExtensions?[]:await $o(r,{},De(s)),l=await it({message:i},w,a,{failedExtensions:c},qe(e)),d=_o(l.message,l.commandName,l.allowedTypes,{unknownCommandExamples:l.unknownCommandExamples,unknownCommandNextSteps:l.unknownCommandNextSteps,attemptedCommand:l.attemptedCommand,normalizedInvocationArgs:l.normalizedInvocationArgs,providedOptionFlags:l.providedOptionFlags,unknownOptionSuggestions:l.unknownOptionSuggestions,suggestedRetryCommand:l.suggestedRetryCommand,failedExtensions:c}),{errorCategory:m,commandResolution:u}=await e.emitTelemetryCommandError({command:o,errorCode:d.code,errorMessage:d.detail,exitCode:g.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t??"commander.helpDisplayed"},resolutionStage:"parse"}),p=await rn({command:o,error_code:d.code,error_category:m,exit_code:g.USAGE,error_message:d.detail,command_resolution:u,resolution_stage:"parse"},e.bootstrapGlobal),f=e.jsonErrors?await ko({message:i},w,a,e.bootstrapGlobal.lean===!0,{failedExtensions:c},qe(e)):await bo({message:i},w,a,{failedExtensions:c},qe(e)),y=wo(f,e.jsonErrors,c);await bi({errorMessage:i,exitCode:g.USAGE,classificationCode:d.code,errorCategory:m,commandResolution:u,resolutionStage:"parse"}),e.jsonErrors?ie(`${Vn(y)}
42
42
  `):x(y),p&&await Oe(yi),process.exitCode=g.USAGE}async function Gc(e,t,n){if(!(t==="commander.helpDisplayed"||t==="commander.help"||t==="commander.helpCommand")&&!n.includes("(outputHelp)"))return!1;let i=$(e.invocationArgv);return i.requested&&!Le(w,i.commandPathTokens)?(await Hc(e,t),!0):(await Uc(),!0)}async function zc(e,t){let n=await it(e.error,w,T,{},qe(e)),o=_o(n.message,n.commandName,n.allowedTypes,{unknownCommandExamples:n.unknownCommandExamples,unknownCommandNextSteps:n.unknownCommandNextSteps,attemptedCommand:n.attemptedCommand,normalizedInvocationArgs:n.normalizedInvocationArgs,providedOptionFlags:n.providedOptionFlags,unknownOptionSuggestions:n.unknownOptionSuggestions,suggestedRetryCommand:n.suggestedRetryCommand}),{errorCategory:i,commandResolution:r}=await e.emitTelemetryCommandError({command:e.attemptedCommand,errorCode:o.code,errorMessage:o.detail,exitCode:g.USAGE,options:{bootstrap_global_options:e.bootstrapGlobal,commander_code:t},resolutionStage:"parse"}),a=await rn({command:e.attemptedCommand,error_code:o.code,error_category:i,exit_code:g.USAGE,error_message:o.detail,command_resolution:r,resolution_stage:"parse",source_context:q?.source_context},e.bootstrapGlobal),s=e.jsonErrors?await ko(e.error,w,T,e.bootstrapGlobal.lean===!0,{},qe(e)):await bo(e.error,w,T,{},qe(e)),c=await Fs(o.code,e.bootstrapPmRoot,{},De(je(e.invocationArgv))),l=wo(s,e.jsonErrors,c);await bi({errorMessage:n.message,exitCode:g.USAGE,classificationCode:o.code,errorCategory:i,commandResolution:r,resolutionStage:"parse"}),e.jsonErrors?ie(`${Vn(l)}
@@ -1,2 +1,2 @@
1
- import{A as Z,C as ee,a as Ae,b as be,c as Re,d as Me,e as Be,f as Te,g as Ne,h as Le,i as $,j,k as D,l as K,m as H,p as U,q,w as G,x as Y,y as X,z as J}from"./focused-chunks/chunk-RDELKGLS.js";import{a as B,b as T,c as N,d as L,p as Q}from"./focused-chunks/chunk-3GQRWIT5.js";import"./focused-chunks/chunk-RMJKVQYE.js";import"./focused-chunks/chunk-TNVLDU7Z.js";import"./focused-chunks/chunk-RFJ3MEFP.js";import"./focused-chunks/chunk-GQBWI4KA.js";import{a as h}from"./focused-chunks/chunk-VV2QF5IE.js";import"./focused-chunks/chunk-WHHFPATO.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{$d as W,Ma as R,Na as M,Yd as V,_d as z,b as y,c as E,f as d,i as k,j as C,k as O,l as S,m as b,n as P}from"./focused-chunks/chunk-NSFS3VWP.js";import"./focused-chunks/chunk-R6QFPHWW.js";import"./focused-chunks/chunk-OCKKIECS.js";import{b as Ie,c as we,d as Fe}from"./focused-chunks/chunk-NGFDPEP7.js";function qe(e){return e}function Ve(e){return e}function re(e,o){for(let r of o.commands??[])e.registerCommand(r);for(let[r,t]of Object.entries(o.commandOverrides??{}))e.registerCommand(r,t);for(let[r,t]of Object.entries(o.flags??{}))e.registerFlags(r,t);for(let[r,t]of Object.entries(o.parsers??{}))e.registerParser(r,t);for(let[r,t]of Object.entries(o.renderers??{}))if(typeof t=="function")e.registerRenderer(r,t);else{let{run:i,...s}=t;e.registerRenderer(r,i,s)}for(let[r,t]of Object.entries(o.services??{}))e.registerService(r,t)}function oe(e,o){for(let s of o.preflights??[])e.registerPreflight(s);let r=o.itemTypes??[];r.length>0&&e.registerItemTypes(r);let t=o.itemFields??[];t.length>0&&e.registerItemFields(t);let i=o.relationshipKinds??[];i.length>0&&e.registerRelationshipKinds(i);for(let s of o.migrations??[])e.registerMigration(s);for(let s of o.profiles??[])e.registerProfile(s)}function te(e,o){for(let r of o.searchProviders??[])e.registerSearchProvider(r);for(let r of o.vectorStoreAdapters??[])e.registerVectorStoreAdapter(r);for(let r of o.assuranceProviders??[])e.registerAssuranceMeasurementProvider(r);for(let r of o.importers??[])e.registerImporter(r.name,r.importer,r.options);for(let r of o.exporters??[])e.registerExporter(r.name,r.exporter,r.options)}function ne(e,o){for(let r of o.beforeCommand??[])e.hooks.beforeCommand(r);for(let r of o.beforeMutation??[])e.hooks.beforeMutation(r);for(let r of o.afterCommand??[])e.hooks.afterCommand(r);for(let r of o.onWrite??[])e.hooks.onWrite(r);for(let r of o.onRead??[])e.hooks.onRead(r);for(let r of o.onIndex??[])e.hooks.onIndex(r)}function ie(e){let r={activate:async t=>{re(t,e),oe(t,e),te(t,e),ne(t,e.hooks??{}),await e.activate?.(t)}};return e.manifest&&(r.manifest=e.manifest),e.deactivate&&(r.deactivate=e.deactivate),r}function f(e){let o=e.flatMap(r=>r??[]);return o.length>0?o:void 0}function u(e){let o=Object.assign({},...e.map(r=>r??{}));return Object.keys(o).length>0?o:void 0}function se(e){let o={};for(let r of e)for(let[t,i]of Object.entries(r??{}))o[t]=[...o[t]??[],...i];return Object.keys(o).length>0?o:void 0}var ae=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function ce(e,o,r){let t=o.map(s=>s?.[r]),i=f(t);if(i!==void 0){let s=e;s[r]=i}}function me(e){let o={};for(let r of ae)ce(o,e,r);return Object.keys(o).length>0?o:void 0}function ze(...e){let o={},r=(n,a)=>{a!==void 0&&(o[n]=a)};r("commands",f(e.map(n=>n.commands))),r("commandOverrides",u(e.map(n=>n.commandOverrides))),r("flags",se(e.map(n=>n.flags))),r("parsers",u(e.map(n=>n.parsers))),r("renderers",u(e.map(n=>n.renderers))),r("services",u(e.map(n=>n.services))),r("preflights",f(e.map(n=>n.preflights))),r("itemTypes",f(e.map(n=>n.itemTypes))),r("itemFields",f(e.map(n=>n.itemFields))),r("relationshipKinds",f(e.map(n=>n.relationshipKinds))),r("migrations",f(e.map(n=>n.migrations))),r("profiles",f(e.map(n=>n.profiles))),r("searchProviders",f(e.map(n=>n.searchProviders))),r("vectorStoreAdapters",f(e.map(n=>n.vectorStoreAdapters))),r("assuranceProviders",f(e.map(n=>n.assuranceProviders))),r("importers",f(e.map(n=>n.importers))),r("exporters",f(e.map(n=>n.exporters))),r("hooks",me(e.map(n=>n.hooks)));let t;for(let n of e)n.manifest&&(t=n.manifest);r("manifest",t);let i=e.some(n=>n.activate);r("activate",i?async n=>{for(let a of e)a.activate&&await a.activate(n)}:void 0);let s=e.some(n=>n.deactivate);return r("deactivate",s?async()=>{let n=[];for(let a of[...e].reverse())if(a.deactivate)try{await a.deactivate()}catch(c){n.push(c)}if(n.length>0)throw n.length>1?new AggregateError(n,"Multiple extension blueprint deactivate hooks failed."):n[0]}:void 0),o}var de=[["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 g(e){return e?Array.isArray(e)?e.length>0:Object.keys(e).length>0:!1}function v(e){let o=new Set;for(let[i,s]of de)g(e[i])&&o.add(s);(e.commands??[]).filter(l).some(i=>i.flags!==void 0)&&o.add("schema");let r=[...e.importers??[],...e.exporters??[]].filter(l);r.some(i=>i?.options?.flags!==void 0)&&o.add("schema"),r.some(i=>typeof i=="object")&&o.add("commands");let t=e.hooks??{};return[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some(g)&&o.add("hooks"),[...o].sort((i,s)=>i.localeCompare(s))}var fe=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function m(e){return[...new Set(e)].sort((o,r)=>o.localeCompare(r))}function l(e){return e!=null}function x(e){return d(`${e.name} import`)}function _(e){return d(`${e.name} export`)}function pe(e,o,r){return[...e.map(t=>d(t.name)),...o.filter(t=>t.options!==void 0).map(x),...r.filter(t=>t.options!==void 0).map(_)]}function le(e,o,r,t){return[...Object.keys(e.flags??{}).map(i=>d(i)),...o.filter(i=>i.flags!==void 0).map(i=>d(i.name)),...r.filter(i=>i.options?.flags!==void 0).map(x),...t.filter(i=>i.options?.flags!==void 0).map(_)]}function ue(e){return fe.filter(([o])=>(e[o]?.length??0)>0).map(([,o])=>o)}function ge(e){let o=Object.entries(e??{}).filter(([,r])=>typeof r!="function"&&((r.commands?.length??0)>0||r.resultDiscriminator!==void 0)).map(([r,t])=>{let i=t;return{format:r,commands:m((i.commands??[]).map(s=>d(s))),result_discriminator:i.resultDiscriminator!==void 0}}).sort((r,t)=>r.format.localeCompare(t.format));return o.length>0?{renderer_ownership:o}:{}}function he(e){return!e||e.length===0?{}:{assurance_providers:m(e.map(o=>o.id))}}function ve(e,o,r){return{item_types:m((e.itemTypes??[]).map(t=>t.name)),item_fields:m((e.itemFields??[]).map(t=>t.name)),...(e.relationshipKinds?.length??0)>0?{relationship_kinds:m(e.relationshipKinds.map(t=>t.kind))}:{},migrations:m((e.migrations??[]).flatMap(t=>typeof t.id=="string"?[t.id]:[])),profiles:m((e.profiles??[]).map(t=>t.name)),importers:m(o.map(t=>d(t.name))),exporters:m(r.map(t=>d(t.name))),search_providers:m((e.searchProviders??[]).map(t=>t.name)),vector_store_adapters:m((e.vectorStoreAdapters??[]).map(t=>t.name)),...he(e.assuranceProviders),parser_overrides:m(Object.keys(e.parsers??{}).map(t=>d(t))),service_overrides:m(Object.keys(e.services??{}).map(t=>String(t).trim().toLowerCase())),renderer_overrides:m(Object.keys(e.renderers??{}).map(t=>String(t).trim().toLowerCase())),...ge(e.renderers),preflight_overrides:(e.preflights??[]).length,preflight_ownership:(e.preflights??[]).map(t=>({commands:[...t.commands??[]]}))}}function We(e){let o=(e.commands??[]).filter(l),r=(e.importers??[]).filter(l),t=(e.exporters??[]).filter(l),i=r.map(x),s=t.map(_),n=pe(o,r,t),a=le(e,o,r,t),c=e.hooks??{},p=ve(e,r,t);return{capabilities:v(e),commands:m(n),command_overrides:m(Object.keys(e.commandOverrides??{}).map(A=>d(A))),command_handlers:m([...n,...i,...s]),hooks:ue(c),flag_commands:m(a),...p}}var xe=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function _e(e){return(e.itemFields??[]).filter(o=>typeof o?.name=="string"&&h.has(o.name.trim())).map(o=>({code:"reserved_item_field",severity:"error",message:`Item field "${o.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:o.name}))}function ye(e){return[...Object.values(e.flags??{}).flat(),...(e.commands??[]).flatMap(r=>r.flags??[]),...(e.importers??[]).flatMap(r=>r.options?.flags??[]),...(e.exporters??[]).flatMap(r=>r.options?.flags??[])].flatMap(r=>{if(typeof r?.long!="string"&&typeof r?.short!="string")return[];let t=k(r.long,r.short);if(t===null)return[];let{token:i,failure:s}=t;return[{code:s,severity:"error",message:`Flag "${i}" ${C(i,s)}.`,field:i}]})}function w(e){let o=new Set;for(let r of e){let t=E(r)??y(r);t!==null&&o.add(t)}return[...o].sort((r,t)=>r.localeCompare(t))}function Ee(e,o){let r=[];if(o===null)return e.length>0&&r.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${e.length===1?"capability":"capabilities"} [${e.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),r;let t=new Set(o),i=new Set(e);for(let s of e)t.has(s)||r.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${s}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${s}" to the manifest capabilities.`,capability:s});for(let s of o)i.has(s)||r.push({code:"capability_unused",severity:"warning",message:`Capability "${s}" 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:s});return r}function ke(e){let o=[],r=new Map;for(let i of e.commands??[]){let s=d(i.name);r.set(s,(r.get(s)??0)+1)}for(let[i,s]of r)s>1&&o.push({code:"duplicate_command",severity:"warning",message:`Command "${i}" is declared ${s} times in commands; the later registration shadows the earlier one at dispatch.`,command:i});let t=new Set(Object.keys(e.commandOverrides??{}).map(i=>d(i)));for(let i of r.keys())t.has(i)&&o.push({code:"command_override_conflict",severity:"warning",message:`Command "${i}" is declared both as a new command definition and as a command override; register one or the other.`,command:i});return o}function Ce(e){let o=[];for(let r of xe)r in e&&!g(e[r])&&o.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${r}" is present but empty; remove it or populate it.`,field:r});if("hooks"in e){let r=e.hooks??{};[r.beforeCommand,r.beforeMutation,r.afterCommand,r.onWrite,r.onRead,r.onIndex].some(g)||o.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 o}function Oe(e,o={}){let r=v(e),t=o.declaredCapabilities??e.manifest?.capabilities,i=Array.isArray(t)?w(t):null,s=[...Ee(r,i),...ke(e),...ye(e),..._e(e),...Ce(e)];return{ok:s.every(n=>n.severity!=="error"),findings:s,used:r,declared:i}}function F(e,o){let{additionalCapabilities:r,...t}=o,i=Array.isArray(r)?w(r):[],s=[...new Set([...v(e),...i])].sort((n,a)=>n.localeCompare(a));return{...t,capabilities:s}}function Ge(e,o){let r=F(e,o);return{module:ie({...e,manifest:r}),manifest:r}}function I(e,o){if(e.status==="absent"||e.status==="ok")return null;let r=`${e.kind}_${e.status}`,t="";switch(r){case"pm_min_version_invalid":t=`pm_min_version "${e.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":t=`pm_min_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_min_version_unmet":t=`Requires pm >= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_invalid":t=`pm_max_version "${e.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":t=`pm_max_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_max_version_exceeded":t=`Allows pm <= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":t=`Target pm ${o} is newer than pm_max_version ${e.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:r,severity:e.allowed?"warning":"error",constraint:e.kind,required:e.required,current:o,message:t}}function Se(e,o){let r=O(e.pm_min_version,o.pmVersion),t=S(e.pm_max_version,o.pmVersion,o.pmMaxVersionExceededMode??"block"),s=P(e).findings.map(p=>({code:p.code,severity:"warning",constraint:"manifest",required:p.code==="manifest_unknown_key"?p.path:"pm_min_version",current:o.pmVersion,path:p.path,...p.suggested_key?{suggested_key:p.suggested_key}:{},message:p.message})),n=[],a=I(r,o.pmVersion);a!==null&&n.push(a);let c=I(t,o.pmVersion);return c!==null&&n.push(c),{compatible:r.allowed&&t.allowed,findings:[...s,...n],pmVersion:o.pmVersion}}var Pe=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function Ye(e,o={}){let r=Oe(e,{declaredCapabilities:o.declaredCapabilities}),t=o.identity?F(e,o.identity):null,i=o.target?Se(t??e.manifest??{},o.target):null,a=[...(t!==null&&o.declaredCapabilities===void 0?r.findings.filter(c=>!Pe.has(c.code)):r.findings).map(c=>({source:"blueprint",severity:c.severity,code:c.code,message:c.message})),...(i?.findings??[]).map(c=>({source:"compatibility",severity:c.severity,code:c.code,message:c.message}))];return{ok:a.every(c=>c.severity!=="error"),capabilities:r.used,blueprint:r,manifest:t,compatibility:i,findings:a}}function Je(e){return e}function Qe(e){return e}function Ze(e){return e}function er(e){return e}function rr(e){return e}function or(e){return e}function tr(e){return e}function nr(e){return e}function ir(e){return e}function sr(e){return e}function ar(e){return e}function cr(e){return e}function mr(e){return e}function dr(e){return{handled:!0,result:e}}function fr(){return{handled:!1}}function pr(e){return e}function lr(e){return e}function ur(e){return e}function gr(e){return e}function hr(e){return e}function vr(e){return e}function xr(e){return e}function _r(e){return e}function yr(e){return e}export{j as BUILTIN_PROFILES,Ae as EXTENSION_CAPABILITIES,Fe as EXTENSION_CAPABILITY_CONTRACT,Ie as EXTENSION_CAPABILITY_CONTRACT_VERSION,we as EXTENSION_CAPABILITY_LEGACY_ALIASES,V as EXTENSION_CAPABILITY_REGISTRATION_SURFACES,be as EXTENSION_POLICY_MODES,Re as EXTENSION_POLICY_SURFACES,Be as EXTENSION_SANDBOX_PROFILES,Me as EXTENSION_TRUST_MODES,Ne as LIST_FILTER_EXTENSION_FLAG_DEFINITIONS,T as PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,B as PM_PACKAGE_RESOURCE_KINDS,Y as PROFILE_LINT_CODES,G as PROFILE_LINT_DIMENSIONS,$ as PROFILE_NAMES,h as RESERVED_ITEM_FIELD_NAMES,Le as SEARCH_EXTENSION_FLAG_DEFINITIONS,Se as checkExtensionManifestCompatibility,L as collectPackageExtensionDirectories,z as collectUsedExtensionCapabilities,ie as composeExtension,Ge as composeExtensionPackage,M as createExtensionContributionInventory,fr as declineServiceOverride,vr as defineAfterCommandHook,gr as defineBeforeCommandHook,hr as defineBeforeMutationHook,Ze as defineCommand,sr as defineCommandOverride,ur as defineExporter,qe as defineExtension,Ve as defineExtensionBlueprint,Je as defineExtensionManifest,er as defineFlag,lr as defineImporter,or as defineItemField,rr as defineItemType,tr as defineMigration,yr as defineOnIndexHook,_r as defineOnReadHook,xr as defineOnWriteHook,ar as defineParserOverride,cr as definePreflightOverride,Qe as defineProjectProfile,pr as defineRendererOverride,nr as defineSearchProvider,mr as defineServiceOverride,ir as defineVectorStoreAdapter,v as deriveExtensionCapabilities,We as describeExtensionBlueprint,U as describeProfileComposition,q as describeProjectProfile,dr as handleServiceOverride,b as inspectExtensionManifestSchema,Oe as lintExtensionBlueprint,P as lintExtensionManifestSchema,X as lintProjectProfile,H as listProfiles,ze as mergeExtensionBlueprints,ee as normalizeDirectExtensionCommandOptions,R as normalizeExtensionContributionInventory,D as normalizeProfileName,J as planProfileApplication,Ye as preflightExtension,N as readPmPackageManifest,W as reconcileExtensionCapabilityUsage,Q as renderExtensionSurfaceMarkdown,Z as resolveExtensionFlagOptionKey,K as resolveProfile,F as synthesizeExtensionManifest,Te as toExtensionFlagDefinitions};
1
+ import{A as Z,C as ee,a as Ae,b as be,c as Re,d as Me,e as Be,f as Te,g as Ne,h as Le,i as $,j,k as D,l as K,m as H,p as U,q,w as G,x as Y,y as X,z as J}from"./focused-chunks/chunk-4HLZOOZI.js";import{a as B,b as T,c as N,d as L,p as Q}from"./focused-chunks/chunk-GUAT4OAC.js";import"./focused-chunks/chunk-I4GY7HAP.js";import"./focused-chunks/chunk-REORRDPH.js";import"./focused-chunks/chunk-52PHSTGP.js";import"./focused-chunks/chunk-AL47ODFZ.js";import{a as h}from"./focused-chunks/chunk-ZZYJS74B.js";import"./focused-chunks/chunk-SXWUKNTY.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{$d as W,Ma as R,Na as M,Yd as V,_d as z,b as y,c as E,f as d,i as k,j as C,k as O,l as S,m as b,n as P}from"./focused-chunks/chunk-HGJ4MILN.js";import"./focused-chunks/chunk-YPOATPTX.js";import"./focused-chunks/chunk-OCKKIECS.js";import{b as Ie,c as we,d as Fe}from"./focused-chunks/chunk-NGFDPEP7.js";function qe(e){return e}function Ve(e){return e}function re(e,o){for(let r of o.commands??[])e.registerCommand(r);for(let[r,t]of Object.entries(o.commandOverrides??{}))e.registerCommand(r,t);for(let[r,t]of Object.entries(o.flags??{}))e.registerFlags(r,t);for(let[r,t]of Object.entries(o.parsers??{}))e.registerParser(r,t);for(let[r,t]of Object.entries(o.renderers??{}))if(typeof t=="function")e.registerRenderer(r,t);else{let{run:i,...s}=t;e.registerRenderer(r,i,s)}for(let[r,t]of Object.entries(o.services??{}))e.registerService(r,t)}function oe(e,o){for(let s of o.preflights??[])e.registerPreflight(s);let r=o.itemTypes??[];r.length>0&&e.registerItemTypes(r);let t=o.itemFields??[];t.length>0&&e.registerItemFields(t);let i=o.relationshipKinds??[];i.length>0&&e.registerRelationshipKinds(i);for(let s of o.migrations??[])e.registerMigration(s);for(let s of o.profiles??[])e.registerProfile(s)}function te(e,o){for(let r of o.searchProviders??[])e.registerSearchProvider(r);for(let r of o.vectorStoreAdapters??[])e.registerVectorStoreAdapter(r);for(let r of o.assuranceProviders??[])e.registerAssuranceMeasurementProvider(r);for(let r of o.importers??[])e.registerImporter(r.name,r.importer,r.options);for(let r of o.exporters??[])e.registerExporter(r.name,r.exporter,r.options)}function ne(e,o){for(let r of o.beforeCommand??[])e.hooks.beforeCommand(r);for(let r of o.beforeMutation??[])e.hooks.beforeMutation(r);for(let r of o.afterCommand??[])e.hooks.afterCommand(r);for(let r of o.onWrite??[])e.hooks.onWrite(r);for(let r of o.onRead??[])e.hooks.onRead(r);for(let r of o.onIndex??[])e.hooks.onIndex(r)}function ie(e){let r={activate:async t=>{re(t,e),oe(t,e),te(t,e),ne(t,e.hooks??{}),await e.activate?.(t)}};return e.manifest&&(r.manifest=e.manifest),e.deactivate&&(r.deactivate=e.deactivate),r}function f(e){let o=e.flatMap(r=>r??[]);return o.length>0?o:void 0}function u(e){let o=Object.assign({},...e.map(r=>r??{}));return Object.keys(o).length>0?o:void 0}function se(e){let o={};for(let r of e)for(let[t,i]of Object.entries(r??{}))o[t]=[...o[t]??[],...i];return Object.keys(o).length>0?o:void 0}var ae=["beforeCommand","beforeMutation","afterCommand","onWrite","onRead","onIndex"];function ce(e,o,r){let t=o.map(s=>s?.[r]),i=f(t);if(i!==void 0){let s=e;s[r]=i}}function me(e){let o={};for(let r of ae)ce(o,e,r);return Object.keys(o).length>0?o:void 0}function ze(...e){let o={},r=(n,a)=>{a!==void 0&&(o[n]=a)};r("commands",f(e.map(n=>n.commands))),r("commandOverrides",u(e.map(n=>n.commandOverrides))),r("flags",se(e.map(n=>n.flags))),r("parsers",u(e.map(n=>n.parsers))),r("renderers",u(e.map(n=>n.renderers))),r("services",u(e.map(n=>n.services))),r("preflights",f(e.map(n=>n.preflights))),r("itemTypes",f(e.map(n=>n.itemTypes))),r("itemFields",f(e.map(n=>n.itemFields))),r("relationshipKinds",f(e.map(n=>n.relationshipKinds))),r("migrations",f(e.map(n=>n.migrations))),r("profiles",f(e.map(n=>n.profiles))),r("searchProviders",f(e.map(n=>n.searchProviders))),r("vectorStoreAdapters",f(e.map(n=>n.vectorStoreAdapters))),r("assuranceProviders",f(e.map(n=>n.assuranceProviders))),r("importers",f(e.map(n=>n.importers))),r("exporters",f(e.map(n=>n.exporters))),r("hooks",me(e.map(n=>n.hooks)));let t;for(let n of e)n.manifest&&(t=n.manifest);r("manifest",t);let i=e.some(n=>n.activate);r("activate",i?async n=>{for(let a of e)a.activate&&await a.activate(n)}:void 0);let s=e.some(n=>n.deactivate);return r("deactivate",s?async()=>{let n=[];for(let a of[...e].reverse())if(a.deactivate)try{await a.deactivate()}catch(c){n.push(c)}if(n.length>0)throw n.length>1?new AggregateError(n,"Multiple extension blueprint deactivate hooks failed."):n[0]}:void 0),o}var de=[["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 g(e){return e?Array.isArray(e)?e.length>0:Object.keys(e).length>0:!1}function v(e){let o=new Set;for(let[i,s]of de)g(e[i])&&o.add(s);(e.commands??[]).filter(l).some(i=>i.flags!==void 0)&&o.add("schema");let r=[...e.importers??[],...e.exporters??[]].filter(l);r.some(i=>i?.options?.flags!==void 0)&&o.add("schema"),r.some(i=>typeof i=="object")&&o.add("commands");let t=e.hooks??{};return[t.beforeCommand,t.beforeMutation,t.afterCommand,t.onWrite,t.onRead,t.onIndex].some(g)&&o.add("hooks"),[...o].sort((i,s)=>i.localeCompare(s))}var fe=[["beforeCommand","before_command"],["beforeMutation","before_mutation"],["afterCommand","after_command"],["onWrite","on_write"],["onRead","on_read"],["onIndex","on_index"]];function m(e){return[...new Set(e)].sort((o,r)=>o.localeCompare(r))}function l(e){return e!=null}function x(e){return d(`${e.name} import`)}function _(e){return d(`${e.name} export`)}function pe(e,o,r){return[...e.map(t=>d(t.name)),...o.filter(t=>t.options!==void 0).map(x),...r.filter(t=>t.options!==void 0).map(_)]}function le(e,o,r,t){return[...Object.keys(e.flags??{}).map(i=>d(i)),...o.filter(i=>i.flags!==void 0).map(i=>d(i.name)),...r.filter(i=>i.options?.flags!==void 0).map(x),...t.filter(i=>i.options?.flags!==void 0).map(_)]}function ue(e){return fe.filter(([o])=>(e[o]?.length??0)>0).map(([,o])=>o)}function ge(e){let o=Object.entries(e??{}).filter(([,r])=>typeof r!="function"&&((r.commands?.length??0)>0||r.resultDiscriminator!==void 0)).map(([r,t])=>{let i=t;return{format:r,commands:m((i.commands??[]).map(s=>d(s))),result_discriminator:i.resultDiscriminator!==void 0}}).sort((r,t)=>r.format.localeCompare(t.format));return o.length>0?{renderer_ownership:o}:{}}function he(e){return!e||e.length===0?{}:{assurance_providers:m(e.map(o=>o.id))}}function ve(e,o,r){return{item_types:m((e.itemTypes??[]).map(t=>t.name)),item_fields:m((e.itemFields??[]).map(t=>t.name)),...(e.relationshipKinds?.length??0)>0?{relationship_kinds:m(e.relationshipKinds.map(t=>t.kind))}:{},migrations:m((e.migrations??[]).flatMap(t=>typeof t.id=="string"?[t.id]:[])),profiles:m((e.profiles??[]).map(t=>t.name)),importers:m(o.map(t=>d(t.name))),exporters:m(r.map(t=>d(t.name))),search_providers:m((e.searchProviders??[]).map(t=>t.name)),vector_store_adapters:m((e.vectorStoreAdapters??[]).map(t=>t.name)),...he(e.assuranceProviders),parser_overrides:m(Object.keys(e.parsers??{}).map(t=>d(t))),service_overrides:m(Object.keys(e.services??{}).map(t=>String(t).trim().toLowerCase())),renderer_overrides:m(Object.keys(e.renderers??{}).map(t=>String(t).trim().toLowerCase())),...ge(e.renderers),preflight_overrides:(e.preflights??[]).length,preflight_ownership:(e.preflights??[]).map(t=>({commands:[...t.commands??[]]}))}}function We(e){let o=(e.commands??[]).filter(l),r=(e.importers??[]).filter(l),t=(e.exporters??[]).filter(l),i=r.map(x),s=t.map(_),n=pe(o,r,t),a=le(e,o,r,t),c=e.hooks??{},p=ve(e,r,t);return{capabilities:v(e),commands:m(n),command_overrides:m(Object.keys(e.commandOverrides??{}).map(A=>d(A))),command_handlers:m([...n,...i,...s]),hooks:ue(c),flag_commands:m(a),...p}}var xe=["commands","commandOverrides","flags","parsers","renderers","services","preflights","itemTypes","itemFields","relationshipKinds","migrations","profiles","searchProviders","vectorStoreAdapters","assuranceProviders","importers","exporters"];function _e(e){return(e.itemFields??[]).filter(o=>typeof o?.name=="string"&&h.has(o.name.trim())).map(o=>({code:"reserved_item_field",severity:"error",message:`Item field "${o.name}" collides with reserved item metadata; rename it with an extension-specific prefix before publishing.`,field:o.name}))}function ye(e){return[...Object.values(e.flags??{}).flat(),...(e.commands??[]).flatMap(r=>r.flags??[]),...(e.importers??[]).flatMap(r=>r.options?.flags??[]),...(e.exporters??[]).flatMap(r=>r.options?.flags??[])].flatMap(r=>{if(typeof r?.long!="string"&&typeof r?.short!="string")return[];let t=k(r.long,r.short);if(t===null)return[];let{token:i,failure:s}=t;return[{code:s,severity:"error",message:`Flag "${i}" ${C(i,s)}.`,field:i}]})}function w(e){let o=new Set;for(let r of e){let t=E(r)??y(r);t!==null&&o.add(t)}return[...o].sort((r,t)=>r.localeCompare(t))}function Ee(e,o){let r=[];if(o===null)return e.length>0&&r.push({code:"manifest_capabilities_absent",severity:"warning",message:`Blueprint exercises ${e.length===1?"capability":"capabilities"} [${e.join(", ")}] but declares none; set capabilities to deriveExtensionCapabilities(blueprint) so the manifest grant matches.`}),r;let t=new Set(o),i=new Set(e);for(let s of e)t.has(s)||r.push({code:"capability_undeclared",severity:"error",message:`Blueprint exercises capability "${s}" but it is absent from the declared capabilities; activation throws extension_capability_missing \u2014 add "${s}" to the manifest capabilities.`,capability:s});for(let s of o)i.has(s)||r.push({code:"capability_unused",severity:"warning",message:`Capability "${s}" 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:s});return r}function ke(e){let o=[],r=new Map;for(let i of e.commands??[]){let s=d(i.name);r.set(s,(r.get(s)??0)+1)}for(let[i,s]of r)s>1&&o.push({code:"duplicate_command",severity:"warning",message:`Command "${i}" is declared ${s} times in commands; the later registration shadows the earlier one at dispatch.`,command:i});let t=new Set(Object.keys(e.commandOverrides??{}).map(i=>d(i)));for(let i of r.keys())t.has(i)&&o.push({code:"command_override_conflict",severity:"warning",message:`Command "${i}" is declared both as a new command definition and as a command override; register one or the other.`,command:i});return o}function Ce(e){let o=[];for(let r of xe)r in e&&!g(e[r])&&o.push({code:"empty_surface",severity:"warning",message:`Blueprint field "${r}" is present but empty; remove it or populate it.`,field:r});if("hooks"in e){let r=e.hooks??{};[r.beforeCommand,r.beforeMutation,r.afterCommand,r.onWrite,r.onRead,r.onIndex].some(g)||o.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 o}function Oe(e,o={}){let r=v(e),t=o.declaredCapabilities??e.manifest?.capabilities,i=Array.isArray(t)?w(t):null,s=[...Ee(r,i),...ke(e),...ye(e),..._e(e),...Ce(e)];return{ok:s.every(n=>n.severity!=="error"),findings:s,used:r,declared:i}}function F(e,o){let{additionalCapabilities:r,...t}=o,i=Array.isArray(r)?w(r):[],s=[...new Set([...v(e),...i])].sort((n,a)=>n.localeCompare(a));return{...t,capabilities:s}}function Ge(e,o){let r=F(e,o);return{module:ie({...e,manifest:r}),manifest:r}}function I(e,o){if(e.status==="absent"||e.status==="ok")return null;let r=`${e.kind}_${e.status}`,t="";switch(r){case"pm_min_version_invalid":t=`pm_min_version "${e.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;break;case"pm_min_version_unchecked":t=`pm_min_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_min_version_unmet":t=`Requires pm >= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_invalid":t=`pm_max_version "${e.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":t=`pm_max_version "${e.required}" could not be compared against pm ${o}; compatibility is unverified.`;break;case"pm_max_version_exceeded":t=`Allows pm <= ${e.required} but the target is pm ${o}; the loader skips the extension.`;break;case"pm_max_version_exceeded_warn":t=`Target pm ${o} is newer than pm_max_version ${e.required}, but the "warn" exceeded mode lets it load with a warning.`;break}return{code:r,severity:e.allowed?"warning":"error",constraint:e.kind,required:e.required,current:o,message:t}}function Se(e,o){let r=O(e.pm_min_version,o.pmVersion),t=S(e.pm_max_version,o.pmVersion,o.pmMaxVersionExceededMode??"block"),s=P(e).findings.map(p=>({code:p.code,severity:"warning",constraint:"manifest",required:p.code==="manifest_unknown_key"?p.path:"pm_min_version",current:o.pmVersion,path:p.path,...p.suggested_key?{suggested_key:p.suggested_key}:{},message:p.message})),n=[],a=I(r,o.pmVersion);a!==null&&n.push(a);let c=I(t,o.pmVersion);return c!==null&&n.push(c),{compatible:r.allowed&&t.allowed,findings:[...s,...n],pmVersion:o.pmVersion}}var Pe=new Set(["capability_undeclared","capability_unused","manifest_capabilities_absent"]);function Ye(e,o={}){let r=Oe(e,{declaredCapabilities:o.declaredCapabilities}),t=o.identity?F(e,o.identity):null,i=o.target?Se(t??e.manifest??{},o.target):null,a=[...(t!==null&&o.declaredCapabilities===void 0?r.findings.filter(c=>!Pe.has(c.code)):r.findings).map(c=>({source:"blueprint",severity:c.severity,code:c.code,message:c.message})),...(i?.findings??[]).map(c=>({source:"compatibility",severity:c.severity,code:c.code,message:c.message}))];return{ok:a.every(c=>c.severity!=="error"),capabilities:r.used,blueprint:r,manifest:t,compatibility:i,findings:a}}function Je(e){return e}function Qe(e){return e}function Ze(e){return e}function er(e){return e}function rr(e){return e}function or(e){return e}function tr(e){return e}function nr(e){return e}function ir(e){return e}function sr(e){return e}function ar(e){return e}function cr(e){return e}function mr(e){return e}function dr(e){return{handled:!0,result:e}}function fr(){return{handled:!1}}function pr(e){return e}function lr(e){return e}function ur(e){return e}function gr(e){return e}function hr(e){return e}function vr(e){return e}function xr(e){return e}function _r(e){return e}function yr(e){return e}export{j as BUILTIN_PROFILES,Ae as EXTENSION_CAPABILITIES,Fe as EXTENSION_CAPABILITY_CONTRACT,Ie as EXTENSION_CAPABILITY_CONTRACT_VERSION,we as EXTENSION_CAPABILITY_LEGACY_ALIASES,V as EXTENSION_CAPABILITY_REGISTRATION_SURFACES,be as EXTENSION_POLICY_MODES,Re as EXTENSION_POLICY_SURFACES,Be as EXTENSION_SANDBOX_PROFILES,Me as EXTENSION_TRUST_MODES,Ne as LIST_FILTER_EXTENSION_FLAG_DEFINITIONS,T as PM_PACKAGE_CONVENTIONAL_RESOURCE_ROOTS,B as PM_PACKAGE_RESOURCE_KINDS,Y as PROFILE_LINT_CODES,G as PROFILE_LINT_DIMENSIONS,$ as PROFILE_NAMES,h as RESERVED_ITEM_FIELD_NAMES,Le as SEARCH_EXTENSION_FLAG_DEFINITIONS,Se as checkExtensionManifestCompatibility,L as collectPackageExtensionDirectories,z as collectUsedExtensionCapabilities,ie as composeExtension,Ge as composeExtensionPackage,M as createExtensionContributionInventory,fr as declineServiceOverride,vr as defineAfterCommandHook,gr as defineBeforeCommandHook,hr as defineBeforeMutationHook,Ze as defineCommand,sr as defineCommandOverride,ur as defineExporter,qe as defineExtension,Ve as defineExtensionBlueprint,Je as defineExtensionManifest,er as defineFlag,lr as defineImporter,or as defineItemField,rr as defineItemType,tr as defineMigration,yr as defineOnIndexHook,_r as defineOnReadHook,xr as defineOnWriteHook,ar as defineParserOverride,cr as definePreflightOverride,Qe as defineProjectProfile,pr as defineRendererOverride,nr as defineSearchProvider,mr as defineServiceOverride,ir as defineVectorStoreAdapter,v as deriveExtensionCapabilities,We as describeExtensionBlueprint,U as describeProfileComposition,q as describeProjectProfile,dr as handleServiceOverride,b as inspectExtensionManifestSchema,Oe as lintExtensionBlueprint,P as lintExtensionManifestSchema,X as lintProjectProfile,H as listProfiles,ze as mergeExtensionBlueprints,ee as normalizeDirectExtensionCommandOptions,R as normalizeExtensionContributionInventory,D as normalizeProfileName,J as planProfileApplication,Ye as preflightExtension,N as readPmPackageManifest,W as reconcileExtensionCapabilityUsage,Q as renderExtensionSurfaceMarkdown,Z as resolveExtensionFlagOptionKey,K as resolveProfile,F as synthesizeExtensionManifest,Te as toExtensionFlagDefinitions};
2
2
  //# sourceMappingURL=sdk-authoring.js.map
@@ -1,4 +1,4 @@
1
- import{a as Wi,b as Xi,c as Qi,d as C,e as Zi,f as F,g as en,h as tn,i as rn,j as on,k as nn,l as sn,m as cn,n as an,o as D,p as dn,q,u as z,v as ln,w as pn,x as U,y as un,z as mn}from"./focused-chunks/chunk-KEZ4VXYD.js";import{a as _n}from"./focused-chunks/chunk-K53OIT5J.js";import{a as Yi}from"./focused-chunks/chunk-AAB3ZR7Z.js";import{$ as Di,A as xo,T as vi,U as ji,V as Ai,W as Ri,X as Ii,Y as Ni,Z as Li,_ as Fi,a as Ke,aa as qi,b as Ye,ba as zi,c as We,d as Xe,da as Ui,e as Qe,ea as Hi,f as Ze,fa as Gi,g as et,ga as Vi,h as tt,ha as Bi,i as rt,ia as Ji,j as to,ja as Ki,k as ro,l as oo,m as io,n as no,o as so,p as co,q as ao,r as lo,s as po,t as uo,u as mo,v as _o,w as fo,x as go,y as yo,z as ho}from"./focused-chunks/chunk-TNVLDU7Z.js";import{$ as Ht,$a as Hr,A as ht,Aa as gr,B as xt,Ba as yr,C as bt,Ca as hr,Da as xr,E as wt,Ea as br,F as Ct,Fa as wr,G as Tt,Ga as Cr,H as Pt,Ha as Tr,I as kt,Ia as Pr,J as Mt,Ja as kr,K as Et,Ka as Mr,L as Ot,La as Er,M as $t,Ma as Or,N as St,Na as $r,O as vt,Oa as Sr,P as jt,Pa as vr,Q as At,Qa as jr,R as Rt,Ra as Ar,Sa as Rr,T as It,Ta as Ir,U as Nt,Ua as Nr,V as Lt,Va as Lr,W as Ft,Wa as Fr,X as Dt,Xa as Dr,Y as qt,Ya as qr,Z as zt,Za as zr,_ as Ut,_a as Ur,aa as Gt,ab as Gr,ba as Vt,bb as Vr,ca as Bt,cb as Br,d as S,da as Jt,db as Jr,ea as Kt,eb as Kr,f as v,fa as Yt,fb as Yr,ga as Wt,gb as Wr,ha as Xt,hb as Xr,ia as Qt,ib as Qr,j,ja as Zt,ka as er,kb as Zr,l as A,la as tr,m as it,ma as rr,mb as R,n as nt,na as or,nb as I,o as st,oa as ir,ob as eo,p as ct,pa as nr,q as at,qa as sr,r as dt,ra as cr,s as lt,sa as ar,t as pt,ta as dr,u as ut,ua as lr,v as mt,va as pr,w as _t,wa as ur,x as ft,xa as mr,y as gt,ya as _r,z as yt,za as fr}from"./focused-chunks/chunk-GQBWI4KA.js";import{a as ot}from"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{$f as Pi,Aa as Le,Af as hi,Ba as Fe,Ca as De,Ce as N,Da as qe,De as L,Ea as ze,Fa as Ue,Ga as He,Ge as Oo,Ha as Ge,He as $o,Ia as Ve,Ie as So,Ja as Be,Je as vo,Ke as jo,La as Je,Le as Ao,Me as Ro,Ne as Io,Oe as No,Pe as Lo,Qe as Fo,Re as Do,Se as qo,Te as zo,Ue as Uo,Ve as Ho,Vf as xi,We as Go,Wf as w,Xe as Vo,Xf as bi,Ya as Q,Ye as Bo,Yf as wi,Ze as Jo,Zf as Ci,_f as Ti,af as Ko,ag as ki,bf as Yo,bg as Mi,cg as Ei,dg as Oi,ef as Wo,eg as $i,ff as Xo,gf as Qo,hf as Zo,if as ei,jf as ti,kb as bo,kf as ri,lb as wo,lf as oi,lg as Si,mb as Co,mf as ii,nb as To,nf as ni,oa as Me,ob as Po,of as si,pa as Ee,pb as ko,pf as ci,qa as Oe,qb as Mo,qf as ai,ra as $e,rb as Eo,rf as di,sa as Se,sf as li,ta as ve,tf as pi,ua as je,uf as ui,vf as mi,wa as Ae,wf as _i,xa as Re,xf as fi,ya as Ie,yf as gi,za as Ne,zf as yi}from"./focused-chunks/chunk-NSFS3VWP.js";import{g as ye,h as he,i as xe,j as be,k as O,l as we,m as _,n as $,o as Ce,p as Te,q as Pe,r as ke}from"./focused-chunks/chunk-R6QFPHWW.js";import"./focused-chunks/chunk-OCKKIECS.js";import{z as b}from"./focused-chunks/chunk-NGFDPEP7.js";var Z="2026-07-28",H=["2025-11-25","2025-06-18"],G=[Z];var ee=new Set(["--help","-h","--version","-V"]);function te(e,t){let n=[`Usage: ${e==="stdio"?"pm-mcp":"pm-mcp-http"} [--help | --version]`,"",e==="stdio"?"JSON-RPC over stdin/stdout. With no arguments, starts the stdio server.":"Streamable HTTP POST /mcp. With no arguments, starts the HTTP server.","","Options:"," -h, --help Print help and exit before transport startup."," -V, --version Print the package version and exit.","","Environment:"," PM_PATH Tracker root (otherwise discovered from cwd)."," PM_GLOBAL_PATH Global settings root."," PM_MCP_PROFILE core (default), standard, full, or custom."," PM_MCP_TOOLS Comma-separated tool allowlist for custom profile."," PM_MCP_DISCOVERY_CURSOR_KEY Shared discovery cursor secret, at least 32 UTF-8 bytes."," PM_MCP_BAGGAGE_ALLOWLIST Comma-separated permitted trace baggage keys."];return e==="http"&&n.push(" PM_MCP_HTTP_HOST Bind host (default 127.0.0.1)."," PM_MCP_HTTP_PORT Bind port, 0..65535 (default 3000)."," PM_MCP_HTTP_ALLOWED_ORIGINS Comma-separated exact browser origins (default none)."," PM_MCP_HTTP_BEARER_TOKEN Deployment token for the bundled verifier."," PM_MCP_HTTP_AUTH_ISSUER Exact HTTPS authorization-server issuer."," PM_MCP_HTTP_RESOURCE Canonical resource/audience URI."," PM_MCP_HTTP_SCOPES Space-separated scopes (default pm:read pm:write).","","Non-loopback HTTP requires bearer token, issuer, and resource together."),n.push("",`MCP protocol: ${G.join(", ")}.`,e==="stdio"?`Legacy initialize compatibility: ${H.join(", ")}.`:"HTTP requires modern per-request metadata; legacy initialize is stdio-only.","",e==="stdio"?"Client configuration:":"Example loopback server:",e==="stdio"?JSON.stringify({mcpServers:{pm:{command:"npx",args:["--yes","--package",`@unbrained/pm-cli@${t}`,"pm-mcp"]}}}):`PM_MCP_HTTP_PORT=3000 npx --yes --package @unbrained/pm-cli@${t} pm-mcp-http`,...e==="http"?["HTTP client configuration:",JSON.stringify({mcpServers:{pm:{url:"http://127.0.0.1:3000/mcp"}}})]:[],"","Configuration: https://github.com/unbraind/pm-cli/blob/main/docs/MCP_REMOTE_TRANSPORT_SECURITY.md",""),n.join(`
1
+ import{a as Wi,b as Xi,c as Qi,d as C,e as Zi,f as F,g as en,h as tn,i as rn,j as on,k as nn,l as sn,m as cn,n as an,o as D,p as dn,q,u as z,v as ln,w as pn,x as U,y as un,z as mn}from"./focused-chunks/chunk-AN4NFFLL.js";import{a as _n}from"./focused-chunks/chunk-K53OIT5J.js";import{a as Yi}from"./focused-chunks/chunk-24W63UPP.js";import{$ as Di,A as xo,T as vi,U as ji,V as Ai,W as Ri,X as Ii,Y as Ni,Z as Li,_ as Fi,a as Ke,aa as qi,b as Ye,ba as zi,c as We,d as Xe,da as Ui,e as Qe,ea as Hi,f as Ze,fa as Gi,g as et,ga as Vi,h as tt,ha as Bi,i as rt,ia as Ji,j as to,ja as Ki,k as ro,l as oo,m as io,n as no,o as so,p as co,q as ao,r as lo,s as po,t as uo,u as mo,v as _o,w as fo,x as go,y as yo,z as ho}from"./focused-chunks/chunk-REORRDPH.js";import{$ as Ht,$a as Hr,A as ht,Aa as gr,B as xt,Ba as yr,C as bt,Ca as hr,Da as xr,E as wt,Ea as br,F as Ct,Fa as wr,G as Tt,Ga as Cr,H as Pt,Ha as Tr,I as kt,Ia as Pr,J as Mt,Ja as kr,K as Et,Ka as Mr,L as Ot,La as Er,M as $t,Ma as Or,N as St,Na as $r,O as vt,Oa as Sr,P as jt,Pa as vr,Q as At,Qa as jr,R as Rt,Ra as Ar,Sa as Rr,T as It,Ta as Ir,U as Nt,Ua as Nr,V as Lt,Va as Lr,W as Ft,Wa as Fr,X as Dt,Xa as Dr,Y as qt,Ya as qr,Z as zt,Za as zr,_ as Ut,_a as Ur,aa as Gt,ab as Gr,ba as Vt,bb as Vr,ca as Bt,cb as Br,d as S,da as Jt,db as Jr,ea as Kt,eb as Kr,f as v,fa as Yt,fb as Yr,ga as Wt,gb as Wr,ha as Xt,hb as Xr,ia as Qt,ib as Qr,j,ja as Zt,ka as er,kb as Zr,l as A,la as tr,m as it,ma as rr,mb as R,n as nt,na as or,nb as I,o as st,oa as ir,ob as eo,p as ct,pa as nr,q as at,qa as sr,r as dt,ra as cr,s as lt,sa as ar,t as pt,ta as dr,u as ut,ua as lr,v as mt,va as pr,w as _t,wa as ur,x as ft,xa as mr,y as gt,ya as _r,z as yt,za as fr}from"./focused-chunks/chunk-AL47ODFZ.js";import{a as ot}from"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{$f as Pi,Aa as Le,Af as hi,Ba as Fe,Ca as De,Ce as N,Da as qe,De as L,Ea as ze,Fa as Ue,Ga as He,Ge as Oo,Ha as Ge,He as $o,Ia as Ve,Ie as So,Ja as Be,Je as vo,Ke as jo,La as Je,Le as Ao,Me as Ro,Ne as Io,Oe as No,Pe as Lo,Qe as Fo,Re as Do,Se as qo,Te as zo,Ue as Uo,Ve as Ho,Vf as xi,We as Go,Wf as w,Xe as Vo,Xf as bi,Ya as Q,Ye as Bo,Yf as wi,Ze as Jo,Zf as Ci,_f as Ti,af as Ko,ag as ki,bf as Yo,bg as Mi,cg as Ei,dg as Oi,ef as Wo,eg as $i,ff as Xo,gf as Qo,hf as Zo,if as ei,jf as ti,kb as bo,kf as ri,lb as wo,lf as oi,lg as Si,mb as Co,mf as ii,nb as To,nf as ni,oa as Me,ob as Po,of as si,pa as Ee,pb as ko,pf as ci,qa as Oe,qb as Mo,qf as ai,ra as $e,rb as Eo,rf as di,sa as Se,sf as li,ta as ve,tf as pi,ua as je,uf as ui,vf as mi,wa as Ae,wf as _i,xa as Re,xf as fi,ya as Ie,yf as gi,za as Ne,zf as yi}from"./focused-chunks/chunk-HGJ4MILN.js";import{g as ye,h as he,i as xe,j as be,k as O,l as we,m as _,n as $,o as Ce,p as Te,q as Pe,r as ke}from"./focused-chunks/chunk-YPOATPTX.js";import"./focused-chunks/chunk-OCKKIECS.js";import{z as b}from"./focused-chunks/chunk-NGFDPEP7.js";var Z="2026-07-28",H=["2025-11-25","2025-06-18"],G=[Z];var ee=new Set(["--help","-h","--version","-V"]);function te(e,t){let n=[`Usage: ${e==="stdio"?"pm-mcp":"pm-mcp-http"} [--help | --version]`,"",e==="stdio"?"JSON-RPC over stdin/stdout. With no arguments, starts the stdio server.":"Streamable HTTP POST /mcp. With no arguments, starts the HTTP server.","","Options:"," -h, --help Print help and exit before transport startup."," -V, --version Print the package version and exit.","","Environment:"," PM_PATH Tracker root (otherwise discovered from cwd)."," PM_GLOBAL_PATH Global settings root."," PM_MCP_PROFILE core (default), standard, full, or custom."," PM_MCP_TOOLS Comma-separated tool allowlist for custom profile."," PM_MCP_DISCOVERY_CURSOR_KEY Shared discovery cursor secret, at least 32 UTF-8 bytes."," PM_MCP_BAGGAGE_ALLOWLIST Comma-separated permitted trace baggage keys."];return e==="http"&&n.push(" PM_MCP_HTTP_HOST Bind host (default 127.0.0.1)."," PM_MCP_HTTP_PORT Bind port, 0..65535 (default 3000)."," PM_MCP_HTTP_ALLOWED_ORIGINS Comma-separated exact browser origins (default none)."," PM_MCP_HTTP_BEARER_TOKEN Deployment token for the bundled verifier."," PM_MCP_HTTP_AUTH_ISSUER Exact HTTPS authorization-server issuer."," PM_MCP_HTTP_RESOURCE Canonical resource/audience URI."," PM_MCP_HTTP_SCOPES Space-separated scopes (default pm:read pm:write).","","Non-loopback HTTP requires bearer token, issuer, and resource together."),n.push("",`MCP protocol: ${G.join(", ")}.`,e==="stdio"?`Legacy initialize compatibility: ${H.join(", ")}.`:"HTTP requires modern per-request metadata; legacy initialize is stdio-only.","",e==="stdio"?"Client configuration:":"Example loopback server:",e==="stdio"?JSON.stringify({mcpServers:{pm:{command:"npx",args:["--yes","--package",`@unbrained/pm-cli@${t}`,"pm-mcp"]}}}):`PM_MCP_HTTP_PORT=3000 npx --yes --package @unbrained/pm-cli@${t} pm-mcp-http`,...e==="http"?["HTTP client configuration:",JSON.stringify({mcpServers:{pm:{url:"http://127.0.0.1:3000/mcp"}}})]:[],"","Configuration: https://github.com/unbraind/pm-cli/blob/main/docs/MCP_REMOTE_TRANSPORT_SECURITY.md",""),n.join(`
2
2
  `)}function yn(e,t,i){if(e.length===0)return{kind:"serve"};let n=e.find(o=>!ee.has(o));if(n!==void 0){let o=t==="stdio"?"pm-mcp":"pm-mcp-http";return{kind:"exit",exitCode:64,stdout:"",stderr:`Unsupported argument ${JSON.stringify(n)}. Run ${o} --help.
3
3
  `}}return{kind:"exit",exitCode:0,stdout:e.includes("--help")||e.includes("-h")?te(t,i):`${i}
4
4
  `,stderr:""}}var f,re=Object.freeze({list:"list-item-projection","list-all":"list-item-projection","list-draft":"list-item-projection","list-open":"list-item-projection","list-in-progress":"list-item-projection","list-blocked":"list-item-projection","list-closed":"list-item-projection","list-canceled":"list-item-projection",get:"get-item-projection",graph:"graph-detail-projection",search:"search-result-projection",history:"history-entry-projection",events:"mutation-event-projection",activity:"activity-entry-projection",deps:"dependency-graph-projection",health:"health-diagnostic-projection",validate:"validation-diagnostic-projection",contracts:"contract-catalog-projection"});function oe(e,t){if(t==="--limit")return"result-row-limit";if(t==="--node-limit")return"graph-node-limit";if(t==="--edge-limit")return"graph-edge-limit";if(t==="--output-limit")return"rendered-output-row-limit";if(t==="--output-budget")return"rendered-output-byte-budget";if(t==="--token-budget")return"context-intent-token-budget";if(t==="--full"){let i=re[_(e)];if(i===void 0)throw new Error(`Command ${e} exposes --full without a registered projection concept.`);return i}return t!=="--file"?t.slice(2):["create","update","update-many"].includes(_(e))?"linked-file-path":["comments","notes","learnings"].includes(_(e))?"entry-file-input":"plan-definition-file"}function g(){if(f!==void 0)return f;let t=q.filter(({command:o})=>R(o)).flatMap(({command:o,family:s})=>D(o,I(o)).map(a=>({command:o,family:s,concept:oe(o,a.flag),flag:a.flag,aliases:Object.freeze([...a.aliases??[]]),value_kind:a.repeatable?"list":a.flag==="--limit"?"number":a.value_type}))),i=new Set(t.flatMap(o=>o.aliases.map(s=>`${o.command}:${s}`))),n=t.filter(o=>!i.has(`${o.command}:${o.flag}`)),r=new Map;for(let o of n){let s=r.get(o.concept)??new Set;s.add(o.value_kind),r.set(o.concept,s)}return f=Object.freeze(n.map(o=>Object.freeze({...o,concept:r.get(o.concept)?.size===1?o.concept:`${o.concept}@${o.command}`}))),f}function Tn(){return Object.freeze(g().map(e=>Object.freeze({command:e.command,canonical_flag:e.flag,accepted_spellings:Object.freeze([...new Set([e.flag,...e.aliases])].sort())})))}var V=Object.freeze({init:30,item:20,config:36,extension:55,package:56,packages:56,install:27,upgrade:29,create:104,copy:24,focus:22,list:86,"list-all":86,"list-draft":84,"list-open":84,"list-in-progress":84,"list-blocked":84,"list-closed":84,"list-canceled":84,aggregate:40,context:45,ctx:45,get:30,graph:34,search:78,duplicates:25,eval:25,next:38,history:36,events:34,"history-attest":23,"history-redact":27,"history-repair":28,"history-compact":30,"history-author-acknowledge":28,merge:29,schema:43,profile:22,activity:36,restore:23,update:105,"update-many":146,close:32,"close-many":72,delete:24,append:25,comments:32,notes:36,learnings:32,files:41,docs:32,deps:32,plan:111,test:58,"test-all":41,telemetry:21,stats:29,health:36,validate:46,assurance:30,gc:22,workspace:23,contracts:29,claim:40,release:25,"start-task":24,"pause-task":23,"close-task":24,meet:33,event:33,remind:29,"test-runs-worker":20}),ie=1,B=Object.freeze(Object.fromEntries(Object.entries({...V,...Object.fromEntries(O.flatMap(({alias:e,canonical:t})=>{let i=V[e];return i===void 0?[]:[[t,i]]}))}).map(([e,t])=>[e,t+ie])));function J(){let e=new Map(Object.keys(B).map(t=>[t,0]));for(let{command:t}of g())e.set(t,Number(e.get(t))+1);return Object.freeze(Object.entries(B).map(([t,i])=>Object.freeze({command:t,current:Number(e.get(t)),maximum:i})))}function ne(e,t,i){for(let n of e)for(let r of n.aliases){let o=t.get(`${n.command}:${r}`);o===void 0||o.flag===n.flag||i.push({code:"alias_collision",command:n.command,detail:`${r} aliases ${n.flag} but is canonical for ${o.flag}.`})}}function se(e,t,i){let n=new Set(t.map(({command:r})=>r));for(let r of e.keys())n.has(r)||i.push({code:"missing_budget",command:r,detail:`${r} has canonical flags but no persisted budget.`});for(let r of t){let o=e.get(r.command)??0;o===0&&i.push({code:"stale_budget",command:r.command,detail:`${r.command} has a persisted budget but no canonical flags.`}),!(o<=r.maximum)&&i.push({code:"budget_exceeded",command:r.command,detail:`${o} canonical flags exceed the ratcheted maximum ${r.maximum}.`})}}function ce(e,t,i){let n=new Map(e.map(r=>[`${r.command}:${r.flag}`,r]));for(let r of t){let o=`${r.command}:${r.canonical_flag}`,s=n.get(o);if(!s){i.push({code:"removed_canonical_spelling",command:r.command,detail:`${r.canonical_flag} disappeared from the executable spelling inventory.`});continue}let a=new Set([s.flag,...s.aliases]);for(let c of r.accepted_spellings)a.has(c)||i.push({code:"removed_compatibility_spelling",command:r.command,detail:`${c} no longer resolves to ${r.canonical_flag}.`})}}function Pn(e=g(),t=J(),i=[]){let n=[],r=new Map,o=new Map,s=new Map,a=new Map;for(let c of e){let d=`${c.command}:${c.flag}`;r.has(d)?n.push({code:"duplicate_canonical_flag",command:c.command,detail:`${c.flag} has more than one canonical row.`}):r.set(d,c),a.set(c.command,(a.get(c.command)??0)+1);let l=o.get(c.concept);l!==void 0&&l!==c.value_kind?n.push({code:"inconsistent_concept_kind",command:c.command,detail:`${c.concept} uses both ${l} and ${c.value_kind}.`}):o.set(c.concept,c.value_kind);let p=s.get(c.concept);p!==void 0&&p!==c.flag?n.push({code:"semantic_spelling_collision",command:c.command,detail:`${c.concept} is canonicalized by both ${p} and ${c.flag}.`}):s.set(c.concept,c.flag)}return ne(e,r,n),se(a,t,n),ce(e,i,n),n.sort((c,d)=>c.command.localeCompare(d.command)||c.code.localeCompare(d.code)||c.detail.localeCompare(d.detail)),{ok:n.length===0,entry_count:e.length,budget_count:t.length,concept_count:new Set(e.map(({concept:c})=>c)).size,baseline_entry_count:i.length,findings:n}}function kn(){let e=g(),t=J(),i=new Map(t.map(({command:r})=>[r,"unknown"]));for(let{command:r,family:o}of e)i.set(r,o);return["# Generated flag lexicon budgets","","This file is generated by `listPmFlagLexicon()`. Compatibility aliases do not consume canonical budget.","","| Command | Capability family | Canonical flags | Maximum |","| --- | --- | ---: | ---: |",...t.map(({command:r,current:o,maximum:s})=>{let a=i.get(r);return`| \`${r}\` | ${a} | ${o} | ${s} |`}),""].join(`
@@ -1,2 +1,2 @@
1
- import{A as We,B as ke,C as Ye,D as Xe,E as we,F as Ke,G as je,H as qe,I as Je,J as Qe,K as Ze,L as $e,O as et,b as Ie,c as _e,d as Te,e as Re,f as Oe,g as ge,h as Ce,i as Ne,j as Pe,k as xe,l as fe,m as De,n as ve,o as Ue,p as ye,q as Le,r as Me,s as Ve,t as Fe,u as he,v as ze,w as Be,x as be,y as He,z as Ge}from"./focused-chunks/chunk-AVLB4L7M.js";import"./focused-chunks/chunk-RDELKGLS.js";import"./focused-chunks/chunk-KEZ4VXYD.js";import{oa as Ee,pa as pe}from"./focused-chunks/chunk-FQWKESMI.js";import"./focused-chunks/chunk-IIP6LZ5E.js";import"./focused-chunks/chunk-IWEGGRRD.js";import"./focused-chunks/chunk-YSZZSV6M.js";import"./focused-chunks/chunk-4SX2BN4V.js";import"./focused-chunks/chunk-AIDL2ZNT.js";import"./focused-chunks/chunk-QNWNUQSJ.js";import"./focused-chunks/chunk-3GQRWIT5.js";import"./focused-chunks/chunk-RMJKVQYE.js";import"./focused-chunks/chunk-K53OIT5J.js";import{a as me}from"./focused-chunks/chunk-AAB3ZR7Z.js";import"./focused-chunks/chunk-TNVLDU7Z.js";import"./focused-chunks/chunk-NXUFVQ33.js";import"./focused-chunks/chunk-JUG3BAZZ.js";import{k as ue,l as de,m as ce,n as le,o as Ae,p as Se}from"./focused-chunks/chunk-QSRXF6XS.js";import"./focused-chunks/chunk-UA2JNKMY.js";import"./focused-chunks/chunk-FW5Q26HA.js";import"./focused-chunks/chunk-RFJ3MEFP.js";import"./focused-chunks/chunk-GQBWI4KA.js";import"./focused-chunks/chunk-YNRW2FWB.js";import"./focused-chunks/chunk-3BR5NWQI.js";import"./focused-chunks/chunk-BKPUUW5O.js";import{U as oe,V as ne,W as ie,X as se,Y as ae,j as re}from"./focused-chunks/chunk-VV2QF5IE.js";import"./focused-chunks/chunk-WHHFPATO.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{Ab as d,Ac as V,Af as j,Bb as c,Bc as F,Cb as l,Cc as h,Eb as A,Ub as S,Vb as I,Wb as _,Xb as T,Yb as R,Zb as O,ef as z,ff as B,gf as b,hf as H,hg as q,if as G,ig as J,nf as W,ng as Q,oc as g,pc as C,pg as Z,qc as N,qg as $,rc as P,rf as k,rg as ee,sc as x,sg as te,tc as f,tf as Y,uc as D,vc as v,vf as X,wc as U,wf as w,xb as p,xc as y,yb as u,yc as L,zc as M,zf as K}from"./focused-chunks/chunk-NSFS3VWP.js";import{u as E}from"./focused-chunks/chunk-R6QFPHWW.js";import{a as e,b as t,c as r,h as o,j as n,k as i,l as s}from"./focused-chunks/chunk-OCKKIECS.js";import{A as m,z as a}from"./focused-chunks/chunk-NGFDPEP7.js";export{g as AGENT_PROVENANCE_DIMENSIONS,p as BASELINE_ITEM_FORMAT_VERSION,N as BUILTIN_AGENT_PROVENANCE_ADAPTERS,C as BUILTIN_HARNESS_SIGNAL_DESCRIPTORS,e as BUILTIN_ITEM_TYPE_VALUES,s as CONFIDENCE_TEXT_VALUES,u as CURRENT_ITEM_FORMAT_VERSION,o as DEPENDENCY_KIND_VALUES,a as EXIT_CODE,i as ISSUE_SEVERITY_VALUES,t as ITEM_TYPE_VALUES,ne as PM_CLI_EXPECTED_ERROR_NAME,b as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,z as PM_READ_OUTPUT_DIMENSIONS,B as PM_READ_OUTPUT_OPTION_FLAGS,H as PM_READ_OUTPUT_SURFACE_CONTRACTS,m as PmCliError,xe as PmClient,n as RISK_VALUES,Ae as SEMANTIC_ATTRIBUTION_LIMITS,r as STATUS_VALUES,O as agentSessionEnvironment,Me as aggregate,Te as analyzeAgentProvenanceDescriptorCoverage,me as analyzeSdkCliParameterCompleteness,We as append,Y as applyReadOutputDimensions,$ as applyReadOutputSessionReferences,J as assertWellFormedOutputText,ee as attachReadOutputSessionReceipt,_ as boundAgentEpisodeIdentity,I as canonicalDocument,Ke as claim,je as claimNext,l as classifyItemFormatVersion,we as close,Ve as comments,fe as context,Je as copy,ke as create,se as createPmCliExpectedError,j as decodeReadOutputContinuationCursor,Qe as deleteItem,He as deps,y as detectAgentIdentity,F as detectHarnessIdentity,L as diagnoseAgentIdentity,be as docs,d as effectiveItemFormatVersion,Pe as emptyImportedDocument,K as encodeReadOutputContinuationCursor,ge as evaluateSemanticAttributionCoverage,pe as explainSourceTraceability,ze as files,Be as filesDiscover,$e as focus,ye as get,Ge as graph,Ce as groupHistoryByEpisode,Ie as isAlreadyClaimedError,ie as isItemAlreadyExistsError,ae as isPmCliExpectedError,oe as isPmTokenBudgetRecovery,X as isReadOutputBudgetExceeded,Q as isReadOutputSessionReference,he as learnings,De as list,x as listAgentProvenanceAdapters,ve as listAllComplete,Le as next,D as normalizeAgentProvenanceAdapterValue,c as normalizeItemFormatVersion,re as normalizeItemId,A as normalizeStatusInput,Fe as notes,E as nowIso,Z as parseReadOutputSession,Ee as parseSourceLineRange,M as readAuthorEnvironment,te as readOutputSessionRemainingTokens,de as recordClaimSemanticAttribution,le as recordFocusSemanticAttribution,ce as recordReleaseSemanticAttribution,f as registerAgentProvenanceAdapters,P as registerHarnessSignalDescriptors,qe as release,Xe as reopen,T as resolveAgentSessionContextFromSignals,h as resolveAuthorIdentity,_e as resolveHistoryEpisodeGroupIdentity,k as resolveReadOutputDimensions,w as resolveReadOutputEncoding,G as resolveReadOutputSurface,ue as resolveSemanticLineageIds,Ze as restore,et as runAction,R as runWithAgentSessionContext,v as runWithHarnessDetectionSignals,U as runWithWorkspaceHarnessSignalDescriptors,Ue as search,Se as semanticAttributionAffinity,S as serializeItemDocument,Re as summarizeAgentModelProvenance,Oe as summarizeAgentProvenance,q as toWellFormedText,Ye as update,Ne as updateLinkedTest,W as validateReadOutputOptions,V as writeAuthorEnvironment};
1
+ import{A as We,B as ke,C as Ye,D as Xe,E as we,F as Ke,G as je,H as qe,I as Je,J as Qe,K as Ze,L as $e,O as et,b as Ie,c as _e,d as Te,e as Re,f as Oe,g as ge,h as Ce,i as Ne,j as Pe,k as xe,l as fe,m as De,n as ve,o as Ue,p as ye,q as Le,r as Me,s as Ve,t as Fe,u as he,v as ze,w as Be,x as be,y as He,z as Ge}from"./focused-chunks/chunk-2XGHBYDA.js";import"./focused-chunks/chunk-4HLZOOZI.js";import"./focused-chunks/chunk-AN4NFFLL.js";import{oa as Ee,pa as pe}from"./focused-chunks/chunk-UGQ2EXTU.js";import"./focused-chunks/chunk-IIP6LZ5E.js";import"./focused-chunks/chunk-GISZWMBS.js";import"./focused-chunks/chunk-N7ZAMULP.js";import"./focused-chunks/chunk-4SX2BN4V.js";import"./focused-chunks/chunk-AIDL2ZNT.js";import"./focused-chunks/chunk-7FKGIJEB.js";import"./focused-chunks/chunk-GUAT4OAC.js";import"./focused-chunks/chunk-I4GY7HAP.js";import"./focused-chunks/chunk-K53OIT5J.js";import{a as me}from"./focused-chunks/chunk-24W63UPP.js";import"./focused-chunks/chunk-REORRDPH.js";import"./focused-chunks/chunk-HSWL6L2O.js";import"./focused-chunks/chunk-3QRMY6KF.js";import{k as ue,l as de,m as ce,n as le,o as Ae,p as Se}from"./focused-chunks/chunk-7GZMOLQY.js";import"./focused-chunks/chunk-KMG4O2IU.js";import"./focused-chunks/chunk-B2HJI6KA.js";import"./focused-chunks/chunk-52PHSTGP.js";import"./focused-chunks/chunk-AL47ODFZ.js";import"./focused-chunks/chunk-C2HW7BSE.js";import"./focused-chunks/chunk-H4JBS477.js";import"./focused-chunks/chunk-BKPUUW5O.js";import{U as oe,V as ne,W as ie,X as se,Y as ae,j as re}from"./focused-chunks/chunk-ZZYJS74B.js";import"./focused-chunks/chunk-SXWUKNTY.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{Ab as d,Ac as V,Af as j,Bb as c,Bc as F,Cb as l,Cc as h,Eb as A,Ub as S,Vb as I,Wb as _,Xb as T,Yb as R,Zb as O,ef as z,ff as B,gf as b,hf as H,hg as q,if as G,ig as J,nf as W,ng as Q,oc as g,pc as C,pg as Z,qc as N,qg as $,rc as P,rf as k,rg as ee,sc as x,sg as te,tc as f,tf as Y,uc as D,vc as v,vf as X,wc as U,wf as w,xb as p,xc as y,yb as u,yc as L,zc as M,zf as K}from"./focused-chunks/chunk-HGJ4MILN.js";import{u as E}from"./focused-chunks/chunk-YPOATPTX.js";import{a as e,b as t,c as r,h as o,j as n,k as i,l as s}from"./focused-chunks/chunk-OCKKIECS.js";import{A as m,z as a}from"./focused-chunks/chunk-NGFDPEP7.js";export{g as AGENT_PROVENANCE_DIMENSIONS,p as BASELINE_ITEM_FORMAT_VERSION,N as BUILTIN_AGENT_PROVENANCE_ADAPTERS,C as BUILTIN_HARNESS_SIGNAL_DESCRIPTORS,e as BUILTIN_ITEM_TYPE_VALUES,s as CONFIDENCE_TEXT_VALUES,u as CURRENT_ITEM_FORMAT_VERSION,o as DEPENDENCY_KIND_VALUES,a as EXIT_CODE,i as ISSUE_SEVERITY_VALUES,t as ITEM_TYPE_VALUES,ne as PM_CLI_EXPECTED_ERROR_NAME,b as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,z as PM_READ_OUTPUT_DIMENSIONS,B as PM_READ_OUTPUT_OPTION_FLAGS,H as PM_READ_OUTPUT_SURFACE_CONTRACTS,m as PmCliError,xe as PmClient,n as RISK_VALUES,Ae as SEMANTIC_ATTRIBUTION_LIMITS,r as STATUS_VALUES,O as agentSessionEnvironment,Me as aggregate,Te as analyzeAgentProvenanceDescriptorCoverage,me as analyzeSdkCliParameterCompleteness,We as append,Y as applyReadOutputDimensions,$ as applyReadOutputSessionReferences,J as assertWellFormedOutputText,ee as attachReadOutputSessionReceipt,_ as boundAgentEpisodeIdentity,I as canonicalDocument,Ke as claim,je as claimNext,l as classifyItemFormatVersion,we as close,Ve as comments,fe as context,Je as copy,ke as create,se as createPmCliExpectedError,j as decodeReadOutputContinuationCursor,Qe as deleteItem,He as deps,y as detectAgentIdentity,F as detectHarnessIdentity,L as diagnoseAgentIdentity,be as docs,d as effectiveItemFormatVersion,Pe as emptyImportedDocument,K as encodeReadOutputContinuationCursor,ge as evaluateSemanticAttributionCoverage,pe as explainSourceTraceability,ze as files,Be as filesDiscover,$e as focus,ye as get,Ge as graph,Ce as groupHistoryByEpisode,Ie as isAlreadyClaimedError,ie as isItemAlreadyExistsError,ae as isPmCliExpectedError,oe as isPmTokenBudgetRecovery,X as isReadOutputBudgetExceeded,Q as isReadOutputSessionReference,he as learnings,De as list,x as listAgentProvenanceAdapters,ve as listAllComplete,Le as next,D as normalizeAgentProvenanceAdapterValue,c as normalizeItemFormatVersion,re as normalizeItemId,A as normalizeStatusInput,Fe as notes,E as nowIso,Z as parseReadOutputSession,Ee as parseSourceLineRange,M as readAuthorEnvironment,te as readOutputSessionRemainingTokens,de as recordClaimSemanticAttribution,le as recordFocusSemanticAttribution,ce as recordReleaseSemanticAttribution,f as registerAgentProvenanceAdapters,P as registerHarnessSignalDescriptors,qe as release,Xe as reopen,T as resolveAgentSessionContextFromSignals,h as resolveAuthorIdentity,_e as resolveHistoryEpisodeGroupIdentity,k as resolveReadOutputDimensions,w as resolveReadOutputEncoding,G as resolveReadOutputSurface,ue as resolveSemanticLineageIds,Ze as restore,et as runAction,R as runWithAgentSessionContext,v as runWithHarnessDetectionSignals,U as runWithWorkspaceHarnessSignalDescriptors,Ue as search,Se as semanticAttributionAffinity,S as serializeItemDocument,Re as summarizeAgentModelProvenance,Oe as summarizeAgentProvenance,q as toWellFormedText,Ye as update,Ne as updateLinkedTest,W as validateReadOutputOptions,V as writeAuthorEnvironment};
2
2
  //# sourceMappingURL=sdk-core.js.map
@@ -1,2 +1,2 @@
1
- import{$a as Lt,Aa as qt,Ba as Mt,Ca as Nt,Da as jt,E as ot,Ea as Rt,F as at,Fa as Jt,Fb as Qt,G as st,Gb as Vt,H as ft,Hb as Xt,I as pt,Ib as Yt,Jb as Zt,Kb as $t,Lb as er,Mb as tr,Nb as rr,Ob as ir,Pb as nr,Qb as y,Rb as or,Sb as ar,Tb as sr,Ub as fr,Vb as pr,Wb as cr,Xa as Ft,Xb as dr,Yb as _,a as je,ab as Pt,b as Re,ba as ct,bb as Ut,c as Je,ca as dt,cb as Wt,d as Fe,da as mt,db as Bt,e as Le,ea as lt,eb as Ct,f as Pe,fa as ut,fb as Gt,g as Ue,ga as gt,gb as Ht,h as We,ha as wt,hb as Kt,i as Be,ia as ht,j as Ce,ja as xt,k as Ge,l as He,m as Ke,n as Qe,o as Ve,p as Xe,q as Ye,r as Ze,s as $e,t as et,ta as Tt,u as tt,ua as It,v as rt,va as kt,w as it,wa as At,x as nt,xa as Ot,ya as zt,za as Dt}from"./focused-chunks/chunk-FQWKESMI.js";import"./focused-chunks/chunk-IIP6LZ5E.js";import"./focused-chunks/chunk-IWEGGRRD.js";import"./focused-chunks/chunk-YSZZSV6M.js";import"./focused-chunks/chunk-4SX2BN4V.js";import"./focused-chunks/chunk-AIDL2ZNT.js";import"./focused-chunks/chunk-QNWNUQSJ.js";import"./focused-chunks/chunk-3GQRWIT5.js";import"./focused-chunks/chunk-RMJKVQYE.js";import{a as Ne}from"./focused-chunks/chunk-K53OIT5J.js";import"./focused-chunks/chunk-AAB3ZR7Z.js";import{B as W,C as B,D as C,E as G,F as H,G as K,K as Q,L as V,M as X,N as Y,O as Z,P as $,Q as ee,R as te}from"./focused-chunks/chunk-TNVLDU7Z.js";import"./focused-chunks/chunk-JUG3BAZZ.js";import{T as yt,U as _t,V as Et,W as vt,X as bt,Y as St}from"./focused-chunks/chunk-UA2JNKMY.js";import"./focused-chunks/chunk-FW5Q26HA.js";import{Ab as Te,Bb as Ie,Cb as ke,Db as Ae,Eb as Oe,Fb as ze,Gb as De,Hb as qe,Ib as Me,db as ie,eb as ne,fb as oe,gb as ae,hb as se,ib as fe,jb as pe,kb as ce,lb as de,mb as me,nb as le,ob as ue,pb as ge,qb as we,sb as he,tb as xe,ub as ye,vb as _e,wb as Ee,xb as ve,yb as be,zb as Se}from"./focused-chunks/chunk-RFJ3MEFP.js";import"./focused-chunks/chunk-GQBWI4KA.js";import"./focused-chunks/chunk-YNRW2FWB.js";import"./focused-chunks/chunk-3BR5NWQI.js";import"./focused-chunks/chunk-BKPUUW5O.js";import{s as re}from"./focused-chunks/chunk-VV2QF5IE.js";import"./focused-chunks/chunk-WHHFPATO.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{cb as R,da as T,ea as I,fa as k,ga as A,ha as O,ia as z,ja as D,ka as q,la as M,ma as N,na as j,sb as J,tb as F,ub as L,vb as P,wb as U}from"./focused-chunks/chunk-NSFS3VWP.js";import{w as h}from"./focused-chunks/chunk-R6QFPHWW.js";import"./focused-chunks/chunk-OCKKIECS.js";import"./focused-chunks/chunk-NGFDPEP7.js";function m(e){if(typeof e!="string"||!h(e))throw new TypeError("Invalid reliability timestamp.");return Date.parse(e)}function E(e){let o=m(e.window_start),t=m(e.window_end);if(o>=t||!Number.isFinite(e.max_failure_rate)||e.max_failure_rate<0||e.max_failure_rate>=1||!Number.isSafeInteger(e.min_completed_attempts)||e.min_completed_attempts<1)throw new TypeError("Invalid reliability window policy.");if(e.families.length===0||e.families.some(r=>typeof r!="string"||r.trim().length===0)||new Set(e.families).size!==e.families.length)throw new TypeError("Expected unique, nonempty reliability families.");return{start:o,end:t}}function v(e,o,t,r){let a=new Map(o.map(i=>[i,[]])),c=new Set;for(let i of e){if(typeof i.id!="string"||i.id.trim().length===0||c.has(i.id))throw new TypeError("Invalid or duplicate reliability attempt identity.");c.add(i.id);let p=a.get(i.family);if(!p||!["success","failure","pending"].includes(i.outcome)||i.cause!==void 0&&(!["product","infrastructure","unknown"].includes(i.cause)||i.outcome!=="failure"))throw new TypeError("Invalid reliability attempt family, outcome or cause.");let f=m(i.started_at);if(i.repaired_at!==void 0&&(m(i.repaired_at)<f||i.outcome!=="failure"))throw new TypeError("Invalid reliability repair chronology.");f>=t&&f<r&&p.push(i)}return a}function lr(e,o){let{start:t,end:r}=E(o),c=[...v(e,o.families,t,r)].map(([i,p])=>{let f=p.filter(s=>s.outcome==="failure"),n=p.filter(s=>s.outcome!=="pending").length,l=n===0?null:f.length/n,u=f.filter(s=>s.repaired_at!==void 0&&m(s.repaired_at)<r),g={product:0,infrastructure:0,unknown:0};for(let s of f)g[s.cause??"unknown"]+=1;let d=[];return n<o.min_completed_attempts&&d.push("insufficient_completed_attempts"),l!==null&&l>o.max_failure_rate&&d.push("failure_rate"),{family:i,attempts:p.length,completed:n,failed:f.length,pending:p.length-n,failure_rate:l,affected_days:[...new Set(f.map(s=>new Date(m(s.started_at)).toISOString().slice(0,10)))].sort(),repair_minutes:u.map(s=>(m(s.repaired_at)-m(s.started_at))/6e4).sort((s,x)=>s-x),unresolved:f.length-u.length,causes:g,violations:d,ok:d.length===0}});return{schema:"pm-reliability-window/1",window_start:new Date(t).toISOString(),window_end:new Date(r).toISOString(),ok:c.every(i=>i.ok),families:c}}function w(e){return typeof e=="string"&&e.length>0&&e.trim()===e}function b(e){if(!Array.isArray(e)||e.length<2)throw new TypeError("Expected at least two artifact ledgers.");let o=new Map;for(let t of e){if(t===null||typeof t!="object"||!w(t.name)||o.has(t.name)||t.complete!==!0)throw new TypeError("Expected unique complete artifact ledgers.");if(!Array.isArray(t.identities))throw new TypeError("Invalid or duplicate artifact identity.");let r=new Set(t.identities);if(r.size!==t.identities.length||[...r].some(a=>!w(a)))throw new TypeError("Invalid or duplicate artifact identity.");o.set(t.name,r)}if([...o.values()].every(t=>t.size===0))throw new TypeError("Empty inventories cannot establish artifact reconciliation.");return o}function S(e,o){if(!Array.isArray(e))throw new TypeError("Expected unique evidence-backed artifact exceptions.");let t=new Map;for(let r of e){if(r===null||typeof r!="object"||!w(r.identity)||t.has(r.identity)||!w(r.reason)||!w(r.evidence))throw new TypeError("Expected unique evidence-backed artifact exceptions.");let a=r.missing_from;if(!Array.isArray(a)||a.length===0||a.length>=o.length||new Set(a).size!==a.length||[...a].some(c=>!o.includes(c)))throw new TypeError("Invalid artifact exception ledger signature.");t.set(r.identity,r)}return t}function gr(e,o=[]){let t=b(e),r=[...t.keys()].sort(),a=S(o,r),c=[...new Set([...t.values()].flatMap(n=>[...n]))].sort(),i=[],p=new Set;for(let n of c){let l=r.filter(d=>!t.get(d).has(n));if(l.length===0)continue;let u=a.get(n),g=u!==void 0&&JSON.stringify([...u.missing_from].sort())===JSON.stringify(l);g&&p.add(n),i.push({identity:n,present_in:r.filter(d=>t.get(d).has(n)),missing_from:l,disposition:g?{reason:u.reason,evidence:u.evidence}:null})}let f=[...a.keys()].filter(n=>!p.has(n)).sort();return{schema:"pm-artifact-ledgers/1",ok:i.every(n=>n.disposition!==null)&&f.length===0,counts:Object.fromEntries(r.map(n=>[n,t.get(n).size])),findings:i,stale_exceptions:f}}export{er as ASSURANCE_ACTIONS,tr as ASSURANCE_DECLARATION_KINDS,Pe as ASSURANCE_DOCUMENT_VERSION,Ue as ASSURANCE_GATE_TRIGGERS,We as ASSURANCE_MEASUREMENT_SOURCE_KINDS,Tt as ASSURANCE_PRESET_IDS,Re as AssuranceEvaluationRefusalError,je as AssuranceMutationRefusalError,Je as AssuranceSourceResolutionError,W as BOUNDARY_FIXTURE_CAPTURE_SOURCES,L as CURRENT_HISTORY_HASH_ALGORITHM,Q as DEFECT_ESCAPE_CLASSES,V as DEFECT_GATE_EVIDENCE_DISPOSITIONS,$ as DefectRecurrencePolicyParseError,ct as HISTORY_AUTHOR_ATTRIBUTION_BASELINE,J as HISTORY_HASH_ALGORITHMS,jt as IN_PROGRESS_WORK_DETAIL_LIMIT,F as LEGACY_HISTORY_HASH_ALGORITHM,B as MAX_WAIVER_NOTICE_DAYS,I as MAX_WORKFLOW_POLICIES,k as MAX_WORKFLOW_POLICY_TERMS,Ne as PM_HISTORY_ATTESTATION_CONTRACT,ie as PM_MUTATION_ACTION_CONTRACTS,ae as SECRET_GUARD_RULE_CATEGORIES,he as STALE_WORK_THRESHOLD_SETTING,xe as UNPROVEN_ACTIVITY_REASONS,T as WORKFLOW_POLICY_ACTIONS,at as WORKFLOW_POLICY_DOCUMENT_SCHEMA,ot as WORKFLOW_POLICY_SCHEMA,Wt as _testOnlyHealthCommand,_t as _testOnlySimilarity,Vt as _testOnlyValidateCommand,dr as _testOnlyWorkspacePosition,Ot as acceptAssuranceProposals,xt as acknowledgeUnknownAuthorHistoryEvents,ht as acknowledgeUnknownAuthorHistoryEventsFromTransport,Y as analyzeDefectChangeRisk,$t as analyzeDefectRecurrenceCoverage,vt as analyzeDuplicateItems,kt as applyAssurancePreset,Gt as applyClosureTimestampFix,Be as assuranceAssertionUpdateIsLoosening,X as buildDefectRecurrenceIndex,Rt as buildInProgressSweepCommands,Jt as buildInProgressWorkHealthSummary,Ht as buildLinkedFileRepairReport,Pt as buildStatusRoleWarnings,st as buildWorkflowCompletenessCheck,dt as classifyHistoryAuthorEvent,It as createAssurancePreset,Yt as createAssuranceWorkspaceContext,Qe as createEmptyAssuranceDocument,ft as createLifecycleCompletenessPolicies,j as createWorkflowPolicyEvaluator,fe as decideSecretGuardFinding,At as deriveAssuranceProposals,Bt as deriveClosureTimestamp,Xe as evaluateAssuranceAssertion,Ye as evaluateAssuranceGate,K as evaluateBoundaryFixtures,Z as evaluateDefectGateEvidence,Ve as evaluateMeasurement,oe as evaluateMutationGuard,lr as evaluateReliabilityWindow,St as evaluateSimilarityGovernance,N as evaluateWorkflowPolicies,ar as exportAttestation,bt as findDuplicateClusters,Et as findSimilarItems,cr as formatWorkspacePositionHuman,$e as getAssuranceDeclaration,de as getMutationActionContract,U as historyDigest,mt as inspectHistoryAuthorStream,be as inspectInProgressWork,Se as inspectStaleInProgressItems,Lt as inspectStatusRoleAssignments,Ie as isJudgeableHistoryRecord,pe as isMutationAction,C as isWaiverNoticeDays,Te as isWellFormedHistoryRecord,R as jaccardSimilarity,Oe as latestHistoryTimestamp,Ze as listAssuranceDeclarations,nt as listAssuranceVerdicts,Mt as listInvalidProvenanceHistoryStreamIds,ce as listMutationActions,Le as normalizeAssuranceEvaluation,Fe as normalizeAssuranceMutation,qt as normalizeInvalidHistoryProvenance,me as normalizeSimilarityText,ye as normalizeStaleWorkThresholdHours,te as parseDefectChangeRiskRequest,Zt as parseDefectRecurrenceCoverageRequest,ee as parseDefectRecurrencePolicy,or as parseHistoryAttestation,wt as parseUnknownAuthorHistoryEventCoordinates,A as parseWorkflowPolicy,O as parseWorkflowPolicyDocument,ut as planUnknownAuthorHistoryAcknowledgment,ue as prepareSimilarityText,Qt as projectValidateCounts,zt as promoteAssuranceAssertion,et as putAssuranceDeclaration,tt as putAssuranceDeclarationBundle,De as readLatestHistoryActivity,re as readWorkflowPolicies,z as readWorkflowPolicyField,pr as readWorkspacePosition,gr as reconcileArtifactLedgers,it as recordAssuranceVerdict,Ae as recordedBaselineActivity,ze as recordedPrefixActivity,rt as removeAssuranceDeclaration,P as resolveHistoryHashAlgorithm,_e as resolveLastActivityAt,gt as resolveUnknownAuthorAcknowledgmentSelector,rr as runAssuranceAction,ir as runAssuranceDispatch,nr as runGc,Ut as runHealth,fr as runHistoryAttest,Ft as runHistoryMaintenance,_ as runReindex,y as runUpgrade,Xt as runValidate,pt as runWorkflowPolicyAction,Ct as scanClosureTimestamps,Dt as scanExtensionHostVersions,lt as scanHistoryAuthorAttribution,qe as scanInProgressWork,ne as scanMutationSecrets,Nt as scanProvenanceResolverHealth,Me as scanStaleInProgressItems,Kt as scanStorageIntegrity,ge as scoreItemSimilarity,we as scorePreparedItemSimilarity,se as secretGuardRuleCategory,yt as similarityAdvisoryWarnings,H as sortWaiverNotices,ve as staleEligibleAt,le as tokenizeSimilarityText,ke as unprovenClaimActivity,Ge as validateAssertionDefinition,Ke as validateAssuranceDocument,He as validateGateDefinition,Ce as validateMeasurementDefinition,sr as verifyAttestation,G as waiverNoticeFor,Ee as wholeHoursSince,q as workflowApprovalFingerprint,M as workflowPolicyApplies,D as workflowPolicyFingerprint};
1
+ import{$a as Lt,Aa as qt,Ba as Mt,Ca as Nt,Da as jt,E as ot,Ea as Rt,F as at,Fa as Jt,Fb as Qt,G as st,Gb as Vt,H as ft,Hb as Xt,I as pt,Ib as Yt,Jb as Zt,Kb as $t,Lb as er,Mb as tr,Nb as rr,Ob as ir,Pb as nr,Qb as y,Rb as or,Sb as ar,Tb as sr,Ub as fr,Vb as pr,Wb as cr,Xa as Ft,Xb as dr,Yb as _,a as je,ab as Pt,b as Re,ba as ct,bb as Ut,c as Je,ca as dt,cb as Wt,d as Fe,da as mt,db as Bt,e as Le,ea as lt,eb as Ct,f as Pe,fa as ut,fb as Gt,g as Ue,ga as gt,gb as Ht,h as We,ha as wt,hb as Kt,i as Be,ia as ht,j as Ce,ja as xt,k as Ge,l as He,m as Ke,n as Qe,o as Ve,p as Xe,q as Ye,r as Ze,s as $e,t as et,ta as Tt,u as tt,ua as It,v as rt,va as kt,w as it,wa as At,x as nt,xa as Ot,ya as zt,za as Dt}from"./focused-chunks/chunk-UGQ2EXTU.js";import"./focused-chunks/chunk-IIP6LZ5E.js";import"./focused-chunks/chunk-GISZWMBS.js";import"./focused-chunks/chunk-N7ZAMULP.js";import"./focused-chunks/chunk-4SX2BN4V.js";import"./focused-chunks/chunk-AIDL2ZNT.js";import"./focused-chunks/chunk-7FKGIJEB.js";import"./focused-chunks/chunk-GUAT4OAC.js";import"./focused-chunks/chunk-I4GY7HAP.js";import{a as Ne}from"./focused-chunks/chunk-K53OIT5J.js";import"./focused-chunks/chunk-24W63UPP.js";import{B as W,C as B,D as C,E as G,F as H,G as K,K as Q,L as V,M as X,N as Y,O as Z,P as $,Q as ee,R as te}from"./focused-chunks/chunk-REORRDPH.js";import"./focused-chunks/chunk-3QRMY6KF.js";import{T as yt,U as _t,V as Et,W as vt,X as bt,Y as St}from"./focused-chunks/chunk-KMG4O2IU.js";import"./focused-chunks/chunk-B2HJI6KA.js";import{Ab as Te,Bb as Ie,Cb as ke,Db as Ae,Eb as Oe,Fb as ze,Gb as De,Hb as qe,Ib as Me,db as ie,eb as ne,fb as oe,gb as ae,hb as se,ib as fe,jb as pe,kb as ce,lb as de,mb as me,nb as le,ob as ue,pb as ge,qb as we,sb as he,tb as xe,ub as ye,vb as _e,wb as Ee,xb as ve,yb as be,zb as Se}from"./focused-chunks/chunk-52PHSTGP.js";import"./focused-chunks/chunk-AL47ODFZ.js";import"./focused-chunks/chunk-C2HW7BSE.js";import"./focused-chunks/chunk-H4JBS477.js";import"./focused-chunks/chunk-BKPUUW5O.js";import{s as re}from"./focused-chunks/chunk-ZZYJS74B.js";import"./focused-chunks/chunk-SXWUKNTY.js";import"./focused-chunks/chunk-BWOVFE5B.js";import"./focused-chunks/chunk-X6CXWWNB.js";import{cb as R,da as T,ea as I,fa as k,ga as A,ha as O,ia as z,ja as D,ka as q,la as M,ma as N,na as j,sb as J,tb as F,ub as L,vb as P,wb as U}from"./focused-chunks/chunk-HGJ4MILN.js";import{w as h}from"./focused-chunks/chunk-YPOATPTX.js";import"./focused-chunks/chunk-OCKKIECS.js";import"./focused-chunks/chunk-NGFDPEP7.js";function m(e){if(typeof e!="string"||!h(e))throw new TypeError("Invalid reliability timestamp.");return Date.parse(e)}function E(e){let o=m(e.window_start),t=m(e.window_end);if(o>=t||!Number.isFinite(e.max_failure_rate)||e.max_failure_rate<0||e.max_failure_rate>=1||!Number.isSafeInteger(e.min_completed_attempts)||e.min_completed_attempts<1)throw new TypeError("Invalid reliability window policy.");if(e.families.length===0||e.families.some(r=>typeof r!="string"||r.trim().length===0)||new Set(e.families).size!==e.families.length)throw new TypeError("Expected unique, nonempty reliability families.");return{start:o,end:t}}function v(e,o,t,r){let a=new Map(o.map(i=>[i,[]])),c=new Set;for(let i of e){if(typeof i.id!="string"||i.id.trim().length===0||c.has(i.id))throw new TypeError("Invalid or duplicate reliability attempt identity.");c.add(i.id);let p=a.get(i.family);if(!p||!["success","failure","pending"].includes(i.outcome)||i.cause!==void 0&&(!["product","infrastructure","unknown"].includes(i.cause)||i.outcome!=="failure"))throw new TypeError("Invalid reliability attempt family, outcome or cause.");let f=m(i.started_at);if(i.repaired_at!==void 0&&(m(i.repaired_at)<f||i.outcome!=="failure"))throw new TypeError("Invalid reliability repair chronology.");f>=t&&f<r&&p.push(i)}return a}function lr(e,o){let{start:t,end:r}=E(o),c=[...v(e,o.families,t,r)].map(([i,p])=>{let f=p.filter(s=>s.outcome==="failure"),n=p.filter(s=>s.outcome!=="pending").length,l=n===0?null:f.length/n,u=f.filter(s=>s.repaired_at!==void 0&&m(s.repaired_at)<r),g={product:0,infrastructure:0,unknown:0};for(let s of f)g[s.cause??"unknown"]+=1;let d=[];return n<o.min_completed_attempts&&d.push("insufficient_completed_attempts"),l!==null&&l>o.max_failure_rate&&d.push("failure_rate"),{family:i,attempts:p.length,completed:n,failed:f.length,pending:p.length-n,failure_rate:l,affected_days:[...new Set(f.map(s=>new Date(m(s.started_at)).toISOString().slice(0,10)))].sort(),repair_minutes:u.map(s=>(m(s.repaired_at)-m(s.started_at))/6e4).sort((s,x)=>s-x),unresolved:f.length-u.length,causes:g,violations:d,ok:d.length===0}});return{schema:"pm-reliability-window/1",window_start:new Date(t).toISOString(),window_end:new Date(r).toISOString(),ok:c.every(i=>i.ok),families:c}}function w(e){return typeof e=="string"&&e.length>0&&e.trim()===e}function b(e){if(!Array.isArray(e)||e.length<2)throw new TypeError("Expected at least two artifact ledgers.");let o=new Map;for(let t of e){if(t===null||typeof t!="object"||!w(t.name)||o.has(t.name)||t.complete!==!0)throw new TypeError("Expected unique complete artifact ledgers.");if(!Array.isArray(t.identities))throw new TypeError("Invalid or duplicate artifact identity.");let r=new Set(t.identities);if(r.size!==t.identities.length||[...r].some(a=>!w(a)))throw new TypeError("Invalid or duplicate artifact identity.");o.set(t.name,r)}if([...o.values()].every(t=>t.size===0))throw new TypeError("Empty inventories cannot establish artifact reconciliation.");return o}function S(e,o){if(!Array.isArray(e))throw new TypeError("Expected unique evidence-backed artifact exceptions.");let t=new Map;for(let r of e){if(r===null||typeof r!="object"||!w(r.identity)||t.has(r.identity)||!w(r.reason)||!w(r.evidence))throw new TypeError("Expected unique evidence-backed artifact exceptions.");let a=r.missing_from;if(!Array.isArray(a)||a.length===0||a.length>=o.length||new Set(a).size!==a.length||[...a].some(c=>!o.includes(c)))throw new TypeError("Invalid artifact exception ledger signature.");t.set(r.identity,r)}return t}function gr(e,o=[]){let t=b(e),r=[...t.keys()].sort(),a=S(o,r),c=[...new Set([...t.values()].flatMap(n=>[...n]))].sort(),i=[],p=new Set;for(let n of c){let l=r.filter(d=>!t.get(d).has(n));if(l.length===0)continue;let u=a.get(n),g=u!==void 0&&JSON.stringify([...u.missing_from].sort())===JSON.stringify(l);g&&p.add(n),i.push({identity:n,present_in:r.filter(d=>t.get(d).has(n)),missing_from:l,disposition:g?{reason:u.reason,evidence:u.evidence}:null})}let f=[...a.keys()].filter(n=>!p.has(n)).sort();return{schema:"pm-artifact-ledgers/1",ok:i.every(n=>n.disposition!==null)&&f.length===0,counts:Object.fromEntries(r.map(n=>[n,t.get(n).size])),findings:i,stale_exceptions:f}}export{er as ASSURANCE_ACTIONS,tr as ASSURANCE_DECLARATION_KINDS,Pe as ASSURANCE_DOCUMENT_VERSION,Ue as ASSURANCE_GATE_TRIGGERS,We as ASSURANCE_MEASUREMENT_SOURCE_KINDS,Tt as ASSURANCE_PRESET_IDS,Re as AssuranceEvaluationRefusalError,je as AssuranceMutationRefusalError,Je as AssuranceSourceResolutionError,W as BOUNDARY_FIXTURE_CAPTURE_SOURCES,L as CURRENT_HISTORY_HASH_ALGORITHM,Q as DEFECT_ESCAPE_CLASSES,V as DEFECT_GATE_EVIDENCE_DISPOSITIONS,$ as DefectRecurrencePolicyParseError,ct as HISTORY_AUTHOR_ATTRIBUTION_BASELINE,J as HISTORY_HASH_ALGORITHMS,jt as IN_PROGRESS_WORK_DETAIL_LIMIT,F as LEGACY_HISTORY_HASH_ALGORITHM,B as MAX_WAIVER_NOTICE_DAYS,I as MAX_WORKFLOW_POLICIES,k as MAX_WORKFLOW_POLICY_TERMS,Ne as PM_HISTORY_ATTESTATION_CONTRACT,ie as PM_MUTATION_ACTION_CONTRACTS,ae as SECRET_GUARD_RULE_CATEGORIES,he as STALE_WORK_THRESHOLD_SETTING,xe as UNPROVEN_ACTIVITY_REASONS,T as WORKFLOW_POLICY_ACTIONS,at as WORKFLOW_POLICY_DOCUMENT_SCHEMA,ot as WORKFLOW_POLICY_SCHEMA,Wt as _testOnlyHealthCommand,_t as _testOnlySimilarity,Vt as _testOnlyValidateCommand,dr as _testOnlyWorkspacePosition,Ot as acceptAssuranceProposals,xt as acknowledgeUnknownAuthorHistoryEvents,ht as acknowledgeUnknownAuthorHistoryEventsFromTransport,Y as analyzeDefectChangeRisk,$t as analyzeDefectRecurrenceCoverage,vt as analyzeDuplicateItems,kt as applyAssurancePreset,Gt as applyClosureTimestampFix,Be as assuranceAssertionUpdateIsLoosening,X as buildDefectRecurrenceIndex,Rt as buildInProgressSweepCommands,Jt as buildInProgressWorkHealthSummary,Ht as buildLinkedFileRepairReport,Pt as buildStatusRoleWarnings,st as buildWorkflowCompletenessCheck,dt as classifyHistoryAuthorEvent,It as createAssurancePreset,Yt as createAssuranceWorkspaceContext,Qe as createEmptyAssuranceDocument,ft as createLifecycleCompletenessPolicies,j as createWorkflowPolicyEvaluator,fe as decideSecretGuardFinding,At as deriveAssuranceProposals,Bt as deriveClosureTimestamp,Xe as evaluateAssuranceAssertion,Ye as evaluateAssuranceGate,K as evaluateBoundaryFixtures,Z as evaluateDefectGateEvidence,Ve as evaluateMeasurement,oe as evaluateMutationGuard,lr as evaluateReliabilityWindow,St as evaluateSimilarityGovernance,N as evaluateWorkflowPolicies,ar as exportAttestation,bt as findDuplicateClusters,Et as findSimilarItems,cr as formatWorkspacePositionHuman,$e as getAssuranceDeclaration,de as getMutationActionContract,U as historyDigest,mt as inspectHistoryAuthorStream,be as inspectInProgressWork,Se as inspectStaleInProgressItems,Lt as inspectStatusRoleAssignments,Ie as isJudgeableHistoryRecord,pe as isMutationAction,C as isWaiverNoticeDays,Te as isWellFormedHistoryRecord,R as jaccardSimilarity,Oe as latestHistoryTimestamp,Ze as listAssuranceDeclarations,nt as listAssuranceVerdicts,Mt as listInvalidProvenanceHistoryStreamIds,ce as listMutationActions,Le as normalizeAssuranceEvaluation,Fe as normalizeAssuranceMutation,qt as normalizeInvalidHistoryProvenance,me as normalizeSimilarityText,ye as normalizeStaleWorkThresholdHours,te as parseDefectChangeRiskRequest,Zt as parseDefectRecurrenceCoverageRequest,ee as parseDefectRecurrencePolicy,or as parseHistoryAttestation,wt as parseUnknownAuthorHistoryEventCoordinates,A as parseWorkflowPolicy,O as parseWorkflowPolicyDocument,ut as planUnknownAuthorHistoryAcknowledgment,ue as prepareSimilarityText,Qt as projectValidateCounts,zt as promoteAssuranceAssertion,et as putAssuranceDeclaration,tt as putAssuranceDeclarationBundle,De as readLatestHistoryActivity,re as readWorkflowPolicies,z as readWorkflowPolicyField,pr as readWorkspacePosition,gr as reconcileArtifactLedgers,it as recordAssuranceVerdict,Ae as recordedBaselineActivity,ze as recordedPrefixActivity,rt as removeAssuranceDeclaration,P as resolveHistoryHashAlgorithm,_e as resolveLastActivityAt,gt as resolveUnknownAuthorAcknowledgmentSelector,rr as runAssuranceAction,ir as runAssuranceDispatch,nr as runGc,Ut as runHealth,fr as runHistoryAttest,Ft as runHistoryMaintenance,_ as runReindex,y as runUpgrade,Xt as runValidate,pt as runWorkflowPolicyAction,Ct as scanClosureTimestamps,Dt as scanExtensionHostVersions,lt as scanHistoryAuthorAttribution,qe as scanInProgressWork,ne as scanMutationSecrets,Nt as scanProvenanceResolverHealth,Me as scanStaleInProgressItems,Kt as scanStorageIntegrity,ge as scoreItemSimilarity,we as scorePreparedItemSimilarity,se as secretGuardRuleCategory,yt as similarityAdvisoryWarnings,H as sortWaiverNotices,ve as staleEligibleAt,le as tokenizeSimilarityText,ke as unprovenClaimActivity,Ge as validateAssertionDefinition,Ke as validateAssuranceDocument,He as validateGateDefinition,Ce as validateMeasurementDefinition,sr as verifyAttestation,G as waiverNoticeFor,Ee as wholeHoursSince,q as workflowApprovalFingerprint,M as workflowPolicyApplies,D as workflowPolicyFingerprint};
2
2
  //# sourceMappingURL=sdk-governance.js.map