@unbrained/pm-cli 2026.9.22 → 2026.9.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +6 -0
- package/dist/cli-bundle/bundle-manifest.json +147 -147
- package/dist/cli-bundle/chunks/{chunk-AVWHZUNC.js → chunk-6WBR6GMW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-CM57QHVK.js → chunk-7IABMUB6.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-UDNYAMCM.js → chunk-E6ZES2X7.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BJBBOUYQ.js → chunk-KOUT5SAA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-D2OV2UBV.js → chunk-NBGSRFZE.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ZSPZJOMK.js → chunk-OBTHQ6UX.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3OFFMS2N.js → chunk-PFWCAI4X.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-JSW33Q6R.js → chunk-SXRMM72R.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-SBTT42A4.js → chunk-VO7DHENB.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4XOV7Q5R.js → chunk-WBB5B7G5.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ML42DLI3.js → chunk-ZSVINTXT.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GFTN5OS4.js → chunk-ZWSWR2GX.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-VOS5CBX4.js → register-list-query-IFPQ4YRD.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-LWZH6UFJ.js → register-mutation-C3O7OSXW.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-YJK4DNFZ.js → register-operations-LGO7DBZ7.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-Q3CYF67Q.js → register-setup-4EW2PPZD.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QYN77MQP.js → chunk-3JAEZ7WI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-LH24XUPJ.js → chunk-6CWR2QFM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-V2NARGRH.js → chunk-BKXYQQDT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-JCD5YESL.js → chunk-BQSKFRL2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UAU4DJSR.js → chunk-BULUJEOL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-AO5FR7PN.js → chunk-E5AOEXF5.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-PRMQTT7X.js → chunk-FIQYVDLL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-FKYUTTFL.js → chunk-HJA6OHWT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-IOL25GKH.js → chunk-KMNH4G6Y.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-URH727T5.js → chunk-L554BKFH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-QFEDRPPI.js → chunk-LZOEUNHR.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UT7VS4X2.js → chunk-N2JYYEHM.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TSI73EEM.js → chunk-PIHQNL32.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-MXESHALQ.js → chunk-QREDJ77O.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-XR5EBU3B.js → chunk-S5JYIFFS.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-CASXNCNQ.js → chunk-YE6F5HGF.js} +2 -2
- package/dist/cli-bundle/main.js +2 -2
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +1 -1
- package/dist/cli-bundle/sdk-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +2 -2
- package/dist/cli-bundle/sdk-query.js +1 -1
- package/dist/cli-bundle/sdk-runtime.js +1 -1
- package/dist/cli-bundle/sdk-testing.js +1 -1
- package/dist/cli-bundle/sdk.js +1 -1
- package/dist/sdk/cli-contracts/commander-types.d.ts +11 -11
- package/dist/sdk/cli-contracts/commander-types.js +1 -1
- package/dist/sdk/pagination.js +1 -1
- package/docs/QUALITY_EVIDENCE.md +70 -0
- package/docs/TESTING.md +8 -0
- package/marketplace.json +2 -2
- package/package.json +8 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as vu,o as Bo,p as Eu,q as Au,r as ka,s as Wo,t as Tu,u as Sa,v as Yo,y as Zu,z as ep}from"./focused-chunks/chunk-V2NARGRH.js";import{a as op,f as ip,h as Zt,m as sp,o as pr,r as ni,s as ap,t as cp,x as lp}from"./focused-chunks/chunk-IOL25GKH.js";import{$ as Dn,$a as t_,A as Ar,Ab as f_,B as ff,Bb as __,C as Ti,Cb as Ir,D as _f,Da as Kf,Db as sc,E as hf,Eb as ac,Fa as Bf,Fb as Fi,Ga as xi,Gb as cc,Ha as gk,Hb as h_,Ia as Hf,Ib as lc,J as gf,Ja as Vf,Jb as $i,K as yf,Ka as ic,Kb as jn,L as vf,Lb as dc,M as wf,Mb as mc,N as bf,Nb as g_,O as kf,Ob as y_,P as Sf,Pb as v_,Q as Ef,Qb as qn,R as Af,Rb as uc,S as Tf,Sb as w_,T as Cf,U as If,V as Rf,Va as Yf,Vb as Mi,W as Of,Wa as Jf,X as xf,Xa as Xf,Y as Nf,Ya as Qf,Z as Pf,Za as Zf,_ as Lf,_a as e_,aa as Gt,ab as tn,ac as b_,ba as w,bb as n_,bc as k_,ca as Ff,cb as r_,cc as S_,da as $f,db as Ni,ea as Me,eb as o_,fa as Mf,fb as i_,g as af,ga as ec,gb as s_,gc as E_,h as cf,ha as Df,hb as a_,hc as N_,ia as tc,ib as c_,ja as Tr,jb as Pi,ka as Ci,kb as jt,la as Un,lb as l_,ma as Uf,mb as Li,na as nc,oa as ge,pa as rc,pb as Cr,qa as ye,ra as Gf,sa as jf,ta as Ii,ua as qf,va as Ri,wb as d_,xb as m_,y as pf,yb as u_,z as Xa,zb as p_}from"./focused-chunks/chunk-QYN77MQP.js";import{e as hu,g as gu,h as yu,k as wu,q as Su}from"./focused-chunks/chunk-QFEDRPPI.js";import{b as tp,c as ti,e as np,f as rp,g as ek}from"./focused-chunks/chunk-LH24XUPJ.js";import{R as Da,V as Qu,a as am,b as cm,c as lm,d as dm,f as mm}from"./focused-chunks/chunk-UT7VS4X2.js";import{a as df,b as mf,c as Di}from"./focused-chunks/chunk-CASXNCNQ.js";import{K as Wf,b as uf}from"./focused-chunks/chunk-AO5FR7PN.js";import{Ba as gc,Da as x_,Sa as xr,c as Qa,e as Za,g as oc,h as Rr,i as yk,j as pc,k as fc,l as Ui,m as vk,n as wk,pa as _c,s as A_,t as T_,u as C_,ua as Or,v as I_,w as R_,wa as hc,x as O_}from"./focused-chunks/chunk-PRMQTT7X.js";import{A as Pn,B as _i,C as hi,F as gi,G as yi,H as qp,Ha as Mn,I as vi,Ia as Zp,J as wi,Ja,K as Ln,Ka as ef,L as Wa,M as bi,N as Kp,Na as tf,O as zp,Oa as nf,P as vr,Wa as Si,Za as of,_a as br,a as si,b as ai,bb as sf,c as ci,d as li,h as di,i as Lt,j as xn,jb as gt,k as mi,l as Nn,lb as Er,m as ui,mb as en,n as le,o as pi,ob as lf,p as Ha,pb as Oi,q as Ve,r as Va,ra as Qp,s as Dp,t as Ie,ub as Gn,v as _t,w as Up,x as fi,y as Ft,z as fe}from"./focused-chunks/chunk-UAU4DJSR.js";import{c as pu,f as fu,g as _u,i as zo,j as xt,k as Cu,l as Iu,m as Ru}from"./focused-chunks/chunk-TSI73EEM.js";import{a as mp,b as up,c as pp}from"./focused-chunks/chunk-MXESHALQ.js";import{$ as Um,A as wo,Aa as iu,B as vm,Ba as su,C as wm,Ca as Oo,D as bm,Da as au,E as bo,Ea as cu,F as km,Fa as lu,G as Sm,Ga as xo,H as Em,Ha as No,I as Am,Ia as Po,J as ko,Ja as Lo,K as So,Ka as dr,L as Tm,La as du,M as Eo,Ma as Fo,Na as mr,O as Cm,Oa as $o,P as cr,Pa as Mo,Q as Im,Qa as Do,R as Rm,Ra as Uo,S as Om,Sa as mu,T as xm,Ta as Rt,U as Nm,Ua as Go,V as Pm,Va as jo,W as Lm,Wa as qo,X as Fm,Xa as Ko,Y as $m,Z as Mm,_ as Dm,_a as uu,aa as Gm,ab as Ot,ba as jm,bb as L,ca as qm,d as va,da as lr,e as um,ea as Km,fa as zm,ga as Ao,h as ho,ha as To,i as wa,ia as Bm,j as Xt,ja as Hm,ka as Vm,l as pm,la as Wm,ma as Ym,na as Jm,oa as Xm,pa as Qm,q as ba,ra as Zm,s as go,sa as eu,t as yo,ta as tu,u as vo,ua as nu,v as fm,va as ru,w as _m,wa as ou,x as hm,xa as Co,y as gm,ya as Io,z as ym,za as Ro}from"./focused-chunks/chunk-XR5EBU3B.js";import{$ as Ep,$a as Fn,A as hk,Ab as _e,B as On,Bb as Yp,C,Cb as ki,Db as ht,Eb as Jp,Fb as se,G as ft,Ga as Pp,Gb as Xp,Ia as Ba,K as hp,Kb as rf,L as ii,La as Lp,M as gp,Ma as Fp,N as yp,Na as rt,O as vp,P as wp,Q as bp,Qa as $p,Qb as kr,Ra as Mp,Rb as Sr,S as ee,Sa as A,Sb as Ei,T as Ua,Ta as $e,Tb as Ut,U as ne,Ua as Ce,Va as Gp,W as Ga,Wa as jp,X as kp,Xa as $t,Y as He,Yb as Ai,Z as tt,Za as Ke,_ as Sp,_a as yr,a as tk,ab as Bp,b as nk,ba as Ap,bb as $n,c as rk,ca as Tp,cb as Ya,d as ok,da as ja,db as Hp,ga as qa,ia as Cp,j as ri,ja as Ip,jb as wr,k as fp,ka as Rp,l as _p,la as Op,m as Rn,ma as xp,n as fr,nc as zf,o as ik,p as sk,q as ak,qa as Fe,qb as Mt,r as ck,ra as Pt,s as lk,sb as Dt,t as dk,ta as Ka,u as mk,ua as _r,ub as Vp,v as uk,va as hr,vb as I,w as pk,wa as za,wb as q,x as oi,xa as nt,xb as ie,y as fk,ya as Np,yb as Wp,z as _k,za as gr}from"./focused-chunks/chunk-FKYUTTFL.js";import{b as Ct,c as mo,d as uo,g as ut,i as Ho,j as pt,k as Nt,l as bu,n as M,o as Vo,p as et,r as ku}from"./focused-chunks/chunk-JCD5YESL.js";import{e as dp}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as pe,$b as xu,$d as Te,Ab as sr,Ac as ju,Ad as jb,B as Gd,Bd as qb,C as jd,Cc as Ca,Cd as Kb,Ce as Jb,D as qd,Dc as Ia,De as Xb,E as Kd,Ec as Ra,Ed as zb,Ee as Qb,F as zd,Fb as Se,Fc as Oa,Fd as Bb,Fe as Zb,G as Bd,Ga as Sn,Gc as xa,Gd as Fa,Ge as ei,H as la,Hb as H,Hc as Na,Hd as $a,He as Xu,I as da,Ia as Xd,Ic as Pa,Id as Ma,J as ma,Jb as ar,Jc as O,Jd as zu,K as ua,Ka as ha,Kc as Tn,L as pa,Lc as Qt,Ld as Bu,M as fa,Mc as J,Md as Hb,Na as ga,Nc as Jo,Oa as nr,Oc as Cn,Od as Vb,P as lo,Pa as Ee,Pb as An,Pd as Wb,Qd as Yb,Rc as Xo,Sa as x,Sd as S,Ta as ke,Tc as Ae,U as _a,Ua as fo,Uc as Qo,Va as En,W as Hd,Wa as rr,Wd as Zo,Xa as Qd,Ya as E,Yc as ur,Yd as oe,Z as Tt,Za as Zd,_a as lt,_b as Ou,aa as l,ab as dt,ac as Nu,bc as Pu,cb as Ze,cc as Lu,db as _o,dc as Fu,ec as Ea,fc as $u,fe as Hu,hb as em,hc as Mu,ia as Vd,ib as tm,ic as Du,jb as nm,ka as Wd,kb as rm,kd as qu,lb as om,lc as Aa,ma as po,mb as im,mc as Uu,me as Vu,nb as sm,nc as Ta,ne as Wu,o as so,oa as Yd,od as Ku,p as Ud,pa as Jd,pb as or,q as ao,qb as Jt,qe as In,r as ca,rb as mt,sa as P,ta as Yt,td as La,ua as It,uc as Gu,ue as Yu,v as Wt,va as Z,w as ct,wa as te,x as wn,y as bn,ya as kn,yb as ir,ye as Ju,z as co,zb as ya}from"./focused-chunks/chunk-URH727T5.js";import{AsyncLocalStorage as RM}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1979adcd-4a7f-5dc7-b5dd-6bfc15eed1af")}catch{}})();var bk=Da("list").properties.outputSession,kk={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...bk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},P_={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},L_={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},ae={type:"string",description:"pm item id, for example pm-abc1."},Sk=`Operation name (one of): ${Ta.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,Ek={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},Ak={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function U(e,t=[]){return{...L_,properties:{...L_.properties,...e},required:t}}var Tk=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:U({action:{type:"string",enum:[...Ta],description:Sk},id:ae,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...kk},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:U({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:U({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:U({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:U({query:{type:"string"},options:{type:"object"},...Ak},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:U({options:{type:"object"},...Ek})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:U({id:ae,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:U({since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",inputSchema:U({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"]},id:ae,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"}},required:["op"],additionalProperties:!1}},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["transactionId","mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({id:ae,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:U({id:ae,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:U({id:ae,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({id:ae,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:U({id:ae,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:U({id:ae,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({id:ae,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:"List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls default to the most recent 20 comments with total_count/has_more metadata for token efficiency. Pass options.limit=N to choose a page size, options.limit=0 for summary-only metadata, or options.full=true for full history.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:U({subcommand:{type:"string",enum:[...$u]},id:ae,target:ae,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:U({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:U({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:U({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:U({...P_,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...An],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...ca]},description:`Lifecycle roles for add-status: ${ca.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:P_}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:U({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:U({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:U({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],Ck={pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},Ik=Tk.map(e=>{let t=Ck[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Da(t,{properties:n,required:r})}});function F_(){return Ik.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,o)=>r.localeCompare(o)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="845638dd-45b8-5057-bed2-2f687591eeaa")}catch{}})();var $_=new Map([["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),Rk=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],H_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),ji=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),nn=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),V_=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),W_=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),Y_=new Map([...W_.entries()].flatMap(([e,t])=>yt(t).map(n=>[n,e]))),J_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],wc=new Map(J_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),Ok=10,xk=20,M_=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),X_=[["init",Cm],["install",Rm],["uninstall",Om],["explore",xm],["manage",Mm],["describe",Nm],["reload",Dm],["doctor",Um],["catalog",Gm],["adopt",jm],["adopt-all",Pm],["activate",Lm],["deactivate",Fm],["migrate",$m]],Nk=[...X_.map(([e,t])=>e==="init"?[e,Im]:[e,t]),["upgrade",lr]],Pk=[...X_.map(([e,t])=>[`extension ${e}`,t]),...Nk.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",So],["config",Tm],["extension",Eo],["package",cr],["packages",cr],["install",qm],["create",Oo],["item mutate",au],["item complete",cu],["item reopen",lu],["copy",xo],["focus",No],["update",Po],["update-many",Lo],["upgrade",lr],["calendar",dr],["cal",dr],["context",mr],["ctx",mr],["get",$o],["search",jo],["eval",mu],["events",Fo],["workspace",Rt],["workspace position",[]],["workspace snapshot",Rt],["workspace snapshot create",Rt],["workspace snapshot list",Rt],["workspace snapshot inspect",Rt],["workspace snapshot restore",Rt],["workspace snapshot delete",Rt],["next",Go],["aggregate",vo],["deps",Do],["graph",Uo],["guide",Mo],["reindex",Km],["history",wo],["history-compact",km],["history-attest",Sm],["history-redact",wm],["history-repair",bm],["history-author-acknowledge",bo],["merge",vm],["schema",Em],["profile",Am],["plan",ko],["restore",Hm],["delete",Vm],["close",zm],["close-many",Ao],["append",To],["claim",Bm],["release",Wm],["start-task",Ym],["pause-task",Jm],["close-task",Xm],["comments",fm],["notes",_m],["learnings",hm],["files",gm],["docs",ym],["test",eu],["test-runs-worker",[]],["test-all",tu],["telemetry",nu],["test-runs",ru],["gc",ou],["stats",Co],["ops",[]],["duplicates",Io],["validate",iu],["health",Ro],["assurance",su],...uu,["contracts",qo],["completion",Ko],["activity",du],...[...H_].map(e=>[e,yo])],Nr=new Map(Pk);for(let{alias:e,canonical:t}of Se){let n=Nr.get(e);n!==void 0&&Nr.set(t,n)}function Lk(e){let t=Y_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function D_(e){let t=Se.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:Ea.includes(e)?ve(e):e.startsWith("extension-")?ve(`extension ${e.slice(10)}`):e.startsWith("package-")?ve(`package ${e.slice(8)}`):e.startsWith("item-")?ve(`item ${e.slice(5)}`):e.startsWith("test-runs-")?ve(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?ve(`templates ${e.slice(10)}`):ji.has(e)?W_.get(e)??ve(e):null}function Fk(e,t){let n=H(t);return n!==t||Se.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:yt(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function yt(e){return e.split("|").map(t=>ve(t)).filter(t=>t.length>0)}function $k(e,t){let n=new Set(t),r=new Set;for(let o of e)if(o.command_path)for(let i of yt(o.command_path)){let s=i.split(" ").filter(a=>a.length>0);if(s.length!==0)for(let a=s.length;a>0;a-=1){let c=s.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function Gi(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Pr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function Mk(e,t){if(!t)return{...e};let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:r}}function yc(e,t){let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let a=s.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:r}}function ve(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function Q_(e){return e.replace(/\s+/g,"-")}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function U_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=ot(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function vc(e,t,n){n&&(e[t]=!0)}function G_(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?n:null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Dk(e){let t=G_(e.long,"long"),n=G_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),vc(o,"required",e.required===!0),vc(o,"repeatable",e.repeatable===!0),vc(o,"list",e.list===!0);let i=ot(e.description);i&&(o.description=i);let s=ot(e.value_name);s&&(o.value_name=s);let a=[ot(e.value_type),ot(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function Z_(e){let t=new Map;for(let r of e){let o=ve(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},s=`${r.layer}:${r.name}`;i.sourceDedupe.has(s)||(i.sourceDedupe.add(s),i.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=Dk(a);if(!c)continue;let m=`${c.flag}|${c.short??""}`;i.dedupe.has(m)||(i.dedupe.add(m),i.flags.push(c))}t.set(o,i)}let n=new Map;for(let[r,o]of t.entries())n.set(r,{flags:o.flags,sources:o.sources.sort((i,s)=>{let a=i.layer.localeCompare(s.layer);return a!==0?a:(i.name??"").localeCompare(s.name??"")})});return n}function Uk(e){let t=Z_(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ve(i.command);if(s.length===0)continue;let a=ot(i.action)??Q_(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=ot(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:ot(m.description)}:null}).filter(m=>m!==null):[];n.set(s,{...i.tier===void 0?{}:{tier:i.tier},command:s,action:a,source:{layer:i.layer,name:i.name},description:ot(i.description),intent:ot(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:U_(i.examples),failure_hints:U_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(ve(i));for(let i of n.keys())r.add(i);for(let i of t.keys())r.add(i);let o=[];for(let i of[...r].sort((s,a)=>s.localeCompare(a))){let s=n.get(i);o.push(Gk(i,s,t.get(i)?.flags??[]))}return o}function Gk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:Q_(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function jk(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let r=t.replace(/-([a-z0-9])/g,(o,i)=>i.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return r.length>0?r:null}function qk(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function Kk(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",o=e.repeatable===!0||e.list===!0;return{type:o?"array":r,...o?{items:{type:r}}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function zk(e){let t=e.command.split("|").map(o=>o.trim()).filter(o=>o.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let o of e.arguments)n[o.name]=qk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=jk(o);!i||n[i]!==void 0||(n[i]=Kk(o,e.action),o.required===!0&&r.push(i))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function Bk(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function Hk(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((i,s)=>i.localeCompare(s)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let o=new Set(r.flags.map(i=>`${i.flag}|${i.short??""}`));for(let i of n.flags){let s=`${i.flag}|${i.short??""}`;if(!o.has(s))o.add(s),r.flags.push(i);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===s);a&&Bk(a,i)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function Vk(e,t=A){let n={mode:Tt.extensions.policy.mode,trust_mode:Tt.extensions.policy.trust_mode,default_sandbox_profile:Tt.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=E(process.cwd(),e.path);if(!await P(pe(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await ir({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await sr({...i,loaded:i.loaded});return{handlers:new Set(s.commands.handlers.map(c=>ve(c.command))),disabledReason:null,commandDefinitions:s.registrations.commands,flagRegistrations:s.registrations.flags,registrations:s.registrations,policyState:{mode:i.policy.mode,trust_mode:i.policy.trust_mode,default_sandbox_profile:i.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function Wk(e,t={}){let n=new Map;for(let r of Aa){let o=ji.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=D_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of ji)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:D_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:Se.find(o=>o.alias===r.command)?.canonical??ve(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function Yk(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!nn.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?yt(e.command_path):[],r=n.some(s=>t.handlers.has(s)||t.handlers.has(H(s))),o=n.map(s=>V_.get(H(s))).find(s=>typeof s=="string"),i=t.disabledReason===null&&r;return{action:e.action,invocable:i,available:i,requires_extension:!0,provider:"extension",disabled_reason:i?null:t.disabledReason??(o?`optional_package_not_installed:${o}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function eh(e){return Nr.get(e)??go}function Jk(e){return nn.has(H(e))?!1:Nr.has(e)}function Xk(e){return H_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function j_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function Qk(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function Zk(e){let t=new Map;for(let r of e.definitions){let o=j_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(a=>Qk(a)).find(a=>a!==null),s=r.cli_aliases.map(a=>j_(a)).filter(a=>a!==null&&a!==o);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},u=`${m.flag}|${m.short??""}`;c.seen.has(u)||(c.seen.add(u),c.flags.push(m));for(let p of s){let f=`${p}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:p}))}t.set(a,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,ba(o.flags));return n}function q_(e,t){let n=[],r=new Set;for(let o of[...e,...t]){let i=`${o.flag}|${o.short??""}`;r.has(i)||(r.add(i),n.push(o))}return ba(n)}function eS(e,t,n,r,o){let i=new Map(t);for(let{alias:s,canonical:a}of Se){let c=t.get(a)??t.get(s);c&&(i.set(s,c),i.set(a,c))}return e.map(s=>{let a=Jk(s),c=a?eh(s):[],m=n.get(Xk(s))??[],u=i.get(s),p=q_(c,m),f=q_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:nh(s),visibility:th(s,o),positionals:um(s)?.slots??[],flag_invocations:pr(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function tS(e,t=ar){let n=new Set(e),r=new Map;for(let o of J_){let i=o.aliases.filter(s=>n.has(s));r.set(o.canonical,{canonical:o.canonical,aliases:i,contracts:[]})}for(let o of t){if(!n.has(o.canonical)||o.registration==="commander"&&!n.has(o.alias))continue;let i=r.get(o.canonical)??{canonical:o.canonical,aliases:[],contracts:[]};i.aliases.includes(o.alias)||i.aliases.push(o.alias),i.contracts.push(o),r.set(o.canonical,i)}return[...r.values()].map(({contracts:o,...i})=>o.length===0?i:{...i,contracts:o}).sort((o,i)=>o.canonical.localeCompare(i.canonical))}function nS(){return{create_string_options:tp,create_repeatable_options:ti,update_string_options:np,update_repeatable_options:rp,list_string_options:am,search_string_options:cm,calendar_string_options:lm,context_string_options:dm,activity_string_options:mm}}function K_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=En(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Ee("create",a)))].sort((a,c)=>a.localeCompare(c)),s=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:s,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function rS(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=K_(o,"strict"),n[r]=K_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function oS(e,t){let n=Pr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let s=i.properties;if(typeof s!="object"||s===null)return i;let a=s.action;return typeof a!="object"||a===null||a.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function iS(e){let t=Gi(e.action)!==void 0||Gi(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,o=e.schemaOnly===!0,i=e.flagsOnly===!0,s=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,m=Gi(e.action),u=Gi(e.command),p=!r&&!c&&!o&&!i&&!s&&!m&&!u;return{selectedAction:m,selectedCommand:u,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:s,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:p,omitUnfilteredCommandFlags:p,omitUnfilteredCommanderAliases:p||u!==void 0&&!c}}function sS(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(n=>n).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function aS(e,t=A){try{return await t(e)}catch{return structuredClone(Tt)}}async function cS(e,t,n){let r=await aS(t),o=await Vk(e),i=x(r,o.registrations??O()),s=et(r.schema),a=Uk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:M(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:Zk(s),createRequiredOptionContracts:rS(i),extensionContracts:a,mergedExtensionContracts:Hk(a.filter(c=>qi(n,c.command,a))),extensionFlagMap:Z_(o.flagRegistrations)}}function z_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&ji.has(e.selectedAction)||e.selectedCommand!==void 0&&nn.has(H(e.selectedCommand)))}function lS(e,t){let n=Wk(t,{includePackageOwnedActions:z_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(Uu);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??ni(o.action))!=="internal"))}return z_(e)&&e.selectedCommand!==void 0&&nn.has(H(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Lk(H(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function dS(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new l(`Unknown action: "${e.selectedAction}".`,d.USAGE)}function mS(e,t){return[...new Set([...Ea.filter(n=>!nn.has(H(n))),...[...Nr.keys()].filter(n=>!nn.has(H(n))),...e.flatMap(n=>n.command_path?yt(n.command_path).filter(r=>n.provider==="extension"||!nn.has(H(r))||t.some(o=>o.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let o=Se.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>ve(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function uS(e,t){let n=t.slice(0,Ok),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,xk),s=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=t[0];return new l(`Command "${e}" is a command namespace. Choose a concrete child command: ${o}.`,d.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:s,nextSteps:[`Retry with a child command, for example: ${s[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --flags-only --json`,fallback_candidates:i.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function pS(e,t){return new l(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm install ${t} --project" and retry.`,d.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm install ${t} --project`],recovery:{suggested_retry:`pm install ${t} --project`}})}function fS(e){return new l(`Unknown command: "${e}".`,d.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function _S(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let r=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(r.length>0)throw uS(e.selectedCommand,r);let o=V_.get(H(e.selectedCommand));throw o?pS(e.selectedCommand,o):fS(e.selectedCommand)}function hS(e,t){let n=lS(e,t.mergedExtensionContracts);dS(e,n);let r=mS(n,t.mergedExtensionContracts);_S(e,r);let o=e.selectedCommand?Y_.get(H(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Fk(m,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!i.some(m=>m.action===e.selectedAction))throw new l(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,d.USAGE);let s=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,a=[...new Map(s.map(m=>Yk(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(m=>m.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:s,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function gS(e){return new Set(Pr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let o=r.const;return typeof o=="string"?o:null}).filter(t=>t!==null))}function yS(e){let t=Qu,n=Pr(t),r=gS(t),o=e.filter(i=>!r.has(i.action)).map(i=>zk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function B_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?Mk(n,e.selectedAction):e.selectedCommand?yc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):yc(n,r);return e.runtimeOnly&&!e.selectedAction?yc(o,new Set(t.actions)):o}function vS(e,t,n){let r=yS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?oS(B_(e,n,r),t.createRequiredOptionContracts):B_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function wS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?$k(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function th(e,t){return t.find(n=>H(n.command)===H(e))?.tier??ni(e)}function qi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||th(t,n)!=="internal"}function bS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(ar.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of wc.keys())r.add(o);return t.filter(o=>!r.has(o)&&qi(e,o,n))}function nh(e){let t=Se.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":wc.get(n)??n}var kS=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),SS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function ES(e,t){let n=M_.get(H(e))??(e.includes(" ")?void 0:M_.get(nh(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>yt(m.command).some(u=>H(u)===H(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let o=e.split(" "),i=o.at(-1),s=o.slice(0,-1).join(" "),a=kS.get(i),c=SS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function AS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(ve))].filter(i=>i.length>0).sort((i,s)=>i.localeCompare(s)).map(i=>{let s=La(i,{generateFallback:!0}),a=i.split(" ")[0],c=wc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...eh(i).map(f=>f.flag),...t.filter(f=>yt(f.command).some(_=>H(_)===H(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=($_.get(H(i))??$_.get(c)??Rk).filter(f=>m.has(f)),p=ES(i,t);return{command:i,intent:p.intent,...o||p.intent_source!=="command"?{intent_source:p.intent_source}:{},...u.length>0?{flags:u}:{},default_max_estimated_tokens:s.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...s.default_max_estimated_tokens_by_format}}:{}}})}function TS(e){return e.map(t=>({budget:La(t,{generateFallback:!0}),envelope:lp(t)}))}function CS(e){let t=new Map;for(let n of e){let r=ip(n),o=r===void 0?[d.SUCCESS,d.GENERIC_FAILURE,d.USAGE,d.NOT_FOUND,d.CONFLICT,d.DEPENDENCY_FAILED]:r.exit_codes,i=o.join(","),s=t.get(i)??{commands:[],exit_codes:o};s.commands.push(n),t.set(i,s)}return[...t.values()]}function IS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>yt(r.command).some(o=>H(o)===H(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(o=>yt(o.command).some(i=>r.has(i)))}return t.extensionContracts.filter(r=>qi(e,r.command,t.extensionContracts))}function RS(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function OS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=dp);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(o=>o.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([o])=>r===void 0||o===r).map(([o,i])=>[o,[...new Set(i.map(s=>`--${s.cli_flag}`))].sort((s,a)=>s.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...Ou],services:[...xu],policy_modes:[...Nu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...Fu],trust_modes:[...Pu],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Lu],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...Gd],create_modes:[...jd],close_validation_modes:[...qd],workflow_enforcement_modes:[...Kd]},e.relationship_kind_contracts=[...Vd,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(o=>o.definitions)].sort((o,i)=>o.kind.localeCompare(i.kind)).map(o=>({canonical:o.kind,aliases:[...o.aliases??[]],...o.inverse===void 0?{}:{inverse:o.inverse},ordering:o.ordering,hierarchy:o.hierarchy})))}function xS(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function NS(e,t,n,r,o){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=eS(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(pp).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...up],compact_fields:[...mp]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:s})=>({canonical:i,aliases:s})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function PS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=nS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function LS(e,t,n,r){e.command_summaries=AS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...qu],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(ve))].filter(o=>$a(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...zu(o).keys()]}))}:{}},e.grammar_contracts={nouns:Xt.nouns,shared_verbs:Xt.shared_verbs,scope_before_verb:Xt.scope_before_verb,visible_top_level_ceiling:Xt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Xt.ceiling_raise_requires_pm_item,positional_shape_budget:Xt.positional_shape_budget,positional_shape_count:new Set(wa.map(({slots:o})=>pm(o))).size,positional_action_count:va.length,positional_action_parents:[...new Set(va.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:wa}:{}}}async function bc(e,t){let n=iS(e);sS(n);let r=E(process.cwd(),t.path),o=await cS(t,r,n),i=hS(n,o),s=vS(n,o,i),a=wS(n,i),c=bS(n,a,o.extensionContracts),m=RS(n,s,i,c),u=IS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&LS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=tS(i.commandCatalog.filter(_=>qi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||OS(m,o,n),xS(m,n,s,u),NS(m,n,o,c,f),PS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...cf],gate_triggers:[...af]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=ho.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=F_(),m.context_intents=Vu(),m.read_output_dimensions=Fa,m.error_codes=sp,m.command_output_contracts=TS(c),m.diagnostic_output_contracts=Ku,m.command_exit_contracts={vocabulary:op,command_sets:CS(c)}),m}import{readFile as FS}from"node:fs/promises";import $S from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var kc="context-intents.json";function Ki(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function MS(e,t,n){if(!Ki(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let r=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(r)||!r.every(o=>typeof o=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:r,token_budget:e.token_budget}}function rh(e,t){let n=Array.isArray(e)?e:Ki(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((r,o)=>MS(r,t,o))}async function DS(e){let t=$S.join(e,kc),n;try{n=await FS(t,"utf8")}catch(o){if(Yt(o))return[];throw await Vp(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${kc}: ${i}`,{cause:o})}return rh(r,kc)}function US(e){if(!Ki(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Ki(n)?n.contextIntents??n.context_intents:void 0}function GS(e){return e.flatMap(t=>{let n=US(t.module);return n===void 0?[]:rh(n,`package ${t.name}`)})}async function jS(e){let t=await DS(e.pmRoot),n=GS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Sc(e,t){let n=await jS(e);return await Wu(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function oh(e,t,n=Hu){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let r=t,o=Array.isArray(r.warnings)?r.warnings.filter(i=>typeof i=="string"):[];r.warnings=[...new Set([...o,"context_usage_feedback_write_failed"])].sort()}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var Ec="PmCliError";function qS(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=d.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function ih(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new l(e,qS(t.exitCode??d.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function zi(e){if(!(e instanceof Error)||e.name!==Ec)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3113ad4b-282a-50af-a836-8e9abfde7d7e")}catch{}})();function Ac(e){let t=Wd();for(let n of e)t.register(n);return t}function sh(e,t){return{client:t,isItemNotFoundError:n=>zi(n)&&n.exitCode===d.NOT_FOUND,getItemAt:(n,r)=>lf(n,r,{pmRoot:e}),openRelationshipEventStore:n=>mf.open({pmRoot:e,nodes:n.nodes,registry:Ac(n.definitions),...n.relativePath===void 0?{}:{relativePath:n.relativePath}}),createRelationshipGraph:n=>new Jd(n.nodes,n.edges,Ac(n.definitions)),analyzeRelationshipImpact:(n,r,o)=>uf(n,r,o),validateRelationshipEvents:n=>{let r=new df(n.nodes,{registry:Ac(n.definitions)});return n.events.map(o=>r.append({...o,expectedVersion:r.version}))},commitWorkspaceTransaction:n=>pf({...n,pmRoot:e})}}import vE from"node:fs/promises";import X from"node:path";import wE from"node:readline/promises";import{stdin as bE,stdout as De}from"node:process";import Cc from"node:fs/promises";import de from"node:path";import KS from"node:readline/promises";import{stdin as zS,stdout as Bi}from"node:process";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e5ae3e66-4a45-5c62-9144-46f8f5bff7cf")}catch{}})();var ch=["ask","add","skip","status"],BS=["AGENTS.md","CLAUDE.md"],HS=["pm init","pm context","pm search","pm create","pm claim","pm files","pm docs","pm test --run","pm close","pm release","pm_author"],VS=8,Ic=1,WS="<!-- pm-cli:agent-guidance:start:",YS=`<!-- pm-cli:agent-guidance:start:v${Ic} -->`,Tc="<!-- pm-cli:agent-guidance:end -->",$r="Add workflow guidance later: pm init --agent-guidance add";var JS=()=>KS.createInterface({input:zS,output:Bi});function Lr(e,t){let n=de.relative(e,t);return n.length===0?de.basename(t):n.split(de.sep).join("/")}function ah(e){return e.endsWith(`
|
|
1
|
+
import{n as vu,o as Bo,p as Eu,q as Au,r as ka,s as Wo,t as Tu,u as Sa,v as Yo,y as Zu,z as ep}from"./focused-chunks/chunk-BKXYQQDT.js";import{a as op,f as ip,h as Zt,m as sp,o as pr,r as ni,s as ap,t as cp,x as lp}from"./focused-chunks/chunk-KMNH4G6Y.js";import{$ as Dn,$a as t_,A as Ar,Ab as f_,B as ff,Bb as __,C as Ti,Cb as Ir,D as _f,Da as Kf,Db as sc,E as hf,Eb as ac,Fa as Bf,Fb as Fi,Ga as xi,Gb as cc,Ha as gk,Hb as h_,Ia as Hf,Ib as lc,J as gf,Ja as Vf,Jb as $i,K as yf,Ka as ic,Kb as jn,L as vf,Lb as dc,M as wf,Mb as mc,N as bf,Nb as g_,O as kf,Ob as y_,P as Sf,Pb as v_,Q as Ef,Qb as qn,R as Af,Rb as uc,S as Tf,Sb as w_,T as Cf,U as If,V as Rf,Va as Yf,Vb as Mi,W as Of,Wa as Jf,X as xf,Xa as Xf,Y as Nf,Ya as Qf,Z as Pf,Za as Zf,_ as Lf,_a as e_,aa as Gt,ab as tn,ac as b_,ba as w,bb as n_,bc as k_,ca as Ff,cb as r_,cc as S_,da as $f,db as Ni,ea as Me,eb as o_,fa as Mf,fb as i_,g as af,ga as ec,gb as s_,gc as E_,h as cf,ha as Df,hb as a_,hc as N_,ia as tc,ib as c_,ja as Tr,jb as Pi,ka as Ci,kb as jt,la as Un,lb as l_,ma as Uf,mb as Li,na as nc,oa as ge,pa as rc,pb as Cr,qa as ye,ra as Gf,sa as jf,ta as Ii,ua as qf,va as Ri,wb as d_,xb as m_,y as pf,yb as u_,z as Xa,zb as p_}from"./focused-chunks/chunk-3JAEZ7WI.js";import{e as hu,g as gu,h as yu,k as wu,q as Su}from"./focused-chunks/chunk-LZOEUNHR.js";import{b as tp,c as ti,e as np,f as rp,g as ek}from"./focused-chunks/chunk-6CWR2QFM.js";import{R as Da,V as Qu,a as am,b as cm,c as lm,d as dm,f as mm}from"./focused-chunks/chunk-N2JYYEHM.js";import{a as df,b as mf,c as Di}from"./focused-chunks/chunk-YE6F5HGF.js";import{K as Wf,b as uf}from"./focused-chunks/chunk-E5AOEXF5.js";import{Ba as gc,Da as x_,Sa as xr,c as Qa,e as Za,g as oc,h as Rr,i as yk,j as pc,k as fc,l as Ui,m as vk,n as wk,pa as _c,s as A_,t as T_,u as C_,ua as Or,v as I_,w as R_,wa as hc,x as O_}from"./focused-chunks/chunk-FIQYVDLL.js";import{A as Pn,B as _i,C as hi,F as gi,G as yi,H as qp,Ha as Mn,I as vi,Ia as Zp,J as wi,Ja,K as Ln,Ka as ef,L as Wa,M as bi,N as Kp,Na as tf,O as zp,Oa as nf,P as vr,Wa as Si,Za as of,_a as br,a as si,b as ai,bb as sf,c as ci,d as li,h as di,i as Lt,j as xn,jb as gt,k as mi,l as Nn,lb as Er,m as ui,mb as en,n as le,o as pi,ob as lf,p as Ha,pb as Oi,q as Ve,r as Va,ra as Qp,s as Dp,t as Ie,ub as Gn,v as _t,w as Up,x as fi,y as Ft,z as fe}from"./focused-chunks/chunk-BULUJEOL.js";import{c as pu,f as fu,g as _u,i as zo,j as xt,k as Cu,l as Iu,m as Ru}from"./focused-chunks/chunk-PIHQNL32.js";import{a as mp,b as up,c as pp}from"./focused-chunks/chunk-QREDJ77O.js";import{$ as Um,A as wo,Aa as iu,B as vm,Ba as su,C as wm,Ca as Oo,D as bm,Da as au,E as bo,Ea as cu,F as km,Fa as lu,G as Sm,Ga as xo,H as Em,Ha as No,I as Am,Ia as Po,J as ko,Ja as Lo,K as So,Ka as dr,L as Tm,La as du,M as Eo,Ma as Fo,Na as mr,O as Cm,Oa as $o,P as cr,Pa as Mo,Q as Im,Qa as Do,R as Rm,Ra as Uo,S as Om,Sa as mu,T as xm,Ta as Rt,U as Nm,Ua as Go,V as Pm,Va as jo,W as Lm,Wa as qo,X as Fm,Xa as Ko,Y as $m,Z as Mm,_ as Dm,_a as uu,aa as Gm,ab as Ot,ba as jm,bb as L,ca as qm,d as va,da as lr,e as um,ea as Km,fa as zm,ga as Ao,h as ho,ha as To,i as wa,ia as Bm,j as Xt,ja as Hm,ka as Vm,l as pm,la as Wm,ma as Ym,na as Jm,oa as Xm,pa as Qm,q as ba,ra as Zm,s as go,sa as eu,t as yo,ta as tu,u as vo,ua as nu,v as fm,va as ru,w as _m,wa as ou,x as hm,xa as Co,y as gm,ya as Io,z as ym,za as Ro}from"./focused-chunks/chunk-S5JYIFFS.js";import{$ as Ep,$a as Fn,A as hk,Ab as _e,B as On,Bb as Yp,C,Cb as ki,Db as ht,Eb as Jp,Fb as se,G as ft,Ga as Pp,Gb as Xp,Ia as Ba,K as hp,Kb as rf,L as ii,La as Lp,M as gp,Ma as Fp,N as yp,Na as rt,O as vp,P as wp,Q as bp,Qa as $p,Qb as kr,Ra as Mp,Rb as Sr,S as ee,Sa as A,Sb as Ei,T as Ua,Ta as $e,Tb as Ut,U as ne,Ua as Ce,Va as Gp,W as Ga,Wa as jp,X as kp,Xa as $t,Y as He,Yb as Ai,Z as tt,Za as Ke,_ as Sp,_a as yr,a as tk,ab as Bp,b as nk,ba as Ap,bb as $n,c as rk,ca as Tp,cb as Ya,d as ok,da as ja,db as Hp,ga as qa,ia as Cp,j as ri,ja as Ip,jb as wr,k as fp,ka as Rp,l as _p,la as Op,m as Rn,ma as xp,n as fr,nc as zf,o as ik,p as sk,q as ak,qa as Fe,qb as Mt,r as ck,ra as Pt,s as lk,sb as Dt,t as dk,ta as Ka,u as mk,ua as _r,ub as Vp,v as uk,va as hr,vb as I,w as pk,wa as za,wb as q,x as oi,xa as nt,xb as ie,y as fk,ya as Np,yb as Wp,z as _k,za as gr}from"./focused-chunks/chunk-HJA6OHWT.js";import{b as Ct,c as mo,d as uo,g as ut,i as Ho,j as pt,k as Nt,l as bu,n as M,o as Vo,p as et,r as ku}from"./focused-chunks/chunk-BQSKFRL2.js";import{e as dp}from"./focused-chunks/chunk-HFAW3FJQ.js";import{$ as d,$a as pe,$b as xu,$d as Te,Ab as sr,Ac as ju,Ad as jb,B as Gd,Bd as qb,C as jd,Cc as Ca,Cd as Kb,Ce as Jb,D as qd,Dc as Ia,De as Xb,E as Kd,Ec as Ra,Ed as zb,Ee as Qb,F as zd,Fb as Se,Fc as Oa,Fd as Bb,Fe as Zb,G as Bd,Ga as Sn,Gc as xa,Gd as Fa,Ge as ei,H as la,Hb as H,Hc as Na,Hd as $a,He as Xu,I as da,Ia as Xd,Ic as Pa,Id as Ma,J as ma,Jb as ar,Jc as O,Jd as zu,K as ua,Ka as ha,Kc as Tn,L as pa,Lc as Qt,Ld as Bu,M as fa,Mc as J,Md as Hb,Na as ga,Nc as Jo,Oa as nr,Oc as Cn,Od as Vb,P as lo,Pa as Ee,Pb as An,Pd as Wb,Qd as Yb,Rc as Xo,Sa as x,Sd as S,Ta as ke,Tc as Ae,U as _a,Ua as fo,Uc as Qo,Va as En,W as Hd,Wa as rr,Wd as Zo,Xa as Qd,Ya as E,Yc as ur,Yd as oe,Z as Tt,Za as Zd,_a as lt,_b as Ou,aa as l,ab as dt,ac as Nu,bc as Pu,cb as Ze,cc as Lu,db as _o,dc as Fu,ec as Ea,fc as $u,fe as Hu,hb as em,hc as Mu,ia as Vd,ib as tm,ic as Du,jb as nm,ka as Wd,kb as rm,kd as qu,lb as om,lc as Aa,ma as po,mb as im,mc as Uu,me as Vu,nb as sm,nc as Ta,ne as Wu,o as so,oa as Yd,od as Ku,p as Ud,pa as Jd,pb as or,q as ao,qb as Jt,qe as In,r as ca,rb as mt,sa as P,ta as Yt,td as La,ua as It,uc as Gu,ue as Yu,v as Wt,va as Z,w as ct,wa as te,x as wn,y as bn,ya as kn,yb as ir,ye as Ju,z as co,zb as ya}from"./focused-chunks/chunk-L554BKFH.js";import{AsyncLocalStorage as RM}from"node:async_hooks";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1979adcd-4a7f-5dc7-b5dd-6bfc15eed1af")}catch{}})();var bk=Da("list").properties.outputSession,kk={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...bk},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},P_={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},L_={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},ae={type:"string",description:"pm item id, for example pm-abc1."},Sk=`Operation name (one of): ${Ta.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,Ek={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},Ak={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function U(e,t=[]){return{...L_,properties:{...L_.properties,...e},required:t}}var Tk=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:U({action:{type:"string",enum:[...Ta],description:Sk},id:ae,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...kk},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:U({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:U({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:U({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:U({query:{type:"string"},options:{type:"object"},...Ak},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:U({options:{type:"object"},...Ek})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:U({id:ae,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:U({since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId. Set dryRun=true to validate and preview without writes.",inputSchema:U({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"]},id:ae,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"}},required:["op"],additionalProperties:!1}},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["transactionId","mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({id:ae,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:U({id:ae,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:U({id:ae,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({id:ae,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:U({id:ae,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:U({id:ae,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:U({id:ae,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:"List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls default to the most recent 20 comments with total_count/has_more metadata for token efficiency. Pass options.limit=N to choose a page size, options.limit=0 for summary-only metadata, or options.full=true for full history.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:U({subcommand:{type:"string",enum:[...$u]},id:ae,target:ae,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:U({id:ae,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:U({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:U({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:U({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:U({...P_,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...An],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...ca]},description:`Lifecycle roles for add-status: ${ca.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:P_}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:U({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:U({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:U({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],Ck={pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},Ik=Tk.map(e=>{let t=Ck[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Da(t,{properties:n,required:r})}});function F_(){return Ik.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,o)=>r.localeCompare(o)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="845638dd-45b8-5057-bed2-2f687591eeaa")}catch{}})();var $_=new Map([["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),Rk=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],H_=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),ji=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),nn=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),V_=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),W_=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),Y_=new Map([...W_.entries()].flatMap(([e,t])=>yt(t).map(n=>[n,e]))),J_=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],wc=new Map(J_.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),Ok=10,xk=20,M_=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),X_=[["init",Cm],["install",Rm],["uninstall",Om],["explore",xm],["manage",Mm],["describe",Nm],["reload",Dm],["doctor",Um],["catalog",Gm],["adopt",jm],["adopt-all",Pm],["activate",Lm],["deactivate",Fm],["migrate",$m]],Nk=[...X_.map(([e,t])=>e==="init"?[e,Im]:[e,t]),["upgrade",lr]],Pk=[...X_.map(([e,t])=>[`extension ${e}`,t]),...Nk.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",So],["config",Tm],["extension",Eo],["package",cr],["packages",cr],["install",qm],["create",Oo],["item mutate",au],["item complete",cu],["item reopen",lu],["copy",xo],["focus",No],["update",Po],["update-many",Lo],["upgrade",lr],["calendar",dr],["cal",dr],["context",mr],["ctx",mr],["get",$o],["search",jo],["eval",mu],["events",Fo],["workspace",Rt],["workspace position",[]],["workspace snapshot",Rt],["workspace snapshot create",Rt],["workspace snapshot list",Rt],["workspace snapshot inspect",Rt],["workspace snapshot restore",Rt],["workspace snapshot delete",Rt],["next",Go],["aggregate",vo],["deps",Do],["graph",Uo],["guide",Mo],["reindex",Km],["history",wo],["history-compact",km],["history-attest",Sm],["history-redact",wm],["history-repair",bm],["history-author-acknowledge",bo],["merge",vm],["schema",Em],["profile",Am],["plan",ko],["restore",Hm],["delete",Vm],["close",zm],["close-many",Ao],["append",To],["claim",Bm],["release",Wm],["start-task",Ym],["pause-task",Jm],["close-task",Xm],["comments",fm],["notes",_m],["learnings",hm],["files",gm],["docs",ym],["test",eu],["test-runs-worker",[]],["test-all",tu],["telemetry",nu],["test-runs",ru],["gc",ou],["stats",Co],["ops",[]],["duplicates",Io],["validate",iu],["health",Ro],["assurance",su],...uu,["contracts",qo],["completion",Ko],["activity",du],...[...H_].map(e=>[e,yo])],Nr=new Map(Pk);for(let{alias:e,canonical:t}of Se){let n=Nr.get(e);n!==void 0&&Nr.set(t,n)}function Lk(e){let t=Y_.get(e);return t||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function D_(e){let t=Se.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:Ea.includes(e)?ve(e):e.startsWith("extension-")?ve(`extension ${e.slice(10)}`):e.startsWith("package-")?ve(`package ${e.slice(8)}`):e.startsWith("item-")?ve(`item ${e.slice(5)}`):e.startsWith("test-runs-")?ve(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?ve(`templates ${e.slice(10)}`):ji.has(e)?W_.get(e)??ve(e):null}function Fk(e,t){let n=H(t);return n!==t||Se.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:yt(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function yt(e){return e.split("|").map(t=>ve(t)).filter(t=>t.length>0)}function $k(e,t){let n=new Set(t),r=new Set;for(let o of e)if(o.command_path)for(let i of yt(o.command_path)){let s=i.split(" ").filter(a=>a.length>0);if(s.length!==0)for(let a=s.length;a>0;a-=1){let c=s.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((o,i)=>o.localeCompare(i))}function Gi(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Pr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function Mk(e,t){if(!t)return{...e};let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:r}}function yc(e,t){let r=Pr(e).filter(o=>{let i=o.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let a=s.const;return typeof a=="string"&&t.has(a)});return{...e,oneOf:r}}function ve(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function Q_(e){return e.replace(/\s+/g,"-")}function ot(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function U_(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let o=ot(r);!o||n.has(o)||(n.add(o),t.push(o))}return t}function vc(e,t,n){n&&(e[t]=!0)}function G_(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?n:null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function Dk(e){let t=G_(e.long,"long"),n=G_(e.short,"short"),r=t??n;if(!r)return null;let o={flag:r};n&&t&&(o.short=n),vc(o,"required",e.required===!0),vc(o,"repeatable",e.repeatable===!0),vc(o,"list",e.list===!0);let i=ot(e.description);i&&(o.description=i);let s=ot(e.value_name);s&&(o.value_name=s);let a=[ot(e.value_type),ot(e.type),s?"string":null].find(c=>c==="string"||c==="number"||c==="boolean");return a&&(o.value_type=a),o}function Z_(e){let t=new Map;for(let r of e){let o=ve(r.target_command);if(o.length===0)continue;let i=t.get(o)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},s=`${r.layer}:${r.name}`;i.sourceDedupe.has(s)||(i.sourceDedupe.add(s),i.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=Dk(a);if(!c)continue;let m=`${c.flag}|${c.short??""}`;i.dedupe.has(m)||(i.dedupe.add(m),i.flags.push(c))}t.set(o,i)}let n=new Map;for(let[r,o]of t.entries())n.set(r,{flags:o.flags,sources:o.sources.sort((i,s)=>{let a=i.layer.localeCompare(s.layer);return a!==0?a:(i.name??"").localeCompare(s.name??"")})});return n}function Uk(e){let t=Z_(e.flagRegistrations),n=new Map;for(let i of e.commandDefinitions){let s=ve(i.command);if(s.length===0)continue;let a=ot(i.action)??Q_(s),c=Array.isArray(i.arguments)?i.arguments.map(m=>{let u=ot(m.name);return u?{name:u,required:m.required===!0,variadic:m.variadic===!0,description:ot(m.description)}:null}).filter(m=>m!==null):[];n.set(s,{...i.tier===void 0?{}:{tier:i.tier},command:s,action:a,source:{layer:i.layer,name:i.name},description:ot(i.description),intent:ot(i.intent),arguments:c,flags:t.get(s)?.flags??[],examples:U_(i.examples),failure_hints:U_(i.failure_hints)})}let r=new Set;for(let i of e.handlers)r.add(ve(i));for(let i of n.keys())r.add(i);for(let i of t.keys())r.add(i);let o=[];for(let i of[...r].sort((s,a)=>s.localeCompare(a))){let s=n.get(i);o.push(Gk(i,s,t.get(i)?.flags??[]))}return o}function Gk(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:Q_(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function jk(e){let t=e.flag.replace(/^-+/,"").trim();if(t.length===0)return null;let r=t.replace(/-([a-z0-9])/g,(o,i)=>i.toUpperCase()).replace(/[^a-zA-Z0-9]/g,"");return r.length>0?r:null}function qk(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function Kk(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",o=e.repeatable===!0||e.list===!0;return{type:o?"array":r,...o?{items:{type:r}}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function zk(e){let t=e.command.split("|").map(o=>o.trim()).filter(o=>o.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let o of e.arguments)n[o.name]=qk(o,e.action),o.required&&r.push(o.name);for(let o of e.flags){let i=jk(o);!i||n[i]!==void 0||(n[i]=Kk(o,e.action),o.required===!0&&r.push(i))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function Bk(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function Hk(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((i,s)=>i.localeCompare(s)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let o=new Set(r.flags.map(i=>`${i.flag}|${i.short??""}`));for(let i of n.flags){let s=`${i.flag}|${i.short??""}`;if(!o.has(s))o.add(s),r.flags.push(i);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===s);a&&Bk(a,i)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function Vk(e,t=A){let n={mode:Tt.extensions.policy.mode,trust_mode:Tt.extensions.policy.trust_mode,default_sandbox_profile:Tt.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=E(process.cwd(),e.path);if(!await P(pe(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let o=await t(r),i=await ir({pmRoot:r,settings:o,cwd:process.cwd(),noExtensions:!1}),s=await sr({...i,loaded:i.loaded});return{handlers:new Set(s.commands.handlers.map(c=>ve(c.command))),disabledReason:null,commandDefinitions:s.registrations.commands,flagRegistrations:s.registrations.flags,registrations:s.registrations,policyState:{mode:i.policy.mode,trust_mode:i.policy.trust_mode,default_sandbox_profile:i.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function Wk(e,t={}){let n=new Map;for(let r of Aa){let o=ji.has(r);if(o&&!t.includePackageOwnedActions)continue;let i=D_(r);n.set(r,{action:r,provider:o?"extension":"core",requires_extension:o,command_path:i})}if(t.includePackageOwnedActions)for(let r of ji)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:D_(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:Se.find(o=>o.alias===r.command)?.canonical??ve(r.command)});return[...n.values()].sort((r,o)=>(r.action??"").localeCompare(o.action??""))}function Yk(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!nn.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?yt(e.command_path):[],r=n.some(s=>t.handlers.has(s)||t.handlers.has(H(s))),o=n.map(s=>V_.get(H(s))).find(s=>typeof s=="string"),i=t.disabledReason===null&&r;return{action:e.action,invocable:i,available:i,requires_extension:!0,provider:"extension",disabled_reason:i?null:t.disabledReason??(o?`optional_package_not_installed:${o}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function eh(e){return Nr.get(e)??go}function Jk(e){return nn.has(H(e))?!1:Nr.has(e)}function Xk(e){return H_.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function j_(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function Qk(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function Zk(e){let t=new Map;for(let r of e.definitions){let o=j_(r.cli_flag);if(!o)continue;let i=r.cli_aliases.map(a=>Qk(a)).find(a=>a!==null),s=r.cli_aliases.map(a=>j_(a)).filter(a=>a!==null&&a!==o);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},m=i?{flag:o,short:i}:{flag:o},u=`${m.flag}|${m.short??""}`;c.seen.has(u)||(c.seen.add(u),c.flags.push(m));for(let p of s){let f=`${p}|`;c.seen.has(f)||(c.seen.add(f),c.flags.push({flag:p}))}t.set(a,c)}}let n=new Map;for(let[r,o]of t.entries())n.set(r,ba(o.flags));return n}function q_(e,t){let n=[],r=new Set;for(let o of[...e,...t]){let i=`${o.flag}|${o.short??""}`;r.has(i)||(r.add(i),n.push(o))}return ba(n)}function eS(e,t,n,r,o){let i=new Map(t);for(let{alias:s,canonical:a}of Se){let c=t.get(a)??t.get(s);c&&(i.set(s,c),i.set(a,c))}return e.map(s=>{let a=Jk(s),c=a?eh(s):[],m=n.get(Xk(s))??[],u=i.get(s),p=q_(c,m),f=q_(p,u?.flags??[]),_=c.length>0&&(u?.flags.length??0)>0?"mixed":a?"core":"extension";return{command:s,flags:f,...r?{canonical_command:nh(s),visibility:th(s,o),positionals:um(s)?.slots??[],flag_invocations:pr(s,f)}:{},provider:_,extension_sources:u?.sources}}).sort((s,a)=>s.command.localeCompare(a.command))}function tS(e,t=ar){let n=new Set(e),r=new Map;for(let o of J_){let i=o.aliases.filter(s=>n.has(s));r.set(o.canonical,{canonical:o.canonical,aliases:i,contracts:[]})}for(let o of t){if(!n.has(o.canonical)||o.registration==="commander"&&!n.has(o.alias))continue;let i=r.get(o.canonical)??{canonical:o.canonical,aliases:[],contracts:[]};i.aliases.includes(o.alias)||i.aliases.push(o.alias),i.contracts.push(o),r.set(o.canonical,i)}return[...r.values()].map(({contracts:o,...i})=>o.length===0?i:{...i,contracts:o}).sort((o,i)=>o.canonical.localeCompare(i.canonical))}function nS(){return{create_string_options:tp,create_repeatable_options:ti,update_string_options:np,update_repeatable_options:rp,list_string_options:am,search_string_options:cm,calendar_string_options:lm,context_string_options:dm,activity_string_options:mm}}function K_(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=En(e,"create",n),o=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),i=[...new Set(o.map(a=>Ee("create",a)))].sort((a,c)=>a.localeCompare(c)),s=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:o,required_flags:i,required_type_options:s,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function rS(e){let t={},n={};for(let r of[...e.types].sort((o,i)=>o.localeCompare(i))){let o=e.by_type[r];t[r]=K_(o,"strict"),n[r]=K_(o,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function oS(e,t){let n=Pr(e);if(n.length===0)return e;let r=!1,o=n.map(i=>{let s=i.properties;if(typeof s!="object"||s===null)return i;let a=s.action;return typeof a!="object"||a===null||a.const!=="create"?i:(r=!0,{...i,"x-create-required-options":t})});return r?{...e,oneOf:o}:e}function iS(e){let t=Gi(e.action)!==void 0||Gi(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,o=e.schemaOnly===!0,i=e.flagsOnly===!0,s=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,m=Gi(e.action),u=Gi(e.command),p=!r&&!c&&!o&&!i&&!s&&!m&&!u;return{selectedAction:m,selectedCommand:u,summary:r,schemaOnly:o,flagsOnly:i,availabilityOnly:s,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:p,omitUnfilteredCommandFlags:p,omitUnfilteredCommanderAliases:p||u!==void 0&&!c}}function sS(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(n=>n).length>1)throw new l("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",d.USAGE)}async function aS(e,t=A){try{return await t(e)}catch{return structuredClone(Tt)}}async function cS(e,t,n){let r=await aS(t),o=await Vk(e),i=x(r,o.registrations??O()),s=et(r.schema),a=Uk(o);return{settings:r,runtimeProbe:o,typeRegistry:i,statusRegistry:M(r.schema),runtimeFieldRegistry:s,runtimeFieldFlagMap:Zk(s),createRequiredOptionContracts:rS(i),extensionContracts:a,mergedExtensionContracts:Hk(a.filter(c=>qi(n,c.command,a))),extensionFlagMap:Z_(o.flagRegistrations)}}function z_(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&ji.has(e.selectedAction)||e.selectedCommand!==void 0&&nn.has(H(e.selectedCommand)))}function lS(e,t){let n=Wk(t,{includePackageOwnedActions:z_(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(Uu);return n.filter(o=>!r.has(o.action)&&(e.fullOutput||(t.find(i=>i.action===o.action)?.tier??ni(o.action))!=="internal"))}return z_(e)&&e.selectedCommand!==void 0&&nn.has(H(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:Lk(H(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function dS(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new l(`Unknown action: "${e.selectedAction}".`,d.USAGE)}function mS(e,t){return[...new Set([...Ea.filter(n=>!nn.has(H(n))),...[...Nr.keys()].filter(n=>!nn.has(H(n))),...e.flatMap(n=>n.command_path?yt(n.command_path).filter(r=>n.provider==="extension"||!nn.has(H(r))||t.some(o=>o.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let o=Se.find(i=>i.alias===r||i.canonical===r);return o===void 0?[r]:[o.alias,o.canonical]}))])].map(n=>ve(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function uS(e,t){let n=t.slice(0,Ok),r=t.length-n.length,o=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),i=t.slice(0,xk),s=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=t[0];return new l(`Command "${e}" is a command namespace. Choose a concrete child command: ${o}.`,d.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:s,nextSteps:[`Retry with a child command, for example: ${s[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --flags-only --json`,fallback_candidates:i.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function pS(e,t){return new l(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm install ${t} --project" and retry.`,d.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm install ${t} --project`],recovery:{suggested_retry:`pm install ${t} --project`}})}function fS(e){return new l(`Unknown command: "${e}".`,d.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function _S(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let r=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(r.length>0)throw uS(e.selectedCommand,r);let o=V_.get(H(e.selectedCommand));throw o?pS(e.selectedCommand,o):fS(e.selectedCommand)}function hS(e,t){let n=lS(e,t.mergedExtensionContracts);dS(e,n);let r=mS(n,t.mergedExtensionContracts);_S(e,r);let o=e.selectedCommand?Y_.get(H(e.selectedCommand)):void 0,i=e.selectedCommand?n.filter(m=>o?m.action===o:Fk(m,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!i.some(m=>m.action===e.selectedAction))throw new l(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,d.USAGE);let s=e.selectedAction?i.filter(m=>m.action===e.selectedAction):i,a=[...new Map(s.map(m=>Yk(m,t.runtimeProbe)).map(m=>[o?m.action:`${m.action}|${m.command_path??""}`,m])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(m=>m.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:i,scopedActionDescriptors:s,selectedPackageOwnedAction:o,actionAvailability:c,actions:[...new Set(c.map(m=>m.action))]}}function gS(e){return new Set(Pr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let o=r.const;return typeof o=="string"?o:null}).filter(t=>t!==null))}function yS(e){let t=Qu,n=Pr(t),r=gS(t),o=e.filter(i=>!r.has(i.action)).map(i=>zk(i));return o.length>0?{...t,oneOf:[...n,...o]}:t}function B_(e,t,n){let r=new Set(t.actionDescriptors.map(i=>i.action)),o=e.selectedAction?Mk(n,e.selectedAction):e.selectedCommand?yc(n,new Set(t.scopedActionDescriptors.map(i=>i.action))):yc(n,r);return e.runtimeOnly&&!e.selectedAction?yc(o,new Set(t.actions)):o}function vS(e,t,n){let r=yS(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?oS(B_(e,n,r),t.createRequiredOptionContracts):B_(e,n,r);return{mergedSchema:r,filteredSchema:i}}function wS(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?$k(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function th(e,t){return t.find(n=>H(n.command)===H(e))?.tier??ni(e)}function qi(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||th(t,n)!=="internal"}function bS(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(ar.filter(o=>o.hidden&&(o.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(o=>o.alias));if(e.summary&&!e.fullOutput)for(let o of wc.keys())r.add(o);return t.filter(o=>!r.has(o)&&qi(e,o,n))}function nh(e){let t=Se.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":wc.get(n)??n}var kS=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),SS=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function ES(e,t){let n=M_.get(H(e))??(e.includes(" ")?void 0:M_.get(nh(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(m=>yt(m.command).some(u=>H(u)===H(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let o=e.split(" "),i=o.at(-1),s=o.slice(0,-1).join(" "),a=kS.get(i),c=SS.get(e)??s;return{intent:a===void 0||s.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function AS(e,t=[],n={}){let r=n.includeFormatBudgets??!0,o=n.includeIntentProvenance??!0;return[...new Set(e.map(ve))].filter(i=>i.length>0).sort((i,s)=>i.localeCompare(s)).map(i=>{let s=La(i,{generateFallback:!0}),a=i.split(" ")[0],c=wc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),m=new Set([...eh(i).map(f=>f.flag),...t.filter(f=>yt(f.command).some(_=>H(_)===H(i))).flatMap(f=>f.flags.map(_=>_.flag))]),u=($_.get(H(i))??$_.get(c)??Rk).filter(f=>m.has(f)),p=ES(i,t);return{command:i,intent:p.intent,...o||p.intent_source!=="command"?{intent_source:p.intent_source}:{},...u.length>0?{flags:u}:{},default_max_estimated_tokens:s.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...s.default_max_estimated_tokens_by_format}}:{}}})}function TS(e){return e.map(t=>({budget:La(t,{generateFallback:!0}),envelope:lp(t)}))}function CS(e){let t=new Map;for(let n of e){let r=ip(n),o=r===void 0?[d.SUCCESS,d.GENERIC_FAILURE,d.USAGE,d.NOT_FOUND,d.CONFLICT,d.DEPENDENCY_FAILED]:r.exit_codes,i=o.join(","),s=t.get(i)??{commands:[],exit_codes:o};s.commands.push(n),t.set(i,s)}return[...t.values()]}function IS(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>yt(r.command).some(o=>H(o)===H(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(o=>yt(o.command).some(i=>r.has(i)))}return t.extensionContracts.filter(r=>qi(e,r.command,t.extensionContracts))}function RS(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function OS(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=dp);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(o=>o.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([o])=>r===void 0||o===r).map(([o,i])=>[o,[...new Set(i.map(s=>`--${s.cli_flag}`))].sort((s,a)=>s.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...Ou],services:[...xu],policy_modes:[...Nu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...Fu],trust_modes:[...Pu],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...Lu],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...Gd],create_modes:[...jd],close_validation_modes:[...qd],workflow_enforcement_modes:[...Kd]},e.relationship_kind_contracts=[...Vd,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(o=>o.definitions)].sort((o,i)=>o.kind.localeCompare(i.kind)).map(o=>({canonical:o.kind,aliases:[...o.aliases??[]],...o.inverse===void 0?{}:{inverse:o.inverse},ordering:o.ordering,hierarchy:o.hierarchy})))}function xS(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function NS(e,t,n,r,o){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=eS(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let i=new Set(r);e.list_projections=Object.entries(pp).filter(([s])=>i.has(s)).map(([s,a])=>({command:s,default:a,brief_fields:[...up],compact_fields:[...mp]}))}e.command_aliases=t.fullOutput?o:o.map(({canonical:i,aliases:s})=>({canonical:i,aliases:s})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function PS(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=nS();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function LS(e,t,n,r){e.command_summaries=AS(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...qu],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(ve))].filter(o=>$a(o)!==void 0).sort((o,i)=>o.localeCompare(i)).map(o=>({command:o,modes:[...zu(o).keys()]}))}:{}},e.grammar_contracts={nouns:Xt.nouns,shared_verbs:Xt.shared_verbs,scope_before_verb:Xt.scope_before_verb,visible_top_level_ceiling:Xt.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Xt.ceiling_raise_requires_pm_item,positional_shape_budget:Xt.positional_shape_budget,positional_shape_count:new Set(wa.map(({slots:o})=>pm(o))).size,positional_action_count:va.length,positional_action_parents:[...new Set(va.map(({parent:o})=>o))].sort((o,i)=>o.localeCompare(i)),...r.includePositionalSignatures?{positional_signatures:wa}:{}}}async function bc(e,t){let n=iS(e);sS(n);let r=E(process.cwd(),t.path),o=await cS(t,r,n),i=hS(n,o),s=vS(n,o,i),a=wS(n,i),c=bS(n,a,o.extensionContracts),m=RS(n,s,i,c),u=IS(n,o,c),p=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&LS(m,c,u,{includeFormatBudgets:p,includeIntentProvenance:p,includePositionalSignatures:p,includeProjectionModeMatrix:p}),n.summary)return m;let f=tS(i.commandCatalog.filter(_=>qi(n,_,o.extensionContracts)));return n.flagsOnly&&!n.fullOutput||OS(m,o,n),xS(m,n,s,u),NS(m,n,o,c,f),PS(m,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(m.assurance_contracts={measurement_source_kinds:[...cf],gate_triggers:[...af]}),n.fullOutput&&m.grammar_contracts&&(m.grammar_contracts.destinations=ho.map(_=>({..._,reason:_.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(m.mcp_tools=F_(),m.context_intents=Vu(),m.read_output_dimensions=Fa,m.error_codes=sp,m.command_output_contracts=TS(c),m.diagnostic_output_contracts=Ku,m.command_exit_contracts={vocabulary:op,command_sets:CS(c)}),m}import{readFile as FS}from"node:fs/promises";import $S from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c64f304d-9081-5bad-8187-7bf6b65e4a07")}catch{}})();var kc="context-intents.json";function Ki(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function MS(e,t,n){if(!Ki(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let r=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(r)||!r.every(o=>typeof o=="string")||typeof e.token_budget!="number")throw new TypeError(`${t} context intent at index ${String(n)} has an invalid contract shape`);return{command:e.command,intent:e.intent,description:e.description,included_field_groups:r,token_budget:e.token_budget}}function rh(e,t){let n=Array.isArray(e)?e:Ki(e)&&Array.isArray(e.intents)?e.intents:void 0;if(!n)throw new TypeError(`${t} context intents must be an array or an object with an intents array`);return n.map((r,o)=>MS(r,t,o))}async function DS(e){let t=$S.join(e,kc),n;try{n=await FS(t,"utf8")}catch(o){if(Yt(o))return[];throw await Vp(e),o}let r;try{r=JSON.parse(n)}catch(o){let i=o instanceof Error?o.message:String(o);throw new TypeError(`Invalid ${kc}: ${i}`,{cause:o})}return rh(r,kc)}function US(e){if(!Ki(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Ki(n)?n.contextIntents??n.context_intents:void 0}function GS(e){return e.flatMap(t=>{let n=US(t.module);return n===void 0?[]:rh(n,`package ${t.name}`)})}async function jS(e){let t=await DS(e.pmRoot),n=GS(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Sc(e,t){let n=await jS(e);return await Wu(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2766f4e-6354-55bb-9e40-676273ee901f")}catch{}})();async function oh(e,t,n=Hu){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let r=t,o=Array.isArray(r.warnings)?r.warnings.filter(i=>typeof i=="string"):[];r.warnings=[...new Set([...o,"context_usage_feedback_write_failed"])].sort()}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9133d39d-b2fb-5f99-8fd3-87a7d2f8df6d")}catch{}})();var Ec="PmCliError";function qS(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=d.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function ih(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new l(e,qS(t.exitCode??d.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function zi(e){if(!(e instanceof Error)||e.name!==Ec)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3113ad4b-282a-50af-a836-8e9abfde7d7e")}catch{}})();function Ac(e){let t=Wd();for(let n of e)t.register(n);return t}function sh(e,t){return{client:t,isItemNotFoundError:n=>zi(n)&&n.exitCode===d.NOT_FOUND,getItemAt:(n,r)=>lf(n,r,{pmRoot:e}),openRelationshipEventStore:n=>mf.open({pmRoot:e,nodes:n.nodes,registry:Ac(n.definitions),...n.relativePath===void 0?{}:{relativePath:n.relativePath}}),createRelationshipGraph:n=>new Jd(n.nodes,n.edges,Ac(n.definitions)),analyzeRelationshipImpact:(n,r,o)=>uf(n,r,o),validateRelationshipEvents:n=>{let r=new df(n.nodes,{registry:Ac(n.definitions)});return n.events.map(o=>r.append({...o,expectedVersion:r.version}))},commitWorkspaceTransaction:n=>pf({...n,pmRoot:e})}}import vE from"node:fs/promises";import X from"node:path";import wE from"node:readline/promises";import{stdin as bE,stdout as De}from"node:process";import Cc from"node:fs/promises";import de from"node:path";import KS from"node:readline/promises";import{stdin as zS,stdout as Bi}from"node:process";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e5ae3e66-4a45-5c62-9144-46f8f5bff7cf")}catch{}})();var ch=["ask","add","skip","status"],BS=["AGENTS.md","CLAUDE.md"],HS=["pm init","pm context","pm search","pm create","pm claim","pm files","pm docs","pm test --run","pm close","pm release","pm_author"],VS=8,Ic=1,WS="<!-- pm-cli:agent-guidance:start:",YS=`<!-- pm-cli:agent-guidance:start:v${Ic} -->`,Tc="<!-- pm-cli:agent-guidance:end -->",$r="Add workflow guidance later: pm init --agent-guidance add";var JS=()=>KS.createInterface({input:zS,output:Bi});function Lr(e,t){let n=de.relative(e,t);return n.length===0?de.basename(t):n.split(de.sep).join("/")}function ah(e){return e.endsWith(`
|
|
2
2
|
`)?e:`${e}
|
|
3
3
|
`}function XS(e){return e.includes(`\r
|
|
4
4
|
`)?`\r
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$b as ki,Aa as je,Ba as Fe,Ca as qe,Da as ze,Ea as Je,F as Ie,G as $e,H as Be,I as Ce,J as De,La as Ke,Ma as Xe,Na as Le,Oa as Qe,Pa as Me,Qa as ei,Ra as ii,Sa as ri,Ta as ti,Tb as mi,Ua as ni,Ub as xi,Vb as vi,Wb as bi,Xb as yi,Yb as hi,Zb as wi,_b as gi,a as oe,ac as Ai,b as de,bc as Ei,c as ae,cc as _,d as ue,dc as Ri,e as se,ec as Si,f as fe,fc as Ti,g as pe,gc as Ii,h as ce,hc as $i,i as _e,ic as Bi,j as le,jb as oi,jc as Ci,k as me,kc as l,l as xe,m as ve,n as be,nb as di,o as ye,ob as ai,p as he,pb as ui,q as we,qb as si,r as ge,rb as fi,s as ke,sb as pi,t as Ae,tb as ci,u as Ee,ub as _i,v as Re,vb as li,w as Se,wa as Ne,x as Te,xa as Oe,ya as Ue,za as Pe}from"./focused-chunks/chunk-
|
|
1
|
+
import{$b as ki,Aa as je,Ba as Fe,Ca as qe,Da as ze,Ea as Je,F as Ie,G as $e,H as Be,I as Ce,J as De,La as Ke,Ma as Xe,Na as Le,Oa as Qe,Pa as Me,Qa as ei,Ra as ii,Sa as ri,Ta as ti,Tb as mi,Ua as ni,Ub as xi,Vb as vi,Wb as bi,Xb as yi,Yb as hi,Zb as wi,_b as gi,a as oe,ac as Ai,b as de,bc as Ei,c as ae,cc as _,d as ue,dc as Ri,e as se,ec as Si,f as fe,fc as Ti,g as pe,gc as Ii,h as ce,hc as $i,i as _e,ic as Bi,j as le,jb as oi,jc as Ci,k as me,kc as l,l as xe,m as ve,n as be,nb as di,o as ye,ob as ai,p as he,pb as ui,q as we,qb as si,r as ge,rb as fi,s as ke,sb as pi,t as Ae,tb as ci,u as Ee,ub as _i,v as Re,vb as li,w as Se,wa as Ne,x as Te,xa as Oe,ya as Ue,za as Pe}from"./focused-chunks/chunk-3JAEZ7WI.js";import"./focused-chunks/chunk-LZOEUNHR.js";import{h as j}from"./focused-chunks/chunk-6CWR2QFM.js";import{E as B,F as C,G as D,H as N,I as O,J as U,K as P}from"./focused-chunks/chunk-N2JYYEHM.js";import"./focused-chunks/chunk-E5AOEXF5.js";import{Aa as Q,Ba as M,Ca as ee,Da as ie,Ea as re,Fa as te,Ga as ne,pb as We,qb as Ze,rb as Ge,sa as G,sb as He,ta as H,tb as Ve,ua as V,ub as Ye,va as Y,wa as K,xa as X,za as L}from"./focused-chunks/chunk-BULUJEOL.js";import"./focused-chunks/chunk-PIHQNL32.js";import"./focused-chunks/chunk-QREDJ77O.js";import"./focused-chunks/chunk-S5JYIFFS.js";import{D as F,E as q,F as z,G as J,H as W,gb as Z}from"./focused-chunks/chunk-HJA6OHWT.js";import"./focused-chunks/chunk-BQSKFRL2.js";import"./focused-chunks/chunk-HFAW3FJQ.js";import{Pb as h,Qb as w,Rb as g,Sb as k,Tb as A,Ub as E,Ud as c,Vb as R,Wb as S,Xb as T,Yb as I,Zb as $}from"./focused-chunks/chunk-L554BKFH.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="aa6b9997-a4c6-5bfb-8804-45b34afd9e01")}catch{}})();var m=["captured_redacted","captured_verbatim"],x=[{label:"home directory",pattern:/(?:\/home\/|\/Users\/)[^/\s"']+/u},{label:"GitHub token",pattern:/\b(?:gh[oprsu]_[A-Za-z0-9_]{20,})\b/u},{label:"npm token",pattern:/\bnpm_[A-Za-z0-9]{20,}\b/u},{label:"private key",pattern:/-----BEGIN (?:RSA |EC |OPENSSH )?PRIVATE KEY-----/u}];function n(e){return typeof e=="string"&&e.trim().length>0}function v(e,i){if(typeof i!="object"||i===null||Array.isArray(i))return[{boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} must contain a JSON object.`}];let r=i,t=[];r.boundary_id!==e.id&&t.push({boundary_id:e.id,kind:"fixture_boundary_mismatch",detail:`${e.fixture_path} names ${String(r.boundary_id)} instead of ${e.id}.`}),(r.version!==1||!m.includes(r.capture_source)||!n(r.capture_provenance)||!Array.isArray(r.redactions)||!r.redactions.every(n)||!("input"in r)||!("observed"in r))&&t.push({boundary_id:e.id,kind:"invalid_fixture",detail:`${e.fixture_path} lacks captured provenance, redaction metadata, input, or observed output.`});let d=JSON.stringify(i);for(let s of x)s.pattern.test(d)&&t.push({boundary_id:e.id,kind:"unsafe_fixture",detail:`${e.fixture_path} contains a possible ${s.label}.`});return t}function b(e,i){let r=Date.parse(e.waiver_expires_at),t=n(e.waiver_reason)&&n(e.waiver_owner)&&e.waiver_expires_at.endsWith("Z")&&c(e.waiver_expires_at)&&Number.isFinite(r);return{captured:0,waived:t&&r>=i?1:0,findings:t?r<i?[{boundary_id:e.id,kind:"expired_waiver",detail:`Boundary ${e.id} waiver expired at ${e.waiver_expires_at}.`}]:[]:[{boundary_id:e.id,kind:"invalid_waiver",detail:`Boundary ${e.id} waiver requires reason, owner, and an RFC 3339 UTC expiry.`}]}}function y(e,i,r){if(!n(e.id)||!n(e.producer)||!n(e.consumer)||!n(e.format))return{captured:0,waived:0,findings:[{boundary_id:n(e.id)?e.id:"unknown",kind:"invalid_boundary",detail:"Each boundary requires non-empty id, producer, consumer, and format."}]};if("fixture_path"in e){let t=i[e.fixture_path],d=n(e.fixture_path)&&e.fixture_path in i?v(e,t):[{boundary_id:e.id,kind:"missing_fixture",detail:`Boundary ${e.id} fixture ${String(e.fixture_path)} is missing.`}];return{captured:d.length===0?1:0,waived:0,findings:d}}return b(e,r)}function Ni(e,i,r=new Date){let t=[];if(e.version!==1||!n(e.inventory_scope)||!Array.isArray(e.boundaries))return{ok:!1,boundary_count:0,captured_count:0,waived_count:0,findings:[{boundary_id:"registry",kind:"invalid_registry",detail:"Boundary registry requires version 1, inventory_scope, and boundaries."}]};let d=new Set,s=0,p=0;for(let o of e.boundaries){if(typeof o!="object"||o===null||Array.isArray(o)){t.push({boundary_id:"unknown",kind:"invalid_boundary",detail:"Each boundary must be a JSON object."});continue}let a=o,u=n(a.id)?a.id:void 0;if(u!==void 0&&d.has(u)){t.push({boundary_id:u,kind:"duplicate_boundary",detail:`Boundary ${u} is inventoried more than once.`});continue}u!==void 0&&d.add(u);let f=y(a,i,r.getTime());s+=f.captured,p+=f.waived,t.push(...f.findings)}return t.sort((o,a)=>o.boundary_id!==a.boundary_id?o.boundary_id.localeCompare(a.boundary_id):o.kind.localeCompare(a.kind)),{ok:t.length===0,boundary_count:e.boundaries.length,captured_count:s,waived_count:p,findings:t}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new e.Error().stack;i&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[i]="47924d35-d6ce-5507-adbf-c4c3cb25c18e")}catch{}})();export{wi as ASSURANCE_ACTIONS,gi as ASSURANCE_DECLARATION_KINDS,fe as ASSURANCE_DOCUMENT_VERSION,pe as ASSURANCE_GATE_TRIGGERS,ce as ASSURANCE_MEASUREMENT_SOURCE_KINDS,Ke as ASSURANCE_PRESET_IDS,de as AssuranceEvaluationRefusalError,oe as AssuranceMutationRefusalError,ae as AssuranceSourceResolutionError,m as BOUNDARY_FIXTURE_CAPTURE_SOURCES,z as CURRENT_HISTORY_HASH_ALGORITHM,B as DEFECT_ESCAPE_CLASSES,C as DEFECT_GATE_EVIDENCE_DISPOSITIONS,Ne as HISTORY_AUTHOR_ATTRIBUTION_BASELINE,F as HISTORY_HASH_ALGORITHMS,q as LEGACY_HISTORY_HASH_ALGORITHM,w as MAX_WORKFLOW_POLICIES,g as MAX_WORKFLOW_POLICY_TERMS,j as PM_HISTORY_ATTESTATION_CONTRACT,G as PM_MUTATION_ACTION_CONTRACTS,h as WORKFLOW_POLICY_ACTIONS,$e as WORKFLOW_POLICY_DOCUMENT_SCHEMA,Ie as WORKFLOW_POLICY_SCHEMA,si as _testOnlyHealthCommand,Ze as _testOnlySimilarity,xi as _testOnlyValidateCommand,Ci as _testOnlyWorkspacePosition,Me as acceptAssuranceProposals,Je as acknowledgeUnknownAuthorHistoryEvents,ze as acknowledgeUnknownAuthorHistoryEventsFromTransport,N as analyzeDefectChangeRisk,hi as analyzeDefectRecurrenceCoverage,He as analyzeDuplicateItems,Le as applyAssurancePreset,ci as applyClosureTimestampFix,_e as assuranceAssertionUpdateIsLoosening,D as buildDefectRecurrenceIndex,_i as buildLinkedFileRepairReport,ai as buildStatusRoleWarnings,Be as buildWorkflowCompletenessCheck,Oe as classifyHistoryAuthorEvent,Xe as createAssurancePreset,bi as createAssuranceWorkspaceContext,be as createEmptyAssuranceDocument,Ce as createLifecycleCompletenessPolicies,$ as createWorkflowPolicyEvaluator,Qe as deriveAssuranceProposals,fi as deriveClosureTimestamp,he as evaluateAssuranceAssertion,we as evaluateAssuranceGate,Ni as evaluateBoundaryFixtures,O as evaluateDefectGateEvidence,ye as evaluateMeasurement,V as evaluateMutationGuard,Ye as evaluateSimilarityGovernance,I as evaluateWorkflowPolicies,Si as exportAttestation,Ve as findDuplicateClusters,Ge as findSimilarItems,Bi as formatWorkspacePositionHuman,ke as getAssuranceDeclaration,X as getMutationActionContract,W as historyDigest,Ue as inspectHistoryAuthorStream,te as inspectStaleInProgressItems,di as inspectStatusRoleAssignments,Y as isMutationAction,L as jaccardSimilarity,ge as listAssuranceDeclarations,Te as listAssuranceVerdicts,ti as listInvalidProvenanceHistoryStreamIds,K as listMutationActions,se as normalizeAssuranceEvaluation,ue as normalizeAssuranceMutation,ri as normalizeInvalidHistoryProvenance,Q as normalizeSimilarityText,P as parseDefectChangeRiskRequest,yi as parseDefectRecurrenceCoverageRequest,U as parseDefectRecurrencePolicy,Ri as parseHistoryAttestation,qe as parseUnknownAuthorHistoryEventCoordinates,k as parseWorkflowPolicy,A as parseWorkflowPolicyDocument,je as planUnknownAuthorHistoryAcknowledgment,ee as prepareSimilarityText,mi as projectValidateCounts,ei as promoteAssuranceAssertion,Ae as putAssuranceDeclaration,Ee as putAssuranceDeclarationBundle,Z as readWorkflowPolicies,E as readWorkflowPolicyField,$i as readWorkspacePosition,Se as recordAssuranceVerdict,Re as removeAssuranceDeclaration,J as resolveHistoryHashAlgorithm,Fe as resolveUnknownAuthorAcknowledgmentSelector,ki as runAssuranceAction,Ai as runAssuranceDispatch,Ei as runGc,ui as runHealth,Ii as runHistoryAttest,oi as runHistoryMaintenance,l as runReindex,_ as runUpgrade,vi as runValidate,De as runWorkflowPolicyAction,pi as scanClosureTimestamps,ii as scanExtensionHostVersions,Pe as scanHistoryAuthorAttribution,H as scanMutationSecrets,ni as scanProvenanceResolverHealth,ne as scanStaleInProgressItems,li as scanStorageIntegrity,ie as scoreItemSimilarity,re as scorePreparedItemSimilarity,We as similarityAdvisoryWarnings,M as tokenizeSimilarityText,me as validateAssertionDefinition,ve as validateAssuranceDocument,xe as validateGateDefinition,le as validateMeasurementDefinition,Ti as verifyAttestation,S as workflowApprovalFingerprint,T as workflowPolicyApplies,R as workflowPolicyFingerprint};
|
|
2
2
|
//# sourceMappingURL=sdk-governance.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Je,b as Ze,c as Ie}from"./focused-chunks/chunk-CASXNCNQ.js";import{A as me,B as ye,C as we,D as be,E as Re,F as _e,G as ke,H as Ae,I as Ge,J as Se,K as Ee,a as Qe,b as Xe,c as Ye,d as et,e as q,f as J,g as Z,h as Q,i as X,j as Y,k as ee,l as te,m as re,n as ne,o as ie,p as se,q as oe,r as ae,s as pe,t as ce,u as de,v as le,w as he,x as fe,y as ge,z as ue}from"./focused-chunks/chunk-AO5FR7PN.js";import{$b as W,Hb as ze,Ib as We,Jb as je,Kb as Fe,Lb as Ue,Mb as Le,Nb as Ve,Ob as Ke,Pb as qe,Tb as $,Ub as v,Vb as H,Wb as P,Xb as M,Yb as N,Zb as B,_b as z,ac as j,bc as F,dc as k,ec as U,fc as L,gc as V,hc as K,ic as tt}from"./focused-chunks/chunk-FKYUTTFL.js";import"./focused-chunks/chunk-JCD5YESL.js";import"./focused-chunks/chunk-HFAW3FJQ.js";import{Nb as Be,fc as O,ia as $e,ja as _,ka as E,la as ve,ma as He,na as Pe,oa as Me,pa as f,qa as Ne,qb as b}from"./focused-chunks/chunk-URH727T5.js";import{createHash as De}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eb475dcd-d16c-51fb-b248-b14cf5ade4de")}catch{}})();var A=1;function g(e){e?.throwIfAborted()}function l(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship graph ${t} must be non-empty`);return e.trim()}function u(e,t,r={}){let n=Date.parse(r.createdAt??new Date().toISOString());if(!Number.isFinite(n))throw new TypeError("Relationship graph createdAt must be a valid timestamp");let i=e.nodes(),a=e.edges(),s=t.list();return Object.freeze({version:A,fingerprint:De("sha256").update(b({nodes:i,edges:a,kinds:s})).digest("hex"),created_at:new Date(n).toISOString(),nodes:i,edges:a,kinds:s})}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e){if(!Te(e))throw new TypeError("Relationship graph snapshot must be an object");if(e.version!==A)throw new TypeError(`Unsupported relationship graph snapshot version: ${String(e.version)}`);if(!Array.isArray(e.nodes)||e.nodes.some(i=>typeof i!="string"))throw new TypeError("Relationship graph snapshot nodes must be strings");if(!Array.isArray(e.edges)||!Array.isArray(e.kinds))throw new TypeError("Relationship graph snapshot edges and kinds must be arrays");if(typeof e.created_at!="string"||!Number.isFinite(Date.parse(e.created_at)))throw new TypeError("Relationship graph snapshot created_at must be valid");if(typeof e.fingerprint!="string")throw new TypeError("Relationship graph snapshot fingerprint must be a string");let t=new _([]);for(let i of e.kinds)t.register(i);let r=new f(e.nodes,e.edges,t),n=u(r,t,{createdAt:e.created_at});if(n.fingerprint!==e.fingerprint)throw new TypeError("Relationship graph snapshot fingerprint mismatch");return{snapshot:n,registry:t,graph:r}}async function d(e,t){l(e.name,"adapter name");let r=l(t.workspace,"workspace");g(t.signal);let n=await e.read({...t,workspace:r});return g(t.signal),n===null?null:y(n)}async function R(e,t){let r=l(t.workspace,"workspace"),n=y(t.snapshot).snapshot,i=await d(e,{workspace:r,signal:t.signal});if(i?.snapshot.fingerprint===n.fingerprint)return{adapter:e.name,workspace:r,disposition:"current",fingerprint:n.fingerprint,previous_fingerprint:i.snapshot.fingerprint,node_count:n.nodes.length,edge_count:n.edges.length};if(g(t.signal),await e.replace({workspace:r,signal:t.signal,snapshot:n,expected_fingerprint:i?.snapshot.fingerprint??null}),(await d(e,{workspace:r,signal:t.signal}))?.snapshot.fingerprint!==n.fingerprint)throw new Error(`Relationship graph adapter "${e.name}" did not expose the replaced snapshot`);return{adapter:e.name,workspace:r,disposition:"written",fingerprint:n.fingerprint,...i?{previous_fingerprint:i.snapshot.fingerprint}:{},node_count:n.nodes.length,edge_count:n.edges.length}}function Ce(e,t={}){let r=e.map(y),n=new Map;for(let s of r)for(let o of s.snapshot.kinds){let c=n.get(o.kind);if(c&&b(c)!==b(o))throw new TypeError(`Conflicting federated relationship kind: ${o.kind}`);n.set(o.kind,o)}let i=new _([...n.values()].sort((s,o)=>s.kind.localeCompare(o.kind))),a=new f(new Set(r.flatMap(s=>[...s.snapshot.nodes])),r.flatMap(s=>[...s.snapshot.edges]),i);return u(a,i,t)}var m=class{name;#e=new Map;constructor(t="memory"){this.name=l(t,"adapter name")}async read(t){g(t.signal);let r=this.#e.get(l(t.workspace,"workspace"));return r?structuredClone(r):null}async replace(t){g(t.signal);let r=l(t.workspace,"workspace"),n=this.#e.get(r);if(t.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==t.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${r}`);this.#e.set(r,structuredClone(y(t.snapshot).snapshot))}async clear(t){g(t.signal);let r=l(t.workspace,"workspace"),n=this.#e.get(r);if(t.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==t.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${r}`);this.#e.delete(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]="9a60b8c0-37d1-5c04-a079-e1351caf6e09")}catch{}})();function I(e,t){if(!Number.isInteger(e)||e<1)throw new TypeError(`Relationship graph ${t} must be a positive integer`);return e}function xe(e){let t=I(e.nodeCount,"nodeCount"),r=I(e.edgeStride??1,"edgeStride"),n=e.topology??"chain";if(!["chain","star","disconnected"].includes(n))throw new TypeError(`Unsupported relationship graph topology: ${n}`);let i=(e.kind??"related").trim(),a=(e.idPrefix??"node").trim();if(!i||!a)throw new TypeError("Relationship graph kind and idPrefix must be non-empty");let s=n==="disconnected"?0:Math.floor((t-1)/r);return{node_count:t,edge_count:s,edge_basis:"fixture_generated",nodes:{*[Symbol.iterator](){for(let o=0;o<t;o+=1)yield`${a}-${o}`}},edges:{*[Symbol.iterator](){if(n!=="disconnected")for(let o=r;o<t;o+=r)yield{source:`${a}-${n==="star"?0:o-r}`,target:`${a}-${o}`,kind:i}}}}}function h(e,t){if(!e)throw new Error(`Relationship graph adapter conformance: ${t}`)}async function D(e,t={}){let r=t.workspace?.trim()||"pm-graph-conformance",n=E(),i=u(new f(["a","b"],[{source:"a",target:"b",kind:"related"}],n),n,{createdAt:"2026-01-01T00:00:00.000Z"}),a=u(new f(["a","b","c"],[{source:"a",target:"b",kind:"related"},{source:"b",target:"c",kind:"blocked_by"}],n),n,{createdAt:"2026-01-02T00:00:00.000Z"}),s=[];h(await d(e,{workspace:r})===null,"workspace must start empty"),s.push({name:"empty-read",passed:!0});let o=await R(e,{workspace:r,snapshot:i});h(o.disposition==="written","first sync must write"),s.push({name:"atomic-replace",passed:!0}),(await e.read({workspace:r})).nodes.push("mutated-reader-copy"),h((await d(e,{workspace:r}))?.snapshot.nodes.length===2,"reads must not mutate stored state"),s.push({name:"read-isolation",passed:!0}),h((await R(e,{workspace:r,snapshot:i})).disposition==="current","identical sync must be idempotent"),s.push({name:"idempotent-sync",passed:!0}),await e.replace({workspace:r,snapshot:a,expected_fingerprint:i.fingerprint}),h((await d(e,{workspace:r}))?.snapshot.fingerprint===a.fingerprint,"replacement must become visible"),s.push({name:"replacement-visibility",passed:!0});let w=!1;try{await e.replace({workspace:r,snapshot:i,expected_fingerprint:i.fingerprint})}catch{w=!0}return h(w,"stale compare-and-swap must fail"),s.push({name:"stale-cas",passed:!0}),e.clear&&(await e.clear({workspace:r,expected_fingerprint:a.fingerprint}),h(await d(e,{workspace:r})===null,"clear must remove the workspace"),s.push({name:"clear",passed:!0})),{adapter:e.name,workspace:r,cases:Object.freeze(s),clear_supported:e.clear!==void 0}}function Oe(e){return D(new m,e?{workspace:e}:{})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df28925a-72d8-5d39-accf-e295ee01d3f9")}catch{}})();import{createHash as T}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41ef1735-c534-5b84-8367-1278007cb7c6")}catch{}})();function C(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship backfill ${t} must be non-empty`);return e.trim()}function Dt(e,t){let r=C(t.migrationId,"migrationId"),n=C(t.author,"author"),i=Date.parse(t.timestamp);if(!Number.isFinite(i))throw new TypeError("Relationship backfill timestamp must be valid");let a=new Date(i).toISOString(),s=k(e,void 0,t.registry),o=s.graph.nodes(),c=s.graph.edges().map(p=>{let S=T("sha256").update(JSON.stringify([r,p.kind,p.source,p.target,p.createdAt??null,p.author??null,p.payload??null])).digest("hex").slice(0,24);return Object.freeze({eventId:`backfill:${r}:${S}`,relationshipId:`migration:${r}:${S}`,action:"add",edge:p,author:n,timestamp:a,reason:`Backfill ${r} from legacy item metadata`})}),w=T("sha256").update(JSON.stringify({migrationId:r,nodes:o,events:c})).digest("hex"),x=new Set([...t.existingEventIds??[]].filter(p=>typeof p=="string").map(p=>p.trim()).filter(Boolean)),G=c.filter(p=>!x.has(p.eventId));return Object.freeze({migration_id:r,fingerprint:w,nodes:o,events:Object.freeze(G),edge_count:c.length,skipped_existing_count:c.length-G.length,duplicate_dependency_rows:s.duplicateRows.length,dangling_reference_count:s.dangling.active.length+s.dangling.legacy_terminal.length})}(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]="3160880c-9d85-52c5-ae1d-ada213f56ce6")}catch{}})();export{We as ACTIONABILITY_ORDERING_KINDS,$e as BUILTIN_RELATIONSHIP_KINDS,ge as GRAPH_DURABLE_CACHE_MIN_ITEMS,fe as GRAPH_DURABLE_CACHE_VERSION,Be as GRAPH_QUERY_DEFAULTS,O as GRAPH_SUBCOMMAND_VALUES,m as MemoryRelationshipGraphAdapter,A as RELATIONSHIP_GRAPH_SNAPSHOT_VERSION,Je as RelationshipEventLog,Ze as RelationshipEventStore,f as RelationshipGraph,_ as RelationshipKindRegistry,L as WorkspaceGraphCache,Xe as analyzeGraphImpact,H as analyzeHierarchyIntegrity,Ye as analyzeKnowledgeGraph,Qe as analyzeRelationshipExecution,se as analyzeRelationshipSchedule,k as assembleWorkspaceRelationshipGraph,N as assertHierarchyMutationAllowed,Oe as assertMemoryRelationshipGraphAdapterConformance,Me as assertRelationshipEdgeAllowed,D as assertRelationshipGraphAdapterConformance,le as auditWorkspaceRelationshipGraph,tt as buildRelationshipContext,ve as canonicalizeRelationshipKind,be as clearDurableGraphCache,je as collectBlockedByIds,Ue as collectBlockedByIdsFromCorpus,j as collectDanglingDependencyReferences,Ve as collectDependencyBlockedIds,z as collectDuplicateDependencyRows,de as collectDuplicateRelationshipEdgeGroups,v as collectHierarchyRelations,F as collectMissingDependencyTargetIds,Ie as collectNewOrderingCycleWarnings,ae as collectOrderingCycles,W as collectOrderingStorageContradictions,et as compareRelationshipSnapshots,qe as computeActionabilityReport,ne as computeRelationshipCentrality,re as computeRelationshipDominators,U as computeWorkspaceGraphFingerprint,xe as createRelationshipGraphScaleFixture,u as createRelationshipGraphSnapshot,E as createRelationshipKindRegistry,Ne as dependencyToRelationship,oe as deriveRelationshipDeadlines,ee as detectRelationshipCommunities,he as diffRelationshipAuditSnapshots,ue as durableGraphCachePath,Re as durableGraphCacheStatus,X as enumerateRelationshipPaths,Ce as federateRelationshipGraphSnapshots,te as findRedundantRelationshipEdges,ie as findRelationshipCutStructure,Y as forEachMatchedRelationshipEdge,ce as formatDuplicateEdgeGroup,P as formatHierarchyRelation,pe as formatOrderingStorageContradiction,me as graphAuditBaselinePath,q as hierarchyAncestors,J as hierarchyDescendants,Fe as indexBlockedByIds,M as indexHierarchyRelations,Pe as isOrderingRelationshipKind,ke as loadGraphAuditBaseline,d as loadRelationshipGraphAdapter,B as normalizeDependencyGraphTarget,ye as openDurableGraphCache,Z as orderingPredecessors,Q as orderingSuccessors,Se as parseGraphSubcommand,y as parseRelationshipGraphSnapshot,we as persistDurableGraphResult,Dt as planRelationshipEventBackfill,Ge as planRelationshipRemediation,K as resetWorkspaceGraphCache,He as resolveCanonicalRelationshipKind,Le as resolveItemBlockers,ze as resolveItemExecutionRole,$ as resolveWorkspaceRelationshipKindRegistry,Ee as runGraph,Ae as saveGraphAuditBaseline,Ke as selectActionableEntries,_e as shouldPersistDurableGraphCache,R as syncRelationshipGraphAdapter,V as workspaceGraphCache};
|
|
1
|
+
import{a as Je,b as Ze,c as Ie}from"./focused-chunks/chunk-YE6F5HGF.js";import{A as me,B as ye,C as we,D as be,E as Re,F as _e,G as ke,H as Ae,I as Ge,J as Se,K as Ee,a as Qe,b as Xe,c as Ye,d as et,e as q,f as J,g as Z,h as Q,i as X,j as Y,k as ee,l as te,m as re,n as ne,o as ie,p as se,q as oe,r as ae,s as pe,t as ce,u as de,v as le,w as he,x as fe,y as ge,z as ue}from"./focused-chunks/chunk-E5AOEXF5.js";import{$b as W,Hb as ze,Ib as We,Jb as je,Kb as Fe,Lb as Ue,Mb as Le,Nb as Ve,Ob as Ke,Pb as qe,Tb as $,Ub as v,Vb as H,Wb as P,Xb as M,Yb as N,Zb as B,_b as z,ac as j,bc as F,dc as k,ec as U,fc as L,gc as V,hc as K,ic as tt}from"./focused-chunks/chunk-HJA6OHWT.js";import"./focused-chunks/chunk-BQSKFRL2.js";import"./focused-chunks/chunk-HFAW3FJQ.js";import{Nb as Be,fc as O,ia as $e,ja as _,ka as E,la as ve,ma as He,na as Pe,oa as Me,pa as f,qa as Ne,qb as b}from"./focused-chunks/chunk-L554BKFH.js";import{createHash as De}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="eb475dcd-d16c-51fb-b248-b14cf5ade4de")}catch{}})();var A=1;function g(e){e?.throwIfAborted()}function l(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship graph ${t} must be non-empty`);return e.trim()}function u(e,t,r={}){let n=Date.parse(r.createdAt??new Date().toISOString());if(!Number.isFinite(n))throw new TypeError("Relationship graph createdAt must be a valid timestamp");let i=e.nodes(),a=e.edges(),s=t.list();return Object.freeze({version:A,fingerprint:De("sha256").update(b({nodes:i,edges:a,kinds:s})).digest("hex"),created_at:new Date(n).toISOString(),nodes:i,edges:a,kinds:s})}function Te(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function y(e){if(!Te(e))throw new TypeError("Relationship graph snapshot must be an object");if(e.version!==A)throw new TypeError(`Unsupported relationship graph snapshot version: ${String(e.version)}`);if(!Array.isArray(e.nodes)||e.nodes.some(i=>typeof i!="string"))throw new TypeError("Relationship graph snapshot nodes must be strings");if(!Array.isArray(e.edges)||!Array.isArray(e.kinds))throw new TypeError("Relationship graph snapshot edges and kinds must be arrays");if(typeof e.created_at!="string"||!Number.isFinite(Date.parse(e.created_at)))throw new TypeError("Relationship graph snapshot created_at must be valid");if(typeof e.fingerprint!="string")throw new TypeError("Relationship graph snapshot fingerprint must be a string");let t=new _([]);for(let i of e.kinds)t.register(i);let r=new f(e.nodes,e.edges,t),n=u(r,t,{createdAt:e.created_at});if(n.fingerprint!==e.fingerprint)throw new TypeError("Relationship graph snapshot fingerprint mismatch");return{snapshot:n,registry:t,graph:r}}async function d(e,t){l(e.name,"adapter name");let r=l(t.workspace,"workspace");g(t.signal);let n=await e.read({...t,workspace:r});return g(t.signal),n===null?null:y(n)}async function R(e,t){let r=l(t.workspace,"workspace"),n=y(t.snapshot).snapshot,i=await d(e,{workspace:r,signal:t.signal});if(i?.snapshot.fingerprint===n.fingerprint)return{adapter:e.name,workspace:r,disposition:"current",fingerprint:n.fingerprint,previous_fingerprint:i.snapshot.fingerprint,node_count:n.nodes.length,edge_count:n.edges.length};if(g(t.signal),await e.replace({workspace:r,signal:t.signal,snapshot:n,expected_fingerprint:i?.snapshot.fingerprint??null}),(await d(e,{workspace:r,signal:t.signal}))?.snapshot.fingerprint!==n.fingerprint)throw new Error(`Relationship graph adapter "${e.name}" did not expose the replaced snapshot`);return{adapter:e.name,workspace:r,disposition:"written",fingerprint:n.fingerprint,...i?{previous_fingerprint:i.snapshot.fingerprint}:{},node_count:n.nodes.length,edge_count:n.edges.length}}function Ce(e,t={}){let r=e.map(y),n=new Map;for(let s of r)for(let o of s.snapshot.kinds){let c=n.get(o.kind);if(c&&b(c)!==b(o))throw new TypeError(`Conflicting federated relationship kind: ${o.kind}`);n.set(o.kind,o)}let i=new _([...n.values()].sort((s,o)=>s.kind.localeCompare(o.kind))),a=new f(new Set(r.flatMap(s=>[...s.snapshot.nodes])),r.flatMap(s=>[...s.snapshot.edges]),i);return u(a,i,t)}var m=class{name;#e=new Map;constructor(t="memory"){this.name=l(t,"adapter name")}async read(t){g(t.signal);let r=this.#e.get(l(t.workspace,"workspace"));return r?structuredClone(r):null}async replace(t){g(t.signal);let r=l(t.workspace,"workspace"),n=this.#e.get(r);if(t.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==t.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${r}`);this.#e.set(r,structuredClone(y(t.snapshot).snapshot))}async clear(t){g(t.signal);let r=l(t.workspace,"workspace"),n=this.#e.get(r);if(t.expected_fingerprint!==void 0&&(n?.fingerprint??null)!==t.expected_fingerprint)throw new Error(`Relationship graph adapter conflict for ${r}`);this.#e.delete(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]="9a60b8c0-37d1-5c04-a079-e1351caf6e09")}catch{}})();function I(e,t){if(!Number.isInteger(e)||e<1)throw new TypeError(`Relationship graph ${t} must be a positive integer`);return e}function xe(e){let t=I(e.nodeCount,"nodeCount"),r=I(e.edgeStride??1,"edgeStride"),n=e.topology??"chain";if(!["chain","star","disconnected"].includes(n))throw new TypeError(`Unsupported relationship graph topology: ${n}`);let i=(e.kind??"related").trim(),a=(e.idPrefix??"node").trim();if(!i||!a)throw new TypeError("Relationship graph kind and idPrefix must be non-empty");let s=n==="disconnected"?0:Math.floor((t-1)/r);return{node_count:t,edge_count:s,edge_basis:"fixture_generated",nodes:{*[Symbol.iterator](){for(let o=0;o<t;o+=1)yield`${a}-${o}`}},edges:{*[Symbol.iterator](){if(n!=="disconnected")for(let o=r;o<t;o+=r)yield{source:`${a}-${n==="star"?0:o-r}`,target:`${a}-${o}`,kind:i}}}}}function h(e,t){if(!e)throw new Error(`Relationship graph adapter conformance: ${t}`)}async function D(e,t={}){let r=t.workspace?.trim()||"pm-graph-conformance",n=E(),i=u(new f(["a","b"],[{source:"a",target:"b",kind:"related"}],n),n,{createdAt:"2026-01-01T00:00:00.000Z"}),a=u(new f(["a","b","c"],[{source:"a",target:"b",kind:"related"},{source:"b",target:"c",kind:"blocked_by"}],n),n,{createdAt:"2026-01-02T00:00:00.000Z"}),s=[];h(await d(e,{workspace:r})===null,"workspace must start empty"),s.push({name:"empty-read",passed:!0});let o=await R(e,{workspace:r,snapshot:i});h(o.disposition==="written","first sync must write"),s.push({name:"atomic-replace",passed:!0}),(await e.read({workspace:r})).nodes.push("mutated-reader-copy"),h((await d(e,{workspace:r}))?.snapshot.nodes.length===2,"reads must not mutate stored state"),s.push({name:"read-isolation",passed:!0}),h((await R(e,{workspace:r,snapshot:i})).disposition==="current","identical sync must be idempotent"),s.push({name:"idempotent-sync",passed:!0}),await e.replace({workspace:r,snapshot:a,expected_fingerprint:i.fingerprint}),h((await d(e,{workspace:r}))?.snapshot.fingerprint===a.fingerprint,"replacement must become visible"),s.push({name:"replacement-visibility",passed:!0});let w=!1;try{await e.replace({workspace:r,snapshot:i,expected_fingerprint:i.fingerprint})}catch{w=!0}return h(w,"stale compare-and-swap must fail"),s.push({name:"stale-cas",passed:!0}),e.clear&&(await e.clear({workspace:r,expected_fingerprint:a.fingerprint}),h(await d(e,{workspace:r})===null,"clear must remove the workspace"),s.push({name:"clear",passed:!0})),{adapter:e.name,workspace:r,cases:Object.freeze(s),clear_supported:e.clear!==void 0}}function Oe(e){return D(new m,e?{workspace:e}:{})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df28925a-72d8-5d39-accf-e295ee01d3f9")}catch{}})();import{createHash as T}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41ef1735-c534-5b84-8367-1278007cb7c6")}catch{}})();function C(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship backfill ${t} must be non-empty`);return e.trim()}function Dt(e,t){let r=C(t.migrationId,"migrationId"),n=C(t.author,"author"),i=Date.parse(t.timestamp);if(!Number.isFinite(i))throw new TypeError("Relationship backfill timestamp must be valid");let a=new Date(i).toISOString(),s=k(e,void 0,t.registry),o=s.graph.nodes(),c=s.graph.edges().map(p=>{let S=T("sha256").update(JSON.stringify([r,p.kind,p.source,p.target,p.createdAt??null,p.author??null,p.payload??null])).digest("hex").slice(0,24);return Object.freeze({eventId:`backfill:${r}:${S}`,relationshipId:`migration:${r}:${S}`,action:"add",edge:p,author:n,timestamp:a,reason:`Backfill ${r} from legacy item metadata`})}),w=T("sha256").update(JSON.stringify({migrationId:r,nodes:o,events:c})).digest("hex"),x=new Set([...t.existingEventIds??[]].filter(p=>typeof p=="string").map(p=>p.trim()).filter(Boolean)),G=c.filter(p=>!x.has(p.eventId));return Object.freeze({migration_id:r,fingerprint:w,nodes:o,events:Object.freeze(G),edge_count:c.length,skipped_existing_count:c.length-G.length,duplicate_dependency_rows:s.duplicateRows.length,dangling_reference_count:s.dangling.active.length+s.dangling.legacy_terminal.length})}(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]="3160880c-9d85-52c5-ae1d-ada213f56ce6")}catch{}})();export{We as ACTIONABILITY_ORDERING_KINDS,$e as BUILTIN_RELATIONSHIP_KINDS,ge as GRAPH_DURABLE_CACHE_MIN_ITEMS,fe as GRAPH_DURABLE_CACHE_VERSION,Be as GRAPH_QUERY_DEFAULTS,O as GRAPH_SUBCOMMAND_VALUES,m as MemoryRelationshipGraphAdapter,A as RELATIONSHIP_GRAPH_SNAPSHOT_VERSION,Je as RelationshipEventLog,Ze as RelationshipEventStore,f as RelationshipGraph,_ as RelationshipKindRegistry,L as WorkspaceGraphCache,Xe as analyzeGraphImpact,H as analyzeHierarchyIntegrity,Ye as analyzeKnowledgeGraph,Qe as analyzeRelationshipExecution,se as analyzeRelationshipSchedule,k as assembleWorkspaceRelationshipGraph,N as assertHierarchyMutationAllowed,Oe as assertMemoryRelationshipGraphAdapterConformance,Me as assertRelationshipEdgeAllowed,D as assertRelationshipGraphAdapterConformance,le as auditWorkspaceRelationshipGraph,tt as buildRelationshipContext,ve as canonicalizeRelationshipKind,be as clearDurableGraphCache,je as collectBlockedByIds,Ue as collectBlockedByIdsFromCorpus,j as collectDanglingDependencyReferences,Ve as collectDependencyBlockedIds,z as collectDuplicateDependencyRows,de as collectDuplicateRelationshipEdgeGroups,v as collectHierarchyRelations,F as collectMissingDependencyTargetIds,Ie as collectNewOrderingCycleWarnings,ae as collectOrderingCycles,W as collectOrderingStorageContradictions,et as compareRelationshipSnapshots,qe as computeActionabilityReport,ne as computeRelationshipCentrality,re as computeRelationshipDominators,U as computeWorkspaceGraphFingerprint,xe as createRelationshipGraphScaleFixture,u as createRelationshipGraphSnapshot,E as createRelationshipKindRegistry,Ne as dependencyToRelationship,oe as deriveRelationshipDeadlines,ee as detectRelationshipCommunities,he as diffRelationshipAuditSnapshots,ue as durableGraphCachePath,Re as durableGraphCacheStatus,X as enumerateRelationshipPaths,Ce as federateRelationshipGraphSnapshots,te as findRedundantRelationshipEdges,ie as findRelationshipCutStructure,Y as forEachMatchedRelationshipEdge,ce as formatDuplicateEdgeGroup,P as formatHierarchyRelation,pe as formatOrderingStorageContradiction,me as graphAuditBaselinePath,q as hierarchyAncestors,J as hierarchyDescendants,Fe as indexBlockedByIds,M as indexHierarchyRelations,Pe as isOrderingRelationshipKind,ke as loadGraphAuditBaseline,d as loadRelationshipGraphAdapter,B as normalizeDependencyGraphTarget,ye as openDurableGraphCache,Z as orderingPredecessors,Q as orderingSuccessors,Se as parseGraphSubcommand,y as parseRelationshipGraphSnapshot,we as persistDurableGraphResult,Dt as planRelationshipEventBackfill,Ge as planRelationshipRemediation,K as resetWorkspaceGraphCache,He as resolveCanonicalRelationshipKind,Le as resolveItemBlockers,ze as resolveItemExecutionRole,$ as resolveWorkspaceRelationshipKindRegistry,Ee as runGraph,Ae as saveGraphAuditBaseline,Ke as selectActionableEntries,_e as shouldPersistDurableGraphCache,R as syncRelationshipGraphAdapter,V as workspaceGraphCache};
|
|
2
2
|
//# sourceMappingURL=sdk-graph.js.map
|