@unbrained/pm-cli 2026.10.9 → 2026.10.11

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 (130) hide show
  1. package/.claude-plugin/marketplace.json +1 -36
  2. package/CHANGELOG.md +32 -4
  3. package/dist/cli/register-mutation.js +2 -2
  4. package/dist/cli-bundle/bundle-manifest.json +1 -382
  5. package/dist/cli-bundle/chunks/{chunk-P5NS7EFC.js → chunk-2JYTSTQP.js} +2 -2
  6. package/dist/cli-bundle/chunks/{chunk-ZNXRGATT.js → chunk-BXSXT5Z6.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-QQHNXCO3.js → chunk-ESRACL6K.js} +2 -2
  8. package/dist/cli-bundle/chunks/{chunk-5MOFELIF.js → chunk-K2UTE75T.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-55MK3QQM.js → chunk-KNW3RSLS.js} +3 -3
  10. package/dist/cli-bundle/chunks/chunk-MEWBSWE3.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-KOGF6O6W.js → chunk-OBLO45UM.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-XW3BLWFF.js → chunk-RBPOO46D.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-E4XR5LKU.js → chunk-RUT3CCAG.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-CPZOW6L2.js → chunk-S445XEYT.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-5NR6TDYB.js → chunk-SSY4OSJR.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-5TCQ5J3V.js → chunk-YMLF6QT7.js} +75 -75
  17. package/dist/cli-bundle/chunks/{chunk-NIF7JOPW.js → chunk-ZWRLAOA4.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-list-query-2YOWMNWY.js → register-list-query-T6BOR67M.js} +2 -2
  19. package/dist/cli-bundle/chunks/register-mutation-6NXR7SAJ.js +20 -0
  20. package/dist/cli-bundle/chunks/{register-operations-BMK65YM3.js → register-operations-PDOBQZUJ.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-setup-24TFFK6N.js → register-setup-MAYFPKBX.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/{chunk-362645PL.js → chunk-52UJEHEV.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-EZ4367G4.js → chunk-EIOQNLBQ.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-SAN3KPX4.js → chunk-GVGFUD52.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-DSLNUL2Q.js → chunk-JGFSSR3G.js} +16 -16
  26. package/dist/cli-bundle/focused-chunks/{chunk-IARAEFMA.js → chunk-KNJR2WUO.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-MJQ253F3.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-MCVWZUGK.js → chunk-SIEGIPNT.js} +28 -28
  29. package/dist/cli-bundle/main.js +2 -2
  30. package/dist/cli-bundle/sdk-contracts.js +1 -1
  31. package/dist/cli-bundle/sdk-core.js +1 -1
  32. package/dist/cli-bundle/sdk-governance.js +1 -1
  33. package/dist/cli-bundle/sdk-graph.js +1 -1
  34. package/dist/cli-bundle/sdk-merge.js +51 -51
  35. package/dist/cli-bundle/sdk-query.js +1 -1
  36. package/dist/cli-bundle/sdk-runtime.js +1 -1
  37. package/dist/cli-bundle/sdk-testing.js +1 -1
  38. package/dist/cli-bundle/sdk.js +9 -9
  39. package/dist/core/item/item-format.d.ts +2 -0
  40. package/dist/core/item/item-format.js +3 -3
  41. package/dist/core/schema/runtime-field-values.d.ts +2 -2
  42. package/dist/core/schema/runtime-field-values.js +1 -1
  43. package/dist/core/store/item-format-migration.js +1 -1
  44. package/dist/core/store/item-store.js +1 -1
  45. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  46. package/dist/sdk/governance/artifact-ledgers.d.ts +59 -0
  47. package/dist/sdk/governance/artifact-ledgers.js +2 -0
  48. package/dist/sdk/governance/reliability.d.ts +74 -0
  49. package/dist/sdk/governance/reliability.js +2 -0
  50. package/dist/sdk/governance.d.ts +2 -0
  51. package/dist/sdk/governance.js +1 -1
  52. package/dist/sdk/public-surface.json +1 -1
  53. package/dist/sdk/structured-mutations.d.ts +5 -1
  54. package/dist/sdk/structured-mutations.js +1 -1
  55. package/docs/QUALITY_EVIDENCE.md +52 -1
  56. package/docs/RELEASE_LEDGER_RECONCILIATION.md +148 -0
  57. package/docs/RELEASE_RELIABILITY.md +58 -3
  58. package/docs/RELEASING.md +34 -5
  59. package/docs/SDK.md +16 -2
  60. package/docs/TESTING.md +36 -0
  61. package/docs/agent-task-token-baseline.json +1 -291
  62. package/docs/agent-task-transcripts.json +1 -478
  63. package/docs/ecosystem-review-2026-09-28.json +1 -2866
  64. package/docs/examples/policy-restricted-extension/manifest.json +1 -22
  65. package/docs/examples/policy-restricted-extension/package.json +1 -8
  66. package/docs/examples/sdk-agent-environment/package.json +1 -8
  67. package/docs/examples/sdk-app-embedding/package.json +1 -9
  68. package/docs/examples/sdk-contract-consumer/package.json +1 -11
  69. package/docs/examples/sdk-custom-tool/package.json +1 -13
  70. package/docs/examples/starter-extension/manifest.json +1 -33
  71. package/docs/examples/starter-extension/package.json +1 -10
  72. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +4 -3
  73. package/docs/performance/corpus-shape-comparison.json +1 -108
  74. package/docs/performance/latest-scale-report.json +1 -418
  75. package/docs/performance/scale-100k-report.json +1 -418
  76. package/docs/schemas/extension-manifest.schema.json +1 -165
  77. package/marketplace.json +1 -36
  78. package/package.json +1 -1
  79. package/packages/pm-beads/extensions/beads/manifest.json +1 -28
  80. package/packages/pm-beads/extensions/beads/package.json +1 -3
  81. package/packages/pm-beads/package.json +1 -50
  82. package/packages/pm-calendar/extensions/calendar/manifest.json +1 -22
  83. package/packages/pm-calendar/extensions/calendar/package.json +1 -3
  84. package/packages/pm-calendar/package.json +1 -51
  85. package/packages/pm-command-kit/extensions/command-kit/manifest.json +1 -22
  86. package/packages/pm-command-kit/extensions/command-kit/package.json +1 -3
  87. package/packages/pm-command-kit/package.json +1 -53
  88. package/packages/pm-digital-twin/extensions/digital-twin/manifest.json +1 -19
  89. package/packages/pm-digital-twin/extensions/digital-twin/package.json +1 -3
  90. package/packages/pm-digital-twin/package.json +1 -58
  91. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +1 -19
  92. package/packages/pm-governance-audit/extensions/governance-audit/package.json +1 -3
  93. package/packages/pm-governance-audit/package.json +1 -55
  94. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +1 -22
  95. package/packages/pm-guide-shell/extensions/guide-shell/package.json +1 -3
  96. package/packages/pm-guide-shell/package.json +1 -52
  97. package/packages/pm-kanban/extensions/kanban/manifest.json +1 -19
  98. package/packages/pm-kanban/extensions/kanban/package.json +1 -3
  99. package/packages/pm-kanban/package.json +1 -57
  100. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +1 -19
  101. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/package.json +1 -3
  102. package/packages/pm-lifecycle-hooks/package.json +1 -52
  103. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +1 -29
  104. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/package.json +1 -3
  105. package/packages/pm-linked-test-adapters/package.json +1 -53
  106. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +1 -29
  107. package/packages/pm-search-advanced/extensions/search-advanced/package.json +1 -3
  108. package/packages/pm-search-advanced/package.json +1 -54
  109. package/packages/pm-templates/extensions/templates/manifest.json +1 -22
  110. package/packages/pm-templates/extensions/templates/package.json +1 -3
  111. package/packages/pm-templates/package.json +1 -50
  112. package/packages/pm-todos/extensions/todos/manifest.json +1 -29
  113. package/packages/pm-todos/extensions/todos/package.json +1 -3
  114. package/packages/pm-todos/package.json +1 -51
  115. package/packages/pm-vcs/extensions/vcs/manifest.json +1 -19
  116. package/packages/pm-vcs/extensions/vcs/package.json +1 -3
  117. package/packages/pm-vcs/package.json +1 -55
  118. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -25
  119. package/plugins/pm-claude/.mcp.json +1 -8
  120. package/plugins/pm-claude/hooks/hooks.json +1 -17
  121. package/plugins/pm-claude/package.json +1 -9
  122. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -45
  123. package/plugins/pm-codex/.mcp.json +1 -11
  124. package/plugins/pm-codex/mcp.json +1 -11
  125. package/plugins/pm-codex/package.json +1 -9
  126. package/plugins/pm-codex/plugin.json +1 -45
  127. package/runtime-dependencies.json +1 -512
  128. package/dist/cli-bundle/chunks/chunk-N7GKWO4G.js +0 -2
  129. package/dist/cli-bundle/chunks/register-mutation-ILOWFMTV.js +0 -20
  130. package/dist/cli-bundle/focused-chunks/chunk-2ATAD56F.js +0 -2
@@ -1,4 +1,4 @@
1
- import{n as vp,o as Ko,p as Ap,q as Tp,r as As,s as Bo,t as Cp,u as Ts,v as Vo,y as tu,z as nu}from"./focused-chunks/chunk-DMSADMEU.js";import{a as au,f as su,h as en,m as cu,o as mr,r as ei,s as lu,t as du,x as mu}from"./focused-chunks/chunk-2ATAD56F.js";import{$ as Gn,$a as a_,A as Sr,Ab as w_,B as wf,Bb as v_,C as Ci,Cb as b_,D as vf,Db as k_,E as bf,Eb as S_,Fb as Tr,Ga as Xf,Gb as mc,Hb as pc,Ia as Zf,Ib as Mi,J as kf,Ja as Ni,Jb as uc,K as Sf,Ka as Rk,Kb as E_,L as Ef,La as e_,Lb as fc,M as Af,Ma as t_,Mb as Di,N as Tf,Na as dc,Nb as Kn,O as Cf,Ob as _c,P as If,Pb as hc,Q as Rf,Qb as A_,R as Of,Rb as T_,S as xf,Sb as C_,T as Pf,Tb as zn,U as Nf,Ub as gc,V as Lf,Vb as I_,W as $f,X as Ff,Y as Mf,Ya as r_,Yb as Ui,Z as Df,Za as o_,_ as Uf,_a as i_,aa as Gf,ab as s_,ba as jf,bb as c_,ca as qf,cb as l_,da as Dt,db as nn,dc as R_,ea as v,eb as d_,ec as O_,fa as Kf,fb as m_,fc as x_,g as df,ga as zf,gb as Li,h as mf,ha as Me,hb as p_,ia as Hf,ib as u_,ja as ac,jb as f_,jc as P_,ka as Bf,kb as __,kc as q_,la as sc,lb as h_,ma as Er,mb as $i,na as Ii,nb as Ut,oa as jn,ob as g_,pa as Vf,pb as Fi,qa as Ri,ra as ye,sa as cc,sb as Ar,ta as he,ua as Wf,va as Yf,wa as Oi,xa as Jf,y as yf,ya as xi,z as rc,zb as y_}from"./focused-chunks/chunk-IARAEFMA.js";import{e as gp,g as yp,h as wp,k as bp,q as Ep}from"./focused-chunks/chunk-W5AE7GKZ.js";import{b as ru,c as Zo,e as ou,f as iu,g as mk}from"./focused-chunks/chunk-WAOXID5J.js";import{R as js,V as eu,a as cm,b as lm,c as dm,d as mm,f as pm}from"./focused-chunks/chunk-2CJWTLQG.js";import{a as _f,b as hf,c as Gi}from"./focused-chunks/chunk-SAN3KPX4.js";import{K as n_,b as gf}from"./focused-chunks/chunk-362645PL.js";import{A as M_,Aa as bc,B as D_,Fa as kc,Ha as U_,Wa as Rr,Ya as G_,Za as j_,a as pf,b as Ik,c as uf,d as Ti,g as oc,i as ic,k as lc,l as Cr,m as Ok,n as yc,o as wc,p as ji,q as xk,r as Pk,ta as vc,w as N_,x as L_,y as $_,ya as Ir,z as F_}from"./focused-chunks/chunk-EZ4367G4.js";import{$a as wr,A as fe,B as $n,C as _i,D as hi,G as gi,H as yi,I as Bu,Ia as Un,J as wi,Ja as rf,K as vi,Ka as tc,L as Fn,La as of,M as Zs,N as bi,O as Vu,Oa as nc,P as Wu,Pa as af,Q as gr,Xa as Si,_a as cf,a as ju,b as ai,c as si,cb as lf,d as ci,e as li,i as di,j as Pt,k as Nn,kb as ht,l as mi,m as Ln,mb as kr,n as pi,nb as tn,o as me,p as ui,pb as ff,q as Xs,qb as Pi,r as Ye,s as Qs,sa as nf,t as qu,u as Ie,vb as qn,w as ft,x as Ku,y as fi,z as Nt}from"./focused-chunks/chunk-DSLNUL2Q.js";import{c as fp,f as _p,g as hp,i as qo,j as Rt,k as Ip,l as Rp,m as Op}from"./focused-chunks/chunk-PLTTMQAW.js";import{a as uu,b as fu,c as _u}from"./focused-chunks/chunk-AU6VJGTY.js";import{$ as Gm,A as yo,Aa as ap,B as vm,Ba as sp,C as bm,Ca as Io,D as km,Da as cp,E as wo,Ea as lp,F as Sm,Fa as dp,G as Em,Ga as Ro,H as Am,Ha as Oo,I as Tm,Ia as xo,J as vo,Ja as Po,K as bo,Ka as lr,L as Cm,La as mp,M as ko,Ma as No,Na as dr,O as Im,Oa as Lo,P as sr,Pa as $o,Q as Rm,Qa as Fo,R as Om,Ra as Mo,S as xm,Sa as pp,T as Pm,Ta as Ct,U as Nm,Ua as Do,V as Lm,Va as Uo,W as $m,Wa as Go,X as Fm,Xa as jo,Y as Mm,Z as Dm,_ as Um,_a as up,aa as jm,ab as It,ba as qm,bb as N,ca as Km,d as ks,da as cr,e as um,ea as zm,fa as Hm,ga as So,h as fo,ha as Eo,i as Ss,ia as Bm,j as Xt,ja as Vm,ka as Wm,l as fm,la as Ym,ma as Jm,na as Xm,oa as Qm,pa as Zm,q as Es,ra as ep,s as _o,sa as tp,t as ho,ta as np,u as go,ua as rp,v as _m,va as op,w as hm,wa as ip,x as gm,xa as Ao,y as ym,ya as To,z as wm,za as Co}from"./focused-chunks/chunk-WOEZJUA2.js";import{$ as Au,$a as Hu,A as Tk,Aa as _r,Ab as I,B as Ck,Bb as z,C as Pn,Cb as ae,D as C,Db as Qu,Fb as _e,Gb as Zu,H as ut,Ha as $u,Hb as ki,Ib as _t,Ja as Ws,Jb as ef,Kb as se,L as yu,Lb as tf,M as oi,Ma as Fu,N as wu,Na as ii,O as vu,Oa as We,P as bu,Pb as sf,Q as ku,Qa as Mu,R as Su,Ra as Du,T as ee,Ta as Uu,U as qs,Ua as Ys,V as re,Va as Js,Vb as vr,Wa as Gu,Wb as br,X as Ks,Xa as A,Xb as Ei,Y as Eu,Ya as Fe,Yb as Mt,Z as Ve,Za as Ce,_ as rt,_a as zu,a as ti,aa as Tu,ab as Lt,b as pk,bc as Ai,c as uk,ca as Cu,cb as ze,d as fk,da as Iu,db as hr,e as _k,ea as zs,eb as Mn,fb as Yu,gb as Dn,ha as Hs,hb as ec,ib as Ju,ja as Ru,k as ni,ka as Ou,l as hu,la as xu,m as gu,ma as Pu,n as xn,na as Nu,o as pr,ob as yr,p as hk,q as gk,r as yk,ra as $e,s as wk,sa as xt,sc as Qf,t as vk,u as bk,ua as Bs,v as kk,va as ur,vb as $t,w as Sk,wa as fr,x as Ek,xa as Vs,xb as Ft,y as ri,ya as ot,z as Ak,za as Lu,zb as Xu}from"./focused-chunks/chunk-MCVWZUGK.js";import{b as Tt,c as co,d as lo,g as mt,i as zo,j as pt,k as Ot,l as kp,n as $,o as Ho,p as nt,r as Sp}from"./focused-chunks/chunk-PBCYGO7X.js";import{e as pu}from"./focused-chunks/chunk-YLVHHWHN.js";import{$ as d,$a as E,$c as Zt,Aa as En,Ae as Xp,B as jd,Bb as ir,C as qd,Cb as bs,D as Kd,Db as ar,Dc as qp,E as zd,Ee as Qp,F as Hd,Fc as Os,Fd as Qb,G as Bd,Gc as xs,Gd as Zb,H as ms,Hc as Ps,I as ps,Ia as An,Ib as Se,Ic as Ns,Id as ek,Ie as sk,J as us,Jc as Ls,Je as ck,K as fs,Ka as Qd,Kb as B,Kc as $s,Kd as tk,Ke as lk,L as _s,Lc as Fs,Ld as nk,Le as dk,M as hs,Ma as ys,Mb as Jt,Mc as O,Md as Ds,Me as Qo,Na as ws,Nc as In,Nd as Us,Ne as Zp,Oc as Qt,Od as Gs,P as so,Pc as Y,Pd as Bp,Qa as vs,Qc as Wo,Ra as nr,Rc as Rn,Rd as Vp,Sa as Ae,Sb as Cn,Sd as rk,U as gs,Uc as Yo,Ud as ok,Va as x,Vd as ik,W as Vd,Wa as ke,Wc as Ee,Wd as ak,Xa as po,Xc as Jo,Ya as Tn,Yd as k,Z as At,Za as rr,_a as Zd,_c as Kp,aa as l,ab as em,ae as Xo,bb as lt,bc as xp,cb as ne,cc as Pp,ce as ie,db as dt,dc as Np,ec as Lp,fb as tt,fc as $p,fe as Te,gb as uo,gc as Fp,hc as Cs,ia as Wd,ic as Mp,ka as Yd,kb as tm,kc as Dp,lb as nm,lc as Up,le as Wp,ma as mo,mb as rm,nb as om,nd as zp,o as oo,oa as Jd,ob as im,oc as Is,p as Gd,pa as Xd,pb as am,pc as Gp,q as io,qb as sm,qc as Rs,r as ds,rd as Hp,sa as q,sb as or,se as Yp,ta as Wt,tb as Yt,te as Jp,ua as Be,ub as Le,v as Vt,va as J,w as ct,wd as Ms,we as On,x as kn,xc as jp,y as Sn,ya as te,z as ao}from"./focused-chunks/chunk-B3YW6H2I.js";import{AsyncLocalStorage as SM}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="73dbe40e-f7a2-5aca-85aa-a5775e5e981a")}catch{}})();var Nk=js("list").properties.outputSession,Lk={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...Nk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},K_={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},z_={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},ce={type:"string",description:"pm item id, for example pm-abc1."},$k=`Operation name (one of): ${Rs.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,Fk={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},Mk={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function D(e,t=[]){return{...z_,properties:{...z_.properties,...e},required:t}}var Dk=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:D({action:{type:"string",enum:[...Rs],description:$k},id:ce,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...Lk},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:D({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:D({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:D({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({query:{type:"string"},options:{type:"object"},...Mk},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({options:{type:"object"},...Fk})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:D({id:ce,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:D({since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",inputSchema:D({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"]},id:ce,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"}},required:["op"],additionalProperties:!1}},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["transactionId","mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:ce,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:D({id:ce,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:D({id:ce,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:ce,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:D({id:ce,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:D({id:ce,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:ce,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:"List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls default to the most recent 20 comments with total_count/has_more metadata for token efficiency. Pass options.limit=N to choose a page size, options.limit=0 for summary-only metadata, or options.full=true for full history.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:D({subcommand:{type:"string",enum:[...Mp]},id:ce,target:ce,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:D({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:D({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:D({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:D({...K_,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...Cn],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...ds]},description:`Lifecycle roles for add-status: ${ds.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:K_}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:D({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:D({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:D({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],Uk={pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},Gk=Dk.map(e=>{let t=Uk[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:js(t,{properties:n,required:r})}});function H_(){return Gk.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,o)=>r.localeCompare(o)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="48a78171-1f14-5e93-82a2-27108ee87f4f")}catch{}})();var B_=new Map([["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),jk=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],nh=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Ki=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),rn=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),rh=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),oh=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),ih=new Map([...oh.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),ah=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],Ac=new Map(ah.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),qk=10,Kk=20,V_=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),sh=[["init",Im],["install",Om],["uninstall",xm],["explore",Pm],["manage",Dm],["describe",Nm],["reload",Um],["doctor",Gm],["catalog",jm],["adopt",qm],["adopt-all",Lm],["activate",$m],["deactivate",Fm],["migrate",Mm]],zk=[...sh.map(([e,t])=>e==="init"?[e,Rm]:[e,t]),["upgrade",cr]],Hk=[...sh.map(([e,t])=>[`extension ${e}`,t]),...zk.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",bo],["config",Cm],["extension",ko],["package",sr],["packages",sr],["install",Km],["create",Io],["item mutate",cp],["item complete",lp],["item reopen",dp],["copy",Ro],["focus",Oo],["update",xo],["update-many",Po],["upgrade",cr],["calendar",lr],["cal",lr],["context",dr],["ctx",dr],["get",Lo],["search",Uo],["eval",pp],["events",No],["workspace",Ct],["workspace position",[]],["workspace snapshot",Ct],["workspace snapshot create",Ct],["workspace snapshot list",Ct],["workspace snapshot inspect",Ct],["workspace snapshot restore",Ct],["workspace snapshot delete",Ct],["next",Do],["aggregate",go],["deps",Fo],["graph",Mo],["guide",$o],["reindex",zm],["history",yo],["history-compact",Sm],["history-attest",Em],["history-redact",bm],["history-repair",km],["history-author-acknowledge",wo],["merge",vm],["schema",Am],["profile",Tm],["plan",vo],["restore",Vm],["delete",Wm],["close",Hm],["close-many",So],["append",Eo],["claim",Bm],["release",Ym],["start-task",Jm],["pause-task",Xm],["close-task",Qm],["comments",_m],["notes",hm],["learnings",gm],["files",ym],["docs",wm],["test",tp],["test-runs-worker",[]],["test-all",np],["telemetry",rp],["test-runs",op],["gc",ip],["stats",Ao],["ops",[]],["duplicates",To],["validate",ap],["health",Co],["assurance",sp],...up,["contracts",Go],["completion",jo],["activity",mp],...[...nh].map(e=>[e,ho])],Or=new Map(Hk);for(let{alias:e,canonical:t}of Se){let n=Or.get(e);n!==void 0&&Or.set(t,n)}function Bk(e){return ih.get(e)||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function W_(e){let t=Se.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:Cs.includes(e)?we(e):e.startsWith("extension-")?we(`extension ${e.slice(10)}`):e.startsWith("package-")?we(`package ${e.slice(8)}`):e.startsWith("item-")?we(`item ${e.slice(5)}`):e.startsWith("test-runs-")?we(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?we(`templates ${e.slice(10)}`):Ki.has(e)?oh.get(e)??we(e):null}function Vk(e,t){let n=B(t);return n!==t||Se.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:gt(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function gt(e){return e.split("|").map(t=>we(t)).filter(t=>t.length>0)}function Wk(e,t){let n=new Set(t),r=new Set;for(let o of e)if(o.command_path)for(let i of gt(o.command_path)){let a=i.split(" ").filter(s=>s.length>0);if(a.length!==0)for(let s=a.length;s>0;s-=1){let c=a.slice(0,s).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function qi(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function xr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function Yk(e,t){if(!t)return{...e};let n=xr(e).filter(r=>{let o=r.properties;if(typeof o!="object"||o===null)return!1;let i=o.action;return typeof i!="object"||i===null?!1:i.const===t});return{...e,oneOf:n}}function Sc(e,t){let n=xr(e).filter(r=>{let o=r.properties;if(typeof o!="object"||o===null)return!1;let i=o.action;if(typeof i!="object"||i===null)return!1;let a=i.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:n}}function we(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ch(e){return e.replace(/\s+/g,"-")}function it(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Y_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=it(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function Ec(e,t,n){n&&(e[t]=!0)}function J_(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?n:null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Jk(e){let t=J_(e.long,"long"),n=J_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),Ec(o,"required",e.required===!0),Ec(o,"repeatable",e.repeatable===!0),Ec(o,"list",e.list===!0);let i=it(e.description);i&&(o.description=i);let a=it(e.value_name);a&&(o.value_name=a);let s=[it(e.value_type),it(e.type),a?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return s&&(o.value_type=s),o}function lh(e){let t=new Map;for(let r of e){let o=we(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},a=`${r.layer}:${r.name}`;i.sourceDedupe.has(a)||(i.sourceDedupe.add(a),i.sources.push({layer:r.layer,name:r.name}));for(let s of r.flags){let c=Jk(s);if(!c)continue;let m=`${c.flag}|${c.short??""}`;i.dedupe.has(m)||(i.dedupe.add(m),i.flags.push(c))}t.set(o,i)}let n=new Map;for(let[r,o]of t.entries())n.set(r,{flags:o.flags,sources:o.sources.sort((i,a)=>{let s=i.layer.localeCompare(a.layer);return s!==0?s:(i.name??"").localeCompare(a.name??"")})});return n}function Xk(e){let t=lh(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let a=we(i.command);if(a.length===0)continue;let s=it(i.action)??ch(a),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let p=it(m.name);return p?{name:p,required:m.required===!0,variadic:m.variadic===!0,description:it(m.description)}:null}).filter(m=>m!==null):[];n.set(a,{...i.tier===void 0?{}:{tier:i.tier},command:a,action:s,source:{layer:i.layer,name:i.name},description:it(i.description),intent:it(i.intent),arguments:c,flags:t.get(a)?.flags??[],examples:Y_(i.examples),failure_hints:Y_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(we(i));for(let i of n.keys())r.add(i);for(let i of t.keys())r.add(i);let o=[];for(let i of[...r].sort((a,s)=>a.localeCompare(s))){let a=n.get(i);o.push(Qk(i,a,t.get(i)?.flags??[]))}return o}function Qk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:ch(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Zk(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let n=t.replace(/-([a-z0-9])/g,(r,o)=>o.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return n.length>0?n:null}function eS(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function tS(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",o=e.repeatable===!0||e.list===!0;return{type:o?"array":r,...o?{items:{type:r}}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function nS(e){let t=e.command.split("|").map(o=>o.trim()).filter(o=>o.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let o of e.arguments)n[o.name]=eS(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Zk(o);!i||n[i]!==void 0||(n[i]=tS(o,e.action),o.required===!0&&r.push(i))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function rS(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function oS(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((i,a)=>i.localeCompare(a)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let o=new Set(r.flags.map(i=>`${i.flag}|${i.short??""}`));for(let i of n.flags){let a=`${i.flag}|${i.short??""}`;if(!o.has(a))o.add(a),r.flags.push(i);else{let s=r.flags.find(c=>`${c.flag}|${c.short??""}`===a);s&&rS(s,i)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function iS(e,t=A){let n={mode:At.extensions.policy.mode,trust_mode:At.extensions.policy.trust_mode,default_sandbox_profile:At.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=E(process.cwd(),e.path);if(!await q(ne(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await ir({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),a=await ar({...i,loaded:i.loaded});return{handlers:new Set(a.commands.handlers.map(s=>we(s.command))),disabledReason:null,commandDefinitions:a.registrations.commands,flagRegistrations:a.registrations.flags,registrations:a.registrations,policyState:{mode:i.policy.mode,trust_mode:i.policy.trust_mode,default_sandbox_profile:i.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function aS(e,t={}){let n=new Map;for(let r of Is){let o=Ki.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=W_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Ki)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:W_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:Se.find(o=>o.alias===r.command)?.canonical??we(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function sS(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!rn.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?gt(e.command_path):[],r=n.some(a=>t.handlers.has(a)||t.handlers.has(B(a))),o=n.map(a=>rh.get(B(a))).find(a=>typeof a=="string"),i=t.disabledReason===null&&r;return{action:e.action,invocable:i,available:i,requires_extension:!0,provider:"extension",disabled_reason:i?null:t.disabledReason??(o?`optional_package_not_installed:${o}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function dh(e){return Or.get(e)??_o}function cS(e){return rn.has(B(e))?!1:Or.has(e)}function lS(e){return nh.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function X_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function dS(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function mS(e){let t=new Map;for(let r of e.definitions){let o=X_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(s=>dS(s)).find(s=>s!==null),a=r.cli_aliases.map(s=>X_(s)).filter(s=>s!==null&&s!==o);for(let s of r.commands){let c=t.get(s)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},p=`${m.flag}|${m.short??""}`;c.seen.has(p)||(c.seen.add(p),c.flags.push(m));for(let u of a){let f=`${u}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:u}))}t.set(s,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,Es(o.flags));return n}function Q_(e,t){let n=[],r=new Set;for(let o of[...e,...t]){let i=`${o.flag}|${o.short??""}`;r.has(i)||(r.add(i),n.push(o))}return Es(n)}function pS(e,t,n,r,o){let i=new Map(t);for(let{alias:a,canonical:s}of Se){let c=t.get(s)??t.get(a);c&&(i.set(a,c),i.set(s,c))}return e.map(a=>{let s=cS(a),c=s?dh(a):[],m=n.get(lS(a))??[],p=i.get(a),u=Q_(c,m),f=Q_(u,p?.flags??[]),_=c.length>0&&(p?.flags.length??0)>0?"mixed":s?"core":"extension";return{command:a,flags:f,...r?{canonical_command:ph(a),visibility:mh(a,o),positionals:um(a)?.slots??[],flag_invocations:mr(a,f)}:{},provider:_,extension_sources:p?.sources}}).sort((a,s)=>a.command.localeCompare(s.command))}function uS(e,t=Jt){let n=new Set(e),r=new Map;for(let o of ah){let i=o.aliases.filter(a=>n.has(a));r.set(o.canonical,{canonical:o.canonical,aliases:i,contracts:[]})}for(let o of t){if(!n.has(o.canonical)||o.registration==="commander"&&!n.has(o.alias))continue;let i=r.get(o.canonical)??{canonical:o.canonical,aliases:[],contracts:[]};i.aliases.includes(o.alias)||i.aliases.push(o.alias),i.contracts.push(o),r.set(o.canonical,i)}return[...r.values()].map(({contracts:o,...i})=>o.length===0?i:{...i,contracts:o}).sort((o,i)=>o.canonical.localeCompare(i.canonical))}function fS(){return{create_string_options:ru,create_repeatable_options:Zo,update_string_options:ou,update_repeatable_options:iu,list_string_options:cm,search_string_options:lm,calendar_string_options:dm,context_string_options:mm,activity_string_options:pm}}function Z_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let s of e.required_create_fields)n.add(s);for(let s of e.required_create_repeatables)n.add(s)}let r=Tn(e,"create",n),o=[...new Set(r.required)].sort((s,c)=>s.localeCompare(c)),i=[...new Set(o.map(s=>Ae("create",s)))].sort((s,c)=>s.localeCompare(c)),a=[...new Set(e.options.filter(s=>s.required===!0).map(s=>s.key))].sort((s,c)=>s.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:a,policy_errors:[...new Set(r.errors)].sort((s,c)=>s.localeCompare(c))}}function _S(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=Z_(o,"strict"),n[r]=Z_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function hS(e,t){let n=xr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let a=i.properties;if(typeof a!="object"||a===null)return i;let s=a.action;return typeof s!="object"||s===null||s.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function gS(e){let t=qi(e.action)!==void 0||qi(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,o=e.schemaOnly===!0,i=e.flagsOnly===!0,a=e.availabilityOnly===!0,s=e.runtimeOnly===!0,c=e.full===!0,m=qi(e.action),p=qi(e.command),u=!r&&!c&&!o&&!i&&!a&&!m&&!p;return{selectedAction:m,selectedCommand:p,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:a,runtimeOnly:s,fullOutput:c,omitUnfilteredSchema:u,omitUnfilteredCommandFlags:u,omitUnfilteredCommanderAliases:u||p!==void 0&&!c}}function yS(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(t=>t).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function wS(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function vS(e,t,n){let r=await wS(t),o=await iS(e),i=x(r,o.registrations??O()),a=nt(r.schema),s=Xk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:$(r.schema),runtimeFieldRegistry:a,runtimeFieldFlagMap:mS(a),createRequiredOptionContracts:_S(i),extensionContracts:s,mergedExtensionContracts:oS(s.filter(c=>zi(n,c.command,s))),extensionFlagMap:lh(o.flagRegistrations)}}function eh(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Ki.has(e.selectedAction)||e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand)))}function bS(e,t){let n=aS(t,{includePackageOwnedActions:eh(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(Gp);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??ei(o.action))!=="internal"))}return eh(e)&&e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Bk(B(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function kS(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new l(`Unknown action: "${e.selectedAction}".`,d.USAGE)}function SS(e,t){return[...new Set([...Cs.filter(n=>!rn.has(B(n))),...[...Or.keys()].filter(n=>!rn.has(B(n))),...e.flatMap(n=>n.command_path?gt(n.command_path).filter(r=>n.provider==="extension"||!rn.has(B(r))||t.some(o=>o.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let o=Se.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>we(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function ES(e,t){let n=t.slice(0,qk),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,Kk),a=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),s=t[0];return new l(`Command "${e}" is a command namespace. Choose a concrete child command: ${o}.`,d.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:a,nextSteps:[`Retry with a child command, for example: ${a[0]}`],recovery:{suggested_retry:`pm contracts --command "${s}" --flags-only --json`,fallback_candidates:i.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function AS(e,t){return new l(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm install ${t} --project" and retry.`,d.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm install ${t} --project`],recovery:{suggested_retry:`pm install ${t} --project`}})}function TS(e){return new l(`Unknown command: "${e}".`,d.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function CS(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let n=t.filter(o=>o.startsWith(`${e.selectedCommand} `));if(n.length>0)throw ES(e.selectedCommand,n);let r=rh.get(B(e.selectedCommand));throw r?AS(e.selectedCommand,r):TS(e.selectedCommand)}function IS(e,t){let n=bS(e,t.mergedExtensionContracts);kS(e,n);let r=SS(n,t.mergedExtensionContracts);CS(e,r);let o=e.selectedCommand?ih.get(B(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Vk(m,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!i.some(m=>m.action===e.selectedAction))throw new l(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,d.USAGE);let a=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,s=[...new Map(a.map(m=>sS(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?s.filter(m=>m.invocable):s;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:a,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function RS(e){return new Set(xr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let o=r.const;return typeof o=="string"?o:null}).filter(t=>t!==null))}function OS(e){let t=eu,n=xr(t),r=RS(t),o=e.filter(i=>!r.has(i.action)).map(i=>nS(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function th(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?Yk(n,e.selectedAction):e.selectedCommand?Sc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):Sc(n,r);return e.runtimeOnly&&!e.selectedAction?Sc(o,new Set(t.actions)):o}function xS(e,t,n){let r=OS(t.mergedExtensionContracts),o=!e.flagsOnly&&!e.availabilityOnly?hS(th(e,n,r),t.createRequiredOptionContracts):th(e,n,r);return{mergedSchema:r,filteredSchema:o}}function PS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Wk(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function mh(e,t){return t.find(n=>B(n.command)===B(e))?.tier??ei(e)}function zi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||mh(t,n)!=="internal"}function NS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(Jt.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of Ac.keys())r.add(o);return t.filter(o=>!r.has(o)&&zi(e,o,n))}function ph(e){let t=Se.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":Ac.get(n)??n}var LS=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),$S=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function FS(e,t){let n=V_.get(B(e))??(e.includes(" ")?void 0:V_.get(ph(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(p=>B(p)===B(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let o=e.split(" "),i=o.at(-1),a=o.slice(0,-1).join(" "),s=LS.get(i),c=$S.get(e)??a;return{intent:s===void 0||a.length===0?`Run ${e}.`:`${s} ${c}.`,intent_source:"generated"}}function MS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(we))].filter(i=>i.length>0).sort((i,a)=>i.localeCompare(a)).map(i=>{let a=Ms(i,{generateFallback:!0}),s=i.split(" ")[0],c=Ac.get(s)??(s.startsWith("list-")?"list":s.startsWith("history-")?"history":s),m=new Set([...dh(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>B(_)===B(i))).flatMap(f=>f.flags.map(_=>_.flag))]),p=(B_.get(B(i))??B_.get(c)??jk).filter(f=>m.has(f)),u=FS(i,t);return{command:i,intent:u.intent,...o||u.intent_source!=="command"?{intent_source:u.intent_source}:{},...p.length>0?{flags:p}:{},default_max_estimated_tokens:a.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...a.default_max_estimated_tokens_by_format}}:{}}})}function DS(e){return e.map(t=>({budget:Ms(t,{generateFallback:!0}),envelope:mu(t)}))}function US(e){let t=new Map;for(let n of e){let r=su(n),o=r===void 0?[d.SUCCESS,d.GENERIC_FAILURE,d.USAGE,d.NOT_FOUND,d.CONFLICT,d.DEPENDENCY_FAILED]:r.exit_codes,i=o.join(","),a=t.get(i)??{commands:[],exit_codes:o};a.commands.push(n),t.set(i,a)}return[...t.values()]}function GS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>gt(r.command).some(o=>B(o)===B(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(o=>gt(o.command).some(i=>r.has(i)))}return t.extensionContracts.filter(r=>zi(e,r.command,t.extensionContracts))}function jS(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function qS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=pu);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(o=>o.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([o])=>r===void 0||o===r).map(([o,i])=>[o,[...new Set(i.map(a=>`--${a.cli_flag}`))].sort((a,s)=>a.localeCompare(s))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...xp],services:[...Pp],policy_modes:[...Np],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...Fp],trust_modes:[...Lp],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...$p],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...jd],create_modes:[...qd],close_validation_modes:[...Kd],workflow_enforcement_modes:[...zd]},e.relationship_kind_contracts=[...Wd,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(o=>o.definitions)].sort((o,i)=>o.kind.localeCompare(i.kind)).map(o=>({canonical:o.kind,aliases:[...o.aliases??[]],...o.inverse===void 0?{}:{inverse:o.inverse},ordering:o.ordering,hierarchy:o.hierarchy})))}function KS(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function zS(e,t,n,r,o){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=pS(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(_u).filter(([a])=>i.has(a)).map(([a,s])=>({command:a,default:s,brief_fields:[...fu],compact_fields:[...uu]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:a})=>({canonical:i,aliases:a})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function HS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=fS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function BS(e,t,n,r){e.command_summaries=MS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...zp],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(we))].filter(o=>Us(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...Bp(o).keys()]}))}:{}},e.grammar_contracts={nouns:Xt.nouns,shared_verbs:Xt.shared_verbs,scope_before_verb:Xt.scope_before_verb,visible_top_level_ceiling:Xt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Xt.ceiling_raise_requires_pm_item,positional_shape_budget:Xt.positional_shape_budget,positional_shape_count:new Set(Ss.map(({slots:o})=>fm(o))).size,positional_action_count:ks.length,positional_action_parents:[...new Set(ks.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:Ss}:{}}}async function Tc(e,t){let n=gS(e);yS(n);let r=E(process.cwd(),t.path),o=await vS(t,r,n),i=IS(n,o),a=xS(n,o,i),s=PS(n,i),c=NS(n,s,o.extensionContracts),m=jS(n,a,i,c),p=GS(n,o,c),u=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&BS(m,c,p,{includeFormatBudgets:u,includeIntentProvenance:u,includePositionalSignatures:u,includeProjectionModeMatrix:u}),n.summary)return m;let f=uS(i.commandCatalog.filter(_=>zi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||qS(m,o,n),KS(m,n,a,p),zS(m,n,o,c,f),HS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...mf],gate_triggers:[...df]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=fo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=H_(),m.context_intents=Yp(),m.read_output_dimensions=Ds,m.error_codes=cu,m.command_output_contracts=DS(c),m.diagnostic_output_contracts=Hp,m.command_exit_contracts={vocabulary:au,command_sets:US(c)}),m}import{readFile as VS}from"node:fs/promises";import WS from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="20a3a324-d176-5918-8167-5e548be4abc9")}catch{}})();var Cc="context-intents.json";function Hi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function YS(e,t,n){if(!Hi(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let r=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(r)||!r.every(o=>typeof o=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:r,token_budget:e.token_budget}}function uh(e,t){let n=Array.isArray(e)?e:Hi(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((r,o)=>YS(r,t,o))}async function JS(e){let t=WS.join(e,Cc),n;try{n=await VS(t,"utf8")}catch(o){if(Wt(o))return[];throw await Xu(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${Cc}: ${i}`,{cause:o})}return uh(r,Cc)}function XS(e){if(!Hi(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Hi(n)?n.contextIntents??n.context_intents:void 0}function QS(e){return e.flatMap(t=>{let n=XS(t.module);return n===void 0?[]:uh(n,`package ${t.name}`)})}async function ZS(e){let t=await JS(e.pmRoot),n=QS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Ic(e,t){let n=await ZS(e);return await Jp(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a4abc17-0fcb-573f-8f89-6e505e112261")}catch{}})();async function fh(e,t,n=Wp){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let r=t,o=Array.isArray(r.warnings)?r.warnings.filter(i=>typeof i=="string"):[];r.warnings=[...new Set([...o,"context_usage_feedback_write_failed"])].sort()}}}import{createHash as eE}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="93e1b043-89b2-546e-b238-1b9f4a1df742")}catch{}})();function Rc(e){let t=Yd();for(let n of e)t.register(n);return t}function tE(e,t,n=[]){if(n.length===0)return e;let r=JSON.parse(e),o=JSON.parse(Js(t));for(let i of n){let a=i.split("."),s=o;for(let p of a){let u=ys(s);if(!/^[a-zA-Z][a-zA-Z0-9_]*$/u.test(p)||["constructor","prototype","__proto__"].includes(p)||u===null||!Object.hasOwn(u,p))throw new l(`Invalid owned settings subtree: ${i}. Select a declared inline object path.`,d.USAGE);s=u[p]}if(ys(s)===null)throw new l(`Invalid owned settings subtree: ${i}. Select a declared inline object path.`,d.USAGE);let c=r,m=o;for(let p of a.slice(0,-1)){let u=c[p];m=m[p],u===void 0&&Object.defineProperty(c,p,{value:structuredClone(m),enumerable:!0,writable:!0,configurable:!0}),c=c[p]}Object.defineProperty(c,a.at(-1),{value:s,enumerable:!0,writable:!0,configurable:!0})}return Le(r,JSON.parse(e))?e:`${JSON.stringify(r,null,2)}
1
+ import{n as vp,o as Ko,p as Ap,q as Tp,r as As,s as Bo,t as Cp,u as Ts,v as Vo,y as tu,z as nu}from"./focused-chunks/chunk-DMSADMEU.js";import{a as au,f as su,h as en,m as cu,o as mr,r as ei,s as lu,t as du,x as mu}from"./focused-chunks/chunk-MJQ253F3.js";import{$ as Gn,$a as a_,A as Sr,Ab as w_,B as wf,Bb as v_,C as Ci,Cb as b_,D as vf,Db as k_,E as bf,Eb as S_,Fb as Tr,Ga as Xf,Gb as mc,Hb as pc,Ia as Zf,Ib as Mi,J as kf,Ja as Ni,Jb as uc,K as Sf,Ka as Rk,Kb as E_,L as Ef,La as e_,Lb as fc,M as Af,Ma as t_,Mb as Di,N as Tf,Na as dc,Nb as Kn,O as Cf,Ob as _c,P as If,Pb as hc,Q as Rf,Qb as A_,R as Of,Rb as T_,S as xf,Sb as C_,T as Pf,Tb as zn,U as Nf,Ub as gc,V as Lf,Vb as I_,W as $f,X as Ff,Y as Mf,Ya as r_,Yb as Ui,Z as Df,Za as o_,_ as Uf,_a as i_,aa as Gf,ab as s_,ba as jf,bb as c_,ca as qf,cb as l_,da as Dt,db as nn,dc as R_,ea as v,eb as d_,ec as O_,fa as Kf,fb as m_,fc as x_,g as df,ga as zf,gb as Li,h as mf,ha as Me,hb as p_,ia as Hf,ib as u_,ja as ac,jb as f_,jc as P_,ka as Bf,kb as __,kc as q_,la as sc,lb as h_,ma as Er,mb as $i,na as Ii,nb as Ut,oa as jn,ob as g_,pa as Vf,pb as Fi,qa as Ri,ra as ye,sa as cc,sb as Ar,ta as he,ua as Wf,va as Yf,wa as Oi,xa as Jf,y as yf,ya as xi,z as rc,zb as y_}from"./focused-chunks/chunk-KNJR2WUO.js";import{e as gp,g as yp,h as wp,k as bp,q as Ep}from"./focused-chunks/chunk-W5AE7GKZ.js";import{b as ru,c as Zo,e as ou,f as iu,g as mk}from"./focused-chunks/chunk-WAOXID5J.js";import{R as js,V as eu,a as cm,b as lm,c as dm,d as mm,f as pm}from"./focused-chunks/chunk-2CJWTLQG.js";import{a as _f,b as hf,c as Gi}from"./focused-chunks/chunk-GVGFUD52.js";import{K as n_,b as gf}from"./focused-chunks/chunk-52UJEHEV.js";import{A as M_,Aa as bc,B as D_,Fa as kc,Ha as U_,Wa as Rr,Ya as G_,Za as j_,a as pf,b as Ik,c as uf,d as Ti,g as oc,i as ic,k as lc,l as Cr,m as Ok,n as yc,o as wc,p as ji,q as xk,r as Pk,ta as vc,w as N_,x as L_,y as $_,ya as Ir,z as F_}from"./focused-chunks/chunk-EIOQNLBQ.js";import{$a as wr,A as fe,B as $n,C as _i,D as hi,G as gi,H as yi,I as Bu,Ia as Un,J as wi,Ja as rf,K as vi,Ka as tc,L as Fn,La as of,M as Zs,N as bi,O as Vu,Oa as nc,P as Wu,Pa as af,Q as gr,Xa as Si,_a as cf,a as ju,b as ai,c as si,cb as lf,d as ci,e as li,i as di,j as Pt,k as Nn,kb as ht,l as mi,m as Ln,mb as kr,n as pi,nb as tn,o as me,p as ui,pb as ff,q as Xs,qb as Pi,r as Ye,s as Qs,sa as nf,t as qu,u as Ie,vb as qn,w as ft,x as Ku,y as fi,z as Nt}from"./focused-chunks/chunk-JGFSSR3G.js";import{c as fp,f as _p,g as hp,i as qo,j as Rt,k as Ip,l as Rp,m as Op}from"./focused-chunks/chunk-PLTTMQAW.js";import{a as uu,b as fu,c as _u}from"./focused-chunks/chunk-AU6VJGTY.js";import{$ as Gm,A as yo,Aa as ap,B as vm,Ba as sp,C as bm,Ca as Io,D as km,Da as cp,E as wo,Ea as lp,F as Sm,Fa as dp,G as Em,Ga as Ro,H as Am,Ha as Oo,I as Tm,Ia as xo,J as vo,Ja as Po,K as bo,Ka as lr,L as Cm,La as mp,M as ko,Ma as No,Na as dr,O as Im,Oa as Lo,P as sr,Pa as $o,Q as Rm,Qa as Fo,R as Om,Ra as Mo,S as xm,Sa as pp,T as Pm,Ta as Ct,U as Nm,Ua as Do,V as Lm,Va as Uo,W as $m,Wa as Go,X as Fm,Xa as jo,Y as Mm,Z as Dm,_ as Um,_a as up,aa as jm,ab as It,ba as qm,bb as N,ca as Km,d as ks,da as cr,e as um,ea as zm,fa as Hm,ga as So,h as fo,ha as Eo,i as Ss,ia as Bm,j as Xt,ja as Vm,ka as Wm,l as fm,la as Ym,ma as Jm,na as Xm,oa as Qm,pa as Zm,q as Es,ra as ep,s as _o,sa as tp,t as ho,ta as np,u as go,ua as rp,v as _m,va as op,w as hm,wa as ip,x as gm,xa as Ao,y as ym,ya as To,z as wm,za as Co}from"./focused-chunks/chunk-WOEZJUA2.js";import{$ as Au,$a as Hu,A as Tk,Aa as _r,Ab as I,B as Ck,Bb as z,C as Pn,Cb as ae,D as C,Db as Qu,Fb as _e,Gb as Zu,H as ut,Ha as $u,Hb as ki,Ib as _t,Ja as Ws,Jb as ef,Kb as se,L as yu,Lb as tf,M as oi,Ma as Fu,N as wu,Na as ii,O as vu,Oa as We,P as bu,Pb as sf,Q as ku,Qa as Mu,R as Su,Ra as Du,T as ee,Ta as Uu,U as qs,Ua as Ys,V as re,Va as Js,Vb as vr,Wa as Gu,Wb as br,X as Ks,Xa as A,Xb as Ei,Y as Eu,Ya as Fe,Yb as Mt,Z as Ve,Za as Ce,_ as rt,_a as zu,a as ti,aa as Tu,ab as Lt,b as pk,bc as Ai,c as uk,ca as Cu,cb as ze,d as fk,da as Iu,db as hr,e as _k,ea as zs,eb as Mn,fb as Yu,gb as Dn,ha as Hs,hb as ec,ib as Ju,ja as Ru,k as ni,ka as Ou,l as hu,la as xu,m as gu,ma as Pu,n as xn,na as Nu,o as pr,ob as yr,p as hk,q as gk,r as yk,ra as $e,s as wk,sa as xt,sc as Qf,t as vk,u as bk,ua as Bs,v as kk,va as ur,vb as $t,w as Sk,wa as fr,x as Ek,xa as Vs,xb as Ft,y as ri,ya as ot,z as Ak,za as Lu,zb as Xu}from"./focused-chunks/chunk-SIEGIPNT.js";import{b as Tt,c as co,d as lo,g as mt,i as zo,j as pt,k as Ot,l as kp,n as $,o as Ho,p as nt,r as Sp}from"./focused-chunks/chunk-PBCYGO7X.js";import{e as pu}from"./focused-chunks/chunk-YLVHHWHN.js";import{$ as d,$a as E,$c as Zt,Aa as En,Ae as Xp,B as jd,Bb as ir,C as qd,Cb as bs,D as Kd,Db as ar,Dc as qp,E as zd,Ee as Qp,F as Hd,Fc as Os,Fd as Qb,G as Bd,Gc as xs,Gd as Zb,H as ms,Hc as Ps,I as ps,Ia as An,Ib as Se,Ic as Ns,Id as ek,Ie as sk,J as us,Jc as Ls,Je as ck,K as fs,Ka as Qd,Kb as B,Kc as $s,Kd as tk,Ke as lk,L as _s,Lc as Fs,Ld as nk,Le as dk,M as hs,Ma as ys,Mb as Jt,Mc as O,Md as Ds,Me as Qo,Na as ws,Nc as In,Nd as Us,Ne as Zp,Oc as Qt,Od as Gs,P as so,Pc as Y,Pd as Bp,Qa as vs,Qc as Wo,Ra as nr,Rc as Rn,Rd as Vp,Sa as Ae,Sb as Cn,Sd as rk,U as gs,Uc as Yo,Ud as ok,Va as x,Vd as ik,W as Vd,Wa as ke,Wc as Ee,Wd as ak,Xa as po,Xc as Jo,Ya as Tn,Yd as k,Z as At,Za as rr,_a as Zd,_c as Kp,aa as l,ab as em,ae as Xo,bb as lt,bc as xp,cb as ne,cc as Pp,ce as ie,db as dt,dc as Np,ec as Lp,fb as tt,fc as $p,fe as Te,gb as uo,gc as Fp,hc as Cs,ia as Wd,ic as Mp,ka as Yd,kb as tm,kc as Dp,lb as nm,lc as Up,le as Wp,ma as mo,mb as rm,nb as om,nd as zp,o as oo,oa as Jd,ob as im,oc as Is,p as Gd,pa as Xd,pb as am,pc as Gp,q as io,qb as sm,qc as Rs,r as ds,rd as Hp,sa as q,sb as or,se as Yp,ta as Wt,tb as Yt,te as Jp,ua as Be,ub as Le,v as Vt,va as J,w as ct,wd as Ms,we as On,x as kn,xc as jp,y as Sn,ya as te,z as ao}from"./focused-chunks/chunk-B3YW6H2I.js";import{AsyncLocalStorage as SM}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="73dbe40e-f7a2-5aca-85aa-a5775e5e981a")}catch{}})();var Nk=js("list").properties.outputSession,Lk={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...Nk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},K_={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},z_={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},ce={type:"string",description:"pm item id, for example pm-abc1."},$k=`Operation name (one of): ${Rs.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,Fk={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},Mk={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function D(e,t=[]){return{...z_,properties:{...z_.properties,...e},required:t}}var Dk=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:D({action:{type:"string",enum:[...Rs],description:$k},id:ce,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...Lk},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:D({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:D({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:D({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({query:{type:"string"},options:{type:"object"},...Mk},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:D({options:{type:"object"},...Fk})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:D({id:ce,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:D({since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",inputSchema:D({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"]},id:ce,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"}},required:["op"],additionalProperties:!1}},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["transactionId","mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:ce,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:D({id:ce,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:D({id:ce,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:ce,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:D({id:ce,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:D({id:ce,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:D({id:ce,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:"List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls default to the most recent 20 comments with total_count/has_more metadata for token efficiency. Pass options.limit=N to choose a page size, options.limit=0 for summary-only metadata, or options.full=true for full history.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:D({subcommand:{type:"string",enum:[...Mp]},id:ce,target:ce,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:D({id:ce,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:D({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:D({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:D({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:D({...K_,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...Cn],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...ds]},description:`Lifecycle roles for add-status: ${ds.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:K_}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:D({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:D({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:D({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],Uk={pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},Gk=Dk.map(e=>{let t=Uk[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:js(t,{properties:n,required:r})}});function H_(){return Gk.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,o)=>r.localeCompare(o)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="48a78171-1f14-5e93-82a2-27108ee87f4f")}catch{}})();var B_=new Map([["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),jk=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],nh=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Ki=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),rn=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),rh=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),oh=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),ih=new Map([...oh.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),ah=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],Ac=new Map(ah.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),qk=10,Kk=20,V_=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),sh=[["init",Im],["install",Om],["uninstall",xm],["explore",Pm],["manage",Dm],["describe",Nm],["reload",Um],["doctor",Gm],["catalog",jm],["adopt",qm],["adopt-all",Lm],["activate",$m],["deactivate",Fm],["migrate",Mm]],zk=[...sh.map(([e,t])=>e==="init"?[e,Rm]:[e,t]),["upgrade",cr]],Hk=[...sh.map(([e,t])=>[`extension ${e}`,t]),...zk.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",bo],["config",Cm],["extension",ko],["package",sr],["packages",sr],["install",Km],["create",Io],["item mutate",cp],["item complete",lp],["item reopen",dp],["copy",Ro],["focus",Oo],["update",xo],["update-many",Po],["upgrade",cr],["calendar",lr],["cal",lr],["context",dr],["ctx",dr],["get",Lo],["search",Uo],["eval",pp],["events",No],["workspace",Ct],["workspace position",[]],["workspace snapshot",Ct],["workspace snapshot create",Ct],["workspace snapshot list",Ct],["workspace snapshot inspect",Ct],["workspace snapshot restore",Ct],["workspace snapshot delete",Ct],["next",Do],["aggregate",go],["deps",Fo],["graph",Mo],["guide",$o],["reindex",zm],["history",yo],["history-compact",Sm],["history-attest",Em],["history-redact",bm],["history-repair",km],["history-author-acknowledge",wo],["merge",vm],["schema",Am],["profile",Tm],["plan",vo],["restore",Vm],["delete",Wm],["close",Hm],["close-many",So],["append",Eo],["claim",Bm],["release",Ym],["start-task",Jm],["pause-task",Xm],["close-task",Qm],["comments",_m],["notes",hm],["learnings",gm],["files",ym],["docs",wm],["test",tp],["test-runs-worker",[]],["test-all",np],["telemetry",rp],["test-runs",op],["gc",ip],["stats",Ao],["ops",[]],["duplicates",To],["validate",ap],["health",Co],["assurance",sp],...up,["contracts",Go],["completion",jo],["activity",mp],...[...nh].map(e=>[e,ho])],Or=new Map(Hk);for(let{alias:e,canonical:t}of Se){let n=Or.get(e);n!==void 0&&Or.set(t,n)}function Bk(e){return ih.get(e)||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function W_(e){let t=Se.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:Cs.includes(e)?we(e):e.startsWith("extension-")?we(`extension ${e.slice(10)}`):e.startsWith("package-")?we(`package ${e.slice(8)}`):e.startsWith("item-")?we(`item ${e.slice(5)}`):e.startsWith("test-runs-")?we(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?we(`templates ${e.slice(10)}`):Ki.has(e)?oh.get(e)??we(e):null}function Vk(e,t){let n=B(t);return n!==t||Se.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:gt(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function gt(e){return e.split("|").map(t=>we(t)).filter(t=>t.length>0)}function Wk(e,t){let n=new Set(t),r=new Set;for(let o of e)if(o.command_path)for(let i of gt(o.command_path)){let a=i.split(" ").filter(s=>s.length>0);if(a.length!==0)for(let s=a.length;s>0;s-=1){let c=a.slice(0,s).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function qi(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function xr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function Yk(e,t){if(!t)return{...e};let n=xr(e).filter(r=>{let o=r.properties;if(typeof o!="object"||o===null)return!1;let i=o.action;return typeof i!="object"||i===null?!1:i.const===t});return{...e,oneOf:n}}function Sc(e,t){let n=xr(e).filter(r=>{let o=r.properties;if(typeof o!="object"||o===null)return!1;let i=o.action;if(typeof i!="object"||i===null)return!1;let a=i.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:n}}function we(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function ch(e){return e.replace(/\s+/g,"-")}function it(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function Y_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=it(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function Ec(e,t,n){n&&(e[t]=!0)}function J_(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?n:null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Jk(e){let t=J_(e.long,"long"),n=J_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),Ec(o,"required",e.required===!0),Ec(o,"repeatable",e.repeatable===!0),Ec(o,"list",e.list===!0);let i=it(e.description);i&&(o.description=i);let a=it(e.value_name);a&&(o.value_name=a);let s=[it(e.value_type),it(e.type),a?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return s&&(o.value_type=s),o}function lh(e){let t=new Map;for(let r of e){let o=we(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},a=`${r.layer}:${r.name}`;i.sourceDedupe.has(a)||(i.sourceDedupe.add(a),i.sources.push({layer:r.layer,name:r.name}));for(let s of r.flags){let c=Jk(s);if(!c)continue;let m=`${c.flag}|${c.short??""}`;i.dedupe.has(m)||(i.dedupe.add(m),i.flags.push(c))}t.set(o,i)}let n=new Map;for(let[r,o]of t.entries())n.set(r,{flags:o.flags,sources:o.sources.sort((i,a)=>{let s=i.layer.localeCompare(a.layer);return s!==0?s:(i.name??"").localeCompare(a.name??"")})});return n}function Xk(e){let t=lh(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let a=we(i.command);if(a.length===0)continue;let s=it(i.action)??ch(a),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let p=it(m.name);return p?{name:p,required:m.required===!0,variadic:m.variadic===!0,description:it(m.description)}:null}).filter(m=>m!==null):[];n.set(a,{...i.tier===void 0?{}:{tier:i.tier},command:a,action:s,source:{layer:i.layer,name:i.name},description:it(i.description),intent:it(i.intent),arguments:c,flags:t.get(a)?.flags??[],examples:Y_(i.examples),failure_hints:Y_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(we(i));for(let i of n.keys())r.add(i);for(let i of t.keys())r.add(i);let o=[];for(let i of[...r].sort((a,s)=>a.localeCompare(s))){let a=n.get(i);o.push(Qk(i,a,t.get(i)?.flags??[]))}return o}function Qk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:ch(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Zk(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let n=t.replace(/-([a-z0-9])/g,(r,o)=>o.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return n.length>0?n:null}function eS(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function tS(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",o=e.repeatable===!0||e.list===!0;return{type:o?"array":r,...o?{items:{type:r}}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function nS(e){let t=e.command.split("|").map(o=>o.trim()).filter(o=>o.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let o of e.arguments)n[o.name]=eS(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Zk(o);!i||n[i]!==void 0||(n[i]=tS(o,e.action),o.required===!0&&r.push(i))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function rS(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function oS(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((i,a)=>i.localeCompare(a)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let o=new Set(r.flags.map(i=>`${i.flag}|${i.short??""}`));for(let i of n.flags){let a=`${i.flag}|${i.short??""}`;if(!o.has(a))o.add(a),r.flags.push(i);else{let s=r.flags.find(c=>`${c.flag}|${c.short??""}`===a);s&&rS(s,i)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function iS(e,t=A){let n={mode:At.extensions.policy.mode,trust_mode:At.extensions.policy.trust_mode,default_sandbox_profile:At.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=E(process.cwd(),e.path);if(!await q(ne(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await ir({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),a=await ar({...i,loaded:i.loaded});return{handlers:new Set(a.commands.handlers.map(s=>we(s.command))),disabledReason:null,commandDefinitions:a.registrations.commands,flagRegistrations:a.registrations.flags,registrations:a.registrations,policyState:{mode:i.policy.mode,trust_mode:i.policy.trust_mode,default_sandbox_profile:i.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function aS(e,t={}){let n=new Map;for(let r of Is){let o=Ki.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=W_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Ki)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:W_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:Se.find(o=>o.alias===r.command)?.canonical??we(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function sS(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!rn.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?gt(e.command_path):[],r=n.some(a=>t.handlers.has(a)||t.handlers.has(B(a))),o=n.map(a=>rh.get(B(a))).find(a=>typeof a=="string"),i=t.disabledReason===null&&r;return{action:e.action,invocable:i,available:i,requires_extension:!0,provider:"extension",disabled_reason:i?null:t.disabledReason??(o?`optional_package_not_installed:${o}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function dh(e){return Or.get(e)??_o}function cS(e){return rn.has(B(e))?!1:Or.has(e)}function lS(e){return nh.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function X_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function dS(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function mS(e){let t=new Map;for(let r of e.definitions){let o=X_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(s=>dS(s)).find(s=>s!==null),a=r.cli_aliases.map(s=>X_(s)).filter(s=>s!==null&&s!==o);for(let s of r.commands){let c=t.get(s)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},p=`${m.flag}|${m.short??""}`;c.seen.has(p)||(c.seen.add(p),c.flags.push(m));for(let u of a){let f=`${u}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:u}))}t.set(s,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,Es(o.flags));return n}function Q_(e,t){let n=[],r=new Set;for(let o of[...e,...t]){let i=`${o.flag}|${o.short??""}`;r.has(i)||(r.add(i),n.push(o))}return Es(n)}function pS(e,t,n,r,o){let i=new Map(t);for(let{alias:a,canonical:s}of Se){let c=t.get(s)??t.get(a);c&&(i.set(a,c),i.set(s,c))}return e.map(a=>{let s=cS(a),c=s?dh(a):[],m=n.get(lS(a))??[],p=i.get(a),u=Q_(c,m),f=Q_(u,p?.flags??[]),_=c.length>0&&(p?.flags.length??0)>0?"mixed":s?"core":"extension";return{command:a,flags:f,...r?{canonical_command:ph(a),visibility:mh(a,o),positionals:um(a)?.slots??[],flag_invocations:mr(a,f)}:{},provider:_,extension_sources:p?.sources}}).sort((a,s)=>a.command.localeCompare(s.command))}function uS(e,t=Jt){let n=new Set(e),r=new Map;for(let o of ah){let i=o.aliases.filter(a=>n.has(a));r.set(o.canonical,{canonical:o.canonical,aliases:i,contracts:[]})}for(let o of t){if(!n.has(o.canonical)||o.registration==="commander"&&!n.has(o.alias))continue;let i=r.get(o.canonical)??{canonical:o.canonical,aliases:[],contracts:[]};i.aliases.includes(o.alias)||i.aliases.push(o.alias),i.contracts.push(o),r.set(o.canonical,i)}return[...r.values()].map(({contracts:o,...i})=>o.length===0?i:{...i,contracts:o}).sort((o,i)=>o.canonical.localeCompare(i.canonical))}function fS(){return{create_string_options:ru,create_repeatable_options:Zo,update_string_options:ou,update_repeatable_options:iu,list_string_options:cm,search_string_options:lm,calendar_string_options:dm,context_string_options:mm,activity_string_options:pm}}function Z_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let s of e.required_create_fields)n.add(s);for(let s of e.required_create_repeatables)n.add(s)}let r=Tn(e,"create",n),o=[...new Set(r.required)].sort((s,c)=>s.localeCompare(c)),i=[...new Set(o.map(s=>Ae("create",s)))].sort((s,c)=>s.localeCompare(c)),a=[...new Set(e.options.filter(s=>s.required===!0).map(s=>s.key))].sort((s,c)=>s.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:a,policy_errors:[...new Set(r.errors)].sort((s,c)=>s.localeCompare(c))}}function _S(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=Z_(o,"strict"),n[r]=Z_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function hS(e,t){let n=xr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let a=i.properties;if(typeof a!="object"||a===null)return i;let s=a.action;return typeof s!="object"||s===null||s.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function gS(e){let t=qi(e.action)!==void 0||qi(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,o=e.schemaOnly===!0,i=e.flagsOnly===!0,a=e.availabilityOnly===!0,s=e.runtimeOnly===!0,c=e.full===!0,m=qi(e.action),p=qi(e.command),u=!r&&!c&&!o&&!i&&!a&&!m&&!p;return{selectedAction:m,selectedCommand:p,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:a,runtimeOnly:s,fullOutput:c,omitUnfilteredSchema:u,omitUnfilteredCommandFlags:u,omitUnfilteredCommanderAliases:u||p!==void 0&&!c}}function yS(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(t=>t).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function wS(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function vS(e,t,n){let r=await wS(t),o=await iS(e),i=x(r,o.registrations??O()),a=nt(r.schema),s=Xk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:$(r.schema),runtimeFieldRegistry:a,runtimeFieldFlagMap:mS(a),createRequiredOptionContracts:_S(i),extensionContracts:s,mergedExtensionContracts:oS(s.filter(c=>zi(n,c.command,s))),extensionFlagMap:lh(o.flagRegistrations)}}function eh(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Ki.has(e.selectedAction)||e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand)))}function bS(e,t){let n=aS(t,{includePackageOwnedActions:eh(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(Gp);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??ei(o.action))!=="internal"))}return eh(e)&&e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Bk(B(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function kS(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new l(`Unknown action: "${e.selectedAction}".`,d.USAGE)}function SS(e,t){return[...new Set([...Cs.filter(n=>!rn.has(B(n))),...[...Or.keys()].filter(n=>!rn.has(B(n))),...e.flatMap(n=>n.command_path?gt(n.command_path).filter(r=>n.provider==="extension"||!rn.has(B(r))||t.some(o=>o.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let o=Se.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>we(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function ES(e,t){let n=t.slice(0,qk),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,Kk),a=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),s=t[0];return new l(`Command "${e}" is a command namespace. Choose a concrete child command: ${o}.`,d.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:a,nextSteps:[`Retry with a child command, for example: ${a[0]}`],recovery:{suggested_retry:`pm contracts --command "${s}" --flags-only --json`,fallback_candidates:i.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function AS(e,t){return new l(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm install ${t} --project" and retry.`,d.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm install ${t} --project`],recovery:{suggested_retry:`pm install ${t} --project`}})}function TS(e){return new l(`Unknown command: "${e}".`,d.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function CS(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let n=t.filter(o=>o.startsWith(`${e.selectedCommand} `));if(n.length>0)throw ES(e.selectedCommand,n);let r=rh.get(B(e.selectedCommand));throw r?AS(e.selectedCommand,r):TS(e.selectedCommand)}function IS(e,t){let n=bS(e,t.mergedExtensionContracts);kS(e,n);let r=SS(n,t.mergedExtensionContracts);CS(e,r);let o=e.selectedCommand?ih.get(B(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Vk(m,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!i.some(m=>m.action===e.selectedAction))throw new l(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,d.USAGE);let a=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,s=[...new Map(a.map(m=>sS(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?s.filter(m=>m.invocable):s;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:a,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function RS(e){return new Set(xr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let o=r.const;return typeof o=="string"?o:null}).filter(t=>t!==null))}function OS(e){let t=eu,n=xr(t),r=RS(t),o=e.filter(i=>!r.has(i.action)).map(i=>nS(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function th(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?Yk(n,e.selectedAction):e.selectedCommand?Sc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):Sc(n,r);return e.runtimeOnly&&!e.selectedAction?Sc(o,new Set(t.actions)):o}function xS(e,t,n){let r=OS(t.mergedExtensionContracts),o=!e.flagsOnly&&!e.availabilityOnly?hS(th(e,n,r),t.createRequiredOptionContracts):th(e,n,r);return{mergedSchema:r,filteredSchema:o}}function PS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Wk(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function mh(e,t){return t.find(n=>B(n.command)===B(e))?.tier??ei(e)}function zi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||mh(t,n)!=="internal"}function NS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(Jt.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of Ac.keys())r.add(o);return t.filter(o=>!r.has(o)&&zi(e,o,n))}function ph(e){let t=Se.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":Ac.get(n)??n}var LS=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),$S=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function FS(e,t){let n=V_.get(B(e))??(e.includes(" ")?void 0:V_.get(ph(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(p=>B(p)===B(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let o=e.split(" "),i=o.at(-1),a=o.slice(0,-1).join(" "),s=LS.get(i),c=$S.get(e)??a;return{intent:s===void 0||a.length===0?`Run ${e}.`:`${s} ${c}.`,intent_source:"generated"}}function MS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(we))].filter(i=>i.length>0).sort((i,a)=>i.localeCompare(a)).map(i=>{let a=Ms(i,{generateFallback:!0}),s=i.split(" ")[0],c=Ac.get(s)??(s.startsWith("list-")?"list":s.startsWith("history-")?"history":s),m=new Set([...dh(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>B(_)===B(i))).flatMap(f=>f.flags.map(_=>_.flag))]),p=(B_.get(B(i))??B_.get(c)??jk).filter(f=>m.has(f)),u=FS(i,t);return{command:i,intent:u.intent,...o||u.intent_source!=="command"?{intent_source:u.intent_source}:{},...p.length>0?{flags:p}:{},default_max_estimated_tokens:a.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...a.default_max_estimated_tokens_by_format}}:{}}})}function DS(e){return e.map(t=>({budget:Ms(t,{generateFallback:!0}),envelope:mu(t)}))}function US(e){let t=new Map;for(let n of e){let r=su(n),o=r===void 0?[d.SUCCESS,d.GENERIC_FAILURE,d.USAGE,d.NOT_FOUND,d.CONFLICT,d.DEPENDENCY_FAILED]:r.exit_codes,i=o.join(","),a=t.get(i)??{commands:[],exit_codes:o};a.commands.push(n),t.set(i,a)}return[...t.values()]}function GS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>gt(r.command).some(o=>B(o)===B(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(o=>gt(o.command).some(i=>r.has(i)))}return t.extensionContracts.filter(r=>zi(e,r.command,t.extensionContracts))}function jS(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function qS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=pu);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(o=>o.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([o])=>r===void 0||o===r).map(([o,i])=>[o,[...new Set(i.map(a=>`--${a.cli_flag}`))].sort((a,s)=>a.localeCompare(s))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...xp],services:[...Pp],policy_modes:[...Np],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...Fp],trust_modes:[...Lp],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...$p],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...jd],create_modes:[...qd],close_validation_modes:[...Kd],workflow_enforcement_modes:[...zd]},e.relationship_kind_contracts=[...Wd,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(o=>o.definitions)].sort((o,i)=>o.kind.localeCompare(i.kind)).map(o=>({canonical:o.kind,aliases:[...o.aliases??[]],...o.inverse===void 0?{}:{inverse:o.inverse},ordering:o.ordering,hierarchy:o.hierarchy})))}function KS(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function zS(e,t,n,r,o){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=pS(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(_u).filter(([a])=>i.has(a)).map(([a,s])=>({command:a,default:s,brief_fields:[...fu],compact_fields:[...uu]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:a})=>({canonical:i,aliases:a})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function HS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=fS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function BS(e,t,n,r){e.command_summaries=MS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...zp],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(we))].filter(o=>Us(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...Bp(o).keys()]}))}:{}},e.grammar_contracts={nouns:Xt.nouns,shared_verbs:Xt.shared_verbs,scope_before_verb:Xt.scope_before_verb,visible_top_level_ceiling:Xt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Xt.ceiling_raise_requires_pm_item,positional_shape_budget:Xt.positional_shape_budget,positional_shape_count:new Set(Ss.map(({slots:o})=>fm(o))).size,positional_action_count:ks.length,positional_action_parents:[...new Set(ks.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:Ss}:{}}}async function Tc(e,t){let n=gS(e);yS(n);let r=E(process.cwd(),t.path),o=await vS(t,r,n),i=IS(n,o),a=xS(n,o,i),s=PS(n,i),c=NS(n,s,o.extensionContracts),m=jS(n,a,i,c),p=GS(n,o,c),u=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&BS(m,c,p,{includeFormatBudgets:u,includeIntentProvenance:u,includePositionalSignatures:u,includeProjectionModeMatrix:u}),n.summary)return m;let f=uS(i.commandCatalog.filter(_=>zi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||qS(m,o,n),KS(m,n,a,p),zS(m,n,o,c,f),HS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...mf],gate_triggers:[...df]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=fo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=H_(),m.context_intents=Yp(),m.read_output_dimensions=Ds,m.error_codes=cu,m.command_output_contracts=DS(c),m.diagnostic_output_contracts=Hp,m.command_exit_contracts={vocabulary:au,command_sets:US(c)}),m}import{readFile as VS}from"node:fs/promises";import WS from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="20a3a324-d176-5918-8167-5e548be4abc9")}catch{}})();var Cc="context-intents.json";function Hi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function YS(e,t,n){if(!Hi(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let r=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(r)||!r.every(o=>typeof o=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:r,token_budget:e.token_budget}}function uh(e,t){let n=Array.isArray(e)?e:Hi(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((r,o)=>YS(r,t,o))}async function JS(e){let t=WS.join(e,Cc),n;try{n=await VS(t,"utf8")}catch(o){if(Wt(o))return[];throw await Xu(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${Cc}: ${i}`,{cause:o})}return uh(r,Cc)}function XS(e){if(!Hi(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Hi(n)?n.contextIntents??n.context_intents:void 0}function QS(e){return e.flatMap(t=>{let n=XS(t.module);return n===void 0?[]:uh(n,`package ${t.name}`)})}async function ZS(e){let t=await JS(e.pmRoot),n=QS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Ic(e,t){let n=await ZS(e);return await Jp(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a4abc17-0fcb-573f-8f89-6e505e112261")}catch{}})();async function fh(e,t,n=Wp){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let r=t,o=Array.isArray(r.warnings)?r.warnings.filter(i=>typeof i=="string"):[];r.warnings=[...new Set([...o,"context_usage_feedback_write_failed"])].sort()}}}import{createHash as eE}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="93e1b043-89b2-546e-b238-1b9f4a1df742")}catch{}})();function Rc(e){let t=Yd();for(let n of e)t.register(n);return t}function tE(e,t,n=[]){if(n.length===0)return e;let r=JSON.parse(e),o=JSON.parse(Js(t));for(let i of n){let a=i.split("."),s=o;for(let p of a){let u=ys(s);if(!/^[a-zA-Z][a-zA-Z0-9_]*$/u.test(p)||["constructor","prototype","__proto__"].includes(p)||u===null||!Object.hasOwn(u,p))throw new l(`Invalid owned settings subtree: ${i}. Select a declared inline object path.`,d.USAGE);s=u[p]}if(ys(s)===null)throw new l(`Invalid owned settings subtree: ${i}. Select a declared inline object path.`,d.USAGE);let c=r,m=o;for(let p of a.slice(0,-1)){let u=c[p];m=m[p],u===void 0&&Object.defineProperty(c,p,{value:structuredClone(m),enumerable:!0,writable:!0,configurable:!0}),c=c[p]}Object.defineProperty(c,a.at(-1),{value:s,enumerable:!0,writable:!0,configurable:!0})}return Le(r,JSON.parse(e))?e:`${JSON.stringify(r,null,2)}
2
2
  `}function _h(e,t,n,r){return{client:t,isItemNotFoundError:o=>Ti(o)&&o.exitCode===d.NOT_FOUND,getItemAt:(o,i)=>ff(o,i,{pmRoot:e}),openRelationshipEventStore:o=>hf.open({pmRoot:e,nodes:o.nodes,registry:Rc(o.definitions),...o.relativePath===void 0?{}:{relativePath:o.relativePath}}),createRelationshipGraph:o=>new Xd(o.nodes,o.edges,Rc(o.definitions)),analyzeRelationshipImpact:(o,i,a)=>gf(o,i,a),validateRelationshipEvents:o=>{let i=new _f(o.nodes,{registry:Rc(o.definitions)});return o.events.map(a=>i.append({...a,expectedVersion:i.version}))},commitWorkspaceTransaction:o=>yf({...o,pmRoot:e}),mutateWorkspaceSettings:async o=>{if(!/^[a-zA-Z0-9._-]{1,128}$/u.test(o.operationId))throw new l("Workspace settings operationId must be 1-128 letters, digits, dots, underscores, or hyphens.",d.USAGE);let i=o.dryRun===!0?await Du(e,()=>A(e)):await A(e);try{let a=await ii({pmRoot:e,filePath:ne(e),op:"extension:pm:settings",idempotencyKey:r===void 0?o.operationId:`${eE("sha256").update(r).digest("hex").slice(0,16)}:${o.operationId}`,author:n??C(void 0,i.author_default),lockTtlSeconds:i.locks.ttl_seconds,lockWaitMs:i.locks.wait_ms,recordCreation:!1,dryRun:o.dryRun===!0,mutate:async s=>{let c=s===null?null:JSON.parse(s),m=ti(c);if(!m.success)throw new l("Workspace settings mutation requires a valid initialized settings.json.",d.USAGE);let p=Ys(m.data),u=await o.mutate(structuredClone(p));if(!ti(u).success)throw new l("Workspace settings mutation returned invalid settings.json.",d.USAGE);let f=Le(p,u)?s:Js(u,{source:{raw:c,validated:m.data}});f=tE(f,u,o.replaceSubtrees);let _=ti(JSON.parse(f));if(!_.success)throw new l("Workspace settings mutation serialized invalid settings.json.",d.USAGE);return{raw:f,result:o.includePreview===!0?Ys(_.data):void 0}}});return a.changed&&o.dryRun!==!0&&await Y({path:ne(e),scope:"project",op:"extension:pm:settings"}),{changed:a.changed,dry_run:o.dryRun===!0,replayed:a.replayed===!0,...a.result===void 0?{}:{preview:a.result}}}finally{Mu(e)}}}}import nE from"node:fs/promises";import X from"node:path";import rE from"node:readline/promises";import{stdin as oE,stdout as De}from"node:process";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ffab1407-659d-5bc4-95ff-5efe52baf522")}catch{}})();var xc=Symbol.for("pm.sdk.init-invocation-cwd");var iE=()=>rE.createInterface({input:oE,output:De});function aE(){return structuredClone(At)}var sE=["minimal","default","strict"];function gh(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new l("--preset must not be empty",d.USAGE);if(t==="minimal"||t==="default"||t==="strict")return t;if(t==="lite"||t==="minimum")return"minimal";throw new l(`Invalid --preset value "${e}". Allowed: ${sE.join(", ")}`,d.USAGE)}function cE(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return yp(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${gp.join(", ")}`,d.USAGE)}}}function lE(e){if(e===void 0)return;let t=e.trim();if(t.length===0)throw new l("--author must not be empty",d.USAGE);return t}function Oc(e){if(e===void 0)return!1;let t=e.trim();return t.length===0?!1:X.isAbsolute(t)||/^[a-z]:/iu.test(t)||t.startsWith(".")||t.includes("/")||t.includes("\\")}function dE(e,t,n,r){let o=r?.trim();if(r!==void 0&&o?.length===0)throw new l("--workspace must not be empty",d.USAGE);if(o!==void 0){if(t.path!==void 0||Oc(n))throw new l("--workspace cannot be combined with --pm-path/--path or a path-like positional target.",d.USAGE);let m=X.resolve(e,o),p=X.join(m,".agents","pm");return{pmRoot:p,prefixArg:n,target:{mode:"workspace-path",tracker_root:p,workspace_root:m}}}if(t.path===void 0&&Oc(n)){let m=X.resolve(e,n.trim());return{pmRoot:m,prefixArg:void 0,target:{mode:"tracker-path",tracker_root:m}}}let i=E(e,t.path),a=X.join(X.resolve(e),".agents","pm"),s=X.dirname(X.dirname(i)),c=X.resolve(i)===a?"current":"ancestor";return{pmRoot:i,prefixArg:n,target:t.path===void 0?{mode:"workspace-discovery",tracker_root:i,workspace_root:s,discovery:c,requested_cwd:X.resolve(e),...c==="ancestor"?{suggested_current_tracker_root:a}:{}}:{mode:"tracker-path",tracker_root:i}}}function mE(e,t){if(t===void 0)return e;if(t.trim().length===0)throw new l("--id-prefix must not be empty",d.USAGE);if(Oc(t))throw new l(`--id-prefix accepts an item ID prefix, not a tracker path: "${t}".`,d.USAGE,{code:"init_id_prefix_path_like",required:"Pass the tracker path positionally or with the global --path option.",examples:[`pm init ${t}`,`pm --path ${t} init`]});if(e!==void 0&&Lt(e)!==Lt(t))throw new l(`Conflicting id prefixes: positional "${e}" and --id-prefix "${t}".`,d.USAGE,{code:"init_id_prefix_conflict",required:"Use either the positional id prefix or --id-prefix with one value.",examples:[`pm init ${Lt(e)}`,`pm init --id-prefix ${Lt(t)}`]});return t}function pE(e){if(e===void 0)return"ask";let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new l("--agent-guidance must not be empty",d.USAGE);if(t==="ask"||t==="add"||t==="skip"||t==="status")return t;throw new l(`Invalid --agent-guidance value "${e}". Allowed: ${Gf.join(", ")}`,d.USAGE)}function uE(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function yh(e,t){let n=Vd[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function fE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _E(e){let t=e.details;return{installed_all:t.installed_all===!0,installed_count:typeof t.installed_count=="number"?t.installed_count:0,packages:Array.isArray(t.packages)?t.packages.filter(fE).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function hE(e,t,n){let r=zo(t.schema),o=pt(e,r.files.types,mt.types),i=_p(await J(o)),a=[],s=[];for(let c of wp(n)){let m=hp(i,c);i=m.file,(m.replaced?s:a).push(m.definition.name)}return await We({pmRoot:e,filePath:o,raw:qo(i),op:"init:type-preset",author:C(void 0,t.author_default),lockTtlSeconds:t.locks.ttl_seconds,lockWaitMs:t.locks.wait_ms}),{name:n,registered:a,updated:s,file:o}}async function gE(e){let t=[".git","package.json","pnpm-workspace.yaml","AGENTS.md",X.join(".agents","pm")];for(let n of t)if(await q(X.join(e,n)))return!0;return!1}async function yE(e,t,n){if(!t||n||await q(X.join(e,"settings.json"))||!await gE(e))return;let r=X.join(e,".agents","pm");throw new l(`Refusing to initialize tracker files directly in workspace root "${e}".`,d.USAGE,{code:"workspace_root_pm_path",type:"urn:pm-cli:error:workspace_root_pm_path",why:"Path-like init targets and --pm-path/--path point at the tracker storage directory itself, not the repository workspace. Point at .agents/pm, use --workspace, or pass --force if you intentionally want root-level tracker files.",examples:[`pm --pm-path ${r} init --yes`,"pm init --yes",`pm --pm-path ${e} init --yes --force`],nextSteps:["Use --pm-path <repo>/.agents/pm for repository-local tracker storage.","Use PM_PATH only for sandboxed tests or explicit tracker roots.","Pass --force only when root-level tracker files are intentional."],recovery:{next_best_command:`pm --pm-path ${r} init --yes`}})}async function wh(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,a=await q(i);await nE.mkdir(i,{recursive:!0}),a?r.push(`already_exists:${i}`):n.push(i),r.push(...await Y({path:i,scope:"project",op:"init:ensure_dir"}))}return{createdDirs:n,warnings:r}}async function wE(e,t){let n=iE();try{De.write(`pm init setup wizard (agent-optimized)
3
3
  `),De.write(`This walkthrough is non-destructive and each choice can be changed later with pm config.
4
4
 
@@ -1,2 +1,2 @@
1
- import{$b as hi,Aa as Oe,Ba as Ue,Ca as Pe,Da as je,Ea as Fe,F as $e,Fa as qe,G as Ie,Ga as ze,H as Be,Ha as Je,I as Ce,J as De,Oa as Ke,Pa as Xe,Qa as Le,Ra as Qe,Sa as Me,Ta as ei,Ua as ii,Va as ri,Wa as ti,Wb as mi,Xa as ni,Xb as xi,Yb as vi,Zb as yi,_b as bi,a as oe,ac as wi,b as de,bc as gi,c as ae,cc as ki,d as ue,dc as Ai,e as se,ec as Ei,f as pe,fc as _,g as fe,gc as Ri,h as ce,hc as Si,i as _e,ic as Ti,j as le,jc as $i,k as me,kc as Ii,l as xe,lc as Bi,m as ve,mb as oi,mc as Ci,n as ye,nc as l,o as be,p as he,q as we,qb as di,r as ge,rb as ai,s as ke,sb as ui,t as Ae,tb as si,u as Ee,ub as pi,v as Re,vb as fi,w as Se,wb as ci,x as Te,xb as _i,yb as li,za as Ne}from"./focused-chunks/chunk-IARAEFMA.js";import"./focused-chunks/chunk-W5AE7GKZ.js";import{h as j}from"./focused-chunks/chunk-WAOXID5J.js";import{E as B,F as C,G as D,H as N,I as O,J as U,K as P}from"./focused-chunks/chunk-2CJWTLQG.js";import"./focused-chunks/chunk-362645PL.js";import{Aa as L,Ba as Q,Ca as M,Da as ee,Ea as ie,Fa as re,Ga as te,Ha as ne,qb as We,rb as Ze,sb as Ge,ta as G,tb as He,ua as H,ub as Ve,va as V,vb as Ye,wa as Y,xa as K,ya as X}from"./focused-chunks/chunk-DSLNUL2Q.js";import"./focused-chunks/chunk-PLTTMQAW.js";import"./focused-chunks/chunk-AU6VJGTY.js";import"./focused-chunks/chunk-WOEZJUA2.js";import{E as F,F as q,G as z,H as J,I as W,lb as Z}from"./focused-chunks/chunk-MCVWZUGK.js";import"./focused-chunks/chunk-PBCYGO7X.js";import"./focused-chunks/chunk-YLVHHWHN.js";import{$b as $,Sb as h,Tb as w,Ub as g,Vb as k,Wb as A,Xb as E,Yb as R,Zb as S,_b as T,_d as c,ac as I}from"./focused-chunks/chunk-B3YW6H2I.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="7e55d416-9cc3-51c5-8e56-6b5fd5c836a9")}catch{}})();var m=["captured_redacted","captured_verbatim"],x=[{label:"home directory",pattern:/(?:\/home\/|\/Users\/)[^/\s"']+/u},{label:"GitHub token",pattern:/\b(?:gh[oprsu]_[A-Za-z0-9_]{20,})\b/u},{label:"npm token",pattern:/\bnpm_[A-Za-z0-9]{20,}\b/u},{label:"private key",pattern:/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u}];function n(e){return typeof e=="string"&&e.trim().length>0}function v(e,i){if(typeof i!="object"||i===null||Array.isArray(i))return[{boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} must contain a JSON object.`}];let r=i,t=[];r.boundary_id!==e.id&&t.push({boundary_id:e.id,kind:"fixture_boundary_mismatch",detail:`${e.fixture_path} names ${String(r.boundary_id)} instead of ${e.id}.`}),(r.version!==1||!m.includes(r.capture_source)||!n(r.capture_provenance)||!Array.isArray(r.redactions)||!r.redactions.every(n)||!("input"in r)||!("observed"in r))&&t.push({boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} lacks captured provenance, redaction metadata, input, or observed output.`});let d=JSON.stringify(i);for(let s of x)s.pattern.test(d)&&t.push({boundary_id:e.id,kind:"unsafe_fixture",detail:`${e.fixture_path} contains a possible ${s.label}.`});return t}function y(e,i){let r=Date.parse(e.waiver_expires_at),t=n(e.waiver_reason)&&n(e.waiver_owner)&&e.waiver_expires_at.endsWith("Z")&&c(e.waiver_expires_at)&&Number.isFinite(r);return{captured:0,waived:t&&r>=i?1:0,findings:t?r<i?[{boundary_id:e.id,kind:"expired_waiver",detail:`Boundary ${e.id} waiver expired at ${e.waiver_expires_at}.`}]:[]:[{boundary_id:e.id,kind:"invalid_waiver",detail:`Boundary ${e.id} waiver requires reason, owner, and an RFC 3339 UTC expiry.`}]}}function b(e,i,r){if(!n(e.id)||!n(e.producer)||!n(e.consumer)||!n(e.format))return{captured:0,waived:0,findings:[{boundary_id:n(e.id)?e.id:"unknown",kind:"invalid_boundary",detail:"Each boundary requires non-empty id, producer, consumer, and format."}]};if("fixture_path"in e){let t=i[e.fixture_path],d=n(e.fixture_path)&&e.fixture_path in i?v(e,t):[{boundary_id:e.id,kind:"missing_fixture",detail:`Boundary ${e.id} fixture ${String(e.fixture_path)} is missing.`}];return{captured:d.length===0?1:0,waived:0,findings:d}}return y(e,r)}function Ni(e,i,r=new Date){let t=[];if(e.version!==1||!n(e.inventory_scope)||!Array.isArray(e.boundaries))return{ok:!1,boundary_count:0,captured_count:0,waived_count:0,findings:[{boundary_id:"registry",kind:"invalid_registry",detail:"Boundary registry requires version 1, inventory_scope, and boundaries."}]};let d=new Set,s=0,f=0;for(let o of e.boundaries){if(typeof o!="object"||o===null||Array.isArray(o)){t.push({boundary_id:"unknown",kind:"invalid_boundary",detail:"Each boundary must be a JSON object."});continue}let a=o,u=n(a.id)?a.id:void 0;if(u!==void 0&&d.has(u)){t.push({boundary_id:u,kind:"duplicate_boundary",detail:`Boundary ${u} is inventoried more than once.`});continue}u!==void 0&&d.add(u);let p=b(a,i,r.getTime());s+=p.captured,f+=p.waived,t.push(...p.findings)}return t.sort((o,a)=>o.boundary_id!==a.boundary_id?o.boundary_id.localeCompare(a.boundary_id):o.kind.localeCompare(a.kind)),{ok:t.length===0,boundary_count:e.boundaries.length,captured_count:s,waived_count:f,findings:t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="47924d35-d6ce-5507-adbf-c4c3cb25c18e")}catch{}})();export{wi as ASSURANCE_ACTIONS,gi as ASSURANCE_DECLARATION_KINDS,pe as ASSURANCE_DOCUMENT_VERSION,fe as ASSURANCE_GATE_TRIGGERS,ce as ASSURANCE_MEASUREMENT_SOURCE_KINDS,Ke as ASSURANCE_PRESET_IDS,de as AssuranceEvaluationRefusalError,oe as AssuranceMutationRefusalError,ae as AssuranceSourceResolutionError,m as BOUNDARY_FIXTURE_CAPTURE_SOURCES,z as CURRENT_HISTORY_HASH_ALGORITHM,B as DEFECT_ESCAPE_CLASSES,C as DEFECT_GATE_EVIDENCE_DISPOSITIONS,Ne as HISTORY_AUTHOR_ATTRIBUTION_BASELINE,F as HISTORY_HASH_ALGORITHMS,q as LEGACY_HISTORY_HASH_ALGORITHM,w as MAX_WORKFLOW_POLICIES,g as MAX_WORKFLOW_POLICY_TERMS,j as PM_HISTORY_ATTESTATION_CONTRACT,G as PM_MUTATION_ACTION_CONTRACTS,h as WORKFLOW_POLICY_ACTIONS,Ie as WORKFLOW_POLICY_DOCUMENT_SCHEMA,$e as WORKFLOW_POLICY_SCHEMA,si as _testOnlyHealthCommand,Ze as _testOnlySimilarity,xi as _testOnlyValidateCommand,Ci as _testOnlyWorkspacePosition,Me as acceptAssuranceProposals,Je as acknowledgeUnknownAuthorHistoryEvents,ze as acknowledgeUnknownAuthorHistoryEventsFromTransport,N as analyzeDefectChangeRisk,hi as analyzeDefectRecurrenceCoverage,He as analyzeDuplicateItems,Le as applyAssurancePreset,ci as applyClosureTimestampFix,_e as assuranceAssertionUpdateIsLoosening,D as buildDefectRecurrenceIndex,_i as buildLinkedFileRepairReport,ai as buildStatusRoleWarnings,Be as buildWorkflowCompletenessCheck,Oe as classifyHistoryAuthorEvent,Xe as createAssurancePreset,yi as createAssuranceWorkspaceContext,ye as createEmptyAssuranceDocument,Ce as createLifecycleCompletenessPolicies,I as createWorkflowPolicyEvaluator,Qe as deriveAssuranceProposals,pi as deriveClosureTimestamp,he as evaluateAssuranceAssertion,we as evaluateAssuranceGate,Ni as evaluateBoundaryFixtures,O as evaluateDefectGateEvidence,be as evaluateMeasurement,V as evaluateMutationGuard,Ye as evaluateSimilarityGovernance,$ as evaluateWorkflowPolicies,Si as exportAttestation,Ve as findDuplicateClusters,Ge as findSimilarItems,Bi as formatWorkspacePositionHuman,ke as getAssuranceDeclaration,X as getMutationActionContract,W as historyDigest,Ue as inspectHistoryAuthorStream,te as inspectStaleInProgressItems,di as inspectStatusRoleAssignments,Y as isMutationAction,L as jaccardSimilarity,ge as listAssuranceDeclarations,Te as listAssuranceVerdicts,ti as listInvalidProvenanceHistoryStreamIds,K as listMutationActions,se as normalizeAssuranceEvaluation,ue as normalizeAssuranceMutation,ri as normalizeInvalidHistoryProvenance,Q as normalizeSimilarityText,P as parseDefectChangeRiskRequest,bi as parseDefectRecurrenceCoverageRequest,U as parseDefectRecurrencePolicy,Ri as parseHistoryAttestation,qe as parseUnknownAuthorHistoryEventCoordinates,k as parseWorkflowPolicy,A as parseWorkflowPolicyDocument,je as planUnknownAuthorHistoryAcknowledgment,ee as prepareSimilarityText,mi as projectValidateCounts,ei as promoteAssuranceAssertion,Ae as putAssuranceDeclaration,Ee as putAssuranceDeclarationBundle,Z as readWorkflowPolicies,E as readWorkflowPolicyField,Ii as readWorkspacePosition,Se as recordAssuranceVerdict,Re as removeAssuranceDeclaration,J as resolveHistoryHashAlgorithm,Fe as resolveUnknownAuthorAcknowledgmentSelector,ki as runAssuranceAction,Ai as runAssuranceDispatch,Ei as runGc,ui as runHealth,$i as runHistoryAttest,oi as runHistoryMaintenance,l as runReindex,_ as runUpgrade,vi as runValidate,De as runWorkflowPolicyAction,fi as scanClosureTimestamps,ii as scanExtensionHostVersions,Pe as scanHistoryAuthorAttribution,H as scanMutationSecrets,ni as scanProvenanceResolverHealth,ne as scanStaleInProgressItems,li as scanStorageIntegrity,ie as scoreItemSimilarity,re as scorePreparedItemSimilarity,We as similarityAdvisoryWarnings,M as tokenizeSimilarityText,me as validateAssertionDefinition,ve as validateAssuranceDocument,xe as validateGateDefinition,le as validateMeasurementDefinition,Ti as verifyAttestation,S as workflowApprovalFingerprint,T as workflowPolicyApplies,R as workflowPolicyFingerprint};
1
+ import{$b as Rt,Aa as Ze,Ba as Ge,Ca as He,Da as Ve,Ea as Ye,F as Ue,Fa as Ke,G as Pe,Ga as Le,H as Fe,Ha as Xe,I as Je,J as We,Oa as ot,Pa as at,Qa as dt,Ra as st,Sa as ft,Ta as ut,Ua as pt,Va as lt,Wa as ct,Wb as Tt,Xa as mt,Xb as It,Yb as St,Zb as At,_b as Dt,a as _e,ac as Ot,b as ge,bc as $t,c as ye,cc as Nt,d as we,dc as Bt,e as he,ec as Ct,f as ve,fc as h,g as xe,gc as zt,h as be,hc as jt,i as Ee,ic as qt,j as ke,jc as Ut,k as Te,kc as Pt,l as Ie,lc as Ft,m as Se,mb as _t,mc as Jt,n as Ae,nc as v,o as De,p as Re,q as Oe,qb as gt,r as $e,rb as yt,s as Ne,sb as wt,t as Be,tb as ht,u as Ce,ub as vt,v as ze,vb as xt,w as je,wb as bt,x as qe,xb as Et,yb as kt,za as Me}from"./focused-chunks/chunk-KNJR2WUO.js";import"./focused-chunks/chunk-W5AE7GKZ.js";import{h as V}from"./focused-chunks/chunk-WAOXID5J.js";import{E as F,F as J,G as W,H as M,I as Z,J as G,K as H}from"./focused-chunks/chunk-2CJWTLQG.js";import"./focused-chunks/chunk-52UJEHEV.js";import{Aa as de,Ba as se,Ca as fe,Da as ue,Ea as pe,Fa as le,Ga as ce,Ha as me,qb as Qe,rb as et,sb as tt,ta as te,tb as it,ua as ie,ub as rt,va as re,vb as nt,wa as ne,xa as oe,ya as ae}from"./focused-chunks/chunk-JGFSSR3G.js";import"./focused-chunks/chunk-PLTTMQAW.js";import"./focused-chunks/chunk-AU6VJGTY.js";import"./focused-chunks/chunk-WOEZJUA2.js";import{E as Y,F as K,G as L,H as X,I as Q,lb as ee}from"./focused-chunks/chunk-SIEGIPNT.js";import"./focused-chunks/chunk-PBCYGO7X.js";import"./focused-chunks/chunk-YLVHHWHN.js";import{$b as U,Sb as R,Tb as O,Ub as $,Vb as N,Wb as B,Xb as C,Yb as z,Zb as j,_b as q,_d as y,ac as P}from"./focused-chunks/chunk-B3YW6H2I.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="7e55d416-9cc3-51c5-8e56-6b5fd5c836a9")}catch{}})();var x=["captured_redacted","captured_verbatim"],b=[{label:"home directory",pattern:/(?:\/home\/|\/Users\/)[^/\s"']+/u},{label:"GitHub token",pattern:/\b(?:gh[oprsu]_[A-Za-z0-9_]{20,})\b/u},{label:"npm token",pattern:/\bnpm_[A-Za-z0-9]{20,}\b/u},{label:"private key",pattern:/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u}];function p(e){return typeof e=="string"&&e.trim().length>0}function E(e,i){if(typeof i!="object"||i===null||Array.isArray(i))return[{boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} must contain a JSON object.`}];let t=i,r=[];t.boundary_id!==e.id&&r.push({boundary_id:e.id,kind:"fixture_boundary_mismatch",detail:`${e.fixture_path} names ${String(t.boundary_id)} instead of ${e.id}.`}),(t.version!==1||!x.includes(t.capture_source)||!p(t.capture_provenance)||!Array.isArray(t.redactions)||!t.redactions.every(p)||!("input"in t)||!("observed"in t))&&r.push({boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} lacks captured provenance, redaction metadata, input, or observed output.`});let o=JSON.stringify(i);for(let u of b)u.pattern.test(o)&&r.push({boundary_id:e.id,kind:"unsafe_fixture",detail:`${e.fixture_path} contains a possible ${u.label}.`});return r}function k(e,i){let t=Date.parse(e.waiver_expires_at),r=p(e.waiver_reason)&&p(e.waiver_owner)&&e.waiver_expires_at.endsWith("Z")&&y(e.waiver_expires_at)&&Number.isFinite(t);return{captured:0,waived:r&&t>=i?1:0,findings:r?t<i?[{boundary_id:e.id,kind:"expired_waiver",detail:`Boundary ${e.id} waiver expired at ${e.waiver_expires_at}.`}]:[]:[{boundary_id:e.id,kind:"invalid_waiver",detail:`Boundary ${e.id} waiver requires reason, owner, and an RFC 3339 UTC expiry.`}]}}function T(e,i,t){if(!p(e.id)||!p(e.producer)||!p(e.consumer)||!p(e.format))return{captured:0,waived:0,findings:[{boundary_id:p(e.id)?e.id:"unknown",kind:"invalid_boundary",detail:"Each boundary requires non-empty id, producer, consumer, and format."}]};if("fixture_path"in e){let r=i[e.fixture_path],o=p(e.fixture_path)&&e.fixture_path in i?E(e,r):[{boundary_id:e.id,kind:"missing_fixture",detail:`Boundary ${e.id} fixture ${String(e.fixture_path)} is missing.`}];return{captured:o.length===0?1:0,waived:0,findings:o}}return k(e,t)}function Mt(e,i,t=new Date){let r=[];if(e.version!==1||!p(e.inventory_scope)||!Array.isArray(e.boundaries))return{ok:!1,boundary_count:0,captured_count:0,waived_count:0,findings:[{boundary_id:"registry",kind:"invalid_registry",detail:"Boundary registry requires version 1, inventory_scope, and boundaries."}]};let o=new Set,u=0,n=0;for(let d of e.boundaries){if(typeof d!="object"||d===null||Array.isArray(d)){r.push({boundary_id:"unknown",kind:"invalid_boundary",detail:"Each boundary must be a JSON object."});continue}let s=d,a=p(s.id)?s.id:void 0;if(a!==void 0&&o.has(a)){r.push({boundary_id:a,kind:"duplicate_boundary",detail:`Boundary ${a} is inventoried more than once.`});continue}a!==void 0&&o.add(a);let l=T(s,i,t.getTime());u+=l.captured,n+=l.waived,r.push(...l.findings)}return r.sort((d,s)=>d.boundary_id!==s.boundary_id?d.boundary_id.localeCompare(s.boundary_id):d.kind.localeCompare(s.kind)),{ok:r.length===0,boundary_count:e.boundaries.length,captured_count:u,waived_count:n,findings:r}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="604d7dcb-9fea-5631-8a72-b2a7ff3278f8")}catch{}})();function c(e){if(typeof e!="string"||!y(e))throw new TypeError("Invalid reliability timestamp.");return Date.parse(e)}function I(e){let i=c(e.window_start),t=c(e.window_end);if(i>=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:i,end:t}}function S(e,i,t,r){let o=new Map(i.map(n=>[n,[]])),u=new Set;for(let n of e){if(typeof n.id!="string"||n.id.trim().length===0||u.has(n.id))throw new TypeError("Invalid or duplicate reliability attempt identity.");u.add(n.id);let d=o.get(n.family);if(!d||!["success","failure","pending"].includes(n.outcome)||n.cause!==void 0&&(!["product","infrastructure","unknown"].includes(n.cause)||n.outcome!=="failure"))throw new TypeError("Invalid reliability attempt family, outcome or cause.");let s=c(n.started_at);if(n.repaired_at!==void 0&&(c(n.repaired_at)<s||n.outcome!=="failure"))throw new TypeError("Invalid reliability repair chronology.");s>=t&&s<r&&d.push(n)}return o}function Ht(e,i){let{start:t,end:r}=I(i),o=[...S(e,i.families,t,r)].map(([u,n])=>{let d=n.filter(f=>f.outcome==="failure"),s=n.filter(f=>f.outcome!=="pending").length,a=s===0?null:d.length/s,l=d.filter(f=>f.repaired_at!==void 0&&c(f.repaired_at)<r),m={product:0,infrastructure:0,unknown:0};for(let f of d)m[f.cause??"unknown"]+=1;let _=[];return s<i.min_completed_attempts&&_.push("insufficient_completed_attempts"),a!==null&&a>i.max_failure_rate&&_.push("failure_rate"),{family:u,attempts:n.length,completed:s,failed:d.length,pending:n.length-s,failure_rate:a,affected_days:[...new Set(d.map(f=>new Date(c(f.started_at)).toISOString().slice(0,10)))].sort(),repair_minutes:l.map(f=>(c(f.repaired_at)-c(f.started_at))/6e4).sort((f,w)=>f-w),unresolved:d.length-l.length,causes:m,violations:_,ok:_.length===0}});return{schema:"pm-reliability-window/1",window_start:new Date(t).toISOString(),window_end:new Date(r).toISOString(),ok:o.every(u=>u.ok),families:o}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="415e07d5-008a-5a96-ad7d-eb630aa08f57")}catch{}})();function g(e){return typeof e=="string"&&e.length>0&&e.trim()===e}function A(e){if(!Array.isArray(e)||e.length<2)throw new TypeError("Expected at least two artifact ledgers.");let i=new Map;for(let t of e){if(t===null||typeof t!="object"||!g(t.name)||i.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||t.identities.some(o=>!g(o)))throw new TypeError("Invalid or duplicate artifact identity.");i.set(t.name,r)}if([...i.values()].every(t=>t.size===0))throw new TypeError("Empty inventories cannot establish artifact reconciliation.");return i}function D(e,i){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"||!g(r.identity)||t.has(r.identity)||!g(r.reason)||!g(r.evidence))throw new TypeError("Expected unique evidence-backed artifact exceptions.");let o=r.missing_from;if(!Array.isArray(o)||o.length===0||o.length>=i.length||new Set(o).size!==o.length||o.some(u=>!i.includes(u)))throw new TypeError("Invalid artifact exception ledger signature.");t.set(r.identity,r)}return t}function Yt(e,i=[]){let t=A(e),r=[...t.keys()].sort(),o=D(i,r),u=[...new Set([...t.values()].flatMap(a=>[...a]))].sort(),n=[],d=new Set;for(let a of u){let l=r.filter(f=>!t.get(f).has(a));if(l.length===0)continue;let m=o.get(a),_=m!==void 0&&JSON.stringify([...m.missing_from].sort())===JSON.stringify(l);_&&d.add(a),n.push({identity:a,present_in:r.filter(f=>t.get(f).has(a)),missing_from:l,disposition:_?{reason:m.reason,evidence:m.evidence}:null})}let s=[...o.keys()].filter(a=>!d.has(a)).sort();return{schema:"pm-artifact-ledgers/1",ok:n.every(a=>a.disposition!==null)&&s.length===0,counts:Object.fromEntries(r.map(a=>[a,t.get(a).size])),findings:n,stale_exceptions:s}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="fca4e9bb-3a30-512e-9929-565ab6c11c54")}catch{}})();export{Ot as ASSURANCE_ACTIONS,$t as ASSURANCE_DECLARATION_KINDS,ve as ASSURANCE_DOCUMENT_VERSION,xe as ASSURANCE_GATE_TRIGGERS,be as ASSURANCE_MEASUREMENT_SOURCE_KINDS,ot as ASSURANCE_PRESET_IDS,ge as AssuranceEvaluationRefusalError,_e as AssuranceMutationRefusalError,ye as AssuranceSourceResolutionError,x as BOUNDARY_FIXTURE_CAPTURE_SOURCES,L as CURRENT_HISTORY_HASH_ALGORITHM,F as DEFECT_ESCAPE_CLASSES,J as DEFECT_GATE_EVIDENCE_DISPOSITIONS,Me as HISTORY_AUTHOR_ATTRIBUTION_BASELINE,Y as HISTORY_HASH_ALGORITHMS,K as LEGACY_HISTORY_HASH_ALGORITHM,O as MAX_WORKFLOW_POLICIES,$ as MAX_WORKFLOW_POLICY_TERMS,V as PM_HISTORY_ATTESTATION_CONTRACT,te as PM_MUTATION_ACTION_CONTRACTS,R as WORKFLOW_POLICY_ACTIONS,Pe as WORKFLOW_POLICY_DOCUMENT_SCHEMA,Ue as WORKFLOW_POLICY_SCHEMA,ht as _testOnlyHealthCommand,et as _testOnlySimilarity,It as _testOnlyValidateCommand,Jt as _testOnlyWorkspacePosition,ft as acceptAssuranceProposals,Xe as acknowledgeUnknownAuthorHistoryEvents,Le as acknowledgeUnknownAuthorHistoryEventsFromTransport,M as analyzeDefectChangeRisk,Rt as analyzeDefectRecurrenceCoverage,it as analyzeDuplicateItems,dt as applyAssurancePreset,bt as applyClosureTimestampFix,Ee as assuranceAssertionUpdateIsLoosening,W as buildDefectRecurrenceIndex,Et as buildLinkedFileRepairReport,yt as buildStatusRoleWarnings,Fe as buildWorkflowCompletenessCheck,Ze as classifyHistoryAuthorEvent,at as createAssurancePreset,At as createAssuranceWorkspaceContext,Ae as createEmptyAssuranceDocument,Je as createLifecycleCompletenessPolicies,P as createWorkflowPolicyEvaluator,st as deriveAssuranceProposals,vt as deriveClosureTimestamp,Re as evaluateAssuranceAssertion,Oe as evaluateAssuranceGate,Mt as evaluateBoundaryFixtures,Z as evaluateDefectGateEvidence,De as evaluateMeasurement,re as evaluateMutationGuard,Ht as evaluateReliabilityWindow,nt as evaluateSimilarityGovernance,U as evaluateWorkflowPolicies,jt as exportAttestation,rt as findDuplicateClusters,tt as findSimilarItems,Ft as formatWorkspacePositionHuman,Ne as getAssuranceDeclaration,ae as getMutationActionContract,Q as historyDigest,Ge as inspectHistoryAuthorStream,ce as inspectStaleInProgressItems,gt as inspectStatusRoleAssignments,ne as isMutationAction,de as jaccardSimilarity,$e as listAssuranceDeclarations,qe as listAssuranceVerdicts,ct as listInvalidProvenanceHistoryStreamIds,oe as listMutationActions,he as normalizeAssuranceEvaluation,we as normalizeAssuranceMutation,lt as normalizeInvalidHistoryProvenance,se as normalizeSimilarityText,H as parseDefectChangeRiskRequest,Dt as parseDefectRecurrenceCoverageRequest,G as parseDefectRecurrencePolicy,zt as parseHistoryAttestation,Ke as parseUnknownAuthorHistoryEventCoordinates,N as parseWorkflowPolicy,B as parseWorkflowPolicyDocument,Ve as planUnknownAuthorHistoryAcknowledgment,ue as prepareSimilarityText,Tt as projectValidateCounts,ut as promoteAssuranceAssertion,Be as putAssuranceDeclaration,Ce as putAssuranceDeclarationBundle,ee as readWorkflowPolicies,C as readWorkflowPolicyField,Pt as readWorkspacePosition,Yt as reconcileArtifactLedgers,je as recordAssuranceVerdict,ze as removeAssuranceDeclaration,X as resolveHistoryHashAlgorithm,Ye as resolveUnknownAuthorAcknowledgmentSelector,Nt as runAssuranceAction,Bt as runAssuranceDispatch,Ct as runGc,wt as runHealth,Ut as runHistoryAttest,_t as runHistoryMaintenance,v as runReindex,h as runUpgrade,St as runValidate,We as runWorkflowPolicyAction,xt as scanClosureTimestamps,pt as scanExtensionHostVersions,He as scanHistoryAuthorAttribution,ie as scanMutationSecrets,mt as scanProvenanceResolverHealth,me as scanStaleInProgressItems,kt as scanStorageIntegrity,pe as scoreItemSimilarity,le as scorePreparedItemSimilarity,Qe as similarityAdvisoryWarnings,fe as tokenizeSimilarityText,Te as validateAssertionDefinition,Se as validateAssuranceDocument,Ie as validateGateDefinition,ke as validateMeasurementDefinition,qt as verifyAttestation,j as workflowApprovalFingerprint,q as workflowPolicyApplies,z as workflowPolicyFingerprint};
2
2
  //# sourceMappingURL=sdk-governance.js.map
@@ -1,2 +1,2 @@
1
- import{a as Je,b as Ze,c as Ie}from"./focused-chunks/chunk-SAN3KPX4.js";import{A as me,B as ye,C as we,D as be,E as Re,F as _e,G as ke,H as Ae,I as Ge,J as Se,K as Ee,a as Qe,b as Xe,c as Ye,d as er,e as q,f as J,g as Z,h as Q,i as X,j as Y,k as ee,l as re,m as te,n as ne,o as ie,p as ae,q as oe,r as se,s as pe,t as de,u as ce,v as le,w as he,x as fe,y as ge,z as ue}from"./focused-chunks/chunk-362645PL.js";import{$b as P,Mb as ze,Nb as We,Ob as je,Pb as Fe,Qb as Ue,Rb as Le,Sb as Ve,Tb as Ke,Ub as qe,Yb as $,Zb as H,_b as v,ac as M,bc as N,cc as B,dc as z,ec as W,fc as j,gc as F,ic as _,jc as U,kc as L,lc as V,mc as K,nc as rr}from"./focused-chunks/chunk-MCVWZUGK.js";import"./focused-chunks/chunk-PBCYGO7X.js";import"./focused-chunks/chunk-YLVHHWHN.js";import{Qb as Be,ia as $e,ic as O,ja as R,ka as S,la as He,ma as ve,na as Pe,oa as Me,pa as f,qa as Ne,tb as w}from"./focused-chunks/chunk-B3YW6H2I.js";import{createHash as De}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="ff60bc5b-bd85-5b3c-9a55-21e7e72477ac")}catch{}})();var k=1;function g(e){e?.throwIfAborted()}function l(e,r){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship graph ${r} must be non-empty`);return e.trim()}function u(e,r,t={}){let n=Date.parse(t.createdAt??new Date().toISOString());if(!Number.isFinite(n))throw new TypeError("Relationship graph createdAt must be a valid timestamp");let i=e.nodes(),s=e.edges(),a=r.list();return Object.freeze({version:k,fingerprint:De("sha256").update(w({nodes:i,edges:s,kinds:a})).digest("hex"),created_at:new Date(n).toISOString(),nodes:i,edges:s,kinds:a})}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e){if(!Te(e))throw new TypeError("Relationship graph snapshot must be an object");if(e.version!==k)throw new TypeError(`Unsupported relationship graph snapshot version: ${String(e.version)}`);if(!Array.isArray(e.nodes)||e.nodes.some(i=>typeof i!="string"))throw new TypeError("Relationship graph snapshot nodes must be strings");if(!Array.isArray(e.edges)||!Array.isArray(e.kinds))throw new TypeError("Relationship graph snapshot edges and kinds must be arrays");if(typeof e.created_at!="string"||!Number.isFinite(Date.parse(e.created_at)))throw new TypeError("Relationship graph snapshot created_at must be valid");if(typeof e.fingerprint!="string")throw new TypeError("Relationship graph snapshot fingerprint must be a string");let r=new R([]);for(let i of e.kinds)r.register(i);let t=new f(e.nodes,e.edges,r),n=u(t,r,{createdAt:e.created_at});if(n.fingerprint!==e.fingerprint)throw new TypeError("Relationship graph snapshot fingerprint mismatch");return{snapshot:n,registry:r,graph:t}}async function c(e,r){l(e.name,"adapter name");let t=l(r.workspace,"workspace");g(r.signal);let n=await e.read({...r,workspace:t});return g(r.signal),n===null?null:y(n)}async function b(e,r){let t=l(r.workspace,"workspace"),n=y(r.snapshot).snapshot,i=await c(e,{workspace:t,signal:r.signal});if(i?.snapshot.fingerprint===n.fingerprint)return{adapter:e.name,workspace:t,disposition:"current",fingerprint:n.fingerprint,previous_fingerprint:i.snapshot.fingerprint,node_count:n.nodes.length,edge_count:n.edges.length};if(g(r.signal),await e.replace({workspace:t,signal:r.signal,snapshot:n,expected_fingerprint:i?.snapshot.fingerprint??null}),(await c(e,{workspace:t,signal:r.signal}))?.snapshot.fingerprint!==n.fingerprint)throw new Error(`Relationship graph adapter "${e.name}" did not expose the replaced snapshot`);return{adapter:e.name,workspace:t,disposition:"written",fingerprint:n.fingerprint,...i?{previous_fingerprint:i.snapshot.fingerprint}:{},node_count:n.nodes.length,edge_count:n.edges.length}}function Ce(e,r={}){let t=e.map(y),n=new Map;for(let a of t)for(let o of a.snapshot.kinds){let d=n.get(o.kind);if(d&&w(d)!==w(o))throw new TypeError(`Conflicting federated relationship kind: ${o.kind}`);n.set(o.kind,o)}let i=new R([...n.values()].sort((a,o)=>a.kind.localeCompare(o.kind))),s=new f(new Set(t.flatMap(a=>[...a.snapshot.nodes])),t.flatMap(a=>[...a.snapshot.edges]),i);return u(s,i,r)}var m=class{name;#e=new Map;constructor(r="memory"){this.name=l(r,"adapter name")}async read(r){g(r.signal);let t=this.#e.get(l(r.workspace,"workspace"));return t?structuredClone(t):null}async replace(r){g(r.signal);let t=l(r.workspace,"workspace"),n=this.#e.get(t);if(r.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==r.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${t}`);this.#e.set(t,structuredClone(y(r.snapshot).snapshot))}async clear(r){g(r.signal);let t=l(r.workspace,"workspace"),n=this.#e.get(t);if(r.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==r.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${t}`);this.#e.delete(t)}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e47f9bb8-f98e-5159-9116-29c3e6fedfc3")}catch{}})();function E(e,r){if(!Number.isInteger(e)||e<1)throw new TypeError(`Relationship graph ${r} must be a positive integer`);return e}function xe(e){let r=E(e.nodeCount,"nodeCount"),t=E(e.edgeStride??1,"edgeStride"),n=e.topology??"chain";if(!["chain","star","disconnected"].includes(n))throw new TypeError(`Unsupported relationship graph topology: ${n}`);let i=(e.kind??"related").trim(),s=(e.idPrefix??"node").trim();if(!i||!s)throw new TypeError("Relationship graph kind and idPrefix must be non-empty");let a=n==="disconnected"?0:Math.floor((r-1)/t);return{node_count:r,edge_count:a,edge_basis:"fixture_generated",nodes:{*[Symbol.iterator](){for(let o=0;o<r;o+=1)yield`${s}-${o}`}},edges:{*[Symbol.iterator](){if(n!=="disconnected")for(let o=t;o<r;o+=t)yield{source:`${s}-${n==="star"?0:o-t}`,target:`${s}-${o}`,kind:i}}}}}function h(e,r){if(!e)throw new Error(`Relationship graph adapter conformance: ${r}`)}async function I(e,r={}){let t=r.workspace?.trim()||"pm-graph-conformance",n=S(),i=u(new f(["a","b"],[{source:"a",target:"b",kind:"related"}],n),n,{createdAt:"2026-01-01T00:00:00.000Z"}),s=u(new f(["a","b","c"],[{source:"a",target:"b",kind:"related"},{source:"b",target:"c",kind:"blocked_by"}],n),n,{createdAt:"2026-01-02T00:00:00.000Z"}),a=[];h(await c(e,{workspace:t})===null,"workspace must start empty"),a.push({name:"empty-read",passed:!0});let o=await b(e,{workspace:t,snapshot:i});h(o.disposition==="written","first sync must write"),a.push({name:"atomic-replace",passed:!0}),(await e.read({workspace:t})).nodes.push("mutated-reader-copy"),h((await c(e,{workspace:t}))?.snapshot.nodes.length===2,"reads must not mutate stored state"),a.push({name:"read-isolation",passed:!0}),h((await b(e,{workspace:t,snapshot:i})).disposition==="current","identical sync must be idempotent"),a.push({name:"idempotent-sync",passed:!0}),await e.replace({workspace:t,snapshot:s,expected_fingerprint:i.fingerprint}),h((await c(e,{workspace:t}))?.snapshot.fingerprint===s.fingerprint,"replacement must become visible"),a.push({name:"replacement-visibility",passed:!0});let d=!1;try{await e.replace({workspace:t,snapshot:i,expected_fingerprint:i.fingerprint})}catch{d=!0}return h(d,"stale compare-and-swap must fail"),a.push({name:"stale-cas",passed:!0}),e.clear&&(await e.clear({workspace:t,expected_fingerprint:s.fingerprint}),h(await c(e,{workspace:t})===null,"clear must remove the workspace"),a.push({name:"clear",passed:!0})),{adapter:e.name,workspace:t,cases:Object.freeze(a),clear_supported:e.clear!==void 0}}function Oe(e){return I(new m,e?{workspace:e}:{})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="df28925a-72d8-5d39-accf-e295ee01d3f9")}catch{}})();import{createHash as D}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="7163a078-d8be-5bca-813f-c941fcb8e406")}catch{}})();function T(e,r){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship backfill ${r} must be non-empty`);return e.trim()}function Dr(e,r){let t=T(r.migrationId,"migrationId"),n=T(r.author,"author"),i=Date.parse(r.timestamp);if(!Number.isFinite(i))throw new TypeError("Relationship backfill timestamp must be valid");let s=new Date(i).toISOString(),a=_(e,void 0,r.registry),o=a.graph.nodes(),d=a.graph.edges().map(p=>{let G=D("sha256").update(JSON.stringify([t,p.kind,p.source,p.target,p.createdAt??null,p.author??null,p.payload??null])).digest("hex").slice(0,24);return Object.freeze({eventId:`backfill:${t}:${G}`,relationshipId:`migration:${t}:${G}`,action:"add",edge:p,author:n,timestamp:s,reason:`Backfill ${t} from legacy item metadata`})}),C=D("sha256").update(JSON.stringify({migrationId:t,nodes:o,events:d})).digest("hex"),x=new Set([...r.existingEventIds??[]].filter(p=>typeof p=="string").map(p=>p.trim()).filter(Boolean)),A=d.filter(p=>!x.has(p.eventId));return Object.freeze({migration_id:t,fingerprint:C,nodes:o,events:Object.freeze(A),edge_count:d.length,skipped_existing_count:d.length-A.length,duplicate_dependency_rows:a.duplicateRows.length,dangling_reference_count:a.dangling.active.length+a.dangling.legacy_terminal.length})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="3160880c-9d85-52c5-ae1d-ada213f56ce6")}catch{}})();export{We as ACTIONABILITY_ORDERING_KINDS,$e as BUILTIN_RELATIONSHIP_KINDS,ge as GRAPH_DURABLE_CACHE_MIN_ITEMS,fe as GRAPH_DURABLE_CACHE_VERSION,Be as GRAPH_QUERY_DEFAULTS,O as GRAPH_SUBCOMMAND_VALUES,m as MemoryRelationshipGraphAdapter,k as RELATIONSHIP_GRAPH_SNAPSHOT_VERSION,Je as RelationshipEventLog,Ze as RelationshipEventStore,f as RelationshipGraph,R as RelationshipKindRegistry,L as WorkspaceGraphCache,Xe as analyzeGraphImpact,v as analyzeHierarchyIntegrity,Ye as analyzeKnowledgeGraph,Qe as analyzeRelationshipExecution,ae as analyzeRelationshipSchedule,_ as assembleWorkspaceRelationshipGraph,N as assertHierarchyMutationAllowed,Oe as assertMemoryRelationshipGraphAdapterConformance,Me as assertRelationshipEdgeAllowed,I as assertRelationshipGraphAdapterConformance,le as auditWorkspaceRelationshipGraph,rr as buildRelationshipContext,He as canonicalizeRelationshipKind,be as clearDurableGraphCache,je as collectBlockedByIds,Ue as collectBlockedByIdsFromCorpus,j as collectDanglingDependencyReferences,Ve as collectDependencyBlockedIds,z as collectDuplicateDependencyRows,ce as collectDuplicateRelationshipEdgeGroups,H as collectHierarchyRelations,F as collectMissingDependencyTargetIds,Ie as collectNewOrderingCycleWarnings,se as collectOrderingCycles,W as collectOrderingStorageContradictions,er as compareRelationshipSnapshots,qe as computeActionabilityReport,ne as computeRelationshipCentrality,te as computeRelationshipDominators,U as computeWorkspaceGraphFingerprint,xe as createRelationshipGraphScaleFixture,u as createRelationshipGraphSnapshot,S as createRelationshipKindRegistry,Ne as dependencyToRelationship,oe as deriveRelationshipDeadlines,ee as detectRelationshipCommunities,he as diffRelationshipAuditSnapshots,ue as durableGraphCachePath,Re as durableGraphCacheStatus,X as enumerateRelationshipPaths,Ce as federateRelationshipGraphSnapshots,re as findRedundantRelationshipEdges,ie as findRelationshipCutStructure,Y as forEachMatchedRelationshipEdge,de as formatDuplicateEdgeGroup,P as formatHierarchyRelation,pe as formatOrderingStorageContradiction,me as graphAuditBaselinePath,q as hierarchyAncestors,J as hierarchyDescendants,Fe as indexBlockedByIds,M as indexHierarchyRelations,Pe as isOrderingRelationshipKind,ke as loadGraphAuditBaseline,c as loadRelationshipGraphAdapter,B as normalizeDependencyGraphTarget,ye as openDurableGraphCache,Z as orderingPredecessors,Q as orderingSuccessors,Se as parseGraphSubcommand,y as parseRelationshipGraphSnapshot,we as persistDurableGraphResult,Dr as planRelationshipEventBackfill,Ge as planRelationshipRemediation,K as resetWorkspaceGraphCache,ve as resolveCanonicalRelationshipKind,Le as resolveItemBlockers,ze as resolveItemExecutionRole,$ as resolveWorkspaceRelationshipKindRegistry,Ee as runGraph,Ae as saveGraphAuditBaseline,Ke as selectActionableEntries,_e as shouldPersistDurableGraphCache,b as syncRelationshipGraphAdapter,V as workspaceGraphCache};
1
+ import{a as Je,b as Ze,c as Ie}from"./focused-chunks/chunk-GVGFUD52.js";import{A as me,B as ye,C as we,D as be,E as Re,F as _e,G as ke,H as Ae,I as Ge,J as Se,K as Ee,a as Qe,b as Xe,c as Ye,d as er,e as q,f as J,g as Z,h as Q,i as X,j as Y,k as ee,l as re,m as te,n as ne,o as ie,p as ae,q as oe,r as se,s as pe,t as de,u as ce,v as le,w as he,x as fe,y as ge,z as ue}from"./focused-chunks/chunk-52UJEHEV.js";import{$b as P,Mb as ze,Nb as We,Ob as je,Pb as Fe,Qb as Ue,Rb as Le,Sb as Ve,Tb as Ke,Ub as qe,Yb as $,Zb as H,_b as v,ac as M,bc as N,cc as B,dc as z,ec as W,fc as j,gc as F,ic as _,jc as U,kc as L,lc as V,mc as K,nc as rr}from"./focused-chunks/chunk-SIEGIPNT.js";import"./focused-chunks/chunk-PBCYGO7X.js";import"./focused-chunks/chunk-YLVHHWHN.js";import{Qb as Be,ia as $e,ic as O,ja as R,ka as S,la as He,ma as ve,na as Pe,oa as Me,pa as f,qa as Ne,tb as w}from"./focused-chunks/chunk-B3YW6H2I.js";import{createHash as De}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="ff60bc5b-bd85-5b3c-9a55-21e7e72477ac")}catch{}})();var k=1;function g(e){e?.throwIfAborted()}function l(e,r){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship graph ${r} must be non-empty`);return e.trim()}function u(e,r,t={}){let n=Date.parse(t.createdAt??new Date().toISOString());if(!Number.isFinite(n))throw new TypeError("Relationship graph createdAt must be a valid timestamp");let i=e.nodes(),s=e.edges(),a=r.list();return Object.freeze({version:k,fingerprint:De("sha256").update(w({nodes:i,edges:s,kinds:a})).digest("hex"),created_at:new Date(n).toISOString(),nodes:i,edges:s,kinds:a})}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e){if(!Te(e))throw new TypeError("Relationship graph snapshot must be an object");if(e.version!==k)throw new TypeError(`Unsupported relationship graph snapshot version: ${String(e.version)}`);if(!Array.isArray(e.nodes)||e.nodes.some(i=>typeof i!="string"))throw new TypeError("Relationship graph snapshot nodes must be strings");if(!Array.isArray(e.edges)||!Array.isArray(e.kinds))throw new TypeError("Relationship graph snapshot edges and kinds must be arrays");if(typeof e.created_at!="string"||!Number.isFinite(Date.parse(e.created_at)))throw new TypeError("Relationship graph snapshot created_at must be valid");if(typeof e.fingerprint!="string")throw new TypeError("Relationship graph snapshot fingerprint must be a string");let r=new R([]);for(let i of e.kinds)r.register(i);let t=new f(e.nodes,e.edges,r),n=u(t,r,{createdAt:e.created_at});if(n.fingerprint!==e.fingerprint)throw new TypeError("Relationship graph snapshot fingerprint mismatch");return{snapshot:n,registry:r,graph:t}}async function c(e,r){l(e.name,"adapter name");let t=l(r.workspace,"workspace");g(r.signal);let n=await e.read({...r,workspace:t});return g(r.signal),n===null?null:y(n)}async function b(e,r){let t=l(r.workspace,"workspace"),n=y(r.snapshot).snapshot,i=await c(e,{workspace:t,signal:r.signal});if(i?.snapshot.fingerprint===n.fingerprint)return{adapter:e.name,workspace:t,disposition:"current",fingerprint:n.fingerprint,previous_fingerprint:i.snapshot.fingerprint,node_count:n.nodes.length,edge_count:n.edges.length};if(g(r.signal),await e.replace({workspace:t,signal:r.signal,snapshot:n,expected_fingerprint:i?.snapshot.fingerprint??null}),(await c(e,{workspace:t,signal:r.signal}))?.snapshot.fingerprint!==n.fingerprint)throw new Error(`Relationship graph adapter "${e.name}" did not expose the replaced snapshot`);return{adapter:e.name,workspace:t,disposition:"written",fingerprint:n.fingerprint,...i?{previous_fingerprint:i.snapshot.fingerprint}:{},node_count:n.nodes.length,edge_count:n.edges.length}}function Ce(e,r={}){let t=e.map(y),n=new Map;for(let a of t)for(let o of a.snapshot.kinds){let d=n.get(o.kind);if(d&&w(d)!==w(o))throw new TypeError(`Conflicting federated relationship kind: ${o.kind}`);n.set(o.kind,o)}let i=new R([...n.values()].sort((a,o)=>a.kind.localeCompare(o.kind))),s=new f(new Set(t.flatMap(a=>[...a.snapshot.nodes])),t.flatMap(a=>[...a.snapshot.edges]),i);return u(s,i,r)}var m=class{name;#e=new Map;constructor(r="memory"){this.name=l(r,"adapter name")}async read(r){g(r.signal);let t=this.#e.get(l(r.workspace,"workspace"));return t?structuredClone(t):null}async replace(r){g(r.signal);let t=l(r.workspace,"workspace"),n=this.#e.get(t);if(r.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==r.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${t}`);this.#e.set(t,structuredClone(y(r.snapshot).snapshot))}async clear(r){g(r.signal);let t=l(r.workspace,"workspace"),n=this.#e.get(t);if(r.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==r.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${t}`);this.#e.delete(t)}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="e47f9bb8-f98e-5159-9116-29c3e6fedfc3")}catch{}})();function E(e,r){if(!Number.isInteger(e)||e<1)throw new TypeError(`Relationship graph ${r} must be a positive integer`);return e}function xe(e){let r=E(e.nodeCount,"nodeCount"),t=E(e.edgeStride??1,"edgeStride"),n=e.topology??"chain";if(!["chain","star","disconnected"].includes(n))throw new TypeError(`Unsupported relationship graph topology: ${n}`);let i=(e.kind??"related").trim(),s=(e.idPrefix??"node").trim();if(!i||!s)throw new TypeError("Relationship graph kind and idPrefix must be non-empty");let a=n==="disconnected"?0:Math.floor((r-1)/t);return{node_count:r,edge_count:a,edge_basis:"fixture_generated",nodes:{*[Symbol.iterator](){for(let o=0;o<r;o+=1)yield`${s}-${o}`}},edges:{*[Symbol.iterator](){if(n!=="disconnected")for(let o=t;o<r;o+=t)yield{source:`${s}-${n==="star"?0:o-t}`,target:`${s}-${o}`,kind:i}}}}}function h(e,r){if(!e)throw new Error(`Relationship graph adapter conformance: ${r}`)}async function I(e,r={}){let t=r.workspace?.trim()||"pm-graph-conformance",n=S(),i=u(new f(["a","b"],[{source:"a",target:"b",kind:"related"}],n),n,{createdAt:"2026-01-01T00:00:00.000Z"}),s=u(new f(["a","b","c"],[{source:"a",target:"b",kind:"related"},{source:"b",target:"c",kind:"blocked_by"}],n),n,{createdAt:"2026-01-02T00:00:00.000Z"}),a=[];h(await c(e,{workspace:t})===null,"workspace must start empty"),a.push({name:"empty-read",passed:!0});let o=await b(e,{workspace:t,snapshot:i});h(o.disposition==="written","first sync must write"),a.push({name:"atomic-replace",passed:!0}),(await e.read({workspace:t})).nodes.push("mutated-reader-copy"),h((await c(e,{workspace:t}))?.snapshot.nodes.length===2,"reads must not mutate stored state"),a.push({name:"read-isolation",passed:!0}),h((await b(e,{workspace:t,snapshot:i})).disposition==="current","identical sync must be idempotent"),a.push({name:"idempotent-sync",passed:!0}),await e.replace({workspace:t,snapshot:s,expected_fingerprint:i.fingerprint}),h((await c(e,{workspace:t}))?.snapshot.fingerprint===s.fingerprint,"replacement must become visible"),a.push({name:"replacement-visibility",passed:!0});let d=!1;try{await e.replace({workspace:t,snapshot:i,expected_fingerprint:i.fingerprint})}catch{d=!0}return h(d,"stale compare-and-swap must fail"),a.push({name:"stale-cas",passed:!0}),e.clear&&(await e.clear({workspace:t,expected_fingerprint:s.fingerprint}),h(await c(e,{workspace:t})===null,"clear must remove the workspace"),a.push({name:"clear",passed:!0})),{adapter:e.name,workspace:t,cases:Object.freeze(a),clear_supported:e.clear!==void 0}}function Oe(e){return I(new m,e?{workspace:e}:{})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="df28925a-72d8-5d39-accf-e295ee01d3f9")}catch{}})();import{createHash as D}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="7163a078-d8be-5bca-813f-c941fcb8e406")}catch{}})();function T(e,r){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship backfill ${r} must be non-empty`);return e.trim()}function Dr(e,r){let t=T(r.migrationId,"migrationId"),n=T(r.author,"author"),i=Date.parse(r.timestamp);if(!Number.isFinite(i))throw new TypeError("Relationship backfill timestamp must be valid");let s=new Date(i).toISOString(),a=_(e,void 0,r.registry),o=a.graph.nodes(),d=a.graph.edges().map(p=>{let G=D("sha256").update(JSON.stringify([t,p.kind,p.source,p.target,p.createdAt??null,p.author??null,p.payload??null])).digest("hex").slice(0,24);return Object.freeze({eventId:`backfill:${t}:${G}`,relationshipId:`migration:${t}:${G}`,action:"add",edge:p,author:n,timestamp:s,reason:`Backfill ${t} from legacy item metadata`})}),C=D("sha256").update(JSON.stringify({migrationId:t,nodes:o,events:d})).digest("hex"),x=new Set([...r.existingEventIds??[]].filter(p=>typeof p=="string").map(p=>p.trim()).filter(Boolean)),A=d.filter(p=>!x.has(p.eventId));return Object.freeze({migration_id:t,fingerprint:C,nodes:o,events:Object.freeze(A),edge_count:d.length,skipped_existing_count:d.length-A.length,duplicate_dependency_rows:a.duplicateRows.length,dangling_reference_count:a.dangling.active.length+a.dangling.legacy_terminal.length})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="3160880c-9d85-52c5-ae1d-ada213f56ce6")}catch{}})();export{We as ACTIONABILITY_ORDERING_KINDS,$e as BUILTIN_RELATIONSHIP_KINDS,ge as GRAPH_DURABLE_CACHE_MIN_ITEMS,fe as GRAPH_DURABLE_CACHE_VERSION,Be as GRAPH_QUERY_DEFAULTS,O as GRAPH_SUBCOMMAND_VALUES,m as MemoryRelationshipGraphAdapter,k as RELATIONSHIP_GRAPH_SNAPSHOT_VERSION,Je as RelationshipEventLog,Ze as RelationshipEventStore,f as RelationshipGraph,R as RelationshipKindRegistry,L as WorkspaceGraphCache,Xe as analyzeGraphImpact,v as analyzeHierarchyIntegrity,Ye as analyzeKnowledgeGraph,Qe as analyzeRelationshipExecution,ae as analyzeRelationshipSchedule,_ as assembleWorkspaceRelationshipGraph,N as assertHierarchyMutationAllowed,Oe as assertMemoryRelationshipGraphAdapterConformance,Me as assertRelationshipEdgeAllowed,I as assertRelationshipGraphAdapterConformance,le as auditWorkspaceRelationshipGraph,rr as buildRelationshipContext,He as canonicalizeRelationshipKind,be as clearDurableGraphCache,je as collectBlockedByIds,Ue as collectBlockedByIdsFromCorpus,j as collectDanglingDependencyReferences,Ve as collectDependencyBlockedIds,z as collectDuplicateDependencyRows,ce as collectDuplicateRelationshipEdgeGroups,H as collectHierarchyRelations,F as collectMissingDependencyTargetIds,Ie as collectNewOrderingCycleWarnings,se as collectOrderingCycles,W as collectOrderingStorageContradictions,er as compareRelationshipSnapshots,qe as computeActionabilityReport,ne as computeRelationshipCentrality,te as computeRelationshipDominators,U as computeWorkspaceGraphFingerprint,xe as createRelationshipGraphScaleFixture,u as createRelationshipGraphSnapshot,S as createRelationshipKindRegistry,Ne as dependencyToRelationship,oe as deriveRelationshipDeadlines,ee as detectRelationshipCommunities,he as diffRelationshipAuditSnapshots,ue as durableGraphCachePath,Re as durableGraphCacheStatus,X as enumerateRelationshipPaths,Ce as federateRelationshipGraphSnapshots,re as findRedundantRelationshipEdges,ie as findRelationshipCutStructure,Y as forEachMatchedRelationshipEdge,de as formatDuplicateEdgeGroup,P as formatHierarchyRelation,pe as formatOrderingStorageContradiction,me as graphAuditBaselinePath,q as hierarchyAncestors,J as hierarchyDescendants,Fe as indexBlockedByIds,M as indexHierarchyRelations,Pe as isOrderingRelationshipKind,ke as loadGraphAuditBaseline,c as loadRelationshipGraphAdapter,B as normalizeDependencyGraphTarget,ye as openDurableGraphCache,Z as orderingPredecessors,Q as orderingSuccessors,Se as parseGraphSubcommand,y as parseRelationshipGraphSnapshot,we as persistDurableGraphResult,Dr as planRelationshipEventBackfill,Ge as planRelationshipRemediation,K as resetWorkspaceGraphCache,ve as resolveCanonicalRelationshipKind,Le as resolveItemBlockers,ze as resolveItemExecutionRole,$ as resolveWorkspaceRelationshipKindRegistry,Ee as runGraph,Ae as saveGraphAuditBaseline,Ke as selectActionableEntries,_e as shouldPersistDurableGraphCache,b as syncRelationshipGraphAdapter,V as workspaceGraphCache};
2
2
  //# sourceMappingURL=sdk-graph.js.map