@unbrained/pm-cli 2026.9.30 → 2026.10.2

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 (134) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +20 -0
  3. package/dist/cli/error-guidance.d.ts +5 -0
  4. package/dist/cli/error-guidance.js +1 -1
  5. package/dist/cli/main.js +2 -2
  6. package/dist/cli/register-list-query.d.ts +8 -5
  7. package/dist/cli/register-list-query.js +2 -2
  8. package/dist/cli/register-structured-mutation.d.ts +2 -0
  9. package/dist/cli/register-structured-mutation.js +1 -1
  10. package/dist/cli/runtime/projection-retry.d.ts +9 -0
  11. package/dist/cli/runtime/projection-retry.js +2 -0
  12. package/dist/cli/runtime/selection.d.ts +5 -1
  13. package/dist/cli/runtime/selection.js +1 -1
  14. package/dist/cli-bundle/bundle-manifest.json +157 -157
  15. package/dist/cli-bundle/chunks/{chunk-EGAIIWI3.js → chunk-7FUEQOYG.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-7NL3A2BY.js +2 -0
  17. package/dist/cli-bundle/chunks/chunk-CZLAWXDR.js +8 -0
  18. package/dist/cli-bundle/chunks/chunk-HY6M34B4.js +2 -0
  19. package/dist/cli-bundle/chunks/{chunk-O23CQ5T4.js → chunk-MTJMOI4I.js} +14 -14
  20. package/dist/cli-bundle/chunks/chunk-R4TUD355.js +6 -0
  21. package/dist/cli-bundle/chunks/chunk-R7ULWMBG.js +238 -0
  22. package/dist/cli-bundle/chunks/chunk-SV7CZEVV.js +20 -0
  23. package/dist/cli-bundle/chunks/chunk-TRYXVQ7W.js +3 -0
  24. package/dist/cli-bundle/chunks/{chunk-BTCE36JS.js → chunk-WP6NRH72.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-XRN3JYNN.js → chunk-XOUBIF6Z.js} +38 -38
  26. package/dist/cli-bundle/chunks/chunk-Z2GYDSAO.js +3 -0
  27. package/dist/cli-bundle/chunks/{chunk-6YEET7XI.js → chunk-ZI7F3FVE.js} +47 -47
  28. package/dist/cli-bundle/chunks/{register-list-query-SYNBVMNG.js → register-list-query-R4PHNB7W.js} +6 -6
  29. package/dist/cli-bundle/chunks/register-mutation-PDDAUDYV.js +20 -0
  30. package/dist/cli-bundle/chunks/{register-operations-7FCJUC4Z.js → register-operations-A5HJT46K.js} +2 -2
  31. package/dist/cli-bundle/chunks/{register-setup-YTWW2KL5.js → register-setup-EZ2F25JI.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-MOUCTR72.js → chunk-3BIYG72P.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/{chunk-T4PZJQG4.js → chunk-4FFPGNCJ.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-AKB3JN57.js → chunk-BLCTBSGT.js} +45 -45
  35. package/dist/cli-bundle/focused-chunks/{chunk-XUCXRZZZ.js → chunk-DBD4W4QP.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-KZULQIAG.js → chunk-E754JDLY.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-4AORVUT4.js → chunk-EJN7DY3B.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-OMBDUJWZ.js → chunk-FKK2HI3S.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/chunk-GBD4EN6S.js +12 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-ZJ3CLTV4.js → chunk-GMYUNHST.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-IR4UXLRP.js +20 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-RIJQQOEZ.js → chunk-UTRSM3ZK.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/{chunk-EVMH4SKN.js → chunk-VVWYI2X7.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-WCY6HRZO.js +30 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-XB5Q2P7Z.js → chunk-XRSCIYHR.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-YC32ZSLS.js +165 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-IQBFYQF2.js → chunk-ZIXFMIUL.js} +2 -2
  48. package/dist/cli-bundle/main.js +22 -22
  49. package/dist/cli-bundle/sdk-authoring.js +1 -1
  50. package/dist/cli-bundle/sdk-contracts.js +2 -2
  51. package/dist/cli-bundle/sdk-core.js +2 -2
  52. package/dist/cli-bundle/sdk-governance.js +1 -1
  53. package/dist/cli-bundle/sdk-graph.js +1 -1
  54. package/dist/cli-bundle/sdk-merge.js +48 -48
  55. package/dist/cli-bundle/sdk-query.js +1 -1
  56. package/dist/cli-bundle/sdk-runtime.js +1 -1
  57. package/dist/cli-bundle/sdk-testing.js +1 -1
  58. package/dist/cli-bundle/sdk.js +7 -7
  59. package/dist/core/fs/fs-utils.d.ts +11 -0
  60. package/dist/core/fs/fs-utils.js +2 -2
  61. package/dist/core/shared/errors.d.ts +9 -0
  62. package/dist/core/shared/errors.js +1 -1
  63. package/dist/core/store/settings.d.ts +15 -5
  64. package/dist/core/store/settings.js +3 -3
  65. package/dist/core/telemetry/runtime.js +3 -3
  66. package/dist/mcp/server.js +1 -1
  67. package/dist/sdk/agent/closed-domain-contracts.js +1 -1
  68. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  69. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  70. package/dist/sdk/item-transaction.d.ts +11 -0
  71. package/dist/sdk/item-transaction.js +1 -1
  72. package/dist/sdk/merge/install.d.ts +2 -2
  73. package/dist/sdk/merge/install.js +1 -1
  74. package/dist/sdk/pagination.js +1 -1
  75. package/dist/sdk/public-surface.json +1 -1
  76. package/dist/sdk/query/context.d.ts +2 -0
  77. package/dist/sdk/query/context.js +1 -1
  78. package/dist/sdk/query/get.d.ts +19 -15
  79. package/dist/sdk/query/get.js +1 -1
  80. package/dist/sdk/query/list.js +1 -1
  81. package/dist/sdk/query/search-contracts.js +1 -1
  82. package/dist/sdk/query/search-pagination.d.ts +4 -0
  83. package/dist/sdk/query/search-pagination.js +1 -1
  84. package/dist/sdk/query/search.js +1 -1
  85. package/dist/sdk/read-output/options.d.ts +14 -0
  86. package/dist/sdk/read-output/options.js +2 -0
  87. package/dist/sdk/read-output-budget.js +1 -1
  88. package/dist/sdk/read-output-contracts.js +1 -1
  89. package/dist/sdk/read-output-rows.d.ts +4 -0
  90. package/dist/sdk/read-output-rows.js +1 -1
  91. package/dist/sdk/runtime-primitives.d.ts +2 -2
  92. package/dist/sdk/runtime-primitives.js +1 -1
  93. package/dist/sdk/runtime.js +1 -1
  94. package/dist/sdk/workspace-transaction.d.ts +2 -0
  95. package/dist/sdk/workspace-transaction.js +2 -2
  96. package/docs/BOUNDED_CONTEXT_READS.md +10 -7
  97. package/docs/COMMANDS.md +1 -1
  98. package/docs/MERGE_SAFETY.md +12 -6
  99. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +27 -0
  100. package/docs/SDK.md +98 -0
  101. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +6 -3
  102. package/marketplace.json +2 -2
  103. package/package.json +1 -1
  104. package/packages/pm-beads/package.json +1 -1
  105. package/packages/pm-calendar/package.json +1 -1
  106. package/packages/pm-command-kit/package.json +1 -1
  107. package/packages/pm-digital-twin/package.json +1 -1
  108. package/packages/pm-governance-audit/package.json +1 -1
  109. package/packages/pm-guide-shell/package.json +1 -1
  110. package/packages/pm-kanban/package.json +1 -1
  111. package/packages/pm-lifecycle-hooks/package.json +1 -1
  112. package/packages/pm-linked-test-adapters/package.json +1 -1
  113. package/packages/pm-search-advanced/package.json +1 -1
  114. package/packages/pm-templates/package.json +1 -1
  115. package/packages/pm-todos/package.json +1 -1
  116. package/packages/pm-vcs/package.json +1 -1
  117. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  118. package/plugins/pm-claude/package.json +2 -2
  119. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  120. package/plugins/pm-codex/package.json +2 -2
  121. package/plugins/pm-codex/plugin.json +1 -1
  122. package/dist/cli-bundle/chunks/chunk-6XTJLOKW.js +0 -3
  123. package/dist/cli-bundle/chunks/chunk-A6NDNRCK.js +0 -6
  124. package/dist/cli-bundle/chunks/chunk-BNAT4EYR.js +0 -20
  125. package/dist/cli-bundle/chunks/chunk-BX4LEJX4.js +0 -8
  126. package/dist/cli-bundle/chunks/chunk-FYTXVVZG.js +0 -2
  127. package/dist/cli-bundle/chunks/chunk-UIAH7UFK.js +0 -238
  128. package/dist/cli-bundle/chunks/chunk-USTAFHIM.js +0 -2
  129. package/dist/cli-bundle/chunks/chunk-YM342ELM.js +0 -3
  130. package/dist/cli-bundle/chunks/register-mutation-4GSUK23D.js +0 -20
  131. package/dist/cli-bundle/focused-chunks/chunk-3CAZ7Z4R.js +0 -30
  132. package/dist/cli-bundle/focused-chunks/chunk-EFD4ATS7.js +0 -12
  133. package/dist/cli-bundle/focused-chunks/chunk-IDB6E3ZV.js +0 -165
  134. package/dist/cli-bundle/focused-chunks/chunk-UPOMLSW7.js +0 -20
@@ -1,4 +1,4 @@
1
- import{n as _u,o as jo,p as wu,q as bu,r as wa,s as zo,t as ku,u as ba,v as Bo,y as Ju,z as Xu}from"./focused-chunks/chunk-XUCXRZZZ.js";import{a as tp,f as np,h as en,m as rp,o as ur,r as Qo,s as op,t as ip,x as sp}from"./focused-chunks/chunk-KZULQIAG.js";import{$ as Un,$a as Zf,A as Er,Ab as u_,B as uf,Bb as p_,C as Si,Cb as f_,D as pf,Db as __,E as ff,Eb as h_,Fb as Cr,Ga as zf,Gb as ic,Hb as sc,Ia as Hf,Ib as Ni,J as _f,Ja as Ri,Jb as ac,K as hf,Ka as _k,Kb as g_,L as gf,La as Vf,Lb as cc,M as yf,Ma as Wf,Mb as Li,N as vf,Na as oc,Nb as qn,O as wf,Ob as lc,P as bf,Pb as dc,Q as kf,Qb as y_,R as Sf,Rb as v_,S as Ef,Sb as w_,T as Af,Tb as Kn,U as Tf,Ub as mc,V as Cf,Vb as b_,W as If,X as Rf,Y as Of,Ya as Jf,Yb as $i,Z as xf,Za as Xf,_ as Pf,_a as Qf,aa as Nf,ab as e_,ba as Lf,bb as t_,ca as $f,cb as n_,da as Ut,db as nn,dc as k_,ea as w,eb as r_,ec as S_,fa as Ff,fb as o_,fc as E_,g as of,ga as Mf,gb as Oi,h as sf,ha as Fe,hb as i_,ia as Df,ib as s_,ja as ec,jb as a_,jc as A_,ka as Uf,kb as c_,kc as $_,la as tc,lb as l_,ma as Ar,mb as xi,na as Ei,nb as Gt,oa as Gn,ob as d_,pa as Gf,pb as Pi,qa as Ai,ra as ge,sa as nc,sb as Tr,ta as _e,ua as jf,va as qf,wa as Ti,xa as Kf,y as mf,ya as Ci,z as Xa,zb as m_}from"./focused-chunks/chunk-AKB3JN57.js";import{e as uu,g as pu,h as fu,k as hu,q as vu}from"./focused-chunks/chunk-T4PZJQG4.js";import{b as Qu,c as Xo,e as Zu,f as ep,g as Qb}from"./focused-chunks/chunk-MOUCTR72.js";import{R as Fa,V as Yu,a as rm,b as om,c as im,d as sm,f as am}from"./focused-chunks/chunk-4AORVUT4.js";import{a as cf,b as lf,c as Fi}from"./focused-chunks/chunk-RIJQQOEZ.js";import{K as Yf,b as df}from"./focused-chunks/chunk-EVMH4SKN.js";import{Ba as hc,Da as P_,Sa as Or,Ua as N_,Va as L_,c as Qa,e as Za,g as rc,h as Ir,i as hk,j as uc,k as pc,l as Mi,m as gk,n as yk,pa as fc,s as T_,t as C_,u as I_,ua as Rr,v as R_,w as O_,wa as _c,x as x_}from"./focused-chunks/chunk-EFD4ATS7.js";import{$a as wr,A as pe,B as Ln,C as ui,D as pi,G as fi,H as _i,I as jp,Ia as Dn,J as hi,Ja as Qp,K as gi,Ka as Ya,L as $n,La as Zp,M as Va,N as yi,O as qp,Oa as Ja,P as Kp,Pa as ef,Q as yr,Xa as wi,_a as nf,a as Fp,b as ri,c as oi,cb as rf,d as ii,e as si,i as ai,j as Nt,k as Pn,kb as ht,l as ci,m as Nn,mb as Sr,n as li,nb as tn,o as de,p as di,pb as af,q as Ba,qb as Ii,r as Ve,s as Ha,sa as Xp,t as Mp,u as Ce,vb as jn,w as ft,x as Dp,y as mi,z as Lt}from"./focused-chunks/chunk-UPOMLSW7.js";import{c as lu,f as du,g as mu,i as Go,j as Ot,k as Su,l as Eu,m as Au}from"./focused-chunks/chunk-IQBFYQF2.js";import{a as cp,b as lp,c as dp}from"./focused-chunks/chunk-OMBDUJWZ.js";import{$ as $m,A as ho,Aa as tu,B as _m,Ba as nu,C as hm,Ca as To,D as gm,Da as ru,E as go,Ea as ou,F as ym,Fa as iu,G as vm,Ga as Co,H as wm,Ha as Io,I as bm,Ia as Ro,J as yo,Ja as Oo,K as vo,Ka as dr,L as km,La as su,M as wo,Ma as xo,Na as mr,O as Sm,Oa as Po,P as cr,Pa as No,Q as Em,Qa as Lo,R as Am,Ra as $o,S as Tm,Sa as au,T as Cm,Ta as It,U as Im,Ua as Fo,V as Rm,Va as Mo,W as Om,Wa as Do,X as xm,Xa as Uo,Y as Pm,Z as Nm,_ as Lm,_a as cu,aa as Fm,ab as Rt,ba as Mm,bb as N,ca as Dm,d as ga,da as lr,e as cm,ea as Um,fa as Gm,ga as bo,h as uo,ha as ko,i as ya,ia as jm,j as Xt,ja as qm,ka as Km,l as lm,la as zm,ma as Bm,na as Hm,oa as Vm,pa as Wm,q as va,ra as Ym,s as po,sa as Jm,t as fo,ta as Xm,u as _o,ua as Qm,v as dm,va as Zm,w as mm,wa as eu,x as um,xa as So,y as pm,ya as Eo,z as fm,za as Ao}from"./focused-chunks/chunk-XB5Q2P7Z.js";import{$ as wp,$a as Ke,A as pk,Aa as hr,Ab as Vp,B as fk,C as xn,Cb as fe,D as C,Db as Wp,Eb as vi,Fb as _t,Gb as Yp,H as pt,Ha as Op,Hb as ae,Ib as Jp,Ja as za,L as pp,M as ti,Ma as xp,Mb as tf,N as fp,Na as ni,O as _p,Oa as rt,P as hp,Q as gp,Qa as Pp,R as yp,Ra as Np,Sa as Lp,Sb as br,T as ee,Ta as $p,Tb as kr,U as Da,Ua as A,Ub as bi,V as re,Va as $e,Vb as Dt,Wa as Te,X as Ua,Xa as Up,Y as vp,Ya as Gp,Z as He,Za as $t,_ as tt,_b as ki,a as Ma,aa as bp,ab as gr,b as Zb,bb as Fn,c as ek,ca as kp,cb as zp,d as tk,da as Sp,db as Mn,e as nk,ea as Ga,eb as Wa,fb as Bp,ha as ja,ja as Ep,k as Zo,ka as Ap,l as mp,la as Tp,lb as vr,m as up,ma as Cp,n as On,na as Ip,o as pr,p as rk,pc as Bf,q as ok,r as ik,ra as Le,s as sk,sa as Pt,sb as Ft,t as ak,u as ck,ua as qa,ub as Mt,v as lk,va as fr,w as dk,wa as _r,wb as Hp,x as mk,xa as Ka,xb as I,y as ei,ya as nt,yb as q,z as uk,za as Rp,zb as se}from"./focused-chunks/chunk-IDB6E3ZV.js";import{b as Tt,c as so,d as ao,g as mt,i as qo,j as ut,k as xt,l as gu,n as F,o as Ko,p as et,r as yu}from"./focused-chunks/chunk-ZJ3CLTV4.js";import{e as ap}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as ne,$b as Cu,Ab as ar,Ac as Mu,Ad as Ub,B as Fd,Bd as Gb,C as Md,Cc as Aa,D as Dd,Dc as Ta,Dd as jb,De as Wb,E as Ud,Ec as Ca,Ee as Yb,F as Gd,Fb as ke,Fc as Ia,Fd as qb,Fe as Jb,G as jd,Ga as En,Gc as Ra,Gd as Kb,Ge as Xb,H as aa,Hb as B,Hc as Oa,Hd as Na,He as Jo,I as ca,Ia as Vd,Ic as xa,Id as La,Ie as Wu,J as la,Jb as Jt,Jc as R,Jd as $a,K as da,Ka as fa,Kc as Cn,Kd as ju,L as ma,Lc as Qt,M as ua,Mc as Y,Md as qu,Na as _a,Nc as Ho,Nd as zb,Oa as rr,Oc as In,P as io,Pa as Ee,Pb as Tn,Pd as Bb,Qd as Hb,Rc as Vo,Rd as Vb,Sa as x,Ta as be,Tc as Se,Td as S,U as pa,Ua as lo,Uc as Wo,Va as An,W as qd,Wa as or,Xa as Wd,Xc as Du,Xd as Yo,Ya as E,Yc as Zt,Z as At,Za as Yd,Zd as ie,_a as lt,_b as Tu,aa as l,ab as dt,ac as Iu,ae as Ae,bc as Ru,cb as Ze,cc as Ou,db as mo,dc as xu,ec as ka,fc as Pu,ge as Ku,hb as Jd,hc as Nu,ia as Kd,ib as Xd,ic as Lu,jb as Qd,ka as zd,kb as Zd,kd as Uu,lb as em,lc as Sa,ma as co,mb as tm,mc as $u,nb as nm,nc as Ea,ne as zu,o as no,oa as Bd,od as Gu,oe as Bu,p as $d,pa as Hd,pb as ir,q as ro,qb as Yt,r as sa,rb as qe,re as Rn,sa as G,ta as Wt,td as Pa,ua as Ct,uc as Fu,v as Vt,va as Z,ve as Hu,w as ct,wa as te,x as bn,y as kn,ya as Sn,yb as sr,z as oo,zb as ha,ze as Vu}from"./focused-chunks/chunk-3CAZ7Z4R.js";import{AsyncLocalStorage as rM}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]="1979adcd-4a7f-5dc7-b5dd-6bfc15eed1af")}catch{}})();var vk=Fa("list").properties.outputSession,wk={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:{...vk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},F_={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."}},M_={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."},bk=`Operation name (one of): ${Ea.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,kk={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."}},Sk={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{...M_,properties:{...M_.properties,...e},required:t}}var Ek=[{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:[...Ea],description:bk},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."},...wk},["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"},...Sk},["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"},...kk})},{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:[...Pu]},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({...F_,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",...Tn],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:[...sa]},description:`Lifecycle roles for add-status: ${sa.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:F_}},["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."}})}],Ak={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"},Tk=Ek.map(e=>{let t=Ak[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Fa(t,{properties:n,required:r})}});function D_(){return Tk.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]="845638dd-45b8-5057-bed2-2f687591eeaa")}catch{}})();var U_=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"]]]),Ck=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],Y_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Ui=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"]),J_=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"]]),X_=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"]]),Q_=new Map([...X_.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),Z_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],vc=new Map(Z_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),Ik=10,Rk=20,G_=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."]]),eh=[["init",Sm],["install",Am],["uninstall",Tm],["explore",Cm],["manage",Nm],["describe",Im],["reload",Lm],["doctor",$m],["catalog",Fm],["adopt",Mm],["adopt-all",Rm],["activate",Om],["deactivate",xm],["migrate",Pm]],Ok=[...eh.map(([e,t])=>e==="init"?[e,Em]:[e,t]),["upgrade",lr]],xk=[...eh.map(([e,t])=>[`extension ${e}`,t]),...Ok.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",vo],["config",km],["extension",wo],["package",cr],["packages",cr],["install",Dm],["create",To],["item mutate",ru],["item complete",ou],["item reopen",iu],["copy",Co],["focus",Io],["update",Ro],["update-many",Oo],["upgrade",lr],["calendar",dr],["cal",dr],["context",mr],["ctx",mr],["get",Po],["search",Mo],["eval",au],["events",xo],["workspace",It],["workspace position",[]],["workspace snapshot",It],["workspace snapshot create",It],["workspace snapshot list",It],["workspace snapshot inspect",It],["workspace snapshot restore",It],["workspace snapshot delete",It],["next",Fo],["aggregate",_o],["deps",Lo],["graph",$o],["guide",No],["reindex",Um],["history",ho],["history-compact",ym],["history-attest",vm],["history-redact",hm],["history-repair",gm],["history-author-acknowledge",go],["merge",_m],["schema",wm],["profile",bm],["plan",yo],["restore",qm],["delete",Km],["close",Gm],["close-many",bo],["append",ko],["claim",jm],["release",zm],["start-task",Bm],["pause-task",Hm],["close-task",Vm],["comments",dm],["notes",mm],["learnings",um],["files",pm],["docs",fm],["test",Jm],["test-runs-worker",[]],["test-all",Xm],["telemetry",Qm],["test-runs",Zm],["gc",eu],["stats",So],["ops",[]],["duplicates",Eo],["validate",tu],["health",Ao],["assurance",nu],...cu,["contracts",Do],["completion",Uo],["activity",su],...[...Y_].map(e=>[e,fo])],xr=new Map(xk);for(let{alias:e,canonical:t}of ke){let n=xr.get(e);n!==void 0&&xr.set(t,n)}function Pk(e){let t=Q_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function j_(e){let t=ke.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:ka.includes(e)?ye(e):e.startsWith("extension-")?ye(`extension ${e.slice(10)}`):e.startsWith("package-")?ye(`package ${e.slice(8)}`):e.startsWith("item-")?ye(`item ${e.slice(5)}`):e.startsWith("test-runs-")?ye(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?ye(`templates ${e.slice(10)}`):Ui.has(e)?X_.get(e)??ye(e):null}function Nk(e,t){let n=B(t);return n!==t||ke.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=>ye(t)).filter(t=>t.length>0)}function Lk(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 s=i.split(" ").filter(a=>a.length>0);if(s.length!==0)for(let a=s.length;a>0;a-=1){let c=s.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function Di(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Pr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function $k(e,t){if(!t)return{...e};let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:r}}function gc(e,t){let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let a=s.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:r}}function ye(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function th(e){return e.replace(/\s+/g,"-")}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function q_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=ot(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function yc(e,t,n){n&&(e[t]=!0)}function K_(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 Fk(e){let t=K_(e.long,"long"),n=K_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),yc(o,"required",e.required===!0),yc(o,"repeatable",e.repeatable===!0),yc(o,"list",e.list===!0);let i=ot(e.description);i&&(o.description=i);let s=ot(e.value_name);s&&(o.value_name=s);let a=[ot(e.value_type),ot(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function nh(e){let t=new Map;for(let r of e){let o=ye(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},s=`${r.layer}:${r.name}`;i.sourceDedupe.has(s)||(i.sourceDedupe.add(s),i.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=Fk(a);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,s)=>{let a=i.layer.localeCompare(s.layer);return a!==0?a:(i.name??"").localeCompare(s.name??"")})});return n}function Mk(e){let t=nh(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ye(i.command);if(s.length===0)continue;let a=ot(i.action)??th(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=ot(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:ot(m.description)}:null}).filter(m=>m!==null):[];n.set(s,{...i.tier===void 0?{}:{tier:i.tier},command:s,action:a,source:{layer:i.layer,name:i.name},description:ot(i.description),intent:ot(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:q_(i.examples),failure_hints:q_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(ye(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((s,a)=>s.localeCompare(a))){let s=n.get(i);o.push(Dk(i,s,t.get(i)?.flags??[]))}return o}function Dk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:th(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Uk(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let r=t.replace(/-([a-z0-9])/g,(o,i)=>i.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return r.length>0?r:null}function Gk(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 jk(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 qk(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]=Gk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Uk(o);!i||n[i]!==void 0||(n[i]=jk(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 Kk(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 zk(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,s)=>i.localeCompare(s)).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 s=`${i.flag}|${i.short??""}`;if(!o.has(s))o.add(s),r.flags.push(i);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===s);a&&Kk(a,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 Bk(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 G(ne(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await sr({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await ar({...i,loaded:i.loaded});return{handlers:new Set(s.commands.handlers.map(c=>ye(c.command))),disabledReason:null,commandDefinitions:s.registrations.commands,flagRegistrations:s.registrations.flags,registrations:s.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 Hk(e,t={}){let n=new Map;for(let r of Sa){let o=Ui.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=j_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Ui)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:j_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:ke.find(o=>o.alias===r.command)?.canonical??ye(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function Vk(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(s=>t.handlers.has(s)||t.handlers.has(B(s))),o=n.map(s=>J_.get(B(s))).find(s=>typeof s=="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 rh(e){return xr.get(e)??po}function Wk(e){return rn.has(B(e))?!1:xr.has(e)}function Yk(e){return Y_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function z_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function Jk(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function Xk(e){let t=new Map;for(let r of e.definitions){let o=z_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(a=>Jk(a)).find(a=>a!==null),s=r.cli_aliases.map(a=>z_(a)).filter(a=>a!==null&&a!==o);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},u=`${m.flag}|${m.short??""}`;c.seen.has(u)||(c.seen.add(u),c.flags.push(m));for(let p of s){let f=`${p}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:p}))}t.set(a,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,va(o.flags));return n}function B_(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 va(n)}function Qk(e,t,n,r,o){let i=new Map(t);for(let{alias:s,canonical:a}of ke){let c=t.get(a)??t.get(s);c&&(i.set(s,c),i.set(a,c))}return e.map(s=>{let a=Wk(s),c=a?rh(s):[],m=n.get(Yk(s))??[],u=i.get(s),p=B_(c,m),f=B_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:ih(s),visibility:oh(s,o),positionals:cm(s)?.slots??[],flag_invocations:ur(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function Zk(e,t=Jt){let n=new Set(e),r=new Map;for(let o of Z_){let i=o.aliases.filter(s=>n.has(s));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 eS(){return{create_string_options:Qu,create_repeatable_options:Xo,update_string_options:Zu,update_repeatable_options:ep,list_string_options:rm,search_string_options:om,calendar_string_options:im,context_string_options:sm,activity_string_options:am}}function H_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=An(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Ee("create",a)))].sort((a,c)=>a.localeCompare(c)),s=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:s,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function tS(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=H_(o,"strict"),n[r]=H_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function nS(e,t){let n=Pr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let s=i.properties;if(typeof s!="object"||s===null)return i;let a=s.action;return typeof a!="object"||a===null||a.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function rS(e){let t=Di(e.action)!==void 0||Di(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,s=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,m=Di(e.action),u=Di(e.command),p=!r&&!c&&!o&&!i&&!s&&!m&&!u;return{selectedAction:m,selectedCommand:u,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:s,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:p,omitUnfilteredCommandFlags:p,omitUnfilteredCommanderAliases:p||u!==void 0&&!c}}function oS(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(n=>n).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function iS(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function sS(e,t,n){let r=await iS(t),o=await Bk(e),i=x(r,o.registrations??R()),s=et(r.schema),a=Mk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:F(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:Xk(s),createRequiredOptionContracts:tS(i),extensionContracts:a,mergedExtensionContracts:zk(a.filter(c=>Gi(n,c.command,a))),extensionFlagMap:nh(o.flagRegistrations)}}function V_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Ui.has(e.selectedAction)||e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand)))}function aS(e,t){let n=Hk(t,{includePackageOwnedActions:V_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set($u);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??Qo(o.action))!=="internal"))}return V_(e)&&e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Pk(B(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function cS(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 lS(e,t){return[...new Set([...ka.filter(n=>!rn.has(B(n))),...[...xr.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=ke.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>ye(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function dS(e,t){let n=t.slice(0,Ik),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,Rk),s=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=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:s,nextSteps:[`Retry with a child command, for example: ${s[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --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 mS(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 uS(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 pS(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let r=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(r.length>0)throw dS(e.selectedCommand,r);let o=J_.get(B(e.selectedCommand));throw o?mS(e.selectedCommand,o):uS(e.selectedCommand)}function fS(e,t){let n=aS(e,t.mergedExtensionContracts);cS(e,n);let r=lS(n,t.mergedExtensionContracts);pS(e,r);let o=e.selectedCommand?Q_.get(B(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Nk(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 s=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,a=[...new Map(s.map(m=>Vk(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(m=>m.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:s,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function _S(e){return new Set(Pr(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 hS(e){let t=Yu,n=Pr(t),r=_S(t),o=e.filter(i=>!r.has(i.action)).map(i=>qk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function W_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?$k(n,e.selectedAction):e.selectedCommand?gc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):gc(n,r);return e.runtimeOnly&&!e.selectedAction?gc(o,new Set(t.actions)):o}function gS(e,t,n){let r=hS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?nS(W_(e,n,r),t.createRequiredOptionContracts):W_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function yS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Lk(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function oh(e,t){return t.find(n=>B(n.command)===B(e))?.tier??Qo(e)}function Gi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||oh(t,n)!=="internal"}function vS(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 vc.keys())r.add(o);return t.filter(o=>!r.has(o)&&Gi(e,o,n))}function ih(e){let t=ke.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":vc.get(n)??n}var wS=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"]]),bS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function kS(e,t){let n=G_.get(B(e))??(e.includes(" ")?void 0:G_.get(ih(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(u=>B(u)===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),s=o.slice(0,-1).join(" "),a=wS.get(i),c=bS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function SS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(ye))].filter(i=>i.length>0).sort((i,s)=>i.localeCompare(s)).map(i=>{let s=Pa(i,{generateFallback:!0}),a=i.split(" ")[0],c=vc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...rh(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>B(_)===B(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=(U_.get(B(i))??U_.get(c)??Ck).filter(f=>m.has(f)),p=kS(i,t);return{command:i,intent:p.intent,...o||p.intent_source!=="command"?{intent_source:p.intent_source}:{},...u.length>0?{flags:u}:{},default_max_estimated_tokens:s.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...s.default_max_estimated_tokens_by_format}}:{}}})}function ES(e){return e.map(t=>({budget:Pa(t,{generateFallback:!0}),envelope:sp(t)}))}function AS(e){let t=new Map;for(let n of e){let r=np(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(","),s=t.get(i)??{commands:[],exit_codes:o};s.commands.push(n),t.set(i,s)}return[...t.values()]}function TS(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=>Gi(e,r.command,t.extensionContracts))}function CS(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 IS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=ap);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(s=>`--${s.cli_flag}`))].sort((s,a)=>s.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...Tu],services:[...Cu],policy_modes:[...Iu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...xu],trust_modes:[...Ru],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Ou],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...Fd],create_modes:[...Md],close_validation_modes:[...Dd],workflow_enforcement_modes:[...Ud]},e.relationship_kind_contracts=[...Kd,...(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 RS(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 OS(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=Qk(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(dp).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...lp],compact_fields:[...cp]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:s})=>({canonical:i,aliases:s})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function xS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=eS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function PS(e,t,n,r){e.command_summaries=SS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...Uu],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(ye))].filter(o=>La(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...ju(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(ya.map(({slots:o})=>lm(o))).size,positional_action_count:ga.length,positional_action_parents:[...new Set(ga.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:ya}:{}}}async function wc(e,t){let n=rS(e);oS(n);let r=E(process.cwd(),t.path),o=await sS(t,r,n),i=fS(n,o),s=gS(n,o,i),a=yS(n,i),c=vS(n,a,o.extensionContracts),m=CS(n,s,i,c),u=TS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&PS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=Zk(i.commandCatalog.filter(_=>Gi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||IS(m,o,n),RS(m,n,s,u),OS(m,n,o,c,f),xS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...sf],gate_triggers:[...of]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=uo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=D_(),m.context_intents=zu(),m.read_output_dimensions=Na,m.error_codes=rp,m.command_output_contracts=ES(c),m.diagnostic_output_contracts=Gu,m.command_exit_contracts={vocabulary:tp,command_sets:AS(c)}),m}import{readFile as NS}from"node:fs/promises";import LS 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]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var bc="context-intents.json";function ji(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $S(e,t,n){if(!ji(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 sh(e,t){let n=Array.isArray(e)?e:ji(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)=>$S(r,t,o))}async function FS(e){let t=LS.join(e,bc),n;try{n=await NS(t,"utf8")}catch(o){if(Wt(o))return[];throw await Hp(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${bc}: ${i}`,{cause:o})}return sh(r,bc)}function MS(e){if(!ji(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return ji(n)?n.contextIntents??n.context_intents:void 0}function DS(e){return e.flatMap(t=>{let n=MS(t.module);return n===void 0?[]:sh(n,`package ${t.name}`)})}async function US(e){let t=await FS(e.pmRoot),n=DS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function kc(e,t){let n=await US(e);return await Bu(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]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function ah(e,t,n=Ku){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 jS}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]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var Sc="PmCliError";function GS(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=d.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function ch(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new l(e,GS(t.exitCode??d.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function qi(e){if(!(e instanceof Error)||e.name!==Sc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}(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]="4c3bb78a-4b63-51ef-a854-c4520cfd3f32")}catch{}})();function Ec(e){let t=zd();for(let n of e)t.register(n);return t}function lh(e,t,n,r){return{client:t,isItemNotFoundError:o=>qi(o)&&o.exitCode===d.NOT_FOUND,getItemAt:(o,i)=>af(o,i,{pmRoot:e}),openRelationshipEventStore:o=>lf.open({pmRoot:e,nodes:o.nodes,registry:Ec(o.definitions),...o.relativePath===void 0?{}:{relativePath:o.relativePath}}),createRelationshipGraph:o=>new Hd(o.nodes,o.edges,Ec(o.definitions)),analyzeRelationshipImpact:(o,i,s)=>df(o,i,s),validateRelationshipEvents:o=>{let i=new cf(o.nodes,{registry:Ec(o.definitions)});return o.events.map(s=>i.append({...s,expectedVersion:i.version}))},commitWorkspaceTransaction:o=>mf({...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=await A(e);try{let s=await ni({pmRoot:e,filePath:ne(e),op:"extension:pm:settings",idempotencyKey:r===void 0?o.operationId:`${jS("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 a=>{let c=a===null?null:JSON.parse(a);if(!Ma(c).success)throw new l("Workspace settings mutation requires a valid initialized settings.json.",d.USAGE);let m=await o.mutate(structuredClone(c));if(!Ma(m).success)throw new l("Workspace settings mutation returned invalid settings.json.",d.USAGE);return{raw:qe(c,m)?a:Lp(m),result:void 0}}});return s.changed&&o.dryRun!==!0&&await Y({path:ne(e),scope:"project",op:"extension:pm:settings"}),{changed:s.changed,dry_run:o.dryRun===!0,replayed:s.replayed===!0}}finally{Pp(e)}}}}import qS from"node:fs/promises";import X from"node:path";import KS from"node:readline/promises";import{stdin as zS,stdout as Me}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]="231597cc-2166-5029-9b3a-476587a33941")}catch{}})();var Tc=Symbol.for("pm.sdk.init-invocation-cwd");var BS=()=>KS.createInterface({input:zS,output:Me});function HS(){return structuredClone(At)}var VS=["minimal","default","strict"];function mh(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: ${VS.join(", ")}`,d.USAGE)}function WS(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return pu(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${uu.join(", ")}`,d.USAGE)}}}function YS(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 Ac(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 JS(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||Ac(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),u=X.join(m,".agents","pm");return{pmRoot:u,prefixArg:n,target:{mode:"workspace-path",tracker_root:u,workspace_root:m}}}if(t.path===void 0&&Ac(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),s=X.join(X.resolve(e),".agents","pm"),a=X.dirname(X.dirname(i)),c=X.resolve(i)===s?"current":"ancestor";return{pmRoot:i,prefixArg:n,target:t.path===void 0?{mode:"workspace-discovery",tracker_root:i,workspace_root:a,discovery:c,requested_cwd:X.resolve(e),...c==="ancestor"?{suggested_current_tracker_root:s}:{}}:{mode:"tracker-path",tracker_root:i}}}function XS(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(Ac(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&&$t(e)!==$t(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 ${$t(e)}`,`pm init --id-prefix ${$t(t)}`]});return t}function QS(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: ${Nf.join(", ")}`,d.USAGE)}function ZS(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function uh(e,t){let n=qd[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function eE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tE(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(eE).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function nE(e,t,n){let r=qo(t.schema),o=ut(e,r.files.types,mt.types),s=du(await Z(o)),a=[],c=[];for(let m of fu(n)){let u=mu(s,m);s=u.file,(u.replaced?c:a).push(u.definition.name)}return await rt({pmRoot:e,filePath:o,raw:Go(s),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:c,file:o}}async function rE(e){let t=[".git","package.json","pnpm-workspace.yaml","AGENTS.md",X.join(".agents","pm")];for(let n of t)if(await G(X.join(e,n)))return!0;return!1}async function oE(e,t,n){if(!t||n||await G(X.join(e,"settings.json"))||!await rE(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 ph(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,s=await G(i);await qS.mkdir(i,{recursive:!0}),s?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 iE(e,t){let n=BS();try{Me.write(`pm init setup wizard (agent-optimized)
1
+ import{n as _u,o as jo,p as wu,q as bu,r as wa,s as zo,t as ku,u as ba,v as Bo,y as Ju,z as Xu}from"./focused-chunks/chunk-DBD4W4QP.js";import{a as tp,f as np,h as en,m as rp,o as ur,r as Qo,s as op,t as ip,x as sp}from"./focused-chunks/chunk-E754JDLY.js";import{$ as Un,$a as Zf,A as Er,Ab as u_,B as uf,Bb as p_,C as Si,Cb as f_,D as pf,Db as __,E as ff,Eb as h_,Fb as Cr,Ga as zf,Gb as ic,Hb as sc,Ia as Hf,Ib as Ni,J as _f,Ja as Ri,Jb as ac,K as hf,Ka as _k,Kb as g_,L as gf,La as Vf,Lb as cc,M as yf,Ma as Wf,Mb as Li,N as vf,Na as oc,Nb as qn,O as wf,Ob as lc,P as bf,Pb as dc,Q as kf,Qb as y_,R as Sf,Rb as v_,S as Ef,Sb as w_,T as Af,Tb as Kn,U as Tf,Ub as mc,V as Cf,Vb as b_,W as If,X as Rf,Y as Of,Ya as Jf,Yb as $i,Z as xf,Za as Xf,_ as Pf,_a as Qf,aa as Nf,ab as e_,ba as Lf,bb as t_,ca as $f,cb as n_,da as Ut,db as nn,dc as k_,ea as w,eb as r_,ec as S_,fa as Ff,fb as o_,fc as E_,g as of,ga as Mf,gb as Oi,h as sf,ha as Fe,hb as i_,ia as Df,ib as s_,ja as ec,jb as a_,jc as A_,ka as Uf,kb as c_,kc as $_,la as tc,lb as l_,ma as Ar,mb as xi,na as Ei,nb as Gt,oa as Gn,ob as d_,pa as Gf,pb as Pi,qa as Ai,ra as ge,sa as nc,sb as Tr,ta as _e,ua as jf,va as qf,wa as Ti,xa as Kf,y as mf,ya as Ci,z as Xa,zb as m_}from"./focused-chunks/chunk-BLCTBSGT.js";import{e as uu,g as pu,h as fu,k as hu,q as vu}from"./focused-chunks/chunk-4FFPGNCJ.js";import{b as Qu,c as Xo,e as Zu,f as ep,g as Qb}from"./focused-chunks/chunk-3BIYG72P.js";import{R as Fa,V as Yu,a as rm,b as om,c as im,d as sm,f as am}from"./focused-chunks/chunk-EJN7DY3B.js";import{a as cf,b as lf,c as Fi}from"./focused-chunks/chunk-UTRSM3ZK.js";import{K as Yf,b as df}from"./focused-chunks/chunk-VVWYI2X7.js";import{Ba as hc,Da as P_,Sa as Or,Ua as N_,Va as L_,c as Qa,e as Za,g as rc,h as Ir,i as hk,j as uc,k as pc,l as Mi,m as gk,n as yk,pa as fc,s as T_,t as C_,u as I_,ua as Rr,v as R_,w as O_,wa as _c,x as x_}from"./focused-chunks/chunk-GBD4EN6S.js";import{$a as wr,A as pe,B as Ln,C as ui,D as pi,G as fi,H as _i,I as jp,Ia as Dn,J as hi,Ja as Qp,K as gi,Ka as Ya,L as $n,La as Zp,M as Va,N as yi,O as qp,Oa as Ja,P as Kp,Pa as ef,Q as yr,Xa as wi,_a as nf,a as Fp,b as ri,c as oi,cb as rf,d as ii,e as si,i as ai,j as Nt,k as Pn,kb as ht,l as ci,m as Nn,mb as Sr,n as li,nb as tn,o as de,p as di,pb as af,q as Ba,qb as Ii,r as Ve,s as Ha,sa as Xp,t as Mp,u as Ce,vb as jn,w as ft,x as Dp,y as mi,z as Lt}from"./focused-chunks/chunk-IR4UXLRP.js";import{c as lu,f as du,g as mu,i as Go,j as Ot,k as Su,l as Eu,m as Au}from"./focused-chunks/chunk-ZIXFMIUL.js";import{a as cp,b as lp,c as dp}from"./focused-chunks/chunk-FKK2HI3S.js";import{$ as $m,A as ho,Aa as tu,B as _m,Ba as nu,C as hm,Ca as To,D as gm,Da as ru,E as go,Ea as ou,F as ym,Fa as iu,G as vm,Ga as Co,H as wm,Ha as Io,I as bm,Ia as Ro,J as yo,Ja as Oo,K as vo,Ka as dr,L as km,La as su,M as wo,Ma as xo,Na as mr,O as Sm,Oa as Po,P as cr,Pa as No,Q as Em,Qa as Lo,R as Am,Ra as $o,S as Tm,Sa as au,T as Cm,Ta as It,U as Im,Ua as Fo,V as Rm,Va as Mo,W as Om,Wa as Do,X as xm,Xa as Uo,Y as Pm,Z as Nm,_ as Lm,_a as cu,aa as Fm,ab as Rt,ba as Mm,bb as N,ca as Dm,d as ga,da as lr,e as cm,ea as Um,fa as Gm,ga as bo,h as uo,ha as ko,i as ya,ia as jm,j as Xt,ja as qm,ka as Km,l as lm,la as zm,ma as Bm,na as Hm,oa as Vm,pa as Wm,q as va,ra as Ym,s as po,sa as Jm,t as fo,ta as Xm,u as _o,ua as Qm,v as dm,va as Zm,w as mm,wa as eu,x as um,xa as So,y as pm,ya as Eo,z as fm,za as Ao}from"./focused-chunks/chunk-XRSCIYHR.js";import{$ as wp,$b as ki,A as pk,Aa as hr,Ab as se,B as fk,Bb as Vp,C as xn,D as C,Db as fe,Eb as Wp,Fb as vi,Gb as _t,H as pt,Ha as Op,Hb as Yp,Ib as ae,Ja as za,Jb as Jp,L as pp,M as ti,Ma as xp,N as fp,Na as ni,Nb as tf,O as _p,Oa as rt,P as hp,Q as gp,Qa as Pp,R as yp,Sa as Np,T as ee,Ta as Lp,Tb as br,U as Da,Ua as $p,Ub as kr,V as re,Va as A,Vb as bi,Wa as $e,Wb as Dt,X as Ua,Xa as Te,Y as vp,Ya as Up,Z as He,Za as Gp,_ as tt,_a as $t,a as Ma,aa as bp,ab as Ke,b as Zb,bb as gr,c as ek,ca as kp,cb as Fn,d as tk,da as Sp,db as zp,e as nk,ea as Ga,eb as Mn,fb as Wa,gb as Bp,ha as ja,ja as Ep,k as Zo,ka as Ap,l as mp,la as Tp,m as up,ma as Cp,mb as vr,n as On,na as Ip,o as pr,p as rk,q as ok,qc as Bf,r as ik,ra as Le,s as sk,sa as Pt,t as ak,tb as Ft,u as ck,ua as qa,v as lk,va as fr,vb as Mt,w as dk,wa as _r,x as mk,xa as Ka,xb as Hp,y as ei,ya as nt,yb as I,z as uk,za as Rp,zb as q}from"./focused-chunks/chunk-YC32ZSLS.js";import{b as Tt,c as so,d as ao,g as mt,i as qo,j as ut,k as xt,l as gu,n as F,o as Ko,p as et,r as yu}from"./focused-chunks/chunk-GMYUNHST.js";import{e as ap}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as lt,$b as Tu,Ab as ha,B as Fd,Bb as ar,Bc as Mu,C as Md,Ce as Vu,D as Dd,Dc as Aa,Dd as Ub,E as Ud,Ec as Ta,Ed as Gb,F as Gd,Fc as Ca,G as jd,Gb as ke,Gc as Ia,Gd as jb,Ge as Wb,H as aa,Ha as En,Hc as Ra,He as Yb,I as ca,Ib as B,Ic as Oa,Id as qb,Ie as Jb,J as la,Ja as Vd,Jc as xa,Jd as Kb,Je as Xb,K as da,Kb as Jt,Kc as R,Kd as Na,Ke as Jo,L as ma,La as fa,Lc as Cn,Ld as La,Le as Wu,M as ua,Mc as Qt,Md as $a,Nc as Y,Nd as ju,Oa as _a,Oc as Ho,P as io,Pa as rr,Pc as In,Pd as qu,Qa as Ee,Qb as Tn,Qd as zb,Sc as Vo,Sd as Bb,Ta as x,Td as Hb,U as pa,Ua as be,Uc as Se,Ud as Vb,Va as lo,Vc as Wo,W as qd,Wa as An,Wd as S,Xa as or,Ya as Wd,Yc as Du,Z as At,Za as E,Zc as Zt,_a as Yd,_d as Yo,aa as l,ab as ne,ac as Cu,ae as ie,bb as dt,bc as Iu,cc as Ru,db as Ze,dc as Ou,de as Ae,eb as mo,ec as xu,fc as ka,gc as Pu,ia as Kd,ib as Jd,ic as Nu,jb as Xd,jc as Lu,je as Ku,ka as zd,kb as Qd,lb as Zd,ld as Uu,ma as co,mb as em,mc as Sa,nb as tm,nc as $u,o as no,oa as Bd,ob as nm,oc as Ea,p as $d,pa as Hd,pd as Gu,q as ro,qb as ir,qe as zu,r as sa,rb as Yt,re as Bu,sa as G,sb as qe,ta as Wt,ua as Ct,ud as Pa,ue as Rn,v as Vt,va as Z,vc as Fu,w as ct,x as bn,xa as te,y as kn,ye as Hu,z as oo,za as Sn,zb as sr}from"./focused-chunks/chunk-WCY6HRZO.js";import{AsyncLocalStorage as rM}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]="1979adcd-4a7f-5dc7-b5dd-6bfc15eed1af")}catch{}})();var vk=Fa("list").properties.outputSession,wk={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:{...vk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},F_={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."}},M_={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."},bk=`Operation name (one of): ${Ea.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,kk={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."}},Sk={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{...M_,properties:{...M_.properties,...e},required:t}}var Ek=[{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:[...Ea],description:bk},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."},...wk},["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"},...Sk},["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"},...kk})},{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:[...Pu]},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({...F_,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",...Tn],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:[...sa]},description:`Lifecycle roles for add-status: ${sa.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:F_}},["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."}})}],Ak={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"},Tk=Ek.map(e=>{let t=Ak[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Fa(t,{properties:n,required:r})}});function D_(){return Tk.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]="845638dd-45b8-5057-bed2-2f687591eeaa")}catch{}})();var U_=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"]]]),Ck=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],Y_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),Ui=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"]),J_=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"]]),X_=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"]]),Q_=new Map([...X_.entries()].flatMap(([e,t])=>gt(t).map(n=>[n,e]))),Z_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],vc=new Map(Z_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),Ik=10,Rk=20,G_=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."]]),eh=[["init",Sm],["install",Am],["uninstall",Tm],["explore",Cm],["manage",Nm],["describe",Im],["reload",Lm],["doctor",$m],["catalog",Fm],["adopt",Mm],["adopt-all",Rm],["activate",Om],["deactivate",xm],["migrate",Pm]],Ok=[...eh.map(([e,t])=>e==="init"?[e,Em]:[e,t]),["upgrade",lr]],xk=[...eh.map(([e,t])=>[`extension ${e}`,t]),...Ok.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",vo],["config",km],["extension",wo],["package",cr],["packages",cr],["install",Dm],["create",To],["item mutate",ru],["item complete",ou],["item reopen",iu],["copy",Co],["focus",Io],["update",Ro],["update-many",Oo],["upgrade",lr],["calendar",dr],["cal",dr],["context",mr],["ctx",mr],["get",Po],["search",Mo],["eval",au],["events",xo],["workspace",It],["workspace position",[]],["workspace snapshot",It],["workspace snapshot create",It],["workspace snapshot list",It],["workspace snapshot inspect",It],["workspace snapshot restore",It],["workspace snapshot delete",It],["next",Fo],["aggregate",_o],["deps",Lo],["graph",$o],["guide",No],["reindex",Um],["history",ho],["history-compact",ym],["history-attest",vm],["history-redact",hm],["history-repair",gm],["history-author-acknowledge",go],["merge",_m],["schema",wm],["profile",bm],["plan",yo],["restore",qm],["delete",Km],["close",Gm],["close-many",bo],["append",ko],["claim",jm],["release",zm],["start-task",Bm],["pause-task",Hm],["close-task",Vm],["comments",dm],["notes",mm],["learnings",um],["files",pm],["docs",fm],["test",Jm],["test-runs-worker",[]],["test-all",Xm],["telemetry",Qm],["test-runs",Zm],["gc",eu],["stats",So],["ops",[]],["duplicates",Eo],["validate",tu],["health",Ao],["assurance",nu],...cu,["contracts",Do],["completion",Uo],["activity",su],...[...Y_].map(e=>[e,fo])],xr=new Map(xk);for(let{alias:e,canonical:t}of ke){let n=xr.get(e);n!==void 0&&xr.set(t,n)}function Pk(e){let t=Q_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function j_(e){let t=ke.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:ka.includes(e)?ye(e):e.startsWith("extension-")?ye(`extension ${e.slice(10)}`):e.startsWith("package-")?ye(`package ${e.slice(8)}`):e.startsWith("item-")?ye(`item ${e.slice(5)}`):e.startsWith("test-runs-")?ye(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?ye(`templates ${e.slice(10)}`):Ui.has(e)?X_.get(e)??ye(e):null}function Nk(e,t){let n=B(t);return n!==t||ke.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=>ye(t)).filter(t=>t.length>0)}function Lk(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 s=i.split(" ").filter(a=>a.length>0);if(s.length!==0)for(let a=s.length;a>0;a-=1){let c=s.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function Di(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Pr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function $k(e,t){if(!t)return{...e};let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:r}}function gc(e,t){let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let a=s.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:r}}function ye(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function th(e){return e.replace(/\s+/g,"-")}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function q_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=ot(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function yc(e,t,n){n&&(e[t]=!0)}function K_(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 Fk(e){let t=K_(e.long,"long"),n=K_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),yc(o,"required",e.required===!0),yc(o,"repeatable",e.repeatable===!0),yc(o,"list",e.list===!0);let i=ot(e.description);i&&(o.description=i);let s=ot(e.value_name);s&&(o.value_name=s);let a=[ot(e.value_type),ot(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function nh(e){let t=new Map;for(let r of e){let o=ye(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},s=`${r.layer}:${r.name}`;i.sourceDedupe.has(s)||(i.sourceDedupe.add(s),i.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=Fk(a);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,s)=>{let a=i.layer.localeCompare(s.layer);return a!==0?a:(i.name??"").localeCompare(s.name??"")})});return n}function Mk(e){let t=nh(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ye(i.command);if(s.length===0)continue;let a=ot(i.action)??th(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=ot(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:ot(m.description)}:null}).filter(m=>m!==null):[];n.set(s,{...i.tier===void 0?{}:{tier:i.tier},command:s,action:a,source:{layer:i.layer,name:i.name},description:ot(i.description),intent:ot(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:q_(i.examples),failure_hints:q_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(ye(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((s,a)=>s.localeCompare(a))){let s=n.get(i);o.push(Dk(i,s,t.get(i)?.flags??[]))}return o}function Dk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:th(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function Uk(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let r=t.replace(/-([a-z0-9])/g,(o,i)=>i.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return r.length>0?r:null}function Gk(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 jk(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 qk(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]=Gk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=Uk(o);!i||n[i]!==void 0||(n[i]=jk(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 Kk(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 zk(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,s)=>i.localeCompare(s)).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 s=`${i.flag}|${i.short??""}`;if(!o.has(s))o.add(s),r.flags.push(i);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===s);a&&Kk(a,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 Bk(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 G(ne(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await sr({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await ar({...i,loaded:i.loaded});return{handlers:new Set(s.commands.handlers.map(c=>ye(c.command))),disabledReason:null,commandDefinitions:s.registrations.commands,flagRegistrations:s.registrations.flags,registrations:s.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 Hk(e,t={}){let n=new Map;for(let r of Sa){let o=Ui.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=j_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of Ui)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:j_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:ke.find(o=>o.alias===r.command)?.canonical??ye(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function Vk(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(s=>t.handlers.has(s)||t.handlers.has(B(s))),o=n.map(s=>J_.get(B(s))).find(s=>typeof s=="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 rh(e){return xr.get(e)??po}function Wk(e){return rn.has(B(e))?!1:xr.has(e)}function Yk(e){return Y_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function z_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function Jk(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function Xk(e){let t=new Map;for(let r of e.definitions){let o=z_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(a=>Jk(a)).find(a=>a!==null),s=r.cli_aliases.map(a=>z_(a)).filter(a=>a!==null&&a!==o);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},u=`${m.flag}|${m.short??""}`;c.seen.has(u)||(c.seen.add(u),c.flags.push(m));for(let p of s){let f=`${p}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:p}))}t.set(a,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,va(o.flags));return n}function B_(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 va(n)}function Qk(e,t,n,r,o){let i=new Map(t);for(let{alias:s,canonical:a}of ke){let c=t.get(a)??t.get(s);c&&(i.set(s,c),i.set(a,c))}return e.map(s=>{let a=Wk(s),c=a?rh(s):[],m=n.get(Yk(s))??[],u=i.get(s),p=B_(c,m),f=B_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:ih(s),visibility:oh(s,o),positionals:cm(s)?.slots??[],flag_invocations:ur(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function Zk(e,t=Jt){let n=new Set(e),r=new Map;for(let o of Z_){let i=o.aliases.filter(s=>n.has(s));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 eS(){return{create_string_options:Qu,create_repeatable_options:Xo,update_string_options:Zu,update_repeatable_options:ep,list_string_options:rm,search_string_options:om,calendar_string_options:im,context_string_options:sm,activity_string_options:am}}function H_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=An(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Ee("create",a)))].sort((a,c)=>a.localeCompare(c)),s=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:s,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function tS(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=H_(o,"strict"),n[r]=H_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function nS(e,t){let n=Pr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let s=i.properties;if(typeof s!="object"||s===null)return i;let a=s.action;return typeof a!="object"||a===null||a.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function rS(e){let t=Di(e.action)!==void 0||Di(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,s=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,m=Di(e.action),u=Di(e.command),p=!r&&!c&&!o&&!i&&!s&&!m&&!u;return{selectedAction:m,selectedCommand:u,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:s,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:p,omitUnfilteredCommandFlags:p,omitUnfilteredCommanderAliases:p||u!==void 0&&!c}}function oS(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(n=>n).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function iS(e,t=A){try{return await t(e)}catch{return structuredClone(At)}}async function sS(e,t,n){let r=await iS(t),o=await Bk(e),i=x(r,o.registrations??R()),s=et(r.schema),a=Mk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:F(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:Xk(s),createRequiredOptionContracts:tS(i),extensionContracts:a,mergedExtensionContracts:zk(a.filter(c=>Gi(n,c.command,a))),extensionFlagMap:nh(o.flagRegistrations)}}function V_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&Ui.has(e.selectedAction)||e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand)))}function aS(e,t){let n=Hk(t,{includePackageOwnedActions:V_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set($u);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??Qo(o.action))!=="internal"))}return V_(e)&&e.selectedCommand!==void 0&&rn.has(B(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Pk(B(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function cS(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 lS(e,t){return[...new Set([...ka.filter(n=>!rn.has(B(n))),...[...xr.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=ke.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>ye(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function dS(e,t){let n=t.slice(0,Ik),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,Rk),s=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=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:s,nextSteps:[`Retry with a child command, for example: ${s[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --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 mS(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 uS(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 pS(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let r=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(r.length>0)throw dS(e.selectedCommand,r);let o=J_.get(B(e.selectedCommand));throw o?mS(e.selectedCommand,o):uS(e.selectedCommand)}function fS(e,t){let n=aS(e,t.mergedExtensionContracts);cS(e,n);let r=lS(n,t.mergedExtensionContracts);pS(e,r);let o=e.selectedCommand?Q_.get(B(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Nk(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 s=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,a=[...new Map(s.map(m=>Vk(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(m=>m.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:s,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function _S(e){return new Set(Pr(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 hS(e){let t=Yu,n=Pr(t),r=_S(t),o=e.filter(i=>!r.has(i.action)).map(i=>qk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function W_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?$k(n,e.selectedAction):e.selectedCommand?gc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):gc(n,r);return e.runtimeOnly&&!e.selectedAction?gc(o,new Set(t.actions)):o}function gS(e,t,n){let r=hS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?nS(W_(e,n,r),t.createRequiredOptionContracts):W_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function yS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?Lk(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function oh(e,t){return t.find(n=>B(n.command)===B(e))?.tier??Qo(e)}function Gi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||oh(t,n)!=="internal"}function vS(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 vc.keys())r.add(o);return t.filter(o=>!r.has(o)&&Gi(e,o,n))}function ih(e){let t=ke.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":vc.get(n)??n}var wS=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"]]),bS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function kS(e,t){let n=G_.get(B(e))??(e.includes(" ")?void 0:G_.get(ih(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>gt(m.command).some(u=>B(u)===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),s=o.slice(0,-1).join(" "),a=wS.get(i),c=bS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function SS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(ye))].filter(i=>i.length>0).sort((i,s)=>i.localeCompare(s)).map(i=>{let s=Pa(i,{generateFallback:!0}),a=i.split(" ")[0],c=vc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...rh(i).map(f=>f.flag),...t.filter(f=>gt(f.command).some(_=>B(_)===B(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=(U_.get(B(i))??U_.get(c)??Ck).filter(f=>m.has(f)),p=kS(i,t);return{command:i,intent:p.intent,...o||p.intent_source!=="command"?{intent_source:p.intent_source}:{},...u.length>0?{flags:u}:{},default_max_estimated_tokens:s.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...s.default_max_estimated_tokens_by_format}}:{}}})}function ES(e){return e.map(t=>({budget:Pa(t,{generateFallback:!0}),envelope:sp(t)}))}function AS(e){let t=new Map;for(let n of e){let r=np(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(","),s=t.get(i)??{commands:[],exit_codes:o};s.commands.push(n),t.set(i,s)}return[...t.values()]}function TS(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=>Gi(e,r.command,t.extensionContracts))}function CS(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 IS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=ap);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(s=>`--${s.cli_flag}`))].sort((s,a)=>s.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...Tu],services:[...Cu],policy_modes:[...Iu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...xu],trust_modes:[...Ru],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Ou],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...Fd],create_modes:[...Md],close_validation_modes:[...Dd],workflow_enforcement_modes:[...Ud]},e.relationship_kind_contracts=[...Kd,...(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 RS(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 OS(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=Qk(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(dp).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...lp],compact_fields:[...cp]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:s})=>({canonical:i,aliases:s})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function xS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=eS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function PS(e,t,n,r){e.command_summaries=SS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...Uu],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(ye))].filter(o=>La(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...ju(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(ya.map(({slots:o})=>lm(o))).size,positional_action_count:ga.length,positional_action_parents:[...new Set(ga.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:ya}:{}}}async function wc(e,t){let n=rS(e);oS(n);let r=E(process.cwd(),t.path),o=await sS(t,r,n),i=fS(n,o),s=gS(n,o,i),a=yS(n,i),c=vS(n,a,o.extensionContracts),m=CS(n,s,i,c),u=TS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&PS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=Zk(i.commandCatalog.filter(_=>Gi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||IS(m,o,n),RS(m,n,s,u),OS(m,n,o,c,f),xS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...sf],gate_triggers:[...of]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=uo.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=D_(),m.context_intents=zu(),m.read_output_dimensions=Na,m.error_codes=rp,m.command_output_contracts=ES(c),m.diagnostic_output_contracts=Gu,m.command_exit_contracts={vocabulary:tp,command_sets:AS(c)}),m}import{readFile as NS}from"node:fs/promises";import LS 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]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var bc="context-intents.json";function ji(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function $S(e,t,n){if(!ji(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 sh(e,t){let n=Array.isArray(e)?e:ji(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)=>$S(r,t,o))}async function FS(e){let t=LS.join(e,bc),n;try{n=await NS(t,"utf8")}catch(o){if(Wt(o))return[];throw await Hp(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${bc}: ${i}`,{cause:o})}return sh(r,bc)}function MS(e){if(!ji(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return ji(n)?n.contextIntents??n.context_intents:void 0}function DS(e){return e.flatMap(t=>{let n=MS(t.module);return n===void 0?[]:sh(n,`package ${t.name}`)})}async function US(e){let t=await FS(e.pmRoot),n=DS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function kc(e,t){let n=await US(e);return await Bu(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]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function ah(e,t,n=Ku){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 jS}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]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var Sc="PmCliError";function GS(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=d.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function ch(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new l(e,GS(t.exitCode??d.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function qi(e){if(!(e instanceof Error)||e.name!==Sc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}(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]="4c3bb78a-4b63-51ef-a854-c4520cfd3f32")}catch{}})();function Ec(e){let t=zd();for(let n of e)t.register(n);return t}function lh(e,t,n,r){return{client:t,isItemNotFoundError:o=>qi(o)&&o.exitCode===d.NOT_FOUND,getItemAt:(o,i)=>af(o,i,{pmRoot:e}),openRelationshipEventStore:o=>lf.open({pmRoot:e,nodes:o.nodes,registry:Ec(o.definitions),...o.relativePath===void 0?{}:{relativePath:o.relativePath}}),createRelationshipGraph:o=>new Hd(o.nodes,o.edges,Ec(o.definitions)),analyzeRelationshipImpact:(o,i,s)=>df(o,i,s),validateRelationshipEvents:o=>{let i=new cf(o.nodes,{registry:Ec(o.definitions)});return o.events.map(s=>i.append({...s,expectedVersion:i.version}))},commitWorkspaceTransaction:o=>mf({...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=await A(e);try{let s=await ni({pmRoot:e,filePath:ne(e),op:"extension:pm:settings",idempotencyKey:r===void 0?o.operationId:`${jS("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 a=>{let c=a===null?null:JSON.parse(a);if(!Ma(c).success)throw new l("Workspace settings mutation requires a valid initialized settings.json.",d.USAGE);let m=await o.mutate(structuredClone(c));if(!Ma(m).success)throw new l("Workspace settings mutation returned invalid settings.json.",d.USAGE);return{raw:qe(c,m)?a:Lp(m),result:void 0}}});return s.changed&&o.dryRun!==!0&&await Y({path:ne(e),scope:"project",op:"extension:pm:settings"}),{changed:s.changed,dry_run:o.dryRun===!0,replayed:s.replayed===!0}}finally{Pp(e)}}}}import qS from"node:fs/promises";import X from"node:path";import KS from"node:readline/promises";import{stdin as zS,stdout as Me}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]="231597cc-2166-5029-9b3a-476587a33941")}catch{}})();var Tc=Symbol.for("pm.sdk.init-invocation-cwd");var BS=()=>KS.createInterface({input:zS,output:Me});function HS(){return structuredClone(At)}var VS=["minimal","default","strict"];function mh(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: ${VS.join(", ")}`,d.USAGE)}function WS(e){if(e!==void 0){if(e.trim().length===0)throw new l("--type-preset must not be empty",d.USAGE);try{return pu(e)}catch{throw new l(`Invalid --type-preset value "${e}". Allowed: ${uu.join(", ")}`,d.USAGE)}}}function YS(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 Ac(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 JS(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||Ac(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),u=X.join(m,".agents","pm");return{pmRoot:u,prefixArg:n,target:{mode:"workspace-path",tracker_root:u,workspace_root:m}}}if(t.path===void 0&&Ac(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),s=X.join(X.resolve(e),".agents","pm"),a=X.dirname(X.dirname(i)),c=X.resolve(i)===s?"current":"ancestor";return{pmRoot:i,prefixArg:n,target:t.path===void 0?{mode:"workspace-discovery",tracker_root:i,workspace_root:a,discovery:c,requested_cwd:X.resolve(e),...c==="ancestor"?{suggested_current_tracker_root:s}:{}}:{mode:"tracker-path",tracker_root:i}}}function XS(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(Ac(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&&$t(e)!==$t(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 ${$t(e)}`,`pm init --id-prefix ${$t(t)}`]});return t}function QS(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: ${Nf.join(", ")}`,d.USAGE)}function ZS(e,t){let n=e.trim().toLowerCase();return n.length===0?t:n==="y"||n==="yes"?!0:n==="n"||n==="no"?!1:t}function uh(e,t){let n=qd[t];e.governance={preset:t,...n},e.validation.parent_reference=n.parent_reference,e.validation.metadata_profile=n.metadata_profile}function eE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function tE(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(eE).map(n=>({alias:typeof n.alias=="string"?n.alias:"",ok:n.ok===!0})):[]}}async function nE(e,t,n){let r=qo(t.schema),o=ut(e,r.files.types,mt.types),s=du(await Z(o)),a=[],c=[];for(let m of fu(n)){let u=mu(s,m);s=u.file,(u.replaced?c:a).push(u.definition.name)}return await rt({pmRoot:e,filePath:o,raw:Go(s),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:c,file:o}}async function rE(e){let t=[".git","package.json","pnpm-workspace.yaml","AGENTS.md",X.join(".agents","pm")];for(let n of t)if(await G(X.join(e,n)))return!0;return!1}async function oE(e,t,n){if(!t||n||await G(X.join(e,"settings.json"))||!await rE(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 ph(e,t){let n=[],r=[];for(let o of t){let i=o?X.join(e,o):e,s=await G(i);await qS.mkdir(i,{recursive:!0}),s?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 iE(e,t){let n=BS();try{Me.write(`pm init setup wizard (agent-optimized)
2
2
  `),Me.write(`This walkthrough is non-destructive and each choice can be changed later with pm config.
3
3
 
4
4
  `),Me.write(`1/3 Item ID prefix
@@ -33,5 +33,5 @@ import{n as _u,o as jo,p as wu,q as bu,r as wa,s as zo,t as ku,u as ba,v as Bo,y
33
33
  `);return IN.some(n=>n.test(t))||t.split(/\r?\n/u).some(n=>RN.test(n)&&ON.test(n))}function dL(e){return lL(e)?"infra_collision":e.timedOut?"timeout":e.maxBufferExceeded?"max_buffer":e.spawnError?"spawn_error":e.signal?"signal":"assertion_failure"}function mL(){return{infra_collision:0,trust_refusal:0,assertion_failure:0,empty_run:0,timeout:0,max_buffer:0,spawn_error:0,signal:0}}function qs(e){let t=mL();for(let n of e)n.status!=="failed"||!n.failure_category||(t[n.failure_category]+=1);return t}function lw(e,t){for(let[n,r]of Object.entries(t.env_set))ln.has(n.toUpperCase())||(e[n]=r);for(let n of t.env_clear)ln.has(n.toUpperCase())||delete e[n]}function uL(e){e.PORT===void 0&&(e.PORT="0"),e.HOST===void 0&&(e.HOST="127.0.0.1"),e.PM_SHARED_HOST_SAFE===void 0&&(e.PM_SHARED_HOST_SAFE="1"),e.PLAYWRIGHT_HTML_OPEN===void 0&&(e.PLAYWRIGHT_HTML_OPEN="never"),e.PW_TEST_HTML_REPORT_OPEN===void 0&&(e.PW_TEST_HTML_REPORT_OPEN="never")}function pL(e,t){let n={...e.env_set,...t.env_set},r=[...new Set([...e.env_clear,...t.env_clear??[]])],o=t.shared_host_safe??e.shared_host_safe;return{env_set:n,env_clear:r,shared_host_safe:o}}function fL(e,t,n){return{env_set:jN(e,"--env-set"),env_clear:qN(t,"--env-clear"),shared_host_safe:n===!0}}async function er(e,t,n=!1,r=Us){if(await G(e))try{await ir("seed_linked_test",async()=>{if(await r(V.dirname(t),{recursive:!0}),n){await rd(e,t,{recursive:!0,force:!0});return}await rd(e,t,{force:!0})},{why:"Linked tests need an isolated PM context without mutating the source tracker.",nextSteps:["Reclaim capacity on the filesystem that hosts the linked-test temporary directory."]})}catch(o){if(typeof o=="object"&&o!==null&&"code"in o&&Ct(o))return;throw o}}async function dw(e,t,n){await er(ne(n.projectPmRoot),ne(e)),await er(V.join(n.projectPmRoot,"extensions"),V.join(e,"extensions"),!0),await er(ne(n.globalPmRoot),ne(t)),await er(V.join(n.globalPmRoot,"extensions"),V.join(t,"extensions"),!0)}async function mw(e,t){if(!await G(e))return;let n=await id(e,{withFileTypes:!0});for(let r of n){if(TN.has(r.name))continue;let o=V.join(e,r.name),i=V.join(t,r.name);if(r.isDirectory()){await er(o,i,!0);continue}r.isFile()&&await er(o,i)}}async function uw(e,t){let n=await Z(ne(e));if(n===null||await G(za(e)))return;let r=await A(t);await Jr(za(t),{force:!0}),await Jr(ne(t),{force:!0}),await rt({pmRoot:t,filePath:ne(t),raw:n,op:"settings:write",author:C(void 0,r.author_default),lockTtlSeconds:r.locks.ttl_seconds,lockWaitMs:r.locks.wait_ms,recordCreation:!0,message:"Seed linked-test tracker settings history"})}async function Zn(e){if(!await G(e))return 0;let t=0,n=await id(e,{withFileTypes:!0});for(let r of n){if(!r.isDirectory()||CN.has(r.name))continue;let o=V.join(e,r.name),i;try{i=await id(o,{withFileTypes:!0})}catch{continue}for(let s of i)s.isFile()&&Wd.some(a=>s.name.toLowerCase().endsWith(a))&&(t+=1)}return t}function _L(e){let t=typeof e.exitCode=="number"?e.exitCode:1;return(e.timedOut||e.maxBufferExceeded)&&t===0?1:t}function hL(e){let t=e.trim();if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return null;let n=Number(t);if(t.length>0&&Number.isFinite(n))return n;if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{}return t}function gL(e,t){return typeof e=="object"&&e!==null&&typeof t=="object"&&t!==null?qe(e,t):Object.is(e,t)}function yL(e,t,n){let r=[];r.push(...pw("stdout",t,e.assert_stdout_contains)),r.push(...fw("stdout",t,e.assert_stdout_regex)),r.push(...pw("stderr",n,e.assert_stderr_contains)),r.push(...fw("stderr",n,e.assert_stderr_regex)),r.push(...vL(t,e.assert_stdout_min_lines));let o=e.assert_json_field_equals??{},i=e.assert_json_field_gte??{};if(!(Object.keys(o).length>0||Object.keys(i).length>0))return r;let a;try{a=JSON.parse(t)}catch(c){return r.push(`stdout is not valid JSON for assert_json_field_* checks: ${c instanceof Error?c.message:String(c)}`),r}for(let[c,m]of Object.entries(o)){let u=ed(a,c);if(!u.found){r.push(`assert_json_field_equals missing path "${c}"`);continue}let p=hL(m);gL(u.value,p)||r.push(`assert_json_field_equals mismatch at "${c}" (expected=${JSON.stringify(p)} actual=${JSON.stringify(u.value)})`)}for(let[c,m]of Object.entries(i)){let u=ed(a,c);if(!u.found){r.push(`assert_json_field_gte missing path "${c}"`);continue}if(typeof u.value!="number"||!Number.isFinite(u.value)){r.push(`assert_json_field_gte path "${c}" resolved to non-numeric value`);continue}u.value<m&&r.push(`assert_json_field_gte failed at "${c}" (expected >= ${m}, actual ${u.value})`)}return r}function pw(e,t,n){let r=[];for(let o of n??[])t.includes(o)||r.push(`${e} missing required text: "${o}"`);return r}function fw(e,t,n){let r=[];for(let o of n??[])try{new RegExp(o,"m").test(t)||r.push(`${e} failed regex assertion: /${o}/m`)}catch(i){r.push(`${e} regex assertion is invalid: /${o}/ (${i instanceof Error?i.message:String(i)})`)}return r}function vL(e,t){if(typeof t!="number")return[];let n=e.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0).length;return n<t?[`stdout line count ${n} is below required minimum ${t}`]:[]}var wL=[{code:"no_projects_matched_filters",regex:/\bNo projects matched the filters\b/i},{code:"no_test_files_found",regex:/\bNo test files found\b/i},{code:"no_tests_found",regex:/\bNo tests found\b/i},{code:"no_matching_tests",regex:/\bNo matching tests?\b/i},{code:"collected_zero_items",regex:/\bcollected 0 items?\b/i},{code:"reported_zero_passes",regex:/(?:^\s*(?:#|ℹ)?\s*tests\s+0\s*$[\s\S]*^\s*(?:#|ℹ)?\s*pass\s+0\s*$|^\s*(?:#|ℹ)?\s*pass\s+0\s*$[\s\S]*^\s*(?:#|ℹ)?\s*tests\s+0\s*$)/imu},{code:"reported_zero_tests",regex:/^\s*(?:#|ℹ)?\s*tests\s+0\s*$/imu}],bL=[/^\s*(?:#|ℹ)?\s*tests\s+[1-9]\d*\s*$/imu,/^\s*(?:#|ℹ)?\s*pass\s+[1-9]\d*\s*$/imu,/\bTests?\s+[1-9]\d*\s+passed\b/iu,/\b[1-9]\d*\s+passed\b/iu,/\bTests:\s+(?:.*\b)?[1-9]\d*\s+passed\b/iu];function kL(e,t){let n=`${e}
34
34
  ${t}`;for(let r of wL)if(r.regex.test(n))return{code:r.code};return null}function SL(e,t){let n=`${e}
35
35
  ${t}`;return bL.some(r=>r.test(n))}function _w(e){let t=js(e);return/(?:^|\s)(?:--test-name-pattern|--testnamepattern)(?:=|\s)/u.test(t)?!0:Cr(t).some(n=>/(?:^|\s)-t(?:=|\s)/u.test(n)&&xw(n))}function EL(e){return{root:e,schemaProjectPmPath:V.join(e,"schema","project",".agents","pm"),schemaGlobalPmPath:V.join(e,"schema","global"),trackerProjectPmPath:V.join(e,"tracker","project",".agents","pm"),trackerGlobalPmPath:V.join(e,"tracker","global"),workspaceSnapshotRoot:V.join(e,"workspace","project"),workspaceIsolatedRoot:V.join(e,"workspace","isolated")}}function AL(e,t,n){return e.some(r=>Sw(r,t,n)==="snapshot")}async function TL(e,t){let n=new Set([".agents",".git",".nyc_output",".turbo","coverage","node_modules"]);await Us(V.dirname(e.workspaceSnapshotRoot),{recursive:!0}),await rd(t,e.workspaceSnapshotRoot,{recursive:!0,force:!0,filter(o){let i=V.relative(t,o);return i?!i.split(V.sep).some(s=>n.has(s)):!0}});let r=V.join(t,"node_modules");await G(r)&&await bw(r,V.join(e.workspaceSnapshotRoot,"node_modules"),process.platform==="win32"?"junction":"dir")}async function CL(e,t){let n=V.join(e,".agents"),r=V.join(n,"pm");await Us(n,{recursive:!0}),await Jr(r,{recursive:!0,force:!0}),await bw(t,r,process.platform==="win32"?"junction":"dir")}async function IL(e,t=Nr,n=!0){let r={defaults:!0,agentGuidance:"skip"};await t(void 0,{path:e.schemaProjectPmPath},r),await t(void 0,{path:e.schemaGlobalPmPath},r),n&&(await t(void 0,{path:e.trackerProjectPmPath},r),await t(void 0,{path:e.trackerGlobalPmPath},r))}async function RL(e,t,n){t&&(await dw(e.schemaProjectPmPath,e.schemaGlobalPmPath,t),n&&(await dw(e.trackerProjectPmPath,e.trackerGlobalPmPath,t),await mw(t.projectPmRoot,e.trackerProjectPmPath),await mw(t.globalPmRoot,e.trackerGlobalPmPath),await uw(t.projectPmRoot,e.trackerProjectPmPath),await uw(t.globalPmRoot,e.trackerGlobalPmPath)))}function OL(e,t,n){return e.some(r=>{let o=r.command??"",i=o.length>0&&Tw(o),s=n?.autoPmContext===!0&&i?"auto":Ew(r,t,n?.overrideLinkedPmContext===!0);return Aw(s,i)==="tracker"})}async function xL(e,t){return{sourceProjectItemCount:t?await Zn(t.projectPmRoot):0,sourceGlobalItemCount:t?await Zn(t.globalPmRoot):0,schemaProjectItemCount:await Zn(e.schemaProjectPmPath),schemaGlobalItemCount:await Zn(e.schemaGlobalPmPath),trackerProjectItemCount:await Zn(e.trackerProjectPmPath),trackerGlobalItemCount:await Zn(e.trackerGlobalPmPath)}}function PL(e){let t=e.effectivePmContextMode==="tracker",n=t?e.layout.trackerProjectPmPath:e.layout.schemaProjectPmPath,r=t?e.layout.trackerGlobalPmPath:e.layout.schemaGlobalPmPath,o=t?e.counts.trackerProjectItemCount:e.counts.schemaProjectItemCount,i=t?e.counts.trackerGlobalItemCount:e.counts.schemaGlobalItemCount,s=e.workspaceContextMode==="snapshot"?e.layout.workspaceSnapshotRoot:e.workspaceContextMode==="isolated"?e.layout.workspaceIsolatedRoot:e.sourceWorkspaceRoot,a=e.workspaceContextMode==="isolated"?"":s;return{requested_pm_context_mode:e.requestedPmContextMode,pm_context_mode:e.effectivePmContextMode,auto_pm_context_applied:e.autoPmContextApplied,is_pm_command:e.isPmCommand,is_pm_tracker_read_command:e.isPmTrackerReadCommand,source_project_pm_path:e.sourceRoots?.projectPmRoot??"",sandbox_project_pm_path:n,source_global_pm_path:e.sourceRoots?.globalPmRoot??"",sandbox_global_pm_path:r,source_project_item_count:e.counts.sourceProjectItemCount,sandbox_project_item_count:o,source_global_item_count:e.counts.sourceGlobalItemCount,sandbox_global_item_count:i,mismatch_detected:e.isPmCommand&&(e.counts.sourceProjectItemCount!==o||e.counts.sourceGlobalItemCount!==i),project_extensions_seeded:!!e.sourceRoots,global_extensions_seeded:!!e.sourceRoots,requested_workspace_context_mode:e.requestedWorkspaceContextMode,workspace_context_mode:e.workspaceContextMode,working_directory:s,source_workspace_root:a,trust:e.trust}}async function NL(e){let t=typeof e.linkedTest.pm_context_mode=="string"&&e.linkedTest.pm_context_mode.trim().length>0?Gs(e.linkedTest.pm_context_mode):void 0,n=typeof e.linkedTest.command=="string"&&e.linkedTest.command.length>0?e.linkedTest.command:void 0,r=n?KN(n):!1,o=r&&n?Tw(n):!1,i=e.options?.autoPmContext===!0&&o,s=i?"auto":Ew(e.linkedTest,e.runLevelPmContextMode,e.options?.overrideLinkedPmContext===!0),a=Aw(s,o),c=a==="tracker"?e.layout.trackerProjectPmPath:e.layout.schemaProjectPmPath;e.workspaceContextMode==="snapshot"&&await CL(e.layout.workspaceSnapshotRoot,c);let m=e.options?.pmRoot?await mc(e.options.pmRoot,e.linkedTest,e.currentSourceRef):await mc(e.layout.root,e.linkedTest,e.currentSourceRef);return{linkedOverridePmContextMode:t,executionContext:PL({layout:e.layout,counts:e.counts,sourceRoots:e.sourceRoots,isPmCommand:r,isPmTrackerReadCommand:o,requestedPmContextMode:s,effectivePmContextMode:a,autoPmContextApplied:i,requestedWorkspaceContextMode:e.requestedWorkspaceContextMode,workspaceContextMode:e.workspaceContextMode,sourceWorkspaceRoot:e.sourceWorkspaceRoot,trust:m})}}function hw(e,t,n){return{command:e.command,path:e.path,status:"skipped",execution_context:t,error:n}}function Xr(e,t,n,r){return{command:e.command,path:e.path,status:"failed",exit_code:1,failure_category:"assertion_failure",execution_context:t,...r?{stdout:r.stdout,stderr:r.stderr}:{},error:n}}function LL(e,t,n){return{command:e.command,path:e.path,status:"failed",exit_code:1,failure_category:"trust_refusal",execution_context:t,error:n}}function $L(e){if(e.executionContext.trust.trusted)return null;let t=e.options?.allowUntrustedLinkedTests===!0,n=e.options?.untrustedLinkedTestsPolicyEnabled===!0;if(t&&n)return null;let r=n?"Retry with --allow-untrusted-linked-tests for this invocation, or acknowledge the current commands with --acknowledge-linked-tests.":"Set testing.allow_untrusted_linked_tests=true, then retry with --allow-untrusted-linked-tests; alternatively acknowledge the current commands with --acknowledge-linked-tests.";return LL(e.linkedTest,e.executionContext,`Linked test command is not trusted by this clone (source_ref=${e.executionContext.trust.source_ref??"unknown"}, current_ref=${e.executionContext.trust.current_source_ref??"unknown"}). ${r}`)}function FL(e){if(!e.linkedTest.command)return hw(e.linkedTest,e.executionContext,"No command configured for this linked test.");let t=VN(e.linkedTest.command);return t?hw(e.linkedTest,e.executionContext,t):null}function ML(e){return e.executionContext.pm_context_mode!=="none"?null:e.executionContext.workspace_context_mode==="source"?Xr(e.linkedTest,e.executionContext,"pm_context_mode=none requires workspace_context_mode=isolated or snapshot so implicit tracker discovery cannot reach the source workspace."):e.executionContext.is_pm_command?Xr(e.linkedTest,e.executionContext,"pm_context_mode=none is for self-isolating SDK tests; direct PM commands require schema, tracker, or auto context."):null}function DL(e){let t=e.executionContext.pm_context_mode==="schema"&&e.executionContext.is_pm_tracker_read_command&&e.executionContext.mismatch_detected,n=e.options?.failOnContextMismatch===!0&&e.executionContext.is_pm_command&&e.executionContext.mismatch_detected;if(!t&&!n)return null;let r=GN({executionContext:e.executionContext,runLevelPmContextMode:e.runLevelPmContextMode,linkedOverridePmContextMode:e.linkedOverridePmContextMode}),o=e.options?.checkContext===!0?"Linked test preflight PM context mismatch detected":"Linked test PM context mismatch detected";return Xr(e.linkedTest,e.executionContext,`${o} (source_project_items=${e.executionContext.source_project_item_count}, sandbox_project_items=${e.executionContext.sandbox_project_item_count}).${r}`)}function UL(e){let t=FL(e);if(t)return t;let n=$L(e);if(n)return n;let r=ML(e);if(r)return r;let o=DL(e);return o||(e.options?.requireAssertionsForPm===!0&&e.executionContext.is_pm_command&&!UN(e.linkedTest)?Xr(e.linkedTest,e.executionContext,"Linked PM command requires assertions when --require-assertions-for-pm is enabled."):null)}function GL(e){let t=pL(e.runtimeDirectives,e.linkedTest),n={...process.env,SENTRY_ENVIRONMENT:"test"};return lw(n,e.runtimeDirectives),lw(n,{env_set:e.linkedTest.env_set??{},env_clear:e.linkedTest.env_clear??[]}),t.shared_host_safe&&uL(n),n.FORCE_COLOR="0",e.executionContext.pm_context_mode==="none"?delete n.PM_PATH:n.PM_PATH=e.executionContext.sandbox_project_pm_path,n.PM_GLOBAL_PATH=e.executionContext.sandbox_global_pm_path,e.executionContext.workspace_context_mode==="isolated"?(delete n.PM_SOURCE_WORKSPACE_ROOT,delete n.PM_SOURCE_PM_PATH,delete n[Er]):(n.PM_SOURCE_WORKSPACE_ROOT=e.executionContext.source_workspace_root,n.PM_SOURCE_PM_PATH=e.executionContext.workspace_context_mode==="snapshot"?e.executionContext.sandbox_project_pm_path:e.executionContext.source_project_pm_path,n[Er]="read_only"),n}function jL(e,t,n){return{command:e.command,path:e.path,status:"passed",exit_code:0,execution_context:t,stdout:n.stdout,stderr:n.stderr}}function gw(e){return{command:e.linkedTest.command,path:e.linkedTest.path,status:"failed",exit_code:1,failure_category:"empty_run",execution_context:e.executionContext,stdout:e.execution.stdout,stderr:e.execution.stderr,error:`Linked test reported an empty test run (${e.emptyRunSignal.code}). Update the test selection so at least one test executes; unfiltered commands may opt out by omitting --fail-on-empty-test-run.`}}function qL(e){return{command:e.linkedTest.command,path:e.linkedTest.path,status:"failed",exit_code:_L(e.execution),failure_category:dL(e.execution),execution_context:e.executionContext,stdout:e.execution.stdout,stderr:e.execution.stderr,error:cL(e.execution,e.timeoutMs)}}function KL(e){if(e.options?.failOnEmptyTestRun===!0||_w(e.linkedTest.command??"")){let n=kL(e.execution.stdout,e.execution.stderr);if(n)return gw({...e,emptyRunSignal:n});if(_w(e.linkedTest.command??"")&&!SL(e.execution.stdout,e.execution.stderr))return gw({...e,emptyRunSignal:{code:"missing_positive_execution_receipt"}})}let t=yL(e.linkedTest,e.execution.stdout,e.execution.stderr);return t.length>0?Xr(e.linkedTest,e.executionContext,`Linked test assertion(s) failed: ${t.join("; ")}`,e.execution):jL(e.linkedTest,e.executionContext,e.execution)}async function zL(e){let t=e.linkedTest.command??"",n=(e.linkedTest.timeout_seconds??e.defaultTimeoutSeconds??120)*1e3,r=await aL(t,n,GL(e),{index:e.index+1,total:e.total,timeoutMs:n,command:t},e.progressMode,e.executionContext.working_directory);return r.exitCode===0&&!r.timedOut&&!r.maxBufferExceeded?KL({...e,execution:r}):qL({...e,execution:r,timeoutMs:n})}async function ld(e,t,n){let r=[],o=await ww(V.join(kw(),"pm-linked-test-")),i=EL(o),s=Gs(n?.pmContext),a=DN(n?.workspaceContext),c=n?.progress===!0?"always":"auto",m=fL(n?.envSet,n?.envClear,n?.sharedHostSafe),u=n?.sourceRoots,p=w_(),f=OL(e,s,n),_=AL(e,a,n?.overrideLinkedWorkspaceContext===!0),h=await v_(p);try{await IL(i,Nr,f),await Us(i.workspaceIsolatedRoot,{recursive:!0}),await RL(i,u,f),_&&await TL(i,p);let y=await xL(i,u);for(let g=0;g<e.length;g+=1){let v=e[g],b=Sw(v,a,n?.overrideLinkedWorkspaceContext===!0),k=await NL({linkedTest:v,layout:i,counts:y,sourceRoots:u,runLevelPmContextMode:s,options:n,requestedWorkspaceContextMode:a,workspaceContextMode:b,currentSourceRef:h,sourceWorkspaceRoot:p}),T=UL({linkedTest:v,executionContext:k.executionContext,runLevelPmContextMode:s,linkedOverridePmContextMode:k.linkedOverridePmContextMode,options:n});if(T){r.push(T);continue}r.push(await zL({linkedTest:v,index:g,total:e.length,defaultTimeoutSeconds:t,runtimeDirectives:m,progressMode:c,executionContext:k.executionContext,options:n}))}}finally{await Jr(i.root,{recursive:!0,force:!0,maxRetries:3,retryDelay:100})}return r}async function BL(e){let{id:t,pmRoot:n,settings:r,typeToFolder:o}=e,i=await q(n,t,r.id_prefix,r.item_format,o);if(!i)throw new l(`Item ${t} not found`,d.NOT_FOUND);let s=await se(i,{schema:r.schema});return{itemId:i.id,tests:s.document.metadata.tests??[],testRuns:s.document.metadata.test_runs??[],changed:!1,removed:0}}function HL(e,t){return e.command===t.command&&e.path===t.path&&e.scope===t.scope&&e.pm_context_mode===t.pm_context_mode&&e.workspace_context_mode===t.workspace_context_mode}function VL(e,t){let n=[...e];for(let r of t)n.some(o=>HL(o,r))||n.push(r);return n}function WL(e,t,n){if(t.length===0&&n.length===0)return{tests:e,removed:0};let r=new Set(n),o=e.filter((i,s)=>r.has(s+1)?!1:!t.some(a=>a.kind==="command"?i.command===a.value:a.kind==="path"?i.path===a.value:i.command===a.value||i.path===a.value));return{tests:o,removed:e.length-o.length}}function YL(e,t,n,r){return WL(VL(e,t),n,r)}function JL(e){return[(e.envSet?.length??0)>0,(e.envClear?.length??0)>0,e.sharedHostSafe===!0,e.pmContext!==void 0,e.overrideLinkedPmContext===!0,e.failOnContextMismatch===!0,e.failOnSkipped===!0,e.failOnEmptyTestRun===!0,e.requireAssertionsForPm===!0,e.checkContext===!0,e.autoPmContext===!0,e.workspaceContext!==void 0,e.overrideLinkedWorkspaceContext===!0,e.allowUntrustedLinkedTests===!0].some(Boolean)}function XL(e){if(JL(e)&&e.run!==!0)throw new l("--env-set, --env-clear, --shared-host-safe, --pm-context, --override-linked-pm-context, --workspace-context, --override-linked-workspace-context, --allow-untrusted-linked-tests, --fail-on-context-mismatch, --fail-on-skipped, --fail-on-empty-test-run, --require-assertions-for-pm, --check-context, and --auto-pm-context require --run",d.USAGE);if(e.acknowledgeLinkedTests===!0&&e.run===!0)throw new l("--acknowledge-linked-tests records trust without executing commands; run it separately before --run",d.USAGE);if((e.match!==void 0||e.onlyIndex!==void 0||e.onlyLast===!0)&&e.run!==!0)throw new l("--match, --only-index, and --only-last require --run",d.USAGE)}async function QL(e){let{id:t,options:n,pmRoot:r,settings:o,typeToFolder:i,adds:s,removes:a,removeIndexes:c}=e;if(s.length===0&&a.length===0&&c.length===0)return BL({id:t,pmRoot:r,settings:o,typeToFolder:i});let m=0,u=await ae({pmRoot:r,settings:o,id:t,op:s.length>0?"tests_add":"tests_remove",author:C(n.author,o.author_default),message:n.message,force:n.force,skipNoop:!0,mutate(p){let f=p.metadata.tests??[],_=YL(f,s,a,c);if(m=_.removed,(a.length>0||c.length>0)&&m===0)throw new l("No linked tests matched the requested removal selector",d.NOT_FOUND,{code:"linked_test_remove_no_match",unmatched:[...a.map(h=>`${h.kind}=${h.value}`),...c.map(h=>`index=${h}`)],required:"List linked tests and retry with an exact command/path or a current 1-based --remove-index.",examples:[`pm test ${t} --list`,`pm test ${t} --remove-index 1`]});return p.metadata.tests=_.tests,{changedFields:qe(f,_.tests)?[]:["tests"]}}});return{itemId:u.item.id,tests:u.item.tests??[],testRuns:u.item.test_runs??[],changed:u.changedFields.length>0,removed:m}}function ZL(e,t){XL(e);let n={match:e.match,onlyIndex:e.onlyIndex===void 0?void 0:td(e.onlyIndex),onlyLast:e.onlyLast},r=e.run===!0?ow(t,n):void 0,o=e.timeout===void 0?void 0:pe(e.timeout,"timeout");if(o!==void 0&&o<=0)throw new l("Test timeout must be a positive number",d.USAGE);return{defaultTimeoutSeconds:o,pmContextMode:Gs(e.pmContext),runSelection:r,testsToRun:r?.selected??t}}async function e$(e){let{options:t,runOptions:n,pmRoot:r}=e;return t.run!==!0?[]:await ld(n.testsToRun,n.defaultTimeoutSeconds,{progress:t.progress,envSet:t.envSet,envClear:t.envClear,sharedHostSafe:t.sharedHostSafe,pmContext:n.pmContextMode,overrideLinkedPmContext:t.overrideLinkedPmContext,failOnContextMismatch:t.failOnContextMismatch,failOnEmptyTestRun:t.failOnEmptyTestRun,requireAssertionsForPm:t.requireAssertionsForPm,checkContext:t.checkContext,autoPmContext:t.autoPmContext,workspaceContext:t.workspaceContext,overrideLinkedWorkspaceContext:t.overrideLinkedWorkspaceContext,pmRoot:r,allowUntrustedLinkedTests:t.allowUntrustedLinkedTests,untrustedLinkedTestsPolicyEnabled:e.untrustedLinkedTestsPolicyEnabled,sourceRoots:{projectPmRoot:r,globalPmRoot:lt(process.cwd())}})}function t$(e,t,n){let r=[];if(t&&t.selector!==null&&r.push(`linked_test_selection:${t.selector}=${t.requested};selected=${t.selected_count};skipped=${t.skipped_count};indexes=${t.selected_indexes.join(",")}`),e.run===!0&&e.checkContext===!0){let o=cd(n);r.push(`context_preflight:checked_pm_commands=${o.checked_pm_commands};tracker_read_commands=${o.tracker_read_commands};mismatches=${o.mismatches};auto_remediated=${o.auto_remediated}`)}return r}function n$(e){let t=FN(e.runResults),n=Number.parseInt(process.env.PM_BACKGROUND_TEST_RUN_ATTEMPT?.trim()??"",10),r=process.env.PM_BACKGROUND_TEST_RUN_RESUMED_FROM?.trim(),o=S(),i=Yr(e.options.measure,o);return{run_id:$N("test"),kind:"test",status:t.failed>0||e.failOnSkippedTriggered?"failed":"passed",started_at:e.runStartedAt,finished_at:o,recorded_at:o,attempt:Number.isFinite(n)&&n>=1?n:void 0,resumed_from:r&&r.length>0?r:void 0,passed:t.passed,failed:t.failed,skipped:t.skipped,fail_on_skipped_triggered:e.failOnSkippedTriggered?!0:void 0,measurements:i.length>0?i:void 0,executions:e.runResults.filter(s=>s.command?.trim()).slice(0,32).map(s=>({command:s.command.trim(),requested_pm_context_mode:s.execution_context?.requested_pm_context_mode,pm_context_mode:s.execution_context?.pm_context_mode,workspace_context_mode:s.execution_context?.workspace_context_mode,trust_reason:s.execution_context?.trust.reason}))}}async function r$(e){let{options:t,pmRoot:n,settings:r,itemId:o,runStartedAt:i,runResults:s,failOnSkippedTriggered:a,warnings:c}=e;if(t.run!==!0||!i)return;let m=n$({options:t,runStartedAt:i,runResults:s,failOnSkippedTriggered:a});if(r.testing.record_results_to_items!==!0)return{entry:m,receipt:{recorded:!1,reason:"tracking_disabled",run_id:m.run_id,recovery_command:"pm config project set test-result-tracking --policy enabled"}};try{return await $s({pmRoot:n,settings:r,itemId:o,author:C(t.author,r.author_default),message:`Track test run summary (${m.run_id})`,entry:m}),{entry:m,receipt:{recorded:!0,reason:"recorded",run_id:m.run_id}}}catch(u){return c.push(`test_result_tracking_failed:${o}:${u instanceof Error?u.message:String(u)}`),{entry:m,receipt:{recorded:!1,reason:"write_failed",run_id:m.run_id}}}}function yw(e,t,n){let r;if(e.metricBelow!==void 0){let o=e.metricBelow.indexOf("="),i=e.metricBelow.slice(0,o).trim(),s=e.metricBelow.slice(o+1).trim(),a=Number(s);if(o<=0||i.length===0||s.length===0||!Number.isFinite(a))throw new l("--metric-below must use name=value",d.USAGE);r=Uv(t,i,a)}return{measurements:n?.measurements,metric_below:r,metric_diff:e.metricDiff===void 0?void 0:Gv(t,e.metricDiff)}}async function o$(e,t,n){if(e.acknowledgeLinkedTests===!0)return b_(t,n,S())}function i$(e){let{item:t,runResults:n,failureCategories:r,runSelection:o,failOnSkippedTriggered:i,warnings:s,recording:a,measurementProjection:c}=e;return{ok:n.every(m=>m.status!=="failed")&&i!==!0,id:t.itemId,tests:t.tests,run_results:n,failure_categories:r,selection:o?{selector:o.selector,requested:o.requested,selected_indexes:o.selected_indexes,selected_count:o.selected_count,skipped_count:o.skipped_count}:void 0,fail_on_skipped_triggered:i?!0:void 0,warnings:s.length>0?s:void 0,changed:t.changed||a?.receipt.recorded===!0,...a?{evidence_recording:a.receipt}:{},count:t.tests.length,...t.removed>0?{removed:t.removed}:{},...c}}async function Ks(e,t,n){let r=Lt(),o=E(process.cwd(),n.path);await I(o);let i=await A(o);if((t.measure?.length??0)>0&&t.run!==!0)throw new l("--measure requires --run",d.USAGE);Yr(t.measure,"validation"),yw(t,[],void 0);let s=x(i,R()),a=await r.resolveList(t.add,"--add"),c=await r.resolveList(t.addJson,"--add-json"),m=await r.resolveList(t.remove,"--remove"),u=[...WN(a),...XN(c)],p=await Kn(u,C(t.author,i.author_default),S())??[],f=QN(m),_=ZN(t.removeIndex),h=await QL({id:e,options:t,pmRoot:o,settings:i,typeToFolder:s.type_to_folder,adds:p,removes:f,removeIndexes:_}),y=ZL(t,h.tests),g=await o$(t,o,h.tests),v=t.run===!0?S():void 0,b=await e$({options:t,runOptions:y,pmRoot:o,untrustedLinkedTestsPolicyEnabled:i.testing.allow_untrusted_linked_tests}),k=qs(b),T=t.run===!0&&t.failOnSkipped===!0&&b.some(J=>J.status==="skipped"),O=t$(t,y.runSelection,b);g&&O.push(`linked_test_trust_acknowledged:${g.acknowledged}`);let L=await r$({options:t,pmRoot:o,settings:i,itemId:h.itemId,runStartedAt:v,runResults:b,failOnSkippedTriggered:T,warnings:O}),$=L?.receipt.recorded?Zl([...h.testRuns,L.entry]):h.testRuns,K=yw(t,$,L?.entry);return i$({item:h,runResults:b,failureCategories:k,runSelection:y.runSelection,failOnSkippedTriggered:T,warnings:O,recording:L,measurementProjection:K})}(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]="e3e3a1d4-4552-5f3c-9b02-c33ae72ea32b")}catch{}})();var s$=(e,t)=>{if(e===void 0)return;let n=ee(e,t);if(!n){let r=t.definitions.map(o=>o.id);throw new l(`Invalid --status value "${e}". Allowed: ${r.join(", ")}`,d.USAGE)}return n},a$=e=>{if(e===void 0)return;let t=pe(e,"timeout");if(t<=0)throw new l("timeout must be a positive number",d.USAGE);return t},Lw=(e,t)=>{if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw new l(`${t} must be a non-negative integer`,d.USAGE);return n},c$=e=>e instanceof Error?e.message:String(e),l$=()=>{let e=process.env.PM_BACKGROUND_TEST_RUN_ID?.trim();return e&&e.length>0?e:`test-all-local-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`},d$=e=>e.trim().replaceAll(/\s+/g," "),m$=e=>!e||Object.keys(e).length===0?"{}":JSON.stringify(Object.fromEntries(Object.entries(e).sort(([t],[n])=>t.localeCompare(n)))),u$=e=>!e||e.length===0?"[]":JSON.stringify([...e].sort((t,n)=>t.localeCompare(n))),p$=e=>{let t=e?.trim().toLowerCase();return t&&t.length>0?t:"none"},f$=e=>{let t=e?.trim().toLowerCase();return t&&t.length>0?t:"source"},zs=e=>[...new Set(e??[])].sort((t,n)=>t.localeCompare(n)),$w=e=>Object.fromEntries(Object.entries(e??{}).sort(([t],[n])=>t.localeCompare(n))),_$=e=>typeof e=="number"?e:void 0,h$=e=>{let t={assert_stdout_contains:zs(e.assert_stdout_contains),assert_stdout_regex:zs(e.assert_stdout_regex),assert_stderr_contains:zs(e.assert_stderr_contains),assert_stderr_regex:zs(e.assert_stderr_regex),assert_stdout_min_lines:_$(e.assert_stdout_min_lines),assert_json_field_equals:$w(e.assert_json_field_equals),assert_json_field_gte:$w(e.assert_json_field_gte)};return JSON.stringify(t)},g$=e=>{let t=dd(e.command);return t!==void 0?`command:${e.scope}:${d$(t)}`:`path:${e.scope}:${dd(e.path)??""}`},Fw=e=>{let t=m$(e.env_set),n=u$(e.env_clear),r=p$(e.pm_context_mode),o=f$(e.workspace_context_mode),i=e.shared_host_safe===!0?"true":"false",s=h$(e);return`${g$(e)}:${t}:${n}:${r}:${o}:${i}:${s}`},y$=(e,t)=>t===void 0?e:e===void 0||t>e?t:e,v$=e=>{let t=0,n=0,r=0;for(let o of e){if(o.status==="passed"){t+=1;continue}if(o.status==="failed"){n+=1;continue}r+=1}return{passed:t,failed:n,skipped:r}},w$=(e,t)=>{for(let[n,r]of Object.entries(t))e[n]+=r},Bs=(e,t)=>{if(e.progress===!0)try{process.stderr.write(`[pm test-all] ${t}
36
- `)}catch{}},b$=async(e,t,n)=>{let r=[],o=0;for(let i of e){let s=await Ks(i.id,{run:!1},{...t,path:n});o+=s.tests.length,r.push({item:i,tests:s.tests})}return{itemTests:r,linkedTests:o}},k$=async e=>{let t=F(e.settings.schema),n=x(e.settings,R()),r=s$(e.options.status,t),o=Lw(e.options.limit,"--limit"),i=Lw(e.options.offset,"--offset")??0,a=(await fe(e.pmRoot,e.settings.item_format,n.type_to_folder,void 0,e.settings.schema)).filter(m=>r?m.status===r:!0).sort((m,u)=>m.id.localeCompare(u.id));return{filteredItems:o===void 0?a.slice(i):a.slice(i,i+o),statusFilter:r,limitFilter:o,offsetFilter:i}},S$=e=>{let t=new Map;for(let{tests:n}of e)for(let r of n){let o=Fw(r);if(!t.has(o)){t.set(o,r.timeout_seconds);continue}t.set(o,y$(t.get(o),r.timeout_seconds))}return t},E$=async(e,t)=>{let n=[],r=e.tests.map(u=>{let p=Fw(u),f=t.seenTestKeys.has(p);if(!f){t.seenTestKeys.add(p);let _=t.effectiveTimeoutByKey.get(p);n.push(_===void 0?u:{...u,timeout_seconds:_})}return{test:u,key:p,duplicate:f}}),o=n.length>0?await ld(n,t.defaultTimeoutSeconds,{progress:t.options.progress,sourceRoots:t.sourceRoots,envSet:t.options.envSet,envClear:t.options.envClear,sharedHostSafe:t.options.sharedHostSafe,pmContext:t.options.pmContext,overrideLinkedPmContext:t.options.overrideLinkedPmContext,failOnContextMismatch:t.options.failOnContextMismatch,failOnEmptyTestRun:t.options.failOnEmptyTestRun,requireAssertionsForPm:t.options.requireAssertionsForPm,checkContext:t.options.checkContext,autoPmContext:t.options.autoPmContext,workspaceContext:t.options.workspaceContext,overrideLinkedWorkspaceContext:t.options.overrideLinkedWorkspaceContext,pmRoot:t.pmRoot,allowUntrustedLinkedTests:t.options.allowUntrustedLinkedTests,untrustedLinkedTestsPolicyEnabled:t.settings.testing.allow_untrusted_linked_tests}):[],i=0,s=r.map(({test:u,key:p,duplicate:f})=>{if(!f){let _=o[i];return i+=1,_}return{command:u.command,path:u.path,status:"skipped",error:`Duplicate linked test skipped (key=${p}).`}}),a=v$(s),c=qs(s),m=await C$(e,a,s,t);return{passed:a.passed,failed:a.failed,skipped:a.skipped,trackingWarnings:m,failureCategories:c,result:{ok:a.failed===0&&!(t.options.failOnSkipped===!0&&a.skipped>0),id:e.item.id,status:e.item.status,test_count:e.tests.length,passed:a.passed,failed:a.failed,skipped:a.skipped,run_results:s,failure_categories:c}}},A$=(e,t)=>[e.failed>0,t.failOnSkipped===!0&&e.skipped>0].includes(!0),T$=e=>e?!0:void 0,C$=async(e,t,n,r)=>{if(!r.trackingEnabled)return[];try{let o=A$(t,r.options);await $s({pmRoot:r.pmRoot,settings:r.settings,itemId:e.item.id,author:r.trackingAuthor,message:`Track test-all run summary (${r.trackingRunId})`,entry:{run_id:r.trackingRunId,kind:"test-all",status:o?"failed":"passed",started_at:r.runStartedAt,finished_at:S(),recorded_at:S(),attempt:r.trackingAttempt,resumed_from:r.trackingResumedFrom,passed:t.passed,failed:t.failed,skipped:t.skipped,items:1,linked_tests:e.tests.length,fail_on_skipped_triggered:T$(r.options.failOnSkipped===!0&&t.skipped>0),executions:n.filter(i=>i.command?.trim()).slice(0,32).map(i=>({command:i.command.trim(),requested_pm_context_mode:i.execution_context?.requested_pm_context_mode,pm_context_mode:i.execution_context?.pm_context_mode,workspace_context_mode:i.execution_context?.workspace_context_mode,trust_reason:i.execution_context?.trust.reason}))}})}catch(o){return[`test_result_tracking_failed:${e.item.id}:${c$(o)}`]}return[]},I$=()=>{let e=process.env.PM_BACKGROUND_TEST_RUN_ATTEMPT?.trim(),t=e?Number.parseInt(e,10):Number.NaN;return Number.isFinite(t)&&t>=1?t:void 0},dd=e=>{let t=e?.trim();return t&&t.length>0?t:void 0},R$=e=>({pmRoot:e.pmRoot,settings:e.settings,options:e.options,defaultTimeoutSeconds:e.defaultTimeoutSeconds,sourceRoots:{projectPmRoot:e.pmRoot,globalPmRoot:lt(process.cwd())},seenTestKeys:new Set,effectiveTimeoutByKey:S$(e.itemTests),trackingEnabled:e.settings.testing.record_results_to_items===!0,trackingAuthor:C(e.options.author,e.settings.author_default),trackingRunId:l$(),trackingAttempt:I$(),trackingResumedFrom:dd(process.env.PM_BACKGROUND_TEST_RUN_RESUMED_FROM),runStartedAt:e.runStartedAt}),O$=(e,t,n)=>{let r={results:[],passed:0,failed:0,skipped:0,failureCategories:qs([]),trackingWarnings:[]},o=e.failOnEmptyTestRun===!0&&t===0;return o&&(r.failed+=1,r.failureCategories.empty_run+=1,r.trackingWarnings.push(`empty_linked_test_selection:items=${n.length};linked_tests=0;fail_on_empty_test_run=true`)),{accumulation:r,failOnEmptyTestRunTriggered:o}},x$=async(e,t,n)=>{for(let[r,o]of e.entries()){Bs(t.options,`item ${r+1}/${e.length} start id=${o.item.id} linked_tests=${o.tests.length}`);let i=await E$(o,t);w$(n.failureCategories,i.failureCategories),n.passed+=i.passed,n.failed+=i.failed,n.skipped+=i.skipped,n.trackingWarnings.push(...i.trackingWarnings),n.results.push(i.result),Bs(t.options,`item ${r+1}/${e.length} end id=${o.item.id} status=${i.failed===0?"passed":"failed"} passed=${i.passed} failed=${i.failed} skipped=${i.skipped}`)}},P$=(e,t)=>{if(e.checkContext!==!0)return;let n=t.results.flatMap(o=>o.run_results),r=cd(n);t.trackingWarnings.push(`context_preflight:checked_pm_commands=${r.checked_pm_commands};tracker_read_commands=${r.tracker_read_commands};mismatches=${r.mismatches};auto_remediated=${r.auto_remediated}`)},N$=e=>({ok:e.ok,totals:{items:e.filteredItems.length,linked_tests:e.linkedTests,passed:e.accumulation.passed,failed:e.accumulation.failed,skipped:e.accumulation.skipped,failure_categories:e.accumulation.failureCategories},failed:e.accumulation.failed,passed:e.accumulation.passed,skipped:e.accumulation.skipped,fail_on_skipped_triggered:e.failOnSkippedTriggered?!0:void 0,fail_on_empty_test_run_triggered:e.failOnEmptyTestRunTriggered?!0:void 0,warnings:e.accumulation.trackingWarnings.length>0?e.accumulation.trackingWarnings:void 0,results:e.accumulation.results}),L$=e=>[`selection items=${e.filteredItems.length}`,`linked_tests=${e.linkedTests}`,e.statusFilter===void 0?"":`status=${e.statusFilter}`,e.limitFilter===void 0?"":`limit=${e.limitFilter}`,e.offsetFilter>0?`offset=${e.offsetFilter}`:""].filter(t=>t.length>0).join(" "),$$=async(e,t)=>{let n=E(process.cwd(),t.path);await I(n);let r=await A(n),o=await k$({pmRoot:n,settings:r,options:e}),i=a$(e.timeout),s=S(),a=await b$(o.filteredItems,t,n);return Bs(e,L$({...o,linkedTests:a.linkedTests})),{pmRoot:n,settings:r,filteredItems:o.filteredItems,itemTests:a.itemTests,linkedTests:a.linkedTests,defaultTimeoutSeconds:i,runStartedAt:s}},F$=e=>{let t=e.options.failOnSkipped===!0&&e.accumulation.skipped>0,n=![e.accumulation.failed>0,t,e.failOnEmptyTestRunTriggered].includes(!0);return{failOnSkippedTriggered:t,ok:n}},Mw=async(e,t)=>{let n=await $$(e,t),{accumulation:r,failOnEmptyTestRunTriggered:o}=O$(e,n.linkedTests,n.filteredItems),i=R$({pmRoot:n.pmRoot,settings:n.settings,options:e,itemTests:n.itemTests,defaultTimeoutSeconds:n.defaultTimeoutSeconds,runStartedAt:n.runStartedAt});await x$(n.itemTests,i,r),P$(e,r);let s=F$({options:e,accumulation:r,failOnEmptyTestRunTriggered:o});return Bs(e,`end status=${s.ok?"passed":"failed"} items=${n.filteredItems.length} linked_tests=${n.linkedTests} passed=${r.passed} failed=${r.failed} skipped=${r.skipped}`),N$({ok:s.ok,filteredItems:n.filteredItems,linkedTests:n.linkedTests,accumulation:r,failOnSkippedTriggered:s.failOnSkippedTriggered,failOnEmptyTestRunTriggered:o})};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="419a061f-e181-5b18-9e3a-d22cc5aff416")}catch{}})();function Dw(e,t,n){let r;if(typeof e.lines=="string")r=Ri(e.lines);else if(e.lineRange!==void 0){if(e.lineRange===null||typeof e.lineRange!="object"||Array.isArray(e.lineRange))throw new RangeError("Source line range must be an object with numeric start and end values.");r=Ri(`${String(Reflect.get(e.lineRange,"start"))}:${String(Reflect.get(e.lineRange,"end"))}`)}return{paths:t,scope:e.scope==="project"||e.scope==="global"?e.scope:void 0,limit:n(e.limit,"files lookup limit"),offset:n(e.offset,"files lookup offset"),noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:r,decisionDepth:n(e.decisionDepth,"files lookup decision depth")}}(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]="c6f4c40f-50cf-568f-8a45-860ac4be3c97")}catch{}})();function Pe(e,t){let n=w(e,t);if(!n)throw new l(`Missing required argument: ${t}`,64);return n}function wn(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}(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]="1b86373f-26a3-5893-95dc-e794fcc1afa1")}catch{}})();function M$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:w(e.args,"name")??w(e.options,"name"),author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:ge(n)}}function D$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,a=wn({list:()=>Sf(t.global),show:()=>Ef(r,t.global),"show-status":()=>Af(r,t.global),"list-fields":()=>If(t.global),"show-field":()=>Rf(r,t.global),"remove-type":()=>vf(r,{author:o,force:i},t.global),"remove-field":()=>Cf(r,{author:o,force:i},t.global),"remove-status":()=>kf(r,{author:o,force:i},t.global),"apply-preset":()=>Of(w(t.args,"typePreset")??w(t.options,"typePreset"),{author:o,force:i},t.global)},n);return a?a():null}function U$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return Tf(n,{type:w(t.args,"fieldType")??w(t.options,"fieldType"),commands:s===void 0?void 0:ge(s),description:w(t.args,"description")??w(t.options,"description"),cliFlag:w(t.args,"cliFlag")??w(t.options,"cliFlag"),alias:i,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:ge(a),author:r,force:o},t.global)}function G$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.role??t.options.role;return bf(n,{role:s===void 0?void 0:ge(s),alias:i,description:w(t.args,"description")??w(t.options,"description"),order:Fe(t.args.order??t.options.order,"schema add-status order"),author:r,force:o},t.global)}function j$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e;return yf(n,{description:w(t.args,"description")??w(t.options,"description"),defaultStatus:w(t.args,"defaultStatus")??w(t.args,"default_status")??w(t.options,"defaultStatus")??w(t.options,"default_status"),folder:w(t.args,"folder")??w(t.options,"folder"),alias:i,author:r,force:o},t.global)}function q$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,s=w(t.args,"to")??Pe(t.options,"to"),a=w(t.args,"migrationId")??w(t.args,"migration_id")??w(t.options,"migrationId")??w(t.options,"migration_id"),c=w(t.args,"fieldTypeScope")??w(t.options,"fieldTypeScope")??w(t.args,"type")??w(t.options,"type"),m=n==="rename-type"?{kind:"rename-type",from:r??"",to:s}:n==="rename-field"?{kind:"rename-field",from:r??"",to:s,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:r??"",to:s};return hf(m,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:o,force:i},t.global)}function Uw(e){let t=M$(e);Fp(t.subcommand,e.args.dryRun===!0||e.options.dryRun===!0);let n=Tn.find(o=>o===t.subcommand);if(n)return _f(n,t.name,{definition:e.args.definition??e.options.definition,policy:w(e.args,"policy")??w(e.options,"policy"),message:w(e.args,"message")??w(e.options,"message"),author:t.author,dryRun:e.args.dryRun===!0||e.options.dryRun===!0},e.global);let r=D$(t);if(r!==null)return r;if(["rename-type","rename-field","remap-status"].includes(t.subcommand))return q$(t);if(t.subcommand==="add-field")return U$(t);if(t.subcommand==="add-status")return G$(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?xf({minCount:Fe(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):j$(t);throw Te({command_path:"schema",token:t.subcommand,allowed:gf,exit_code:64})}(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]="d5136ee1-7446-5fbf-b782-bc58b5323c64")}catch{}})();function Hs(e){return w(e.args,"target")??w(e.options,"target")}function we(e,t=e.options){return e.id??Pe(t,"id")}async function K$(e){let t=Rn("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Cc(await ht(w(e.args,"status")??w(t,"status"),t,e.global),t)}async function z$(e){let t=Pe(e.args,"query"),n=Rn("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),Cc(await Or(t,n,e.global),n)}async function B$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options);return Se(await jt(r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function H$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options),o={...r,...r.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...r.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return Se(await Bc(we(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function V$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options);return Se(await it(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function W$(e){let t=zi(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),bh(we(e),t,e.global)}function Gw(e,t){return Wf(Dw(e.options,t,Fe),e.global)}function Y$(e){let t=ge(e.options.lookupPath);if(t&&t.length>0)return Gw(e,t);let n=we(e);return e.options.discover===!0?oc(n,Ei(e.options),e.global):Vf(n,Ar(e.options),e.global)}function J$(e){return Zv({subcommand:w(e.args,"subcommand")??w(e.options,"subcommand"),limit:Df(e.args,e.options)},e.global)}function X$(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Tr(e.global,t)}function Q$(e){let t=w(e.args,"configAction")??w(e.options,"configAction")??w(e.options,"action");if(t===void 0)throw new l("Missing required argument: configAction",64);let n=w(e.args,"value")??w(e.options,"value"),r=w(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return Kh(w(e.args,"scope")??w(e.options,"scope")??"project",t,w(e.args,"key")??w(e.options,"key"),r,e.global,w(e.options,"policy")===void 0?n:void 0)}function Z$(e){let t=e.options;return x_(O_(t),e.global)}function eF(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new l(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new l(`${t} must be a finite integer.`,64);let r=Number.parseInt(n,10);if(!Number.isInteger(r))throw new l(`${t} must be a finite integer.`,64);return r}}async function tF(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.options,{changedFields:r,idOnly:o}=_e(e.args,e.options),i=await by({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:nF(e),reorderTo:eF(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global});return t!=="show"&&$f(e.args)&&(i.mutation_receipt=As(i,void 0)),t==="show"?i:Se(i,{changedFields:r,idOnly:o,compactEnvelope:r==="compact"&&!o})}function nF(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function rF(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=t.trim().toLowerCase(),r=w(e.args,"name")??w(e.options,"name"),i=wn({list:()=>Fy(),show:()=>My(r),lint:()=>Dy(r),apply:()=>Uy(r,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!i)throw Te({command_path:"profile",token:t,allowed:$y,exit_code:64});return i()}async function oF(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options);return Se(await ng(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function iF(e){let{changedFields:t,runnerOptions:n}=_e(e.args,e.options);return Se(await Ty(Ci(n),e.global),{changedFields:t})}async function sF(e){let{changedFields:t,runnerOptions:n}=_e(e.args,e.options),r=w(e.args,"reason"),o=r!==void 0&&n.reason===void 0?{...n,reason:r}:{...n};return e.force&&o.force===void 0&&(o.force=!0),Se(await ug(Ti(o),e.global),{changedFields:t})}async function aF(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options),o=w(r,"target")??Pe(e.args,"target");return Se(await sn(we(e,r),o,r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function cF(e){let t={...e.args,...e.options};return Yf(Pe(t,"subcommand"),w(t,"id")??e.id,w(t,"target"),qf(t),e.global)}function lF(e){return zf(E(process.cwd(),e.global.path),{...e.args,...e.options})}var jw={init:e=>Nr(w(e.args,"prefix"),e.global,e.options),context:e=>fc(Rn("context",e.options),e.global),next:e=>Rr(Rn("next",e.options),e.global),eval:vv,events:wv,merge:bv,workspace:kv,meet:xs,event:xs,remind:xs,list:K$,get:e=>{let t=we(e);return hc(t,e.global,Rn("get",e.options,[t]))},search:z$,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:ge(e.options.status);return rc(e.global,{exhaustive:e.options.exhaustive===!0,...t.length===0?{}:{status:t},since:w(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:Fe(e.options.limit,"limit")})},create:B$,copy:H$,focus:e=>ol(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:V$,"item-reopen":cy,restore:aF,claim:iy,release:ay,"start-task":e=>_n(e,"start_task"),"pause-task":e=>_n(e,"pause_task"),"close-task":e=>_n(e,"close_task"),close:sy,comments:W$,notes:e=>Cy(we(e),zi(e.options),e.global),learnings:e=>tg(we(e),zi(e.options),e.global),files:Y$,docs:e=>Hf(we(e),Ar(e.options),e.global),test:e=>Ks(we(e),e.options,e.global),"test-all":e=>Mw(e.options,e.global),telemetry:J$,validate:e=>$i(e.options,e.global,{runUpdate:(t,n,r)=>it(t,n,r)}),health:X$,assurance:e=>k_(e.args,e.options,e.global),contracts:e=>wc(e.options,e.global),config:Q$,activity:Z$,aggregate:e=>_c(e.options,e.global),extension:e=>Un(Hs(e),e.options,e.global),package:e=>Un(Hs(e),e.options,e.global),install:e=>Un(Hs(e),{...e.options,install:!0},e.global),upgrade:e=>E_(Hs(e),e.options,e.global),delete:e=>rl(we(e),e.options,e.global),deps:e=>Bf(we(e),e.options,e.global),graph:cF,"files-discover":e=>oc(we(e),e.options,e.global),"files-lookup":e=>Gw(e,ge(e.options.paths)),history:e=>P_(we(e),e.options,e.global),"history-redact":e=>eg(we(e),e.options,e.global),"history-repair":Yh,"history-compact":Jh,"history-attest":e=>A_(e.options,e.global),"history-author-acknowledge":lF,plan:tF,schema:Uw,profile:rF,stats:e=>Yl(e.global,Sv(e.options)),append:oF,"update-many":iF,"close-many":sF,gc:e=>S_(e.global,e.options)};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e8137f8b-745a-5ef5-9e7e-14b7d032c1ea")}catch{}})();var dF=new Map;function md(){dF.clear()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c84b11c-502f-5c33-a757-5757402357b4")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b841f903-6276-5067-842f-6a6bff114cec")}catch{}})();(function(){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]="4277a72c-f012-55d2-9e18-c9a836d829d6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aba4af26-98d3-53aa-8b23-1be7c90a38d1")}catch{}})();function qw(){return{metadata:{},body:""}}(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]="5b106ed0-ef19-58a4-a7d0-bd0988482f58")}catch{}})();var zw=[{id:"capabilities",aliases:["capability-map","families","routing"],title:"Generated Capability Routing",summary:"Route work through command families generated from the canonical agent capability contract.",intent:"Use this as the drift-free entrypoint when selecting a CLI, MCP, completion, documentation, or extension command surface.",commands:ip().flatMap(({commands:e})=>e.map(t=>`pm ${t}`)),workflows:[],docs:[{path:"docs/generated/AGENT_CAPABILITY_ROUTING.md",purpose:"Generated command-to-family routing table."},{path:"docs/generated/AGENT_COMMAND_SURFACE.md",purpose:"Generated visibility-tier and family table."}],related:["commands","workflows","extensions"]},{id:"quickstart",aliases:["start","getting-started","bootstrap"],title:"Quickstart",summary:"Initialize a tracker and run the shortest safe plan -> execute -> close loop.",intent:"Use this when a human or agent needs to start productive work quickly with minimal context load.",commands:["pm workspace init","pm workspace config --help","pm workspace schema --help","pm workspace profile --help","pm context --limit 10","pm list --status open --limit 20",'pm create --create-mode progressive --title "..." --description "..." --type Task',"pm claim <ID>","pm update <ID> --status in_progress",'pm close <ID> "<reason with evidence>" --validate-close warn'],workflows:[{name:"Start Session Safely",goal:"Bootstrap without mutating unrelated state.",prompt:"You are bootstrapping pm work. Use a token-efficient context snapshot first, then select one open item, claim it, and only then mutate.",commands:["pm context --limit 10","pm list --status open --limit 20","pm claim <ID>"]}],docs:[{path:"README.md",purpose:"High-level project and install entrypoint."},{path:"docs/QUICKSTART.md",purpose:"Short setup and first-command walkthrough."},{path:"docs/COMMANDS.md",purpose:"Task-oriented command recipes."}],related:["commands","workflows","release"]},{id:"commands",aliases:["cli","operations","reference"],title:"CLI Command Routing",summary:"Find the right command family quickly and use command-scoped help/contracts output.",intent:"Use this when selecting command paths, flags, and output formats for implementation or automation.",commands:["pm --help","pm <command> --help","pm <command> --help --explain","pm contracts --command <command> --flags-only","pm contracts --command <command> --availability-only --runtime-only","pm completion <bash|zsh|fish>"],workflows:[{name:"Flag Discovery",goal:"Resolve command flags deterministically before mutations.",prompt:"You are preparing to run a command. Use help and contracts surfaces to verify required/optional flags before execution.",commands:["pm <command> --help --explain","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Command grouping and examples."},{path:"docs/CONFIGURATION.md",purpose:"Project/global settings and policy controls."},{path:"docs/TESTING.md",purpose:"Linked-test orchestration and safety guidance."}],related:["quickstart","workflows","sdk","extensions"]},{id:"workflows",aliases:["developer","maintainer","agent"],title:"Developer and Agent Workflows",summary:"Apply canonical claim -> execute -> verify -> close workflows with append-only evidence.",intent:"Use this for day-to-day coding-agent execution loops and handoff-safe updates.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add ...","pm test <ID> --add ...",'pm comments <ID> "..."',"pm validate --check-resolution --check-history-drift","pm release <ID>"],workflows:[{name:"Execution Loop",goal:"Keep code, tests, and tracker evidence synchronized.",prompt:"You are implementing a scoped change. Claim first, link files/tests/docs as you go, append evidence comments, and close only after validation.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add path=<file>,scope=project","pm test <ID> --run --progress",'pm close <ID> "<evidence>" --validate-close warn']}],docs:[{path:"AGENTS.md",purpose:"Repository operating rules and required workflow."},{path:"docs/AGENT_GUIDE.md",purpose:"Agent-oriented usage and context strategy."},{path:"docs/TESTING.md",purpose:"Sandbox-safe test execution rules."}],related:["quickstart","commands","skills"]},{id:"sdk",aliases:["api","typescript-sdk"],title:"SDK and Integrations",summary:"Use the published SDK surface for extension authoring and contract-safe integrations.",intent:"Use this when building or reviewing programmatic integrations against @unbrained/pm-cli/sdk.",commands:["pm contracts --schema-only","pm contracts --command extension --flags-only","pm contracts --runtime-only --availability-only"],workflows:[{name:"Integration Contract Check",goal:"Confirm action schemas and runtime availability before coding.",prompt:"You are wiring an integration. Capture schema + runtime availability first, then map your adapter payload fields to contract keys.",commands:["pm contracts --schema-only","pm contracts --availability-only --runtime-only","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/SDK.md",purpose:"Public SDK exports and extension authoring references."},{path:"docs/ARCHITECTURE.md",purpose:"Core runtime composition and extension load flow."}],related:["extensions","commands"]},{id:"extensions",aliases:["plugins","extension-authoring","packages","package-authoring"],title:"Packages and Extensions",summary:"Install, author, and diagnose packages/extensions with deterministic lifecycle controls.",intent:"Use this for package management, extension capability registration, and runtime diagnostics.",commands:["pm package install <target> --project","pm package upgrade --dry-run","pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package activate <target> --project","pm package deactivate <target> --project"],workflows:[{name:"Lifecycle Triage",goal:"Diagnose extension state before forceful lifecycle actions.",prompt:"You are debugging package behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.",commands:["pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package upgrade --packages-only --dry-run"]}],docs:[{path:"docs/EXTENSIONS.md",purpose:"Capability model and lifecycle command usage."},{path:"docs/examples/starter-extension/README.md",purpose:"Starter extension scaffold and local development path."},{path:"docs/SDK.md",purpose:"SDK contracts used by extension implementations."}],related:["sdk","commands","skills"]},{id:"skills",aliases:["agent-skills","agentskills"],title:"Agent Skills",summary:"Skill bundles for developer, user, extensions, and sdk workflows aligned to the current CLI.",intent:"Use this when an agent needs reproducible prompts/workflows with strict compatibility metadata.",commands:["pm guide skills --depth deep","pm contracts --command guide --flags-only","pm validate --check-command-references"],workflows:[{name:"Skill Selection",goal:"Pick the narrowest compatible skill first to minimize context usage.",prompt:"Select a pm skill based on the task intent, then execute only the workflow section needed for the current change.",commands:["pm guide skills","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent-first usage and context model."},{path:"docs/README.md",purpose:"Documentation routing with progressive disclosure."},{path:".agents/skills/README.md",purpose:"Agent skills index and routing overview."},{path:".agents/skills/pm-developer/SKILL.md",purpose:"Developer-oriented pm skill workflow."},{path:".agents/skills/pm-user/SKILL.md",purpose:"User/operator pm skill workflow."},{path:".agents/skills/pm-extensions/SKILL.md",purpose:"Extension-focused pm skill workflow."},{path:".agents/skills/pm-sdk/SKILL.md",purpose:"SDK integration pm skill workflow."}],related:["workflows","harnesses","commands"]},{id:"harnesses",aliases:["compatibility","agent-compatibility"],title:"Agent Harness Compatibility",summary:"Cross-harness compatibility guidance for docs routing.",intent:"Use this when adapting pm docs and SDK contracts for an external automation harness.",commands:["pm guide skills","pm guide commands","pm contracts --runtime-only --availability-only"],workflows:[{name:"Harness Mapping",goal:"Route each harness to the same canonical skill/docs sources.",prompt:"Map harness-specific entrypoints to the same pm guide topics and .agents/skills workflows without adding runtime harness-specific code.",commands:["pm guide harnesses --depth standard","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent context and output-mode conventions."},{path:"docs/README.md",purpose:"Single-source documentation routing entrypoint."},{path:".agents/skills/HARNESS_COMPATIBILITY.md",purpose:"Harness compatibility matrix and usage notes."}],related:["skills","workflows"]},{id:"release",aliases:["gates","ship","release-readiness"],title:"Release and Staleness Gates",summary:"Run release gates and docs/skills freshness checks before publishing.",intent:"Use this when validating release readiness and preventing docs/skills drift.",commands:["pnpm build","pnpm test:coverage","pnpm quality:static","node scripts/release/run-gates.mjs --telemetry-mode best-effort","pnpm security:scan"],workflows:[{name:"Pre-Release Gate Sweep",goal:"Ensure code, docs, and skills are all green before publish.",prompt:"Run release gates in deterministic order and treat docs/skills freshness failures as release blockers.",commands:["pnpm build","pnpm test:coverage","node scripts/release/run-gates.mjs --telemetry-mode best-effort"]}],docs:[{path:"docs/RELEASING.md",purpose:"Release flow and safety checks."},{path:"CHANGELOG.md",purpose:"Versioned release history and unreleased notes."},{path:"scripts/release/run-gates.mjs",purpose:"Source of truth for release gate ordering."}],related:["commands","skills","workflows"]},{id:"tokens",aliases:["output","budget","context-cost","projections"],title:"Read Output and Token Budgets",summary:"Bound what a read costs before it is emitted, and resume the part a budget withheld.",intent:"Use this when an agent must keep context small: every read declares a token ceiling, degrades deterministically, and reports what it omitted.",commands:["pm contracts --summary --json","pm list --status open --output-limit 20","pm get <ID> --output-include id,title,status,dependencies","pm context --limit 10 --token-accounting","pm notes <ID> --output-cursor <cursor>","pm list --status closed --output-budget unbounded"],workflows:[{name:"Bound A Read Before Emitting It",goal:"Never pay for rows the task does not need.",prompt:"Choose the narrowest projection first, then a row limit, then a token budget. Read the omission receipt before concluding the result is complete.",commands:["pm contracts --command list --flags-only --json","pm list --status open --output-limit 20 --output-format toon","pm list --status open --token-accounting"]},{name:"Recover A Truncated Read",goal:"Continue a bounded read instead of re-running it unbounded.",prompt:"When output_budget_truncation appears, prefer the declared continuation cursor. Only widen the budget when the response declares no cursor.",commands:["pm notes <ID> --output-cursor <cursor>","pm get <ID> --output-budget 20000"]}],docs:[{path:"docs/READ_OUTPUT_CONTRACTS.md",purpose:"Budget, truncation, continuation, and omission receipts."},{path:"docs/OUTPUT_PROJECTION_CONTRACTS.md",purpose:"Field and section projection grammar for every read."},{path:"docs/OUTPUT_TOKEN_ACCOUNTING.md",purpose:"Per-section token cost receipts."},{path:"docs/ITEM_READ_PROJECTIONS.md",purpose:"Item-level projection defaults and restore hints."}],related:["commands","workflows","quickstart"]},{id:"graph",aliases:["relationships","deps","dependencies","analytics"],title:"Relationship Graph and Planning Analytics",summary:"Type the relationships between items, then read the project as a graph rather than as a list.",intent:"Use this when the question is about lineage, ordering, blast radius, bottlenecks, or which work reaches a declared outcome.",commands:["pm deps <ID>",'pm update <ID> --dep "id=<other>,kind=implements"',"pm graph analyze","pm graph impact <ID> --direction downstream","pm graph paths <ID> <ID>","pm graph audit"],workflows:[{name:"Place New Work In The Ladder",goal:"Every item resolves to an outcome through a typed, explainable path.",prompt:"Set parent lineage first, then add typed edges that cite durable evidence. Never add an edge to satisfy a count.",commands:['pm search "<topic>" --limit 10','pm update <ID> --dep "id=<parent-goal>,kind=implements"',"pm graph ancestors <ID>"]},{name:"Assess Blast Radius Before Changing Something",goal:"Know what derives from an item before touching it.",prompt:"Walk the directed graph downstream from the item, then check whether any bottleneck node sits on the path.",commands:["pm graph impact <ID> --direction downstream","pm graph dominators <ID>","pm graph articulation"]}],docs:[{path:"docs/RELATIONSHIP_GRAPH.md",purpose:"Graph model, traversal verbs, and analytics surface."},{path:"docs/DEPENDENCY_KIND_CONTRACT.md",purpose:"Every typed edge kind, its direction, and its semantics."}],related:["commands","workflows","assurance"]},{id:"assurance",aliases:["gates","invariants","measurements","quality"],title:"Declared Invariants and Gates",summary:"Express a project's own quality rules as tracked data the SDK evaluates, instead of as scripts.",intent:"Use this when a rule must hold over the record itself \u2014 a floor, a ceiling, or a monotone property \u2014 and must fail closed in CI.",commands:["pm assurance list","pm assurance run <gate-id> --trigger ci --dry-run","pm validate --check-resolution --check-history-drift","pm health --summary"],workflows:[{name:"Add An Invariant Rather Than A Script",goal:"A new enforcement gap becomes declared data, not a new bespoke gate script.",prompt:"Define the measurement, bind an assertion with an explicit bound and polarity, prove a negative control, then attach it to a trigger.",commands:["pm assurance list --json","pm assurance run <gate-id> --trigger ci --dry-run --json"]},{name:"Read A Verdict Before Believing It",goal:"Know which population a passing assertion speaks for.",prompt:"Read population_size and scope on every assertion. A gate that cannot fail for the reason it exists is not evidence.",commands:["pm assurance run <gate-id> --trigger ci --dry-run --json --output-budget unbounded"]}],docs:[{path:"docs/ASSURANCE.md",purpose:"Measurement, assertion, gate, and trigger vocabulary."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"What every mutation must record to remain provable."}],related:["release","graph","workflows"]},{id:"merge",aliases:["branches","concurrency","multi-agent","fleet"],title:"Branching, Merging, and Concurrent Agents",summary:"Keep tracker data and history conflict-free while many agents work on separate branches.",intent:"Use this when more than one agent or worktree mutates the same tracker and the results must merge without hand resolution.",commands:["pm merge install","pm merge report","pm merge reconcile --dry-run","pm claim <ID>","pm release <ID>","pm validate --check-history-drift","pm health --check-only"],workflows:[{name:"Prepare A Clone For Field-Aware Merges",goal:"The committed merge fence needs clone-local driver configuration once.",prompt:"Run the merge installer in every fresh clone or worktree before the first branch merge of tracker data.",commands:["pm merge install","pm health --check-only"]},{name:"Settle A Merge Before Trusting Health",goal:"A lossless merge still leaves pending receipts that strict health reports until they are reconciled.",prompt:"After any branch merge that touched tracker data, read the merge report, preview the reconciliation, then apply it; only then treat a health verdict as a statement about the data.",commands:["pm merge report","pm merge reconcile --dry-run",'pm merge reconcile --message "Post-merge history reconciliation"',"pm health --check-only"]},{name:"Hand Work Between Agents Safely",goal:"Ownership and evidence survive the handoff.",prompt:"Claim before substantial edits, record evidence as comments, and release the claim when pausing, handing off, closing, or canceling.",commands:["pm claim <ID>",'pm comments <ID> "Handoff: <state and next step>"',"pm release <ID>"]}],docs:[{path:"docs/MERGE_SAFETY.md",purpose:"Merge driver, field-aware resolution, and clone setup."},{path:"docs/SDK_CONTEXT_COORDINATION.md",purpose:"Coordination primitives for concurrent agents."}],related:["workflows","assurance","commands"]},{id:"evidence",aliases:["record","annotations","learnings","history-maintenance"],title:"Evidence, Durable Knowledge, and Record Maintenance",summary:"Append comments, notes, learnings, files, docs, and tests to items, and maintain the immutable history those records live in.",intent:"Use this when work must be explained to the next agent, when a durable lesson should outlive the item, or when a history stream needs verification, repair, redaction, compaction, or author attribution.",commands:['pm comments <ID> "<progress or verification evidence>"','pm notes <ID> --add "<rationale that belongs on the item>"','pm learnings <ID> --add "<lesson that should outlive the item>"',"pm append <ID> --body -","pm files <ID> --add path=<path>,scope=project,note=<why>","pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run","pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run","pm close-many --ids <ID>,<ID> --reason <text> --dry-run","pm test-all --status open --limit 10 --progress"],workflows:[{name:"Record While Working, Not After",goal:"Another agent can rebuild the full situation from the item alone.",prompt:"Add a comment for each verified step, a note for each rationale the item body does not carry, and a learning for each lesson that applies beyond this item. Prefer appending over rewriting.",commands:['pm comments <ID> "Evidence: <what changed and what passed>"','pm notes <ID> --add "Decision log: <why this shape>"','pm learnings <ID> --add "<durable lesson>"',"pm learnings <ID> --limit 5"]},{name:"Verify And Repair A History Stream",goal:"Every mutation stays provable and the chain re-anchors after drift.",prompt:"Verify the chain with a strict exit before trusting a stream, preview any repair, and record why the repair was needed in the audit message.",commands:["pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run",'pm history-repair --all --message "<why the chain drifted>"',"pm validate --check-history-drift"]},{name:"Redact, Compact, Or Attribute Without Losing Proof",goal:"Sensitive text, stream length, and unknown authors are handled through audited rewrites.",prompt:"Preview every history rewrite with --dry-run, read the receipt, then apply. Compaction renumbers ordinal versions, so record the checkpoint it created.",commands:["pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Annotation, bulk, and history-and-recovery command families."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"Provenance and content-safety policy every mutation shares."},{path:"docs/AGENT_GUIDE.md",purpose:"Evidence expectations in the agent loop and self-repair remediation."}],related:["workflows","assurance","merge","graph"]},{id:"automation",aliases:["calendar","reminders","meetings","events"],title:"Reminders, Events, and Meetings",summary:"Attach time to items so context and agenda views can surface deadlines, meetings, and reminders when they matter.",intent:"Use this when an item needs a due signal, a scheduled event, or a meeting record that later context reads should surface.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm calendar event <title> --start <when> --parent <ID>","pm calendar meet <title> --start <when> --duration 30min --parent <ID>","pm context --limit 10"],workflows:[{name:"Put A Deadline Where Context Will Find It",goal:"Time-bound work surfaces in the agenda section of context reads.",prompt:"Install calendar, then record the reminder or event under its owning item and confirm it in context. Use explicit min or mo for durations; bare m is ambiguous.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm context --limit 10"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Calendar and context command family."},{path:"packages/pm-calendar/README.md",purpose:"Package commands, duration units, and compatibility aliases."}],related:["workflows","quickstart","extensions"]}],Kw=new Map;for(let e of zw){Kw.set(e.id,e);for(let t of e.aliases)Kw.set(t,e)}function ud(){return zw.map(e=>e.id)}(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]="3a7cf539-2663-5265-90e8-c2aa9926a62a")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be171aef-09e7-5f87-9605-1d47ca665440")}catch{}})();var k5=[...no],S5=[...ro],pd=new Set(Jt.filter(e=>e.hidden).map(e=>e.alias)),Bw=op("full").filter(e=>!e.includes(" ")&&!pd.has(e)),mF=N(fo),uF=N(_o),pF=N(ko),fF=N(Co),Hw=ur("restore",Rt("restore")),Vw=ur("history-attest",Rt("history-attest")),_F=N(Io),hF=N(Wm),gF=N(Ym),yF=N(To),vF=N(Po),wF=N(Ro),bF=N(Oo),kF=N(bo),fd=[...new Set(ke.map(e=>e.canonical_argv[0]))],Ww=[...new Set(ke.flatMap(e=>e.canonical_argv.slice(0,-1).map((t,n)=>e.canonical_argv.slice(0,n+1).join(" "))))],E5=new Set(uo.filter(e=>e.disposition==="package_owned").map(e=>B(e.command))),Yw=ke.filter(e=>e.canonical_argv[0]==="history"),SF=Yw.map(e=>e.canonical_argv[1]).join(" ");var EF=Yw.map(e=>({...e,flags:N(Rt(e.alias))})),AF=N(ho),TF=N(go,!1),CF=N(xo),IF=N(dr),RF=N(mr),OF=N(Fo),xF=N(Lo),PF=N(Eo),NF=N($o),LF=N(No),$F=N(Mo),FF=N(So),MF=N(Ao),DF=N(vo),UF=N(Do),GF=N(yo),_d=`${Tn.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;var jF=N(Uo),qF=`${jF} bash zsh fish`,hd=Ws(ud()),Vs="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate",gd=`${Vs} upgrade`,KF=N(wo),zF=N(cr),BF=N(lr);var HF=N(Rt("close")),VF=N(Rt("close-task")),WF=N(Rt("release")),YF=N(Rt("claim"));var Jw=po.flatMap(e=>[e.short,e.flag,...e.aliases??[]]).filter(e=>!!e).join(" "),yd=[...Wo].join("|"),vd=[...Wo].map(e=>`${e}=*`).join("|"),wd=[...Jw.split(" ").filter(e=>!Wo.has(e)),"-h","-V"].join("|");function Ws(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n)).join(" ")}(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]="2dba61cf-0757-5b46-b86c-e5b7a1c733ae")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1cf1ab58-6aaf-5d9b-9681-0a070119c791")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="818bb54f-06ad-587f-86d6-4eaee9e4966c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c1fb3981-3bae-5f63-861a-ee689a9ffd36")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2c2a4576-a5d8-57c1-84e8-ca8b9019c84e")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e7f8a7ea-3ec2-521b-ad52-45b655208f06")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f42d8a66-b4c0-5281-b5ef-fdc0ea503f58")}catch{}})();var nb=Symbol("pm.active-extension-host-context");function Ge(e){return{fullChangedFields:!0,options:e}}var U=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[nb]=!0,n}run(t,n={}){return rb({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return fh(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Za(await this.list(Qa(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},r={}){return this.runTyped("graph",{subcommand:t,...n,options:r})}append(t,n,r={}){return this.runTyped("append",{id:t,...Ge(Ut(r,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,r,o,i={}){return this.runTyped("config",{scope:t,configAction:n,...r===void 0?{}:{key:r},...o===void 0?{}:{value:o},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,r={}){return this.runTyped("schema",{name:n,options:{...r,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,r,o){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-field",to:n,...o?{fieldTypeScope:o}:{}}})}schemaRemapStatus(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,r={},o,i){return this.runTyped("plan",{fullChangedFields:!0,...n===void 0?{}:{id:n},...o===void 0?{}:{stepRef:o},...i===void 0?{}:{reorderTo:i},options:Ut(r,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,r){return this.plan("update-step",t,r,n)}planCompleteStep(t,n,r={}){return this.plan("complete-step",t,r,n)}planBlockStep(t,n,r){return this.plan("block-step",t,r,n)}planReorderStep(t,n,r,o={}){return this.plan("reorder-step",t,o,n,r)}planRemoveStep(t,n,r={}){return this.plan("remove-step",t,r,n)}planLink(t,n,r){return this.plan("link",t,r,n)}planUnlink(t,n,r){return this.plan("unlink",t,r,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Ge(t))}update(t,n={}){return this.runTyped("update",{id:t,...Ge(n)})}reopen(t,n,r={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:r})}close(t,n,r={}){return this.runTyped("close",{id:t,reason:n,...Ge(r)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Ge(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Ge(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Ge(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Ge(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Ge(n)})}restore(t,n,r={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...r,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Ge(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Ge(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Ge(n)})}closeTask(t,n,r={}){return this.runTyped("close-task",{id:t,reason:n,...Ge(r)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function oM(e={},t={}){return new U(t).context(e)}function iM(e={},t={}){return new U(t).list(e)}function sM(e={},t={}){return new U(t).listAllComplete(e)}function aM(e,t={},n={}){return new U(n).search(e,t)}function cM(e,t={},n={}){return new U(n).get(e,t)}function lM(e={},t={}){return new U(t).next(e)}function dM(e={},t={}){return new U(t).aggregate(e)}function mM(e,t={},n={}){return new U(n).comments(e,t)}function uM(e,t={},n={}){return new U(n).notes(e,t)}function pM(e,t={},n={}){return new U(n).learnings(e,t)}function fM(e,t={},n={}){return new U(n).files(e,t)}function _M(e,t={},n={}){return new U(n).filesDiscover(e,t)}function hM(e,t={},n={}){return new U(n).docs(e,t)}function gM(e,t={},n={}){return new U(n).deps(e,t)}function yM(e,t={},n={},r={}){return new U(r).graph(e,t,n)}function vM(e,t,n={},r={}){return new U(r).append(e,t,n)}function wM(e={},t={}){return new U(t).create(e)}function bM(e,t={},n={}){return new U(n).update(e,t)}function kM(e,t,n={},r={}){return new U(r).reopen(e,t,n)}function SM(e,t,n={},r={}){return new U(r).close(e,t,n)}function EM(e,t={},n={}){return new U(n).claim(e,t)}function AM(e={},t={}){return new U(t).claimNext(e)}function TM(e,t={},n={}){return new U(n).release(e,t)}function CM(e,t={},n={}){return new U(n).copy(e,t)}function IM(e,t={},n={}){return new U(n).delete(e,t)}function RM(e,t,n={},r={}){return new U(r).restore(e,t,n)}function OM(e,t={},n={}){return new U(n).focus(e,t)}var eb=Fu(),xM=new rM;function Ys(){Aa(Jd()),Ta(Xd()),Ca(Qd()),Ia(Zd()),Ra(em()),Oa(tm()),xa(nm())}async function PM(e,t,n,r){return Mu(()=>t===void 0?eb.read(()=>tb(e,n,r)):eb.write(()=>LM(t,()=>tb(e,n,r))))}async function tb(e,t,n){let r=E(t,e.path);if(e.noExtensions)return Ys(),kc({pmRoot:r},()=>n(null));if(!await G(ne(r)))return Ys(),n(null);let o=null,i;try{let s=await A(r),a=await sr({pmRoot:r,settings:s,cwd:t,noExtensions:!1}),c=await ar({...a,loaded:a.loaded});i={loadResult:a,activationResult:c},Aa(c.hooks),Ta(c.commands),Ca(c.parsers),Ia(c.preflight),Ra(c.services),Oa(c.renderers),xa(c.registrations),o={registrations:c.registrations,commands:c.commands,pmRoot:r,packages:a.loaded}}catch(s){Ys(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",s)}try{return await kc({pmRoot:r,packages:o?.packages},()=>n(o))}finally{Ys(),i&&await ha(i.loadResult,i.activationResult).catch(()=>{})}}async function NM(e,t,n,r,o){if(!o)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let i=Gn(e),a=o.registrations.commands.find(u=>Gn(u.action)===i)?.command??o.commands.handlers.find(u=>Gn(u.command)===i)?.command;if(!a)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let c=typeof r.author=="string"&&r.author.trim()?r.author.trim():"pm-extension",m=await Vo({command:Ai(a),args:ge(n.args??t.args),options:nc(t,n),global:r,pm_root:o.pmRoot,sdk:lh(o.pmRoot,U.forActiveExtensionHost({pmRoot:o.pmRoot,author:c}),c,Ai(a))});if(!m.handled){let u=m.warnings.length>0?` (${m.warnings.join(", ")})`:"";throw new l(`Unsupported native pm action: ${e}${u}`,d.USAGE)}return m.result}async function LM(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function $M(e){let t=Pe(e,"action"),n=Gn(t),r=wn(hh,n),o=r?.action??n,i={...e,action:o};return r?.options!==void 0&&(i.options={...r.options,...fa(e.options)}),o==="package"&&(i.options={...fa(i.options),vocabulary:"package"}),{action:o,args:i}}async function rb(e){let t=$M(e),n=ec(t.args),r=Gf(t.action),o=w(t.args,"cwd"),i=o??process.cwd();t.action==="init"&&(n[Tc]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=E(i,n.path));try{return t.action==="history-attest"?await bd(t.action,t.args,n,null):e[nb]===!0||xM.getStore()===!0?await bd(t.action,t.args,n,null):await PM(n,o,i,s=>bd(t.action,t.args,n,s))}finally{r&&md()}}async function bd(e,t,n,r){let o=tc(t,e);$a(e,o),qu(e,o);let i={action:e,args:t,options:o,id:w(t,"id"),force:t.force===!0||o.force===!0,global:n,activeExtensions:r},s=wn(jw,e),a=s?await s(i):await NM(e,t,o,n,r);if(e==="history-attest")return a;{o.resolvedOutputFormat="json";let c=Hu(e,o,a);return await ah(E(process.cwd(),n.path),c),c}}var FM={closeManyOptionsFromFlat:Ti,extensionOptionsFromArgs:nc,globalOptions:ec,mutationListOptions:jf,normalizeActionName:Gn,normalizeCommandPath:Ai,normalizeMcpUpdateOptions:Kf,normalizeMcpOptionsArrays:Uf,optionsWithAuthor:tc,readRequiredString:Pe,readScalarString:Ff,readScalarStringAllowBlank:Mf,readStringArray:ge,updateManyOptionsFromFlat:Ci,withAddNoteOption:Ar,withFilesDiscoveryOptions:Ei,withMutationCompaction:_e};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=FM);(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]="48d03e9b-14a4-545c-8e5d-5f5f2092a113")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="38023567-8a5b-5e25-8d71-5112f74d1894")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3eaa41f7-77a1-5838-8a2f-2ab6a49c21ef")}catch{}})();export{On as AGENT_PROVENANCE_DIMENSIONS,fp as BASELINE_ITEM_FORMAT_VERSION,rk as BUILTIN_AGENT_PROVENANCE_ADAPTERS,pr as BUILTIN_HARNESS_SIGNAL_DESCRIPTORS,no as BUILTIN_ITEM_TYPE_VALUES,oo as CONFIDENCE_TEXT_VALUES,_p as CURRENT_ITEM_FORMAT_VERSION,Vt as DEPENDENCY_KIND_VALUES,d as EXIT_CODE,kn as ISSUE_SEVERITY_VALUES,$d as ITEM_TYPE_VALUES,Sc as PM_CLI_EXPECTED_ERROR_NAME,Kb as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,jb as PM_READ_OUTPUT_DIMENSIONS,qb as PM_READ_OUTPUT_OPTION_FLAGS,Na as PM_READ_OUTPUT_SURFACE_CONTRACTS,l as PmCliError,U as PmClient,bn as RISK_VALUES,gk as SEMANTIC_ATTRIBUTION_LIMITS,ro as STATUS_VALUES,nk as agentSessionEnvironment,dM as aggregate,Vl as analyzeAgentProvenanceDescriptorCoverage,Qb as analyzeSdkCliParameterCompleteness,vM as append,Bb as applyReadOutputDimensions,Yb as applyReadOutputSessionReferences,Jb as attachReadOutputSessionReceipt,Zb as boundAgentEpisodeIdentity,tt as canonicalDocument,EM as claim,AM as claimNext,yp as classifyItemFormatVersion,SM as close,mM as comments,oM as context,CM as copy,wM as create,ch as createPmCliExpectedError,Gb as decodeReadOutputContinuationCursor,IM as deleteItem,gM as deps,dk as detectAgentIdentity,pk as detectHarnessIdentity,mk as diagnoseAgentIdentity,hM as docs,hp as effectiveItemFormatVersion,qw as emptyImportedDocument,Ub as encodeReadOutputContinuationCursor,gP as evaluateSemanticAttributionCoverage,_k as explainSourceTraceability,fM as files,_M as filesDiscover,OM as focus,cM as get,yM as graph,yP as groupHistoryByEpisode,ry as isAlreadyClaimedError,qi as isPmCliExpectedError,Hb as isReadOutputBudgetExceeded,pM as learnings,iM as list,ik as listAgentProvenanceAdapters,sM as listAllComplete,lM as next,ak as normalizeAgentProvenanceAdapterValue,gp as normalizeItemFormatVersion,Ke as normalizeItemId,ee as normalizeStatusInput,uM as notes,S as nowIso,Wb as parseReadOutputSession,Ri as parseSourceLineRange,ei as readAuthorEnvironment,Xb as readOutputSessionRemainingTokens,uc as recordClaimSemanticAttribution,Mi as recordFocusSemanticAttribution,pc as recordReleaseSemanticAttribution,sk as registerAgentProvenanceAdapters,ok as registerHarnessSignalDescriptors,TM as release,kM as reopen,ek as resolveAgentSessionContextFromSignals,fk as resolveAuthorIdentity,Pv as resolveHistoryEpisodeGroupIdentity,zb as resolveReadOutputDimensions,Vb as resolveReadOutputEncoding,La as resolveReadOutputSurface,hk as resolveSemanticLineageIds,RM as restore,rb as runAction,tk as runWithAgentSessionContext,ck as runWithHarnessDetectionSignals,lk as runWithWorkspaceHarnessSignalDescriptors,aM as search,yk as semanticAttributionAffinity,He as serializeItemDocument,hP as summarizeAgentModelProvenance,Wl as summarizeAgentProvenance,bM as update,$a as validateReadOutputOptions,uk as writeAuthorEnvironment};
36
+ `)}catch{}},b$=async(e,t,n)=>{let r=[],o=0;for(let i of e){let s=await Ks(i.id,{run:!1},{...t,path:n});o+=s.tests.length,r.push({item:i,tests:s.tests})}return{itemTests:r,linkedTests:o}},k$=async e=>{let t=F(e.settings.schema),n=x(e.settings,R()),r=s$(e.options.status,t),o=Lw(e.options.limit,"--limit"),i=Lw(e.options.offset,"--offset")??0,a=(await fe(e.pmRoot,e.settings.item_format,n.type_to_folder,void 0,e.settings.schema)).filter(m=>r?m.status===r:!0).sort((m,u)=>m.id.localeCompare(u.id));return{filteredItems:o===void 0?a.slice(i):a.slice(i,i+o),statusFilter:r,limitFilter:o,offsetFilter:i}},S$=e=>{let t=new Map;for(let{tests:n}of e)for(let r of n){let o=Fw(r);if(!t.has(o)){t.set(o,r.timeout_seconds);continue}t.set(o,y$(t.get(o),r.timeout_seconds))}return t},E$=async(e,t)=>{let n=[],r=e.tests.map(u=>{let p=Fw(u),f=t.seenTestKeys.has(p);if(!f){t.seenTestKeys.add(p);let _=t.effectiveTimeoutByKey.get(p);n.push(_===void 0?u:{...u,timeout_seconds:_})}return{test:u,key:p,duplicate:f}}),o=n.length>0?await ld(n,t.defaultTimeoutSeconds,{progress:t.options.progress,sourceRoots:t.sourceRoots,envSet:t.options.envSet,envClear:t.options.envClear,sharedHostSafe:t.options.sharedHostSafe,pmContext:t.options.pmContext,overrideLinkedPmContext:t.options.overrideLinkedPmContext,failOnContextMismatch:t.options.failOnContextMismatch,failOnEmptyTestRun:t.options.failOnEmptyTestRun,requireAssertionsForPm:t.options.requireAssertionsForPm,checkContext:t.options.checkContext,autoPmContext:t.options.autoPmContext,workspaceContext:t.options.workspaceContext,overrideLinkedWorkspaceContext:t.options.overrideLinkedWorkspaceContext,pmRoot:t.pmRoot,allowUntrustedLinkedTests:t.options.allowUntrustedLinkedTests,untrustedLinkedTestsPolicyEnabled:t.settings.testing.allow_untrusted_linked_tests}):[],i=0,s=r.map(({test:u,key:p,duplicate:f})=>{if(!f){let _=o[i];return i+=1,_}return{command:u.command,path:u.path,status:"skipped",error:`Duplicate linked test skipped (key=${p}).`}}),a=v$(s),c=qs(s),m=await C$(e,a,s,t);return{passed:a.passed,failed:a.failed,skipped:a.skipped,trackingWarnings:m,failureCategories:c,result:{ok:a.failed===0&&!(t.options.failOnSkipped===!0&&a.skipped>0),id:e.item.id,status:e.item.status,test_count:e.tests.length,passed:a.passed,failed:a.failed,skipped:a.skipped,run_results:s,failure_categories:c}}},A$=(e,t)=>[e.failed>0,t.failOnSkipped===!0&&e.skipped>0].includes(!0),T$=e=>e?!0:void 0,C$=async(e,t,n,r)=>{if(!r.trackingEnabled)return[];try{let o=A$(t,r.options);await $s({pmRoot:r.pmRoot,settings:r.settings,itemId:e.item.id,author:r.trackingAuthor,message:`Track test-all run summary (${r.trackingRunId})`,entry:{run_id:r.trackingRunId,kind:"test-all",status:o?"failed":"passed",started_at:r.runStartedAt,finished_at:S(),recorded_at:S(),attempt:r.trackingAttempt,resumed_from:r.trackingResumedFrom,passed:t.passed,failed:t.failed,skipped:t.skipped,items:1,linked_tests:e.tests.length,fail_on_skipped_triggered:T$(r.options.failOnSkipped===!0&&t.skipped>0),executions:n.filter(i=>i.command?.trim()).slice(0,32).map(i=>({command:i.command.trim(),requested_pm_context_mode:i.execution_context?.requested_pm_context_mode,pm_context_mode:i.execution_context?.pm_context_mode,workspace_context_mode:i.execution_context?.workspace_context_mode,trust_reason:i.execution_context?.trust.reason}))}})}catch(o){return[`test_result_tracking_failed:${e.item.id}:${c$(o)}`]}return[]},I$=()=>{let e=process.env.PM_BACKGROUND_TEST_RUN_ATTEMPT?.trim(),t=e?Number.parseInt(e,10):Number.NaN;return Number.isFinite(t)&&t>=1?t:void 0},dd=e=>{let t=e?.trim();return t&&t.length>0?t:void 0},R$=e=>({pmRoot:e.pmRoot,settings:e.settings,options:e.options,defaultTimeoutSeconds:e.defaultTimeoutSeconds,sourceRoots:{projectPmRoot:e.pmRoot,globalPmRoot:lt(process.cwd())},seenTestKeys:new Set,effectiveTimeoutByKey:S$(e.itemTests),trackingEnabled:e.settings.testing.record_results_to_items===!0,trackingAuthor:C(e.options.author,e.settings.author_default),trackingRunId:l$(),trackingAttempt:I$(),trackingResumedFrom:dd(process.env.PM_BACKGROUND_TEST_RUN_RESUMED_FROM),runStartedAt:e.runStartedAt}),O$=(e,t,n)=>{let r={results:[],passed:0,failed:0,skipped:0,failureCategories:qs([]),trackingWarnings:[]},o=e.failOnEmptyTestRun===!0&&t===0;return o&&(r.failed+=1,r.failureCategories.empty_run+=1,r.trackingWarnings.push(`empty_linked_test_selection:items=${n.length};linked_tests=0;fail_on_empty_test_run=true`)),{accumulation:r,failOnEmptyTestRunTriggered:o}},x$=async(e,t,n)=>{for(let[r,o]of e.entries()){Bs(t.options,`item ${r+1}/${e.length} start id=${o.item.id} linked_tests=${o.tests.length}`);let i=await E$(o,t);w$(n.failureCategories,i.failureCategories),n.passed+=i.passed,n.failed+=i.failed,n.skipped+=i.skipped,n.trackingWarnings.push(...i.trackingWarnings),n.results.push(i.result),Bs(t.options,`item ${r+1}/${e.length} end id=${o.item.id} status=${i.failed===0?"passed":"failed"} passed=${i.passed} failed=${i.failed} skipped=${i.skipped}`)}},P$=(e,t)=>{if(e.checkContext!==!0)return;let n=t.results.flatMap(o=>o.run_results),r=cd(n);t.trackingWarnings.push(`context_preflight:checked_pm_commands=${r.checked_pm_commands};tracker_read_commands=${r.tracker_read_commands};mismatches=${r.mismatches};auto_remediated=${r.auto_remediated}`)},N$=e=>({ok:e.ok,totals:{items:e.filteredItems.length,linked_tests:e.linkedTests,passed:e.accumulation.passed,failed:e.accumulation.failed,skipped:e.accumulation.skipped,failure_categories:e.accumulation.failureCategories},failed:e.accumulation.failed,passed:e.accumulation.passed,skipped:e.accumulation.skipped,fail_on_skipped_triggered:e.failOnSkippedTriggered?!0:void 0,fail_on_empty_test_run_triggered:e.failOnEmptyTestRunTriggered?!0:void 0,warnings:e.accumulation.trackingWarnings.length>0?e.accumulation.trackingWarnings:void 0,results:e.accumulation.results}),L$=e=>[`selection items=${e.filteredItems.length}`,`linked_tests=${e.linkedTests}`,e.statusFilter===void 0?"":`status=${e.statusFilter}`,e.limitFilter===void 0?"":`limit=${e.limitFilter}`,e.offsetFilter>0?`offset=${e.offsetFilter}`:""].filter(t=>t.length>0).join(" "),$$=async(e,t)=>{let n=E(process.cwd(),t.path);await I(n);let r=await A(n),o=await k$({pmRoot:n,settings:r,options:e}),i=a$(e.timeout),s=S(),a=await b$(o.filteredItems,t,n);return Bs(e,L$({...o,linkedTests:a.linkedTests})),{pmRoot:n,settings:r,filteredItems:o.filteredItems,itemTests:a.itemTests,linkedTests:a.linkedTests,defaultTimeoutSeconds:i,runStartedAt:s}},F$=e=>{let t=e.options.failOnSkipped===!0&&e.accumulation.skipped>0,n=![e.accumulation.failed>0,t,e.failOnEmptyTestRunTriggered].includes(!0);return{failOnSkippedTriggered:t,ok:n}},Mw=async(e,t)=>{let n=await $$(e,t),{accumulation:r,failOnEmptyTestRunTriggered:o}=O$(e,n.linkedTests,n.filteredItems),i=R$({pmRoot:n.pmRoot,settings:n.settings,options:e,itemTests:n.itemTests,defaultTimeoutSeconds:n.defaultTimeoutSeconds,runStartedAt:n.runStartedAt});await x$(n.itemTests,i,r),P$(e,r);let s=F$({options:e,accumulation:r,failOnEmptyTestRunTriggered:o});return Bs(e,`end status=${s.ok?"passed":"failed"} items=${n.filteredItems.length} linked_tests=${n.linkedTests} passed=${r.passed} failed=${r.failed} skipped=${r.skipped}`),N$({ok:s.ok,filteredItems:n.filteredItems,linkedTests:n.linkedTests,accumulation:r,failOnSkippedTriggered:s.failOnSkippedTriggered,failOnEmptyTestRunTriggered:o})};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="419a061f-e181-5b18-9e3a-d22cc5aff416")}catch{}})();function Dw(e,t,n){let r;if(typeof e.lines=="string")r=Ri(e.lines);else if(e.lineRange!==void 0){if(e.lineRange===null||typeof e.lineRange!="object"||Array.isArray(e.lineRange))throw new RangeError("Source line range must be an object with numeric start and end values.");r=Ri(`${String(Reflect.get(e.lineRange,"start"))}:${String(Reflect.get(e.lineRange,"end"))}`)}return{paths:t,scope:e.scope==="project"||e.scope==="global"?e.scope:void 0,limit:n(e.limit,"files lookup limit"),offset:n(e.offset,"files lookup offset"),noTruncate:e.noTruncate===!0,strictRead:e.strictRead===!0,explain:e.explain===!0,lineRange:r,decisionDepth:n(e.decisionDepth,"files lookup decision depth")}}(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]="c6f4c40f-50cf-568f-8a45-860ac4be3c97")}catch{}})();function Pe(e,t){let n=w(e,t);if(!n)throw new l(`Missing required argument: ${t}`,64);return n}function wn(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}(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]="1b86373f-26a3-5893-95dc-e794fcc1afa1")}catch{}})();function M$(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:w(e.args,"name")??w(e.options,"name"),author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:ge(n)}}function D$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,a=wn({list:()=>Sf(t.global),show:()=>Ef(r,t.global),"show-status":()=>Af(r,t.global),"list-fields":()=>If(t.global),"show-field":()=>Rf(r,t.global),"remove-type":()=>vf(r,{author:o,force:i},t.global),"remove-field":()=>Cf(r,{author:o,force:i},t.global),"remove-status":()=>kf(r,{author:o,force:i},t.global),"apply-preset":()=>Of(w(t.args,"typePreset")??w(t.options,"typePreset"),{author:o,force:i},t.global)},n);return a?a():null}function U$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return Tf(n,{type:w(t.args,"fieldType")??w(t.options,"fieldType"),commands:s===void 0?void 0:ge(s),description:w(t.args,"description")??w(t.options,"description"),cliFlag:w(t.args,"cliFlag")??w(t.options,"cliFlag"),alias:i,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:ge(a),author:r,force:o},t.global)}function G$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e,s=t.args.role??t.options.role;return bf(n,{role:s===void 0?void 0:ge(s),alias:i,description:w(t.args,"description")??w(t.options,"description"),order:Fe(t.args.order??t.options.order,"schema add-status order"),author:r,force:o},t.global)}function j$(e){let{ctx:t,name:n,author:r,force:o,aliases:i}=e;return yf(n,{description:w(t.args,"description")??w(t.options,"description"),defaultStatus:w(t.args,"defaultStatus")??w(t.args,"default_status")??w(t.options,"defaultStatus")??w(t.options,"default_status"),folder:w(t.args,"folder")??w(t.options,"folder"),alias:i,author:r,force:o},t.global)}function q$(e){let{ctx:t,subcommand:n,name:r,author:o,force:i}=e,s=w(t.args,"to")??Pe(t.options,"to"),a=w(t.args,"migrationId")??w(t.args,"migration_id")??w(t.options,"migrationId")??w(t.options,"migration_id"),c=w(t.args,"fieldTypeScope")??w(t.options,"fieldTypeScope")??w(t.args,"type")??w(t.options,"type"),m=n==="rename-type"?{kind:"rename-type",from:r??"",to:s}:n==="rename-field"?{kind:"rename-field",from:r??"",to:s,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:r??"",to:s};return hf(m,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:o,force:i},t.global)}function Uw(e){let t=M$(e);Fp(t.subcommand,e.args.dryRun===!0||e.options.dryRun===!0);let n=Tn.find(o=>o===t.subcommand);if(n)return _f(n,t.name,{definition:e.args.definition??e.options.definition,policy:w(e.args,"policy")??w(e.options,"policy"),message:w(e.args,"message")??w(e.options,"message"),author:t.author,dryRun:e.args.dryRun===!0||e.options.dryRun===!0},e.global);let r=D$(t);if(r!==null)return r;if(["rename-type","rename-field","remap-status"].includes(t.subcommand))return q$(t);if(t.subcommand==="add-field")return U$(t);if(t.subcommand==="add-status")return G$(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?xf({minCount:Fe(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):j$(t);throw Te({command_path:"schema",token:t.subcommand,allowed:gf,exit_code:64})}(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]="d5136ee1-7446-5fbf-b782-bc58b5323c64")}catch{}})();function Hs(e){return w(e.args,"target")??w(e.options,"target")}function we(e,t=e.options){return e.id??Pe(t,"id")}async function K$(e){let t=Rn("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Cc(await ht(w(e.args,"status")??w(t,"status"),t,e.global),t)}async function z$(e){let t=Pe(e.args,"query"),n=Rn("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),Cc(await Or(t,n,e.global),n)}async function B$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options);return Se(await jt(r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function H$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options),o={...r,...r.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...r.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return Se(await Bc(we(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function V$(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options);return Se(await it(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function W$(e){let t=zi(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),bh(we(e),t,e.global)}function Gw(e,t){return Wf(Dw(e.options,t,Fe),e.global)}function Y$(e){let t=ge(e.options.lookupPath);if(t&&t.length>0)return Gw(e,t);let n=we(e);return e.options.discover===!0?oc(n,Ei(e.options),e.global):Vf(n,Ar(e.options),e.global)}function J$(e){return Zv({subcommand:w(e.args,"subcommand")??w(e.options,"subcommand"),limit:Df(e.args,e.options)},e.global)}function X$(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Tr(e.global,t)}function Q$(e){let t=w(e.args,"configAction")??w(e.options,"configAction")??w(e.options,"action");if(t===void 0)throw new l("Missing required argument: configAction",64);let n=w(e.args,"value")??w(e.options,"value"),r=w(e.options,"policy")!==void 0&&n!==void 0?{...e.options,value:n}:e.options;return Kh(w(e.args,"scope")??w(e.options,"scope")??"project",t,w(e.args,"key")??w(e.options,"key"),r,e.global,w(e.options,"policy")===void 0?n:void 0)}function Z$(e){let t=e.options;return x_(O_(t),e.global)}function eF(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new l(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new l(`${t} must be a finite integer.`,64);let r=Number.parseInt(n,10);if(!Number.isInteger(r))throw new l(`${t} must be a finite integer.`,64);return r}}async function tF(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=e.options,{changedFields:r,idOnly:o}=_e(e.args,e.options),i=await by({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:nF(e),reorderTo:eF(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global});return t!=="show"&&$f(e.args)&&(i.mutation_receipt=As(i,void 0)),t==="show"?i:Se(i,{changedFields:r,idOnly:o,compactEnvelope:r==="compact"&&!o})}function nF(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function rF(e){let t=w(e.args,"subcommand")??Pe(e.options,"subcommand"),n=t.trim().toLowerCase(),r=w(e.args,"name")??w(e.options,"name"),i=wn({list:()=>Fy(),show:()=>My(r),lint:()=>Dy(r),apply:()=>Uy(r,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:w(e.args,"author")??w(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!i)throw Te({command_path:"profile",token:t,allowed:$y,exit_code:64});return i()}async function oF(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options);return Se(await ng(we(e,r),r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function iF(e){let{changedFields:t,runnerOptions:n}=_e(e.args,e.options);return Se(await Ty(Ci(n),e.global),{changedFields:t})}async function sF(e){let{changedFields:t,runnerOptions:n}=_e(e.args,e.options),r=w(e.args,"reason"),o=r!==void 0&&n.reason===void 0?{...n,reason:r}:{...n};return e.force&&o.force===void 0&&(o.force=!0),Se(await ug(Ti(o),e.global),{changedFields:t})}async function aF(e){let{changedFields:t,idOnly:n,runnerOptions:r}=_e(e.args,e.options),o=w(r,"target")??Pe(e.args,"target");return Se(await sn(we(e,r),o,r,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function cF(e){let t={...e.args,...e.options};return Yf(Pe(t,"subcommand"),w(t,"id")??e.id,w(t,"target"),qf(t),e.global)}function lF(e){return zf(E(process.cwd(),e.global.path),{...e.args,...e.options})}var jw={init:e=>Nr(w(e.args,"prefix"),e.global,e.options),context:e=>fc(Rn("context",e.options),e.global),next:e=>Rr(Rn("next",e.options),e.global),eval:vv,events:wv,merge:bv,workspace:kv,meet:xs,event:xs,remind:xs,list:K$,get:e=>{let t=we(e);return hc(t,e.global,Rn("get",e.options,[t]))},search:z$,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:ge(e.options.status);return rc(e.global,{exhaustive:e.options.exhaustive===!0,...t.length===0?{}:{status:t},since:w(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:Fe(e.options.limit,"limit")})},create:B$,copy:H$,focus:e=>ol(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:V$,"item-reopen":cy,restore:aF,claim:iy,release:ay,"start-task":e=>_n(e,"start_task"),"pause-task":e=>_n(e,"pause_task"),"close-task":e=>_n(e,"close_task"),close:sy,comments:W$,notes:e=>Cy(we(e),zi(e.options),e.global),learnings:e=>tg(we(e),zi(e.options),e.global),files:Y$,docs:e=>Hf(we(e),Ar(e.options),e.global),test:e=>Ks(we(e),e.options,e.global),"test-all":e=>Mw(e.options,e.global),telemetry:J$,validate:e=>$i(e.options,e.global,{runUpdate:(t,n,r)=>it(t,n,r)}),health:X$,assurance:e=>k_(e.args,e.options,e.global),contracts:e=>wc(e.options,e.global),config:Q$,activity:Z$,aggregate:e=>_c(e.options,e.global),extension:e=>Un(Hs(e),e.options,e.global),package:e=>Un(Hs(e),e.options,e.global),install:e=>Un(Hs(e),{...e.options,install:!0},e.global),upgrade:e=>E_(Hs(e),e.options,e.global),delete:e=>rl(we(e),e.options,e.global),deps:e=>Bf(we(e),e.options,e.global),graph:cF,"files-discover":e=>oc(we(e),e.options,e.global),"files-lookup":e=>Gw(e,ge(e.options.paths)),history:e=>P_(we(e),e.options,e.global),"history-redact":e=>eg(we(e),e.options,e.global),"history-repair":Yh,"history-compact":Jh,"history-attest":e=>A_(e.options,e.global),"history-author-acknowledge":lF,plan:tF,schema:Uw,profile:rF,stats:e=>Yl(e.global,Sv(e.options)),append:oF,"update-many":iF,"close-many":sF,gc:e=>S_(e.global,e.options)};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e8137f8b-745a-5ef5-9e7e-14b7d032c1ea")}catch{}})();var dF=new Map;function md(){dF.clear()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c84b11c-502f-5c33-a757-5757402357b4")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b841f903-6276-5067-842f-6a6bff114cec")}catch{}})();(function(){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]="4277a72c-f012-55d2-9e18-c9a836d829d6")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aba4af26-98d3-53aa-8b23-1be7c90a38d1")}catch{}})();function qw(){return{metadata:{},body:""}}(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]="5b106ed0-ef19-58a4-a7d0-bd0988482f58")}catch{}})();var zw=[{id:"capabilities",aliases:["capability-map","families","routing"],title:"Generated Capability Routing",summary:"Route work through command families generated from the canonical agent capability contract.",intent:"Use this as the drift-free entrypoint when selecting a CLI, MCP, completion, documentation, or extension command surface.",commands:ip().flatMap(({commands:e})=>e.map(t=>`pm ${t}`)),workflows:[],docs:[{path:"docs/generated/AGENT_CAPABILITY_ROUTING.md",purpose:"Generated command-to-family routing table."},{path:"docs/generated/AGENT_COMMAND_SURFACE.md",purpose:"Generated visibility-tier and family table."}],related:["commands","workflows","extensions"]},{id:"quickstart",aliases:["start","getting-started","bootstrap"],title:"Quickstart",summary:"Initialize a tracker and run the shortest safe plan -> execute -> close loop.",intent:"Use this when a human or agent needs to start productive work quickly with minimal context load.",commands:["pm workspace init","pm workspace config --help","pm workspace schema --help","pm workspace profile --help","pm context --limit 10","pm list --status open --limit 20",'pm create --create-mode progressive --title "..." --description "..." --type Task',"pm claim <ID>","pm update <ID> --status in_progress",'pm close <ID> "<reason with evidence>" --validate-close warn'],workflows:[{name:"Start Session Safely",goal:"Bootstrap without mutating unrelated state.",prompt:"You are bootstrapping pm work. Use a token-efficient context snapshot first, then select one open item, claim it, and only then mutate.",commands:["pm context --limit 10","pm list --status open --limit 20","pm claim <ID>"]}],docs:[{path:"README.md",purpose:"High-level project and install entrypoint."},{path:"docs/QUICKSTART.md",purpose:"Short setup and first-command walkthrough."},{path:"docs/COMMANDS.md",purpose:"Task-oriented command recipes."}],related:["commands","workflows","release"]},{id:"commands",aliases:["cli","operations","reference"],title:"CLI Command Routing",summary:"Find the right command family quickly and use command-scoped help/contracts output.",intent:"Use this when selecting command paths, flags, and output formats for implementation or automation.",commands:["pm --help","pm <command> --help","pm <command> --help --explain","pm contracts --command <command> --flags-only","pm contracts --command <command> --availability-only --runtime-only","pm completion <bash|zsh|fish>"],workflows:[{name:"Flag Discovery",goal:"Resolve command flags deterministically before mutations.",prompt:"You are preparing to run a command. Use help and contracts surfaces to verify required/optional flags before execution.",commands:["pm <command> --help --explain","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Command grouping and examples."},{path:"docs/CONFIGURATION.md",purpose:"Project/global settings and policy controls."},{path:"docs/TESTING.md",purpose:"Linked-test orchestration and safety guidance."}],related:["quickstart","workflows","sdk","extensions"]},{id:"workflows",aliases:["developer","maintainer","agent"],title:"Developer and Agent Workflows",summary:"Apply canonical claim -> execute -> verify -> close workflows with append-only evidence.",intent:"Use this for day-to-day coding-agent execution loops and handoff-safe updates.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add ...","pm test <ID> --add ...",'pm comments <ID> "..."',"pm validate --check-resolution --check-history-drift","pm release <ID>"],workflows:[{name:"Execution Loop",goal:"Keep code, tests, and tracker evidence synchronized.",prompt:"You are implementing a scoped change. Claim first, link files/tests/docs as you go, append evidence comments, and close only after validation.",commands:["pm claim <ID>","pm update <ID> --status in_progress","pm files <ID> --add path=<file>,scope=project","pm test <ID> --run --progress",'pm close <ID> "<evidence>" --validate-close warn']}],docs:[{path:"AGENTS.md",purpose:"Repository operating rules and required workflow."},{path:"docs/AGENT_GUIDE.md",purpose:"Agent-oriented usage and context strategy."},{path:"docs/TESTING.md",purpose:"Sandbox-safe test execution rules."}],related:["quickstart","commands","skills"]},{id:"sdk",aliases:["api","typescript-sdk"],title:"SDK and Integrations",summary:"Use the published SDK surface for extension authoring and contract-safe integrations.",intent:"Use this when building or reviewing programmatic integrations against @unbrained/pm-cli/sdk.",commands:["pm contracts --schema-only","pm contracts --command extension --flags-only","pm contracts --runtime-only --availability-only"],workflows:[{name:"Integration Contract Check",goal:"Confirm action schemas and runtime availability before coding.",prompt:"You are wiring an integration. Capture schema + runtime availability first, then map your adapter payload fields to contract keys.",commands:["pm contracts --schema-only","pm contracts --availability-only --runtime-only","pm contracts --command <command> --flags-only"]}],docs:[{path:"docs/SDK.md",purpose:"Public SDK exports and extension authoring references."},{path:"docs/ARCHITECTURE.md",purpose:"Core runtime composition and extension load flow."}],related:["extensions","commands"]},{id:"extensions",aliases:["plugins","extension-authoring","packages","package-authoring"],title:"Packages and Extensions",summary:"Install, author, and diagnose packages/extensions with deterministic lifecycle controls.",intent:"Use this for package management, extension capability registration, and runtime diagnostics.",commands:["pm package install <target> --project","pm package upgrade --dry-run","pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package activate <target> --project","pm package deactivate <target> --project"],workflows:[{name:"Lifecycle Triage",goal:"Diagnose extension state before forceful lifecycle actions.",prompt:"You are debugging package behavior. Inspect managed state first, then run doctor diagnostics, then apply install/adopt/activate actions.",commands:["pm package explore --project","pm package manage --detail summary","pm package doctor --detail deep","pm package upgrade --packages-only --dry-run"]}],docs:[{path:"docs/EXTENSIONS.md",purpose:"Capability model and lifecycle command usage."},{path:"docs/examples/starter-extension/README.md",purpose:"Starter extension scaffold and local development path."},{path:"docs/SDK.md",purpose:"SDK contracts used by extension implementations."}],related:["sdk","commands","skills"]},{id:"skills",aliases:["agent-skills","agentskills"],title:"Agent Skills",summary:"Skill bundles for developer, user, extensions, and sdk workflows aligned to the current CLI.",intent:"Use this when an agent needs reproducible prompts/workflows with strict compatibility metadata.",commands:["pm guide skills --depth deep","pm contracts --command guide --flags-only","pm validate --check-command-references"],workflows:[{name:"Skill Selection",goal:"Pick the narrowest compatible skill first to minimize context usage.",prompt:"Select a pm skill based on the task intent, then execute only the workflow section needed for the current change.",commands:["pm guide skills","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent-first usage and context model."},{path:"docs/README.md",purpose:"Documentation routing with progressive disclosure."},{path:".agents/skills/README.md",purpose:"Agent skills index and routing overview."},{path:".agents/skills/pm-developer/SKILL.md",purpose:"Developer-oriented pm skill workflow."},{path:".agents/skills/pm-user/SKILL.md",purpose:"User/operator pm skill workflow."},{path:".agents/skills/pm-extensions/SKILL.md",purpose:"Extension-focused pm skill workflow."},{path:".agents/skills/pm-sdk/SKILL.md",purpose:"SDK integration pm skill workflow."}],related:["workflows","harnesses","commands"]},{id:"harnesses",aliases:["compatibility","agent-compatibility"],title:"Agent Harness Compatibility",summary:"Cross-harness compatibility guidance for docs routing.",intent:"Use this when adapting pm docs and SDK contracts for an external automation harness.",commands:["pm guide skills","pm guide commands","pm contracts --runtime-only --availability-only"],workflows:[{name:"Harness Mapping",goal:"Route each harness to the same canonical skill/docs sources.",prompt:"Map harness-specific entrypoints to the same pm guide topics and .agents/skills workflows without adding runtime harness-specific code.",commands:["pm guide harnesses --depth standard","pm guide skills --depth deep"]}],docs:[{path:"docs/AGENT_GUIDE.md",purpose:"Agent context and output-mode conventions."},{path:"docs/README.md",purpose:"Single-source documentation routing entrypoint."},{path:".agents/skills/HARNESS_COMPATIBILITY.md",purpose:"Harness compatibility matrix and usage notes."}],related:["skills","workflows"]},{id:"release",aliases:["gates","ship","release-readiness"],title:"Release and Staleness Gates",summary:"Run release gates and docs/skills freshness checks before publishing.",intent:"Use this when validating release readiness and preventing docs/skills drift.",commands:["pnpm build","pnpm test:coverage","pnpm quality:static","node scripts/release/run-gates.mjs --telemetry-mode best-effort","pnpm security:scan"],workflows:[{name:"Pre-Release Gate Sweep",goal:"Ensure code, docs, and skills are all green before publish.",prompt:"Run release gates in deterministic order and treat docs/skills freshness failures as release blockers.",commands:["pnpm build","pnpm test:coverage","node scripts/release/run-gates.mjs --telemetry-mode best-effort"]}],docs:[{path:"docs/RELEASING.md",purpose:"Release flow and safety checks."},{path:"CHANGELOG.md",purpose:"Versioned release history and unreleased notes."},{path:"scripts/release/run-gates.mjs",purpose:"Source of truth for release gate ordering."}],related:["commands","skills","workflows"]},{id:"tokens",aliases:["output","budget","context-cost","projections"],title:"Read Output and Token Budgets",summary:"Bound what a read costs before it is emitted, and resume the part a budget withheld.",intent:"Use this when an agent must keep context small: every read declares a token ceiling, degrades deterministically, and reports what it omitted.",commands:["pm contracts --summary --json","pm list --status open --output-limit 20","pm get <ID> --output-include id,title,status,dependencies","pm context --limit 10 --token-accounting","pm notes <ID> --output-cursor <cursor>","pm list --status closed --output-budget unbounded"],workflows:[{name:"Bound A Read Before Emitting It",goal:"Never pay for rows the task does not need.",prompt:"Choose the narrowest projection first, then a row limit, then a token budget. Read the omission receipt before concluding the result is complete.",commands:["pm contracts --command list --flags-only --json","pm list --status open --output-limit 20 --output-format toon","pm list --status open --token-accounting"]},{name:"Recover A Truncated Read",goal:"Continue a bounded read instead of re-running it unbounded.",prompt:"When output_budget_truncation appears, prefer the declared continuation cursor. Only widen the budget when the response declares no cursor.",commands:["pm notes <ID> --output-cursor <cursor>","pm get <ID> --output-budget 20000"]}],docs:[{path:"docs/READ_OUTPUT_CONTRACTS.md",purpose:"Budget, truncation, continuation, and omission receipts."},{path:"docs/OUTPUT_PROJECTION_CONTRACTS.md",purpose:"Field and section projection grammar for every read."},{path:"docs/OUTPUT_TOKEN_ACCOUNTING.md",purpose:"Per-section token cost receipts."},{path:"docs/ITEM_READ_PROJECTIONS.md",purpose:"Item-level projection defaults and restore hints."}],related:["commands","workflows","quickstart"]},{id:"graph",aliases:["relationships","deps","dependencies","analytics"],title:"Relationship Graph and Planning Analytics",summary:"Type the relationships between items, then read the project as a graph rather than as a list.",intent:"Use this when the question is about lineage, ordering, blast radius, bottlenecks, or which work reaches a declared outcome.",commands:["pm deps <ID>",'pm update <ID> --dep "id=<other>,kind=implements"',"pm graph analyze","pm graph impact <ID> --direction downstream","pm graph paths <ID> <ID>","pm graph audit"],workflows:[{name:"Place New Work In The Ladder",goal:"Every item resolves to an outcome through a typed, explainable path.",prompt:"Set parent lineage first, then add typed edges that cite durable evidence. Never add an edge to satisfy a count.",commands:['pm search "<topic>" --limit 10','pm update <ID> --dep "id=<parent-goal>,kind=implements"',"pm graph ancestors <ID>"]},{name:"Assess Blast Radius Before Changing Something",goal:"Know what derives from an item before touching it.",prompt:"Walk the directed graph downstream from the item, then check whether any bottleneck node sits on the path.",commands:["pm graph impact <ID> --direction downstream","pm graph dominators <ID>","pm graph articulation"]}],docs:[{path:"docs/RELATIONSHIP_GRAPH.md",purpose:"Graph model, traversal verbs, and analytics surface."},{path:"docs/DEPENDENCY_KIND_CONTRACT.md",purpose:"Every typed edge kind, its direction, and its semantics."}],related:["commands","workflows","assurance"]},{id:"assurance",aliases:["gates","invariants","measurements","quality"],title:"Declared Invariants and Gates",summary:"Express a project's own quality rules as tracked data the SDK evaluates, instead of as scripts.",intent:"Use this when a rule must hold over the record itself \u2014 a floor, a ceiling, or a monotone property \u2014 and must fail closed in CI.",commands:["pm assurance list","pm assurance run <gate-id> --trigger ci --dry-run","pm validate --check-resolution --check-history-drift","pm health --summary"],workflows:[{name:"Add An Invariant Rather Than A Script",goal:"A new enforcement gap becomes declared data, not a new bespoke gate script.",prompt:"Define the measurement, bind an assertion with an explicit bound and polarity, prove a negative control, then attach it to a trigger.",commands:["pm assurance list --json","pm assurance run <gate-id> --trigger ci --dry-run --json"]},{name:"Read A Verdict Before Believing It",goal:"Know which population a passing assertion speaks for.",prompt:"Read population_size and scope on every assertion. A gate that cannot fail for the reason it exists is not evidence.",commands:["pm assurance run <gate-id> --trigger ci --dry-run --json --output-budget unbounded"]}],docs:[{path:"docs/ASSURANCE.md",purpose:"Measurement, assertion, gate, and trigger vocabulary."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"What every mutation must record to remain provable."}],related:["release","graph","workflows"]},{id:"merge",aliases:["branches","concurrency","multi-agent","fleet"],title:"Branching, Merging, and Concurrent Agents",summary:"Keep tracker data and history conflict-free while many agents work on separate branches.",intent:"Use this when more than one agent or worktree mutates the same tracker and the results must merge without hand resolution.",commands:["pm merge install","pm merge report","pm merge reconcile --dry-run","pm claim <ID>","pm release <ID>","pm validate --check-history-drift","pm health --check-only"],workflows:[{name:"Prepare A Clone For Field-Aware Merges",goal:"The committed merge fence needs clone-local driver configuration once.",prompt:"Run the merge installer in every fresh clone or worktree before the first branch merge of tracker data.",commands:["pm merge install","pm health --check-only"]},{name:"Settle A Merge Before Trusting Health",goal:"A lossless merge still leaves pending receipts that strict health reports until they are reconciled.",prompt:"After any branch merge that touched tracker data, read the merge report, preview the reconciliation, then apply it; only then treat a health verdict as a statement about the data.",commands:["pm merge report","pm merge reconcile --dry-run",'pm merge reconcile --message "Post-merge history reconciliation"',"pm health --check-only"]},{name:"Hand Work Between Agents Safely",goal:"Ownership and evidence survive the handoff.",prompt:"Claim before substantial edits, record evidence as comments, and release the claim when pausing, handing off, closing, or canceling.",commands:["pm claim <ID>",'pm comments <ID> "Handoff: <state and next step>"',"pm release <ID>"]}],docs:[{path:"docs/MERGE_SAFETY.md",purpose:"Merge driver, field-aware resolution, and clone setup."},{path:"docs/SDK_CONTEXT_COORDINATION.md",purpose:"Coordination primitives for concurrent agents."}],related:["workflows","assurance","commands"]},{id:"evidence",aliases:["record","annotations","learnings","history-maintenance"],title:"Evidence, Durable Knowledge, and Record Maintenance",summary:"Append comments, notes, learnings, files, docs, and tests to items, and maintain the immutable history those records live in.",intent:"Use this when work must be explained to the next agent, when a durable lesson should outlive the item, or when a history stream needs verification, repair, redaction, compaction, or author attribution.",commands:['pm comments <ID> "<progress or verification evidence>"','pm notes <ID> --add "<rationale that belongs on the item>"','pm learnings <ID> --add "<lesson that should outlive the item>"',"pm append <ID> --body -","pm files <ID> --add path=<path>,scope=project,note=<why>","pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run","pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run","pm close-many --ids <ID>,<ID> --reason <text> --dry-run","pm test-all --status open --limit 10 --progress"],workflows:[{name:"Record While Working, Not After",goal:"Another agent can rebuild the full situation from the item alone.",prompt:"Add a comment for each verified step, a note for each rationale the item body does not carry, and a learning for each lesson that applies beyond this item. Prefer appending over rewriting.",commands:['pm comments <ID> "Evidence: <what changed and what passed>"','pm notes <ID> --add "Decision log: <why this shape>"','pm learnings <ID> --add "<durable lesson>"',"pm learnings <ID> --limit 5"]},{name:"Verify And Repair A History Stream",goal:"Every mutation stays provable and the chain re-anchors after drift.",prompt:"Verify the chain with a strict exit before trusting a stream, preview any repair, and record why the repair was needed in the audit message.",commands:["pm history <ID> --verify --strict-exit","pm history-repair --all --dry-run",'pm history-repair --all --message "<why the chain drifted>"',"pm validate --check-history-drift"]},{name:"Redact, Compact, Or Attribute Without Losing Proof",goal:"Sensitive text, stream length, and unknown authors are handled through audited rewrites.",prompt:"Preview every history rewrite with --dry-run, read the receipt, then apply. Compaction renumbers ordinal versions, so record the checkpoint it created.",commands:["pm history-redact <ID> --literal <secret> --dry-run","pm history-compact <ID> --dry-run","pm history-author-acknowledge --all-actionable --dry-run"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Annotation, bulk, and history-and-recovery command families."},{path:"docs/MUTATION_INTEGRITY.md",purpose:"Provenance and content-safety policy every mutation shares."},{path:"docs/AGENT_GUIDE.md",purpose:"Evidence expectations in the agent loop and self-repair remediation."}],related:["workflows","assurance","merge","graph"]},{id:"automation",aliases:["calendar","reminders","meetings","events"],title:"Reminders, Events, and Meetings",summary:"Attach time to items so context and agenda views can surface deadlines, meetings, and reminders when they matter.",intent:"Use this when an item needs a due signal, a scheduled event, or a meeting record that later context reads should surface.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm calendar event <title> --start <when> --parent <ID>","pm calendar meet <title> --start <when> --duration 30min --parent <ID>","pm context --limit 10"],workflows:[{name:"Put A Deadline Where Context Will Find It",goal:"Time-bound work surfaces in the agenda section of context reads.",prompt:"Install calendar, then record the reminder or event under its owning item and confirm it in context. Use explicit min or mo for durations; bare m is ambiguous.",commands:["pm package install calendar --project","pm calendar remind <title> --at <when> --parent <ID>","pm context --limit 10"]}],docs:[{path:"docs/COMMANDS.md",purpose:"Calendar and context command family."},{path:"packages/pm-calendar/README.md",purpose:"Package commands, duration units, and compatibility aliases."}],related:["workflows","quickstart","extensions"]}],Kw=new Map;for(let e of zw){Kw.set(e.id,e);for(let t of e.aliases)Kw.set(t,e)}function ud(){return zw.map(e=>e.id)}(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]="3a7cf539-2663-5265-90e8-c2aa9926a62a")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="be171aef-09e7-5f87-9605-1d47ca665440")}catch{}})();var k5=[...no],S5=[...ro],pd=new Set(Jt.filter(e=>e.hidden).map(e=>e.alias)),Bw=op("full").filter(e=>!e.includes(" ")&&!pd.has(e)),mF=N(fo),uF=N(_o),pF=N(ko),fF=N(Co),Hw=ur("restore",Rt("restore")),Vw=ur("history-attest",Rt("history-attest")),_F=N(Io),hF=N(Wm),gF=N(Ym),yF=N(To),vF=N(Po),wF=N(Ro),bF=N(Oo),kF=N(bo),fd=[...new Set(ke.map(e=>e.canonical_argv[0]))],Ww=[...new Set(ke.flatMap(e=>e.canonical_argv.slice(0,-1).map((t,n)=>e.canonical_argv.slice(0,n+1).join(" "))))],E5=new Set(uo.filter(e=>e.disposition==="package_owned").map(e=>B(e.command))),Yw=ke.filter(e=>e.canonical_argv[0]==="history"),SF=Yw.map(e=>e.canonical_argv[1]).join(" ");var EF=Yw.map(e=>({...e,flags:N(Rt(e.alias))})),AF=N(ho),TF=N(go,!1),CF=N(xo),IF=N(dr),RF=N(mr),OF=N(Fo),xF=N(Lo),PF=N(Eo),NF=N($o),LF=N(No),$F=N(Mo),FF=N(So),MF=N(Ao),DF=N(vo),UF=N(Do),GF=N(yo),_d=`${Tn.join(" ")} list show show-status add-type remove-type add-status remove-status add-field remove-field list-fields show-field apply-preset rename-type rename-field remap-status`;var jF=N(Uo),qF=`${jF} bash zsh fish`,hd=Ws(ud()),Vs="init scaffold install uninstall explore manage describe reload doctor catalog adopt adopt-all activate deactivate migrate",gd=`${Vs} upgrade`,KF=N(wo),zF=N(cr),BF=N(lr);var HF=N(Rt("close")),VF=N(Rt("close-task")),WF=N(Rt("release")),YF=N(Rt("claim"));var Jw=po.flatMap(e=>[e.short,e.flag,...e.aliases??[]]).filter(e=>!!e).join(" "),yd=[...Wo].join("|"),vd=[...Wo].map(e=>`${e}=*`).join("|"),wd=[...Jw.split(" ").filter(e=>!Wo.has(e)),"-h","-V"].join("|");function Ws(e){return[...new Set(e.map(t=>t.trim()).filter(t=>t.length>0))].sort((t,n)=>t.localeCompare(n)).join(" ")}(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]="2dba61cf-0757-5b46-b86c-e5b7a1c733ae")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1cf1ab58-6aaf-5d9b-9681-0a070119c791")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="818bb54f-06ad-587f-86d6-4eaee9e4966c")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c1fb3981-3bae-5f63-861a-ee689a9ffd36")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2c2a4576-a5d8-57c1-84e8-ca8b9019c84e")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e7f8a7ea-3ec2-521b-ad52-45b655208f06")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ff0e0921-43ca-5278-ab61-21bef91ce4aa")}catch{}})();var nb=Symbol("pm.active-extension-host-context");function Ge(e){return{fullChangedFields:!0,options:e}}var U=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[nb]=!0,n}run(t,n={}){return rb({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return fh(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Za(await this.list(Qa(t)))}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},r={}){return this.runTyped("graph",{subcommand:t,...n,options:r})}append(t,n,r={}){return this.runTyped("append",{id:t,...Ge(Ut(r,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,r,o,i={}){return this.runTyped("config",{scope:t,configAction:n,...r===void 0?{}:{key:r},...o===void 0?{}:{value:o},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,r={}){return this.runTyped("schema",{name:n,options:{...r,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,r,o){return this.runTyped("schema",{name:t,options:{...r,subcommand:"rename-field",to:n,...o?{fieldTypeScope:o}:{}}})}schemaRemapStatus(t,n,r){return this.runTyped("schema",{name:t,options:{...r,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,r={},o,i){return this.runTyped("plan",{fullChangedFields:!0,...n===void 0?{}:{id:n},...o===void 0?{}:{stepRef:o},...i===void 0?{}:{reorderTo:i},options:Ut(r,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,r){return this.plan("update-step",t,r,n)}planCompleteStep(t,n,r={}){return this.plan("complete-step",t,r,n)}planBlockStep(t,n,r){return this.plan("block-step",t,r,n)}planReorderStep(t,n,r,o={}){return this.plan("reorder-step",t,o,n,r)}planRemoveStep(t,n,r={}){return this.plan("remove-step",t,r,n)}planLink(t,n,r){return this.plan("link",t,r,n)}planUnlink(t,n,r){return this.plan("unlink",t,r,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Ge(t))}update(t,n={}){return this.runTyped("update",{id:t,...Ge(n)})}reopen(t,n,r={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:r})}close(t,n,r={}){return this.runTyped("close",{id:t,reason:n,...Ge(r)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Ge(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Ge(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Ge(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Ge(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Ge(n)})}restore(t,n,r={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...r,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Ge(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Ge(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Ge(n)})}closeTask(t,n,r={}){return this.runTyped("close-task",{id:t,reason:n,...Ge(r)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function oM(e={},t={}){return new U(t).context(e)}function iM(e={},t={}){return new U(t).list(e)}function sM(e={},t={}){return new U(t).listAllComplete(e)}function aM(e,t={},n={}){return new U(n).search(e,t)}function cM(e,t={},n={}){return new U(n).get(e,t)}function lM(e={},t={}){return new U(t).next(e)}function dM(e={},t={}){return new U(t).aggregate(e)}function mM(e,t={},n={}){return new U(n).comments(e,t)}function uM(e,t={},n={}){return new U(n).notes(e,t)}function pM(e,t={},n={}){return new U(n).learnings(e,t)}function fM(e,t={},n={}){return new U(n).files(e,t)}function _M(e,t={},n={}){return new U(n).filesDiscover(e,t)}function hM(e,t={},n={}){return new U(n).docs(e,t)}function gM(e,t={},n={}){return new U(n).deps(e,t)}function yM(e,t={},n={},r={}){return new U(r).graph(e,t,n)}function vM(e,t,n={},r={}){return new U(r).append(e,t,n)}function wM(e={},t={}){return new U(t).create(e)}function bM(e,t={},n={}){return new U(n).update(e,t)}function kM(e,t,n={},r={}){return new U(r).reopen(e,t,n)}function SM(e,t,n={},r={}){return new U(r).close(e,t,n)}function EM(e,t={},n={}){return new U(n).claim(e,t)}function AM(e={},t={}){return new U(t).claimNext(e)}function TM(e,t={},n={}){return new U(n).release(e,t)}function CM(e,t={},n={}){return new U(n).copy(e,t)}function IM(e,t={},n={}){return new U(n).delete(e,t)}function RM(e,t,n={},r={}){return new U(r).restore(e,t,n)}function OM(e,t={},n={}){return new U(n).focus(e,t)}var eb=Fu(),xM=new rM;function Ys(){Aa(Jd()),Ta(Xd()),Ca(Qd()),Ia(Zd()),Ra(em()),Oa(tm()),xa(nm())}async function PM(e,t,n,r){return Mu(()=>t===void 0?eb.read(()=>tb(e,n,r)):eb.write(()=>LM(t,()=>tb(e,n,r))))}async function tb(e,t,n){let r=E(t,e.path);if(e.noExtensions)return Ys(),kc({pmRoot:r},()=>n(null));if(!await G(ne(r)))return Ys(),n(null);let o=null,i;try{let s=await A(r),a=await sr({pmRoot:r,settings:s,cwd:t,noExtensions:!1}),c=await ar({...a,loaded:a.loaded});i={loadResult:a,activationResult:c},Aa(c.hooks),Ta(c.commands),Ca(c.parsers),Ia(c.preflight),Ra(c.services),Oa(c.renderers),xa(c.registrations),o={registrations:c.registrations,commands:c.commands,pmRoot:r,packages:a.loaded}}catch(s){Ys(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",s)}try{return await kc({pmRoot:r,packages:o?.packages},()=>n(o))}finally{Ys(),i&&await ha(i.loadResult,i.activationResult).catch(()=>{})}}async function NM(e,t,n,r,o){if(!o)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let i=Gn(e),a=o.registrations.commands.find(u=>Gn(u.action)===i)?.command??o.commands.handlers.find(u=>Gn(u.command)===i)?.command;if(!a)throw new l(`Unsupported native pm action: ${e}`,d.USAGE);let c=typeof r.author=="string"&&r.author.trim()?r.author.trim():"pm-extension",m=await Vo({command:Ai(a),args:ge(n.args??t.args),options:nc(t,n),global:r,pm_root:o.pmRoot,sdk:lh(o.pmRoot,U.forActiveExtensionHost({pmRoot:o.pmRoot,author:c}),c,Ai(a))});if(!m.handled){let u=m.warnings.length>0?` (${m.warnings.join(", ")})`:"";throw new l(`Unsupported native pm action: ${e}${u}`,d.USAGE)}return m.result}async function LM(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function $M(e){let t=Pe(e,"action"),n=Gn(t),r=wn(hh,n),o=r?.action??n,i={...e,action:o};return r?.options!==void 0&&(i.options={...r.options,...fa(e.options)}),o==="package"&&(i.options={...fa(i.options),vocabulary:"package"}),{action:o,args:i}}async function rb(e){let t=$M(e),n=ec(t.args),r=Gf(t.action),o=w(t.args,"cwd"),i=o??process.cwd();t.action==="init"&&(n[Tc]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=E(i,n.path));try{return t.action==="history-attest"?await bd(t.action,t.args,n,null):e[nb]===!0||xM.getStore()===!0?await bd(t.action,t.args,n,null):await PM(n,o,i,s=>bd(t.action,t.args,n,s))}finally{r&&md()}}async function bd(e,t,n,r){let o=tc(t,e);$a(e,o),qu(e,o);let i={action:e,args:t,options:o,id:w(t,"id"),force:t.force===!0||o.force===!0,global:n,activeExtensions:r},s=wn(jw,e),a=s?await s(i):await NM(e,t,o,n,r);if(e==="history-attest")return a;{o.resolvedOutputFormat="json";let c=Hu(e,o,a);return await ah(E(process.cwd(),n.path),c),c}}var FM={closeManyOptionsFromFlat:Ti,extensionOptionsFromArgs:nc,globalOptions:ec,mutationListOptions:jf,normalizeActionName:Gn,normalizeCommandPath:Ai,normalizeMcpUpdateOptions:Kf,normalizeMcpOptionsArrays:Uf,optionsWithAuthor:tc,readRequiredString:Pe,readScalarString:Ff,readScalarStringAllowBlank:Mf,readStringArray:ge,updateManyOptionsFromFlat:Ci,withAddNoteOption:Ar,withFilesDiscoveryOptions:Ei,withMutationCompaction:_e};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=FM);(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]="48d03e9b-14a4-545c-8e5d-5f5f2092a113")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="38023567-8a5b-5e25-8d71-5112f74d1894")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3eaa41f7-77a1-5838-8a2f-2ab6a49c21ef")}catch{}})();export{On as AGENT_PROVENANCE_DIMENSIONS,fp as BASELINE_ITEM_FORMAT_VERSION,rk as BUILTIN_AGENT_PROVENANCE_ADAPTERS,pr as BUILTIN_HARNESS_SIGNAL_DESCRIPTORS,no as BUILTIN_ITEM_TYPE_VALUES,oo as CONFIDENCE_TEXT_VALUES,_p as CURRENT_ITEM_FORMAT_VERSION,Vt as DEPENDENCY_KIND_VALUES,d as EXIT_CODE,kn as ISSUE_SEVERITY_VALUES,$d as ITEM_TYPE_VALUES,Sc as PM_CLI_EXPECTED_ERROR_NAME,Kb as PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,jb as PM_READ_OUTPUT_DIMENSIONS,qb as PM_READ_OUTPUT_OPTION_FLAGS,Na as PM_READ_OUTPUT_SURFACE_CONTRACTS,l as PmCliError,U as PmClient,bn as RISK_VALUES,gk as SEMANTIC_ATTRIBUTION_LIMITS,ro as STATUS_VALUES,nk as agentSessionEnvironment,dM as aggregate,Vl as analyzeAgentProvenanceDescriptorCoverage,Qb as analyzeSdkCliParameterCompleteness,vM as append,Bb as applyReadOutputDimensions,Yb as applyReadOutputSessionReferences,Jb as attachReadOutputSessionReceipt,Zb as boundAgentEpisodeIdentity,tt as canonicalDocument,EM as claim,AM as claimNext,yp as classifyItemFormatVersion,SM as close,mM as comments,oM as context,CM as copy,wM as create,ch as createPmCliExpectedError,Gb as decodeReadOutputContinuationCursor,IM as deleteItem,gM as deps,dk as detectAgentIdentity,pk as detectHarnessIdentity,mk as diagnoseAgentIdentity,hM as docs,hp as effectiveItemFormatVersion,qw as emptyImportedDocument,Ub as encodeReadOutputContinuationCursor,gP as evaluateSemanticAttributionCoverage,_k as explainSourceTraceability,fM as files,_M as filesDiscover,OM as focus,cM as get,yM as graph,yP as groupHistoryByEpisode,ry as isAlreadyClaimedError,qi as isPmCliExpectedError,Hb as isReadOutputBudgetExceeded,pM as learnings,iM as list,ik as listAgentProvenanceAdapters,sM as listAllComplete,lM as next,ak as normalizeAgentProvenanceAdapterValue,gp as normalizeItemFormatVersion,Ke as normalizeItemId,ee as normalizeStatusInput,uM as notes,S as nowIso,Wb as parseReadOutputSession,Ri as parseSourceLineRange,ei as readAuthorEnvironment,Xb as readOutputSessionRemainingTokens,uc as recordClaimSemanticAttribution,Mi as recordFocusSemanticAttribution,pc as recordReleaseSemanticAttribution,sk as registerAgentProvenanceAdapters,ok as registerHarnessSignalDescriptors,TM as release,kM as reopen,ek as resolveAgentSessionContextFromSignals,fk as resolveAuthorIdentity,Pv as resolveHistoryEpisodeGroupIdentity,zb as resolveReadOutputDimensions,Vb as resolveReadOutputEncoding,La as resolveReadOutputSurface,hk as resolveSemanticLineageIds,RM as restore,rb as runAction,tk as runWithAgentSessionContext,ck as runWithHarnessDetectionSignals,lk as runWithWorkspaceHarnessSignalDescriptors,aM as search,yk as semanticAttributionAffinity,He as serializeItemDocument,hP as summarizeAgentModelProvenance,Wl as summarizeAgentProvenance,bM as update,$a as validateReadOutputOptions,uk as writeAuthorEnvironment};
37
37
  //# sourceMappingURL=sdk-core.js.map