@unbrained/pm-cli 2026.11.17 → 2026.11.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/dist/cli-bundle/bundle-manifest.json +1 -1
- package/dist/cli-bundle/chunks/chunk-2VH6COJE.js +125 -0
- package/dist/cli-bundle/chunks/{chunk-2WHXFKMY.js → chunk-7ETRLLK3.js} +31 -31
- package/dist/cli-bundle/chunks/{chunk-FXSLODOK.js → chunk-7LCJA54R.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-DXSZL3T6.js → chunk-AGU7632B.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-X5TFNFTS.js → chunk-CGTVDSAR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ACLBUVQG.js → chunk-FJQCORYR.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ABFHWRLE.js → chunk-JBPXNG6P.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-QZNL5XDT.js → chunk-L2ZLH3LZ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XPBADEUK.js → chunk-LGWP5D7V.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-KIQNEOKJ.js → chunk-MUGGRKK3.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-3IU2S5UQ.js → chunk-OD2I3SFQ.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-4FIN2XWC.js → chunk-QK7RAN7R.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-77MGDTK4.js → chunk-S3RMFLEG.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-QANUQMDL.js → chunk-SSZBVRIN.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-VLKCFZY6.js → chunk-T3E3WNHO.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-ADKDFCVT.js → chunk-TA5VN4ME.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RXNBNF6O.js → chunk-TS2CZE3O.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-7K2RUKMK.js → chunk-VETSGCF4.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-36R3JTAD.js → chunk-WKHS4QC6.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-O4ZSIMNC.js → chunk-XDIJK6VW.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-XP35IEHT.js → chunk-YJI2Y5N6.js} +2 -2
- package/dist/cli-bundle/chunks/{item-revision-7RVMVXTE.js → item-revision-BV5BUBCR.js} +2 -2
- package/dist/cli-bundle/chunks/item-transaction-E2ST3A3X.js +2 -0
- package/dist/cli-bundle/chunks/{mutation-admission-3PKQOAYK.js → mutation-admission-5AWMXMCB.js} +2 -2
- package/dist/cli-bundle/chunks/{register-list-query-TPZLHFHQ.js → register-list-query-RJT7YBRF.js} +2 -2
- package/dist/cli-bundle/chunks/{register-mutation-JG5AEBRJ.js → register-mutation-6KTMJGYF.js} +2 -2
- package/dist/cli-bundle/chunks/{register-operations-3CNXP46P.js → register-operations-W24TA3HZ.js} +2 -2
- package/dist/cli-bundle/chunks/{register-setup-4N56VL2P.js → register-setup-QK67WUX6.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-2MQNIDKG.js → chunk-3H3SVHAT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-GD2YWUAD.js → chunk-6OZ7BKWJ.js} +54 -54
- package/dist/cli-bundle/focused-chunks/{chunk-XJS4COL2.js → chunk-DWCFZVT2.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-SESMRMEE.js → chunk-EO4XM3XJ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-BNLLST32.js → chunk-IGMFXB5W.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-VBA4BIHN.js → chunk-LZR3JKYT.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-6JQXDGHM.js → chunk-ONHUG7IL.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-YWPLBFPC.js → chunk-PNCCTZKI.js} +3 -3
- package/dist/cli-bundle/focused-chunks/chunk-T3NMYMW4.js +27 -0
- package/dist/cli-bundle/focused-chunks/{item-revision-U7GDVAH7.js → item-revision-NS2V4WON.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{item-transaction-7C4BH47O.js → item-transaction-NENC4HYI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{mutation-admission-SKXVITP5.js → mutation-admission-DZIBDJAE.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-core.js +1 -1
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +58 -58
- 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/core/fs/file-glob.js +2 -0
- package/dist/core/shared/secret-rules.d.ts +83 -4
- package/dist/core/shared/secret-rules.js +5 -4
- package/dist/sdk/linked-artifacts.js +2 -2
- package/dist/sdk/mutation-guard.d.ts +25 -4
- package/dist/sdk/mutation-guard.js +1 -1
- package/dist/sdk/public-surface.json +1 -1
- package/docs/COMMANDS.md +33 -0
- package/docs/DEFECT_RECURRENCE.md +3 -2
- package/docs/MUTATION_INTEGRITY.md +187 -7
- package/marketplace.json +1 -1
- package/package.json +1 -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-claude/package.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/plugins/pm-codex/package.json +1 -1
- package/plugins/pm-codex/plugin.json +1 -1
- package/runtime-dependencies.json +1 -1
- package/dist/cli-bundle/chunks/chunk-AM26RAG7.js +0 -124
- package/dist/cli-bundle/chunks/item-transaction-NVX6P3FK.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-ZDY5L2C2.js +0 -26
- package/node_modules/fdir/LICENSE +0 -7
- package/node_modules/fdir/README.md +0 -91
- package/node_modules/fdir/dist/index.cjs +0 -588
- package/node_modules/fdir/dist/index.d.cts +0 -155
- package/node_modules/fdir/dist/index.d.mts +0 -155
- package/node_modules/fdir/dist/index.mjs +0 -570
- package/node_modules/fdir/package.json +0 -106
- package/node_modules/picomatch/LICENSE +0 -21
- package/node_modules/picomatch/README.md +0 -743
- package/node_modules/picomatch/index.js +0 -17
- package/node_modules/picomatch/lib/constants.js +0 -184
- package/node_modules/picomatch/lib/parse.js +0 -1425
- package/node_modules/picomatch/lib/picomatch.js +0 -361
- package/node_modules/picomatch/lib/scan.js +0 -403
- package/node_modules/picomatch/lib/utils.js +0 -72
- package/node_modules/picomatch/package.json +0 -83
- package/node_modules/picomatch/posix.js +0 -3
- package/node_modules/tinyglobby/LICENSE +0 -21
- package/node_modules/tinyglobby/README.md +0 -25
- package/node_modules/tinyglobby/dist/index.cjs +0 -335
- package/node_modules/tinyglobby/dist/index.d.cts +0 -148
- package/node_modules/tinyglobby/dist/index.d.mts +0 -148
- package/node_modules/tinyglobby/dist/index.mjs +0 -307
- package/node_modules/tinyglobby/package.json +0 -70
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as st,b as Un,c as sl,d as cl,g as ll,i as Fl}from"./chunk-DXSZL3T6.js";import{L as vr,U as Yl,a as Pl,c as Ll,d as Nl,e as Dl,k as Ml,l as Bt,m as yr,n as br,u as wr,w as Jl}from"./chunk-QANUQMDL.js";import{$c as ql,Da as Pc,Db as Tl,Ea as Nn,F as Oc,G as $c,Gb as Cl,Hb as Rl,I as Fc,Ma as al,Mb as Ht,Nc as lr,Nd as kr,Qc as Te,Qd as id,Rc as jl,Wc as mr,Xc as pr,Yc as Gl,Yd as ad,Zc as Ul,Zd as sd,_c as ct,b as er,cc as Hn,cd as Wl,d as Ne,dd as Bl,e as mc,ea as Me,ed as Vl,fd as Kl,g as ot,gb as ml,gd as _r,h as pc,hb as pl,hd as hr,i as tr,id as gr,j as On,jc as Ol,lc as $l,ld as Zl,mb as ir,md as Ql,nb as ar,nd as ed,o as rt,ob as sr,od as td,pd as nd,qb as ul,rb as fl,rc as Wn,rd as od,sb as cr,sd as rd,tc as Wt,x as Rc,y as xc}from"./chunk-2WHXFKMY.js";import{A as $n,B as kc,C as Sc,D as nr,E as zt,F as Fn,G as De,H as Ic,I as or,J as U,K as rr,L as j,M as Ac,N as Ec,O as Pn,P as Tc,Q as Ln,R as Cc,n as qt,o as _c,p as hc,q as gc,s as yc,t as it,u as _,v as bc,w as wc,y as Y,z as vc}from"./chunk-36R3JTAD.js";import{B as Uc,Da as Gn,E as qc,G as zc,H as Hc,Ha as rl,I as Wc,J as Bc,K as Vc,Ka as il,L as Kc,M as Jc,N as Yc,O as Xc,P as Zc,Q as Qc,R as el,S as tl,T as nl,U as ol,d as Rs,m as Dn,o as je,p as Dc,q as Mn,r as Mc,ra as at,s as Ge,t as jc,u as jn,v as Gc}from"./chunk-3IU2S5UQ.js";import{i as Lc,o as Nc}from"./chunk-H64BNM4A.js";import{$a as Ue,Ha as _l,Hc as ur,Kb as zl,Lb as Hl,Mc as fr,Pc as Xl,Ra as hl,Sa as gl,Ta as yl,U as fe,Wa as bl,Xa as wl,Ya as vl,Za as kl,aa as dl,ab as Sl,b as Cs,bb as Il,db as Al,fb as qn,hb as El,lb as Ee,mb as xl,nb as zn,rb as dr}from"./chunk-X5TFNFTS.js";import{a as Es,b as Ts}from"./chunk-RXNBNF6O.js";import{$ as js,$a as oc,B as Os,Ba as zs,Da as Hs,E as $s,F as Rn,G as Fs,Ja as Ws,Ka as Bs,La as Vs,M as Ps,Oa as Ks,Q as Ls,Sa as Js,Ta as Ys,Ua as Xs,V as Ns,Va as Zs,W as Ds,Wa as Qs,Y as Ms,Ya as ec,Za as tc,_a as nc,ab as rc,bb as ic,eb as ac,fb as xn,gb as sc,hb as cc,i as Qo,lb as Ae,lc as fc,mb as T,nb as lc,ob as dc,pa as Gs,s as xs,sa as Us,ta as qs,yb as uc}from"./chunk-7K2RUKMK.js";import{r as nt}from"./chunk-VLKCFZY6.js";import{A as cn,Ab as Gt,Ba as Ka,Bb as ls,C as Xi,Db as Bo,Ea as ue,Fb as Vo,Ha as Ja,Ia as Ya,Jb as ds,Ka as kn,Kb as ms,L as mn,La as Xa,Lb as ps,M as pn,Mb as us,N as un,Nb as fs,O as fn,P as ia,Pb as _s,Qb as hs,R as se,Ra as ts,Rb as gs,Sa as ns,Sb as Ut,Sc as Ss,T as pe,Tb as ys,Ub as Cn,Vb as bs,Wb as Ko,X as Ua,Xb as Jo,Yb as ws,Z as qa,Za as Wo,_ as za,a as qi,aa as Ha,ba as Wa,eb as In,gb as An,i as Rt,j as zi,k as Hi,ka as Uo,l as Wi,la as qo,ld as Xo,m as Bi,mb as rs,nd as Zo,ob as is,pb as as,pc as Yo,qb as ne,qd as Is,ra as vn,rb as Ie,rd as As,s as Vi,t as ko,tc as vs,u as Ki,ub as jt,uc as ks,v as le,wb as En,x as Ji,xa as Va,xb as Tn,y as Yi,yb as cs}from"./chunk-AM26RAG7.js";import{C as os,H as ss,I as P,f as Ba,g as tt,k as Sn,m as Za,n as Mt,p as Qa,s as zo,t as Ho,v as E,w as es}from"./chunk-CR5GC3VO.js";import{$b as oa,$d as Oo,$i as Mo,Aa as Co,Ad as Lt,Cc as B,Ec as Xe,Fc as la,Fg as Ea,Hd as fa,Ib as na,Id as _a,Ie as H,Ig as Qe,Jd as ha,K as ji,Ka as F,L as Gi,La as ln,Lb as Se,Li as gn,Mg as Ta,Mi as yn,Ni as bn,O as Ui,Ob as xo,Of as ba,Pi as Na,Qc as da,Qh as hn,Rb as $t,Sa as A,Va as ke,Vh as et,Vi as Fo,Wa as Ro,Wf as wa,Xb as S,Xi as Po,Y as sn,Ya as me,Yc as Pe,Yi as Lo,Zf as va,Zh as Ca,Zi as No,_c as Ze,_i as Do,a as Ct,ae as C,aj as jo,b as ie,bc as ra,bd as ma,bj as Go,ca as Ot,ce as ga,cj as x,e as an,ea as Io,ed as pa,fd as ua,fi as Ra,gi as xa,hi as Oa,ii as $a,je as $o,jg as ka,ji as Fa,jj as Da,kb as Zi,ki as Pa,kj as Ma,lb as dn,li as La,md as _n,mg as Sa,nd as Ft,nj as G,od as Pt,pg as Ia,qj as wn,rb as Qi,sh as Nt,t as J,th as Dt,tj as ja,uc as Ye,uf as ya,uj as Ga,v as vo,vc as $e,wc as aa,wg as Aa,x as Mi,xa as Ao,xb as ea,xc as sa,ya as Eo,yb as ta,yc as Fe,za as To,zc as ca,zd as Le}from"./chunk-7UUPLMCU.js";import{A as u,C as p,E as ve,F as Je,G as So,H as de,K as ae,M as xt,a as $i,e as Fi,f as Pi,g as Li,i as Ni,m as Di}from"./chunk-5OFMWP3Q.js";import{AsyncLocalStorage as Uy}from"node:async_hooks";import{readFile as du}from"node:fs/promises";import mu from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="20a3a324-d176-5918-8167-5e548be4abc9")}catch{}})();var Sr="context-intents.json";function Bn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pu(e,t,n){if(!Bn(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let o=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(o)||!o.every(r=>typeof r=="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:o,token_budget:e.token_budget}}function cd(e,t){let n=Array.isArray(e)?e:Bn(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((o,r)=>pu(o,t,r))}async function uu(e){let t=mu.join(e,Sr),n;try{n=await du(t,"utf8")}catch(r){if(Je(r))return[];throw await ss(e),r}let o;try{o=JSON.parse(n)}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`Invalid ${Sr}: ${i}`,{cause:r})}return cd(o,Sr)}function fu(e){if(!Bn(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Bn(n)?n.contextIntents??n.context_intents:void 0}function _u(e){return e.flatMap(t=>{let n=fu(t.module);return n===void 0?[]:cd(n,`package ${t.name}`)})}async function hu(e){let t=await uu(e.pmRoot),n=_u(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Vn(e,t){let n=await hu(e);return await Ea(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a4abc17-0fcb-573f-8f89-6e505e112261")}catch{}})();async function ld(e,t,n=Aa){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t,r=Array.isArray(o.warnings)?o.warnings.filter(i=>typeof i=="string"):[];o.warnings=[...new Set([...r,"context_usage_feedback_write_failed"])].sort()}}}import{createHash as Au}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]="f698608a-2f39-5972-b24b-93287af6b373")}catch{}})();var Vt=class extends RangeError{code;work;minimum_tokens;constructor(t,n,o){super(t),this.name="OutputEnvelopeFitError",this.code=t,this.work=Object.freeze({...n}),this.minimum_tokens=o}};function Ir(e,t){if(!Number.isSafeInteger(e)||e<1)throw new RangeError(`${t} must be a positive safe integer`)}function gu(e,t,n,o){return t.map(([r,i])=>{if(o.render_calls>=o.max_render_calls)throw new Vt("output_envelope_work_limit",o);o.render_calls+=1;let a=i(e);if(typeof a!="string")throw new TypeError("Envelope renderers must return strings");let s=n(a);if(!Number.isSafeInteger(s)||s<0)throw new RangeError("Envelope token estimates must be non-negative safe integers");return{name:r,text:a,bytes:Buffer.byteLength(a,"utf8"),estimated_tokens:s}})}function dd(e,t,n,o){let r=t,i=Object.entries(n.renderers),a=n.estimateTokens??(s=>ya(Buffer.byteLength(s,"utf8")));for(let s=0;s<(n.maxStabilizationPasses??16);s+=1){let c=Object.freeze({...r}),l={...n.buildEnvelope(e,c),output_fit:c},d=gu(l,i,a,o),m=Math.max(...d.map(y=>y.bytes)),f=Math.max(...d.map(y=>y.estimated_tokens));if(m===r.output_bytes&&f===r.estimated_tokens)return{envelope:l,renderings:d};r={...r,output_bytes:m,estimated_tokens:f}}throw new Vt("output_envelope_unstable",o)}function md(e,t){Ir(t.tokenBudget,"tokenBudget"),Ir(t.maxRenderCalls??1e4,"maxRenderCalls"),Ir(t.maxStabilizationPasses??16,"maxStabilizationPasses");let n=t.policy??"prefix";if(n!=="prefix"&&n!=="skip")throw new TypeError("Unknown output envelope fit policy");if(Object.entries(t.renderers).length===0||Object.entries(t.renderers).some(([c,l])=>!c.trim()||typeof l!="function"))throw new TypeError("Envelope fitting requires named callable renderers");let o={evaluated_candidates:0,render_calls:0,max_render_calls:t.maxRenderCalls??1e4},r=[],i=[],a=c=>({version:1,policy:n,total_candidates:e.length,included_indices:Object.freeze([...c]),omitted_count:e.length-c.length,token_budget:t.tokenBudget,estimated_tokens:0,output_bytes:0}),s=dd(r,a(i),t,o);if(s.envelope.output_fit.estimated_tokens>t.tokenBudget)throw new Vt("output_envelope_infeasible",o,s.envelope.output_fit.estimated_tokens);for(let[c,l]of e.entries()){o.evaluated_candidates+=1;let d=[...r,l],m=[...i,c],f=dd(d,a(m),t,o);if(f.envelope.output_fit.estimated_tokens<=t.tokenBudget)r=d,i=m,s=f;else if(n==="prefix")break}return{rows:r,...s,complete:r.length===e.length,work:Object.freeze({...o})}}import{constants as Kt}from"node:fs";import{lstat as pd,mkdir as Er,open as ud}from"node:fs/promises";import _e 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]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function Ar(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Tr(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function yu(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function bu(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let a=o.incomingOne.get(`${r.kind}\0${e.target}`);if(a!==void 0&&a!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let s=Tr(e,n),c=o.identities.get(s);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${s}`)}function wu(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function vu(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=Ar(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:Ar(e.relationshipId,"relationshipId"),author:Ar(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function ku(e,t,n,o,r,i){let a=n.has(t);if(e.action==="add"&&a)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!a)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let s=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(s)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${s} -> ${c}`);let l=new et([s,c],[e.edge],r).edges()[0];return bu(l,t,r,i),yu(l)}var Jt=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??hn()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,a;for(let s of this.stream({...o,batchSize:256}))for(let c of s)r=n(r,c),i+=1,a=c;return Object.freeze({state:r,version:a?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...a===void 0?{}:{asOf:a.timestamp}})}#a(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(Tr(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#s(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Tr(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=vu(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=ku(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#s(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#a(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(a=>Date.parse(a.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=wu(n),r=new et(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=ka("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Sa(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Ia(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Su="relationship-event-store",fd=Kt.O_NOFOLLOW;function Kn(e){return Le(e,Su,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function qe(e,t="relationships/events.jsonl"){let n=_e.resolve(e),o=_e.resolve(n,t),r=_e.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${_e.sep}`)||_e.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await Er(n,{recursive:!0}),(await pd(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of r.split(_e.sep)){i=_e.join(i,a);try{if((await pd(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(s){if(So(s))break;throw s}}return o}async function Jn(e,t,n){let o=new Jt(t,{registry:n}),r,i;try{i=await ud(e,Kt.O_RDONLY|fd),r=await i.readFile("utf8")}catch(s){if(So(s))return{log:o,raw:""};throw s}finally{await i?.close()}let a=r.split(`
|
|
1
|
+
import{a as st,b as Un,c as sl,d as cl,g as ll,i as Fl}from"./chunk-AGU7632B.js";import{L as vr,U as Yl,a as Pl,c as Ll,d as Nl,e as Dl,k as Ml,l as Bt,m as yr,n as br,u as wr,w as Jl}from"./chunk-SSZBVRIN.js";import{$c as ql,Da as Pc,Db as Tl,Ea as Nn,F as Oc,G as $c,Gb as Cl,Hb as Rl,I as Fc,Ma as al,Mb as Ht,Nc as lr,Nd as kr,Qc as Te,Qd as id,Rc as jl,Wc as mr,Xc as pr,Yc as Gl,Yd as ad,Zc as Ul,Zd as sd,_c as ct,b as er,cc as Hn,cd as Wl,d as Ne,dd as Bl,e as mc,ea as Me,ed as Vl,fd as Kl,g as ot,gb as ml,gd as _r,h as pc,hb as pl,hd as hr,i as tr,id as gr,j as On,jc as Ol,lc as $l,ld as Zl,mb as ir,md as Ql,nb as ar,nd as ed,o as rt,ob as sr,od as td,pd as nd,qb as ul,rb as fl,rc as Wn,rd as od,sb as cr,sd as rd,tc as Wt,x as Rc,y as xc}from"./chunk-7ETRLLK3.js";import{A as $n,B as kc,C as Sc,D as nr,E as zt,F as Fn,G as De,H as Ic,I as or,J as U,K as rr,L as j,M as Ac,N as Ec,O as Pn,P as Tc,Q as Ln,R as Cc,n as qt,o as _c,p as hc,q as gc,s as yc,t as it,u as _,v as bc,w as wc,y as Y,z as vc}from"./chunk-WKHS4QC6.js";import{B as Uc,Da as Gn,E as qc,G as zc,H as Hc,Ha as rl,I as Wc,J as Bc,K as Vc,Ka as il,L as Kc,M as Jc,N as Yc,O as Xc,P as Zc,Q as Qc,R as el,S as tl,T as nl,U as ol,d as Rs,m as Dn,o as je,p as Dc,q as Mn,r as Mc,ra as at,s as Ge,t as jc,u as jn,v as Gc}from"./chunk-OD2I3SFQ.js";import{i as Lc,o as Nc}from"./chunk-H64BNM4A.js";import{$a as Ue,Ha as _l,Hc as ur,Kb as zl,Lb as Hl,Mc as fr,Pc as Xl,Ra as hl,Sa as gl,Ta as yl,U as fe,Wa as bl,Xa as wl,Ya as vl,Za as kl,aa as dl,ab as Sl,b as Cs,bb as Il,db as Al,fb as qn,hb as El,lb as Ee,mb as xl,nb as zn,rb as dr}from"./chunk-CGTVDSAR.js";import{a as Es,b as Ts}from"./chunk-TS2CZE3O.js";import{$ as js,$a as oc,B as Os,Ba as zs,Da as Hs,E as $s,F as Rn,G as Fs,Ja as Ws,Ka as Bs,La as Vs,M as Ps,Oa as Ks,Q as Ls,Sa as Js,Ta as Ys,Ua as Xs,V as Ns,Va as Zs,W as Ds,Wa as Qs,Y as Ms,Ya as ec,Za as tc,_a as nc,ab as rc,bb as ic,eb as ac,fb as xn,gb as sc,hb as cc,i as Qo,lb as Ae,lc as fc,mb as T,nb as lc,ob as dc,pa as Gs,s as xs,sa as Us,ta as qs,yb as uc}from"./chunk-VETSGCF4.js";import{r as nt}from"./chunk-T3E3WNHO.js";import{A as cn,Ab as Gt,Ba as Ka,Bb as ls,C as Xi,Db as Bo,Ea as ue,Fb as Vo,Ha as Ja,Ia as Ya,Jb as ds,Ka as kn,Kb as ms,L as mn,La as Xa,Lb as ps,M as pn,Mb as us,N as un,Nb as fs,O as fn,P as ia,Pb as _s,Qb as hs,R as se,Ra as ts,Rb as gs,Sa as ns,Sb as Ut,Sc as Ss,T as pe,Tb as ys,Ub as Cn,Vb as bs,Wb as Ko,X as Ua,Xb as Jo,Yb as ws,Z as qa,Za as Wo,_ as za,a as qi,aa as Ha,ba as Wa,eb as In,gb as An,i as Rt,j as zi,k as Hi,ka as Uo,l as Wi,la as qo,ld as Xo,m as Bi,mb as rs,nd as Zo,ob as is,pb as as,pc as Yo,qb as ne,qd as Is,ra as vn,rb as Ie,rd as As,s as Vi,t as ko,tc as vs,u as Ki,ub as jt,uc as ks,v as le,wb as En,x as Ji,xa as Va,xb as Tn,y as Yi,yb as cs}from"./chunk-2VH6COJE.js";import{C as os,H as ss,I as P,f as Ba,g as tt,k as Sn,m as Za,n as Mt,p as Qa,s as zo,t as Ho,v as E,w as es}from"./chunk-CR5GC3VO.js";import{$b as oa,$d as Oo,$i as Mo,Aa as Co,Ad as Lt,Cc as B,Ec as Xe,Fc as la,Fg as Ea,Hd as fa,Ib as na,Id as _a,Ie as H,Ig as Qe,Jd as ha,K as ji,Ka as F,L as Gi,La as ln,Lb as Se,Li as gn,Mg as Ta,Mi as yn,Ni as bn,O as Ui,Ob as xo,Of as ba,Pi as Na,Qc as da,Qh as hn,Rb as $t,Sa as A,Va as ke,Vh as et,Vi as Fo,Wa as Ro,Wf as wa,Xb as S,Xi as Po,Y as sn,Ya as me,Yc as Pe,Yi as Lo,Zf as va,Zh as Ca,Zi as No,_c as Ze,_i as Do,a as Ct,ae as C,aj as jo,b as ie,bc as ra,bd as ma,bj as Go,ca as Ot,ce as ga,cj as x,e as an,ea as Io,ed as pa,fd as ua,fi as Ra,gi as xa,hi as Oa,ii as $a,je as $o,jg as ka,ji as Fa,jj as Da,kb as Zi,ki as Pa,kj as Ma,lb as dn,li as La,md as _n,mg as Sa,nd as Ft,nj as G,od as Pt,pg as Ia,qj as wn,rb as Qi,sh as Nt,t as J,th as Dt,tj as ja,uc as Ye,uf as ya,uj as Ga,v as vo,vc as $e,wc as aa,wg as Aa,x as Mi,xa as Ao,xb as ea,xc as sa,ya as Eo,yb as ta,yc as Fe,za as To,zc as ca,zd as Le}from"./chunk-7UUPLMCU.js";import{A as u,C as p,E as ve,F as Je,G as So,H as de,K as ae,M as xt,a as $i,e as Fi,f as Pi,g as Li,i as Ni,m as Di}from"./chunk-5OFMWP3Q.js";import{AsyncLocalStorage as Uy}from"node:async_hooks";import{readFile as du}from"node:fs/promises";import mu from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="20a3a324-d176-5918-8167-5e548be4abc9")}catch{}})();var Sr="context-intents.json";function Bn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function pu(e,t,n){if(!Bn(e))throw new TypeError(`${t} context intent at index ${String(n)} must be an object`);let o=e.included_field_groups;if(typeof e.command!="string"||typeof e.intent!="string"||typeof e.description!="string"||!Array.isArray(o)||!o.every(r=>typeof r=="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:o,token_budget:e.token_budget}}function cd(e,t){let n=Array.isArray(e)?e:Bn(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((o,r)=>pu(o,t,r))}async function uu(e){let t=mu.join(e,Sr),n;try{n=await du(t,"utf8")}catch(r){if(Je(r))return[];throw await ss(e),r}let o;try{o=JSON.parse(n)}catch(r){let i=r instanceof Error?r.message:String(r);throw new TypeError(`Invalid ${Sr}: ${i}`,{cause:r})}return cd(o,Sr)}function fu(e){if(!Bn(e))return;let t=e.contextIntents??e.context_intents;if(t!==void 0)return t;let n=e.default;return Bn(n)?n.contextIntents??n.context_intents:void 0}function _u(e){return e.flatMap(t=>{let n=fu(t.module);return n===void 0?[]:cd(n,`package ${t.name}`)})}async function hu(e){let t=await uu(e.pmRoot),n=_u(e.packages??[]);return{workspaceContracts:t,packageContracts:n}}async function Vn(e,t){let n=await hu(e);return await Ea(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0a4abc17-0fcb-573f-8f89-6e505e112261")}catch{}})();async function ld(e,t,n=Aa){try{await n({pmRoot:e,result:t})}catch{if(typeof t=="object"&&t!==null&&!Array.isArray(t)){let o=t,r=Array.isArray(o.warnings)?o.warnings.filter(i=>typeof i=="string"):[];o.warnings=[...new Set([...r,"context_usage_feedback_write_failed"])].sort()}}}import{createHash as Au}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]="f698608a-2f39-5972-b24b-93287af6b373")}catch{}})();var Vt=class extends RangeError{code;work;minimum_tokens;constructor(t,n,o){super(t),this.name="OutputEnvelopeFitError",this.code=t,this.work=Object.freeze({...n}),this.minimum_tokens=o}};function Ir(e,t){if(!Number.isSafeInteger(e)||e<1)throw new RangeError(`${t} must be a positive safe integer`)}function gu(e,t,n,o){return t.map(([r,i])=>{if(o.render_calls>=o.max_render_calls)throw new Vt("output_envelope_work_limit",o);o.render_calls+=1;let a=i(e);if(typeof a!="string")throw new TypeError("Envelope renderers must return strings");let s=n(a);if(!Number.isSafeInteger(s)||s<0)throw new RangeError("Envelope token estimates must be non-negative safe integers");return{name:r,text:a,bytes:Buffer.byteLength(a,"utf8"),estimated_tokens:s}})}function dd(e,t,n,o){let r=t,i=Object.entries(n.renderers),a=n.estimateTokens??(s=>ya(Buffer.byteLength(s,"utf8")));for(let s=0;s<(n.maxStabilizationPasses??16);s+=1){let c=Object.freeze({...r}),l={...n.buildEnvelope(e,c),output_fit:c},d=gu(l,i,a,o),m=Math.max(...d.map(y=>y.bytes)),f=Math.max(...d.map(y=>y.estimated_tokens));if(m===r.output_bytes&&f===r.estimated_tokens)return{envelope:l,renderings:d};r={...r,output_bytes:m,estimated_tokens:f}}throw new Vt("output_envelope_unstable",o)}function md(e,t){Ir(t.tokenBudget,"tokenBudget"),Ir(t.maxRenderCalls??1e4,"maxRenderCalls"),Ir(t.maxStabilizationPasses??16,"maxStabilizationPasses");let n=t.policy??"prefix";if(n!=="prefix"&&n!=="skip")throw new TypeError("Unknown output envelope fit policy");if(Object.entries(t.renderers).length===0||Object.entries(t.renderers).some(([c,l])=>!c.trim()||typeof l!="function"))throw new TypeError("Envelope fitting requires named callable renderers");let o={evaluated_candidates:0,render_calls:0,max_render_calls:t.maxRenderCalls??1e4},r=[],i=[],a=c=>({version:1,policy:n,total_candidates:e.length,included_indices:Object.freeze([...c]),omitted_count:e.length-c.length,token_budget:t.tokenBudget,estimated_tokens:0,output_bytes:0}),s=dd(r,a(i),t,o);if(s.envelope.output_fit.estimated_tokens>t.tokenBudget)throw new Vt("output_envelope_infeasible",o,s.envelope.output_fit.estimated_tokens);for(let[c,l]of e.entries()){o.evaluated_candidates+=1;let d=[...r,l],m=[...i,c],f=dd(d,a(m),t,o);if(f.envelope.output_fit.estimated_tokens<=t.tokenBudget)r=d,i=m,s=f;else if(n==="prefix")break}return{rows:r,...s,complete:r.length===e.length,work:Object.freeze({...o})}}import{constants as Kt}from"node:fs";import{lstat as pd,mkdir as Er,open as ud}from"node:fs/promises";import _e 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]="5434ff6f-95af-5983-88cb-fd360d95cb9e")}catch{}})();function Ar(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Tr(e,t){let n=t.require(e.kind),o=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${o}`}function yu(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function bu(e,t,n,o){let r=n.require(e.kind),i=o.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let a=o.incomingOne.get(`${r.kind}\0${e.target}`);if(a!==void 0&&a!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let s=Tr(e,n),c=o.identities.get(s);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${s}`)}function wu(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function vu(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let o=Ar(e.eventId,"eventId");if(n.has(o))throw new TypeError(`Relationship event already exists: ${o}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:o,relationshipId:Ar(e.relationshipId,"relationshipId"),author:Ar(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function ku(e,t,n,o,r,i){let a=n.has(t);if(e.action==="add"&&a)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!a)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let s=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(s)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${s} -> ${c}`);let l=new et([s,c],[e.edge],r).edges()[0];return bu(l,t,r,i),yu(l)}var Jt=class{#t;#n;#o=[];#i=new Set;#e=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#t=new Set([...t].filter(o=>typeof o=="string").map(o=>o.trim()).filter(Boolean)),this.#n=n.registry??hn()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(o)||o<0||o>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${o}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>o+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<o;i+=r)yield Object.freeze(this.#o.slice(i,Math.min(i+r,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,a;for(let s of this.stream({...o,batchSize:256}))for(let c of s)r=n(r,c),i+=1,a=c;return Object.freeze({state:r,version:a?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:i,...a===void 0?{}:{asOf:a.timestamp}})}#a(t,n){let o=this.#n.require(n.kind);this.#r.identities.set(Tr(n,this.#n),t),o.outgoing==="one"&&this.#r.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#r.incomingOne.set(`${o.kind}\0${n.target}`,t)}#s(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Tr(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=vu(t,this.version,this.#i),o=this.#e.get(n.relationshipId),r=ku(t,n.relationshipId,this.#e,this.#t,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(i),this.#i.add(n.eventId),o&&this.#s(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,r),this.#a(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(a=>Date.parse(a.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#o.slice(0,i)}let o=wu(n),r=new et(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=ka("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(Sa(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=Ia(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(o)});return{version:o,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},Su="relationship-event-store",fd=Kt.O_NOFOLLOW;function Kn(e){return Le(e,Su,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function qe(e,t="relationships/events.jsonl"){let n=_e.resolve(e),o=_e.resolve(n,t),r=_e.relative(n,o);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${_e.sep}`)||_e.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await Er(n,{recursive:!0}),(await pd(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of r.split(_e.sep)){i=_e.join(i,a);try{if((await pd(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(s){if(So(s))break;throw s}}return o}async function Jn(e,t,n){let o=new Jt(t,{registry:n}),r,i;try{i=await ud(e,Kt.O_RDONLY|fd),r=await i.readFile("utf8")}catch(s){if(So(s))return{log:o,raw:""};throw s}finally{await i?.close()}let a=r.split(`
|
|
2
2
|
`);for(let s=0;s<a.length;s+=1){let c=a[s].trim();if(!c)continue;let l;try{l=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${s+1}`)}if(l.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${s+1}`);o.append({eventId:l.eventId,relationshipId:l.relationshipId,action:l.action,...l.edge===void 0?{}:{edge:l.edge},author:l.author,timestamp:l.timestamp,...l.reason===void 0?{}:{reason:l.reason},expectedVersion:o.version})}return{log:o,raw:r}}function Iu(e,t,n,o){let r=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new et(n,[t.edge],o).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(r)&&e.timestamp===new Date(r).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&Ct(e.edge)===Ct(i)}var Yn=class e{#t;#n;#o;#i;#e;constructor(t,n,o,r){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#i=o,this.#e=r}static async open(t){let n=Object.freeze([...t.nodes]),o=await qe(t.pmRoot,t.relativePath),r=await Kn(t.pmRoot);try{await qe(t.pmRoot,o);let{log:i}=await Jn(o,n,t.registry);return new e(t,n,o,i)}finally{await r()}}get path(){return this.#i}async currentVersion(){return this.#e=await this.#r(),this.#e.version}async append(t){let n=await Kn(this.#t);try{let o=await qe(this.#t,this.#i),{log:r}=await Jn(o,this.#n,this.#o),i=r.append(t);await Er(_e.dirname(o),{recursive:!0}),await qe(this.#t,o);let a=await ud(o,Kt.O_APPEND|Kt.O_CREAT|Kt.O_WRONLY|fd);try{await a.appendFile(`${JSON.stringify(i)}
|
|
3
3
|
`,"utf8")}finally{await a.close()}return this.#e=r,i}finally{await n()}}async appendBatch(t,n={}){let o=await Kn(this.#t);try{let r=await qe(this.#t,this.#i),{log:i,raw:a}=await Jn(r,this.#n,this.#o),s=i.version,c=new Map(i.events().map(m=>[m.eventId,m])),l=[],d=[];for(let m of t){let f=m.eventId.trim(),y=c.get(f);if(y!==void 0){if(n.existingEventPolicy==="skip_identical"&&Iu(y,m,this.#n,this.#o)){d.push(y.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let g=i.append(m);c.set(g.eventId,g),l.push(g)}if(l.length>0){let m=a.length===0||a.endsWith(`
|
|
4
4
|
`)?a:`${a}
|
|
@@ -2283,5 +2283,5 @@ compdef _pm pm`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"
|
|
|
2283
2283
|
`)}catch{}}function by(e){let t=(e??"keyword").trim().toLowerCase();if(t==="keyword")return"keyword";if(t==="semantic"||t==="hybrid")return t;throw new p("Reindex mode must be one of keyword|semantic|hybrid",u.USAGE)}async function wy(e,t,n,o){let r=[];return{candidates:await as(e,t,n,r,o),warnings:r}}async function Oi(e,t,n,o,r){let i=pe(x()),a=[];for(let s of t)if(!(r&&!r.has(s.metadata.id))){if(typeof s.body=="string"){a.push({metadata:s.metadata,body:s.body});continue}try{let c=await hy.readFile(s.item_path,"utf8"),l=_n(c,{format:s.item_format,schema:n,extensionFieldNames:i,onWarning:d=>o.push(d)});a.push({metadata:s.metadata,body:l.body})}catch{o.push(`item_list_item_read_failed:${on.relative(e,s.item_path)}`),a.push({metadata:s.metadata,body:""})}}return a}function vy(e,t,n){let o=e.metadata;return{id:o.id,mode:t,updated_at:o.updated_at,corpus:ds(e,{fields:n})}}var Et=na;function ky(e){let t=x(),n=Et(e.search?.provider);if(!n)return null;let o=qa(t,n);if(!o)return null;let r=o.runtime_definition??o.definition,i=Et(r.name)??Et(o.definition.name);if(!i)return null;let a=r.embedBatch,s=r.embed_batch,c=r.embed,l=typeof a=="function"?a:typeof s=="function"?s:void 0,d=typeof c=="function"?c:void 0;return!l&&!d?null:{name:i,embedBatch:l,embed:d}}function Sy(e){let t=x(),n=Et(e.vector_store?.adapter);if(!n)return null;let o=za(t,n);if(!o)return null;let r=o.runtime_definition??o.definition,i=Et(r.name)??Et(o.definition.name);if(!i)return null;let a=r.upsert,s=r.delete;return{adapterName:i,...typeof a=="function"?{upsert:a}:{},...typeof s=="function"?{delete:s}:{}}}function xi(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="number"||!Number.isFinite(n)))throw new p(`Invalid vector returned by ${t}`,u.GENERIC_FAILURE);return e}async function Iy(e,t,n){let o=t.search?.embedding_model?.trim()||"text-embedding-3-small";if(e.embedBatch){let i=await Promise.resolve(e.embedBatch({inputs:n,settings:t,model:o}));if(!Array.isArray(i))throw new p(`Extension search provider "${e.name}" embedBatch must return an array of vectors`,u.GENERIC_FAILURE);return i.map((a,s)=>xi(a,`extension search provider "${e.name}" embedBatch output at index ${s}`))}if(!e.embed)throw new p(`Extension search provider "${e.name}" does not implement embed/embedBatch`,u.GENERIC_FAILURE);let r=[];for(let[i,a]of n.entries()){let s=await Promise.resolve(e.embed({input:a,settings:t,model:o}));r.push(xi(s,`extension search provider "${e.name}" embed output at index ${i}`))}return r}function eu(e){return e.search?.embedding_model?.trim()||"text-embedding-3-small"}function tu(e,t,n){let o=n?Ut(n.name,eu(e)):t?Ut(t.name,t.model):null;if(!o)throw new p("No embedding identity available for semantic reindex mode",u.USAGE);return o}function Ay(e,t){return Object.keys(e).filter(n=>!t.has(n)).sort((n,o)=>n.localeCompare(o))}async function nu(e,t,n,o,r,i,a,s){let c=o?.name??n?.name,l=ms(c,e.search.embedding_corpus_max_characters).maxCharacters,d=Vo(e),m=r.map(g=>ps(g,{providerName:c,maxCharacters:l,fields:d})),f=[],y=null;if(o)try{f=await Iy(o,e,m),y=Ut(o.name,eu(e))}catch(g){if(!n)throw new p(`Extension search provider "${o.name}" failed to generate embeddings: ${g instanceof Error?g.message:String(g)}`,u.GENERIC_FAILURE);i.push(`Extension search provider "${o.name}" failed; falling back to built-in provider (${g instanceof Error?g.message:String(g)})`)}if(f.length===0){if(!n)throw new p(`No embedding executor available for reindex mode '${t}'`,u.USAGE);let g=await us(n,e,m,{onProgress:k=>{k.phase==="complete"&&(a.batches_completed=k.batch_index),M(s,`embedding_batch_${k.phase} batch=${k.batch_index}/${k.batch_total} size=${k.batch_size} completed_inputs=${k.completed_inputs}/${k.total_inputs}`)}});i.push(...g.warnings),a.batching=g.receipt,f=g.vectors,y=Ut(n.name,n.model)}if(M(s,`embedding_complete vectors=${f.length}`),f.length!==r.length)throw new p(`Embedding output size mismatch (expected ${r.length}, received ${f.length})`,u.GENERIC_FAILURE);if(!y)throw new p(`No embedding identity available for reindex mode '${t}'`,u.USAGE);return{vectors:f,embeddingIdentity:y}}async function Ey(e,t,n,o,r,i){let a=Object.keys(n);if(t){if(a.length>0&&t.delete)try{await Promise.resolve(t.delete({ids:a.sort((s,c)=>s.localeCompare(c)),settings:o}))}catch(s){throw new p(`Extension vector adapter "${t.adapterName}" failed to delete vectors during reindex reset: ${s instanceof Error?s.message:String(s)}`,u.GENERIC_FAILURE)}else a.length>0&&r.push(`search_semantic_reindex_reset_skipped:adapter=${t.adapterName}:known_ids=${a.length}`);if(!e)return}e&&await gs(e,a,{},i)}async function ou(e,t,n,o,r){if(n.length!==0){if(t){if(t.delete)try{await Promise.resolve(t.delete({ids:n,settings:o}))}catch(i){throw new p(`Extension vector adapter "${t.adapterName}" failed to delete orphan vectors during reindex: ${i instanceof Error?i.message:String(i)}`,u.GENERIC_FAILURE)}else r.push(`search_semantic_reindex_orphan_prune_skipped:adapter=${t.adapterName}:count=${n.length}`);if(!e)return}e&&await hs(e,n)}}function Ty(e){return{enabled:e!=="keyword",stale_items:0,unchanged_items:0,embedded_items:0,vector_upserted:0,batches_completed:0}}function Cy(e,t,n){return{version:1,mode:e,generated_at:t,total_items:n.length,items:n.map(o=>({id:o.metadata.id,type:o.metadata.type,status:o.metadata.status,priority:o.metadata.priority,updated_at:o.metadata.updated_at}))}}function Ry(e){if(e.requestedMode==="keyword")return{activeEmbeddingProvider:null,activeVectorStore:null};let t=Bo(e.settings);if(!t.active&&!e.extensionEmbedding)throw new p(`Reindex mode '${e.requestedMode}' requires a configured embedding provider in settings.providers.openai/settings.providers.ollama or an extension provider selected by settings.search.provider`,u.USAGE);let n=fs(e.settings,e.pmRoot);if(!n.active&&!e.extensionVectorAdapter)throw new p(`Reindex mode '${e.requestedMode}' requires a configured vector store in settings.vector_store.qdrant/settings.vector_store.lancedb or an extension adapter selected by settings.vector_store.adapter`,u.USAGE);return{activeEmbeddingProvider:t.active,activeVectorStore:n.active}}async function xy(e){let t=F(e.settings,x()),n=await wy(e.pmRoot,e.settings.item_format,t.type_to_folder,e.settings.schema);return{documentCandidates:n.candidates,warnings:[...n.warnings],metadataDocuments:n.candidates.map(o=>({metadata:o.metadata,body:typeof o.body=="string"?o.body:""}))}}async function Oy(e){let t=await Jo(e.pmRoot);if(e.reindexWarnings.push(...t.warnings),e.forceFullSemantic&&e.reindexWarnings.push("search_semantic_reindex_full_ignored:mode_keyword"),!t.embedding)return;let n=(()=>{try{return tu(e.settings,Bo(e.settings).active,e.extensionEmbedding)}catch{return null}})();n&&Cn(t.embedding,n)&&(e.reindexWarnings.push("search_semantic_reindex_requires_rebuild:embedding_identity_changed"),e.reindexWarnings.push(gy))}async function $y(e){let t=await Jo(e.pmRoot);e.semanticWarnings.push(...t.warnings);let n=tu(e.settings,e.activeEmbeddingProvider,e.extensionEmbedding),o=new Set(e.metadataDocuments.map(l=>l.metadata.id)),r=Ay(t.entries,o),i=Cn(t.embedding,n);e.forceFullSemantic&&!i&&e.semanticWarnings.push("search_semantic_reindex_full_rebuild_forced");let a=e.forceFullSemantic||i?e.metadataDocuments:e.metadataDocuments.filter(l=>t.entries[l.metadata.id]!==l.metadata.updated_at),s=new Set(a.map(l=>l.metadata.id)),c=s.size>0?await Oi(e.pmRoot,e.documentCandidates,e.settings.schema,e.reindexWarnings,s):[];return{ledgerEntries:t.entries,ledgerEmbedding:t.embedding,orphanIds:r,resetRequired:i,staleDocuments:c,freshDocuments:e.metadataDocuments.length-c.length}}async function Fy(e){let t=new Set(e.metadataDocuments.map(r=>r.metadata.id)),n=await Oi(e.pmRoot,e.documentCandidates,e.settings.schema,e.reindexWarnings,t);e.semanticSummary.stale_items=n.length,e.semanticSummary.unchanged_items=0,M(e.progressEnabled,`embedding_dimension_changed reset_items=${n.length}`);let o=await nu(e.settings,e.requestedMode,e.activeEmbeddingProvider,e.extensionEmbedding,n,e.semanticWarnings,e.semanticSummary,e.progressEnabled);return{...o,staleDocuments:n,vectorDimension:Ko(o.vectors,"Reindex embeddings")}}async function Py(e){let t=await nu(e.settings,e.requestedMode,e.activeEmbeddingProvider,e.extensionEmbedding,e.staleDocuments,e.semanticWarnings,e.semanticSummary,e.progressEnabled),n=t.vectors,o=t.embeddingIdentity,r=Ko(n,"Reindex embeddings");if(!(!e.resetRequired&&(Cn(e.ledgerEmbedding,o)||bs(e.ledgerEmbedding,r))))return{vectors:n,embeddingIdentity:o,staleDocuments:e.staleDocuments,vectorDimension:r,resetRequired:e.resetRequired};let i=await Fy(e);return n=i.vectors,o=i.embeddingIdentity,r=i.vectorDimension,{vectors:n,embeddingIdentity:o,staleDocuments:i.staleDocuments,vectorDimension:r,resetRequired:!0}}async function Ly(e){if(e.extensionVectorAdapter)try{let t=e.extensionVectorAdapter.adapterName;if(M(e.progressEnabled,`vector_upsert_start adapter=${t} points=${e.points.length}`),typeof e.extensionVectorAdapter.upsert!="function")throw new p(`Extension vector adapter "${t}" does not support upserting vectors.`,u.USAGE);await Promise.resolve(e.extensionVectorAdapter.upsert({points:e.points,settings:e.settings})),e.semanticSummary.vector_upserted=e.points.length,M(e.progressEnabled,`vector_upsert_complete adapter=${t}`);return}catch(t){if(t instanceof p)throw t;if(!e.activeVectorStore)throw new p(`Extension vector adapter "${e.extensionVectorAdapter.adapterName}" failed to upsert vectors: ${t instanceof Error?t.message:String(t)}`,u.GENERIC_FAILURE);e.semanticWarnings.push(`Extension vector adapter "${e.extensionVectorAdapter.adapterName}" failed; falling back to built-in vector store (${t instanceof Error?t.message:String(t)})`),M(e.progressEnabled,"vector_upsert_fallback built_in_store")}if(e.activeVectorStore){M(e.progressEnabled,`vector_upsert_start adapter=${e.activeVectorStore.name} points=${e.points.length}`),await _s(e.activeVectorStore,e.points),e.semanticSummary.vector_upserted=e.points.length,M(e.progressEnabled,`vector_upsert_complete adapter=${e.activeVectorStore.name}`);return}throw new p(`No vector upsert executor available for reindex mode '${e.requestedMode}'`,u.USAGE)}function Ny(e,t){return e.map((n,o)=>({id:n.metadata.id,vector:xi(t[o],`reindex embeddings output at index ${o}`),payload:{id:n.metadata.id,type:n.metadata.type,status:n.metadata.status,priority:n.metadata.priority,updated_at:n.metadata.updated_at}}))}async function Dy(e){M(e.progressEnabled,`embedding_start items=${e.plan.staleDocuments.length} unchanged_items=${e.plan.freshDocuments}`);let t=await Py({pmRoot:e.pmRoot,settings:e.settings,requestedMode:e.requestedMode,activeEmbeddingProvider:e.activeEmbeddingProvider,extensionEmbedding:e.extensionEmbedding,documentCandidates:e.documentCandidates,metadataDocuments:e.metadataDocuments,staleDocuments:e.plan.staleDocuments,ledgerEmbedding:e.plan.ledgerEmbedding,resetRequired:e.plan.resetRequired,semanticWarnings:e.semanticWarnings,reindexWarnings:e.reindexWarnings,semanticSummary:e.semanticSummary,progressEnabled:e.progressEnabled});t.resetRequired?(M(e.progressEnabled,"vector_reset_start"),await Ey(e.activeVectorStore,e.extensionVectorAdapter,e.plan.ledgerEntries,e.settings,e.semanticWarnings,e.plan.ledgerEmbedding?t.vectorDimension:void 0),M(e.progressEnabled,"vector_reset_complete")):await ou(e.activeVectorStore,e.extensionVectorAdapter,e.plan.orphanIds,e.settings,e.semanticWarnings);let n=Ny(t.staleDocuments,t.vectors);return e.semanticSummary.embedded_items=t.vectors.length,await Ly({requestedMode:e.requestedMode,activeVectorStore:e.activeVectorStore,extensionVectorAdapter:e.extensionVectorAdapter,settings:e.settings,points:n,semanticWarnings:e.semanticWarnings,semanticSummary:e.semanticSummary,progressEnabled:e.progressEnabled}),{staleDocuments:t.staleDocuments,embeddingMetadata:ys(t.embeddingIdentity,t.vectorDimension)}}async function My(e){let t=await $y(e);e.semanticSummary.stale_items=t.staleDocuments.length,e.semanticSummary.unchanged_items=t.freshDocuments;let n=Object.fromEntries(e.metadataDocuments.map(i=>[i.metadata.id,i.metadata.updated_at]));if(M(e.progressEnabled,`semantic_stale_items stale=${t.staleDocuments.length} total=${e.metadataDocuments.length} unchanged=${t.freshDocuments} full=${e.forceFullSemantic||t.resetRequired}`),t.staleDocuments.length===0)return M(e.progressEnabled,`embedding_skipped unchanged_items=${t.freshDocuments}`),e.semanticWarnings.push(`search_semantic_reindex_skipped_unchanged:count=${t.freshDocuments}`),await ou(e.activeVectorStore,e.extensionVectorAdapter,t.orphanIds,e.settings,e.semanticWarnings),{documentsForKeywordArtifacts:e.documentsForKeywordArtifacts,vectorizationLedgerEntries:n,vectorizationEmbeddingMetadata:t.ledgerEmbedding};let o=await Dy({...e,plan:t});t.freshDocuments>0&&e.semanticWarnings.push(`search_semantic_reindex_skipped_unchanged:count=${t.freshDocuments}`);let r=new Map(o.staleDocuments.map(i=>[i.metadata.id,i]));return{documentsForKeywordArtifacts:e.metadataDocuments.map(i=>r.get(i.metadata.id)??i),vectorizationLedgerEntries:n,vectorizationEmbeddingMetadata:o.embeddingMetadata}}async function jy(e){let t=on.join(e.pmRoot,Ci),n=on.join(e.pmRoot,Ri),o=Vo(e.settings),r=e.documentsForKeywordArtifacts.map(a=>JSON.stringify(vy(a,e.mode,o))).join(`
|
|
2284
2284
|
`);M(e.progressEnabled,"writing keyword artifacts"),await ae(t,`${JSON.stringify(e.manifest,null,2)}
|
|
2285
2285
|
`),await ae(n,`${r}
|
|
2286
|
-
`);let i=[];if(e.mode!=="keyword")try{M(e.progressEnabled,"writing vectorization status ledger"),await ws(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(a){i.push(`search_vectorization_status_ledger_write_failed:${a instanceof Error?a.message:String(a)}`)}return i}async function Gy(e,t){let n=by(e.mode),o=yy(e),r=e.full===!0;M(o,`start mode=${n}`);let i=A(process.cwd(),t.path);await P(i);let a=ts(await E(i)).settings,s=null;try{s=await Le(i,ns,a.locks.ttl_seconds,C(void 0,"pm-reindex"),!1,a.governance.force_required_for_stale_lock,a.locks.wait_ms)}catch(c){throw c instanceof p&&c.exitCode===u.CONFLICT?new p("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",u.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=ky(a),l=Sy(a),d=Ry({requestedMode:n,pmRoot:i,settings:a,extensionEmbedding:c,extensionVectorAdapter:l}),m=n;M(o,"loading item corpus");let f=await xy({pmRoot:i,settings:a}),y=f.warnings,{documentCandidates:g,metadataDocuments:k}=f;M(o,`loaded_items=${k.length}`);let b=S(),v=Cy(m,b,k),h=on.join(i,Ci),I=on.join(i,Ri),L=m==="keyword"?await Oi(i,g,a.schema,y):k,O=[],W={},$=null,R=Ty(m);if(m==="keyword"&&await Oy({pmRoot:i,settings:a,forceFullSemantic:r,extensionEmbedding:c,reindexWarnings:y}),m!=="keyword"){let te=await My({pmRoot:i,settings:a,requestedMode:n,activeEmbeddingProvider:d.activeEmbeddingProvider,activeVectorStore:d.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:l,documentCandidates:g,metadataDocuments:k,documentsForKeywordArtifacts:L,forceFullSemantic:r,reindexWarnings:y,semanticWarnings:O,semanticSummary:R,progressEnabled:o});L=te.documentsForKeywordArtifacts,W=te.vectorizationLedgerEntries,$=te.vectorizationEmbeddingMetadata}let re=await jy({pmRoot:i,mode:m,manifest:v,documentsForKeywordArtifacts:L,settings:a,vectorizationLedgerEntries:W,vectorizationEmbeddingMetadata:$,progressEnabled:o}),Tt=[...await G({path:h,scope:"project",op:"reindex:manifest"}),...await G({path:I,scope:"project",op:"reindex:embeddings"}),...await ja({mode:m,total_items:k.length})];return M(o,"done"),{ok:!0,mode:m,total_items:k.length,semantic:R,artifacts:{manifest:Ci,embeddings:Ri},warnings:[...y,...O,...re,...Tt],generated_at:b}}finally{await s?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="21f305ed-dd88-5b62-8cfa-b55e1b3f01dd")}catch{}})();var rn=Symbol("pm.active-extension-host-context");function Q(e){return{fullChangedFields:!0,options:e}}var w=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[rn]=!0,n}run(t,n={}){return Ky({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}async withItemTransactionContext(t,n=!1){let o=A(this.defaults.cwd??process.cwd(),this.defaults.path),r=async()=>{let a=await Mt(o,()=>E(o));return t({pmRoot:o,author:C(this.defaults.author,a.author_default)})};if(this.defaults[rn]===!0||wo.getStore()===!0)return r();let i=()=>qy({...this.defaults,path:o},r);return n?Mt(o,i):i()}previewItemMutations(t){return this.withItemTransactionContext(async n=>(await import("./item-transaction-NVX6P3FK.js")).previewItemMutations({...t,...n}),!0)}commitItemMutations(t){return this.withItemTransactionContext(async n=>(await import("./item-transaction-NVX6P3FK.js")).commitItemMutations({...t,...n}))}get itemTransactions(){let t=(n,o)=>this.withItemTransactionContext(async r=>(await import("./item-transaction-NVX6P3FK.js")).abandonItemTransaction({...o,...r,transactionId:n}));return{status:n=>this.withItemTransactionContext(async o=>(await import("./item-transaction-NVX6P3FK.js")).readItemTransaction(o.pmRoot,n),!0),abandon:t,supersede:(n,o,r)=>t(n,{...r,supersededBy:o})}}readItemRevision(t){return this.withItemTransactionContext(async({pmRoot:n})=>(await import("./item-revision-7RVMVXTE.js")).readItemRevision(t,{pmRoot:n}))}async withExpectedItemRevisions(t,n){let o=await import("./item-revision-7RVMVXTE.js"),r="",i=await this.withItemTransactionContext(({pmRoot:s})=>(r=s,o.bindExpectedItemRevisions(t,{pmRoot:s}))),a=this.defaults.noExtensions===!0&&this.defaults[rn]!==!0;return o.runWithBoundItemRevisionScope(i,n,{scopeArgs:["--pm-path",r,...a?["--no-extensions"]:[]]})}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return yd(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Zn(await this.list(Rr(t)),t)}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}async append(t,n,o={}){return _c(o,"append"),await this.runTyped("append",{id:t,...Q(it(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,r,i={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...r===void 0?{}:{value:r},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,o={}){return this.runTyped("schema",{name:n,options:{...o,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){let{type:o,...r}=n;return this.runTyped("schema",{name:t,options:{...r,fieldType:o,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,r){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...r?{fieldTypeScope:r}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},r,i){return this.runTyped("plan",{fullChangedFields:!0,...n===void 0?{}:{id:n},...r===void 0?{}:{stepRef:r},...i===void 0?{}:{reorderTo:i},options:it(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,r={}){return this.plan("reorder-step",t,r,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Q(t))}update(t,n={}){return this.runTyped("update",{id:t,...Q(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...Q(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Q(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Q(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Q(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Q(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Q(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Q(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Q(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Q(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...Q(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function FR(e={},t={}){return new w(t).context(e)}function PR(e={},t={}){return new w(t).list(e)}function LR(e={},t={}){return new w(t).listAllComplete(e)}function NR(e,t={},n={}){return new w(n).search(e,t)}function DR(e,t={},n={}){return new w(n).get(e,t)}function MR(e={},t={}){return new w(t).next(e)}function jR(e={},t={}){return new w(t).aggregate(e)}function GR(e={},t={}){return new w(t).stats(e)}function UR(e={},t={}){return new w(t).duplicates(e)}function qR(e,t={},n={}){return new w(n).comments(e,t)}function zR(e,t={},n={}){return new w(n).notes(e,t)}function HR(e,t={},n={}){return new w(n).learnings(e,t)}function WR(e,t={},n={}){return new w(n).files(e,t)}function BR(e,t={},n={}){return new w(n).filesDiscover(e,t)}function VR(e,t={}){return new w(t).filesLookup(e)}function KR(e,t={},n={}){return new w(n).docs(e,t)}function JR(e,t={},n={}){return new w(n).deps(e,t)}function YR(e,t={},n={},o={}){return new w(o).graph(e,t,n)}function XR(e,t,n={},o={}){return new w(o).append(e,t,n)}function ZR(e,t={},n={}){return new w(n).init(e,t)}function QR(e,t,n,o,r={},i={}){return new w(i).config(e,t,n,o,r)}function ex(e,t={},n={}){return new w(n).schema(e,t)}function tx(e={}){return new w(e).schemaList()}function nx(e,t={}){return new w(t).schemaShow(e)}function ox(e,t={},n={}){return new w(n).schemaAddType(e,t)}function rx(e,t={},n={}){return new w(n).schemaRemoveType(e,t)}function ix(e,t={},n={}){return new w(n).schemaAddStatus(e,t)}function ax(e,t={},n={}){return new w(n).schemaRemoveStatus(e,t)}function sx(e,t={},n={}){return new w(n).schemaAddField(e,t)}function cx(e,t={},n={}){return new w(n).schemaRemoveField(e,t)}function lx(e={}){return new w(e).schemaListFields()}function dx(e,t={}){return new w(t).schemaShowField(e)}function mx(e,t={},n={}){return new w(n).schemaApplyPreset(e,t)}function px(e={},t={}){return new w(t).schemaInferTypes(e)}function ux(e,t,n,o={}){return new w(o).schemaRenameType(e,t,n)}function fx(e,t,n,o,r={}){return new w(r).schemaRenameField(e,t,n,o)}function _x(e,t,n,o={}){return new w(o).schemaRemapStatus(e,t,n)}function hx(e,t={}){return new w(t).schemaShowStatus(e)}function gx(e,t={},n={}){return new w(n).profile(e,t)}function yx(e={}){return new w(e).profileList()}function bx(e,t={}){return new w(t).profileShow(e)}function wx(e,t={},n={}){return new w(n).profileApply(e,t)}function vx(e,t={}){return new w(t).profileLint(e)}function kx(e={},t={}){return new w(t).validate(e)}function Sx(e={},t={}){return new w(t).health(e)}function Ix(e={},t={}){return new w(t).gc(e)}function Ax(e,t,n={}){return new w(n).historyRedact(e,t)}function Ex(e,t={},n={}){return new w(n).historyRepair(e,t)}function Tx(e={},t={}){return new w(t).historyRepairAll(e)}function Cx(e,t={},n={}){return new w(n).historyCompact(e,t)}function Rx(e,t={}){return new w(t).historyCompactBulk(e)}function xx(e={},t={}){return new w(t).create(e)}function Ox(e,t={},n={}){return new w(n).update(e,t)}function $x(e,t,n={},o={}){return new w(o).reopen(e,t,n)}function Fx(e,t,n={},o={}){return new w(o).close(e,t,n)}function Px(e,t={},n={}){return new w(n).claim(e,t)}function Lx(e={},t={}){return new w(t).claimNext(e)}function Nx(e,t={},n={}){return new w(n).release(e,t)}function Dx(e,t={},n={}){return new w(n).copy(e,t)}function Mx(e,t={},n={}){return new w(n).delete(e,t)}function jx(e,t,n={},o={}){return new w(o).restore(e,t,n)}function Gx(e,t={},n={}){return new w(n).focus(e,t)}function Ux(e,t={},n={}){return new w(n).startTask(e,t)}function qx(e,t={},n={}){return new w(n).pauseTask(e,t)}function zx(e,t,n={},o={}){return new w(o).closeTask(e,t,n)}function Hx(e,t={},n={}){return new w(n).extension(e,t)}function Wx(e={},t={}){return new w(t).extensionList(e)}function Bx(e,t={},n={}){return new w(n).extensionActivate(e,t)}function Vx(e,t={},n={}){return new w(n).extensionDeactivate(e,t)}function Kx(e,t={},n={}){return new w(n).package(e,t)}function Jx(e={},t={}){return new w(t).packageList(e)}function Yx(e,t={},n={}){return new w(n).packageInstall(e,t)}function Xx(e,t={},n={}){return new w(n).packageUninstall(e,t)}function Zx(e={},t={}){return new w(t).packageDoctor(e)}function Qx(e,t={},n={}){return new w(n).packageManage(e,t)}function e0(e,t={},n={}){return new w(n).packageDescribe(e,t)}function t0(e={},t={}){return new w(t).packageReload(e)}function n0(e={},t={}){return new w(t).packageCatalog(e)}function o0(e,t={},n={}){return new w(n).packageActivate(e,t)}function r0(e,t={},n={}){return new w(n).packageDeactivate(e,t)}function i0(e,t={},n={}){return new w(n).upgrade(e,t)}async function a0(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return Nn(n,o)}var ru=Na(),wo=new Uy;function bo(){Po(Ra()),Lo(xa()),No(Oa()),Do($a()),Mo(Fa()),jo(Pa()),Go(La())}async function su(e,t,n,o){return Fo(()=>t===void 0?ru.read(()=>iu(e,n,o)):ru.write(()=>Wy(t,()=>iu(e,n,o))))}async function qy(e,t){let n=e.cwd;if(wo.getStore()===!0&&n===void 0&&e.noExtensions===!0){let r=A(process.cwd(),e.path);return Fo(()=>Vn({pmRoot:r},t))}let o=n??process.cwd();return su($n({path:e.path,noExtensions:e.noExtensions}),n,o,()=>wo.run(!0,t))}function zy(e){try{let t=e instanceof Error?e.stack:void 0,n=typeof t=="string"?t:ks(e);return typeof n=="string"?n:"Unknown failure"}catch{return"Unknown failure"}}async function iu(e,t,n){let o=A(t,e.path);if(e.noExtensions)return bo(),Vn({pmRoot:o},()=>n(null));if(!await ve(ke(o)))return bo(),n(null);let r=null,i;try{let a=await E(o),s=await gn({pmRoot:o,settings:a,cwd:t,noExtensions:!1}),c=await bn({...s,loaded:s.loaded});i={loadResult:s,activationResult:c},Po(c.hooks),Lo(c.commands),No(c.parsers),Do(c.preflight),Mo(c.services),jo(c.renderers),Go(c.registrations),r={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:s.loaded}}catch(a){bo(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",zy(a))}try{return await Vn({pmRoot:o,packages:r?.packages},()=>n(r))}finally{bo(),i&&await yn(i.loadResult,i.activationResult).catch(()=>{})}}function cu(e,t){let n=De(e);return t?.registrations.commands.find(o=>De(o.action)===n)?.command??t?.commands.handlers.find(o=>De(o.command)===n)?.command}async function Hy(e,t,n,o,r){if(!r)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let i=cu(e,r);if(!i)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let a=typeof n.author=="string"?n.author:o.author,s=or(i),c=xc(rr(t,n),Rc(r.registrations,s),s,hd(s)),l=await Ga({command:s,args:U(n.args??t.args),options:c,global:{...o,author:a},pm_root:r.pmRoot,sdk:_d(r.pmRoot,w.forActiveExtensionHost({pmRoot:r.pmRoot,author:a}),a,s)});if(!l.handled){if(Object.hasOwn(l,"cause"))throw vs(i,l);let d=l.warnings.length>0?` (${l.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${d}`,u.USAGE)}return l.result}async function Wy(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function By(e){let t=K(e,"action"),n=De(t),o=ye(xr,n),r=o?.action??n,i={...e,action:r};return o?.options!==void 0&&(i.options={...o.options,...$t(e.options)}),r==="package"&&(i.options={...$t(i.options),vocabulary:"package"}),{action:r,args:i}}function Vy(e,t,n,o){let r=e[rn]===!0,i=t.noExtensions===!0&&!r?["--no-extensions"]:[];if(n!==void 0)return["--pm-path",A(o,t.path),...i];let a=ta(t,o);return[...t.noExtensions===!0?a.slice(0,-1):a,...i]}async function Ky(e){let t=By(e),n=$n(t.args);ea(n);let o=Ic(t.action),r=_(t.args,"cwd"),i=r??process.cwd();t.action==="init"&&(n[rl]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=A(i,n.path));let{expectHash:a,dispatchArgs:s}=Cc(t.args),c=async l=>{if(a===void 0)return au(t.action,s,n,l);let{dispatchWithExpectedItemRevisions:d}=await import("./item-revision-7RVMVXTE.js");return d({action:t.action,expectHash:a,defaultId:_(s,"id")??_($t(s.options),"id"),options:$t(s.options),background:s.background,pmRoot:A(i,n.path),invocation:{scopeArgs:Vy(e,n,r,i),...n.outputFormat===void 0?{}:{outputArgs:["--output-format",n.outputFormat]}},run:()=>au(t.action,s,n,l)})};try{return t.action==="history-attest"?await c(null):e[rn]===!0||wo.getStore()===!0?await c(null):await su(n,r,i,l=>c(l))}finally{o&&fi()}}function s0(e=Ui){return e.map(t=>{let n=De(t),o=ye(xr,n),r=o?.action??n,i=ye(ui,r)!==void 0;return{action:t,resolved_action:r,covered:i,route:i?o?"alias":"native":"missing"}})}async function au(e,t,n,o){let r=ye(ui,e),i=nr(t,e,{nativeAction:r!==void 0});if(e==="create"||e==="update"){let{assertNativeMutationOptions:d}=await import("./mutation-admission-3PKQOAYK.js");await d(e,t,i,n.path,kc[e])}let a=r?void 0:cu(e,o),s=a===void 0?e:`extension:${a}`;wa(s,i),va(s,i);let c={action:e,args:t,options:i,id:_(t,"id"),force:t.force===!0||i.force===!0,global:n,activeExtensions:o},l=r?await r(c):await Hy(e,t,i,n,o);if(e==="history-attest")return l;{let d=Ta(s,i,l);return await ld(A(process.cwd(),n.path),d),d}}var Jy={closeManyOptionsFromFlat:Pn,extensionOptionsFromArgs:rr,globalOptions:$n,mutationListOptions:Ac,normalizeActionName:De,normalizeCommandPath:or,normalizeMcpUpdateOptions:Tc,normalizeMcpOptionsArrays:Sc,optionsWithAuthor:nr,readRequiredString:K,readScalarString:bc,readScalarStringAllowBlank:wc,readStringArray:U,updateManyOptionsFromFlat:Ln,withAddNoteOption:zt,withFilesDiscoveryOptions:Fn,withMutationCompaction:j};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=Jy);export{Sr as a,cd as b,uu as c,_u as d,hu as e,Vn as f,Vt as g,md as h,Jt as i,Yn as j,_d as k,vd as l,Id as m,em as n,hd as o,Tu as p,Xn as q,Rr as r,gd as s,Zn as t,Lu as u,Ed as v,xd as w,Pr as x,Lr as y,Nr as z,Dr as A,ff as B,zr as C,Vd as D,Zd as E,mt as F,ti as G,z_ as H,Bv as I,Vv as J,ri as K,nm as L,lk as M,dk as N,rm as O,sm as P,xk as Q,ah as R,mi as S,ch as T,lh as U,wm as V,vm as W,km as X,Sm as Y,Im as Z,tS as _,nS as $,oS as aa,rS as ba,Am as ca,Cm as da,so as ea,Fm as fa,Pm as ga,Lm as ha,K as ia,fi as ja,FA as ka,PA as la,LA as ma,NA as na,DA as oa,Bm as pa,MA as qa,pg as ra,_g as sa,bg as ta,wg as ua,vg as va,z as wa,kg as xa,Sg as ya,Ig as za,Ag as Aa,hi as Ba,Ym as Ca,ft as Da,_i as Ea,Xm as Fa,Eg as Ga,Zm as Ha,Tg as Ia,Cg as Ja,Rg as Ka,xg as La,Og as Ma,$g as Na,jg as Oa,np as Pa,Ug as Qa,Kg as Ra,ty as Sa,oy as Ta,_y as Ua,Gy as Va,w as Wa,FR as Xa,PR as Ya,LR as Za,NR as _a,DR as $a,MR as ab,jR as bb,GR as cb,UR as db,qR as eb,zR as fb,HR as gb,WR as hb,BR as ib,VR as jb,KR as kb,JR as lb,YR as mb,XR as nb,ZR as ob,QR as pb,ex as qb,tx as rb,nx as sb,ox as tb,rx as ub,ix as vb,ax as wb,sx as xb,cx as yb,lx as zb,dx as Ab,mx as Bb,px as Cb,ux as Db,fx as Eb,_x as Fb,hx as Gb,gx as Hb,yx as Ib,bx as Jb,wx as Kb,vx as Lb,kx as Mb,Sx as Nb,Ix as Ob,Ax as Pb,Ex as Qb,Tx as Rb,Cx as Sb,Rx as Tb,xx as Ub,Ox as Vb,$x as Wb,Fx as Xb,Px as Yb,Lx as Zb,Nx as _b,Dx as $b,Mx as ac,jx as bc,Gx as cc,Ux as dc,qx as ec,zx as fc,Hx as gc,Wx as hc,Bx as ic,Vx as jc,Kx as kc,Jx as lc,Yx as mc,Xx as nc,Zx as oc,Qx as pc,e0 as qc,t0 as rc,n0 as sc,o0 as tc,r0 as uc,i0 as vc,a0 as wc,qy as xc,Ky as yc,s0 as zc};
|
|
2287
|
-
//# sourceMappingURL=chunk-
|
|
2286
|
+
`);let i=[];if(e.mode!=="keyword")try{M(e.progressEnabled,"writing vectorization status ledger"),await ws(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(a){i.push(`search_vectorization_status_ledger_write_failed:${a instanceof Error?a.message:String(a)}`)}return i}async function Gy(e,t){let n=by(e.mode),o=yy(e),r=e.full===!0;M(o,`start mode=${n}`);let i=A(process.cwd(),t.path);await P(i);let a=ts(await E(i)).settings,s=null;try{s=await Le(i,ns,a.locks.ttl_seconds,C(void 0,"pm-reindex"),!1,a.governance.force_required_for_stale_lock,a.locks.wait_ms)}catch(c){throw c instanceof p&&c.exitCode===u.CONFLICT?new p("Another pm reindex run is already active for this project. Wait for it to finish before starting a new keyword, semantic, or hybrid reindex.",u.CONFLICT,{code:"reindex_already_running",type:"urn:pm-cli:error:reindex_already_running",why:"Semantic reindex can be expensive and duplicate runs compete for the same local embedding model and vector store.",nextSteps:["Check active pm reindex processes before starting another reindex.","Rerun with --progress when you need non-interactive visibility."]}):c}try{let c=ky(a),l=Sy(a),d=Ry({requestedMode:n,pmRoot:i,settings:a,extensionEmbedding:c,extensionVectorAdapter:l}),m=n;M(o,"loading item corpus");let f=await xy({pmRoot:i,settings:a}),y=f.warnings,{documentCandidates:g,metadataDocuments:k}=f;M(o,`loaded_items=${k.length}`);let b=S(),v=Cy(m,b,k),h=on.join(i,Ci),I=on.join(i,Ri),L=m==="keyword"?await Oi(i,g,a.schema,y):k,O=[],W={},$=null,R=Ty(m);if(m==="keyword"&&await Oy({pmRoot:i,settings:a,forceFullSemantic:r,extensionEmbedding:c,reindexWarnings:y}),m!=="keyword"){let te=await My({pmRoot:i,settings:a,requestedMode:n,activeEmbeddingProvider:d.activeEmbeddingProvider,activeVectorStore:d.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:l,documentCandidates:g,metadataDocuments:k,documentsForKeywordArtifacts:L,forceFullSemantic:r,reindexWarnings:y,semanticWarnings:O,semanticSummary:R,progressEnabled:o});L=te.documentsForKeywordArtifacts,W=te.vectorizationLedgerEntries,$=te.vectorizationEmbeddingMetadata}let re=await jy({pmRoot:i,mode:m,manifest:v,documentsForKeywordArtifacts:L,settings:a,vectorizationLedgerEntries:W,vectorizationEmbeddingMetadata:$,progressEnabled:o}),Tt=[...await G({path:h,scope:"project",op:"reindex:manifest"}),...await G({path:I,scope:"project",op:"reindex:embeddings"}),...await ja({mode:m,total_items:k.length})];return M(o,"done"),{ok:!0,mode:m,total_items:k.length,semantic:R,artifacts:{manifest:Ci,embeddings:Ri},warnings:[...y,...O,...re,...Tt],generated_at:b}}finally{await s?.()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="21f305ed-dd88-5b62-8cfa-b55e1b3f01dd")}catch{}})();var rn=Symbol("pm.active-extension-host-context");function Q(e){return{fullChangedFields:!0,options:e}}var w=class e{defaults;constructor(t={}){this.defaults={...t.pmRoot===void 0?{}:{path:t.pmRoot},...t.cwd===void 0?{}:{cwd:t.cwd},...t.author===void 0?{}:{author:t.author},...t.noExtensions===void 0?{}:{noExtensions:t.noExtensions}}}static forActiveExtensionHost(t){let n=new e({...t,noExtensions:!0});return n.defaults[rn]=!0,n}run(t,n={}){return Ky({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}async withItemTransactionContext(t,n=!1){let o=A(this.defaults.cwd??process.cwd(),this.defaults.path),r=async()=>{let a=await Mt(o,()=>E(o));return t({pmRoot:o,author:C(this.defaults.author,a.author_default)})};if(this.defaults[rn]===!0||wo.getStore()===!0)return r();let i=()=>qy({...this.defaults,path:o},r);return n?Mt(o,i):i()}previewItemMutations(t){return this.withItemTransactionContext(async n=>(await import("./item-transaction-E2ST3A3X.js")).previewItemMutations({...t,...n}),!0)}commitItemMutations(t){return this.withItemTransactionContext(async n=>(await import("./item-transaction-E2ST3A3X.js")).commitItemMutations({...t,...n}))}get itemTransactions(){let t=(n,o)=>this.withItemTransactionContext(async r=>(await import("./item-transaction-E2ST3A3X.js")).abandonItemTransaction({...o,...r,transactionId:n}));return{status:n=>this.withItemTransactionContext(async o=>(await import("./item-transaction-E2ST3A3X.js")).readItemTransaction(o.pmRoot,n),!0),abandon:t,supersede:(n,o,r)=>t(n,{...r,supersededBy:o})}}readItemRevision(t){return this.withItemTransactionContext(async({pmRoot:n})=>(await import("./item-revision-BV5BUBCR.js")).readItemRevision(t,{pmRoot:n}))}async withExpectedItemRevisions(t,n){let o=await import("./item-revision-BV5BUBCR.js"),r="",i=await this.withItemTransactionContext(({pmRoot:s})=>(r=s,o.bindExpectedItemRevisions(t,{pmRoot:s}))),a=this.defaults.noExtensions===!0&&this.defaults[rn]!==!0;return o.runWithBoundItemRevisionScope(i,n,{scopeArgs:["--pm-path",r,...a?["--no-extensions"]:[]]})}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return yd(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return Zn(await this.list(Rr(t)),t)}search(t,n={}){return this.runTyped("search",{query:t,options:n})}get(t,n={}){return this.runTyped("get",{id:t,options:n})}next(t={}){return this.runTyped("next",{options:t})}aggregate(t={}){return this.runTyped("aggregate",{options:t})}stats(t={}){return this.runTyped("stats",{options:t})}duplicates(t={}){return this.runTyped("duplicates",{options:t})}comments(t,n={}){return this.runTyped("comments",{id:t,options:n})}notes(t,n={}){return this.runTyped("notes",{id:t,options:n})}learnings(t,n={}){return this.runTyped("learnings",{id:t,options:n})}files(t,n={}){return this.runTyped("files",{id:t,options:n})}filesDiscover(t,n={}){return this.runTyped("files-discover",{id:t,options:n})}filesLookup(t){return this.runTyped("files-lookup",{options:t})}docs(t,n={}){return this.runTyped("docs",{id:t,options:n})}deps(t,n={}){return this.runTyped("deps",{id:t,options:n})}graph(t,n={},o={}){return this.runTyped("graph",{subcommand:t,...n,options:o})}async append(t,n,o={}){return _c(o,"append"),await this.runTyped("append",{id:t,...Q(it(o,{body:n}))})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,r,i={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...r===void 0?{}:{value:r},options:i})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}workflowPolicy(t,n,o={}){return this.runTyped("schema",{name:n,options:{...o,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){let{type:o,...r}=n;return this.runTyped("schema",{name:t,options:{...r,fieldType:o,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,r){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...r?{fieldTypeScope:r}:{}}})}schemaRemapStatus(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"remap-status",to:n}})}schemaShowStatus(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-status"}})}profile(t,n={}){return this.runTyped("profile",{options:{...n,subcommand:t}})}profileList(){return this.runTyped("profile",{options:{subcommand:"list"}})}profileShow(t){return this.runTyped("profile",{name:t,options:{subcommand:"show"}})}profileApply(t,n={}){return this.runTyped("profile",{name:t,options:{...n,subcommand:"apply"}})}profileLint(t){return this.runTyped("profile",{name:t,options:{subcommand:"lint"}})}validate(t={}){return this.runTyped("validate",{options:t})}health(t={}){return this.runTyped("health",{options:t})}gc(t={}){return this.runTyped("gc",{options:t})}assurance(t){return this.runTyped("assurance",{options:{...t,subcommand:t.action}})}historyRedact(t,n){return this.runTyped("history-redact",{id:t,options:n})}historyRepair(t,n={}){return this.runTyped("history-repair",{id:t,options:n})}historyRepairAll(t={}){return this.runTyped("history-repair",{options:{...t,all:!0}})}historyAttest(t={}){return this.runTyped("history-attest",{options:t})}historyCompact(t,n={}){return this.runTyped("history-compact",{id:t,options:n})}historyCompactBulk(t){return this.runTyped("history-compact",{options:t})}historyAuthorAcknowledge(t){return this.runTyped("history-author-acknowledge",{historyEvent:(t.events??[]).map(n=>`${n.item_id}:${String(n.line)}`),allActionable:t.all_actionable===!0,dryRun:t.dry_run===!0,planFingerprint:t.plan_fingerprint,limit:t.coordinate_limit,attributedAuthor:t.attributed_author,reviewer:t.reviewer,reason:t.reason})}plan(t,n,o={},r,i){return this.runTyped("plan",{fullChangedFields:!0,...n===void 0?{}:{id:n},...r===void 0?{}:{stepRef:r},...i===void 0?{}:{reorderTo:i},options:it(o,{subcommand:t})})}planCreate(t){return this.plan("create",void 0,t)}planShow(t,n={}){return this.plan("show",t,n)}planAddStep(t,n){return this.plan("add-step",t,n)}planUpdateStep(t,n,o){return this.plan("update-step",t,o,n)}planCompleteStep(t,n,o={}){return this.plan("complete-step",t,o,n)}planBlockStep(t,n,o){return this.plan("block-step",t,o,n)}planReorderStep(t,n,o,r={}){return this.plan("reorder-step",t,r,n,o)}planRemoveStep(t,n,o={}){return this.plan("remove-step",t,o,n)}planLink(t,n,o){return this.plan("link",t,o,n)}planUnlink(t,n,o){return this.plan("unlink",t,o,n)}planDecision(t,n){return this.plan("decision",t,n)}planDiscovery(t,n){return this.plan("discovery",t,n)}planValidation(t,n){return this.plan("validation",t,n)}planResume(t,n){return this.plan("resume",t,n)}planApprove(t,n={}){return this.plan("approve",t,n)}planMaterialize(t,n){return this.plan("materialize",t,n)}create(t={}){return this.runTyped("create",Q(t))}update(t,n={}){return this.runTyped("update",{id:t,...Q(n)})}reopen(t,n,o={}){return this.runTyped("item-reopen",{id:t,reason:n,fullChangedFields:!0,options:o})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...Q(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...Q(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...Q(t)})}release(t,n={}){return this.runTyped("release",{id:t,...Q(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...Q(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...Q(n)})}restore(t,n,o={}){return this.runTyped("restore",{fullChangedFields:!0,id:t,options:{...o,target:n}})}focus(t,n={}){return this.runTyped("focus",{...t===void 0?{}:{id:t},...Q(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...Q(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...Q(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...Q(o)})}extension(t,n={}){return this.runTyped("extension",{...t===void 0?{}:{target:t},options:n})}extensionList(t={}){return this.extension("list",t)}extensionActivate(t,n={}){return this.runTyped("extension-activate",{target:t,options:n})}extensionDeactivate(t,n={}){return this.runTyped("extension-deactivate",{target:t,options:n})}package(t,n={}){return this.runTyped("package",{...t===void 0?{}:{target:t},options:{...n,vocabulary:"package"}})}packageList(t={}){return this.package("list",t)}packageInstall(t,n={}){return this.runTyped("package-install",{target:t,options:n})}packageUninstall(t,n={}){return this.runTyped("package-uninstall",{target:t,options:n})}packageDoctor(t={}){return this.runTyped("package-doctor",{options:t})}packageManage(t,n={}){return this.runTyped("package-manage",{...t===void 0?{}:{target:t},options:n})}packageDescribe(t,n={}){return this.runTyped("package-describe",{...t===void 0?{}:{target:t},options:n})}packageReload(t={}){return this.runTyped("package-reload",{options:t})}packageCatalog(t={}){return this.runTyped("package-catalog",{options:t})}packageActivate(t,n={}){return this.runTyped("package-activate",{target:t,options:n})}packageDeactivate(t,n={}){return this.runTyped("package-deactivate",{target:t,options:n})}packageMigrate(t={}){return this.package(void 0,{...t,migrate:!0})}upgrade(t,n={}){return this.runTyped("upgrade",{...t===void 0?{}:{target:t},options:n})}};function FR(e={},t={}){return new w(t).context(e)}function PR(e={},t={}){return new w(t).list(e)}function LR(e={},t={}){return new w(t).listAllComplete(e)}function NR(e,t={},n={}){return new w(n).search(e,t)}function DR(e,t={},n={}){return new w(n).get(e,t)}function MR(e={},t={}){return new w(t).next(e)}function jR(e={},t={}){return new w(t).aggregate(e)}function GR(e={},t={}){return new w(t).stats(e)}function UR(e={},t={}){return new w(t).duplicates(e)}function qR(e,t={},n={}){return new w(n).comments(e,t)}function zR(e,t={},n={}){return new w(n).notes(e,t)}function HR(e,t={},n={}){return new w(n).learnings(e,t)}function WR(e,t={},n={}){return new w(n).files(e,t)}function BR(e,t={},n={}){return new w(n).filesDiscover(e,t)}function VR(e,t={}){return new w(t).filesLookup(e)}function KR(e,t={},n={}){return new w(n).docs(e,t)}function JR(e,t={},n={}){return new w(n).deps(e,t)}function YR(e,t={},n={},o={}){return new w(o).graph(e,t,n)}function XR(e,t,n={},o={}){return new w(o).append(e,t,n)}function ZR(e,t={},n={}){return new w(n).init(e,t)}function QR(e,t,n,o,r={},i={}){return new w(i).config(e,t,n,o,r)}function ex(e,t={},n={}){return new w(n).schema(e,t)}function tx(e={}){return new w(e).schemaList()}function nx(e,t={}){return new w(t).schemaShow(e)}function ox(e,t={},n={}){return new w(n).schemaAddType(e,t)}function rx(e,t={},n={}){return new w(n).schemaRemoveType(e,t)}function ix(e,t={},n={}){return new w(n).schemaAddStatus(e,t)}function ax(e,t={},n={}){return new w(n).schemaRemoveStatus(e,t)}function sx(e,t={},n={}){return new w(n).schemaAddField(e,t)}function cx(e,t={},n={}){return new w(n).schemaRemoveField(e,t)}function lx(e={}){return new w(e).schemaListFields()}function dx(e,t={}){return new w(t).schemaShowField(e)}function mx(e,t={},n={}){return new w(n).schemaApplyPreset(e,t)}function px(e={},t={}){return new w(t).schemaInferTypes(e)}function ux(e,t,n,o={}){return new w(o).schemaRenameType(e,t,n)}function fx(e,t,n,o,r={}){return new w(r).schemaRenameField(e,t,n,o)}function _x(e,t,n,o={}){return new w(o).schemaRemapStatus(e,t,n)}function hx(e,t={}){return new w(t).schemaShowStatus(e)}function gx(e,t={},n={}){return new w(n).profile(e,t)}function yx(e={}){return new w(e).profileList()}function bx(e,t={}){return new w(t).profileShow(e)}function wx(e,t={},n={}){return new w(n).profileApply(e,t)}function vx(e,t={}){return new w(t).profileLint(e)}function kx(e={},t={}){return new w(t).validate(e)}function Sx(e={},t={}){return new w(t).health(e)}function Ix(e={},t={}){return new w(t).gc(e)}function Ax(e,t,n={}){return new w(n).historyRedact(e,t)}function Ex(e,t={},n={}){return new w(n).historyRepair(e,t)}function Tx(e={},t={}){return new w(t).historyRepairAll(e)}function Cx(e,t={},n={}){return new w(n).historyCompact(e,t)}function Rx(e,t={}){return new w(t).historyCompactBulk(e)}function xx(e={},t={}){return new w(t).create(e)}function Ox(e,t={},n={}){return new w(n).update(e,t)}function $x(e,t,n={},o={}){return new w(o).reopen(e,t,n)}function Fx(e,t,n={},o={}){return new w(o).close(e,t,n)}function Px(e,t={},n={}){return new w(n).claim(e,t)}function Lx(e={},t={}){return new w(t).claimNext(e)}function Nx(e,t={},n={}){return new w(n).release(e,t)}function Dx(e,t={},n={}){return new w(n).copy(e,t)}function Mx(e,t={},n={}){return new w(n).delete(e,t)}function jx(e,t,n={},o={}){return new w(o).restore(e,t,n)}function Gx(e,t={},n={}){return new w(n).focus(e,t)}function Ux(e,t={},n={}){return new w(n).startTask(e,t)}function qx(e,t={},n={}){return new w(n).pauseTask(e,t)}function zx(e,t,n={},o={}){return new w(o).closeTask(e,t,n)}function Hx(e,t={},n={}){return new w(n).extension(e,t)}function Wx(e={},t={}){return new w(t).extensionList(e)}function Bx(e,t={},n={}){return new w(n).extensionActivate(e,t)}function Vx(e,t={},n={}){return new w(n).extensionDeactivate(e,t)}function Kx(e,t={},n={}){return new w(n).package(e,t)}function Jx(e={},t={}){return new w(t).packageList(e)}function Yx(e,t={},n={}){return new w(n).packageInstall(e,t)}function Xx(e,t={},n={}){return new w(n).packageUninstall(e,t)}function Zx(e={},t={}){return new w(t).packageDoctor(e)}function Qx(e,t={},n={}){return new w(n).packageManage(e,t)}function e0(e,t={},n={}){return new w(n).packageDescribe(e,t)}function t0(e={},t={}){return new w(t).packageReload(e)}function n0(e={},t={}){return new w(t).packageCatalog(e)}function o0(e,t={},n={}){return new w(n).packageActivate(e,t)}function r0(e,t={},n={}){return new w(n).packageDeactivate(e,t)}function i0(e,t={},n={}){return new w(n).upgrade(e,t)}async function a0(e,t={}){let n=typeof e=="string"?{...t,pmRoot:e}:e??t,o={json:!0,quiet:n.quiet??!0,noExtensions:n.noExtensions??!1,noPager:!0,profile:n.profile??!1,path:n.pmRoot};return Nn(n,o)}var ru=Na(),wo=new Uy;function bo(){Po(Ra()),Lo(xa()),No(Oa()),Do($a()),Mo(Fa()),jo(Pa()),Go(La())}async function su(e,t,n,o){return Fo(()=>t===void 0?ru.read(()=>iu(e,n,o)):ru.write(()=>Wy(t,()=>iu(e,n,o))))}async function qy(e,t){let n=e.cwd;if(wo.getStore()===!0&&n===void 0&&e.noExtensions===!0){let r=A(process.cwd(),e.path);return Fo(()=>Vn({pmRoot:r},t))}let o=n??process.cwd();return su($n({path:e.path,noExtensions:e.noExtensions}),n,o,()=>wo.run(!0,t))}function zy(e){try{let t=e instanceof Error?e.stack:void 0,n=typeof t=="string"?t:ks(e);return typeof n=="string"?n:"Unknown failure"}catch{return"Unknown failure"}}async function iu(e,t,n){let o=A(t,e.path);if(e.noExtensions)return bo(),Vn({pmRoot:o},()=>n(null));if(!await ve(ke(o)))return bo(),n(null);let r=null,i;try{let a=await E(o),s=await gn({pmRoot:o,settings:a,cwd:t,noExtensions:!1}),c=await bn({...s,loaded:s.loaded});i={loadResult:s,activationResult:c},Po(c.hooks),Lo(c.commands),No(c.parsers),Do(c.preflight),Mo(c.services),jo(c.renderers),Go(c.registrations),r={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:s.loaded}}catch(a){bo(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",zy(a))}try{return await Vn({pmRoot:o,packages:r?.packages},()=>n(r))}finally{bo(),i&&await yn(i.loadResult,i.activationResult).catch(()=>{})}}function cu(e,t){let n=De(e);return t?.registrations.commands.find(o=>De(o.action)===n)?.command??t?.commands.handlers.find(o=>De(o.command)===n)?.command}async function Hy(e,t,n,o,r){if(!r)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let i=cu(e,r);if(!i)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let a=typeof n.author=="string"?n.author:o.author,s=or(i),c=xc(rr(t,n),Rc(r.registrations,s),s,hd(s)),l=await Ga({command:s,args:U(n.args??t.args),options:c,global:{...o,author:a},pm_root:r.pmRoot,sdk:_d(r.pmRoot,w.forActiveExtensionHost({pmRoot:r.pmRoot,author:a}),a,s)});if(!l.handled){if(Object.hasOwn(l,"cause"))throw vs(i,l);let d=l.warnings.length>0?` (${l.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${d}`,u.USAGE)}return l.result}async function Wy(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}function By(e){let t=K(e,"action"),n=De(t),o=ye(xr,n),r=o?.action??n,i={...e,action:r};return o?.options!==void 0&&(i.options={...o.options,...$t(e.options)}),r==="package"&&(i.options={...$t(i.options),vocabulary:"package"}),{action:r,args:i}}function Vy(e,t,n,o){let r=e[rn]===!0,i=t.noExtensions===!0&&!r?["--no-extensions"]:[];if(n!==void 0)return["--pm-path",A(o,t.path),...i];let a=ta(t,o);return[...t.noExtensions===!0?a.slice(0,-1):a,...i]}async function Ky(e){let t=By(e),n=$n(t.args);ea(n);let o=Ic(t.action),r=_(t.args,"cwd"),i=r??process.cwd();t.action==="init"&&(n[rl]=i),(t.action!=="init"||n.path!==void 0||(process.env.PM_PATH?.trim().length??0)>0)&&(n.path=A(i,n.path));let{expectHash:a,dispatchArgs:s}=Cc(t.args),c=async l=>{if(a===void 0)return au(t.action,s,n,l);let{dispatchWithExpectedItemRevisions:d}=await import("./item-revision-BV5BUBCR.js");return d({action:t.action,expectHash:a,defaultId:_(s,"id")??_($t(s.options),"id"),options:$t(s.options),background:s.background,pmRoot:A(i,n.path),invocation:{scopeArgs:Vy(e,n,r,i),...n.outputFormat===void 0?{}:{outputArgs:["--output-format",n.outputFormat]}},run:()=>au(t.action,s,n,l)})};try{return t.action==="history-attest"?await c(null):e[rn]===!0||wo.getStore()===!0?await c(null):await su(n,r,i,l=>c(l))}finally{o&&fi()}}function s0(e=Ui){return e.map(t=>{let n=De(t),o=ye(xr,n),r=o?.action??n,i=ye(ui,r)!==void 0;return{action:t,resolved_action:r,covered:i,route:i?o?"alias":"native":"missing"}})}async function au(e,t,n,o){let r=ye(ui,e),i=nr(t,e,{nativeAction:r!==void 0});if(e==="create"||e==="update"){let{assertNativeMutationOptions:d}=await import("./mutation-admission-5AWMXMCB.js");await d(e,t,i,n.path,kc[e])}let a=r?void 0:cu(e,o),s=a===void 0?e:`extension:${a}`;wa(s,i),va(s,i);let c={action:e,args:t,options:i,id:_(t,"id"),force:t.force===!0||i.force===!0,global:n,activeExtensions:o},l=r?await r(c):await Hy(e,t,i,n,o);if(e==="history-attest")return l;{let d=Ta(s,i,l);return await ld(A(process.cwd(),n.path),d),d}}var Jy={closeManyOptionsFromFlat:Pn,extensionOptionsFromArgs:rr,globalOptions:$n,mutationListOptions:Ac,normalizeActionName:De,normalizeCommandPath:or,normalizeMcpUpdateOptions:Tc,normalizeMcpOptionsArrays:Sc,optionsWithAuthor:nr,readRequiredString:K,readScalarString:bc,readScalarStringAllowBlank:wc,readStringArray:U,updateManyOptionsFromFlat:Ln,withAddNoteOption:zt,withFilesDiscoveryOptions:Fn,withMutationCompaction:j};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=Jy);export{Sr as a,cd as b,uu as c,_u as d,hu as e,Vn as f,Vt as g,md as h,Jt as i,Yn as j,_d as k,vd as l,Id as m,em as n,hd as o,Tu as p,Xn as q,Rr as r,gd as s,Zn as t,Lu as u,Ed as v,xd as w,Pr as x,Lr as y,Nr as z,Dr as A,ff as B,zr as C,Vd as D,Zd as E,mt as F,ti as G,z_ as H,Bv as I,Vv as J,ri as K,nm as L,lk as M,dk as N,rm as O,sm as P,xk as Q,ah as R,mi as S,ch as T,lh as U,wm as V,vm as W,km as X,Sm as Y,Im as Z,tS as _,nS as $,oS as aa,rS as ba,Am as ca,Cm as da,so as ea,Fm as fa,Pm as ga,Lm as ha,K as ia,fi as ja,FA as ka,PA as la,LA as ma,NA as na,DA as oa,Bm as pa,MA as qa,pg as ra,_g as sa,bg as ta,wg as ua,vg as va,z as wa,kg as xa,Sg as ya,Ig as za,Ag as Aa,hi as Ba,Ym as Ca,ft as Da,_i as Ea,Xm as Fa,Eg as Ga,Zm as Ha,Tg as Ia,Cg as Ja,Rg as Ka,xg as La,Og as Ma,$g as Na,jg as Oa,np as Pa,Ug as Qa,Kg as Ra,ty as Sa,oy as Ta,_y as Ua,Gy as Va,w as Wa,FR as Xa,PR as Ya,LR as Za,NR as _a,DR as $a,MR as ab,jR as bb,GR as cb,UR as db,qR as eb,zR as fb,HR as gb,WR as hb,BR as ib,VR as jb,KR as kb,JR as lb,YR as mb,XR as nb,ZR as ob,QR as pb,ex as qb,tx as rb,nx as sb,ox as tb,rx as ub,ix as vb,ax as wb,sx as xb,cx as yb,lx as zb,dx as Ab,mx as Bb,px as Cb,ux as Db,fx as Eb,_x as Fb,hx as Gb,gx as Hb,yx as Ib,bx as Jb,wx as Kb,vx as Lb,kx as Mb,Sx as Nb,Ix as Ob,Ax as Pb,Ex as Qb,Tx as Rb,Cx as Sb,Rx as Tb,xx as Ub,Ox as Vb,$x as Wb,Fx as Xb,Px as Yb,Lx as Zb,Nx as _b,Dx as $b,Mx as ac,jx as bc,Gx as cc,Ux as dc,qx as ec,zx as fc,Hx as gc,Wx as hc,Bx as ic,Vx as jc,Kx as kc,Jx as lc,Yx as mc,Xx as nc,Zx as oc,Qx as pc,e0 as qc,t0 as rc,n0 as sc,o0 as tc,r0 as uc,i0 as vc,a0 as wc,qy as xc,Ky as yc,s0 as zc};
|
|
2287
|
+
//# sourceMappingURL=chunk-S3RMFLEG.js.map
|