@unbrained/pm-cli 2026.11.10 → 2026.11.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +12 -0
- package/dist/cli/commander-usage.js +2 -2
- package/dist/cli/error-guidance.js +3 -3
- package/dist/cli/help-json-payload.js +1 -1
- package/dist/cli/main.js +4 -4
- package/dist/cli/runtime/refusal-credential-redaction.js +2 -0
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/{chunk-NNE63MSM.js → chunk-4RHXGQMK.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-YSWD2NXB.js → chunk-5N3JMGXU.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-TBBWPEF5.js → chunk-DIWTFDU7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-OJ2KEDUX.js → chunk-DV7WBAKQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-F6FBGLR7.js → chunk-EBAHNZJT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BSJSGDA3.js → chunk-FM375BHH.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-F7P2NZEG.js → chunk-GOLQYO6M.js} +4 -4
- package/dist/cli-bundle/chunks/chunk-GZ52WAY2.js +124 -0
- package/dist/cli-bundle/chunks/{chunk-EHDGHFMJ.js → chunk-JESMEJTD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CZETQYKO.js → chunk-JLQ7O6UV.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-FYD6LSJA.js → chunk-L3SA3354.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-U7LILCUN.js → chunk-NIOOJ3AG.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-WNEUWDUE.js → chunk-PZI6CR24.js} +46 -46
- package/dist/cli-bundle/chunks/{chunk-NZAFLDSH.js → chunk-QCTA2UFR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4FLAKTZW.js → chunk-SPERPX27.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-T2MNRM3S.js → chunk-SVVFJPNW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-5CAMQHEW.js → chunk-WEAF3OY4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-UL64P6MR.js → chunk-WWW5WHHJ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X7NM5HVQ.js → chunk-XJUYJXHZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-L4WWG2H6.js → chunk-XN2BRWDD.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-Z4YEH7VQ.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-7NAAW5EX.js → chunk-ZJDYBXMC.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4AASUCHO.js → chunk-ZSL6U53K.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-M7KXLQXF.js → item-revision-LNIHK36Q.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-TMUYPSMR.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-admission-374UR7NI.js → mutation-admission-WZY22LVH.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-GSB7PP5P.js → register-list-query-DYGPLVRL.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-ZBF6ITYK.js → register-mutation-MP5JCBAJ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-PWF6GOHE.js → register-operations-QEASK3EF.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-QDZ2Y3CI.js → register-setup-G66U2WFV.js} +2 -2
- package/dist/cli-bundle/chunks/{stage-67WGPKPH.js → stage-VIDXGF3T.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-WK773UVA.js → chunk-2ZS3I5ZP.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-33EK522E.js +26 -0
- package/dist/cli-bundle/focused-chunks/{chunk-BE2GK2G7.js → chunk-3A6XMQZJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PAGW6A2X.js → chunk-3FN4ON2Z.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3DWNH72D.js → chunk-3SH3L3DB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ALLOWZSH.js → chunk-6ICHSVEY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QK7FX4O5.js → chunk-6TJXTKZD.js} +4 -4
- package/dist/cli-bundle/focused-chunks/{chunk-QHGGO7SY.js → chunk-AXPRCCYM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UIZVD36C.js → chunk-DW5S67LO.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-HTMQDNVC.js → chunk-GBW2EAAG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-ZBOCYFBE.js → chunk-HIKZYZ26.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QCHCEFTO.js → chunk-JYWVRXLD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-M5FZTPFA.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-2SQUWQP3.js → chunk-MK7UQEE5.js} +18 -18
- package/dist/cli-bundle/focused-chunks/{chunk-2Y4H4LIX.js → chunk-NMU3QFAU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LY3JXL25.js → chunk-NP5C2TQM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-RFMKS7VD.js → chunk-NSOXVVQX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-WJHDUON5.js → chunk-NY65XTX7.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-67M7E2Z3.js → chunk-P6KYUJD4.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LWMPQRJT.js → chunk-UCUESVFW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-NZQYHPUN.js → chunk-V27M5UQH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-3K2MYE7R.js → chunk-VVGXPF4W.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-revision-XC4ZJ7MY.js → item-revision-B3BIG66B.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-CVGK4RJP.js → item-transaction-4JDWOXNB.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-N27D5H64.js → mutation-admission-577MXOGD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{stage-KPK2UHVO.js → stage-EKYWEU2Y.js} +2 -2
- package/dist/cli-bundle/main.js +32 -32
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +57 -57
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +11 -11
- package/dist/core/sentry/instrument.js +1 -1
- package/dist/core/shared/secret-rules.d.ts +18 -2
- package/dist/core/shared/secret-rules.js +4 -2
- package/dist/core/shared/url-credentials.d.ts +37 -0
- package/dist/core/shared/url-credentials.js +2 -0
- package/dist/core/telemetry/runtime.js +2 -2
- package/dist/sdk/command-line.d.ts +1 -1
- package/dist/sdk/command-line.js +1 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/lifecycle/item-revision.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/docs/CODEX_PLUGIN.md +2 -1
- package/docs/CONFIGURATION.md +16 -0
- package/docs/MUTATION_INTEGRITY.md +65 -0
- package/docs/README.md +2 -2
- package/docs/SDK.md +16 -0
- package/marketplace.json +1 -1
- package/package.json +2 -1
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-D727C4RO.js +0 -122
- package/dist/cli-bundle/chunks/chunk-UFPLZ6LZ.js +0 -2
- package/dist/cli-bundle/chunks/item-transaction-4N5P34GO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-56MIAFEN.js +0 -24
- package/dist/cli-bundle/focused-chunks/chunk-U7HWWEJ2.js +0 -2
- package/docs/CHATGPT_CODEX_PLUGIN_IMPLEMENTATION.md +0 -776
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Nf}from"./chunk-UJMQP2HP.js";import{I as pf,a as os,b as hr,c as as,d as xe,e as cs,f as uf,g as ds,h as ls,i as gr,j as mf,k as us,l as ms,m as yr,q as wr,s as ps,t as Z,x as Xa}from"./chunk-TBBWPEF5.js";import{Ba as Af,Ga as xf,Ka as rc,i as fp,ka as Za,ua as ec,va as Cf,wa as tc,x as Tf,xa as nc}from"./chunk-NZAFLDSH.js";import{a as Sr,b as kf,i as xt,k as Tn,l as Cn,m as An}from"./chunk-FYD6LSJA.js";import{A as En,B as ae,D as _s,G as fs,H as gf,Ha as Of,Ia as Lf,Ic as Ff,J as Qa,Ja as Er,K as yf,Ka as ic,Lc as Uf,M as wf,Na as Df,U as vf,_a as Tr,bb as xn,eb as Rn,l as _f,lb as Mf,o as ff,oa as Rf,p as vr,pa as If,pb as $f,qb as Pf,s as hf,y as br,z as kr}from"./chunk-CZETQYKO.js";import{a as _p}from"./chunk-EHDGHFMJ.js";import{$ as Kp,$a as F_,$b as of,A as Ga,Ab as ef,B as qa,C as kp,D as rs,Da as h_,E as Sp,Ea as g_,F as Ep,Fa as y_,G as Tp,Ga as w_,H as Cp,Ha as v_,I as Ap,Ia as b_,J as xp,Ja as k_,K as Rp,Ka as S_,L as Ip,La as E_,M as Op,Ma as T_,N as Lp,Na as C_,O as Dp,Oa as A_,P as Np,Pa as x_,Q as Mp,Qa as R_,R as $p,Ra as I_,S as Pp,Sa as O_,T as Fp,Ta as L_,Tb as tf,U as Up,Ua as D_,Ub as is,V as jp,Va as za,Vb as nf,W as Gp,Wa as N_,Wb as Ya,X as qp,Xa as M_,Ya as Ba,Yb as rf,Z as Wp,Za as $_,Zb as sf,_ as Wa,_a as P_,aa as zp,ab as U_,ac as af,b as hp,ba as Bp,bb as j_,bc as ss,c as gp,ca as Hp,cb as At,cc as cf,d as yp,da as Vp,db as G_,ea as Yp,eb as q_,fa as Jp,fb as W_,ga as Xp,gb as K_,ha as Qp,ia as Zp,ib as z_,ic as Ja,ja as e_,ka as t_,kb as fr,la as n_,ma as r_,mb as B_,mc as df,n as Ua,na as i_,nb as H_,o as wp,oa as Ka,ob as V_,pa as s_,pb as Y_,pc as lf,qa as o_,r as vp,ra as a_,rb as J_,s as ja,sa as c_,t as Ht,ta as d_,ua as l_,v as bp,va as u_,vb as Ha,wa as m_,wb as X_,xa as p_,xb as Q_,ya as __,yb as Va,za as f_,zb as Z_}from"./chunk-T2MNRM3S.js";import{d as dp,j as lp,r as up,s as Bt,t as mp,w as pp}from"./chunk-UFPLZ6LZ.js";import{A as ge,Aa as pr,B as Ci,Bd as ns,C as Ea,Cb as Km,Cd as cp,D as ir,Db as Zi,E as sr,Eb as zm,F as Oi,G as lt,Gb as V,Gc as tp,H as Du,Hb as le,I as Li,Jb as es,Ka as Qi,Kb as Ee,Kc as np,Lb as pt,Mb as Bm,Na as kn,Nb as Kt,Oa as Om,Pa as Lm,Pb as Sn,Q as $i,Qa as $m,Qb as ue,S as St,Sb as La,T as Ui,Tb as Hm,U as ji,X as Yu,Xa as Pm,bc as Vm,c as Xe,db as Fm,dd as Na,e as Qe,ed as Ma,f as uu,fa as Bi,fb as Um,fd as $a,g as ha,gc as Ym,gd as Pa,h as mu,i as ki,ic as Jm,id as rp,j as Si,ja as tt,k as pu,ka as xm,kb as jm,l as Ei,lc as Da,m as _u,ma as Hi,md as Fa,n as Q,na as Rm,nc as Xm,o as mn,oa as Vi,p as tr,pa as Yi,pb as Gm,pc as Qm,pd as ip,q as ve,qa as Ji,rc as Tt,sc as Zm,tc as Ct,u as Ze,ua as Xi,uc as _r,ud as sp,vc as zt,vd as op,w as Ut,wd as ts,xa as Im,xc as ep,xd as ap,y as Ti,yb as qm,z as pn,zb as Wm}from"./chunk-D727C4RO.js";import{$a as Ru,$d as Et,$e as fm,A as nu,Aa as va,Ad as ut,Ae as am,Ai as mr,B as ru,Ba as nr,Bc as cr,Bd as zu,C as iu,Ca as Ce,Cd as Fe,D as su,Dd as Bu,Di as vn,E as ou,Ed as Hu,Ei as bn,F as au,Fa as $,Fc as Gu,Fd as Vu,Fi as Oa,G as Je,Ga as ct,Gb as I,Ge as cm,H as cu,Ha as Ri,Hb as Nu,Ia as fn,Ib as Ta,Ja as rr,Jb as Mu,Jf as gm,Ka as jt,Kb as Ni,Ki as Dm,Lg as vm,Mb as de,Mg as bm,N as du,Na as R,Nb as $u,O as lu,Oa as et,Ob as or,Oe as dm,P as fa,Pa as We,Pb as Ca,Pd as Ju,Pe as lm,Qa as Ae,Qb as Mi,Qe as um,Qg as km,Ra as Su,Re as mm,Sa as Eu,Sb as Pu,Se as pm,Ta as dt,Te as wn,Th as Em,Ti as Nm,Ua as Ii,Ub as Fu,Ud as Gi,Ue as _m,Ui as x,Va as Tu,Vi as Mm,Wa as Cu,Wb as ar,Xa as ba,Xd as K,Ya as ka,Yb as Uu,Yc as Pi,Yd as Ke,Za as Au,Zd as Gt,_a as xu,_c as Fi,a as ne,ab as Iu,ae as Xu,b as $e,bb as Ou,be as Aa,c as eu,cb as Lu,cc as ju,ce as Qu,cf as lr,d as tu,db as Sa,de as xa,df as ur,dg as ym,ea as ga,ee as Zu,ej as U,gb as P,ge as em,ha as ya,hd as qu,he as tm,hg as wm,ia as Pe,ib as hn,ie as qi,ja as Ai,je as dr,ji as Tm,ka as xi,ki as Cm,la as hu,le as Wi,ma as gu,mb as gn,mg as Ia,mi as Am,na as yu,nf as hm,oa as wu,oe as Ki,pa as vu,pd as N,pe as oe,qa as bu,qe as qt,ra as ku,rb as ie,re as _e,rf as Ra,s as Ye,sa as wa,se as yn,sf as j,te as nm,u as W,ub as Di,ue as rm,uf as mt,v as bi,ve as im,w as Ft,wd as Wu,we as sm,xd as Ku,xh as Sm,ye as zi,ze as om,zi as Wt}from"./chunk-WNEUWDUE.js";import{a as Ef}from"./chunk-SPPHDVZE.js";import{c as bf}from"./chunk-RSAN2YUU.js";import{b as Sf}from"./chunk-VS565KBX.js";import{A as m,C as p,D as kt,E as re,F as _n,G,H as X,K as Le,M as fu,a as Vl,m as Yl,p as Jl,s as Xl,u as Ql,w as Zl,x as vi,y as Pt}from"./chunk-O4ZLEN4T.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2e89d3c-9abc-5ca7-a290-69a54dd694ab")}catch{}})();var K0=Object.freeze({"--body":"Set the item body.","--body-file":"Read the item body from a file, or from stdin when set to -.","--description":"Set the item description.","--stdin":"Read the value from stdin.","--stdin-json":"Read a complete JSON document from stdin."}),z0=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),B0=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),H0=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),V0=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),Y0=["--allow-","--check-","--dry-run","--explain","--fail-","--fix-","--full","--has-","--include-","--json","--no-","--prune-","--quiet","--refresh-","--require-","--runtime-only","--schema-only","--skip-","--stream","--strict-","--summary","--today","--verbose"],J0=new Set(["--activate","--active-only","--adopt","--adopt-all","--all","--all-actionable","--all-affected-ids","--all-day","--all-streams","--acknowledge-linked-tests","--append-stable","--auto-fix","--auto-pm-context","--availability-only","--background","--brief","--by-assignee","--by-priority","--by-tag","--catalog","--claim","--clear","--clear-comments","--clear-criteria","--clear-deps","--clear-docs","--clear-events","--clear-files","--clear-learnings","--clear-notes","--clear-reminders","--clear-tests","--clear-type-options","--cli-only","--closed","--compact","--completion","--count","--counts","--deactivate","--declarative","--defaults","--describe","--diff","--doctor","--empty-body","--explore","--field-utilization","--filter-empty-body","--flags-only","--follow","--force","--global","--highlight","--hybrid","--id-only","--if-available","--ignore-global","--include_unparented","--infer","--init","--install","--isolated","--lean","--list","--local","--manage","--markdown","--metadata-coverage","--next","--normalize-provenance","--only","--only-last","--output-row-contract","--override-linked-pm-context","--override-linked-workspace-context","--packages-only","--past","--phrase-exact","--profile","--progress","--project","--promote-to-item-dep","--provenance","--provenance-summary","--raw","--ready-only","--ready_only","--rebuild","--recent","--reload","--repair","--replace-deps","--replace-docs","--replace-files","--replace-tests","--required","--required-on-create","--run","--runtime-probe","--save-baseline","--scaffold","--semantic","--shared-host-safe","--storage","--title-exact","--token-accounting","--trace","--tree","--unbounded","--uninstall","--validate-paths","--verify","--watch","--with-packages"]),X0=new Set(["--only-index"]),Q0=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Z0=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),eS=new Set(["--regression"]);function tS(e,t){return t==="--stdin"||t==="--stdin-json"?["stdin"]:H0.has(`${e}:${t}`)?["argv","file","stdin"]:t.endsWith("-file")?["argv","file"]:z0.has(t)&&B0.has(e)?["argv","stdin"]:["argv"]}function nS(e,t){let n=Q0.has(`${e}:${t.flag}`)||t.value_name!==void 0||t.value_type==="string"||t.value_type==="number"||t.list===!0||t.repeatable===!0,r=t.value_type==="boolean"||t.flag==="--stdin"||t.flag==="--stdin-json"||t.flag.startsWith("--filter-")&&(t.flag.endsWith("-missing")||t.flag.startsWith("--filter-has-")||t.flag.startsWith("--filter-no-"))||Y0.some(i=>t.flag.startsWith(i));return n||X0.has(t.flag)||!J0.has(t.flag)&&!r}function rS(e,t){return t.value_arity!==void 0?t.value_arity:nS(e,t)?eS.has(t.flag)||Z0.has(`${e}:${t.flag}`)?"optional":"required":"none"}function iS(e,t){let n=bi(e),r=rS(n,t),i=r!=="none",s=tS(n,t.flag),o=t.description??K0[t.flag]??`${i?"Set":"Enable"} ${t.flag.slice(2).replaceAll("-"," ")}.`;return{...t,description:o,takes_value:i,value_required:r==="required",...i?{value_name:t.value_name??"value"}:{},value_type:i?t.value_type??"string":"boolean",required:t.required===!0,repeatable:t.repeatable===!0||t.list===!0,input_sources:s,...s.includes("stdin")&&t.flag!=="--stdin"&&t.flag!=="--stdin-json"?{stdin_token:"-"}:{},...V0.has(`${n}:${t.flag}`)?{file_token_prefix:"@"}:{}}}function jf(e,t){return t.map(n=>iS(e,n))}function _U(e,t,n){let r=e.trim().toLowerCase(),i=[],s=new Map,o=0;for(let c of n)if(c.command.trim().toLowerCase()===r){if(o+=1,s.has(c.flag)){i.push({code:"duplicate_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} was observed more than once.`});continue}s.set(c.flag,c)}let a=new Set(t.map(({flag:c})=>c));for(let c of t){let d=s.get(c.flag);if(!d){i.push({code:"missing_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} has no executable option observation.`});continue}for(let[l,u]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[l]!==d[l]&&i.push({code:u,command:r,flag:c.flag,detail:`${r} ${c.flag} declares ${l}=${String(c[l])} but the executable option reports ${String(d[l])}.`})}for(let c of s.values())a.has(c.flag)||i.push({code:"undeclared_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,d)=>c.flag.localeCompare(d.flag)||c.code.localeCompare(d.code)),{ok:i.length===0,declared_count:t.length,observed_count:o,findings:i}}import{readFile as sS}from"node:fs/promises";(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]="9c3ae5d4-5437-543d-90a3-67e92b073c18")}catch{}})();function LU(e){let t={...e,...e.full===!0?{fullHistory:!0}:{}};return delete t.full,Ze(e,t)}function Bf(e){return Object.prototype.toString.call(e)==="[object Object]"}function oS(e,t,n,r){let i=I();if(!Bf(e))return{...r({created_at:i,author:n,text:t}),text:t,edited_at:i};let s=o=>typeof o=="string"&&o!=="";return{...e,...s(e.created_at)?{}:{created_at:i},...s(e.author)?{}:{author:n},text:t,edited_at:i}}function Gf(e,t){if(typeof e=="object"&&e!==null&&"format"in e&&e.format==="json")throw new p(`Structured context events are append-only and cannot be ${t}.`,m.USAGE,{code:"structured_event_immutable"})}function aS(e,t){return t===void 0?e:t===0?[]:e.slice(Math.max(0,e.length-t))}function Vt(e,t){let n=e[t];return Array.isArray(n)?n:[]}function DU(e,t={}){let n=e.trim();if(!n)return"";let r=/^(?:[-*+]\s*)?text\s*[:=]/i.exec(n);if(t.stripPlainTextPrefix===!0&&r&&!n.startsWith("```"))return n.slice(r[0].length).trim()||n;if(!(/^(?:[-*+]\s*)?text\s*[:=]/im.test(n)||n.startsWith("```")))return n;try{let i=Q(n,"--add");return Object.keys(i).map(s=>s.trim().toLowerCase()).some(s=>s!=="text")?n:i.text?.trim()||n}catch{return n}}function cS(e){return typeof e=="object"&&e!==null&&"code"in e}function qf(e,t){if(!Ut(e))throw new p(`${t} cannot read process stdin through the MCP JSON-RPC transport. Pass annotation text in options.add instead.`,m.USAGE,{code:"mcp_stdin_unavailable",required:"Pass annotation text as JSON data; the MCP protocol already owns process stdin."})}async function dS(e,t){if(+(e.add!==void 0)+ +(e.stdin===!0)+ +(typeof e.file=="string")>1)throw new p(`Specify ${t} text using only one input source: --add, --stdin, or --file`,m.USAGE);let n=pn(),r=Ut(e);if(e.add!==void 0)return{value:await n.resolveValue(e.add,"--add",r)??"",rawValue:e.add,emptyFlag:"--add"};if(e.stdin===!0)return qf(e,"--stdin"),{value:await n.resolveValue("-","--stdin")??"",emptyFlag:"--stdin"};if(typeof e.file!="string")return;let i=e.file.trim();if(!i)throw new p("--file path cannot be empty",m.USAGE);if(i==="-")return qf(e,"--file -"),{value:await n.resolveValue("-","--file")??"",emptyFlag:"--file"};try{return{value:await sS(i,"utf8"),emptyFlag:"--file"}}catch(s){if(cS(s)&&_n(s))throw new p(`--file path not found: ${i}. Use --file - to read stdin.`,m.USAGE);let o=s instanceof Error?s.message:String(s);throw new p(`Failed to read --file path "${i}": ${o}. Use --file - to read stdin.`,m.USAGE)}}async function NU(e,t){if(e.edit!==void 0&&e.delete!==void 0)throw new p("Specify only one of --edit or --delete",m.USAGE);if(e.delete!==void 0){if(e.add!==void 0||e.stdin===!0||typeof e.file=="string")throw new p("--delete cannot be combined with replacement text",m.USAGE);if(!Number.isInteger(e.delete)||e.delete<1)throw new p("--delete must be a positive integer",m.USAGE);return{mode:"delete",index:e.delete}}if(e.edit!==void 0&&(!Number.isInteger(e.edit)||e.edit<1))throw new p("--edit must be a positive integer",m.USAGE);let n=await dS(e,t);if(e.edit!==void 0){if(!n)throw new p("--edit requires replacement text from --add, --stdin, or --file",m.USAGE);return{mode:"edit",index:e.edit,...n}}return n?{mode:"add",...n}:{mode:"list"}}function Cr(e,t){throw e instanceof p&&e.exitCode===m.CONFLICT&&e.message.includes("is assigned to")&&e.message.includes("Use --force to override")?new p(e.message,e.exitCode,{code:"ownership_conflict",required:t.required,examples:t.examples,nextSteps:t.nextSteps}):e}function Hf(e){return e==="comments"?"--stdin":"--add -"}var MU="annotation_flag_like_value";function lS(e){return/^-{1,2}[A-Za-z][\w-]*(?:=.*)?$/.test(e.trim())}function uS(e){return e==="--file"?"--file <path>":e.startsWith("--file=")?e:e==="--stdin"?"--stdin":void 0}function mS(e){let t=e.value.trim(),n=e.collectionKey.replace(/s$/,""),r=uS(t),i=Hf(e.collectionKey),s=e.retryArgs===void 0?{}:{field:e.textFlag,recovery:{suggested_flags:[t],suggested_retry:P(e.retryArgs),suggested_retry_args:[...e.retryArgs]}};if(r!==void 0){let o=r.split(/[ =]/,1)[0],a=o==="--file"?"that file":"stdin",c=e.conflictingOperand===void 0?"":` "${e.conflictingOperand}" was read as positional text, which ${o} cannot be combined with: drop it, or pass it as the text without ${o}.`;return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text: ${e.textFlag} took ${o} as its value. Drop ${e.textFlag} and pass ${r} on its own.${c}`,m.USAGE,{code:"annotation_flag_like_value",required:`Drop ${e.textFlag}: ${r} reads the ${n} text from ${a} by itself. Use ${e.textFlag} text=${t} only when the text really is "${t}".`,examples:[`${e.commandPrefix} ${r}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text. Use ${i} to read stdin, or use text=${t} for literal dash-leading text.`,m.USAGE,{code:"annotation_flag_like_value",required:`Use ${i} for stdin input, pass plain text, or use text=${t} when the text really starts with "-".`,examples:[`${e.commandPrefix} ${i}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}function pS(e,t){if(!((t.input.emptyFlag??"--add")!=="--add"||!lS(e)))throw mS({collectionKey:t.collectionKey,textFlag:"--add",value:e,commandPrefix:t.input.mode==="edit"?`pm ${t.collectionKey} <id> --edit <index>`:`pm ${t.collectionKey} <id>`})}function _S(e,t){if(t.ifAbsent===!0&&!["add","stdin","file"].includes(e.input.mode))throw new p(`--if-absent requires a ${e.collectionKey.replace(/s$/,"")} append`,m.USAGE,{code:"annotation_if_absent_without_append",required:"Combine --if-absent with one append text source; omit it for list, edit, and delete operations."});if(fS(e,t),e.input.mode!=="list"||t.message===void 0)return;let n=e.collectionKey.replace(/s$/,"");throw new p(`--message labels a ${n} mutation but does not provide ${n} text. Pass text positionally or with --add, --stdin, or --file.`,m.USAGE,{code:"annotation_message_without_text",required:`Provide ${n} text through a content source; --message only annotates the history entry of a mutation.`,examples:[`pm ${e.collectionKey} <id> --add "text" --message "why"`,`pm ${e.collectionKey} <id> ${Hf(e.collectionKey)}`]})}function fS(e,t){if(t.expectAt!==void 0){if(e.input.mode!=="edit"&&e.input.mode!=="delete")throw new p(`--expect-at guards an --edit or --delete of one ${e.collectionKey.replace(/s$/,"")}`,m.USAGE,{code:"annotation_expectation_without_target",required:"Combine --expect-at with --edit <index> or --delete <index>; omit it for list and append operations.",examples:[`pm ${e.collectionKey} <id> --edit <index> --expect-at <created_at> --add "<text>"`,`pm ${e.collectionKey} <id> --delete <index> --expect-at <created_at>`]});if(typeof t.expectAt!="string"||t.expectAt.trim().length===0)throw new p("--expect-at must be the non-empty created_at timestamp of the entry you read",m.USAGE,{code:"annotation_expectation_invalid",required:"Pass the created_at value of the row you read at that index, as a string."})}}function Wf(e,t,n,r,i){if(i===void 0)return;let s=t[n]?.created_at,o=typeof s=="string"?s:null;if(o===i)return;let a=t.flatMap((_,h)=>_?.created_at===i?[h+1]:[]),c=r.collectionKey.replace(/s$/,""),d=r.input.mode==="delete"?"--delete":"--edit",l=n+1,u=a.length===1?` The ${c} created at ${i} is at index ${a[0]}.`:a.length>1?` ${a.length} ${r.collectionKey} were created at ${i}: indexes ${a.join(", ")}.`:` No ${c} on ${e} was created at ${i}.`;throw new p(`${c.charAt(0).toUpperCase()}${c.slice(1)} ${l} on ${e} was created at ${o||"an unrecorded time (malformed entry)"}, not ${i}; refusing ${d} of an entry the caller did not read. Nothing was written.${u}`,m.CONFLICT,{code:"annotation_entry_mismatch",item_id:e,details:{collection:r.collectionKey,entry_index:l,expected_created_at:i,actual_created_at:o,matching_indexes:a},required:`Address the ${c} by the index its listing row reports and keep --expect-at set to that row's created_at. When several indexes share the timestamp, inspect those rows before retrying, because the guard compares timestamps, not entry identities.`,why:"A listing page's position or count is not an entry address; only the row's index is, and the expectation checks that the entry at that index still carries the created_at that was read.",examples:[`pm ${r.collectionKey} ${e} --limit 5`,`pm ${r.collectionKey} ${e} ${d} ${a.length===1?a[0]:"<index>"} --expect-at ${i}${d==="--edit"?' --add "<text>"':""}`]})}function hS(e,t,n,r,i,s){let o=Vt(e.metadata,t),a=i?o.findIndex(c=>Bf(c)&&c.author===n&&c.text===r):-1;return a>=0?{changedFields:[],written:o,position:a}:(o.push(s({created_at:I(),author:n,text:r})),e.metadata[t]=o,{changedFields:[t],written:o,position:o.length-1})}function Kf(e,t,n){return nm.has(e)?t.map((r,i)=>i).sort((r,i)=>rm(t[r],t[i])||r-i).indexOf(n)+1:n+1}async function $U(e,t,n,r){_S(r,t);let i=R(process.cwd(),n.path);await U(i);let s=await x(i),o=$(s,N()),a=pr(t.limit);if(r.input.mode==="list"){let f=await V(i,e,s.id_prefix,s.item_format,o.type_to_folder);if(!f)throw new p(`Item ${e} not found`,m.NOT_FOUND);let g=await le(f,{schema:s.schema}),y=Vt(g.document.metadata,r.collectionKey);return hs(f.id,r.collectionKey,y,a,t.includeMeta===!0)}let c=j(t.author,s.author_default);if(r.input.mode==="delete"){let f=r.deleteOp??r.op,g;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(w){let v=Vt(w.metadata,r.collectionKey),b=zf(r.input.index,v.length,r.collectionKey);return Wf(e,v,b,r,t.expectAt),Gf(v[b],"deleted"),v.splice(b,1),w.metadata[r.collectionKey]=v,{changedFields:[r.collectionKey]}}})}catch(w){Cr(w,r.conflictGuidance)}let y=Vt(g.item,r.collectionKey);return hs(g.item.id,r.collectionKey,y,a,t.includeMeta===!0,{action:"delete",entryIndex:r.input.index},t.fullHistory===!0)}let d=r.input.rawValue??r.input.value??"";pS(d,r);let l=r.parseText(r.input.value??"");if(!l.trim())throw new p(`${r.input.emptyFlag??"--add"} text cannot be empty`,m.USAGE);if(r.input.mode==="edit"){let f=r.editOp??r.op,g,y=0;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(b){let T=Vt(b.metadata,r.collectionKey),S=zf(r.input.index,T.length,r.collectionKey);Wf(e,T,S,r,t.expectAt);let A=T[S];return Gf(A,"edited"),T[S]=oS(A,l,c,r.createEntry),y=Kf(r.collectionKey,T,S),b.metadata[r.collectionKey]=T,{changedFields:[r.collectionKey]}}})}catch(b){Cr(b,r.conflictGuidance)}let w=Vt(g.item,r.collectionKey),v=y;return hs(g.item.id,r.collectionKey,w,a,t.includeMeta===!0,{action:"edit",entryIndex:v,entry:w[v-1]},t.fullHistory===!0)}let u,_=0;try{u=await ue({pmRoot:i,settings:s,id:e,op:r.op,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,skipNoop:t.ifAbsent===!0,mutate(f){let g=hS(f,r.collectionKey,c,l,t.ifAbsent===!0,r.createEntry);return _=Kf(r.collectionKey,g.written,g.position),{changedFields:g.changedFields}}})}catch(f){Cr(f,r.conflictGuidance)}let h=Vt(u.item,r.collectionKey);return hs(u.item.id,r.collectionKey,h,a,t.includeMeta===!0,{action:"add",entryIndex:_,entry:h[_-1],changedCount:t.ifAbsent===!0?Math.min(u.changedFields.length,1):void 0},t.fullHistory===!0)}function zf(e,t,n){if(e===void 0||!Number.isInteger(e)||e<1||e>t){let r=n.replace(/s$/,""),i=`${r.charAt(0).toUpperCase()}${r.slice(1)}`,s=t===1?`1 ${r}`:`${t} ${n}`;throw new p(`${i} index ${e??"(missing)"} out of range (item has ${s})`,m.USAGE)}return e-1}function gS(e,t,n){return t===void 0?{}:{mutation_receipt:{action:t.action,entry_index:t.entryIndex,changed_count:t.changedCount??1,full_history_included:!n},omission_receipt:{has_omissions:n,omitted_field_group_count:n?1:0,omitted_field_groups:n?[{name:`${e}_history`,restore_with:{selector:"full_history",cli_flag:"--full-history",sdk_option:"fullHistory",mcp_option:"full"}}]:[]}}}function Vf(e,t){if(Object.prototype.toString.call(e)!=="[object Object]")return e;let n={index:t,...e};return n.index=t,n}function yS(e,t){let n=e.length-t.length;return t.map((r,i)=>Vf(r,n+i+1))}function hs(e,t,n,r,i,s,o=!1){let a=s===void 0||o?yS(n,aS(n,s!==void 0&&o?void 0:r)):s.entry===void 0?[]:[Vf(s.entry,s.entryIndex)],c=s!==void 0&&a.length<n.length;return{id:e,[t]:a,count:a.length,...s?.changedCount===void 0?{}:{changed:s.changedCount===1},...[i,s!==void 0].includes(!0)?{total_count:n.length,returned_count:a.length,has_more:c||a.length<n.length,...r!==void 0?{limit:r}:{}}:{},...gS(t,s,c)}}import{isDeepStrictEqual as Jf}from"node:util";(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]="90fdc6f3-29d4-5266-a142-d9d14fbb12e7")}catch{}})();var wS=new Set(["__proto__","prototype","constructor"]),ys=Symbol("looseOptionOccurrences");function In(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function vS(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n),e[t]=r;return}e[t]=[r,n]}function oc(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(1,o).trim(),value:n.slice(o+1),attached:!0};let a=n.slice(1).trim(),c=e[t+1];return typeof c=="string"&&!c.startsWith("-")?{consumed:2,key:a,value:c}:{consumed:1,key:a,value:!0}}let r=n.indexOf("=");if(r>=0)return{consumed:1,key:n.slice(2,r).trim(),value:n.slice(r+1),attached:!0};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let i=n.slice(2).trim(),s=e[t+1];return typeof s=="string"&&!s.startsWith("-")?{consumed:2,key:i,value:s}:{consumed:1,key:i,value:!0}}function gs(e){return wS.has(e)}function ws(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return $u(t)}function Ar(e){let t=[],n=gn(e.long)??"",r=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let i=In(n.slice(2));i.length>0&&!gs(i)&&t.push(i)}if(r.startsWith("-")&&!r.startsWith("--")){let i=In(r.slice(1));i.length>0&&!gs(i)&&t.push(i)}return[...new Set(t)]}function GU(e){let t=new Set;for(let n of e)for(let r of Ar(n))t.add(r);return t}function On(e){let t=gn(e.long)??"";if(t.startsWith("--")){let n=In(t.slice(2));if(n.length>0&&!gs(n))return n}return Ar(e)[0]??null}function xr(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function bS(e,t){return[...(t.definitions??e).map(n=>xr(n)).filter(n=>n!==null),...t.inheritedFlags??[]]}function qU(e,t,n,r={}){if(t.length===0)return;let i=new Set,s=new Map,o=[],a=bS(t,r);for(let c of t){let d=Ar(c),l=xr(c);for(let u of d)i.add(u),c.enabled===!1&&s.set(u,l);c.required===!0&&c.enabled!==!1&&d.length>0&&o.push({keys:d,label:l})}for(let c of Object.keys(e)){if(!i.has(c)){let l=a.length>0?` Expected one of: ${[...new Set(a)].join(", ")}.`:"";throw new p(`Unknown option '--${c}' for extension command '${n}'.${l}`,m.USAGE,{code:"unknown_option",flag:`--${c}`,required:`Use a flag the command accepts; run pm contracts --command ${n} --flags-only --json to list them.`})}let d=s.get(c);if(d)throw new p(`Option '${d}' is disabled for extension command '${n}'.`,m.USAGE)}for(let c of o)if(!c.keys.some(d=>Object.hasOwn(e,d)))throw new p(`Missing required option '${c.label}' for extension command '${n}'.`,m.USAGE)}function kS(e){return typeof e=="string"||e==null?e:String(e)}function SS(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function Xf(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var ES={string:kS,number:SS,boolean:Xf};function Yt(e,t){return Array.isArray(e)?e.map(n=>Yt(n,t)):ES[t](e)}function Qf(e,t,n){let r=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(i=>i!=null&&i!==""):Ca(e);return t?r.map(i=>Yt(i,t)):r}function TS(e,t,n,r){return n?Qf(e,t,r):t?Yt(e,t):e}function CS(e,t,n){let r=e[ys];if(!r||r.length===0)return n;let i=new Set(t);return r.filter(s=>i.has(s.key)).map(s=>s.value)}function Zf(e){return or(e).value_arity==="none"}function ac(e,t,n,r,i){let s=xr(e),o=i?` for extension command '${i}'`:"",a=n===!0?"no value":JSON.stringify(n);throw new p(`Option '${s}'${o} expects ${r}; received ${a}.`,m.USAGE,{code:"extension_flag_value_invalid",required:`Pass ${s} ${t==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${t} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${t} value for ${s}.`,`Run pm ${i??"<command>"} --help to review the declared flag contract.`]})}function cc(e,t){return e.value_validation==="strict"&&t!=="string"}function AS(e,t){let n=e[ys];if(!n)return[];let r=new Set(t);return n.filter(i=>r.has(i.key))}function xS(e,t,n,r){if(Zf(e))for(let i of AS(n,t)){if(i.attached!==!0)continue;let s=e.list===!0&&e.repeatable!==!0?Ca(i.value):[i.value];for(let o of s){let a=Mi(Yt(o,"boolean"),"boolean");a!==null&&ac(e,"boolean",o,a.expected,r)}}}function RS(e,t,n,r,i){let s=Array.isArray(n)?n.flat(1/0):[n],o=r?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(let a of o)if(typeof a=="string"&&a.trim().length===0){let c=Mi(a,t);ac(e,t,a,c.expected,i)}}function dc(e,t,n,r){if(!cc(e,n))return t;let i=n==="boolean"&&Zf(e),s=o=>{let a=Mi(o,n);return a===null?o:i&&typeof o=="string"?!0:ac(e,n,o,a.expected,r)};return Array.isArray(t)?t.map(s):s(t)}function IS(e,t,n,r){for(let i of n)if(!(i===t||!Object.hasOwn(e,i))){if(Object.hasOwn(e,t)){if(r){let s=e[t],o=e[i];e[t]=[...Array.isArray(s)?s:[s],...Array.isArray(o)?o:[o]].filter(a=>a!=null)}delete e[i];continue}e[t]=e[i],delete e[i]}}function OS(e,t,n=e,r){if(t.length===0)return e;let i=Object.create(null);for(let[o,a]of Object.entries(e))i[o]=a;let s=new Set(t.map(o=>On(o)).filter(o=>o!==null));for(let o of t){let a=On(o);if(a){let c=Ar(o).filter(d=>d===a||!s.has(d));LS(i,o,a,c,n,r)}}return i}function LS(e,t,n,r,i,s){let o=t.list===!0,a=ws(t);a&&!o&&DS(e,t,n,r,a,s),IS(e,n,r,o);let c=t.repeatable===!0;if(!Object.hasOwn(e,n)){t.default!==void 0&&(e[n]=TS(t.default,a,o,c));return}if(a==="boolean"&&cc(t,a)&&xS(t,r,i,s),o){e[n]=NS(t,r,i,e[n],a,c,s);return}a&&(e[n]=dc(t,Yt(e[n],a),a,s))}function DS(e,t,n,r,i,s){for(let o of r)o!==n&&Object.hasOwn(e,o)&&dc(t,Yt(e[o],i),i,s)}function NS(e,t,n,r,i,s,o){let a=CS(n,t,r);i&&cc(e,i)&&RS(e,i,a,s,o);let c=Qf(a,i,s);return i?dc(e,c,i,o):c}function WU(e){let t=Object.create(null),n=[];Object.defineProperty(t,ys,{value:n});let r=0;for(;r<e.length;){let i=oc(e,r);if(!i){r+=1;continue}let s=In(i.key);if(s.length===0||gs(s)){r+=i.consumed;continue}vS(t,s,i.value),n.push({...i,key:s}),r+=i.consumed}return t}function KU(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let r=oc(e,n);if(r){n+=Math.max(1,r.consumed);continue}t.push(e[n]),n+=1}return t}function zU(e,t){if(t.length===0)return[...e];let n=new Set,r=new Set;for(let o of t){let a=ws(o);for(let c of Ar(o))n.add(c),a==="boolean"&&r.add(c)}if(n.size===0)return[...e];let i=[],s=0;for(;s<e.length;){if(e[s]==="--"){i.push(...e.slice(s+1));break}let o=oc(e,s);if(o){let a=In(o.key);if(n.has(a)){let c=e[s],d=r.has(a)&&!c.includes("=")?1:o.consumed;s+=d;continue}}i.push(e[s]),s+=1}return i}function lc(e){return On(e)}function Yf(e){return e.trim().toLowerCase().split(/\s+/u).filter(t=>t.length>0).join(" ")}function BU(e,t){let n=Yf(t);if(n.length===0)return[];let r=W(n);return e.flags.filter(i=>W(Yf(i.target_command))===r).flatMap(i=>[...i.flags])}function eh(e,t,n,r){let i=xr(e),[s,o]=n;throw new p(`Options '${s}' and '${o}' both set ${i} for extension command '${r}' with different values.`,m.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${i} once, under the handler key '${t}'.`,why:`'${s}' and '${o}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${o}' and pass one value as '${t}'.`,`Run pm contracts --command ${r} --flags-only --json to read each flag's sdk_option key.`]})}function HU(e,t,n){if(t.length===0)return e;let r=PS(t),i=US(e,r,n),s=new Set([...r.long.values()].map(({handlerKey:c})=>c)),o=Object.create(null),a=Object.create(null);for(let[c,d]of Object.entries(i))(s.has(c)?o:a)[c]=d;return $S(o,t,n),Object.assign(a,OS(o,t,MS(o,r),n))}function MS(e,t){let n=new Set([...t.long.values()].map(({handlerKey:s})=>s)),r=Object.entries(e).filter(([s])=>n.has(s)).flatMap(([s,o])=>(Array.isArray(o)?o.flat(1/0):[o]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),i=Object.create(null);return Object.defineProperty(i,ys,{value:r}),i}function $S(e,t,n){for(let r of t){let i=On(r);if(i===null)continue;let s=xr(r),o=Object.hasOwn(e,i);if(r.enabled===!1&&o)throw new p(`Option '${s}' is disabled for extension command '${n}'.`,m.USAGE);if(r.required===!0&&r.enabled!==!1&&!o)throw new p(`Missing required option '${s}' for extension command '${n}'.`,m.USAGE)}}function PS(e){let t={long:new Map,short:new Map},n=(r,i,s)=>{i.length>0&&!r.has(i)&&r.set(i,s)};for(let r of e){let i=On(r);if(i===null)continue;let s={handlerKey:i,definition:r};n(t.long,i,s);let o=typeof r.short=="string"?r.short.trim():"";o.startsWith("-")&&!o.startsWith("--")&&n(t.short,o.slice(1),s)}return t}function sc(e,t){return e.long.get(t)??e.short.get(t.replace(/^-(?!-)/u,""))??e.long.get(In(t.replace(/^-{1,2}/u,"")))}function FS(e,t,n){let r=/^(?:--)?no-(.+)$/u.exec(t)?.[1];if(r===void 0||sc(e,t)!==void 0)return{spelling:t,value:n};let i=sc(e,r),s=Xf(n);return i!==void 0&&ws(i.definition)==="boolean"&&typeof s=="boolean"?{spelling:r,value:!s}:{spelling:t,value:n}}function US(e,t,n){let r=Object.create(null),i=new Map;for(let[s,o]of Object.entries(e)){let{spelling:a,value:c}=FS(t,s,o),d=sc(t,a);if(d===void 0)r[a]=c;else if(c!==void 0){let l=i.get(d.handlerKey);l===void 0?(i.set(d.handlerKey,a),r[d.handlerKey]=c):Jf(r[d.handlerKey],c)||eh(d.definition,d.handlerKey,[l,a],n)}}return r}function jS(e){let t=new Map;for(let n of e){let r=On(n);if(r===null)continue;let i={definition:n,handlerKey:r,kind:ws(n),arity:or(n).value_arity,scalar:n.list!==!0},s=[gn(n.long),typeof n.short=="string"?n.short.trim():""];for(let o of s.filter(a=>a?.startsWith("-")===!0))t.has(o)||t.set(o,i)}return t}function GS(e,t,n){let r=e.optionOf(n),i=t.get(n),s=i?.scalar===!0?i:void 0;if(r!==void 0){let o={arity:r.arity,...r.variadic===!0?{variadic:!0}:{}};if(s?.handlerKey===r.key)return{...o,declared:s};let a=i===void 0&&n.startsWith("--no-")?t.get(`--${n.slice(5)}`):void 0;return a?.scalar===!0&&a.kind==="boolean"&&a.handlerKey===r.key?{...o,declared:a,negates:!0}:o}if(!(!e.includesLooseFlags||i===void 0))return s===void 0?{arity:i.arity,loose:!0}:{arity:i.arity,declared:s,loose:!0}}function uc(e){return e.length>1&&e.startsWith("-")}var th=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function qS(e,t,n){let{tokens:r}=e,i=0,s,o=!1,a=!1;for(;i<r.length||s!==void 0;){let c=s??r[i++];if(c==="--")return;if(a&&s===void 0&&WS(e,c))continue;let d=uc(c)?zS(e,c,r[i],t,n):{consumedByCommander:!1,consumed:0};if(i+=d.consumed,s=d.group,a=d.variadic===!0,!d.consumedByCommander){if(KS(e.stop,c,o))return;o=!0}}}function WS(e,t){return!uc(t)||e.negativeNumbersAreValues&&th.test(t)}function KS(e,t,n){return e!==void 0&&(e.atFirstUnrecognized||!n&&e.atSubcommand(t))}function zS(e,t,n,r,i){let s=BS(t,n,r);if(s!==void 0)return i(s.spelling,s.entry,s.value),{consumedByCommander:!1,consumed:s.consumed};let o=r(t);if(o!==void 0){let a=o.arity==="required"||o.arity==="optional"&&n!==void 0&&(!uc(n)||e.negativeNumbersAreValues&&th.test(n));return i(t,o,o.negates===!0?!1:a?n:!0),{consumedByCommander:!0,consumed:a?1:0,variadic:o.variadic===!0}}return t[1]!=="-"?{consumed:0,...HS(t,r,i)}:{consumedByCommander:VS(t,r,i,e.includesLooseFlags?i:()=>{}),consumed:0}}function BS(e,t,n){let r=e.indexOf("="),i=r>1?e.slice(0,r):e,s=n(i);if(s?.loose===!0)return r>1?{spelling:i,entry:s,value:e.slice(r+1),consumed:0}:t!==void 0&&!t.startsWith("-")?{spelling:i,entry:s,value:t,consumed:1}:{spelling:i,entry:s,value:!0,consumed:0};let o=r<0&&e.startsWith("--no-")?n(`--${e.slice(5)}`):void 0;return o?.loose===!0&&o.declared?.kind==="boolean"?{spelling:e,entry:o,value:!1,consumed:0}:void 0}function HS(e,t,n){let r=e.slice(0,2),i=e.length>2?t(r):void 0;return i===void 0||i.loose===!0?{consumedByCommander:!1}:i.arity!=="none"?(n(r,i,e.slice(2)),{consumedByCommander:!0}):(n(r,i,!0),{consumedByCommander:!0,group:`-${e.slice(2)}`})}function VS(e,t,n,r){let i=e.indexOf("=");if(i>2){let o=e.slice(0,i),a=t(o);return a!==void 0&&a.arity!=="none"?(n(o,a,e.slice(i+1)),!0):(a?.declared?.kind==="boolean"&&r(o,a,e.slice(i+1)),!1)}let s=e.startsWith("--no-")?t(`--${e.slice(5)}`):void 0;return s?.declared?.kind==="boolean"&&r(e,s,!1),!1}function VU(e,t,n){let r=jS(t),i=new Map;for(let s of e)qS(s,o=>GS(s,r,o),(o,a,c)=>{a.declared!==void 0&&YS(i,a.declared,o,c,n)})}function YS(e,t,n,r,i){let{definition:s,handlerKey:o,kind:a}=t,c=a?Yt(r,a):r,d=e.get(o)??new Map,l=[...d].find(([u,_])=>u!==n&&!Jf(_,c));l!==void 0&&eh(s,o,[l[0],n],i),d.set(n,c),e.set(o,d)}(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]="0c0bb7ab-6157-5861-ad7e-a63ae62220f4")}catch{}})();var JS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),XS=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]),QS=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])}),ZS=new Set(["extension","install","package","packages","upgrade"]);function eE(e){let t=W(e.trim().toLowerCase());if(t==="ops")return"quality";for(let[n,r]of Object.entries(QS))if(r.has(t))return n;return ZS.has(t)?"extensions":"internal"}var Ln=Object.freeze([...Je.flatMap(e=>e==="item"?["item","item-reopen"]:[e,...Ye.filter(t=>t.alias===e).map(t=>t.canonical)]).map(e=>({command:e,tier:JS.has(W(e))?"core":XS.has(W(e))?"standard":"full",family:eE(e)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]),tE=Ln,nh=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),QU=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);function ZU(e){let t=e===""?0:e.split(/\r?\n/).length,n=Buffer.byteLength(e,"utf8");return{lines:t,utf8_bytes:n,within_budget:t<=nh.max_lines&&n<=nh.max_utf8_bytes}}var rh={core:0,standard:1,full:2,internal:3},ih=new Map(tE.map(({command:e,tier:t})=>[e,t]));function mc(e,t="standard"){return ih.get(e.trim().toLowerCase())??ih.get(W(e.trim().toLowerCase()))??t}function ej(e){return sh(e,Ln)}function sh(e,t){let n=rh[e];return t.filter(r=>r.tier!=="internal"&&rh[r.tier]<=n).map(r=>r.command)}function tj(e){return oh(e,Ln)}function oh(e,t){return t.filter(n=>n.family===e).map(n=>n.command)}var nE=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],rE=new Set([...Ft.filter(e=>e.hidden).map(e=>e.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function nj(e=Ln){return nE.map(t=>({family:t,commands:oh(t,e).filter(n=>e.find(r=>r.command===n)?.tier!=="internal"&&!rE.has(n))})).filter(({commands:t})=>t.length>0)}var iE=Object.freeze({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_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});function rj(e,t){return sE(e,t,Ln)}function sE(e,t,n){if(t==="full")return[...e];let r=new Set(sh(t,n));return e.filter(i=>{let s=iE[i];return s!==void 0&&r.has(s)})}var ij=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]),sj=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:!0},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:!1}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0},{name:"evidence",description:"Exact verification and outcome evidence.",required:!0}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);function oj(){return oE(Ln)}function oE(e){return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...e.map(({command:t,tier:n,family:r})=>`| \`${t}\` | ${n} | ${r} |`),""].join(`
|
|
1
|
+
import{a as Nf}from"./chunk-UJMQP2HP.js";import{I as pf,a as os,b as hr,c as as,d as xe,e as cs,f as uf,g as ds,h as ls,i as gr,j as mf,k as us,l as ms,m as yr,q as wr,s as ps,t as Z,x as Xa}from"./chunk-DIWTFDU7.js";import{Ba as Af,Ga as xf,Ka as rc,i as fp,ka as Za,ua as ec,va as Cf,wa as tc,x as Tf,xa as nc}from"./chunk-QCTA2UFR.js";import{a as Sr,b as kf,i as xt,k as Tn,l as Cn,m as An}from"./chunk-L3SA3354.js";import{A as En,B as ae,D as _s,G as fs,H as gf,Ha as Of,Ia as Lf,Ic as Ff,J as Qa,Ja as Er,K as yf,Ka as ic,Lc as Uf,M as wf,Na as Df,U as vf,_a as Tr,bb as xn,eb as Rn,l as _f,lb as Mf,o as ff,oa as Rf,p as vr,pa as If,pb as $f,qb as Pf,s as hf,y as br,z as kr}from"./chunk-JLQ7O6UV.js";import{a as _p}from"./chunk-JESMEJTD.js";import{$ as Kp,$a as F_,$b as of,A as Ga,Ab as ef,B as qa,C as kp,D as rs,Da as h_,E as Sp,Ea as g_,F as Ep,Fa as y_,G as Tp,Ga as w_,H as Cp,Ha as v_,I as Ap,Ia as b_,J as xp,Ja as k_,K as Rp,Ka as S_,L as Ip,La as E_,M as Op,Ma as T_,N as Lp,Na as C_,O as Dp,Oa as A_,P as Np,Pa as x_,Q as Mp,Qa as R_,R as $p,Ra as I_,S as Pp,Sa as O_,T as Fp,Ta as L_,Tb as tf,U as Up,Ua as D_,Ub as is,V as jp,Va as za,Vb as nf,W as Gp,Wa as N_,Wb as Ya,X as qp,Xa as M_,Ya as Ba,Yb as rf,Z as Wp,Za as $_,Zb as sf,_ as Wa,_a as P_,aa as zp,ab as U_,ac as af,b as hp,ba as Bp,bb as j_,bc as ss,c as gp,ca as Hp,cb as At,cc as cf,d as yp,da as Vp,db as G_,ea as Yp,eb as q_,fa as Jp,fb as W_,ga as Xp,gb as K_,ha as Qp,ia as Zp,ib as z_,ic as Ja,ja as e_,ka as t_,kb as fr,la as n_,ma as r_,mb as B_,mc as df,n as Ua,na as i_,nb as H_,o as wp,oa as Ka,ob as V_,pa as s_,pb as Y_,pc as lf,qa as o_,r as vp,ra as a_,rb as J_,s as ja,sa as c_,t as Ht,ta as d_,ua as l_,v as bp,va as u_,vb as Ha,wa as m_,wb as X_,xa as p_,xb as Q_,ya as __,yb as Va,za as f_,zb as Z_}from"./chunk-SVVFJPNW.js";import{d as dp,j as lp,r as up,s as Bt,t as mp,w as pp}from"./chunk-Z4YEH7VQ.js";import{A as ge,Aa as pr,B as Ci,Bd as ns,C as Ea,Cb as Km,Cd as cp,D as ir,Db as Zi,E as sr,Eb as zm,F as Oi,G as lt,Gb as V,Gc as tp,H as Du,Hb as le,I as Li,Jb as es,Ka as Qi,Kb as Ee,Kc as np,Lb as pt,Mb as Bm,Na as kn,Nb as Kt,Oa as Om,Pa as Lm,Pb as Sn,Q as $i,Qa as $m,Qb as ue,S as St,Sb as La,T as Ui,Tb as Hm,U as ji,X as Yu,Xa as Pm,bc as Vm,c as Xe,db as Fm,dd as Na,e as Qe,ed as Ma,f as uu,fa as Bi,fb as Um,fd as $a,g as ha,gc as Ym,gd as Pa,h as mu,i as ki,ic as Jm,id as rp,j as Si,ja as tt,k as pu,ka as xm,kb as jm,l as Ei,lc as Da,m as _u,ma as Hi,md as Fa,n as Q,na as Rm,nc as Xm,o as mn,oa as Vi,p as tr,pa as Yi,pb as Gm,pc as Qm,pd as ip,q as ve,qa as Ji,rc as Tt,sc as Zm,tc as Ct,u as Ze,ua as Xi,uc as _r,ud as sp,vc as zt,vd as op,w as Ut,wd as ts,xa as Im,xc as ep,xd as ap,y as Ti,yb as qm,z as pn,zb as Wm}from"./chunk-GZ52WAY2.js";import{$a as Ru,$b as ar,A as nu,Aa as va,Ae as im,B as ru,Ba as nr,Bd as Wu,Be as sm,C as iu,Ca as Ce,Cd as Ku,Ch as Sm,D as su,De as zi,E as ou,Ee as om,Ei as Wt,F as au,Fa as $,Fd as ut,Fe as am,Fi as mr,G as Je,Ga as ct,Gc as cr,Gd as zu,H as cu,Ha as Ri,Hd as Fe,Ia as fn,Id as Bu,Ii as vn,Ja as rr,Jd as Hu,Ji as bn,Ka as jt,Kc as Gu,Kd as Vu,Ki as Oa,Lb as I,Le as cm,Mb as Nu,N as du,Na as R,Nb as Ta,O as lu,Oa as et,Ob as Mu,Of as gm,P as fa,Pa as We,Pb as Ni,Pi as Dm,Qa as Ae,Qg as vm,Ra as Su,Rb as de,Rg as bm,Sa as Eu,Sb as $u,Ta as dt,Tb as or,Te as dm,Ua as Ii,Ub as Ca,Ud as Ju,Ue as lm,Va as Tu,Vb as Mi,Ve as um,Vg as km,Wa as Cu,We as mm,Xa as ba,Xb as Pu,Xe as pm,Ya as ka,Ye as wn,Yh as Em,Yi as Nm,Za as Au,Zb as Fu,Zd as Gi,Ze as _m,Zi as x,_a as xu,_i as Mm,a as ne,ab as Iu,ae as K,b as $e,bb as Ou,bc as Uu,bd as Pi,be as Ke,c as eu,cb as Lu,ce as Gt,d as tu,db as Sa,dd as Fi,ea as ga,ee as Et,ef as fm,fe as Xu,gb as P,ge as Aa,ha as ya,hc as ju,he as Qu,hf as lr,ia as Pe,ie as xa,if as ur,ig as ym,ja as Ai,je as Zu,jj as U,ka as xi,la as hu,le as em,ma as gu,md as qu,me as tm,mg as wm,na as yu,nb as hn,ne as qi,oa as wu,oe as dr,oi as Tm,pa as vu,pi as Cm,qa as bu,qe as Wi,ra as ku,rb as gn,rg as Ia,ri as Am,s as Ye,sa as wa,sf as hm,te as Ki,u as W,ud as N,ue as oe,v as bi,ve as qt,w as Ft,wb as ie,we as _e,wf as Ra,xe as yn,xf as j,ye as nm,zb as Di,ze as rm,zf as mt}from"./chunk-PZI6CR24.js";import{a as Ef}from"./chunk-SPPHDVZE.js";import{c as bf}from"./chunk-RSAN2YUU.js";import{b as Sf}from"./chunk-VS565KBX.js";import{A as m,C as p,D as kt,E as re,F as _n,G,H as X,K as Le,M as fu,a as Vl,m as Yl,p as Jl,s as Xl,u as Ql,w as Zl,x as vi,y as Pt}from"./chunk-O4ZLEN4T.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2e89d3c-9abc-5ca7-a290-69a54dd694ab")}catch{}})();var K0=Object.freeze({"--body":"Set the item body.","--body-file":"Read the item body from a file, or from stdin when set to -.","--description":"Set the item description.","--stdin":"Read the value from stdin.","--stdin-json":"Read a complete JSON document from stdin."}),z0=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),B0=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),H0=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),V0=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),Y0=["--allow-","--check-","--dry-run","--explain","--fail-","--fix-","--full","--has-","--include-","--json","--no-","--prune-","--quiet","--refresh-","--require-","--runtime-only","--schema-only","--skip-","--stream","--strict-","--summary","--today","--verbose"],J0=new Set(["--activate","--active-only","--adopt","--adopt-all","--all","--all-actionable","--all-affected-ids","--all-day","--all-streams","--acknowledge-linked-tests","--append-stable","--auto-fix","--auto-pm-context","--availability-only","--background","--brief","--by-assignee","--by-priority","--by-tag","--catalog","--claim","--clear","--clear-comments","--clear-criteria","--clear-deps","--clear-docs","--clear-events","--clear-files","--clear-learnings","--clear-notes","--clear-reminders","--clear-tests","--clear-type-options","--cli-only","--closed","--compact","--completion","--count","--counts","--deactivate","--declarative","--defaults","--describe","--diff","--doctor","--empty-body","--explore","--field-utilization","--filter-empty-body","--flags-only","--follow","--force","--global","--highlight","--hybrid","--id-only","--if-available","--ignore-global","--include_unparented","--infer","--init","--install","--isolated","--lean","--list","--local","--manage","--markdown","--metadata-coverage","--next","--normalize-provenance","--only","--only-last","--output-row-contract","--override-linked-pm-context","--override-linked-workspace-context","--packages-only","--past","--phrase-exact","--profile","--progress","--project","--promote-to-item-dep","--provenance","--provenance-summary","--raw","--ready-only","--ready_only","--rebuild","--recent","--reload","--repair","--replace-deps","--replace-docs","--replace-files","--replace-tests","--required","--required-on-create","--run","--runtime-probe","--save-baseline","--scaffold","--semantic","--shared-host-safe","--storage","--title-exact","--token-accounting","--trace","--tree","--unbounded","--uninstall","--validate-paths","--verify","--watch","--with-packages"]),X0=new Set(["--only-index"]),Q0=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Z0=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),eS=new Set(["--regression"]);function tS(e,t){return t==="--stdin"||t==="--stdin-json"?["stdin"]:H0.has(`${e}:${t}`)?["argv","file","stdin"]:t.endsWith("-file")?["argv","file"]:z0.has(t)&&B0.has(e)?["argv","stdin"]:["argv"]}function nS(e,t){let n=Q0.has(`${e}:${t.flag}`)||t.value_name!==void 0||t.value_type==="string"||t.value_type==="number"||t.list===!0||t.repeatable===!0,r=t.value_type==="boolean"||t.flag==="--stdin"||t.flag==="--stdin-json"||t.flag.startsWith("--filter-")&&(t.flag.endsWith("-missing")||t.flag.startsWith("--filter-has-")||t.flag.startsWith("--filter-no-"))||Y0.some(i=>t.flag.startsWith(i));return n||X0.has(t.flag)||!J0.has(t.flag)&&!r}function rS(e,t){return t.value_arity!==void 0?t.value_arity:nS(e,t)?eS.has(t.flag)||Z0.has(`${e}:${t.flag}`)?"optional":"required":"none"}function iS(e,t){let n=bi(e),r=rS(n,t),i=r!=="none",s=tS(n,t.flag),o=t.description??K0[t.flag]??`${i?"Set":"Enable"} ${t.flag.slice(2).replaceAll("-"," ")}.`;return{...t,description:o,takes_value:i,value_required:r==="required",...i?{value_name:t.value_name??"value"}:{},value_type:i?t.value_type??"string":"boolean",required:t.required===!0,repeatable:t.repeatable===!0||t.list===!0,input_sources:s,...s.includes("stdin")&&t.flag!=="--stdin"&&t.flag!=="--stdin-json"?{stdin_token:"-"}:{},...V0.has(`${n}:${t.flag}`)?{file_token_prefix:"@"}:{}}}function jf(e,t){return t.map(n=>iS(e,n))}function _U(e,t,n){let r=e.trim().toLowerCase(),i=[],s=new Map,o=0;for(let c of n)if(c.command.trim().toLowerCase()===r){if(o+=1,s.has(c.flag)){i.push({code:"duplicate_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} was observed more than once.`});continue}s.set(c.flag,c)}let a=new Set(t.map(({flag:c})=>c));for(let c of t){let d=s.get(c.flag);if(!d){i.push({code:"missing_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} has no executable option observation.`});continue}for(let[l,u]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[l]!==d[l]&&i.push({code:u,command:r,flag:c.flag,detail:`${r} ${c.flag} declares ${l}=${String(c[l])} but the executable option reports ${String(d[l])}.`})}for(let c of s.values())a.has(c.flag)||i.push({code:"undeclared_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,d)=>c.flag.localeCompare(d.flag)||c.code.localeCompare(d.code)),{ok:i.length===0,declared_count:t.length,observed_count:o,findings:i}}import{readFile as sS}from"node:fs/promises";(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]="9c3ae5d4-5437-543d-90a3-67e92b073c18")}catch{}})();function LU(e){let t={...e,...e.full===!0?{fullHistory:!0}:{}};return delete t.full,Ze(e,t)}function Bf(e){return Object.prototype.toString.call(e)==="[object Object]"}function oS(e,t,n,r){let i=I();if(!Bf(e))return{...r({created_at:i,author:n,text:t}),text:t,edited_at:i};let s=o=>typeof o=="string"&&o!=="";return{...e,...s(e.created_at)?{}:{created_at:i},...s(e.author)?{}:{author:n},text:t,edited_at:i}}function Gf(e,t){if(typeof e=="object"&&e!==null&&"format"in e&&e.format==="json")throw new p(`Structured context events are append-only and cannot be ${t}.`,m.USAGE,{code:"structured_event_immutable"})}function aS(e,t){return t===void 0?e:t===0?[]:e.slice(Math.max(0,e.length-t))}function Vt(e,t){let n=e[t];return Array.isArray(n)?n:[]}function DU(e,t={}){let n=e.trim();if(!n)return"";let r=/^(?:[-*+]\s*)?text\s*[:=]/i.exec(n);if(t.stripPlainTextPrefix===!0&&r&&!n.startsWith("```"))return n.slice(r[0].length).trim()||n;if(!(/^(?:[-*+]\s*)?text\s*[:=]/im.test(n)||n.startsWith("```")))return n;try{let i=Q(n,"--add");return Object.keys(i).map(s=>s.trim().toLowerCase()).some(s=>s!=="text")?n:i.text?.trim()||n}catch{return n}}function cS(e){return typeof e=="object"&&e!==null&&"code"in e}function qf(e,t){if(!Ut(e))throw new p(`${t} cannot read process stdin through the MCP JSON-RPC transport. Pass annotation text in options.add instead.`,m.USAGE,{code:"mcp_stdin_unavailable",required:"Pass annotation text as JSON data; the MCP protocol already owns process stdin."})}async function dS(e,t){if(+(e.add!==void 0)+ +(e.stdin===!0)+ +(typeof e.file=="string")>1)throw new p(`Specify ${t} text using only one input source: --add, --stdin, or --file`,m.USAGE);let n=pn(),r=Ut(e);if(e.add!==void 0)return{value:await n.resolveValue(e.add,"--add",r)??"",rawValue:e.add,emptyFlag:"--add"};if(e.stdin===!0)return qf(e,"--stdin"),{value:await n.resolveValue("-","--stdin")??"",emptyFlag:"--stdin"};if(typeof e.file!="string")return;let i=e.file.trim();if(!i)throw new p("--file path cannot be empty",m.USAGE);if(i==="-")return qf(e,"--file -"),{value:await n.resolveValue("-","--file")??"",emptyFlag:"--file"};try{return{value:await sS(i,"utf8"),emptyFlag:"--file"}}catch(s){if(cS(s)&&_n(s))throw new p(`--file path not found: ${i}. Use --file - to read stdin.`,m.USAGE);let o=s instanceof Error?s.message:String(s);throw new p(`Failed to read --file path "${i}": ${o}. Use --file - to read stdin.`,m.USAGE)}}async function NU(e,t){if(e.edit!==void 0&&e.delete!==void 0)throw new p("Specify only one of --edit or --delete",m.USAGE);if(e.delete!==void 0){if(e.add!==void 0||e.stdin===!0||typeof e.file=="string")throw new p("--delete cannot be combined with replacement text",m.USAGE);if(!Number.isInteger(e.delete)||e.delete<1)throw new p("--delete must be a positive integer",m.USAGE);return{mode:"delete",index:e.delete}}if(e.edit!==void 0&&(!Number.isInteger(e.edit)||e.edit<1))throw new p("--edit must be a positive integer",m.USAGE);let n=await dS(e,t);if(e.edit!==void 0){if(!n)throw new p("--edit requires replacement text from --add, --stdin, or --file",m.USAGE);return{mode:"edit",index:e.edit,...n}}return n?{mode:"add",...n}:{mode:"list"}}function Cr(e,t){throw e instanceof p&&e.exitCode===m.CONFLICT&&e.message.includes("is assigned to")&&e.message.includes("Use --force to override")?new p(e.message,e.exitCode,{code:"ownership_conflict",required:t.required,examples:t.examples,nextSteps:t.nextSteps}):e}function Hf(e){return e==="comments"?"--stdin":"--add -"}var MU="annotation_flag_like_value";function lS(e){return/^-{1,2}[A-Za-z][\w-]*(?:=.*)?$/.test(e.trim())}function uS(e){return e==="--file"?"--file <path>":e.startsWith("--file=")?e:e==="--stdin"?"--stdin":void 0}function mS(e){let t=e.value.trim(),n=e.collectionKey.replace(/s$/,""),r=uS(t),i=Hf(e.collectionKey),s=e.retryArgs===void 0?{}:{field:e.textFlag,recovery:{suggested_flags:[t],suggested_retry:P(e.retryArgs),suggested_retry_args:[...e.retryArgs]}};if(r!==void 0){let o=r.split(/[ =]/,1)[0],a=o==="--file"?"that file":"stdin",c=e.conflictingOperand===void 0?"":` "${e.conflictingOperand}" was read as positional text, which ${o} cannot be combined with: drop it, or pass it as the text without ${o}.`;return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text: ${e.textFlag} took ${o} as its value. Drop ${e.textFlag} and pass ${r} on its own.${c}`,m.USAGE,{code:"annotation_flag_like_value",required:`Drop ${e.textFlag}: ${r} reads the ${n} text from ${a} by itself. Use ${e.textFlag} text=${t} only when the text really is "${t}".`,examples:[`${e.commandPrefix} ${r}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text. Use ${i} to read stdin, or use text=${t} for literal dash-leading text.`,m.USAGE,{code:"annotation_flag_like_value",required:`Use ${i} for stdin input, pass plain text, or use text=${t} when the text really starts with "-".`,examples:[`${e.commandPrefix} ${i}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}function pS(e,t){if(!((t.input.emptyFlag??"--add")!=="--add"||!lS(e)))throw mS({collectionKey:t.collectionKey,textFlag:"--add",value:e,commandPrefix:t.input.mode==="edit"?`pm ${t.collectionKey} <id> --edit <index>`:`pm ${t.collectionKey} <id>`})}function _S(e,t){if(t.ifAbsent===!0&&!["add","stdin","file"].includes(e.input.mode))throw new p(`--if-absent requires a ${e.collectionKey.replace(/s$/,"")} append`,m.USAGE,{code:"annotation_if_absent_without_append",required:"Combine --if-absent with one append text source; omit it for list, edit, and delete operations."});if(fS(e,t),e.input.mode!=="list"||t.message===void 0)return;let n=e.collectionKey.replace(/s$/,"");throw new p(`--message labels a ${n} mutation but does not provide ${n} text. Pass text positionally or with --add, --stdin, or --file.`,m.USAGE,{code:"annotation_message_without_text",required:`Provide ${n} text through a content source; --message only annotates the history entry of a mutation.`,examples:[`pm ${e.collectionKey} <id> --add "text" --message "why"`,`pm ${e.collectionKey} <id> ${Hf(e.collectionKey)}`]})}function fS(e,t){if(t.expectAt!==void 0){if(e.input.mode!=="edit"&&e.input.mode!=="delete")throw new p(`--expect-at guards an --edit or --delete of one ${e.collectionKey.replace(/s$/,"")}`,m.USAGE,{code:"annotation_expectation_without_target",required:"Combine --expect-at with --edit <index> or --delete <index>; omit it for list and append operations.",examples:[`pm ${e.collectionKey} <id> --edit <index> --expect-at <created_at> --add "<text>"`,`pm ${e.collectionKey} <id> --delete <index> --expect-at <created_at>`]});if(typeof t.expectAt!="string"||t.expectAt.trim().length===0)throw new p("--expect-at must be the non-empty created_at timestamp of the entry you read",m.USAGE,{code:"annotation_expectation_invalid",required:"Pass the created_at value of the row you read at that index, as a string."})}}function Wf(e,t,n,r,i){if(i===void 0)return;let s=t[n]?.created_at,o=typeof s=="string"?s:null;if(o===i)return;let a=t.flatMap((_,h)=>_?.created_at===i?[h+1]:[]),c=r.collectionKey.replace(/s$/,""),d=r.input.mode==="delete"?"--delete":"--edit",l=n+1,u=a.length===1?` The ${c} created at ${i} is at index ${a[0]}.`:a.length>1?` ${a.length} ${r.collectionKey} were created at ${i}: indexes ${a.join(", ")}.`:` No ${c} on ${e} was created at ${i}.`;throw new p(`${c.charAt(0).toUpperCase()}${c.slice(1)} ${l} on ${e} was created at ${o||"an unrecorded time (malformed entry)"}, not ${i}; refusing ${d} of an entry the caller did not read. Nothing was written.${u}`,m.CONFLICT,{code:"annotation_entry_mismatch",item_id:e,details:{collection:r.collectionKey,entry_index:l,expected_created_at:i,actual_created_at:o,matching_indexes:a},required:`Address the ${c} by the index its listing row reports and keep --expect-at set to that row's created_at. When several indexes share the timestamp, inspect those rows before retrying, because the guard compares timestamps, not entry identities.`,why:"A listing page's position or count is not an entry address; only the row's index is, and the expectation checks that the entry at that index still carries the created_at that was read.",examples:[`pm ${r.collectionKey} ${e} --limit 5`,`pm ${r.collectionKey} ${e} ${d} ${a.length===1?a[0]:"<index>"} --expect-at ${i}${d==="--edit"?' --add "<text>"':""}`]})}function hS(e,t,n,r,i,s){let o=Vt(e.metadata,t),a=i?o.findIndex(c=>Bf(c)&&c.author===n&&c.text===r):-1;return a>=0?{changedFields:[],written:o,position:a}:(o.push(s({created_at:I(),author:n,text:r})),e.metadata[t]=o,{changedFields:[t],written:o,position:o.length-1})}function Kf(e,t,n){return nm.has(e)?t.map((r,i)=>i).sort((r,i)=>rm(t[r],t[i])||r-i).indexOf(n)+1:n+1}async function $U(e,t,n,r){_S(r,t);let i=R(process.cwd(),n.path);await U(i);let s=await x(i),o=$(s,N()),a=pr(t.limit);if(r.input.mode==="list"){let f=await V(i,e,s.id_prefix,s.item_format,o.type_to_folder);if(!f)throw new p(`Item ${e} not found`,m.NOT_FOUND);let g=await le(f,{schema:s.schema}),y=Vt(g.document.metadata,r.collectionKey);return hs(f.id,r.collectionKey,y,a,t.includeMeta===!0)}let c=j(t.author,s.author_default);if(r.input.mode==="delete"){let f=r.deleteOp??r.op,g;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(w){let v=Vt(w.metadata,r.collectionKey),b=zf(r.input.index,v.length,r.collectionKey);return Wf(e,v,b,r,t.expectAt),Gf(v[b],"deleted"),v.splice(b,1),w.metadata[r.collectionKey]=v,{changedFields:[r.collectionKey]}}})}catch(w){Cr(w,r.conflictGuidance)}let y=Vt(g.item,r.collectionKey);return hs(g.item.id,r.collectionKey,y,a,t.includeMeta===!0,{action:"delete",entryIndex:r.input.index},t.fullHistory===!0)}let d=r.input.rawValue??r.input.value??"";pS(d,r);let l=r.parseText(r.input.value??"");if(!l.trim())throw new p(`${r.input.emptyFlag??"--add"} text cannot be empty`,m.USAGE);if(r.input.mode==="edit"){let f=r.editOp??r.op,g,y=0;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(b){let T=Vt(b.metadata,r.collectionKey),S=zf(r.input.index,T.length,r.collectionKey);Wf(e,T,S,r,t.expectAt);let A=T[S];return Gf(A,"edited"),T[S]=oS(A,l,c,r.createEntry),y=Kf(r.collectionKey,T,S),b.metadata[r.collectionKey]=T,{changedFields:[r.collectionKey]}}})}catch(b){Cr(b,r.conflictGuidance)}let w=Vt(g.item,r.collectionKey),v=y;return hs(g.item.id,r.collectionKey,w,a,t.includeMeta===!0,{action:"edit",entryIndex:v,entry:w[v-1]},t.fullHistory===!0)}let u,_=0;try{u=await ue({pmRoot:i,settings:s,id:e,op:r.op,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,skipNoop:t.ifAbsent===!0,mutate(f){let g=hS(f,r.collectionKey,c,l,t.ifAbsent===!0,r.createEntry);return _=Kf(r.collectionKey,g.written,g.position),{changedFields:g.changedFields}}})}catch(f){Cr(f,r.conflictGuidance)}let h=Vt(u.item,r.collectionKey);return hs(u.item.id,r.collectionKey,h,a,t.includeMeta===!0,{action:"add",entryIndex:_,entry:h[_-1],changedCount:t.ifAbsent===!0?Math.min(u.changedFields.length,1):void 0},t.fullHistory===!0)}function zf(e,t,n){if(e===void 0||!Number.isInteger(e)||e<1||e>t){let r=n.replace(/s$/,""),i=`${r.charAt(0).toUpperCase()}${r.slice(1)}`,s=t===1?`1 ${r}`:`${t} ${n}`;throw new p(`${i} index ${e??"(missing)"} out of range (item has ${s})`,m.USAGE)}return e-1}function gS(e,t,n){return t===void 0?{}:{mutation_receipt:{action:t.action,entry_index:t.entryIndex,changed_count:t.changedCount??1,full_history_included:!n},omission_receipt:{has_omissions:n,omitted_field_group_count:n?1:0,omitted_field_groups:n?[{name:`${e}_history`,restore_with:{selector:"full_history",cli_flag:"--full-history",sdk_option:"fullHistory",mcp_option:"full"}}]:[]}}}function Vf(e,t){if(Object.prototype.toString.call(e)!=="[object Object]")return e;let n={index:t,...e};return n.index=t,n}function yS(e,t){let n=e.length-t.length;return t.map((r,i)=>Vf(r,n+i+1))}function hs(e,t,n,r,i,s,o=!1){let a=s===void 0||o?yS(n,aS(n,s!==void 0&&o?void 0:r)):s.entry===void 0?[]:[Vf(s.entry,s.entryIndex)],c=s!==void 0&&a.length<n.length;return{id:e,[t]:a,count:a.length,...s?.changedCount===void 0?{}:{changed:s.changedCount===1},...[i,s!==void 0].includes(!0)?{total_count:n.length,returned_count:a.length,has_more:c||a.length<n.length,...r!==void 0?{limit:r}:{}}:{},...gS(t,s,c)}}import{isDeepStrictEqual as Jf}from"node:util";(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]="90fdc6f3-29d4-5266-a142-d9d14fbb12e7")}catch{}})();var wS=new Set(["__proto__","prototype","constructor"]),ys=Symbol("looseOptionOccurrences");function In(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function vS(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n),e[t]=r;return}e[t]=[r,n]}function oc(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(1,o).trim(),value:n.slice(o+1),attached:!0};let a=n.slice(1).trim(),c=e[t+1];return typeof c=="string"&&!c.startsWith("-")?{consumed:2,key:a,value:c}:{consumed:1,key:a,value:!0}}let r=n.indexOf("=");if(r>=0)return{consumed:1,key:n.slice(2,r).trim(),value:n.slice(r+1),attached:!0};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let i=n.slice(2).trim(),s=e[t+1];return typeof s=="string"&&!s.startsWith("-")?{consumed:2,key:i,value:s}:{consumed:1,key:i,value:!0}}function gs(e){return wS.has(e)}function ws(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return $u(t)}function Ar(e){let t=[],n=gn(e.long)??"",r=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let i=In(n.slice(2));i.length>0&&!gs(i)&&t.push(i)}if(r.startsWith("-")&&!r.startsWith("--")){let i=In(r.slice(1));i.length>0&&!gs(i)&&t.push(i)}return[...new Set(t)]}function GU(e){let t=new Set;for(let n of e)for(let r of Ar(n))t.add(r);return t}function On(e){let t=gn(e.long)??"";if(t.startsWith("--")){let n=In(t.slice(2));if(n.length>0&&!gs(n))return n}return Ar(e)[0]??null}function xr(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function bS(e,t){return[...(t.definitions??e).map(n=>xr(n)).filter(n=>n!==null),...t.inheritedFlags??[]]}function qU(e,t,n,r={}){if(t.length===0)return;let i=new Set,s=new Map,o=[],a=bS(t,r);for(let c of t){let d=Ar(c),l=xr(c);for(let u of d)i.add(u),c.enabled===!1&&s.set(u,l);c.required===!0&&c.enabled!==!1&&d.length>0&&o.push({keys:d,label:l})}for(let c of Object.keys(e)){if(!i.has(c)){let l=a.length>0?` Expected one of: ${[...new Set(a)].join(", ")}.`:"";throw new p(`Unknown option '--${c}' for extension command '${n}'.${l}`,m.USAGE,{code:"unknown_option",flag:`--${c}`,required:`Use a flag the command accepts; run pm contracts --command ${n} --flags-only --json to list them.`})}let d=s.get(c);if(d)throw new p(`Option '${d}' is disabled for extension command '${n}'.`,m.USAGE)}for(let c of o)if(!c.keys.some(d=>Object.hasOwn(e,d)))throw new p(`Missing required option '${c.label}' for extension command '${n}'.`,m.USAGE)}function kS(e){return typeof e=="string"||e==null?e:String(e)}function SS(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function Xf(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var ES={string:kS,number:SS,boolean:Xf};function Yt(e,t){return Array.isArray(e)?e.map(n=>Yt(n,t)):ES[t](e)}function Qf(e,t,n){let r=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(i=>i!=null&&i!==""):Ca(e);return t?r.map(i=>Yt(i,t)):r}function TS(e,t,n,r){return n?Qf(e,t,r):t?Yt(e,t):e}function CS(e,t,n){let r=e[ys];if(!r||r.length===0)return n;let i=new Set(t);return r.filter(s=>i.has(s.key)).map(s=>s.value)}function Zf(e){return or(e).value_arity==="none"}function ac(e,t,n,r,i){let s=xr(e),o=i?` for extension command '${i}'`:"",a=n===!0?"no value":JSON.stringify(n);throw new p(`Option '${s}'${o} expects ${r}; received ${a}.`,m.USAGE,{code:"extension_flag_value_invalid",required:`Pass ${s} ${t==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${t} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${t} value for ${s}.`,`Run pm ${i??"<command>"} --help to review the declared flag contract.`]})}function cc(e,t){return e.value_validation==="strict"&&t!=="string"}function AS(e,t){let n=e[ys];if(!n)return[];let r=new Set(t);return n.filter(i=>r.has(i.key))}function xS(e,t,n,r){if(Zf(e))for(let i of AS(n,t)){if(i.attached!==!0)continue;let s=e.list===!0&&e.repeatable!==!0?Ca(i.value):[i.value];for(let o of s){let a=Mi(Yt(o,"boolean"),"boolean");a!==null&&ac(e,"boolean",o,a.expected,r)}}}function RS(e,t,n,r,i){let s=Array.isArray(n)?n.flat(1/0):[n],o=r?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(let a of o)if(typeof a=="string"&&a.trim().length===0){let c=Mi(a,t);ac(e,t,a,c.expected,i)}}function dc(e,t,n,r){if(!cc(e,n))return t;let i=n==="boolean"&&Zf(e),s=o=>{let a=Mi(o,n);return a===null?o:i&&typeof o=="string"?!0:ac(e,n,o,a.expected,r)};return Array.isArray(t)?t.map(s):s(t)}function IS(e,t,n,r){for(let i of n)if(!(i===t||!Object.hasOwn(e,i))){if(Object.hasOwn(e,t)){if(r){let s=e[t],o=e[i];e[t]=[...Array.isArray(s)?s:[s],...Array.isArray(o)?o:[o]].filter(a=>a!=null)}delete e[i];continue}e[t]=e[i],delete e[i]}}function OS(e,t,n=e,r){if(t.length===0)return e;let i=Object.create(null);for(let[o,a]of Object.entries(e))i[o]=a;let s=new Set(t.map(o=>On(o)).filter(o=>o!==null));for(let o of t){let a=On(o);if(a){let c=Ar(o).filter(d=>d===a||!s.has(d));LS(i,o,a,c,n,r)}}return i}function LS(e,t,n,r,i,s){let o=t.list===!0,a=ws(t);a&&!o&&DS(e,t,n,r,a,s),IS(e,n,r,o);let c=t.repeatable===!0;if(!Object.hasOwn(e,n)){t.default!==void 0&&(e[n]=TS(t.default,a,o,c));return}if(a==="boolean"&&cc(t,a)&&xS(t,r,i,s),o){e[n]=NS(t,r,i,e[n],a,c,s);return}a&&(e[n]=dc(t,Yt(e[n],a),a,s))}function DS(e,t,n,r,i,s){for(let o of r)o!==n&&Object.hasOwn(e,o)&&dc(t,Yt(e[o],i),i,s)}function NS(e,t,n,r,i,s,o){let a=CS(n,t,r);i&&cc(e,i)&&RS(e,i,a,s,o);let c=Qf(a,i,s);return i?dc(e,c,i,o):c}function WU(e){let t=Object.create(null),n=[];Object.defineProperty(t,ys,{value:n});let r=0;for(;r<e.length;){let i=oc(e,r);if(!i){r+=1;continue}let s=In(i.key);if(s.length===0||gs(s)){r+=i.consumed;continue}vS(t,s,i.value),n.push({...i,key:s}),r+=i.consumed}return t}function KU(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let r=oc(e,n);if(r){n+=Math.max(1,r.consumed);continue}t.push(e[n]),n+=1}return t}function zU(e,t){if(t.length===0)return[...e];let n=new Set,r=new Set;for(let o of t){let a=ws(o);for(let c of Ar(o))n.add(c),a==="boolean"&&r.add(c)}if(n.size===0)return[...e];let i=[],s=0;for(;s<e.length;){if(e[s]==="--"){i.push(...e.slice(s+1));break}let o=oc(e,s);if(o){let a=In(o.key);if(n.has(a)){let c=e[s],d=r.has(a)&&!c.includes("=")?1:o.consumed;s+=d;continue}}i.push(e[s]),s+=1}return i}function lc(e){return On(e)}function Yf(e){return e.trim().toLowerCase().split(/\s+/u).filter(t=>t.length>0).join(" ")}function BU(e,t){let n=Yf(t);if(n.length===0)return[];let r=W(n);return e.flags.filter(i=>W(Yf(i.target_command))===r).flatMap(i=>[...i.flags])}function eh(e,t,n,r){let i=xr(e),[s,o]=n;throw new p(`Options '${s}' and '${o}' both set ${i} for extension command '${r}' with different values.`,m.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${i} once, under the handler key '${t}'.`,why:`'${s}' and '${o}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${o}' and pass one value as '${t}'.`,`Run pm contracts --command ${r} --flags-only --json to read each flag's sdk_option key.`]})}function HU(e,t,n){if(t.length===0)return e;let r=PS(t),i=US(e,r,n),s=new Set([...r.long.values()].map(({handlerKey:c})=>c)),o=Object.create(null),a=Object.create(null);for(let[c,d]of Object.entries(i))(s.has(c)?o:a)[c]=d;return $S(o,t,n),Object.assign(a,OS(o,t,MS(o,r),n))}function MS(e,t){let n=new Set([...t.long.values()].map(({handlerKey:s})=>s)),r=Object.entries(e).filter(([s])=>n.has(s)).flatMap(([s,o])=>(Array.isArray(o)?o.flat(1/0):[o]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),i=Object.create(null);return Object.defineProperty(i,ys,{value:r}),i}function $S(e,t,n){for(let r of t){let i=On(r);if(i===null)continue;let s=xr(r),o=Object.hasOwn(e,i);if(r.enabled===!1&&o)throw new p(`Option '${s}' is disabled for extension command '${n}'.`,m.USAGE);if(r.required===!0&&r.enabled!==!1&&!o)throw new p(`Missing required option '${s}' for extension command '${n}'.`,m.USAGE)}}function PS(e){let t={long:new Map,short:new Map},n=(r,i,s)=>{i.length>0&&!r.has(i)&&r.set(i,s)};for(let r of e){let i=On(r);if(i===null)continue;let s={handlerKey:i,definition:r};n(t.long,i,s);let o=typeof r.short=="string"?r.short.trim():"";o.startsWith("-")&&!o.startsWith("--")&&n(t.short,o.slice(1),s)}return t}function sc(e,t){return e.long.get(t)??e.short.get(t.replace(/^-(?!-)/u,""))??e.long.get(In(t.replace(/^-{1,2}/u,"")))}function FS(e,t,n){let r=/^(?:--)?no-(.+)$/u.exec(t)?.[1];if(r===void 0||sc(e,t)!==void 0)return{spelling:t,value:n};let i=sc(e,r),s=Xf(n);return i!==void 0&&ws(i.definition)==="boolean"&&typeof s=="boolean"?{spelling:r,value:!s}:{spelling:t,value:n}}function US(e,t,n){let r=Object.create(null),i=new Map;for(let[s,o]of Object.entries(e)){let{spelling:a,value:c}=FS(t,s,o),d=sc(t,a);if(d===void 0)r[a]=c;else if(c!==void 0){let l=i.get(d.handlerKey);l===void 0?(i.set(d.handlerKey,a),r[d.handlerKey]=c):Jf(r[d.handlerKey],c)||eh(d.definition,d.handlerKey,[l,a],n)}}return r}function jS(e){let t=new Map;for(let n of e){let r=On(n);if(r===null)continue;let i={definition:n,handlerKey:r,kind:ws(n),arity:or(n).value_arity,scalar:n.list!==!0},s=[gn(n.long),typeof n.short=="string"?n.short.trim():""];for(let o of s.filter(a=>a?.startsWith("-")===!0))t.has(o)||t.set(o,i)}return t}function GS(e,t,n){let r=e.optionOf(n),i=t.get(n),s=i?.scalar===!0?i:void 0;if(r!==void 0){let o={arity:r.arity,...r.variadic===!0?{variadic:!0}:{}};if(s?.handlerKey===r.key)return{...o,declared:s};let a=i===void 0&&n.startsWith("--no-")?t.get(`--${n.slice(5)}`):void 0;return a?.scalar===!0&&a.kind==="boolean"&&a.handlerKey===r.key?{...o,declared:a,negates:!0}:o}if(!(!e.includesLooseFlags||i===void 0))return s===void 0?{arity:i.arity,loose:!0}:{arity:i.arity,declared:s,loose:!0}}function uc(e){return e.length>1&&e.startsWith("-")}var th=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function qS(e,t,n){let{tokens:r}=e,i=0,s,o=!1,a=!1;for(;i<r.length||s!==void 0;){let c=s??r[i++];if(c==="--")return;if(a&&s===void 0&&WS(e,c))continue;let d=uc(c)?zS(e,c,r[i],t,n):{consumedByCommander:!1,consumed:0};if(i+=d.consumed,s=d.group,a=d.variadic===!0,!d.consumedByCommander){if(KS(e.stop,c,o))return;o=!0}}}function WS(e,t){return!uc(t)||e.negativeNumbersAreValues&&th.test(t)}function KS(e,t,n){return e!==void 0&&(e.atFirstUnrecognized||!n&&e.atSubcommand(t))}function zS(e,t,n,r,i){let s=BS(t,n,r);if(s!==void 0)return i(s.spelling,s.entry,s.value),{consumedByCommander:!1,consumed:s.consumed};let o=r(t);if(o!==void 0){let a=o.arity==="required"||o.arity==="optional"&&n!==void 0&&(!uc(n)||e.negativeNumbersAreValues&&th.test(n));return i(t,o,o.negates===!0?!1:a?n:!0),{consumedByCommander:!0,consumed:a?1:0,variadic:o.variadic===!0}}return t[1]!=="-"?{consumed:0,...HS(t,r,i)}:{consumedByCommander:VS(t,r,i,e.includesLooseFlags?i:()=>{}),consumed:0}}function BS(e,t,n){let r=e.indexOf("="),i=r>1?e.slice(0,r):e,s=n(i);if(s?.loose===!0)return r>1?{spelling:i,entry:s,value:e.slice(r+1),consumed:0}:t!==void 0&&!t.startsWith("-")?{spelling:i,entry:s,value:t,consumed:1}:{spelling:i,entry:s,value:!0,consumed:0};let o=r<0&&e.startsWith("--no-")?n(`--${e.slice(5)}`):void 0;return o?.loose===!0&&o.declared?.kind==="boolean"?{spelling:e,entry:o,value:!1,consumed:0}:void 0}function HS(e,t,n){let r=e.slice(0,2),i=e.length>2?t(r):void 0;return i===void 0||i.loose===!0?{consumedByCommander:!1}:i.arity!=="none"?(n(r,i,e.slice(2)),{consumedByCommander:!0}):(n(r,i,!0),{consumedByCommander:!0,group:`-${e.slice(2)}`})}function VS(e,t,n,r){let i=e.indexOf("=");if(i>2){let o=e.slice(0,i),a=t(o);return a!==void 0&&a.arity!=="none"?(n(o,a,e.slice(i+1)),!0):(a?.declared?.kind==="boolean"&&r(o,a,e.slice(i+1)),!1)}let s=e.startsWith("--no-")?t(`--${e.slice(5)}`):void 0;return s?.declared?.kind==="boolean"&&r(e,s,!1),!1}function VU(e,t,n){let r=jS(t),i=new Map;for(let s of e)qS(s,o=>GS(s,r,o),(o,a,c)=>{a.declared!==void 0&&YS(i,a.declared,o,c,n)})}function YS(e,t,n,r,i){let{definition:s,handlerKey:o,kind:a}=t,c=a?Yt(r,a):r,d=e.get(o)??new Map,l=[...d].find(([u,_])=>u!==n&&!Jf(_,c));l!==void 0&&eh(s,o,[l[0],n],i),d.set(n,c),e.set(o,d)}(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]="0c0bb7ab-6157-5861-ad7e-a63ae62220f4")}catch{}})();var JS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),XS=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]),QS=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])}),ZS=new Set(["extension","install","package","packages","upgrade"]);function eE(e){let t=W(e.trim().toLowerCase());if(t==="ops")return"quality";for(let[n,r]of Object.entries(QS))if(r.has(t))return n;return ZS.has(t)?"extensions":"internal"}var Ln=Object.freeze([...Je.flatMap(e=>e==="item"?["item","item-reopen"]:[e,...Ye.filter(t=>t.alias===e).map(t=>t.canonical)]).map(e=>({command:e,tier:JS.has(W(e))?"core":XS.has(W(e))?"standard":"full",family:eE(e)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]),tE=Ln,nh=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),QU=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);function ZU(e){let t=e===""?0:e.split(/\r?\n/).length,n=Buffer.byteLength(e,"utf8");return{lines:t,utf8_bytes:n,within_budget:t<=nh.max_lines&&n<=nh.max_utf8_bytes}}var rh={core:0,standard:1,full:2,internal:3},ih=new Map(tE.map(({command:e,tier:t})=>[e,t]));function mc(e,t="standard"){return ih.get(e.trim().toLowerCase())??ih.get(W(e.trim().toLowerCase()))??t}function ej(e){return sh(e,Ln)}function sh(e,t){let n=rh[e];return t.filter(r=>r.tier!=="internal"&&rh[r.tier]<=n).map(r=>r.command)}function tj(e){return oh(e,Ln)}function oh(e,t){return t.filter(n=>n.family===e).map(n=>n.command)}var nE=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],rE=new Set([...Ft.filter(e=>e.hidden).map(e=>e.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function nj(e=Ln){return nE.map(t=>({family:t,commands:oh(t,e).filter(n=>e.find(r=>r.command===n)?.tier!=="internal"&&!rE.has(n))})).filter(({commands:t})=>t.length>0)}var iE=Object.freeze({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_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});function rj(e,t){return sE(e,t,Ln)}function sE(e,t,n){if(t==="full")return[...e];let r=new Set(sh(t,n));return e.filter(i=>{let s=iE[i];return s!==void 0&&r.has(s)})}var ij=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]),sj=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:!0},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:!1}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0},{name:"evidence",description:"Exact verification and outcome evidence.",required:!0}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);function oj(){return oE(Ln)}function oE(e){return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...e.map(({command:t,tier:n,family:r})=>`| \`${t}\` | ${n} | ${r} |`),""].join(`
|
|
2
2
|
`)}(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]="7df4fe91-e8a4-540f-8737-c67f2efa460e")}catch{}})();var pc=[{exit_code:1,class:"generic_failure"},{exit_code:2,class:"usage"},{exit_code:3,class:"not_found"},{exit_code:4,class:"conflict"},{exit_code:5,class:"dependency_failed"}],aE=new Map(pc.map(e=>[e.exit_code,e.class]));function vs(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort()}function cE(e){if(!e)return[];let t=new Set,n=new Set;return e.map(r=>{let i=r.state.trim(),s=r.probe_id.trim(),o=vs(r.entrypoints);if(!/^[a-z][a-z0-9_]*$/.test(i)||!/^[a-z][a-z0-9-]*$/.test(s)||o.length===0||t.has(i)||n.has(s))throw new TypeError("Invalid pm refusal state contract");return t.add(i),n.add(s),{state:i,probe_id:s,entrypoints:o,expected_exit_class:r.expected_exit_class}}).sort((r,i)=>r.state.localeCompare(i.state))}function dE(e,t,n,r,i){return![[1,2,3,4,5].includes(e.exit_code),e.meaning.trim().length>0,e.recovery.trim().length>0,t.length>0,n.length>0,/^[a-z][a-z0-9_]*$/.test(r),i.every(s=>/^[a-z][a-z0-9_]*$/.test(s)),aE.get(e.exit_code)===e.class].includes(!1)}function lE(e,t){let n=e,r=new Set;for(;n.canonical_code!==n.code;){if(r.has(n.code))throw new TypeError(`Alias cycle in pm error code catalog: ${e.code}`);r.add(n.code);let i=t.get(n.canonical_code);if(!i)throw new TypeError(`Invalid pm error code contract: ${e.code}`);n=i}return n}function uE(e){let t=new Map(e.map(n=>[n.code,n]));for(let n of e){let r=lE(n,t);if(r.exit_code!==n.exit_code||r.class!==n.class)throw new TypeError(`Alias transport mismatch for pm error code: ${n.code}`);let i=e.filter(s=>s.code!==r.code&&s.canonical_code===r.code).map(s=>s.code).sort();if(n.code===r.code?JSON.stringify(n.aliases)!==JSON.stringify(i):n.aliases.length>0)throw new TypeError(`Invalid pm error code contract: ${n.code}`)}}function ch(e){let t=new Set,n=e.map(r=>{let i=r.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(i))throw new TypeError(`Invalid pm error code: ${JSON.stringify(r.code)}`);if(t.has(i))throw new TypeError(`Duplicate pm error code: ${i}`);t.add(i);let s=vs(r.sources),o=vs(r.emitting_commands),a=(r.canonical_code??i).trim(),c=vs(r.aliases??[]),d=cE(r.owned_states);if(!dE(r,s,o,a,c))throw new TypeError(`Invalid pm error code contract: ${i}`);if(d.some(l=>l.expected_exit_class!==r.class))throw new TypeError(`Invalid pm refusal state exit class: ${i}`);return Object.freeze({...r,code:i,meaning:r.meaning.trim(),recovery:r.recovery.trim(),sources:s,emitting_commands:o,canonical_code:a,aliases:c,owned_states:d})});return uE(n),Object.freeze(n.sort((r,i)=>r.code.localeCompare(i.code)))}function cj(e,t){let n=ah(e,t);return ah(n.canonical_code??n.code,t)}function ah(e,t){let n=e.trim(),r=t.find(i=>i.code===n);if(!r)throw new TypeError(`Unknown pm error code "${n}"`);return r}(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]="0b0d726a-0fd5-5196-bee1-d34c433c0016")}catch{}})();var mE="Inspect the structured error guidance, then retry the suggested command when one is present.",pE=new Map(pc.map(e=>[e.exit_code,e.class]));function dh(e){return e.map(t=>{let n=`${t.code.replaceAll("_"," ")} condition.`,r={code:t.code,meaning:`${n.charAt(0).toUpperCase()}${n.slice(1)}`,stability:t.stable?"stable":"provisional",exit_code:t.exit_code,class:pE.get(t.exit_code),recovery:mE,sources:t.sources,emitting_commands:t.emitting_commands??["*"],canonical_code:t.canonical_code??t.code,aliases:t.aliases??[]};return t.owned_states&&(r.owned_states=t.owned_states),r})}(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]="84712a38-e3a5-542c-8f9b-76f7e83cc725")}catch{}})();var lh=[{code:"acceptance_criteria_mutation_conflict",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_remove_unmatched",exit_code:3,sources:["sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_semicolon_forbidden",exit_code:2,stable:!0,sources:["core/item/parse.ts"]},{code:"accepted_rejected_value",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"alias_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"alias_target_missing",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"already_claimed_by",exit_code:4,stable:!0,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"ambiguous_option_combination",exit_code:2,stable:!0,sources:["sdk/lifecycle/claim.ts","sdk/lifecycle/plan.ts"],emitting_commands:["claim","plan"]},{code:"annotation_alias_conflict",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"annotation_entry_mismatch",exit_code:4,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_invalid",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_without_target",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_flag_like_value",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_if_absent_without_append",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_text_source_conflict",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"annotation_transposed_subcommand",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"append_empty_body",exit_code:2,stable:!0,sources:["sdk/lifecycle/append.ts"],emitting_commands:["append"]},{code:"assurance_registry_invalid",exit_code:1,sources:["sdk/governance/assurance.ts"]},{code:"bare_comma_entry_ambiguous",exit_code:2,sources:["core/item/parse.ts"]},{code:"blocker_identity_read_failed",exit_code:1,sources:["sdk/query/declared-blockers.ts"]},{code:"body_file_conflicts_with_body",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",exit_code:3,stable:!0,sources:["core/io/body-file.ts"]},{code:"budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"bulk_create_route",exit_code:2,sources:["cli/register-mutation.ts"]},{code:"bulk_ids_input_empty",exit_code:2,sources:["core/io/bulk-ids-input.ts","sdk/history-compact.ts","sdk/history-mcp.ts"],owned_states:[{state:"bulk_ids_stdin_contains_no_nonempty_ids",probe_id:"bulk-ids-stdin-empty",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_missing_path",exit_code:2,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_token_omits_its_path",probe_id:"bulk-ids-file-path-missing",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_unreadable",exit_code:3,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_path_cannot_be_read",probe_id:"bulk-ids-file-unreadable",entrypoints:["update-many"],expected_exit_class:"not_found"}]},{code:"bundle_integrity_torn_install",exit_code:1,stable:!0,sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"capability_unused",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",exit_code:1,stable:!0,sources:["sdk/item-children.ts"]},{code:"close_reason_required",exit_code:2,stable:!0,sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"],emitting_commands:["*","close-many"]},{code:"close_through_update",exit_code:1,stable:!0,sources:["core/telemetry/observability.ts"]},{code:"close_validation_missing_fields",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"collected_zero_items",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"collection_transposed_subcommand",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"command_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"command_namespace",exit_code:2,stable:!0,sources:["sdk/cli-contracts/runtime-contracts.ts"]},{code:"command_override_conflict",exit_code:4,stable:!0,sources:["sdk/compose.ts"]},{code:"config_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"config_key_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts","sdk/config.ts"]},{code:"config_value_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"conflicting_lifecycle_owner",exit_code:2,stable:!0,sources:["cli/register-operations.ts"]},{code:"context_evaluation_read_incomplete",exit_code:2,sources:["sdk/context-relevance.ts"]},{code:"context_signal_store_invalid",exit_code:2,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_stale",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_write_failed",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_takes_no_item_argument",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"core_item_field_requires_dedicated_flag",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"create_positional_type_without_title",exit_code:2,stable:!0,sources:["cli/register-mutation.ts"]},{code:"dependency_cardinality_created",exit_code:2,sources:["sdk/graph/cardinality-integrity.ts"]},{code:"dependency_edge_not_allowed",exit_code:2,stable:!0,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_flag_value_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_remove_no_match",exit_code:3,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"dependency_target_not_found",exit_code:3,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_temporal_order_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"duplicate_canonical_flag",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"duplicate_command",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"duplicate_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"duplicate_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"duplicate_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"duplicate_probe",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"duplicate_sweep_cost_limit",exit_code:4,stable:!0,sources:["sdk/query/duplicate-candidates.ts"],emitting_commands:["duplicate-candidates"]},{code:"duplicate_target_circular",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_is_duplicate",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_missing",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_self",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"empty_corpus",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"empty_surface",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"event_cursor_query_mismatch",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"event_history_integrity_failed",exit_code:1,sources:["core/history/event-index.ts"]},{code:"event_index_unavailable",exit_code:1,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"exit_code_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"expect_hash_background_unsupported",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invalid",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invocation_rewritten",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_requires_mutation",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_target_required",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expected_revision_duplicate",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"expected_revision_scope_conflict",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"extension_command_activation_failed",exit_code:1,stable:!0,sources:["cli/commander-usage.ts"]},{code:"extension_dependency_name_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_spec_invalid",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_version_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_flag_value_invalid",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_install_incomplete_source_scan",exit_code:2,sources:["sdk/extension/install-plan.ts"]},{code:"extension_install_rollback_failed",exit_code:1,sources:["sdk/extension/install-snapshot.ts"]},{code:"extension_install_soft_failed",exit_code:1,stable:!0,sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",exit_code:2,stable:!0,sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_option_spelling_conflict",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_read_output_invalid",exit_code:2,sources:["sdk/read-output/extension.ts"]},{code:"extension_update_health_partial_coverage",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"extensions_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"field_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_mcp_input_collision",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"github_source_entry_unbuilt",exit_code:2,stable:!0,sources:["sdk/extension/shared.ts"]},{code:"hierarchy_cardinality_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_cycle_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_parent_divergence_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"history_author_acknowledge_plan_conflict",exit_code:4,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_plan_fingerprint_required",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_preview_limit_invalid",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_required_values_missing",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_conflict",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_required",exit_code:2,stable:!0,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_not_actionable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_unreadable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_baseline_unavailable",exit_code:1,sources:["core/history/projection.ts"]},{code:"history_drift_chain_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_chain_mismatches"]},{code:"history_drift_hash_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_hash_mismatches"]},{code:"history_drift_merge_receipt",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_missing_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_missing_streams"]},{code:"history_drift_unreadable_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_unreadable_streams"]},{code:"history_drift_version_skew",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_version_skews"]},{code:"history_json_invalid",exit_code:1,sources:["core/history/read.ts"]},{code:"history_merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/history/read.ts"],canonical_code:"merge_conflict_markers_detected"},{code:"history_replay_invalid",exit_code:1,sources:["core/history/projection.ts","core/history/tombstone.ts"]},{code:"history_salvage_refused",exit_code:4,sources:["sdk/history/salvage.ts"]},{code:"history_stream_over_compact_threshold",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"history_target_out_of_range",exit_code:1,stable:!0,sources:["core/history/projection.ts"]},{code:"history_timestamp_invalid",exit_code:1,sources:["core/history/event-index.ts","core/history/history.ts"]},{code:"history_union_rebase_conflict",exit_code:4,sources:["sdk/merge/history-scalar-rebase.ts"]},{code:"history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_unknown_author_events"]},{code:"history_version_mapping_unavailable",exit_code:2,sources:["core/history/version-address.ts"]},{code:"history_version_pruned",exit_code:2,sources:["core/history/projection.ts"]},{code:"host_environment_capacity_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_operation_invalid",exit_code:2,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_permission_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_resource_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"improvement_metric_contract_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"improvement_observation_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"incomplete_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"inconsistent_concept_kind",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"init_existing_settings_requires_force",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_gitignore_unwritable",exit_code:1,stable:!0,sources:["sdk/workspace.ts"]},{code:"init_id_prefix_conflict",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_id_prefix_path_like",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"integrity_history_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_history_conflict_markers"]},{code:"integrity_history_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_history_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_ahead_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_ahead_items"]},{code:"integrity_item_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_outdated_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_outdated_items"]},{code:"integrity_item_parse_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"invalid_argument_value",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/item/priority.ts","core/telemetry/observability.ts","sdk/config.ts","sdk/context-intent-contracts.ts","sdk/dependencies.ts","sdk/governance/assurance-mutation-error.ts","sdk/history-redact.ts","sdk/lifecycle/create.ts","sdk/lifecycle/task-composition.ts","sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts","sdk/query/next.ts","sdk/runtime-input.ts","sdk/runtime/mutation-admission.ts","sdk/runtime/mutation-value-validation.ts","sdk/runtime/schema-preview.ts","sdk/workspace.ts"],emitting_commands:["*","create","next","task-composition","update","update-many"]},{code:"invalid_command_usage",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"invalid_event_cursor",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_cursor_mode",exit_code:2,sources:["cli/register-list-query.ts","sdk/mutation-events.ts","sdk/runtime-extended-actions.ts"]},{code:"invalid_event_follow_interval",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_limit",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_since",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_history_analytics_limit",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_minimum_sample",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_since",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_improvement_ledger",exit_code:1,sources:["sdk/improvement-ledger-validation.ts"]},{code:"invalid_improvement_metric",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_limit",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_timestamp",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_provenance_predicate",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"invalid_query_cursor",exit_code:2,stable:!0,sources:["sdk/pagination.ts","sdk/query/window-pagination.ts"]},{code:"invalid_read_output_session",exit_code:2,sources:["sdk/read-output-session.ts"]},{code:"invalid_reproducible_process_environment",exit_code:2,sources:["sdk/reproducibility/process.ts"]},{code:"invalid_workspace_snapshot_target",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"item_already_active",exit_code:4,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"item_already_exists",exit_code:4,stable:!0,sources:["sdk/lifecycle/create.ts"],emitting_commands:["create"]},{code:"item_deleted",exit_code:3,sources:["core/history/tombstone.ts"]},{code:"item_document_encoding_invalid",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_document_invalid",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_document_roundtrip_failed",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_format_version_unsupported",exit_code:4,sources:["core/item/item-format.ts"]},{code:"item_id_collision",exit_code:4,stable:!0,sources:["sdk/lifecycle/copy.ts"],emitting_commands:["copy"]},{code:"item_identity_ambiguous",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_identity_conflict",exit_code:4,sources:["sdk/governance/validate-history-drift.ts","sdk/lifecycle/item-revision.ts","sdk/merge/three-way.ts","sdk/query/declared-blockers.ts"]},{code:"item_identity_reserved",exit_code:4,sources:["core/history/history.ts"]},{code:"item_not_found",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/item-store.ts","core/telemetry/observability.ts","sdk/governance/validate-history-drift.ts"]},{code:"item_revision_conflict",exit_code:4,sources:["core/store/item-mutation-precondition.ts"]},{code:"likely_duplicate",exit_code:4,stable:!0,sources:["sdk/similarity.ts"]},{code:"linked_artifact_mutation_conflict",exit_code:2,sources:["sdk/linked-artifacts.ts"]},{code:"linked_resource_positional_value",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"linked_test_command_immutable",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_command_not_executable",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_context_invalid",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_patch_fields_unsupported",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_remove_no_match",exit_code:3,sources:["sdk/test/execution.ts"]},{code:"linked_test_update_ambiguous",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_update_no_match",exit_code:3,sources:["sdk/test/update.ts"]},{code:"linked_test_value_not_quoted",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"list_source_incomplete",exit_code:1,stable:!0,sources:["sdk/query/list.ts"],emitting_commands:["list"]},{code:"local_package_archive_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"local_source_not_found_bare_name",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"lock_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/lock/lock.ts","core/telemetry/observability.ts"]},{code:"lock_lost",exit_code:4,sources:["core/lock/lock.ts"]},{code:"lock_path_unsafe",exit_code:4,sources:["core/lock/lock-confinement.ts"]},{code:"locks_stale_count",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"locks_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"malformed_plan_step_evidence",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"managed_state_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"managed_state_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_capabilities_absent",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"manifest_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_unknown_key",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_declares_an_unknown_top_level_key",probe_id:"author-manifest-unknown-key",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"manifest_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"mcp_annotation_file_unavailable",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"mcp_stdin_unavailable",exit_code:2,sources:["sdk/annotations.ts"]},{code:"mcp_task_not_found_or_not_authorized",exit_code:3,sources:["sdk/mcp/tasks.ts"]},{code:"merge_artifacts_ignored",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_bun_launcher_unavailable",exit_code:5,sources:["sdk/merge/install.ts"]},{code:"merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/item/item-format.ts"],aliases:["history_merge_conflict_markers_detected"]},{code:"merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_fence_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_fence_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_git_config_unwritable",exit_code:5,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_receipt_evidence_invalid",exit_code:4,sources:["core/diagnostics/remediation.ts","sdk/merge/reconcile.ts"]},{code:"merge_receipt_history_reference_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_receipt_not_portable",exit_code:4,sources:["sdk/merge/receipts.ts"]},{code:"merge_receipts_pending",exit_code:1,sources:["core/diagnostics/remediation.ts"]}];(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]="853917f6-6746-52c8-a2ce-df083ecbe6a6")}catch{}})();var uh=[{code:"merge_reconcile_receipt_evidence_untrusted",exit_code:4,sources:["sdk/history-repair.ts"]},{code:"merge_root_not_found",exit_code:3,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_settlement_hook_conflict",exit_code:4,sources:["sdk/merge/settlement-hook.ts"]},{code:"merge_settlement_review_required",exit_code:4,sources:["sdk/merge/ignored-artifacts.ts","sdk/merge/reconcile.ts","sdk/merge/stage.ts"]},{code:"missing_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"missing_cli_flag",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_directory",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"missing_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_lifecycle_target",exit_code:2,stable:!0,sources:["sdk/extension.ts"]},{code:"missing_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"missing_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_parameter_alias",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_positive_execution_receipt",exit_code:1,sources:["sdk/test/execution.ts"]},{code:"missing_probe",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_required_argument",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","cli/schema/registration.ts","core/telemetry/observability.ts","sdk/governance/assurance-action.ts","sdk/history-redact.ts","sdk/invocation-author.ts","sdk/lifecycle/claim.ts"],emitting_commands:["*","claim"]},{code:"missing_required_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/context-intent-contracts.ts","sdk/lifecycle/create.ts","sdk/lifecycle/plan.ts"],emitting_commands:["*","create","plan"]},{code:"missing_suggested_retry",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_suggested_retry_args",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"module_import_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"multi_target_github_install_ambiguous",exit_code:2,stable:!0,sources:["cli/register-setup.ts"]},{code:"mutation_author_required",exit_code:2,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"mutation_document_unreadable",exit_code:2,sources:["cli/register-structured-mutation.ts"]},{code:"mutation_option_value_invalid",exit_code:2,sources:["sdk/lifecycle/mutation-option-validation.ts"],emitting_commands:["item mutate"]},{code:"mutation_secret_guard_blocked",exit_code:4,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"no_matching_tests",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_projects_matched_filters",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_test_files_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_tests_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_update_fields",exit_code:1,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"no_version_bounds_declared",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_omits_canonical_pm_version_bounds",probe_id:"author-manifest-version-bounds-missing",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"non_refusal_exit",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"npm_pack_json_shape_unsupported",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_missing",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_unsafe",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_not_found",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"ownership_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/annotations.ts"]},{code:"ownership_dependency_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"ownership_metadata_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"package_spec_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"package_upgrade_modes_mutually_exclusive",exit_code:2,sources:["sdk/governance/upgrade.ts"]},{code:"positional_shape_budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"positional_signature_mismatch",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"profile_name_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_name_not_normalized",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_summary_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_title_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"project_runtime_history_epoch_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_item_format_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_mutation",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_read",exit_code:1,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_schema_field_requires_declared_flag",exit_code:2,sources:["core/extensions/item-fields.ts"]},{code:"projection_options_mutually_exclusive",exit_code:2,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"provenance_value_domain_invalid",exit_code:2,sources:["core/diagnostics/remediation.ts"]},{code:"read_output_cursor_command_mismatch",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_invalid",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_stale",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_mutation_conflict",exit_code:2,sources:["sdk/read-output-contracts.ts"]},{code:"recovery_kind_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"redundant_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"refusal_allowed_values_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_exit_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_mutated_state",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_probe_missing",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_recovery_failed",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"reindex_already_running",exit_code:4,stable:!0,sources:["sdk/governance/reindex.ts"]},{code:"removed_canonical_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"removed_compatibility_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"reopen_reason_required",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reopen_receipt_missing",exit_code:1,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"reopen_target_status_invalid",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reported_zero_passes",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reported_zero_tests",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reserved_item_field",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"retry_failed",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"schema_migration_input_required",exit_code:2,stable:!0,sources:["cli/migration-gates.ts"]},{code:"semantic_spelling_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"settings_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_read_fs_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_schema",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_merge_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_section_document_malformed",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_document_missing",exit_code:3,sources:["core/store/settings-sections.ts"]},{code:"settings_section_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_name_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_reserved",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_revision_conflict",exit_code:4,sources:["core/store/settings-sections.ts"]},{code:"settings_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_write_assigned_path_invalid",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_json",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_schema",exit_code:2,sources:["core/store/settings.ts"]},{code:"stale_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"stale_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_revision",exit_code:4,sources:["core/store/item-store.ts"]},{code:"start_blocked_by_open_dependency",exit_code:4,sources:["sdk/lifecycle/start-blockers.ts"],emitting_commands:["claim","start-task","update"]},{code:"status_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_lifecycle_role_required",exit_code:2,sources:["sdk/schema.ts"]},{code:"stdin_json_invalid",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"stdin_json_persisted_annotation_changed",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"stdin_json_unknown_key",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"structured_event_immutable",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"structured_event_input_conflict",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_empty",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_since_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"suggested_retry_args_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"telemetry_endpoint_probe_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_endpoint_probe_http_status",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_otel_export_failing",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_high_retries",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_invalid_rows",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_pending",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_schema_version_behind",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_state_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"template_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"terminal_plan_mutation",exit_code:4,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"terminal_state_conflict",exit_code:4,stable:!0,sources:["core/telemetry/observability.ts","sdk/lifecycle/claim.ts"],emitting_commands:["*","claim"]},{code:"test_measure_requires_execution",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"test_measure_requires_run",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"text_unpaired_surrogate",exit_code:2,sources:["core/item/item-format.ts","core/shared/output-unicode.ts"]},{code:"tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_tracked_runtime_cache_files"]},{code:"tracker_not_initialized",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/tracker-preflight.ts","core/telemetry/observability.ts"],owned_states:[{state:"selected_tracker_root_exists_without_settings",probe_id:"tracker-root-settings-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_missing",exit_code:3,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_does_not_exist",probe_id:"tracker-root-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_not_directory",exit_code:2,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_a_regular_file",probe_id:"tracker-root-not-directory",entrypoints:["list"],expected_exit_class:"usage"}]},{code:"tracker_root_unreadable",exit_code:1,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_not_readable",probe_id:"tracker-root-unreadable",entrypoints:["list"],expected_exit_class:"generic_failure"}]},{code:"transaction_abandoned",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_committed",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_create_compensated",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_journal_invalid",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_partial_mutation",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_plan_mismatch",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_preview_external_schema",exit_code:2,sources:["sdk/item-transaction.ts"]},{code:"transaction_preview_non_regular_file",exit_code:2,sources:["core/fs/fs-utils.ts"]},{code:"transaction_preview_snapshot_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_recovery_plan_missing",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"type_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"type_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"undeclared_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"unexpected_refusal_probe",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"unknown_command",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/cli-contracts/runtime-contracts.ts"]},{code:"unknown_context_intent",exit_code:2,stable:!0,sources:["sdk/context-intent-contracts.ts"]},{code:"unknown_error",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"unknown_field",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_field_projection",exit_code:2,stable:!0,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"unknown_item_type",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_lifecycle_action",exit_code:2,stable:!0,sources:["sdk/agent/subcommand-recovery.ts"],canonical_code:"unknown_subcommand"},{code:"unknown_noun",exit_code:2,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"unknown_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/runtime/invocation-options.ts","core/telemetry/observability.ts","sdk/extension/command-options.ts"],owned_states:[{state:"declared_option_is_rejected_on_the_selected_command_path",probe_id:"cross-command-unknown-option",entrypoints:["deps"],expected_exit_class:"usage"}]},{code:"unknown_plan_template",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"unknown_provenance_dimension",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"unknown_status",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_subcommand",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","sdk/agent/subcommand-recovery.ts"],aliases:["unknown_lifecycle_action"],owned_states:[{state:"config_action_token_is_not_declared",probe_id:"config-unknown-action",entrypoints:["config"],expected_exit_class:"usage"},{state:"graph_command_token_is_not_declared",probe_id:"graph-unknown-subcommand",entrypoints:["graph"],expected_exit_class:"usage"},{state:"nested_command_token_is_not_declared_by_its_family",probe_id:"schema-unknown-subcommand",entrypoints:["schema"],expected_exit_class:"usage"},{state:"package_lifecycle_token_is_not_declared",probe_id:"package-unknown-action",entrypoints:["package"],expected_exit_class:"usage"}]},{code:"unsafe_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"unsupported_update_option",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"upsert_key_ambiguous",exit_code:4,sources:["sdk/structured-mutations.ts"]},{code:"upsert_key_conflict",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"upsert_key_duplicate",exit_code:2,sources:["sdk/item-transaction.ts","sdk/structured-mutations.ts"]},{code:"upsert_key_missing",exit_code:2,sources:["sdk/structured-mutations.ts"]},{code:"upsert_match_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"validate_command_references_stale_pm_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_ahead_format_version"},{code:"validate_format_version_outdated_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_outdated_format_version"},{code:"validate_hierarchy_parent_cycle",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_chain_mismatch"},{code:"validate_history_drift_hash_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_hash_mismatch"},{code:"validate_history_drift_missing_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_missing_stream"},{code:"validate_history_drift_unreadable_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_unreadable_stream"},{code:"validate_history_drift_version_skews",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_version_skew"},{code:"validate_history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_unknown_author_events"},{code:"validate_lifecycle_active_closure_like_metadata",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_driver_configuration",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_closed_at",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_duplicate_item_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_history_conflict_markers",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_history_conflict_marker"},{code:"validate_storage_resurrected_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"tracked_runtime_cache_files"},{code:"validate_storage_unparseable_config",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unparseable_history",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unreadable_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_embedding_identity_changed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_stale_items_remaining",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"visible_surface_ceiling_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"workflow_duplicate_type",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_policy_approval_history_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_audit_failed",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_input_unreadable",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_invalid",exit_code:2,sources:["core/policy/workflow-policy.ts"]},{code:"workflow_policy_refused",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_registry_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_status_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_transition_malformed",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workspace_history_chain_invalid",exit_code:4,sources:["core/history/workspace-history.ts"]},{code:"workspace_history_state_conflict",exit_code:4,stable:!0,sources:["core/history/workspace-history.ts"]},{code:"workspace_root_pm_path",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"workspace_snapshot_force_required",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_manifest_mismatch",exit_code:4,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_name_reserved_fingerprint",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_not_found",exit_code:3,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_permission_denied",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_resource_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_storage_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"wrong_item_type",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]}];(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]="b525d8c8-3a70-52bd-83db-c956aba0c6fb")}catch{}})();var mh=ch(dh([...lh,...uh]));(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]="76c420db-b520-5fde-bd43-16a7324feb0a")}catch{}})();var _E=["mutation_receipt","entity","collection","diagnostic","stream"],fE=new Set(["append","claim","close","close-task","copy","create","delete","focus","pause-task","release","restore","start-task","update"]),hE=new Set(["close-many","update-many"]),gE=new Set(["activity","comments","contracts","events","history","learnings","list","notes","search"]),yE=new Set(["aggregate","deps","graph","health","history-redact","history-repair","history-compact","stats","validate"]);function Rr(e){if(e.command.trim().length===0)throw new TypeError("command must be a non-empty command path");if(!_E.includes(e.kind))throw new TypeError(`Unsupported output envelope kind: ${e.kind}`);return e}function ph(e){let t=e.trim().replace(/\s+/gu," "),[n=t]=t.split(" ");return hE.has(n)?Rr({command:t,kind:"collection",wrapper_key:"rows",cardinality:"many",format_flag:"--json"}):fE.has(n)?Rr({command:t,kind:"mutation_receipt",wrapper_key:null,cardinality:"one",format_flag:"--json"}):gE.has(n)?Rr({command:t,kind:"collection",wrapper_key:n==="contracts"?null:"items",cardinality:"many",format_flag:"--json"}):yE.has(n)?Rr({command:t,kind:"diagnostic",wrapper_key:null,cardinality:"none",format_flag:"--json"}):Rr({command:t,kind:n==="get"?"entity":"diagnostic",wrapper_key:n==="get"?"item":null,cardinality:n==="get"?"one":"none",format_flag:"--json"})}var wE=Je.map(e=>ph(e)),vE=new Map(wE.map(e=>[e.command,e]));function _h(e){let t=e.trim().replace(/\s+/gu," ");if(t.length===0)throw new TypeError("command must be a non-empty command path");let[n=t]=bi(t).split(" "),r=vE.get(n);return r?{...r,command:t}:ph(t)}function bE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function kE(e){return bE(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.status=="string"&&e.status.length>0&&Number.isSafeInteger(e.changed_field_count)&&Number(e.changed_field_count)>=0&&(e.close_reason===void 0||typeof e.close_reason=="string")&&(e.deleted===void 0||typeof e.deleted=="boolean")&&(e.previous_status===void 0||typeof e.previous_status=="string")&&(e.warnings===void 0||Array.isArray(e.warnings))}function bj(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(n){throw new TypeError(`Mutation receipt must be valid JSON: ${String(n)}`,{cause:n})}if(!kE(t))throw new TypeError("Mutation receipt must be a flat object with top-level id, status, and changed_field_count fields");return{id:t.id,status:t.status,changedFieldCount:t.changed_field_count,...typeof t.close_reason=="string"?{closeReason:t.close_reason}:{},...typeof t.deleted=="boolean"?{deleted:t.deleted}:{},...typeof t.previous_status=="string"?{previousStatus:t.previous_status}:{},...Array.isArray(t.warnings)?{warnings:t.warnings}:{}}}(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]="7c95b311-b408-50f7-87e8-2c2fa2323092")}catch{}})();var _c=[{exit_code:m.SUCCESS,outcome:"effect",success:!0,meaning:"The requested operation completed with its intended effect."},{exit_code:m.GENERIC_FAILURE,outcome:"internal_failure",success:!1,meaning:"An unexpected runtime or internal failure prevented completion."},{exit_code:m.USAGE,outcome:"refused_input",success:!1,meaning:"The invocation was refused because its input or composition was invalid."},{exit_code:m.NOT_FOUND,outcome:"refused_tracker_state",success:!1,meaning:"The requested tracker, item, or resource was not present."},{exit_code:m.CONFLICT,outcome:"conflict",success:!1,meaning:"Current state or concurrency prevented the requested effect."},{exit_code:m.DEPENDENCY_FAILED,outcome:"dependency_failed",success:!1,meaning:"A required dependency operation failed."},{exit_code:m.NO_EFFECT,outcome:"no_effect",success:!0,meaning:"The request was valid and completed, but matched nothing to change."},{exit_code:m.PARTIAL_EFFECT,outcome:"partial_effect",success:!0,meaning:"The request completed and changed some, but not all, selected targets."}],fh=[m.SUCCESS,m.GENERIC_FAILURE,m.USAGE,m.NOT_FOUND,m.CONFLICT,m.DEPENDENCY_FAILED],SE=new Set(["close-many","update-many"]),gh=Je.map(e=>({command:e,exit_codes:SE.has(e)?[...fh,m.NO_EFFECT,m.PARTIAL_EFFECT]:[...fh]})),hh=new Map(gh.map(e=>[e.command,e])),EE=[m.SUCCESS,m.NO_EFFECT,m.PARTIAL_EFFECT];function Tj(e){return EE.includes(e)}function Cj(e){return _c.some(t=>t.exit_code===e)}function yh(e){let t=e.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(" ");return hh.get(t)??hh.get(t.split(" ")[0])}function Aj(e,t=Je,n=gh){let r=new Map(n.map(c=>[c.command,c])),i=t.filter(c=>!r.has(c)),s=e.filter(c=>{let d=r.get(c.command)??r.get(c.command.split(" ")[0]);return d===void 0||!d.exit_codes.includes(c.exit_code)}),o=new Set(e.map(c=>c.exit_code)),a=[...new Set(n.flatMap(c=>c.exit_codes))].filter(c=>!o.has(c)).sort((c,d)=>c-d);return{ok:i.length===0&&s.length===0&&a.length===0,missing_commands:i,undeclared_observations:s,unreachable_exit_codes:a}}function xj(e){return e.applied===0&&e.failed>0?{outcome:"dependency_failed",exit_code:m.DEPENDENCY_FAILED}:e.applied===0?{outcome:"no_effect",exit_code:m.NO_EFFECT}:e.skipped>0||e.failed>0||e.unmatched>0?{outcome:"partial_effect",exit_code:m.PARTIAL_EFFECT}:{outcome:"effect",exit_code:m.SUCCESS}}(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]="081bf1eb-4b9a-5fa9-a272-34ae781d250c")}catch{}})();var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Re=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},nt=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Dn(e){try{return await e()}catch(t){throw t instanceof L?new p(t.message,m.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function fc(e){try{return await e()}catch(t){throw t instanceof Re?new p(t.message,m.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as TE}from"node:crypto";import CE 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]="b00dcab2-22c6-55b7-b93d-f6f5413d4b04")}catch{}})();var Nn=1e3;(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]="eaede7d4-43ae-5551-915e-19befefc29d0")}catch{}})();var vh=1,_t=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Ir=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],AE=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],xE=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,bs=30,ks=5e3,bh=4,RE=50;function ft(e,t){if(!xE.test(e))throw new L(`${t} must be a stable lowercase id`)}function IE(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function Or(e){let t=AE.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function gc(e,t){return ne(e)===ne(t)}function kh(e,t){if(t.polarity==="equals")return gc(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function Sh(e){let t=Or(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>kh(r.observed,t)===(r.expected==="pass"))}function OE(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!gc(e.value,t.value)}function LE(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||ne(e.scope)!==ne(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return OE(Or(e),Or(t))||n[t.enforcement]<n[e.enforcement]||r}function DE(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function NE(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(t=>t!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function ME(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function yc(e){ft(e.id,"measurement.id"),e.max_cost!==void 0&&IE(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Ir.join(", ")}`);let n=Reflect.get(t,"kind");if(!Ir.includes(n))throw new L(`measurement.source.kind must be one of ${Ir.join(", ")}`);let r=t;if(r.kind==="items"&&DE(r),r.kind==="dependency_kind"&&NE(r),r.kind==="prose_edge_gap"&&ME(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(ft(r.provider,"provider source provider"),ft(r.key,"provider source key")),e}function wc(e){if(ft(e.id,"assertion.id"),ft(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=Or(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&ft(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!Sh(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function $E(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)ft(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!_t.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Eh(e){if(ft(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)ft(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${_t.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!_t.includes(t))throw new L(`gate trigger must be one of ${_t.join(", ")}`);return e.provider_policy&&$E(e.provider_policy),e}function Mn(e){if(e.version!==vh)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(yc(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(wc(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Eh(r);let i=r.assertion_ids.filter(s=>!e.assertions.some(o=>o.id===s));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Th(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function vc(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)vc(n,t)}function Th(e){let t=new Map,n=(r,i)=>{let s=t.get(r)??[];s.push(i),t.set(r,s)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];vc(r.source.expression,i);for(let s of i)n(s,`derived measurement ${r.id}`)}return t}function PE(e,t){let n=e.assertion_ids.flatMap(s=>{let o=t.assertions.find(a=>a.id===s);return[o.measurement_id,...o.scope.kind==="filter"?[o.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let s=n.pop();if(r.has(s))continue;r.add(s);let o=t.measurements.find(a=>a.id===s);o.source.kind==="provider"?i.add(o.source.provider):o.source.kind==="derived"&&vc(o.source.expression,n)}return i}function Lr(){return{version:vh,measurements:[],assertions:[],gates:[]}}function FE(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let s=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?s:!s}return gc(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function UE(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function jE(e,t){let n=[],r=ar(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let s of i.dependencies??[]){let o=ar(s.kind)??s.kind.trim().toLowerCase(),a=s.source_kind?.trim();o===r&&UE(e,a)&&n.push(`${i.id}->${s.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function GE(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let s=Reflect.get(i,"text");typeof s=="string"&&t.push(s)}}}return t}function qE(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function hc(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function WE(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,s=0;for(let o of e){t.set(o.id.toLowerCase(),o.id);for(let a of o.dependencies??[])n.add(hc(o.id,a.id));for(let a of[o.parent,o.blocked_by])typeof a=="string"&&n.add(hc(o.id,a));for(let a of GE(o)){let c=[...a.matchAll(i)].map(d=>d[0]);s+=c.length,r.push({holder_id:o.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:s}}function KE(e,t){let n=WE(t.items),r=new Map;for(let o of n.prose_mentions){let a=o.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==o.holder_id),c=[...new Set(a)];for(let d of c){let l=hc(o.holder_id,d);if(n.linked_pairs.has(l)||qE(e.exemptions??[],o.holder_id,d,o.segment))continue;let u=c.some(_=>_!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${o.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],s=i.map(o=>o.contributor).sort();return{value:s.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:s.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(o=>o.explicit).length,implicit_subject:i.filter(o=>!o.explicit).length}}}function zE(e,t){return{value:t.history.filter(n=>(e.op===void 0||n.op===e.op)&&(e.author===void 0||n.author===e.author)&&(e.harness===void 0||n.agent_harness===e.harness)&&(e.model===void 0||n.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function BE(e,t){let n=t.items.filter(r=>{let i=r[e.link],s=Array.isArray(i)&&i.length>0;return e.state==="present"?s:!s});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function HE(e,t){let n=e.source;return n.kind==="items"?FE(n,t):n.kind==="dependency_kind"?jE(n,t):n.kind==="prose_edge_gap"?KE(n,t):n.kind==="history"?zE(n,t):n.kind==="links"?BE(n,t):null}function Ch(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function VE(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Ah(e,t,n){let r=new Array(e.length),i=0,s=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let o=i;i+=1,r[o]=await n(e[o],o)}});return await Promise.all(s),r}async function xh(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let o=n.find(d=>d.id===e.measurement);if(!o)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Rh(o,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${o.id} is not numeric`);let c=i.charged.has(o.id)?[]:[a.cost];return i.charged.add(o.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let s=await Ah(e.operands,bh,o=>xh(o,t,n,r,i));return{value:VE(e.operator,s.map(o=>o.value)),costs:s.flatMap(o=>o.costs),population_size:Math.max(0,...s.map(o=>o.population_size)),contributors:[...new Set(s.flatMap(o=>o.contributors))]}}async function YE(e,t,n,r,i){yc(e);let s=Date.now(),o,a=[],c=0;if(e.source.kind==="derived"){let u=await xh(e.source.expression,t,n,[...r,e.id],i);o={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=HE(e,t);u!==null?o=u:(o=await t.external(e.source),c=1)}let d={units:o.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-s},l=Ch([...a,d],Date.now()-s);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Re(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${TE("sha256").update(ne(e)).digest("hex")}`,value:o.value,population_size:o.population_size,cost:l,contributors:o.contributors??[],...o.partitions?{partitions:o.partitions}:{}}}function Rh(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let s=i.cache.get(e.id);if(s)return s;let o=YE(e,t,n,r,i).catch(a=>{if(a instanceof nt&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new nt(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,o),o}async function bc(e,t,n=[e]){return Rh(e,t,n,[],{cache:new Map,charged:new Set})}function JE(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity,e-t.value)}function XE(e,t,n={}){wc(e);let r=Or(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:JE(t.value,r),verdict:i?"retired":kh(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:Sh(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function QE(e,t,n,r){let i=PE(e,t);if(i.size===0)return;let s=e.provider_policy,o=s?.triggers[r];if(!s||!o)throw new Re(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(s.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Re(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Re(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[o.max_cost_class])throw new Re(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!o.allow_network)throw new Re(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wh(e,t,n,r,i){try{return await bc(n,r,i)}catch(s){if(s instanceof nt){let o=s.check?` check ${s.check}`:"",a=s.measurement_id??n.id,c=new Re(`assurance gate ${e} assertion ${t} measurement ${a} source ${s.source_kind}${o} field ${s.field} could not resolve: ${s.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:s.source_kind,field:s.field,...s.check?{check:s.check}:{}});throw c.cause=s,c}throw s}}async function Ih(e,t,n,r){Mn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Re(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Re(`assurance gate ${e} does not declare trigger ${r.trigger}`);QE(i,t,n,r.trigger);let s=await Ah(i.assertion_ids,bh,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(g=>!f.has(g.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,g=t.measurements.find(v=>v.id===f),y=await wh(i.id,d.id,g,n,t.measurements),w=new Set(y.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let _=n.items.find(f=>f.id===d.owner_item_id),h=_!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(_.status);return XE(d,await wh(i.id,d.id,l,u,t.measurements),{owner_terminal:h})}),o=s.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=s.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:o?"block":a?"warn":"pass",exit_code:o?1:0,assertions:s,assertions_total:s.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Ch(s.map(c=>c.cost),Math.max(0,...s.map(c=>c.cost.duration_ms)))}}function Ss(e){return CE.join(e,"assurance.json")}async function Oh(e){let t=await X(Ss(e));return t===null?Lr():Es(t)}function Es(e){try{return Mn(JSON.parse(e))}catch(t){throw new p("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",m.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Ts(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function ZE(e,t){e==="measurement"?yc(t):e==="assertion"?wc(t):Eh(t)}async function Dr(e,t){let n=structuredClone(Ts(await Oh(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Lh(e,t,n){let r=Ts(await Oh(e),t).find(i=>i.id===n);if(!r)throw new Re(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Cs(e,t,n,r={}){ZE(t,n);let i=await x(e),s=j(r.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:`assurance:${t}:put`,author:s,message:r.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a),d=Ts(c,t),l=d.findIndex(_=>_.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&LE(d[l],n)){let _=n.authorization_decision;if(!_||!r.authorized_decision_ids?.includes(_))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Mn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
3
3
|
`,result:{changed:!0,action:u,kind:t,id:n.id}}}});return{...o.result,changed:o.changed}}async function kc(e,t,n={}){let r=Lr();r.measurements=structuredClone(t.measurements),r.assertions=structuredClone(t.assertions),r.gates=structuredClone(t.gates),Mn(r);let i=await x(e),s=j(n.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:"assurance:bundle:apply",author:s,message:n.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a),d=[],l=[],u=(_,h,f)=>{for(let g of h){let y=_.find(w=>w.id===g.id);if(!y){_.push(structuredClone(g)),d.push(`${f}:${g.id}`);continue}if(ne(y)!==ne(g))throw new L(`assurance bundle refuses to replace divergent ${f} ${g.id}`);l.push(`${f}:${g.id}`)}};return u(c.measurements,r.measurements,"measurement"),u(c.assertions,r.assertions,"assertion"),u(c.gates,r.gates,"gate"),Mn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
4
4
|
`,result:{changed:d.length>0,created_ids:d,unchanged_ids:l}}}});return{...o.result,changed:o.changed}}async function Dh(e,t,n,r={}){let i=await x(e),s=j(r.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:`assurance:${t}:remove`,author:s,message:r.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a);if(t==="measurement"){let u=Th(c).get(n);if(u&&u.length>0)throw new L(`assurance measurement ${n} is referenced by ${u.join(", ")}`)}if(t==="assertion"&&c.gates.some(u=>u.assertion_ids.includes(n)))throw new L(`assurance assertion ${n} is referenced by gate`);let d=Ts(c,t),l=d.findIndex(u=>u.id===n);if(l<0)throw new L(`assurance ${t} ${n} not found`);return d.splice(l,1),Mn(c),{raw:`${JSON.stringify(c,null,2)}
|
|
@@ -28,4 +28,4 @@ ${t}`;for(let r of Z$)if(r.regex.test(n))return{code:r.code};return null}functio
|
|
|
28
28
|
`)}async function er(e,t){let n=ka(e,t),r=await X(n);return r?e0(r,n):null}async function GF(e){let t=ba(e);return await re(t)?(await Qn.readdir(t,{withFileTypes:!0})).filter(n=>n.isFile()&&n.name.endsWith(".json")).map(n=>_i.join(t,n.name)).sort((n,r)=>r.localeCompare(n)):[]}function qF(e){let t=e.match(/^VmRSS:\s+(\d+)\s+kB$/m);if(t)return Number.parseInt(t[1],10)*1024}async function WF(e){if(process.platform==="linux")try{let t=await Qn.readFile(`/proc/${e}/status`,"utf8");return qF(t)}catch{return}}function KF(e){let t=e.lastIndexOf(")");if(t<0)return{};let n=e.slice(t+2).trim().split(/\s+/),r=Number.parseInt(n[11],10),i=Number.parseInt(n[12],10);return!Number.isFinite(r)||!Number.isFinite(i)?{}:{cpu_user_seconds:r/zk,cpu_system_seconds:i/zk}}async function zF(e){if(process.platform!=="linux")return{};try{let t=await Qn.readFile(`/proc/${e}/stat`,"utf8");return KF(t)}catch{return{}}}async function Ol(e){let t=e.child_pid??e.worker_pid;if(!Zn(t))return;let n=await WF(t),r=await zF(t),i=e.started_at?Date.parse(e.started_at):Number.NaN,s=Number.isFinite(i)?Math.max(0,(Qk()-i)/1e3):void 0;return{recorded_at:I(),rss_bytes:n,cpu_user_seconds:r.cpu_user_seconds,cpu_system_seconds:r.cpu_system_seconds,uptime_seconds:s}}function Il(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function BF(e,t){if(!t||typeof t!="object")return{summary:{passed:0,failed:1,skipped:0},parsedResult:null};let n=t;if(e==="test-all"){let a=n.totals??{};return{summary:{items:typeof a.items=="number"?a.items:void 0,linked_tests:typeof a.linked_tests=="number"?a.linked_tests:void 0,passed:Il(a.passed),failed:Il(a.failed),skipped:Il(a.skipped),fail_on_skipped_triggered:n.fail_on_skipped_triggered===!0?!0:void 0},parsedResult:t}}let r=Array.isArray(n.run_results)?n.run_results:[],i=0,s=0,o=0;for(let a of r){if(!a||typeof a!="object")continue;let c=a.status;if(c==="passed"){i+=1;continue}if(c==="failed"||c==="refused"){s+=1;continue}o+=1}return{summary:{passed:i,failed:s,skipped:o,fail_on_skipped_triggered:n.fail_on_skipped_triggered===!0?!0:void 0},parsedResult:t}}function HF(e){let t=e.trim();if(t.length===0)return null;let n=t.match(/\[pm test-all\]\s+item\s+(\d+)\/(\d+)\s+(start|end)\s+id=([^\s]+)/i);if(n){let d=Number.parseInt(n[1],10),l=Number.parseInt(n[2],10);return{item_index:d,item_total:l,item_id:n[4],linked_test_index:void 0,linked_test_total:void 0,current_command:void 0,elapsed_ms:void 0,heartbeat_at:I(),phase:n[3]?.toLowerCase()==="end"?"finished":"running"}}let r=t.match(/\[pm test\]\s+linked-test\s+(\d+)\/(\d+)\s+(start|running|end)(?:.*elapsed_ms=(\d+))?/i);if(!r)return null;let i=Number.parseInt(r[1],10),s=Number.parseInt(r[2],10),o=r[4]?Number.parseInt(r[4],10):void 0,a=t.match(/\scommand="((?:\\.|[^"\\])*)"/),c=a?a[1].replaceAll('\\"','"').replaceAll("\\\\","\\"):void 0;return{linked_test_index:i,linked_test_total:s,current_command:c,elapsed_ms:Number.isFinite(o)?o:void 0,heartbeat_at:I(),phase:r[3]?.toLowerCase()==="end"?"finished":"running"}}function VF(e){return e.split(/\r?\n/).map(t=>t.trimEnd()).filter(t=>t.length>0)}function Ll(e,t){if(t<=0)return[];let n=VF(e);return n.length<=t?n:n.slice(n.length-t)}async function t0(e){let t=process.env.PM_BACKGROUND_CLI_ENTRY?.trim();if(t&&t.length>0){let i=_i.resolve(e,t);if(await re(i))return i}let n=_i.resolve(e,"dist","cli.js");if(await re(n))return n;let r=process.argv[1]?.trim();if(r&&r.length>0){let i=_i.resolve(e,r);if(await re(i))return i}throw new p("Unable to resolve a CLI entrypoint for background test runs. Build the project or set PM_BACKGROUND_CLI_ENTRY.",m.GENERIC_FAILURE)}async function fi(e,t){if(!Jk.has(t.status)||Zn(t.worker_pid)||t.finished_at)return t;let n={...t,status:"failed",finished_at:I(),error:t.error??"Background test run worker exited before writing terminal status."};return await it(e,n),n}async function Nl(e){await jF(e.pmRoot);let t=Zk(e.commandArgs);if(t.length===0)throw new p("Background test run requires command arguments.",m.USAGE);let n=UF(e.kind,t,e.pmRoot),r=await $l(e.pmRoot,{});for(let l of r){let u=await fi(e.pmRoot,l);if(u.fingerprint===n&&!(!Jk.has(u.status)||!Zn(u.worker_pid)))return{started:!1,run:{...u,duplicate_of:u.id},duplicate_of:u.id}}let i=FF(),s=I(),o=Ru(e.pmRoot,i),a=Iu(e.pmRoot,i),c=Lu(e.pmRoot,i);await Qn.writeFile(o,"","utf8"),await Qn.writeFile(a,"","utf8");let d={id:i,kind:e.kind,status:"queued",created_at:s,updated_at:s,requested_by:e.requestedBy,fingerprint:n,command_args:t,command_label:PF(t),pm_root:e.pmRoot,global_pm_root:e.globalPmRoot,target_id:e.targetId,status_filter:e.statusFilter,attempt:typeof e.attempt=="number"&&Number.isFinite(e.attempt)&&e.attempt>=1?Math.floor(e.attempt):1,resumed_from:e.resumedFrom,resumed_by:e.resumedBy,stdout_path:o,stderr_path:a,result_path:c,progress:{phase:"queued",message:"Queued for background execution.",heartbeat_at:s}};return await it(e.pmRoot,d),{started:!0,run:d}}async function Ml(e){let t=await er(e.pmRoot,e.runId);if(!t)throw new p(`Background test run ${e.runId} not found`,m.NOT_FOUND);if(Dl.has(t.status))throw new p(`Background test run ${t.id} is already terminal (${t.status}).`,m.CONFLICT);let n=await t0(process.cwd()),r=[];e.noExtensions===!0&&r.push("--no-extensions"),r.push("--path",t.pm_root,"test-runs-worker",t.id);let i={...process.env,PM_PATH:t.pm_root,PM_GLOBAL_PATH:t.global_pm_root,PM_BACKGROUND_TEST_RUN_ID:t.id,PM_BACKGROUND_TEST_RUN_ATTEMPT:String(t.attempt),PM_BACKGROUND_TEST_RUN_RESUMED_FROM:t.resumed_from??"",FORCE_COLOR:"0"},s=Yk(process.execPath,[n,...r],{cwd:process.cwd(),env:i,detached:!0,stdio:"ignore",windowsHide:!0});s.unref();let o={...t,status:"queued",worker_pid:s.pid,progress:{phase:"queued",message:"Worker process started.",heartbeat_at:I()}};return await it(e.pmRoot,o),o}async function Bk(e,t,n){await e,await Qn.appendFile(t,n,"utf8")}function n0(e,t){let n=Number.parseInt(process.env[e]??"",10);return Number.isFinite(n)&&n>0?n:t}function YF(e){return{...process.env,PM_PATH:e.pm_root,PM_GLOBAL_PATH:e.global_pm_root,FORCE_COLOR:"0"}}function JF(e,t){return t?["--no-extensions",...e.command_args]:[...e.command_args]}function XF(e,t){let n=Promise.resolve();return{schedule(){n=n.then(async()=>{try{await it(e,t)}catch{}})},async flush(){await n}}}function Hk(e,t){try{e.kill(t)}catch{}}async function QF(e,t,n,r){n.stopRequested||(n.stopRequested=!0,e.stop_requested_at=I(),e.progress={...e.progress,phase:"stopping",message:"Stop requested for background run.",heartbeat_at:I()},r(),Hk(t,"SIGTERM"),setTimeout(()=>Hk(t,"SIGKILL"),n0("PM_BACKGROUND_RUN_FORCE_KILL_DELAY_MS",MF)).unref?.())}function ZF(e,t,n){return{phase:n,message:e,heartbeat_at:I(),item_index:t.item_index,item_total:t.item_total,item_id:t.item_id,linked_test_index:void 0,linked_test_total:void 0,current_command:void 0,elapsed_ms:void 0}}function eU(e,t,n,r){return{phase:r,message:e,heartbeat_at:I(),item_index:n.item_index??t.progress?.item_index,item_total:n.item_total??t.progress?.item_total,item_id:n.item_id??t.progress?.item_id,linked_test_index:n.linked_test_index,linked_test_total:n.linked_test_total,current_command:n.current_command,elapsed_ms:n.elapsed_ms}}function Vk(e,t,n){let r=HF(t);if(!r)return!1;let i=e.progress?.phase==="stopping"?"stopping":"running";return e.progress=r.item_id?ZF(t,r,i):eU(t,e,r,i),r.phase==="finished"&&!n&&(e.progress.phase="running"),!0}function tU(e){if(e.trim().length===0)return null;try{return JSON.parse(e)}catch{return null}}function nU(e,t,n){return n?"stopped":e===0&&t.failed===0&&t.fail_on_skipped_triggered!==!0?"passed":"failed"}function rU(e,t){return{phase:"finished",message:t?"Background run stopped.":`Background run finished with status=${e.status}.`,heartbeat_at:I(),item_index:e.progress?.item_index,item_total:e.progress?.item_total,item_id:e.progress?.item_id,linked_test_index:e.progress?.linked_test_index,linked_test_total:e.progress?.linked_test_total,current_command:e.progress?.current_command,elapsed_ms:e.progress?.elapsed_ms}}async function iU(e,t,n){if(t!==null){await Le(e.result_path,`${JSON.stringify(t,null,2)}
|
|
29
29
|
`);return}await Le(e.result_path,`${JSON.stringify({parse_error:"Background run output was not valid JSON.",stdout_excerpt:Ll(n,Xk)},null,2)}
|
|
30
30
|
`)}async function r0(e,t,n=!1){let r=await er(e,t);if(!r)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let i={...r,status:"running",started_at:r.started_at??I(),worker_pid:process.pid,progress:{phase:"running",message:"Worker started.",heartbeat_at:I()}},s=await t0(process.cwd()),o=YF(i);await it(e,i);let a=JF(i,n),c=Yk(process.execPath,[s,...a],{cwd:process.cwd(),env:o,detached:!1,stdio:["ignore","pipe","pipe"],windowsHide:!0});i.child_pid=c.pid;let d=XF(e,i),l=d.schedule,u=Promise.resolve(),_=Promise.resolve(),h="",f="",g={stopRequested:!1},y=()=>{QF(i,c,g,l)};process.on("SIGTERM",y),process.on("SIGINT",y);let w=setInterval(()=>{(async()=>(i.resource=await Ol(i),i.progress.heartbeat_at=I(),l()))()},n0("PM_BACKGROUND_RUN_RESOURCE_INTERVAL_MS",NF));w.unref?.(),c.stdout?.on("data",k=>{let C=k.toString("utf8");h+=C,u=Bk(u,i.stdout_path,C)}),c.stderr?.on("data",k=>{let C=k.toString("utf8");_=Bk(_,i.stderr_path,C),f+=C;let O=f.split(/\r?\n/);f=O.pop();let M=!1;for(let E of O){let F=E.trimEnd();F.length>0&&Vk(i,F,g.stopRequested)&&(M=!0)}M&&l()});let v=null,b=null;try{({code:v,signal:b}=await new Promise(k=>{c.on("close",(C,O)=>{k({code:C,signal:O})})}))}finally{clearInterval(w),process.off("SIGTERM",y),process.off("SIGINT",y)}await u,await _;let T=f.trimEnd();T.length>0&&Vk(i,T,g.stopRequested)&&l(),f="";let S=tU(h),A=BF(i.kind,S);return i.summary=A.summary,i.exit_code=typeof v=="number"?v:void 0,i.signal=b??void 0,i.finished_at=I(),i.status=nU(i.exit_code,A.summary,g.stopRequested),i.progress=rU(i,g.stopRequested),i.resource=await Ol(i),await iU(i,S,h),await it(e,i),await d.flush(),i}async function $l(e,t){let n=await GF(e),r=[];for(let a of n){let c=await X(a);if(!c)continue;let d=await e0(c,a);r.push(d)}let i=[];for(let a of r)i.push(await fi(e,a));let s=(t.status?i.filter(a=>a.status===t.status):i).sort((a,c)=>{let d=Date.parse(c.updated_at)-Date.parse(a.updated_at);return Number.isFinite(d)&&d!==0?d:c.id.localeCompare(a.id)}),o=typeof t.limit=="number"&&t.limit>=0?t.limit:void 0;return o===void 0?s:s.slice(0,o)}async function i0(e,t){let n=await er(e,t);if(!n)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let r=await fi(e,n),i=Zn(r.worker_pid),s=Zn(r.child_pid);r.status==="running"&&!s&&!r.finished_at&&!i&&(r.status="failed",r.finished_at=I(),r.error=r.error??"Background run process exited unexpectedly.",await it(e,r)),r.status==="running"&&(r.resource=await Ol(r),await it(e,r));let o=r.progress?.heartbeat_at,a=o?Date.parse(o):Number.NaN,c=Number.isFinite(a)?Math.max(0,Qk()-a):void 0,d=Number.parseInt(process.env.PM_BACKGROUND_RUN_HEARTBEAT_STALE_MS??"",10),l=Number.isFinite(d)&&d>0?d:$F,u=r.status==="running"?c!==void 0&&c>l?"stale":"healthy":"inactive";return{run:r,health:{state:u,last_heartbeat_at:o,heartbeat_lag_ms:c,worker_alive:i,child_alive:s}}}function sU(e,t){let n=t?"SIGKILL":"SIGTERM";if(!Zn(e.worker_pid)||!e.worker_pid)return"none";try{return process.kill(e.worker_pid,n),n}catch{return"none"}}function oU(e,t){return{phase:"stopping",message:t==="none"?"Run marked stopped.":`Stop requested via ${t}.`,heartbeat_at:I(),item_index:e.progress?.item_index,item_total:e.progress?.item_total,item_id:e.progress?.item_id,linked_test_index:e.progress?.linked_test_index,linked_test_total:e.progress?.linked_test_total,current_command:e.progress?.current_command,elapsed_ms:e.progress?.elapsed_ms}}async function s0(e,t,n=!1){let r=await er(e,t);if(!r)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let i=await fi(e,r);if(Dl.has(i.status))return{run:i,signal_sent:"none"};let s=sU(i,n);return s==="none"&&(i.status="stopped",i.finished_at=i.finished_at??I()),i.stop_requested_at=I(),i.progress=oU(i,s),await it(e,i),{run:i,signal_sent:s}}async function o0(e,t,n,r=!1){let i=await er(e,t);if(!i)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let s=await fi(e,i);if(!Dl.has(s.status))throw new p(`Background test run ${t} is not terminal and cannot be resumed.`,m.CONFLICT);let o=await Nl({pmRoot:s.pm_root,globalPmRoot:s.global_pm_root,kind:s.kind,commandArgs:s.command_args,requestedBy:n,targetId:s.target_id,statusFilter:s.status_filter,resumedFrom:s.id,resumedBy:n,attempt:s.attempt+1});if(!o.started)return o.run;let a=await Ml({pmRoot:e,runId:o.run.id,noExtensions:r}),c={...s,resumed_by:a.id};return await it(e,c),a}async function a0(e,t,n,r){let i=await er(e,t);if(!i)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let s=typeof r=="number"&&Number.isFinite(r)&&r>=0?Math.floor(r):Xk,o=n==="stdout"||n==="both"?await X(i.stdout_path)??"":"",a=n==="stderr"||n==="both"?await X(i.stderr_path)??"":"";return{run:i,stream:n,tail:s,stdout:n==="stdout"||n==="both"?Ll(o,s):[],stderr:n==="stderr"||n==="both"?Ll(a,s):[]}}(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]="8e9a2374-d190-52e1-8afd-14e1954863f0")}catch{}})();var cU=["queued","running","passed","failed","stopped","canceled"],dU=["stdout","stderr","both"];function lU(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(cU.includes(t))return t;throw new p(`Invalid --status value "${e}"`,m.USAGE)}function uU(e){if(e===void 0||e.trim().length===0)return"stderr";let t=e.trim().toLowerCase();if(dU.includes(t))return t;throw new p(`Invalid --stream value "${e}"`,m.USAGE)}function mU(){try{let e=aU.userInfo().username.trim();if(e.length>0)return e}catch{}}function c0(e,t){let n=[e,hm(),t,process.env.USER,process.env.LOGNAME,process.env.USERNAME,mU()];for(let r of n){if(typeof r!="string")continue;let i=r.trim();if(i.length>0)return i}return"unknown"}async function un(e){await U(e)}async function x9(e,t){let n=R(process.cwd(),t.path),r=We(process.cwd());await un(n);let i=await x(n),s=c0(e.author,i.author_default),o=await Nl({pmRoot:n,globalPmRoot:r,kind:e.kind,commandArgs:e.commandArgs,requestedBy:s,targetId:e.targetId,statusFilter:e.statusFilter});return o.started?{started:!0,run:await Ml({pmRoot:n,runId:o.run.id,noExtensions:e.noExtensions===!0})}:{started:!1,duplicate_of:o.duplicate_of,run:o.run}}async function R9(e,t){let n=R(process.cwd(),t.path);await un(n);let r=lU(e.status),i=pr(e.limit,"limit"),s=await $l(n,{status:r,limit:i});return{runs:s,count:s.length,filters:{status:r,limit:i}}}async function I9(e,t){let n=R(process.cwd(),t.path);await un(n);let r=await i0(n,e);return{run:r.run,health:r.health}}async function O9(e,t,n){let r=R(process.cwd(),n.path);await un(r);let i=uU(t.stream),s=pr(t.tail,"tail"),o=await a0(r,e,i,s);return{run:o.run,stream:o.stream,tail:o.tail,stdout:o.stdout,stderr:o.stderr}}async function L9(e,t,n){let r=R(process.cwd(),n.path);await un(r);let i=await s0(r,e,t.force===!0);return{run:i.run,signal_sent:i.signal_sent}}async function D9(e,t,n){let r=R(process.cwd(),n.path);await un(r);let i=await x(r),s=c0(t.author,i.author_default),o=await o0(r,e,s,t.noExtensions===!0);return{resumed_from:e,run:o}}async function N9(e,t){let n=R(process.cwd(),t.path);await un(n);let r=await r0(n,e,t.noExtensions===!0);return{id:r.id,status:r.status,exit_code:r.exit_code}}export{iS as a,jf as b,_U as c,LU as d,aS as e,Vt as f,DU as g,cS as h,qf as i,NU as j,Cr as k,MU as l,lS as m,mS as n,$U as o,zf as p,GU as q,qU as r,OS as s,WU as t,KU as u,zU as v,lc as w,BU as x,HU as y,VU as z,eE as A,Ln as B,tE as C,QU as D,ZU as E,mc as F,ej as G,tj as H,nj as I,iE as J,rj as K,ij as L,sj as M,oj as N,pc as O,ch as P,cj as Q,ah as R,mh as S,_E as T,Rr as U,wE as V,_h as W,kE as X,bj as Y,_c as Z,gh as _,EE as $,Tj as aa,Cj as ba,yh as ca,Aj as da,xj as ea,L as fa,Re as ga,nt as ha,Dn as ia,fc as ja,vh as ka,_t as la,Ir as ma,LE as na,yc as oa,wc as pa,Eh as qa,Mn as ra,Lr as sa,bc as ta,XE as ua,Ih as va,Dr as wa,Lh as xa,Cs as ya,kc as za,Dh as Aa,Nh as Ba,Mh as Ca,pG as Da,wC as Ea,dg as Fa,SG as Ga,Fr as Ha,EG as Ia,CC as Ja,AC as Ka,TG as La,xC as Ma,_g as Na,UC as Oa,jC as Pa,GC as Qa,qC as Ra,jr as Sa,WC as Ta,gt as Ua,KC as Va,zC as Wa,BC as Xa,xc as Ya,Rc as Za,HC as _a,Is as $a,Os as ab,fg as bb,yg as cb,mq as db,iA as eb,sA as fb,kg as gb,Lc as hb,hq as ib,bq as jb,Cg as kb,xg as lb,Uq as mb,jq as nb,Gr as ob,$s as pb,Lg as qb,Dg as rb,Ng as sb,Mg as tb,Ug as ub,OA as vb,DA as wb,NA as xb,MA as yb,Kg as zb,zg as Ab,Bg as Bb,Fs as Cb,Us as Db,by as Eb,bW as Fb,ky as Gb,Ey as Hb,Ty as Ib,xy as Jb,Iy as Kb,sd as Lb,Br as Mb,Hr as Nb,IR as Ob,qn as Pb,Fy as Qb,pd as Rb,jy as Sb,Gy as Tb,iI as Ub,Sz as Vb,Pw as Wb,Jr as Xb,jw as Yb,Gw as Zb,qw as _b,Id as $b,mO as ac,oB as bc,Vw as cc,RB as dc,DB as ec,AO as fc,so as gc,Nd as hc,Jw as ic,VB as jc,VO as kc,oo as lc,ao as mc,lo as nc,av as oc,nn as pc,po as qc,tn as rc,sv as sc,Qr as tc,Zr as uc,_o as vc,fo as wc,rn as xc,sn as yc,zn as zc,ho as Ac,go as Bc,yo as Cc,ei as Dc,Ao as Ec,pL as Fc,Pd as Gc,wV as Hc,cn as Ic,FD as Jc,No as Kc,Dv as Lc,Nv as Mc,y4 as Nc,ZD as Oc,gN as Pc,wN as Qc,ii as Rc,w4 as Sc,Qd as Tc,S4 as Uc,cM as Vc,Zd as Wc,q4 as Xc,W4 as Yc,Uo as Zc,i5 as _c,s5 as $c,o5 as ad,lb as bd,k5 as cd,EM as dd,ol as ed,TM as fd,CM as gd,AM as hd,S5 as id,E5 as jd,P5 as kd,F5 as ld,U5 as md,Cb as nd,Ab as od,GM as pd,xb as qd,a3 as rd,Rb as sd,c3 as td,d3 as ud,Go as vd,i$ as wd,h3 as xd,cl as yd,g3 as zd,dl as Ad,s$ as Bd,ai as Cd,Db as Dd,Nb as Ed,j3 as Fd,Pb as Gd,e8 as Hd,t8 as Id,Qb as Jd,fl as Kd,Cl as Ld,q6 as Md,m1 as Nd,pi as Od,h1 as Pd,xl as Qd,Gk as Rd,a9 as Sd,x9 as Td,R9 as Ud,I9 as Vd,O9 as Wd,L9 as Xd,D9 as Yd,N9 as Zd};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-WWW5WHHJ.js.map
|