@unbrained/pm-cli 2026.8.18 → 2026.8.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +2 -2
- package/CHANGELOG.md +16 -2
- package/dist/cli/error-guidance.js +3 -2
- package/dist/cli/help-content.js +32 -13
- package/dist/cli/help-json-payload.d.ts +15 -0
- package/dist/cli/help-json-payload.js +101 -23
- package/dist/cli/main.js +6 -2
- package/dist/cli/register-list-query.js +8 -5
- package/dist/cli/register-mutation.js +8 -8
- package/dist/cli/register-operations.js +6 -6
- package/dist/cli-bundle/bundle-manifest.json +139 -139
- package/dist/cli-bundle/chunks/chunk-4NRRH7AM.js +2 -0
- package/dist/cli-bundle/chunks/{chunk-UYCLQVL2.js → chunk-4THEB6PD.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-BSK2IN3C.js → chunk-BHYMXLAE.js} +2 -2
- package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +197 -0
- package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +35 -0
- package/dist/cli-bundle/chunks/chunk-OI4XI562.js +5 -0
- package/dist/cli-bundle/chunks/{chunk-YRGOLZA7.js → chunk-OIOKV6NO.js} +3 -3
- package/dist/cli-bundle/chunks/{chunk-5UZZAJKR.js → chunk-QXSH7BLM.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-RZQTVMRQ.js → chunk-TOXJM4WA.js} +2 -2
- package/dist/cli-bundle/chunks/{chunk-GNFAFIJI.js → chunk-YBMRWW4E.js} +44 -44
- package/dist/cli-bundle/chunks/{register-list-query-I23LALEE.js → register-list-query-Y56KINDU.js} +11 -11
- package/dist/cli-bundle/chunks/register-mutation-AUWVCW4M.js +20 -0
- package/dist/cli-bundle/chunks/register-operations-PZQPHXW5.js +2 -0
- package/dist/cli-bundle/chunks/{register-setup-PPPEF3SN.js → register-setup-I4LUHGVW.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-5AF3ZBNB.js → chunk-34QBIYZI.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-V5XTGLK7.js → chunk-BJRYFVSH.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-DKPLYW3L.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-ODOVCP45.js → chunk-EF6ZS5GH.js} +44 -44
- package/dist/cli-bundle/focused-chunks/{chunk-EX6MKP2X.js → chunk-ESISGDAY.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-EUEGXZ2A.js → chunk-EXBCLIBU.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-UI6AJ5TD.js → chunk-JDOMQ7VQ.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-MCZXYZAF.js +2 -0
- package/dist/cli-bundle/focused-chunks/chunk-ODHQEECS.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-3TKWMNKF.js → chunk-PRHY2IMX.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-M62NO7EI.js → chunk-US7VEYZG.js} +2 -2
- package/dist/cli-bundle/focused-chunks/{chunk-TN4AE665.js → chunk-VXDSU5MC.js} +2 -2
- package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +16 -0
- package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +2 -0
- package/dist/cli-bundle/focused-chunks/{chunk-K43KKAFS.js → chunk-ZBIQQYMI.js} +2 -2
- package/dist/cli-bundle/main.js +13 -13
- package/dist/cli-bundle/sdk-authoring.js +1 -1
- package/dist/cli-bundle/sdk-contracts.js +2 -1
- package/dist/cli-bundle/sdk-core.js +31 -31
- package/dist/cli-bundle/sdk-governance.js +1 -1
- package/dist/cli-bundle/sdk-graph.js +1 -1
- package/dist/cli-bundle/sdk-merge.js +32 -32
- 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 +5 -4
- package/dist/core/shared/errors.d.ts +2 -0
- package/dist/core/shared/errors.js +2 -2
- package/dist/sdk/agent/refusal-closure.d.ts +41 -0
- package/dist/sdk/agent/refusal-closure.js +92 -0
- package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
- package/dist/sdk/agent-capability-contracts.d.ts +13 -0
- package/dist/sdk/agent-capability-contracts.js +104 -7
- package/dist/sdk/cli-contracts/command-aliases.js +18 -2
- package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
- package/dist/sdk/cli-contracts/commander-types.js +5 -4
- package/dist/sdk/cli-contracts/flag-contracts.d.ts +5 -0
- package/dist/sdk/cli-contracts/flag-contracts.js +75 -8
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +55 -0
- package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +240 -0
- package/dist/sdk/cli-contracts/grammar-contracts.d.ts +81 -0
- package/dist/sdk/cli-contracts/grammar-contracts.js +615 -2
- package/dist/sdk/cli-contracts/runtime-contracts.d.ts +15 -4
- package/dist/sdk/cli-contracts/runtime-contracts.js +42 -12
- package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
- package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
- package/dist/sdk/cli-contracts.d.ts +3 -2
- package/dist/sdk/cli-contracts.js +5 -4
- package/dist/sdk/context-intent-contracts.d.ts +2 -2
- package/dist/sdk/context-intent-contracts.js +22 -7
- package/dist/sdk/contracts.d.ts +2 -0
- package/dist/sdk/contracts.js +4 -2
- package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
- package/dist/sdk/flag-invocation-contracts.js +218 -9
- package/dist/sdk/generated/generated-error-code-catalog-part-1.js +134 -2
- package/dist/sdk/generated/generated-error-code-catalog-part-2.js +154 -22
- package/dist/sdk/index.d.ts +7 -5
- package/dist/sdk/index.js +7 -5
- package/dist/sdk/output-projection.d.ts +2 -0
- package/dist/sdk/output-projection.js +11 -5
- package/dist/sdk/query/get.js +25 -6
- package/dist/sdk/query/list.js +16 -2
- package/dist/sdk/query/search-contracts.d.ts +1 -1
- package/dist/sdk/query/search-contracts.js +23 -9
- package/dist/sdk/query/search.js +3 -3
- package/dist/sdk/read-output/continuation.d.ts +1 -1
- package/dist/sdk/read-output/continuation.js +7 -24
- package/dist/sdk/read-output-contracts.js +55 -6
- package/dist/sdk/read-output-rows.d.ts +4 -0
- package/dist/sdk/read-output-rows.js +47 -18
- package/dist/sdk/runtime.js +9 -5
- package/dist/sdk/workspace-snapshot.d.ts +2 -0
- package/dist/sdk/workspace-snapshot.js +10 -2
- package/docs/COMMANDS.md +16 -4
- package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
- package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
- package/docs/SDK.md +6 -0
- package/docs/TESTING.md +14 -1
- package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
- package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
- package/marketplace.json +2 -2
- package/package.json +5 -3
- package/packages/pm-beads/package.json +1 -1
- package/packages/pm-calendar/package.json +1 -1
- package/packages/pm-command-kit/package.json +1 -1
- package/packages/pm-digital-twin/package.json +1 -1
- package/packages/pm-governance-audit/package.json +1 -1
- package/packages/pm-guide-shell/package.json +1 -1
- package/packages/pm-kanban/package.json +1 -1
- package/packages/pm-lifecycle-hooks/package.json +1 -1
- package/packages/pm-linked-test-adapters/package.json +1 -1
- package/packages/pm-search-advanced/package.json +1 -1
- package/packages/pm-templates/package.json +1 -1
- package/packages/pm-todos/package.json +1 -1
- package/packages/pm-vcs/package.json +1 -1
- package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
- package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
- package/scripts/generate-agent-capability-surfaces.mjs +20 -14
- package/sdk/public-surface.json +576 -12
- package/dist/cli-bundle/chunks/chunk-ALDJGKAK.js +0 -2
- package/dist/cli-bundle/chunks/chunk-DY4DMUMC.js +0 -197
- package/dist/cli-bundle/chunks/chunk-L5Q2CLPE.js +0 -35
- package/dist/cli-bundle/chunks/chunk-PVRUN5ZS.js +0 -5
- package/dist/cli-bundle/chunks/register-mutation-6YGU3GPH.js +0 -20
- package/dist/cli-bundle/chunks/register-operations-4HTFC6J7.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-2PN4TJXH.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-C5IW2NDA.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-RNDNMARJ.js +0 -16
- package/dist/cli-bundle/focused-chunks/chunk-TVV2DONO.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-WGHQVU6P.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-XYNBXTDQ.js +0 -2
- package/dist/cli-bundle/focused-chunks/chunk-Z56ECT7I.js +0 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{$a as Ae,Ha as K,Ia as zt,Ja as $t,Jb as tn,Ka as Kt,La as Bt,Ma as Vt,Nb as nn,Pa as Qt,Qa as Yt,Sa as Xt,Ta as Jt,Za as Zt,_a as ke,ab as oe,k as Pt,l as Ot,q as jt,u as Nt,vb as en,w as Ht,y as Ut,ya as Wt,z as Gt}from"./chunk-4THEB6PD.js";import{$a as X,$h as ie,Bh as I,C as m,Dh as xt,Dl as Dt,E as p,F as W,G as he,I as Y,Ic as we,Ig as vt,J as tt,Ki as U,Na as j,Ph as kt,Q as P,Qc as ot,Qh as ne,Rh as re,Sh as At,T as nt,Th as Ft,U as rt,Uc as st,V as ge,Va as x,Vc as at,Wh as Mt,Wi as qt,Xa as it,Xd as lt,Ya as T,Yd as $,Za as _e,_h as Rt,ai as Ct,bi as ve,c as F,cd as N,ch as ee,ci as Ee,da as ye,de as J,di as Se,ed as H,ei as Tt,fe as ut,gh as te,ii as It,ji as xe,kg as gt,le as ft,pd as ct,qe as mt,rd as z,re as pt,rg as be,sg as yt,sh as Et,si as Lt,tg as _t,th as St,v as Ze,vd as dt,wg as Z,x as et,xc as M,xe as ht,xg as wt,yg as bt}from"./chunk-GWMXAQOD.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ab1153b1-2d91-58a5-9b4a-1d9c5f35a54a")}catch{}})();var Cr=["status","type","tag","priority","deadlineBefore","deadlineAfter","updatedAfter","updatedBefore","createdAfter","createdBefore","ids","assignee","assigneeFilter","parent","sprint","release"],Tr=["filterAcMissing","filterEstimatesMissing","filterResolutionMissing","filterMetadataMissing","filterReviewerMissing","filterRiskMissing","filterConfidenceMissing","filterSprintMissing","filterReleaseMissing","hasNotes","hasLearnings","hasFiles","hasDocs","hasTests","hasComments","hasDeps","hasBody","hasLinkedCommand","noNotes","noLearnings","noFiles","noDocs","noTests","noComments","noDeps","emptyBody","noLinkedCommand"];function Ir(e){return e!=null&&(typeof e!="string"||e.split(",").some(t=>t.trim().length>0))}function Uo(e,t,n={}){let r=n.includePagination!==!1;return[t,...Cr.map(o=>e?.[o]),...r?[e?.limit,e?.offset]:[]].some(Ir)||Tr.some(o=>e?.[o]===!0)}function rn(e){return{type:e.type,tag:e.tag,priority:e.priority,deadlineBefore:e.deadlineBefore,deadlineAfter:e.deadlineAfter,assignee:e.assignee,assigneeFilter:e.assigneeFilter,parent:e.parent,sprint:e.sprint,release:e.release}}(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]="56486369-9164-58d3-ac34-46d57859f96d")}catch{}})();var on=["parent","type","priority","status","assignee","tags","sprint","release"];function an(e,t){let n=ee(e,t,{strict:!0,flagLabel:"--status"});if(!(!n||n.length===0))return n}function cn(e,t=["estimate","estimated_minutes","priority"]){let n=e.sum?.trim(),r=e.avg?.trim(),i=n&&n.length>0?n:void 0,o=r&&r.length>0?r:void 0;if(!i&&!o)return null;if(i&&o&&i!==o)throw new p("Aggregate --sum and --avg must target the same numeric field",m.USAGE);let s=i??o;if(!t.includes(s))throw new p(`Aggregate numeric field "${s}" is not registered. Allowed: ${t.join(", ")}`,m.USAGE);return{field:s,sum:i!==void 0,avg:o!==void 0}}function dn(e){let t=e?.trim()??"status";if(t.length===0)throw new p("--group-by requires at least one field name",m.USAGE);let n=qt(t);if(n.length===0)throw new p("--group-by requires a comma-separated list of fields",m.USAGE);for(let r of n)if(!on.includes(r))throw new p(`Aggregate group fields must be one of ${on.join("|")}; received "${r}"`,m.USAGE);return n}function ln(e){let t=[...new Set(e.map(n=>n.trim().toLowerCase()).filter(n=>n.length>0))].sort((n,r)=>n.localeCompare(r));return t.length===0?null:t.join(",")}function un(e,t){switch(e){case"parent":return t.parent??null;case"type":return t.type;case"priority":return t.priority;case"status":return t.status;case"assignee":return t.assignee??null;case"tags":return ln(t.tags);case"sprint":return t.sprint??null;case"release":return t.release??null;default:return null}}function fn(e,t){let n=e??null,r=t??null;return n===r?0:n===null?1:r===null?-1:typeof n=="number"&&typeof r=="number"?n-r:String(n).localeCompare(String(r))}function mn(e,t){return e.map(n=>`${n}:${JSON.stringify(t[n]??null)}`).join("|")}var Lr={parent:"(unparented)",type:"(untyped)",priority:"(no priority)",status:"(no status)",assignee:"(unassigned)",tags:"(untagged)",sprint:"(no sprint)",release:"(no release)"};function sn(e,t){return t==null||t===""?Lr[e]:String(t)}function qr(e,t){return e.length===1?sn(e[0],t[e[0]]):e.map(n=>`${n}=${sn(n,t[n])}`).join(" | ")}function pn(e,t,n){for(let r of n){let i=fn(e.group[r],t.group[r]);if(i!==0)return i}return 0}function hn(e,t){let r=e[t];if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"){let i=r.trim();if(i.length===0)return null;let o=Number(i);if(Number.isFinite(o))return o}return null}function gn(e,t){return t<=0?0:Math.round(e/t*1e4)/100}function Fe(e,t,n){let r=ct(String(t),n)??t;if(r===n.open_status){e.open_count+=1;return}if(r==="in_progress"||n.active_statuses.has(r)&&r!==n.open_status){e.in_progress_count+=1;return}if(n.terminal_done_statuses.has(r)||r===n.close_status){e.closed_count+=1;return}e.other_count+=1}function Dr(e,t){return{row:{group:e,count:1},numeric_count:t===null?0:1,numeric_sum:t??0,null_count:t===null?1:0,open_count:0,in_progress_count:0,closed_count:0,other_count:0}}function Pr(e,t){if(t===null){e.null_count+=1;return}e.numeric_count+=1,e.numeric_sum+=t}function Or(e){e.accumulator.row.count+=1,e.includeCompletion&&Fe(e.accumulator,e.item.status,e.statusRegistry),e.numericAggregation!==null&&Pr(e.accumulator,e.numericValue)}function jr(e,t){let n={};for(let r of e)n[r]=un(r,t);return n}function Nr(e,t,n,r){let i={...e.row,group_label:qr(t,e.row.group)};return n&&(i.open=e.open_count,i.in_progress=e.in_progress_count,i.closed=e.closed_count,i.other=e.other_count,i.completion_pct=gn(e.closed_count,e.row.count)),r!==null&&(i.null_count=e.null_count,r.sum&&(i.sum=e.numeric_sum),r.avg&&(i.avg=e.numeric_count===0?null:e.numeric_sum/e.numeric_count)),i}function Hr(e){return{group_by:e.groupBy,count:!0,completion:e.includeCompletion,include_unparented:e.includeUnparented,status:e.status?.[0]??null,status_values:e.status,type:e.options.type??null,tag:e.options.tag??null,priority:e.options.priority??null,deadline_before:e.options.deadlineBefore??null,deadline_after:e.options.deadlineAfter??null,assignee:e.options.assignee??null,assignee_filter:e.options.assigneeFilter??null,parent:e.options.parent??null,sprint:e.options.sprint??null,release:e.options.release??null,...e.numericAggregation!==null?{sum:e.options.sum??null,avg:e.options.avg??null,numeric_field:e.numericAggregation.field}:{}}}async function Ko(e,t){if(e.count===!1)throw new p("Aggregate grouped counts are always enabled; omit count=false.",m.USAGE);let n=x(process.cwd(),t.path),r=await I(n),i=N(r.schema),o=["estimate","estimated_minutes","priority",...H(r.schema).definitions.filter(_=>_.type==="number").map(_=>_.metadata_key)],s=dn(e.groupBy),a=an(e.status,i),d=cn(e,[...new Set(o)].sort((_,w)=>_.localeCompare(w))),c=e.completion===!0,u=e.includeUnparented===!0,l=await oe(void 0,{...rn(e),status:e.status},t),f=new Map,h=0,g=0;for(let _ of l.items){let w=_,D=jr(s,w);if(s.includes("parent")&&D.parent===null&&!u){h+=1;continue}let C=mn(s,D),S=f.get(C),v=d===null?null:hn(w,d.field);if(S)Or({accumulator:S,item:w,statusRegistry:i,includeCompletion:c,numericAggregation:d,numericValue:v});else{let E=Dr(D,v);c&&Fe(E,w.status,i),f.set(C,E)}g+=1}let y=[...f.values()].map(_=>Nr(_,s,c,d)).sort((_,w)=>pn(_,w,s)),b=l.warnings&&l.warnings.length>0?l.warnings:void 0;return{groups:y,count:y.length,totals:{items_considered:l.items.length,items_grouped:g,items_skipped_unparented:h},filters:Hr({groupBy:s,includeCompletion:c,includeUnparented:u,status:a,options:e,numericAggregation:d}),now:P(),...b?{warnings:b}:{}}}var Bo={buildGroupKey:mn,compareAggregateRows:pn,compareNullableGroupValue:fn,completionPct:gn,normalizeTagGroupValue:ln,parseGroupBy:dn,parseNumericAggregation:cn,parseStatus:an,readNumericAggregateValue:hn,resolveGroupValue:un,updateCompletionCounts:Fe};(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]="f18d7526-01eb-593b-bf50-788c08a35e5d")}catch{}})();function Ur(e,t){return t===void 0?e:e.slice(Math.max(0,e.length-t))}function Gr(e,t){return e.map((n,r)=>{let i=new Set,o=gt(n.patch);for(let s of o)i.add(be(s.path)),s.from&&i.add(be(s.from));return{index:t+r+1,ts:n.ts,op:n.op,author:n.author,patch_ops:o.length,changed_fields:[...i].sort((s,a)=>s.localeCompare(a))}})}async function Wr(e,t){let n=x(process.cwd(),t.path);if(!await F(T(n)))throw new p(`Tracker is not initialized at ${n}. Run pm init first.`,m.NOT_FOUND);let r=await I(n),i=j(r,M()),o=e.trim()===Z,s=o?Z:vt(e,r.id_prefix),a=await ne(n,s,r.id_prefix,r.item_format,i.type_to_folder),d=a?.id??s,c=o?wt(n):X(n,d);if(!a&&!await F(c))throw new p(`Item ${e} not found`,m.NOT_FOUND);return a&&await _t({pmRoot:n,settings:r,itemId:a.id,commandLabel:"history"}),{historyPath:c,located:a,resolvedId:d,settings:r}}async function ts(e,t,n){let r=te(t.limit),{historyPath:i,located:o,resolvedId:s,settings:a}=await Wr(e,n),d=await $(i,s),c=a.agent_identity.identity_vocabulary,u=Nt(a.agent_identity.harness_signals),l=Ut({harness:t.harness,agentInstance:t.agentInstance,provenance:t.provenanceFilter},c,u),f=d.map((v,E)=>({entry:v,version:E+1})).filter(({entry:v})=>l(v)),h=Ur(f,r),g=h.map(({entry:v})=>v),y=t.compact===!0,b=y?Gr(g,Math.max(0,d.length-g.length)):void 0,_=t.provenance===!0?h.map(({entry:v,version:E})=>Ht(v,c,{itemId:s,version:E})):void 0,w=t.provenance===!0?"provenance":y?"compact":"full",D={compact:{compact_history:b},provenance:{provenance_history:_},full:{history:g}}[w],S={id:s,...D,compact:y,projection:{mode:w,row_key:{compact:"compact_history",provenance:"provenance_history",full:"history"}[w]},omission_receipt:ft("history",w),count:g.length,limit:r??null,...t.provenanceSummary===!0?{provenance_summary:Gt(f.map(({entry:v})=>v),c,u)}:{}};if((t.diff||t.field!==void 0)&&(S.diff=yt(d,{windowStartIndex:Math.max(0,d.length-g.length),field:t.field})),t.verify){let v=o?(await re(o,{schema:a.schema})).document:void 0;if(S.verification=Pt(d,v),s===Z&&S.verification.ok){let E=await bt(x(process.cwd(),n.path));S.verification={...S.verification,ok:E.ok,errors:E.ok?S.verification.errors:[...S.verification.errors,"verify_failed:workspace_state_mismatch"],workspace_state_matches_latest:E.ok,workspace_state_mismatches:E.mismatched_documents,workspace_state_missing:E.missing_documents,workspace_state_unreadable:E.unreadable_documents}}}return 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]="2e14b978-95c9-5922-b8cb-c49d24e6f8c4")}catch{}})();var yn=1e6,_n=20;function wn(e,t,n,r=_n){if(!Number.isSafeInteger(r)||r<0)throw new p("Child projection sample limit must be a non-negative integer.",m.USAGE);let i=e.trim().toLowerCase(),o={},s=[],a=0,d=0;for(let f of t){if(d+=1,d>yn)throw new p(`Child projection exceeded the ${yn.toLocaleString("en-US")} item safety bound.`,m.GENERIC_FAILURE,{code:"child_projection_item_bound_exceeded",required:"Use an indexed or parent-filtered metadata source.",why:"Unbounded graph scans can exhaust memory in universal project stores.",nextSteps:["Build the derived item index, then retry the parent read."]});if(f.parent?.trim().toLowerCase()!==i)continue;s.push(f);let h=f.status.trim().toLowerCase();o[h]=(o[h]??0)+1,z(h,n)||(a+=1)}s.sort((f,h)=>f.id.localeCompare(h.id));let c=s.slice(0,r).map(f=>({id:f.id,title:f.title,type:f.type,status:f.status,priority:f.priority})),u=s.length>c.length,l=r===0?_n:r;return{count:s.length,active:a,by_status:Object.fromEntries(Object.entries(o).sort(([f],[h])=>f.localeCompare(h))),sample:c,sample_limit:r,truncated:u,next_offset:u?c.length:null,continuation:u?`pm list --status all --parent ${e} --offset ${c.length} --limit ${l}`:null,scanned:d}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="80981c24-3442-57a2-8c35-e0e00d5425d6")}catch{}})();var zr=new Set(["event","meeting","reminder"]);function $r(e){return zr.has(e.type.trim().toLowerCase())||e.deadline!==void 0||(e.reminders?.length??0)>0||(e.events?.length??0)>0}function Me(e){if(!$r(e))return;let t=[...e.events??[]].sort((r,i)=>r.start_at.localeCompare(i.start_at)),n=t[0];return{deadline:e.deadline??null,start_at:n?.start_at??null,end_at:n?.end_at??null,location:n?.location??null,reminders:[...e.reminders??[]],events: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]="1ba3eb17-c44c-5b62-8ae0-c2506fca9c62")}catch{}})();var Br=["brief","standard","deep"],Vr=new Set(["epic","feature","milestone","plan"]),Qr=new Set(Object.keys(Ze).map(e=>e.toLowerCase()));function Ce(e){return Object.fromEntries(["comments","notes","learnings","files","tests","docs","reminders","events"].map(n=>[n,e[n]?.length??0]))}function Yr(e,t){let n=Ce(e);return[...t.length>0?["body"]:[],...Object.entries(n).flatMap(([r,i])=>i>0?[r]:[]),...n.files+n.tests+n.docs>0?["linked"]:[],"children",...typeof e.assignee=="string"&&e.assignee.trim().length>0?["claim_state"]:[],...Me(e)?["schedule"]:[]]}function vn(e){let t=e.trim().toLowerCase();return t.length>0&&(Vr.has(t)||!Qr.has(t))}function bn(e){return{ts:e.ts,author:e.author,message:e.message??null}}function Xr(e,t){let n=e?.trim(),r=n&&n.length>0?n:null,i=[...t].reverse().find(s=>s.op==="claim"),o=[...t].reverse().find(s=>s.op==="release");return{claimed:r!==null,assignee:r,last_claim:i?bn(i):null,last_release:o?bn(o):null}}function Jr(e){if(e===void 0||e.trim().length===0)return"standard";let t=e.trim().toLowerCase();if(t==="full")return"deep";if(Br.includes(t))return t;throw new p("Get --depth must be one of brief|standard|deep|full",m.USAGE)}function Zr(e,t){let n=Ce(e);if(t==="deep")return{...e,comments:e.comments??[],notes:e.notes??[],learnings:e.learnings??[],files:e.files??[],tests:e.tests??[],docs:e.docs??[],reminders:e.reminders??[],events:e.events??[],notes_count:n.notes,tests_count:n.tests,collection_counts:n};let{comments:r,notes:i,learnings:o,files:s,tests:a,docs:d,reminders:c,events:u,...l}=e;return{...l,notes_count:e.notes?.length??0,tests_count:e.tests?.length??0,collection_counts:n}}function ei(e){if(e===void 0)return null;let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new p("Get --fields requires a comma-separated list of field names",m.USAGE);return t}function ae(e){return e.startsWith("item.")?e.slice(5):e}function ti(e,t,n){if(e===null)return;let r=new Set([...et,...t,"notes_count","tests_count","collection_counts"]),i=new Set(["body","linked","claim_state","children","schedule"]),o=new Set(["linked.files","linked.tests","linked.docs"]),s=new Set(["claim_state.claimed","claim_state.assignee","claim_state.last_claim","claim_state.last_release"]),a=new Set(["schedule.deadline","schedule.start_at","schedule.end_at","schedule.location","schedule.reminders","schedule.events"]),d=[...[...r].flatMap(u=>[u,`item.${u}`]),...i,...o,...s,...a].sort(),c=e.filter(u=>{let l=ae(u);return!r.has(l)&&!i.has(l)&&!o.has(l)&&!s.has(l)&&!a.has(l)});if(c.length>0){let u=["get",n,"--fields","id,title,status"];throw new p(`Unknown get --fields value(s): ${c.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm get <id> --fields id,title,status,type,updated_at","pm get <id> --fields id,title,claim_state","pm get <id> --fields id,title,body,linked.files"],recovery:{allowed_values:d,suggested_retry:J(u),suggested_retry_args:u}})}}var ni=new Set(["comments","notes","learnings","files","tests","test_runs","docs","reminders","events","dependencies","plan_steps","plan_decisions","plan_discoveries","plan_validation"]);function ri(e,t,n){return Object.hasOwn(t,n)?t[n]:e[n]!==void 0?e[n]:ni.has(n)?[]:void 0}function ii(e,t){let n=e,r={notes_count:e.notes?.length??0,tests_count:e.tests?.length??0,collection_counts:Ce(e)},i={id:e.id};for(let o of t){let s=ae(o);s==="body"||s==="linked"||s.startsWith("linked.")||s==="claim_state"||s.startsWith("claim_state.")||s==="children"||s.startsWith("children.")||s==="schedule"||s.startsWith("schedule.")||(i[s]=ri(n,r,s))}return i}function B(e,t){return e?.some(n=>n===t||n===`item.${t}`)??!1}function se(e,t){return e.some(n=>{let r=ae(n);return r===t||r.startsWith(`${t}.`)})}function oi(e){if(e.full&&(e.fields!==void 0||e.depth!==void 0))throw new p("Get projection options are mutually exclusive; remove the extra projection flag and retry.",m.USAGE);if(e.tree!==!0&&e.treeDepth!==void 0)throw new p("Get --tree-depth requires --tree",m.USAGE);if(e.at!==void 0&&e.tree===!0)throw new p("Get --at cannot be combined with --tree because workspace-level historical projections are not yet indexed.",m.USAGE);return{depth:e.full?"deep":Jr(e.depth),treeDepth:e.tree===!0?jt(e.treeDepth,"--tree-depth"):void 0,fields:ei(e.fields),fieldProjection:e.fields!==void 0}}async function si(e,t,n){let r=x(process.cwd(),t.path);if(!await F(T(r)))throw new p(`Tracker is not initialized at ${r}. Run pm init first.`,m.NOT_FOUND);let i=await I(r),o=j(i,M());if(n!==void 0){let d=await Ot(e,n,{pmRoot:t.path});return{pmRoot:r,settings:i,typeToFolder:o.type_to_folder,locatedId:d.document.metadata.id,metadata:d.document.metadata,body:d.document.body,historical:d}}let s=await ne(r,e,i.id_prefix,i.item_format,o.type_to_folder);if(!s)throw await Mt(r,e,i.id_prefix,o.type_to_folder);let a=await re(s,{schema:i.schema});return{pmRoot:r,settings:i,typeToFolder:o.type_to_folder,locatedId:s.id,metadata:a.document.metadata,body:a.document.body}}function ai(e,t,n,r){let i=H(t.schema).definitions.map(o=>o.metadata_key);if(ti(e,i,r),n&&se(e??[],"children"))throw new p("Get --at cannot project children because workspace-level historical relationships are not yet indexed.",m.USAGE)}function Re(e){let{fieldProjection:t,depth:n,fields:r,field:i}=e;return t?i==="body"||i==="linked"?B(r,i):se(r,i):n!=="brief"}async function ci(e,t){if(!t)return;let n=X(e.pmRoot,e.locatedId),r=await $(n,e.locatedId);return Xr(e.metadata.assignee,e.historical?r.slice(0,e.historical.as_of_version):r)}function di(e,t,n,r){let i=r||B(n,"linked.files"),o=r||B(n,"linked.tests"),s=r||B(n,"linked.docs");!r&&!i&&!o&&!s||(e.linked={files:i?t.metadata.files??[]:[],tests:o?t.metadata.tests??[]:[],docs:s?t.metadata.docs??[]:[]})}async function li(e,t,n,r){if(!t)return;let i=N(e.settings.schema),o=await Ft(e.pmRoot,e.settings.item_format,e.typeToFolder,void 0,e.settings.schema),s=wn(e.locatedId,o,i,r?void 0:0);return s.count>0||n?s:void 0}function ui(e,t,n,r){if(!r)return;let i=Me(t.metadata);if(i){if(n===null||B(n,"schedule")){e.schedule=i;return}e.schedule=Object.fromEntries(Object.entries(i).filter(([o])=>n.some(s=>ae(s)===`schedule.${o}`)))}}async function fi(e,t,n,r){if(t.tree!==!0)return;let i=await oe(void 0,{parent:e.locatedId,tree:!0,treeDepth:n===void 0?void 0:String(n),full:!0},r);return{root_id:e.locatedId,root_title:e.metadata.title,depth_limit:n??null,count:i.count,items:i.items.map(o=>o)}}async function ws(e,t,n={}){let r=oi(n),i=await si(e,t,n.at);ai(r.fields,i.settings,i.historical!==void 0,i.locatedId);let o=Re({...r,field:"body"}),s=Re({...r,field:"linked"}),a=Re({...r,field:"claim_state"}),d=i.historical===void 0&&(r.fieldProjection?se(r.fields,"children"):r.depth!=="brief"&&vn(i.metadata.type)),c=r.fieldProjection?se(r.fields,"schedule"):r.depth!=="brief",u=await ci(i,a),l={item:r.fieldProjection?ii(i.metadata,r.fields):Zr(i.metadata,r.depth)};o&&(l.item.body=i.body),di(l,i,r.fields,s),u&&(l.claim_state=u),ui(l,i,r.fields,c);let f=await li(i,d,r.fieldProjection,r.fieldProjection||r.depth==="deep");f!==void 0&&(l.children=f);let h=await fi(i,n,r.treeDepth,t);if(h!==void 0&&(l.tree=h),i.historical&&(l.reconstructed=!0,l.as_of_version=i.historical.as_of_version,l.as_of_timestamp=i.historical.as_of_timestamp),i.historical===void 0)try{await en({pmRoot:i.pmRoot,author:lt(void 0,i.settings.author_default),itemIds:[i.locatedId],intent:"get"})}catch{}return ut(l,Yr(i.metadata,i.body)),l}var bs={shouldAutoIncludeGetChildren:vn};(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]="70e06a73-6602-5384-a25b-fd3df5f6438e")}catch{}})();var Sn=10,L="https://schema.unbrained.dev/pm/eval-query-set/v1",mi={schema:L,accepted_top_level:["array","object"],required_query_fields:["query","relevant_ids"],optional_fields:["mode","description"],modes:["keyword","semantic","hybrid"]},ce={schema:L,queries:[{query:"offline search",relevant_ids:["pm-75k9"],mode:"keyword"}]},k=class extends Error{constructor(t){super(t),this.name="EvalQuerySetError"}},pi=new Set(["keyword","semantic","hybrid"]);function En(e,t){let n=0,r=Math.min(t,e.length);for(let i=0;i<r;i+=1)n+=e[i]/Math.log2(i+2);return n}function hi(e,t,n){if(t.size===0)return 0;let r=e.map(a=>t.has(a)?1:0),i=En(r,n),o=Array.from({length:t.size},()=>1),s=En(o,n);return s===0?0:i/s}function gi(e,t,n){let r=Math.min(n,e.length);for(let i=0;i<r;i+=1)if(t.has(e[i]))return 1/(i+1);return 0}function Te(e,t,n){let r=Math.min(n,e.length),i=0;for(let o=0;o<r;o+=1)t.has(e[o])&&(i+=1);return i}function yi(e,t,n){return n<=0?0:Te(e,t,n)/n}function _i(e,t,n){return t.size===0?0:Te(e,t,n)/t.size}function xn(e,t,n){return{ndcg:hi(e,t,n),mrr:gi(e,t,n),precision:yi(e,t,n),recall:_i(e,t,n),relevant_total:t.size,retrieved_relevant:Te(e,t,n)}}function kn(e){let t=e.length;if(t===0)return{ndcg:0,mrr:0,precision:0,recall:0,query_count:0};let n=e.reduce((r,i)=>({ndcg:r.ndcg+i.ndcg,mrr:r.mrr+i.mrr,precision:r.precision+i.precision,recall:r.recall+i.recall}),{ndcg:0,mrr:0,precision:0,recall:0});return{ndcg:n.ndcg/t,mrr:n.mrr/t,precision:n.precision/t,recall:n.recall/t,query_count:t}}function wi(e,t){if(typeof e!="object"||e===null)throw new k(`Eval query at index ${t} must be an object`);let n=e,r=typeof n.query=="string"?n.query.trim():"";if(r.length===0)throw new k(`Eval query at index ${t} must have a non-empty "query" string`);if(!Array.isArray(n.relevant_ids))throw new k(`Eval query at index ${t} must have a "relevant_ids" array`);if(n.relevant_ids.some(o=>typeof o!="string"))throw new k(`Eval query at index ${t} must have a "relevant_ids" array of strings`);let i=[...new Set(n.relevant_ids.map(o=>o.trim()).filter(o=>o.length>0))];if(i.length===0)throw new k(`Eval query at index ${t} must list at least one relevant id`);if(n.mode!==void 0&&(typeof n.mode!="string"||!pi.has(n.mode)))throw new k(`Eval query at index ${t} has an invalid mode (expected keyword|semantic|hybrid)`);return{query:r,relevant_ids:i,...n.mode!==void 0?{mode:n.mode}:{},...typeof n.description=="string"&&n.description.trim().length>0?{description:n.description.trim()}:{}}}function Ie(e){let t=typeof e=="object"&&e!==null&&!Array.isArray(e)?e.schema:void 0;if(t!==void 0&&t!==L)throw new k(`Unsupported eval query set schema; expected "${L}"`);let n=Array.isArray(e)?e:typeof e=="object"&&e!==null?e.queries:void 0;if(!Array.isArray(n))throw new k('Eval query set must be an array of queries or an object with a "queries" array');if(n.length===0)throw new k("Eval query set must contain at least one query");return{schema:L,queries:n.map((r,i)=>wi(r,i))}}(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]="b0abcc02-bd6e-536a-b876-e13cfc8ea741")}catch{}})();function An(e){if(typeof e!="string")return!1;let t=e.split(",").map(n=>n.trim().toLowerCase()).filter(Boolean);return t.length===1&&t[0]==="all"}var bi=[{optionKey:"status",summaryKey:"status",normalize:e=>An(e)?"all":e},{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"},{optionKey:"parent",summaryKey:"parent"}];function V(e){let{mode:t,matchMode:n,options:r,includeLinked:i,titleExact:o,phraseExact:s,scoreThreshold:a,hybridSemanticWeight:d,runtimeFieldFilters:c}=e,u={};return Zt(u,r,bi),Object.assign(u,Ae(r)),Object.assign(u,ke(r)),n!==void 0&&n!=="or"&&(u.match_mode=n),i&&(u.include_linked=!0),o&&(u.title_exact=!0),s&&(u.phrase_exact=!0),a>0&&(u.score_threshold=a),t==="hybrid"&&r.semanticWeight!==void 0&&(u.hybrid_semantic_weight=d),r.limit!==void 0&&(u.limit=r.limit),c&&Object.keys(c).length>0&&(u.runtime_filters=c),u}function Q(e){let{effectiveMode:t,matchMode:n,options:r,includeLinked:i,titleExact:o,phraseExact:s,scoreThreshold:a,hybridSemanticWeight:d,queryExpansion:c,rerank:u,runtimeFieldFilters:l}=e,f=h=>h??null;return{mode:t,match_mode:n,status:r.status===void 0||An(r.status)?"all":r.status,type:f(r.type),tag:f(r.tag),priority:f(r.priority),deadline_before:f(r.deadlineBefore),deadline_after:f(r.deadlineAfter),updated_after:f(r.updatedAfter),updated_before:f(r.updatedBefore),created_after:f(r.createdAfter),created_before:f(r.createdBefore),assignee:f(r.assignee),sprint:f(r.sprint),release:f(r.release),parent:f(r.parent),...Ae(r),...ke(r),include_linked:i,title_exact:o,phrase_exact:s,score_threshold:a,hybrid_semantic_weight:t==="hybrid"?d:null,query_expansion_enabled:c.enabled,query_expansion_provider:c.provider,rerank_enabled:u.enabled,rerank_model:u.model,rerank_top_k:u.top_k,limit:f(r.limit),runtime_filters:l}}(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]="0fc9ed92-daf5-5fa2-b9a4-ee6c36256ed1")}catch{}})();function vi(e){return pt("search",{query:e.query.trim(),mode:e.mode,options:mt(e.searchOptions,Dt)})}function Fn(e){let t=ht(e.sorted,{cursor:e.searchOptions.after,fingerprint:vi(e),limit:e.limit,readId:n=>n.item.id});return{limited:t.rows,pageExtras:{applied_limit:e.limit,...t.has_more?{has_more:!0,truncated:!0}:{},...t.next_cursor?{next_cursor:t.next_cursor}:{}}}}(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]="e737cdf9-734c-5010-864f-60e8052dd9c1")}catch{}})();var Ei=["id","title","status","type","priority","updated_at","score","matched_fields"],Si=new Set(["score","matched_fields","highlights"]),Mn=new Set(["id","title","description","type","status","priority","tags","created_at","updated_at","deadline","assignee","author","estimated_minutes","acceptance_criteria","dependencies","comments","notes","learnings","reminders","events","files","tests","docs","close_reason","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result","affected_version","fixed_version","component","regression","customer_impact","definition_of_ready","order","rank","goal","objective","value","impact","outcome","why_now","plan"]);function Rn(e){if(e===void 0)return"keyword";let t=e.trim().toLowerCase();if(t!=="keyword"&&t!=="semantic"&&t!=="hybrid")throw new p("Search mode must be one of keyword|semantic|hybrid",m.USAGE);return t}function de(e){return e===!0}function Cn(e){return tt(e,0,1)??void 0}function Tn(e){if(e===void 0)return"or";let t=e.trim().toLowerCase();if(t!=="and"&&t!=="or"&&t!=="exact")throw new p("Search --match-mode must be one of and|or|exact",m.USAGE);return t}function In(e){if(e==null||e==="")return;let t=typeof e=="number"?e:Number(String(e).trim());if(!Number.isFinite(t)||t<0)throw new p("Search --min-score must be a finite number >= 0",m.USAGE);return t}function G(e,t){if(e==null)return;let n=String(e).trim();if(n.length!==0)return ge(n,new Date,t)}function R(e){return e.toLowerCase().replace(/\s+/g," ").trim()}function Le(e,t){if(e!==void 0)return ge(e,new Date,t)}function xi(e){if(e===void 0)return;let t=e.split(",").map(n=>n.trim()).filter(n=>n.length>0);if(t.length===0)throw new p("Search --fields requires a comma-separated list of field names",m.USAGE);return[...new Set(t)]}function qe(e){let t=e.compact===!0,n=e.full===!0,r=xi(e.fields);if(Number(t)+Number(n)+ +(r!==void 0)>1)throw new p("Search projection options are mutually exclusive. Use one of --compact, --full, or --fields.",m.USAGE);return t?{mode:"compact",fields:[...Ei]}:n?{mode:"full",fields:[]}:r?{mode:"fields",fields:r}:{mode:"full",fields:[]}}function De(e,t,n="<query>"){if(e.mode!=="fields")return;let r=new Set(t.definitions.flatMap(s=>[s.key,s.metadata_key])),i=new Set([...Si,...Mn,...[...Mn].map(s=>`item.${s}`),...r,...[...r].map(s=>`item.${s}`)]),o=e.fields.filter(s=>{let a=s.trim();return!i.has(a)});if(o.length>0){let s=["search",n,"--fields","id,title,status,score"];throw new p(`Unknown search --fields value(s): ${o.join(", ")}`,m.USAGE,{examples:["pm search <query> --fields id,title,status,score","pm search <query> --fields id,title,item.description,matched_fields"],nextSteps:["Use item.<field> for explicit item metadata fields, or run pm search --help for projection examples."],recovery:{allowed_values:[...i].sort(),suggested_retry:J(s),suggested_retry_args:s}})}}function Pe(e){let t=R(e);if(!t)throw new p("Search query must not be empty",m.USAGE);return t.split(/\s+/u).filter(Boolean)}function Oe(e){let t=e.search?.max_results;return typeof t=="number"&&Number.isFinite(t)&&t>0?Math.floor(t):50}function je(e){let t=e.search?.score_threshold;return typeof t=="number"&&Number.isFinite(t)?t:0}function Ne(e){let t=e.search?.hybrid_semantic_weight;return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=1?t:.7}function He(e){let t={title_exact_bonus:10,title_weight:48,description_weight:5,tags_weight:6,status_weight:2,body_weight:1,comments_weight:1,notes_weight:1,learnings_weight:1,reminders_weight:2,events_weight:2,dependencies_weight:3,linked_content_weight:1},n=e.search?.tuning;if(!n)return t;let r=(i,o)=>typeof i=="number"&&Number.isFinite(i)&&i>=0?i:o;return{title_exact_bonus:r(n.title_exact_bonus,t.title_exact_bonus),title_weight:r(n.title_weight,t.title_weight),description_weight:r(n.description_weight,t.description_weight),tags_weight:r(n.tags_weight,t.tags_weight),status_weight:r(n.status_weight,t.status_weight),body_weight:r(n.body_weight,t.body_weight),comments_weight:r(n.comments_weight,t.comments_weight),notes_weight:r(n.notes_weight,t.notes_weight),learnings_weight:r(n.learnings_weight,t.learnings_weight),reminders_weight:r(n.reminders_weight,t.reminders_weight),events_weight:r(n.events_weight,t.events_weight),dependencies_weight:r(n.dependencies_weight,t.dependencies_weight),linked_content_weight:r(n.linked_content_weight,t.linked_content_weight)}}import ue from"node:fs/promises";import Ke 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]="42fde1a1-ee4b-5564-93b2-78d5a0fc7555")}catch{}})();var Ue=4,ki=20,Ai=200,Fi=new Set(["a","an","and","for","from","in","into","of","on","or","the","to","with"]);function Ge(e,t){let n=[],r=new Set;for(let i of e){let o=i.trim().replaceAll(/\s+/g," ");if(o.length===0)continue;let s=o.toLowerCase();if(!r.has(s)&&(r.add(s),n.push(o),n.length>=t))break}return n}function Mi(e){let t=e.toLowerCase();return t.length>4&&t.endsWith("ies")?`${t.slice(0,-3)}y`:t.length>4&&(t.endsWith("ches")||t.endsWith("shes")||t.endsWith("xes")||t.endsWith("zes")||t.endsWith("sses"))?t.slice(0,-2):t.length>3&&t.endsWith("s")&&!t.endsWith("ss")&&!t.endsWith("us")&&!t.endsWith("is")&&!t.endsWith("as")?t.slice(0,-1):t}function Ri(e){let t=e.toLowerCase();return t.length>2&&(!t.endsWith("s")||t.endsWith("ss"))?t.endsWith("y")&&!/[aeiou]y$/u.test(t)?`${t.slice(0,-1)}ies`:t.endsWith("ch")||t.endsWith("sh")||t.endsWith("x")||t.endsWith("z")||t.endsWith("ss")?`${t}es`:`${t}s`:t}function Ln(e,t=Ue){let n=e.trim().replaceAll(/\s+/g," ");if(n.length===0)return[];let r=U(n);if(r.length===0)return[n];let i=r.filter(a=>!Fi.has(a.toLowerCase())),o=r.map(a=>Mi(a)),s=i.map(a=>Ri(a));return Ge([n,r.join(" "),i.join(" "),o.join(" "),s.join(" ")],Math.max(1,t))}function qn(e){let t=Array.isArray(e)?e:e?.queries;return Array.isArray(t)?Ge(t.filter(n=>typeof n=="string"),Ue):[]}function Dn(e,t,n){return Ge([...e,...t],Math.max(1,n))}function Pn(e,t){let r=e.search?.query_expansion,i=W(r?.provider);return{enabled:r?.enabled===!0,provider:i??t,max_queries:Ue}}function On(e,t){let r=e.search?.rerank,i=W(r?.model),s=Y(r?.top_k)??ki;return{enabled:r?.enabled===!0,model:i??t,top_k:Math.min(Ai,s)}}function jn(e){let t=Array.isArray(e)?e:e?.hits;if(!Array.isArray(t))return[];let n=new Map;for(let i of t){if(typeof i!="object"||i===null)continue;let o=W(i.id),s=i.score;if(!o||typeof s!="number"||!Number.isFinite(s))continue;let a=n.get(o);(a===void 0||s>a)&&n.set(o,s)}let r=[...n.entries()].map(([i,o])=>({id:i,score:o}));return r.sort((i,o)=>i.score!==o.score?o.score-i.score:i.id.localeCompare(o.id)),r}function Ci(e,t){let n=e.length,r=0;for(let i=0;i<n;i+=1)r+=e[i]*t[i];return r}function Nn(e){let t=0;for(let n=0;n<e.length;n+=1)t+=e[n]*e[n];return Math.sqrt(t)}function Ti(e,t,n){if(!e||!t||e.length===0||t.length===0||e.length!==t.length)return 0;let r=Ci(e,t),i=Nn(t),o=n*i;return!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||o===0?0:Math.max(-1,Math.min(1,r/o))}async function Hn(e,t,n,r,i){if(r.length===0)return new Map;let o=W(t)??e.model,s=o===e.model?e:{...e,model:o},a=[n.trim(),...r.map(f=>f.text)],d=await ie(s,a,i?{timeout_ms:i}:{}),c=d[0];if(!c)return new Map;let u=Nn(c),l=new Map;for(let f=0;f<r.length;f+=1){let h=r[f],g=d[f+1];if(!g)continue;let y=Ti(c,g,u);l.set(h.id,Math.max(0,Math.min(1,(y+1)/2)))}return l}(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]="3fd6ed70-6633-5886-90a6-3d4cc16b3ef0")}catch{}})();var Ii=1.2,Li=.75;function We(e){return U(e)}function qi(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return t}function Gn(e){let t=[],n=new Map,r=0;for(let o of e){let s=We(o.text),a=qi(s);r+=s.length;for(let d of a.keys())n.set(d,(n.get(d)??0)+1);t.push({id:o.id,termFrequencies:a,length:s.length})}let i=t.length;return{documents:t,documentFrequency:n,documentCount:i,averageDocumentLength:i>0?r/i:0}}function Di(e,t){return Math.log(1+(e-t+.5)/(t+.5))}function Wn(e,t,n){let r=new Map;if(e.documentCount===0||e.averageDocumentLength===0)return r;let i=[...new Set(t.filter(s=>s.length>0))];if(i.length===0)return r;let o=new Map;for(let s of i){let a=e.documentFrequency.get(s);a!==void 0&&o.set(s,Di(e.documentCount,a))}if(o.size===0)return r;for(let s of e.documents){let a=0;for(let[d,c]of o){let u=s.termFrequencies.get(d);if(u===void 0)continue;let l=1-n.b+n.b*s.length/e.averageDocumentLength,f=u+n.k1*l;a+=c*(u*(n.k1+1)/f)}a>0&&r.set(s.id,a)}return r}function Un(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(r,Math.max(n,e))}function zn(e){let t=n=>typeof n=="string"?[n]:typeof n=="number"?[String(n)]:Array.isArray(n)?n.flatMap(t):typeof n=="object"&&n!==null?Object.values(n).flatMap(t):[];return t(Object.values(e)).join(" ")}function $n(e){let t=e?.search?.bm25;return{k1:Un(t?.k1,Ii,0,1e3),b:Un(t?.b,Li,0,1)}}(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]="0582c462-43fc-563c-b209-d6e3c39948f4")}catch{}})();var Pi=2,Oi=120,ji=6,Ni=40,Hi=1e3,Ui=900,Gi="\xAB",Wi="\xBB",Kn=60,Qn=["tag","status","type","priority"];function Yn(e){let t=[],n=e;for(let r=0;r<5&&n&&typeof n=="object";r+=1){let i=n.code;typeof i=="string"&&t.push(i.toLowerCase()),n=n.cause}return t.join(" ")}function Xn(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase(),n=Yn(e),r=`${t} ${n}`;return r.includes("timed out")||r.includes("timeout")||r.includes("etimedout")?"timeout":r.includes("econnrefused")||r.includes("connection refused")||r.includes("connect ")||r.includes("enotfound")||r.includes("eai_again")||r.includes("econnreset")||r.includes("fetch failed")?"connection":"error"}function Jn(e,t){let n=Xn(t);return`search_${e}_fallback:${n}:using_keyword_mode`}async function Zn(e,t,n){try{let r=await Lt(e);r.warnings.length>0&&n.push(...r.warnings);let i=Wt(t.map(o=>({id:o.metadata.id,updated_at:o.metadata.updated_at})),r.entries);if(i.length===0)return;n.push(`vector_index_stale:${i.length}`),process.stderr.write(`[pm] warning: ${i.length} item${i.length===1?" is":"s are"} new or modified since the last reindex and ${i.length===1?"is":"are"} NOT in the semantic index yet \u2014 they will be missing from semantic/hybrid results until you run 'pm reindex --mode hybrid'. (Write-time embedding is governed by search.mutation_refresh_policy; staleness means the embed was skipped, failed, or the backend was unreachable.)
|
|
2
|
+
`)}catch{}}var Aa={applyFilters:or,applyExactQueryFilters:ir,applyInlineQueryFilters:tr,buildHitHighlights:fr,buildVerboseSearchFilters:Q,buildExplicitSemanticFallbackWarning:Jn,buildCompactSearchFilterSummary:V,buildHybridLexicalScore:hr,buildRerankCorpus:xr,buildSemanticHits:br,classifyImplicitSemanticFallbackReason:Xn,collectErrorCauseCodes:Yn,collectExactPhraseFields:nr,collectLinkedPaths:sr,combineHybridHits:Ye,computeBuiltInBm25Hits:Er,computeSemanticOrHybridHits:kr,resolveBuiltInBm25Mode:vr,countOccurrences:Ve,dependencyEntries:Be,documentContainsExactPhrase:rr,emptySearchResult:gr,highlightFieldSnippet:ur,loadDocuments:Ar,markTokenRuns:lr,parseInlineQueryFilters:er,maybeEmitVectorIndexStaleWarning:Zn,loadLinkedCorpus:cr,mergeVectorHitsById:Sr,normalizeExtensionProviderHits:wr,normalizeScoreMap:ze,parseProjectionConfig:qe,parseTimestampWindow:G,parseTokens:Pe,projectSearchHits:Mr,readSearchFieldValue:Fr,requireSemanticDependencies:Qe,resolveExtensionSearchProvider:yr,resolveExtensionSearchProviderByName:pe,resolveExtensionVectorAdapter:_r,resolveLinkedCorpusRoots:ar,scoreDocument:mr,sortHits:pr,stringArray:me,textEntries:O,validateSearchProjectionFields:De};function er(e){let t={},n=[];for(let r of e.split(/\s+/).filter(i=>i.length>0)){let i=r.indexOf(":"),o=i>0?r.slice(0,i).toLowerCase():"",s=i>0?r.slice(i+1):"",a=Qn.includes(o)?o:void 0;if(a&&s.length>0&&t[a]===void 0){t[a]=s;continue}n.push(r)}return{residualQuery:n.join(" "),inlineFilters:t}}function tr(e,t,n){let r={...e};for(let i of Qn){let o=t[i];if(o!==void 0){if(he(r[i])!==void 0){n.push(`search_inline_filter_ignored:${i}:flag_takes_precedence`);continue}r[i]=o}}return r}function me(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function O(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null&&typeof t.text=="string"):[]}function Be(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null&&typeof t.id=="string"&&typeof t.kind=="string"):[]}function nr(e){let t=e.metadata;return[t.title,t.description,t.status,me(t.tags).join(" "),e.body,O(t.comments).map(n=>n.text).join(" "),O(t.notes).map(n=>n.text).join(" "),O(t.learnings).map(n=>n.text).join(" "),ve(t).join(" "),Ee(t).join(" "),Be(t.dependencies).map(n=>`${n.id} ${n.kind}`).join(" "),Se(t)]}function rr(e,t){return nr(e).some(n=>R(n).includes(t))}function ir(e,t,n){return!n.titleExact&&!n.phraseExact?e:e.filter(r=>!(n.titleExact&&R(r.metadata.title)!==t||n.phraseExact&&!rr(r,t)))}function zi(e){if(e&&[...e].some(t=>t.toLowerCase()==="none"||t.toLowerCase()==="null"))throw new p('--assignee no longer accepts "none" or "null".',m.USAGE)}function $i(e,t,n){let r=K(e.assignee,{label:"--assignee"});zi(r);let i=Xt(e),o=Jt(e);return{typeFilter:zt(e.type,t),tagFilter:K(e.tag,{label:"--tag",normalize:s=>s.toLowerCase()}),priorityFilter:$t(e.priority),deadlineBefore:Le(e.deadlineBefore,"deadline-before"),deadlineAfter:Le(e.deadlineAfter,"deadline-after"),updatedAfter:G(e.updatedAfter,"updated-after"),updatedBefore:G(e.updatedBefore,"updated-before"),createdAfter:G(e.createdAfter,"created-after"),createdBefore:G(e.createdBefore,"created-before"),assigneeFilter:r,sprintFilter:K(e.sprint,{label:"--sprint"}),releaseFilter:K(e.release,{label:"--release"}),parentFilter:e.parent?.trim(),statusSet:n&&n.length>0?new Set(n):void 0,missingMetadataFilters:i,missingMetadataActive:Bt(i),contentFieldFilters:o,contentFiltersActive:Qt(o)}}function Ki(e,t){return Bi(e,t)&&Vi(e,t)&&Qi(e,t)}function Bi(e,t){if(t.statusSet&&!t.statusSet.has(e.status)||t.typeFilter&&!t.typeFilter.has(e.type))return!1;let n=t.tagFilter;return!(n&&!me(e.tags).some(r=>n.has(r))||t.priorityFilter!==void 0&&!t.priorityFilter.has(e.priority))}function Vi(e,t){return rt(e,t)}function Qi(e,t){return!(t.assigneeFilter!==void 0&&(e.assignee===void 0||!t.assigneeFilter.has(e.assignee))||t.sprintFilter!==void 0&&(e.sprint===void 0||!t.sprintFilter.has(e.sprint))||t.releaseFilter!==void 0&&(e.release===void 0||!t.releaseFilter.has(e.release))||t.parentFilter!==void 0&&e.parent!==t.parentFilter)}function Yi(e,t,n,r){let i=e.metadata;return!(!Ki(i,t)||!St(i,n)||t.missingMetadataActive&&!Vt(i,t.missingMetadataFilters,r)||t.contentFiltersActive&&!Yt(i,t.contentFieldFilters))}function or(e,t,n,r,i,o){let s=$i(t,n,i);return e.filter(a=>Yi(a,s,r,o))}function Ve(e,t){let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i<0)return n;n+=1,r=i+t.length}}function Xi(e){return U(e)}function sr(e){let t=(e.files??[]).map(s=>({scope:s.scope,path:s.path.trim()})),n=(e.docs??[]).map(s=>({scope:s.scope,path:s.path.trim()})),r=(e.tests??[]).filter(s=>typeof s.path=="string"&&s.path.trim().length>0).map(s=>({scope:s.scope,path:s.path.trim()})),i=[...t,...n,...r].filter(s=>s.path.length>0).sort((s,a)=>s.scope.localeCompare(a.scope)||s.path.localeCompare(a.path)),o=new Map;for(let s of i)o.set(`${s.scope}:${s.path}`,s);return[...o.values()]}async function Bn(e){let t=Ke.resolve(e);try{let n=await ue.realpath(t);return{resolved:t,realpath:n}}catch{return null}}async function ar(e,t){let[n,r]=await Promise.all([Bn(e),Bn(t)]);return{projectContainmentRoot:n,globalContainmentRoot:r}}async function cr(e,t){let n=sr(e.metadata),r=[];for(let i of n){let o=i.scope==="global"?t.globalContainmentRoot:t.projectContainmentRoot;if(!o)continue;let s=Ke.resolve(o.resolved,i.path);if(!ye(o.resolved,s))continue;let a;try{a=await ue.realpath(s)}catch{continue}if(ye(o.realpath,a))try{await we({path:s,scope:i.scope}),r.push(await ue.readFile(s,"utf8"))}catch{}}return r.join(`
|
|
3
|
+
`)}var dr=[{name:"title",weightKey:"title_weight",value:e=>e.metadata.title},{name:"description",weightKey:"description_weight",value:e=>e.metadata.description},{name:"tags",weightKey:"tags_weight",value:e=>me(e.metadata.tags).join(" ")},{name:"status",weightKey:"status_weight",value:e=>typeof e.metadata.status=="string"?e.metadata.status:""},{name:"body",weightKey:"body_weight",value:e=>e.body},{name:"comments",weightKey:"comments_weight",value:e=>O(e.metadata.comments).map(t=>t.text).join(" ")},{name:"notes",weightKey:"notes_weight",value:e=>O(e.metadata.notes).map(t=>t.text).join(" ")},{name:"learnings",weightKey:"learnings_weight",value:e=>O(e.metadata.learnings).map(t=>t.text).join(" ")},{name:"reminders",weightKey:"reminders_weight",value:e=>ve(e.metadata).join(" ")},{name:"events",weightKey:"events_weight",value:e=>Ee(e.metadata).join(" ")},{name:"dependencies",weightKey:"dependencies_weight",value:e=>Be(e.metadata.dependencies).map(t=>`${t.id} ${t.kind}`).join(" ")},{name:"plan",weightKey:"body_weight",value:e=>Se(e.metadata)}],Ji=new Map(dr.map(e=>[e.name,e]));function Zi(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lr(e,t){let n=t.filter(i=>i.length>0).sort((i,o)=>o.length-i.length).map(Zi);if(n.length===0)return e;let r=new RegExp(n.join("|"),"gi");return e.replace(r,i=>`${Gi}${i}${Wi}`)}function ur(e,t){if(e.length===0)return null;let n=e.toLowerCase(),r=-1,i=0;for(let u of t){if(u.length===0)continue;let l=n.indexOf(u);l>=0&&(r<0||l<r)&&(r=l,i=u.length)}if(r<0)return null;let o=Math.max(0,r-Kn),s=Math.min(e.length,r+i+Kn),a=lr(e.slice(o,s),t),d=o>0?"\u2026":"",c=s<e.length?"\u2026":"";return`${d}${a}${c}`}function fr(e,t,n){let r=[];for(let i of t){let o=Ji.get(i);if(o===void 0)continue;let s=ur(o.value(e),n);s!==null&&r.push({field:i,snippet:s})}return r}function eo(e,t,n){return[...dr.map(r=>({name:r.name,value:r.value(e),weight:n[r.weightKey]})),{name:"linked_content",value:t,weight:n.linked_content_weight}]}function to(e,t,n){let r=R(e.id),i=typeof n=="string"?n.trim().toLowerCase():"",o=R(i),s=o.length>0&&r.startsWith(o)?r.slice(o.length).trim():r;return t!==r&&t!==s?null:{item:e,score:t===r?Hi:Ui,matched_fields:["id"],matched_all_terms:!0,exact_id_match:!0}}function no(e,t,n,r,i){for(let o of e){let s=t.get(o)??0;s>0&&(i.score+=s*r.title_exact_bonus,i.matched.add("title"),i.matchedTokens.add(o));for(let a of n){let d=Ve(a.value.toLowerCase(),o);d>0&&(i.score+=d*a.weight,i.matched.add(a.name),i.matchedTokens.add(o))}}}function ro(e,t,n,r){R(e.title)===t&&(r.score+=Oi,r.matched.add("title"));for(let o of n){let s=Ve(R(o.value),t);s>0&&(r.score+=s*o.weight*ji,r.matched.add(o.name))}}function mr(e,t,n,r,i,o,s=!1){let a=e.metadata,d=to(a,n,o);if(d)return d;let c=new Map;for(let y of Xi(a.title))c.set(y,(c.get(y)??0)+1);let u=eo(e,r,i),l={score:0,matched:new Set,matchedTokens:new Set};no(t,c,u,i,l);let f=new Set(t),h=f.size>0&&l.matchedTokens.size===f.size;return s&&f.size>1&&h&&(l.score+=Ni),t.length>=Pi&&n.includes(" ")&&ro(a,n,u,l),l.score<=0?null:{item:a,score:l.score,matched_fields:[...l.matched].sort((y,b)=>y.localeCompare(b)),matched_all_terms:h}}function pr(e,t){return[...e].sort((n,r)=>{let i=r.score-n.score;if(i!==0)return i;let o=z(n.item.status,t),s=z(r.item.status,t);if(o!==s)return o?1:-1;let a=n.item.priority-r.item.priority;if(a!==0)return a;let d=nt(r.item.updated_at,n.item.updated_at);return d!==0?d:n.item.id.localeCompare(r.item.id)})}function hr(e,t,n,r,i,o,s,a=!1){return mr(e,t,n,r?i.get(e.metadata.id)??"":"",o,s,a)}function ze(e){if(e.size===0)return new Map;let t=[...e.values()],n=Math.min(...t),r=Math.max(...t);if(r===n)return new Map([...e.keys()].map(o=>[o,1]));let i=new Map;for(let[o,s]of e)i.set(o,(s-n)/(r-n));return i}function gr(e,t,n,r,i,o,s,a,d,c,u,l,f=!1){let h=f?{total:0,count_only:!0}:{};if(c.mode==="compact"&&r.compact===!0){let b=V({mode:t,matchMode:n,options:r,includeLinked:i,titleExact:r.titleExact===!0,phraseExact:r.phraseExact===!0,scoreThreshold:o,hybridSemanticWeight:s,runtimeFieldFilters:l});return{query:e.trim(),mode:t,items:[],count:0,...h,filters:b,...u.length>0?{warnings:u}:{}}}let y=c.mode==="full"?null:[...c.fields];return{query:e.trim(),mode:t,items:[],count:0,...h,filters:Q({effectiveMode:t,matchMode:n,options:r,includeLinked:i,titleExact:r.titleExact===!0,phraseExact:r.phraseExact===!0,scoreThreshold:o,hybridSemanticWeight:s,queryExpansion:a,rerank:d,runtimeFieldFilters:l??{}}),projection:{mode:c.mode,fields:y},now:P(),...u.length>0?{warnings:u}:{}}}function Qe(e,t,n,r){if(!t.active)throw new p(`Search mode '${e}' requires a configured embedding provider in settings.providers.openai or settings.providers.ollama`,m.USAGE);if(!n.active&&!r)throw new p(`Search mode '${e}' requires a configured vector store in settings.vector_store.qdrant/settings.vector_store.lancedb or an extension adapter selected by settings.vector_store.adapter`,m.USAGE);return{provider:t.active,vectorStore:n.active??null}}var A=he;function pe(e){let t=M(),n=st(t,e);if(!n)return null;let r=n.runtime_definition??n.definition,i=r.query,o=r.queryExpansion??r.query_expansion,s=r.rerank,a=A(r.name)??A(n.definition.name)??e;if(!a)return null;let d={providerName:a,...typeof i=="function"?{query:i}:{},...typeof o=="function"?{queryExpansion:o}:{},...typeof s=="function"?{rerank:s}:{}};return!d.query&&!d.queryExpansion&&!d.rerank?null:d}function yr(e){let t=A(e.search?.provider),n=pe(t);return n?.query?{providerName:n.providerName,query:n.query}:null}function _r(e){let t=M(),n=A(e.vector_store?.adapter),r=at(t,n);if(!r)return null;let i=r.runtime_definition??r.definition,o=i.query;if(typeof o!="function")return null;let s=i.upsert;return{adapterName:A(i.name)??A(r.definition.name)??n??"extension",query:o,...typeof s=="function"?{upsert:s}:{}}}function wr(e,t,n){let r=Array.isArray(t)?t:t?.hits;if(!Array.isArray(r))throw new p(`Extension search provider "${e}" must return an array of hits or { hits: [...] }`,m.GENERIC_FAILURE);let i=new Set,o=[];for(let s of r){if(typeof s!="object"||s===null)continue;let a=A(s.id),d=s.score;if(!a||typeof d!="number"||!Number.isFinite(d)||i.has(a))continue;let c=n.get(a);if(!c)continue;let u=s.matched_fields,l=Array.isArray(u)&&u.every(f=>typeof f=="string")?[...new Set(u.map(f=>f.trim()).filter(f=>f.length>0))].sort((f,h)=>f.localeCompare(h)):[`provider:${e}`];i.add(a),o.push({item:c.metadata,score:d,matched_fields:l})}return o}function br(e,t){let n=[],r=new Map;for(let i of e){if(r.has(i.id))continue;let o=t.get(i.id);o&&(r.set(i.id,i.score),n.push({item:o.metadata,score:i.score,matched_fields:["semantic"]}))}return{semanticHits:n,semanticScores:r}}function fe(e,t){let n=t.filter(c=>c.exact_id_match===!0);if(n.length===0)return e;let r=new Set(n.map(c=>c.item.id)),i=e.filter(c=>!r.has(c.item.id)),o=i.reduce((c,u)=>Math.max(c,u.score),0),s=n.sort((c,u)=>u.score-c.score),a=o+s.length+1;return[...s.map((c,u)=>({...c,score:a-u,matched_fields:["id"]})),...i]}function Ye(e,t,n,r,i="semantic"){let o=new Map(n.map(l=>[l.item.id,l.score])),s=new Map(n.map(l=>[l.item.id,l.matched_fields])),a=ze(t),d=ze(o),c=new Set([...t.keys(),...o.keys()]),u=1-r;return[...c].map(l=>{let f=e.get(l),h=a.get(l)??0,g=d.get(l)??0,y=h*r+g*u;if(y<=0)return null;let b=new Set;t.has(l)&&b.add(i);for(let _ of s.get(l)??[])b.add(_);return{item:f.metadata,score:y,matched_fields:[...b].sort((_,w)=>_.localeCompare(w))}}).filter(l=>l!==null)}function vr(e){let t=e.configuredProvider?.trim().toLowerCase();return t==="bm25"?"explicit":t==="auto"&&!e.hasEmbeddingProvider&&!e.hasExtensionSearchProvider?"auto-fallback":null}function Er(e){let t=e.filteredDocuments.map(s=>({id:s.metadata.id,text:zn(Tt(s,{fields:e.corpusFields}))})),n=Gn(t),r=Wn(n,We(e.query),e.bm25Params),i=new Map(e.filteredDocuments.map(s=>[s.metadata.id,s]));if(e.requestedMode==="semantic"){let s=[...r].map(([a,d])=>({item:i.get(a).metadata,score:d,matched_fields:["bm25"]}));return fe(s,e.keywordHits)}let o=Ye(i,r,e.keywordHits,e.hybridSemanticWeight,"bm25");return fe(o,e.keywordHits)}function Sr(e){let t=new Map;for(let r of e)for(let i of r){let o=t.get(i.id);(!o||i.score>o.score)&&t.set(i.id,i)}let n=[...t.values()];return n.sort((r,i)=>r.score!==i.score?i.score-r.score:r.id.localeCompare(i.id)),n}function xr(e){let t=e.metadata,n=Array.isArray(t?.tags)?t.tags.join(" "):"";return[t?.title,t?.description,t?.type,t?.status,n,e.body].map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0).join(`
|
|
4
|
+
`)}async function io(e,t){let n=e.queryExpansion.enabled?Ln(t,e.queryExpansion.max_queries):[t],r=n.length>0?n:[t];if(!e.queryExpansion.enabled)return r;if(e.queryExpansionExtension?.expand)try{let i=await Promise.resolve(e.queryExpansionExtension.expand({query:t,mode:e.requestedMode,settings:e.settings}));return Dn(r,qn(i),e.queryExpansion.max_queries)}catch{return e.warnings.push(`search_query_expansion_provider_failed:${e.queryExpansionExtension.providerName}:using_builtin`),r}return e.queryExpansion.provider&&e.queryExpansion.provider!=="openai"&&e.queryExpansion.provider!=="ollama"&&e.warnings.push(`search_query_expansion_provider_unavailable:${e.queryExpansion.provider}:using_builtin`),r}async function oo(e,t,n,r){if(e.extensionVectorAdapter?.query)try{return await Promise.resolve(e.extensionVectorAdapter.query({vector:t,limit:n,settings:e.settings}))}catch(i){if(!e.vectorStore)throw new p(`Extension vector adapter query failed and no built-in fallback store is configured (${i instanceof Error?i.message:String(i)})`,m.GENERIC_FAILURE);return e.warnings.push(`search_vector_adapter_failed:${e.extensionVectorAdapter.adapterName}:using_builtin`),await xe(e.vectorStore,t,n,r)}if(e.vectorStore)return await xe(e.vectorStore,t,n,r);throw new p("Semantic search requires either a configured vector store or an extension vector adapter query handler",m.USAGE)}function so(e,t,n){return[...e].sort((i,o)=>i.score!==o.score?o.score-i.score:i.item.id.localeCompare(o.item.id)).slice(0,n).map(i=>{let o=t.get(i.item.id);return o?{hit:i,text:xr(o)}:null}).filter(i=>i!==null)}async function ao(e,t,n){if(!e.rerankExtension?.rerank)return null;try{let r=await Promise.resolve(e.rerankExtension.rerank({query:t,mode:"hybrid",model:e.rerank.model,top_k:e.rerank.top_k,settings:e.settings,candidates:n.map(o=>({id:o.hit.item.id,text:o.text,score:o.hit.score}))})),i=jn(r);return i.length>0?new Map(i.map(o=>[o.id,o.score])):(e.warnings.push(`search_rerank_provider_invalid_response:${e.rerankExtension.providerName}:using_builtin`),null)}catch{return e.warnings.push(`search_rerank_provider_failed:${e.rerankExtension.providerName}:using_builtin`),null}}async function co(e,t,n){let r=await ao(e,t,n);if(r)return r;let i=n.map(o=>({id:o.hit.item.id,text:o.text}));try{return await Hn(e.provider,e.rerank.model,t,i,e.embeddingTimeoutMs)}catch{return e.warnings.push("search_rerank_failed:using_hybrid_scores"),null}}function lo(e,t){let n=new Set(t.keys()),r=e.map(i=>{let o=t.get(i.item.id);if(o===void 0)return i;let s=new Set(i.matched_fields);return s.add("rerank"),{...i,score:o,matched_fields:[...s].sort((a,d)=>a.localeCompare(d))}});return r.sort((i,o)=>{let s=n.has(i.item.id),a=n.has(o.item.id);return s!==a?s?-1:1:i.score!==o.score?o.score-i.score:i.item.id.localeCompare(o.item.id)}),r}async function uo(e,t,n,r){if(!e.rerank.enabled||n.length<=1)return n;let i=so(n,r,e.rerank.top_k),o=await co(e,t,i);return o&&o.size>0?lo(n,o):n}async function kr(e){let t=Math.max(e.limit??e.maxResults,e.maxResults),n=e.embeddingTimeoutMs!==void 0?{timeout_ms:e.embeddingTimeoutMs}:{},r=e.vectorQueryTimeoutMs!==void 0?{timeout_ms:e.vectorQueryTimeoutMs}:{},i=e.query.trim(),o=await io(e,i),s=await ie(e.provider,o,n),a=await Promise.all(s.map(async g=>await oo(e,g,t,r))),d=Sr(a),c=new Map(e.filteredDocuments.map(g=>[g.metadata.id,g])),{semanticHits:u,semanticScores:l}=br(d,c),f=l.size;if(e.requestedMode==="semantic")return{hits:fe(u,e.keywordHits),vectorMatchCount:f};let h=await uo(e,i,Ye(c,l,e.keywordHits,e.hybridSemanticWeight),c);return{hits:fe(h,e.keywordHits),vectorMatchCount:f}}async function Ar(e,t,n,r){let i=ot(M()),o=async(c,u,l)=>{let f=async(h,g)=>{await we({path:h,scope:"project"});let y=await ue.readFile(h,"utf8");return dt(y,{format:g,schema:r,extensionFieldNames:i,onWarning:_=>s.push(_)}).body};try{return await f(u,l)}catch{let h=l==="toon"?"json_markdown":"toon",g=_e(e,c.type,c.id,h,n);try{return await f(g,h)}catch{return s.push(`item_list_item_read_failed:${Ke.relative(e,g)}`),""}}},s=[],a=await kt(e,t,n,s,r),d=[];if(a.length===0){let c=await At(e,t,n,s,r);for(let u of c){let l=_e(e,u.type,u.id,t,n),f=await o(u,l,t);d.push({metadata:u,body:f})}return{documents:d,warnings:[...new Set(s)].sort((u,l)=>u.localeCompare(l))}}for(let c of a){if(typeof c.body=="string"){d.push({metadata:c.metadata,body:c.body});continue}let u=await o(c.metadata,c.item_path,c.item_format);d.push({metadata:c.metadata,body:u})}return{documents:d,warnings:[...new Set(s)].sort((c,u)=>c.localeCompare(u))}}function Fr(e,t){let n=t.trim();if(n.length===0)return null;if(n==="score")return e.score;if(n==="matched_fields")return e.matched_fields;if(n.startsWith("item.")){let o=n.slice(5);return o.length===0?null:e.item[o]??null}let r=e,i=e.item;return Object.prototype.hasOwnProperty.call(i,n)?i[n]??null:Object.prototype.hasOwnProperty.call(r,n)?r[n]??null:null}function Mr(e,t){return t.mode==="full"?e.map(({matched_all_terms:n,exact_id_match:r,...i})=>i):e.map(n=>{let r={};for(let i of t.fields)r[i]=Fr(n,i);return r})}function fo(e){let t=pe(e.provider??void 0);return t?.queryExpansion?{providerName:t.providerName,expand:t.queryExpansion}:null}function mo(e){let t=pe(A(e.search?.provider));return t?.rerank?{providerName:t.providerName,rerank:t.rerank}:null}function po(e,t){let n=[],r=er(e),i=Object.keys(r.inlineFilters).length>0;if(i&&r.residualQuery.trim().length===0)throw new p("Inline field:value tokens consumed the entire query, leaving no search terms.",m.USAGE,{examples:["pm search auth tag:area:search","pm list --tag area:search --status open"],nextSteps:["Add keyword terms alongside the inline filters, or use pm list for pure tag/status/type/priority filtering."]});let o=i?r.residualQuery:e,s=tr(t,r.inlineFilters,n);return{query:o,options:s,inlineWarnings:n,highlight:s.highlight===!0,includeLinked:de(s.includeLinked),titleExact:de(s.titleExact),phraseExact:de(s.phraseExact),matchMode:Tn(typeof s.matchMode=="string"?s.matchMode:void 0),minScoreOverride:In(s.minScore),countOnly:s.count===!0,tokens:Pe(o),normalizedQuery:R(o),limit:te(s.limit),projection:qe(s),modeWasExplicit:typeof s.mode=="string"&&s.mode.trim().length>0}}async function ho(e,t){let n=x(process.cwd(),t.path);if(!await F(T(n)))throw new p(`Tracker is not initialized at ${n}. Run pm init first.`,m.NOT_FOUND);let r=await I(n),i=xt(r).settings,o=N(i.schema),s=H(i.schema);De(e.projection,s,e.query);let a=Et(e.options,s,"search"),d=j(i,M()),c=Rt(i),u=It(i,n),l=yr(i),f=_r(i),h=Cn(e.options.semanticWeight),g=Pn(i,c.active?.name??null),y=On(i,c.active?.model??A(i.search?.embedding_model)??"text-embedding-3-small");return{pmRoot:n,settings:i,statusRegistry:o,runtimeFieldRegistry:s,runtimeFieldFilters:a,typeRegistry:d,maxResults:Oe(i),scoreThreshold:e.minScoreOverride??je(i),semanticWeightProvided:e.options.semanticWeight!==void 0,semanticWeightOverride:h,hybridSemanticWeight:h??Ne(i),tuning:He(i),providerResolution:c,vectorResolution:u,extensionSearchProvider:l,extensionVectorAdapter:f,bm25Mode:vr({configuredProvider:A(i.search?.provider),hasEmbeddingProvider:c.active!==null,hasExtensionSearchProvider:l!==null}),queryExpansion:g,queryExpansionExtension:fo(g),rerank:y,rerankExtension:mo(i),effectiveMode:Rn(e.options.mode)}}async function go(e,t){let n=await Ar(t.pmRoot,t.settings.item_format??"toon",t.typeRegistry.type_to_folder,t.settings.schema),r=ee(typeof e.options.status=="string"?e.options.status:void 0,t.statusRegistry,{strict:!0}),i=Kt(t.statusRegistry),o=or(n.documents,e.options,t.typeRegistry,t.runtimeFieldFilters,r,i);return{warnings:n.warnings,allDocuments:n.documents,filteredDocuments:ir(o,e.normalizedQuery,{titleExact:e.titleExact,phraseExact:e.phraseExact||e.matchMode==="exact"})}}async function yo(e,t,n){let r=new Map;if(!e||t!=="keyword"&&t!=="hybrid")return r;let i=process.cwd(),o=await ar(i,it(i)),s=await Promise.all(n.map(async a=>[a.metadata.id,await cr(a,o)]));for(let[a,d]of s)r.set(a,d);return r}async function _o(e,t,n){let r=await yo(e.includeLinked,t.effectiveMode,n),i=e.matchMode==="or";return n.map(o=>hr(o,e.tokens,e.normalizedQuery,e.includeLinked,r,t.tuning,t.settings.id_prefix,i)).filter(o=>o!==null).filter(o=>e.matchMode!=="and"||o.matched_all_terms===!0)}function Vn(e,t){return gr(e.query,e.effectiveMode,e.matchMode,e.options,e.includeLinked,e.scoreThreshold,e.hybridSemanticWeight,e.queryExpansion,e.rerank,e.projection,e.warnings,e.runtimeFieldFilters,t)}async function wo(e,t,n,r,i){if(t.bm25Mode===null||t.effectiveMode==="keyword")return null;let o=Er({requestedMode:t.effectiveMode,query:e.query,filteredDocuments:n,keywordHits:r,corpusFields:Ct(t.settings),bm25Params:$n(t.settings),hybridSemanticWeight:t.hybridSemanticWeight});return t.bm25Mode==="auto-fallback"&&i.push(`search_${t.effectiveMode}_offline_bm25:no_embedding_provider:using_lexical_bm25`),o}async function bo(e,t,n,r){if(!t.extensionSearchProvider)return null;let i=t.providerResolution.active!==null&&(t.vectorResolution.active!==null||t.extensionVectorAdapter!==null);try{let o=await Promise.resolve(t.extensionSearchProvider.query({query:e.query,mode:t.effectiveMode,tokens:e.tokens,options:e.options,settings:t.settings,documents:n}));return wr(t.extensionSearchProvider.providerName,o,r)}catch(o){if(!i)throw new p(`Extension search provider "${t.extensionSearchProvider.providerName}" failed: ${o instanceof Error?o.message:String(o)}`,m.GENERIC_FAILURE);return null}}function vo(e,t,n,r){return t.vectorMatchCount>0?t.hits:(r.push(`search_${e}_degraded:no_vector_matches:results_are_lexical`),e==="semantic"?n:t.hits)}async function Eo(e,t,n,r,i){let o=!e.extensionSearchProvider&&e.providerResolution.active!==null&&(e.vectorResolution.active!==null||e.extensionVectorAdapter!==null);i&&o&&await Zn(e.pmRoot,n,r),e.extensionSearchProvider||Qe(t,e.providerResolution,e.vectorResolution,e.extensionVectorAdapter!==null)}async function So(e){let{prepared:t,runtime:n,filteredDocuments:r,keywordHits:i,warnings:o,modeWasExplicit:s}=e,a=i,d=await wo(t,n,r,i,o),c=n.effectiveMode;if(d!==null||c==="keyword")return{effectiveMode:n.effectiveMode,hits:d??a};try{if(await Eo(n,c,r,o,s),r.length===0||t.limit===0)return{effectiveMode:n.effectiveMode,hits:[]};let u=new Map(r.map(l=>[l.metadata.id,l]));if(a=await bo(t,n,r,u)??a,a===i){let{provider:l,vectorStore:f}=Qe(c,n.providerResolution,n.vectorResolution,n.extensionVectorAdapter!==null),h=await kr({requestedMode:c,query:t.query,filteredDocuments:r,keywordHits:i,hybridSemanticWeight:n.hybridSemanticWeight,limit:t.limit,maxResults:n.maxResults,provider:l,vectorStore:f,extensionVectorAdapter:n.extensionVectorAdapter,queryExpansion:n.queryExpansion,queryExpansionExtension:n.queryExpansionExtension,rerank:n.rerank,rerankExtension:n.rerankExtension,warnings:o,settings:n.settings});a=vo(c,h,i,o)}return{effectiveMode:n.effectiveMode,hits:a}}catch(u){return o.push(Jn(n.effectiveMode,u)),{effectiveMode:"keyword",hits:i}}}function xo(e,t){if(e.projection.mode==="compact"&&e.options.compact===!0)return $e({query:e.query.trim(),mode:e.effectiveMode,items:[],count:t,total:t,count_only:!0,filters:V({mode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,runtimeFieldFilters:e.runtimeFieldFilters})},e.warnings);let n=e.projection.mode==="full"?null:[...e.projection.fields];return $e({query:e.query.trim(),mode:e.effectiveMode,items:[],count:t,total:t,count_only:!0,filters:Q({effectiveMode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,queryExpansion:e.queryExpansion,rerank:e.rerank,runtimeFieldFilters:e.runtimeFieldFilters}),projection:{mode:e.projection.mode,fields:n},now:P()},e.warnings)}function $e(e,t){return t.length===0?e:{...e,warnings:t}}function le(e,t){return t?{...e,workspace_memory:t}:e}function ko(e,t,n){if(!e.highlight)return{hits:n,projection:e.projection};let r=new Map(t.map(o=>[o.metadata.id,o])),i=n.map(o=>({...o,highlights:fr(r.get(o.item.id),o.matched_fields,e.tokens)}));return e.projection.mode==="full"||e.projection.fields.includes("highlights")?{hits:i,projection:e.projection}:{hits:i,projection:{mode:e.projection.mode,fields:[...e.projection.fields,"highlights"]}}}function Ao(e,t,n,r,i,o){let s=r<n?{total:n}:{};if(e.projection.mode==="compact"&&e.options.compact===!0)return $e({query:e.query.trim(),mode:e.effectiveMode,items:t,count:t.length,...s,...o,filters:V({mode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,runtimeFieldFilters:e.runtimeFieldFilters})},e.warnings);let a=i.mode==="full"?null:[...i.fields];return{query:e.query.trim(),mode:e.effectiveMode,items:t,count:t.length,...s,...o,filters:Q({effectiveMode:e.effectiveMode,matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,queryExpansion:e.queryExpansion,rerank:e.rerank,runtimeFieldFilters:e.runtimeFieldFilters}),projection:{mode:i.mode,fields:a},now:P(),...e.warnings.length>0?{warnings:e.warnings}:{}}}function Fo(e){if(e.after!==void 0&&e.count===!0)throw new p("Search --after cannot be combined with --count.",m.USAGE)}async function Rr(e,t,n){Fo(t);let r=po(e,t),i=await ho(r,n),o=await go(r,i),s=o.warnings;s.push(...r.inlineWarnings);let a=await tn(o.allDocuments.map(C=>C.metadata),{pmRoot:i.pmRoot,statusRegistry:i.statusRegistry,now:P()});s.push(...a.warnings);let d=nn(a,r.query);i.effectiveMode==="hybrid"&&i.semanticWeightProvided&&i.semanticWeightOverride===void 0&&s.push("search_hybrid_semantic_weight_override_invalid:using_settings_default");let c={query:r.query,matchMode:r.matchMode,options:r.options,includeLinked:r.includeLinked,titleExact:r.titleExact,phraseExact:r.phraseExact,scoreThreshold:i.scoreThreshold,hybridSemanticWeight:i.hybridSemanticWeight,queryExpansion:i.queryExpansion,rerank:i.rerank,projection:r.projection,warnings:s,runtimeFieldFilters:i.runtimeFieldFilters};if(i.effectiveMode==="keyword"&&(o.filteredDocuments.length===0||r.limit===0&&!r.countOnly))return le(Vn({...c,effectiveMode:i.effectiveMode},r.countOnly),d);let u=await _o(r,i,o.filteredDocuments),l=await So({prepared:r,runtime:i,filteredDocuments:o.filteredDocuments,keywordHits:u,warnings:s,modeWasExplicit:r.modeWasExplicit});if(l.effectiveMode!=="keyword"&&l.hits.length===0&&(o.filteredDocuments.length===0||r.limit===0&&!r.countOnly))return le(Vn({...c,effectiveMode:l.effectiveMode},r.countOnly),d);let f=l.hits.filter(C=>C.exact_id_match===!0||C.score>=i.scoreThreshold),h=pr(f,i.statusRegistry),g=h.length,y=Fn({sorted:h,query:r.query,mode:l.effectiveMode,searchOptions:r.options,limit:r.limit??i.maxResults}),b={...c,effectiveMode:l.effectiveMode};if(r.countOnly)return le(xo(b,g),d);let{hits:_,projection:w}=ko(r,o.filteredDocuments,y.limited),D=Mr(_,w);return le(Ao(b,D,g,y.limited.length,w,y.pageExtras),d)}import Mo from"node:fs/promises";import Xe 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]="b90a064c-f423-5bf7-9fbf-1fb273c7b5af")}catch{}})();var Ro=Xe.join("search","eval-queries.json"),Je={schema:L,examples:[JSON.stringify(ce)],nextSteps:["Create a git-tracked golden-query JSON file that follows the schema, then re-run pm eval."]},Co=new Set(["keyword","semantic","hybrid"]),To=e=>{if(e===void 0)return"keyword";let t=e.trim().toLowerCase();if(!Co.has(t))throw new p("Eval --mode must be one of keyword|semantic|hybrid",m.USAGE);return t},Io=e=>{if(e===void 0||e==="")return Sn;let t=Y(e);if(t===null)throw new p("Eval --k must be a positive integer",m.USAGE);return t},Lo=e=>{if(e===void 0||e==="")return;let t=String(e).trim(),n=Number(t);if([t.length===0,!Number.isFinite(n),n<0,n>1].includes(!0))throw new p("Eval --fail-under must be a number in the range [0, 1]",m.USAGE);return n},q=e=>Math.round(e*1e4)/1e4,qo=async e=>{try{return await Mo.readFile(e,"utf8")}catch{throw new p(`Eval query set not found at ${e}`,m.NOT_FOUND,{...Je,examples:[`echo '${JSON.stringify(ce)}' > ${e}`,"pm eval --queries ./my-eval.json"]})}},Do=(e,t)=>{try{return JSON.parse(e)}catch(n){throw new p(`Eval query set at ${t} is not valid JSON: ${n instanceof Error?n.message:String(n)}`,m.USAGE,Je)}},Po=e=>{try{return Ie(e)}catch(t){throw new p(t instanceof Error?t.message:String(t),m.USAGE,Je)}},Oo=async e=>Po(Do(await qo(e),e)),jo=(e,t)=>t?Xe.resolve(process.cwd(),t):Xe.join(e,Ro),No=async(e,t,n,r)=>{let i=e.mode??t,s=(await Rr(e.query,{mode:i,limit:String(n),fields:"id"},r)).items.map(d=>d.id).filter(d=>typeof d=="string"),a=xn(s,new Set(e.relevant_ids),n);return{metrics:a,report:{query:e.query,mode:i,relevant_total:a.relevant_total,retrieved_relevant:a.retrieved_relevant,ndcg:q(a.ndcg),mrr:q(a.mrr),precision:q(a.precision),recall:q(a.recall)}}},Ho=(e,t,n,r)=>{let i=kn(n);return{k:e,query_count:t.length,aggregate:{ndcg:q(i.ndcg),mrr:q(i.mrr),precision:q(i.precision),recall:q(i.recall)},queries:t,...r!==void 0?{fail_under:r}:{},passed:r===void 0||i.ndcg>=r}},ja=async(e,t)=>{let n=x(process.cwd(),t.path);if(!await F(T(n)))throw new p(`Tracker is not initialized at ${n}. Run pm init first.`,m.NOT_FOUND);let r=Io(e.k),i=To(e.mode),o=Lo(e.failUnder),s=jo(n,e.queries),a=await Oo(s),d=[],c=[];for(let u of a.queries){let{report:l,metrics:f}=await No(u,i,r,t);c.push(f),d.push(l)}return Ho(r,d,c,o)};export{Uo as a,Ko as b,Bo as c,ts as d,yn as e,_n as f,wn as g,$r as h,Me as i,ws as j,bs as k,L as l,mi as m,ce as n,Ie as o,V as p,Q as q,vi as r,Fn as s,Oe as t,je as u,Ne as v,He as w,Yn as x,Xn as y,Aa as z,Rr as A,Ro as B,ja as C};
|
|
5
|
+
//# sourceMappingURL=chunk-OI4XI562.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as sc,b as nt,c as fn,d as ic,e as ac,f as cc}from"./chunk-5UZZAJKR.js";import{A as To,C as lc,a as It,b as vo,d as tc,j as Co}from"./chunk-PVRUN5ZS.js";import{E as da,G as b,Gb as Me,H as la,Hb as xo,I as ma,Jb as nc,K as se,Ka as Wa,L as pa,La as bo,M as on,N as ua,Na as Ka,Nb as Ro,O as uo,Oa as Ya,P as sn,Pa as wo,Q as fo,R as ke,S as _o,T as K,Ta as ln,U as ho,V as de,Vc as Oo,W as fa,X as _a,Y as go,Z as ha,_ as yo,bc as Et,cc as Ao,db as Ja,dc as oc,eb as mn,ec as Ie,fb as Za,ga,gc as rc,hb as Qe,hc as pc,ia as ja,ib as Qa,ic as uc,ja as Ua,jb as pn,jc as fc,la as St,lb as et,ma as Ga,md as $o,na as qa,nd as Po,oa as za,oc as _c,pa as Ha,pb as Eo,pc as hc,pd as kc,qa as Ba,qb as ec,qc as gc,ra as Va,rb as un,rc as yc,sc as bc,uc as wc,vd as Sc,wd as Ic,xd as Ec,yb as tt,zc as vc}from"./chunk-L5Q2CLPE.js";import{$ as Na,A as ya,C as Le,D as ba,E as rn,F as wa,G as Ne,H as va,I as an,J as ka,K as cn,Ka as dn,N as Sa,P as Ia,Q as Ea,Qa as dc,R as xa,S as Ra,T as Aa,U as Ca,V as Ta,W as Oa,X as $a,Y as Pa,Z as Fa,_ as La,aa as Ma,b as sa,ba as Da,xa as kt}from"./chunk-GNFAFIJI.js";import{A as ra,B as ia,Ka as Xa,Rb as ko,T as aa,ab as Se,b as Qi,c as Qt,d as po,e as ea,f as en,g as tn,h as nn,i as ta,jc as So,l as na,n as oa,oc as Io,rc as mc,xa as ca}from"./chunk-UYCLQVL2.js";import{$a as ae,$c as Ce,$f as qt,$h as ai,$k as zi,Bg as oo,C as u,Ca as Gn,Cb as nr,Cc as jt,Ce as Ar,Cg as yt,Da as qn,Db as or,Dc as _t,Dg as so,E as p,Ea as zn,Eb as sr,Ef as Pr,Fa as Hn,Fb as rr,Fk as Oi,G as Qs,Gb as ir,Gc as N,Gh as Wt,H as ve,Hb as ar,Hc as pr,Hf as Je,Hj as wi,Hk as $i,Ib as cr,Ic as to,Id as kr,Ih as Kt,Jd as Sr,Jg as bt,Jh as ni,Jj as vi,Kc as ur,Kd as Ir,Kg as Gr,Kh as oe,Kj as Xt,Lc as fr,Lf as Fr,Lg as qr,Lh as H,Lj as ki,Mb as D,Mg as zr,N as jn,Na as P,Nb as dr,Ng as Hr,Nh as Fe,Nk as Pi,Oa as Mt,Oe as Cr,Oh as oi,Ok as Fi,Ph as si,Pk as Li,Q as S,Qc as Ve,Qe as Tr,Qh as Yt,Qi as lo,Rf as Lr,Rg as Bt,Rh as wt,Rj as Si,Sh as ri,Si as mo,Sk as Ni,T as $t,Tg as Br,Uc as _r,Ug as Vr,Uh as ro,V as er,Va as E,Vc as hr,Vj as Ii,Vk as Mi,W as Pt,Wd as no,Wh as io,Wk as Di,X as Ft,Xc as We,Xd as A,Xk as ji,Y as Lt,Ya as C,Yc as Ae,Yd as Ye,Yf as ce,Yg as Wr,Yk as Ui,Z as Nt,Za as ft,Zc as gr,Zf as Oe,Zj as Ei,Zk as Gi,_c as yr,_h as ii,_j as xi,_k as qi,ad as br,ae as fe,ag as ne,ah as Kr,ai as ci,aj as gi,ak as Ri,al as Hi,bg as $e,bi as di,bj as yi,bl as Bi,c as x,ca as pe,cd as q,cg as Nr,ci as li,cl as Vi,d as He,dg as Pe,dh as he,dk as Ai,dl as Wi,e as Dn,ec as Bn,ed as ht,eg as Mr,ei as mi,el as Ki,f as G,fc as Vn,fd as wr,fi as pi,g as W,gc as Wn,gg as Dr,gh as Yr,gi as ui,h as pt,hg as Xe,hh as Jr,hi as vt,hl as Yi,i as Ws,ic as lr,id as vr,ig as jr,ii as fi,il as Zt,ja as tr,jg as zt,jh as Vt,ji as Jt,jl as Ji,ka as ut,kg as _e,ki as _i,kl as Xi,lg as Ht,lh as Xr,li as ao,lj as bi,m as Ks,ma as Un,mi as co,n as Ys,ne as Er,ng as Ur,ni as hi,nl as O,o as Js,oc as mr,p as Xs,pd as gt,pg as X,pl as Zi,qc as Kn,qe as xr,rb as Dt,rc as Yn,rd as Ke,sc as Jn,sd as Ut,sh as Zr,tc as Xn,te as Rr,tf as Or,uc as Zn,vc as Qn,vd as Gt,vh as R,wb as Be,wc as eo,wd as ue,wf as $r,wg as Ze,wh as Qr,wk as Ci,x as Zs,xc as T,xd as Te,xh as ei,xk as Ti,yh as ti}from"./chunk-DY4DMUMC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var Kg=Ws,Yg=Ks,Jg=Xs,Xg=Ys,Zg=Js;function xc(e,t,n,o){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),r=n.has(s);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:r?"string":"boolean",...r?{value_name:e.value_name??"value"}:{}}}function Rc(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),o=[];for(let s of wi(e.map(r=>({...r})))){o.push(xc(s,s.flag,n,s.short));for(let r of s.aliases??[])o.push(xc(s,r,n))}return o}var Qg=Rc(Xt,gi),Wl=Rc(Zt,yi);import{AsyncLocalStorage as Qh}from"node:async_hooks";import Ll 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]="27dd77f6-e53d-55b7-be15-db0e60eaec4e")}catch{}})();function Ac(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Kl(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Fo(e,t){let n=Kl(t),o=n==="brief"?n:Ac(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Ac(e.filters)?e.filters:{},projection:o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch{}})();async function Cc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return Fe(n,o.item_format,P(o,null).type_to_folder,void 0,o.schema)}(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]="cc342d27-aa2d-5e84-8441-46a35c42dc00")}catch{}})();var Yl=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],_n=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list-all --full --strict-read --no-truncate --output-budget unbounded --json",sdk:"await client.listAllComplete()"}}}};function Lo(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Y(e,t,n,o){t&&e.push({code:n,message:o})}function Jl(e,t){let n=ge(e.completeness)?e.completeness:{};Y(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),Y(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=ge(e.filters)?e.filters:{},s=ge(o.runtime_filters)?o.runtime_filters:{},r=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return Y(t,o.status!=="all"||Object.keys(s).length>0||Object.keys(o).some(i=>!r.has(i)),"filtered_corpus","The list did not explicitly select every lifecycle status."),Y(t,o.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),Y(t,o.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),o}function Xl(e,t,n){Y(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),Y(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=ge(e.projection)?e.projection:{};Y(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let s=ge(e.omission_receipt)?e.omission_receipt:void 0;Y(n,s?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function Zl(e,t){let n=ge(e.read_output)?e.read_output:void 0;Y(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=ge(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;Y(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),Y(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function Ql(e,t){let n=e.map(o=>ge(o)&&typeof o.id=="string"?o.id.trim():"");Y(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),Y(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function Tc(e){if(!ge(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:Yl[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=Jl(t,n);return Xl(t,o,n),Zl(t,n),Ql(t.items,n),{ok:n.length===0,findings:n}}function hn(e){let t=Tc(e);if(!t.ok)throw new _n(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function em(e){hn(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b9eae1a3-3eb6-5415-86c3-a8e8e1fedd1f")}catch{}})();function Oc(e){return e.map(t=>({key:t.key,optionName:wr(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function $c(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard"}))}(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]="7c898a52-eba4-5626-8207-5ffefd4990ba")}catch{}})();var tm=50,Ee=new Map;function No(){Ee.clear()}function Pc(e,t){let n=Ee.get(e);if(n!==void 0)return n;if(Ee.size>=tm){let s=Ee.keys().next().value;Ee.delete(s)}let o=t().catch(s=>{throw Ee.get(e)===o&&Ee.delete(e),s});return Ee.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6f62939a-7b99-5687-93ae-834e0032f1d5")}catch{}})();var nm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function Fc(e){return Object.fromEntries(Cr.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var Mo={ctx:{action:"context"},...nm,...Fc("extension"),...Fc("package")};(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]="41012e87-ed61-56b2-8505-8f786b3952b2")}catch{}})();var Lc="PmCliError";function om(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=u.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function sm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new p(e,om(t.exitCode??u.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Do(e){if(!(e instanceof Error)||e.name!==Lc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as xt}from"node:fs";import{lstat as Nc,mkdir as Uo,open as Mc}from"node:fs/promises";import ye 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]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function jo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Go(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 rm(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function im(e,t,n,o){let s=n.require(e.kind),r=o.outgoingOne.get(`${s.kind}\0${e.source}`);if(r!==void 0&&r!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let i=o.incomingOne.get(`${s.kind}\0${e.target}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let a=Go(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function am(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 cm(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=jo(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:jo(e.relationshipId,"relationshipId"),author:jo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function dm(e,t,n,o,s,r){let i=n.has(t);if(e.action==="add"&&i)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!i)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 a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new Be([a,c],[e.edge],s).edges()[0];return im(d,t,s,r),rm(d)}var Rt=class{#t;#n;#o=[];#r=new Set;#e=new Map;#s={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??Dt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,s=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(s)||s<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 r=n-1;r<o;r+=s)yield Object.freeze(this.#o.slice(r,Math.min(r+s,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,r=0,i;for(let a of this.stream({...o,batchSize:256}))for(let c of a)s=n(s,c),r+=1,i=c;return Object.freeze({state:s,version:i?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:r,...i===void 0?{}:{asOf:i.timestamp}})}#i(t,n){let o=this.#n.require(n.kind);this.#s.identities.set(Go(n,this.#n),t),o.outgoing==="one"&&this.#s.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#s.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#s.identities.delete(Go(t,this.#n)),n.outgoing==="one"&&this.#s.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#s.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=cm(t,this.version,this.#r),o=this.#e.get(n.relationshipId),s=dm(t,n.relationshipId,this.#e,this.#t,this.#n,this.#s),r=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(r),this.#r.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,s),this.#i(n.relationshipId,s)),r}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 r=Date.parse(t.atTimestamp);if(!Number.isFinite(r))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(i=>Date.parse(i.timestamp)<=r)}else{let r=t.atVersion??this.version;if(!Number.isInteger(r)||r<0||r>this.version)throw new TypeError(`Relationship snapshot version out of range: ${r}`);n=this.#o.slice(0,r)}let o=am(n),s=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Er("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(xr(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=Rr(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:r=>r.eventId,snapshot:String(o)});return{version:o,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},lm="relationship-event-store",Dc=xt.O_NOFOLLOW;function gn(e){return X(e,lm,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function De(e,t="relationships/events.jsonl"){let n=ye.resolve(e),o=ye.resolve(n,t),s=ye.relative(n,o);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${ye.sep}`)||ye.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await Uo(n,{recursive:!0}),(await Nc(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of s.split(ye.sep)){i=ye.join(i,a);try{if((await Nc(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Dn(c))break;throw c}}return o}async function yn(e,t,n){let o=new Rt(t,{registry:n}),s,r;try{r=await Mc(e,xt.O_RDONLY|Dc),s=await r.readFile("utf8")}catch(a){if(Dn(a))return{log:o,raw:""};throw a}finally{await r?.close()}let i=s.split(`
|
|
1
|
+
import{a as sc,b as nt,c as fn,d as ic,e as ac,f as cc}from"./chunk-QXSH7BLM.js";import{A as To,C as lc,a as It,b as vo,d as tc,j as Co}from"./chunk-OI4XI562.js";import{Dc as vc,E as da,G as b,Gb as Me,H as la,Hb as xo,I as ma,Jb as nc,K as se,Ka as Wa,L as pa,La as bo,M as on,N as ua,Na as Ka,Nb as Ro,O as uo,Oa as Ya,P as sn,Pa as wo,Q as fo,R as ke,S as _o,T as K,Ta as ln,U as ho,V as de,Vc as Oo,W as fa,X as _a,Y as go,Z as ha,_ as yo,bc as Et,cc as Ao,db as Ja,dc as oc,eb as mn,ec as Ie,fb as Za,ga,gc as rc,hb as Qe,hc as pc,ia as ja,ib as Qa,ic as uc,ja as Ua,jb as pn,jc as fc,la as St,lb as et,ma as Ga,md as $o,na as qa,nd as Po,oa as za,pa as Ha,pb as Eo,pc as _c,pd as kc,qa as Ba,qb as ec,qc as hc,ra as Va,rb as un,rc as gc,sc as yc,tc as bc,vc as wc,vd as Sc,wd as Ic,xd as Ec,yb as tt}from"./chunk-HVFQTLYM.js";import{A as rn,B as wa,C as Ne,D as va,E as an,F as ka,G as cn,Ga as dn,J as Sa,L as Ia,M as Ea,Ma as dc,N as xa,O as Ra,P as Aa,Q as Ca,R as Ta,S as Oa,T as $a,U as Pa,V as Fa,W as La,X as Na,Y as Ma,Z as Da,b as sa,ta as kt,w as ya,y as Le,z as ba}from"./chunk-YBMRWW4E.js";import{A as ra,B as ia,Ka as Xa,Rb as ko,T as aa,ab as Se,b as Qi,c as Qt,d as po,e as ea,f as en,g as tn,h as nn,i as ta,jc as So,l as na,n as oa,oc as Io,rc as mc,xa as ca}from"./chunk-4THEB6PD.js";import{$a as ae,$c as Ce,Bh as R,C as u,Ca as Gn,Cb as nr,Cc as jt,Cf as $r,Cg as Ze,Ch as Qr,Cl as Yi,Da as qn,Db as or,Dc as _t,Dh as ei,Dl as Zt,E as p,Ea as zn,Eb as sr,Eh as ti,El as Ji,Fa as Hn,Fb as rr,Fl as Xi,G as Qs,Gb as ir,Gc as N,H as ve,Hb as ar,Hc as pr,Hg as oo,Ib as cr,Ic as to,Id as kr,Ie as Ar,Ig as yt,Jd as Sr,Jg as so,Kc as ur,Kd as Ir,Kf as Pr,Kl as O,Lc as fr,Mb as D,Mh as Wt,Ml as Zi,N as jn,Na as P,Nb as dr,Nf as Je,Oa as Mt,Oh as Kt,Pg as bt,Ph as ni,Q as S,Qc as Ve,Qg as Gr,Qh as oe,Rf as Fr,Rg as qr,Rh as H,Rk as Ci,Sg as zr,Sk as Ti,T as $t,Tg as Hr,Th as Fe,Uc as _r,Ue as Cr,Uh as oi,V as er,Va as E,Vc as hr,Vh as si,W as Pt,Wd as no,We as Tr,Wh as Yt,Wi as lo,X as Ft,Xc as We,Xd as A,Xf as Lr,Xg as Bt,Xh as wt,Y as Lt,Ya as C,Yc as Ae,Yd as Ye,Yh as ri,Yi as mo,Z as Nt,Za as ft,Zc as gr,Zg as Br,_c as yr,_g as Vr,_h as ro,_k as Oi,ad as br,ae as fe,ai as io,ak as wi,al as $i,c as x,ca as pe,cd as q,cg as ce,ch as Wr,ck as vi,d as He,dg as Oe,dk as Xt,e as Dn,ec as Bn,ed as ht,ei as ii,ek as ki,f as G,fc as Vn,fd as wr,fg as qt,fi as ai,g as W,gc as Wn,gg as ne,gh as Kr,gi as ci,gj as gi,gl as Pi,h as pt,hg as $e,hi as di,hj as yi,hl as Fi,i as Ws,ic as lr,id as vr,ig as Nr,ii as li,il as Li,ja as tr,jg as Pe,jh as he,ka as ut,kg as Mr,ki as mi,kk as Si,li as pi,ll as Ni,m as Ks,ma as Un,mg as Dr,mh as Yr,mi as ui,n as Ys,ng as Xe,nh as Jr,ni as vt,o as Js,oc as mr,og as jr,oi as fi,ok as Ii,ol as Mi,p as Xs,pd as gt,pg as zt,ph as Vt,pi as Jt,pl as Di,qc as Kn,qg as _e,qi as _i,ql as ji,rb as Dt,rc as Yn,rd as Ke,re as Er,rg as Ht,rh as Xr,ri as ao,rj as bi,rl as Ui,sc as Jn,sd as Ut,si as co,sk as Ei,sl as Gi,tc as Xn,tg as Ur,ti as hi,tk as xi,tl as qi,uc as Zn,ue as xr,ul as zi,vc as Qn,vd as Gt,vg as X,vk as Ri,vl as Hi,wb as Be,wc as eo,wd as ue,wl as Bi,x as Zs,xc as T,xd as Te,xe as Rr,xl as Vi,yh as Zr,yk as Ai,yl as Wi,zf as Or,zl as Ki}from"./chunk-GWMXAQOD.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bb16b445-3bd4-520d-becf-c55621bfa186")}catch{}})();var Kg=Ws,Yg=Ks,Jg=Xs,Xg=Ys,Zg=Js;function xc(e,t,n,o){let s=e.flag.slice(2).replace(/[-_]([a-z])/gu,(i,a)=>a.toUpperCase()),r=n.has(s);return{long:t,...o?{short:o}:{},description:e.description??`Standard pm ${e.flag} option.`,...e.required===!0?{required:!0}:{},...e.list===!0?{list:!0}:{},...e.repeatable===!0?{repeatable:!0}:{},value_type:r?"string":"boolean",...r?{value_name:e.value_name??"value"}:{}}}function Rc(e,t=[]){let n=new Set(t.flatMap(s=>s.keys)),o=[];for(let s of wi(e.map(r=>({...r})))){o.push(xc(s,s.flag,n,s.short));for(let r of s.aliases??[])o.push(xc(s,r,n))}return o}var Qg=Rc(Xt,gi),Wl=Rc(Zt,yi);import{AsyncLocalStorage as Qh}from"node:async_hooks";import Ll 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]="27dd77f6-e53d-55b7-be15-db0e60eaec4e")}catch{}})();function Ac(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Kl(e){return e.brief===!0?"brief":typeof e.fields=="string"&&e.fields.trim().length>0||Array.isArray(e.fields)&&e.fields.length>0?"fields":e.compact===!0?"compact":"full"}function Fo(e,t){let n=Kl(t),o=n==="brief"?n:Ac(e.projection)&&typeof e.projection.mode=="string"?e.projection.mode:n;return{...e,query_summary:{filters:Ac(e.filters)?e.filters:{},projection:o}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch{}})();async function Cc(e,t){let n=E(t??process.cwd(),e),o=await R(n);return Fe(n,o.item_format,P(o,null).type_to_folder,void 0,o.schema)}(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]="cc342d27-aa2d-5e84-8441-46a35c42dc00")}catch{}})();var Yl=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],_n=class extends Error{receipt;constructor(t){super(`Complete-list certification failed: ${t.map(n=>n.code).join(", ")}.`),this.name="PmCompleteListValidationError",this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:"pm list-all --full --strict-read --no-truncate --output-budget unbounded --json",sdk:"await client.listAllComplete()"}}}};function Lo(e={}){return{excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0}}function ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Y(e,t,n,o){t&&e.push({code:n,message:o})}function Jl(e,t){let n=ge(e.completeness)?e.completeness:{};Y(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),Y(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let o=ge(e.filters)?e.filters:{},s=ge(o.runtime_filters)?o.runtime_filters:{},r=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return Y(t,o.status!=="all"||Object.keys(s).length>0||Object.keys(o).some(i=>!r.has(i)),"filtered_corpus","The list did not explicitly select every lifecycle status."),Y(t,o.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),Y(t,o.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),o}function Xl(e,t,n){Y(n,e.has_more!==!1||e.next_cursor!==null||e.truncated!==!1||e.applied_limit!==void 0||t.no_truncate!==!0,"page_incomplete","Pagination or a row ceiling may have withheld items."),Y(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let o=ge(e.projection)?e.projection:{};Y(n,o.mode!=="full"||o.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let s=ge(e.omission_receipt)?e.omission_receipt:void 0;Y(n,s?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function Zl(e,t){let n=ge(e.read_output)?e.read_output:void 0;Y(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let o=ge(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;Y(t,n?.result_omitted===!0||o?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),Y(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function Ql(e,t){let n=e.map(o=>ge(o)&&typeof o.id=="string"?o.id.trim():"");Y(t,n.some(o=>o.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),Y(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function Tc(e){if(!ge(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:Yl[0],message:"The result must be an object with an items array."}]};let t=e,n=[],o=Jl(t,n);return Xl(t,o,n),Zl(t,n),Ql(t.items,n),{ok:n.length===0,findings:n}}function hn(e){let t=Tc(e);if(!t.ok)throw new _n(t.findings);let n=e;return{...n,complete_list:{contract_version:1,item_count:n.items.length,unique_item_id_count:new Set(n.items.map(o=>o.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function em(e){hn(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b9eae1a3-3eb6-5415-86c3-a8e8e1fedd1f")}catch{}})();function Oc(e){return e.map(t=>({key:t.key,optionName:wr(t),metadataKey:t.metadata_key,type:t.type,commands:[...t.commands],repeatable:t.repeatable,requiredOnCreate:t.required_on_create,...t.description?{description:t.description}:{}}))}function $c(e){return e.map(t=>({command:t.command,action:t.action,arguments:t.arguments.map(n=>({name:n.name,required:n.required===!0,variadic:n.variadic===!0,description:n.description})),description:t.description,tier:t.tier??"standard"}))}(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]="7c898a52-eba4-5626-8207-5ffefd4990ba")}catch{}})();var tm=50,Ee=new Map;function No(){Ee.clear()}function Pc(e,t){let n=Ee.get(e);if(n!==void 0)return n;if(Ee.size>=tm){let s=Ee.keys().next().value;Ee.delete(s)}let o=t().catch(s=>{throw Ee.get(e)===o&&Ee.delete(e),s});return Ee.set(e,o),o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6f62939a-7b99-5687-93ae-834e0032f1d5")}catch{}})();var nm={"list-all":{action:"list",options:{excludeTerminal:!1}},"list-draft":{action:"list",options:{status:"draft",excludeTerminal:!1}},"list-open":{action:"list",options:{status:"open",excludeTerminal:!1}},"list-in-progress":{action:"list",options:{status:"in_progress",excludeTerminal:!1}},"list-blocked":{action:"list",options:{status:"blocked",excludeTerminal:!1}},"list-closed":{action:"list",options:{status:"closed",excludeTerminal:!1}},"list-canceled":{action:"list",options:{status:"canceled",excludeTerminal:!1}}};function Fc(e){return Object.fromEntries(Cr.map(t=>[`${e}-${t}`,{action:e,options:{[t==="adopt-all"?"adoptAll":t]:!0,...e==="package"?{vocabulary:"package"}:{}}}]))}var Mo={ctx:{action:"context"},...nm,...Fc("extension"),...Fc("package")};(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]="41012e87-ed61-56b2-8505-8f786b3952b2")}catch{}})();var Lc="PmCliError";function om(e){if(!Number.isFinite(e))throw new TypeError("createPmCliExpectedError options.exitCode must be a finite number");let t=Math.trunc(e);if(t<=u.SUCCESS)throw new TypeError("createPmCliExpectedError options.exitCode must be a positive exit code");return t}function sm(e,t={}){if(typeof e!="string"||e.trim().length===0)throw new TypeError("createPmCliExpectedError message must be a non-empty string");let n=new p(e,om(t.exitCode??u.USAGE),t.context??{});return"cause"in t&&Object.defineProperty(n,"cause",{value:t.cause,enumerable:!1,configurable:!0,writable:!0}),n}function Do(e){if(!(e instanceof Error)||e.name!==Lc)return!1;let t=e;return typeof t.exitCode=="number"&&Number.isFinite(t.exitCode)}import{constants as xt}from"node:fs";import{lstat as Nc,mkdir as Uo,open as Mc}from"node:fs/promises";import ye 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]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch{}})();function jo(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Go(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 rm(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function im(e,t,n,o){let s=n.require(e.kind),r=o.outgoingOne.get(`${s.kind}\0${e.source}`);if(r!==void 0&&r!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${s.kind}`);let i=o.incomingOne.get(`${s.kind}\0${e.target}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${s.kind}`);let a=Go(e,n),c=o.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function am(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 cm(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=jo(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:jo(e.relationshipId,"relationshipId"),author:jo(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function dm(e,t,n,o,s,r){let i=n.has(t);if(e.action==="add"&&i)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!i)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 a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!o.has(a)||!o.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new Be([a,c],[e.edge],s).edges()[0];return im(d,t,s,r),rm(d)}var Rt=class{#t;#n;#o=[];#r=new Set;#e=new Map;#s={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??Dt()}get version(){return this.#o.length}events(){return Object.freeze([...this.#o])}*stream(t={}){let n=t.fromVersion??1,o=t.toVersion??this.version,s=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(s)||s<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 r=n-1;r<o;r+=s)yield Object.freeze(this.#o.slice(r,Math.min(r+s,o)))}project(t,n,o={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let s=t,r=0,i;for(let a of this.stream({...o,batchSize:256}))for(let c of a)s=n(s,c),r+=1,i=c;return Object.freeze({state:s,version:i?.sequence??Math.max(0,(o.fromVersion??1)-1),processed:r,...i===void 0?{}:{asOf:i.timestamp}})}#i(t,n){let o=this.#n.require(n.kind);this.#s.identities.set(Go(n,this.#n),t),o.outgoing==="one"&&this.#s.outgoingOne.set(`${o.kind}\0${n.source}`,t),o.incoming==="one"&&this.#s.incomingOne.set(`${o.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#s.identities.delete(Go(t,this.#n)),n.outgoing==="one"&&this.#s.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#s.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=cm(t,this.version,this.#r),o=this.#e.get(n.relationshipId),s=dm(t,n.relationshipId,this.#e,this.#t,this.#n,this.#s),r=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...s===void 0?{}:{edge:s},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#o.push(r),this.#r.add(n.eventId),o&&this.#a(o),t.action==="remove"?this.#e.delete(n.relationshipId):(this.#e.set(n.relationshipId,s),this.#i(n.relationshipId,s)),r}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 r=Date.parse(t.atTimestamp);if(!Number.isFinite(r))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#o.filter(i=>Date.parse(i.timestamp)<=r)}else{let r=t.atVersion??this.version;if(!Number.isInteger(r)||r<0||r>this.version)throw new TypeError(`Relationship snapshot version out of range: ${r}`);n=this.#o.slice(0,r)}let o=am(n),s=new Be(this.#t,o.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:s.edges(),graph:s})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=Er("relationship-events",{order:"append-sequence"}),o=t.cursor===void 0?this.version:Number(xr(t.cursor,n).snapshot);if(!Number.isSafeInteger(o)||o<0||o>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let s=Rr(this.#o.slice(0,o),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:r=>r.eventId,snapshot:String(o)});return{version:o,events:s.rows,hasMore:s.has_more,...s.next_cursor?{nextCursor:s.next_cursor}:{}}}},lm="relationship-event-store",Dc=xt.O_NOFOLLOW;function gn(e){return X(e,lm,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function De(e,t="relationships/events.jsonl"){let n=ye.resolve(e),o=ye.resolve(n,t),s=ye.relative(n,o);if(s.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(s===".."||s.startsWith(`..${ye.sep}`)||ye.isAbsolute(s))throw new TypeError("Relationship event path must stay within the tracker root");if(await Uo(n,{recursive:!0}),(await Nc(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let i=n;for(let a of s.split(ye.sep)){i=ye.join(i,a);try{if((await Nc(i)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(Dn(c))break;throw c}}return o}async function yn(e,t,n){let o=new Rt(t,{registry:n}),s,r;try{r=await Mc(e,xt.O_RDONLY|Dc),s=await r.readFile("utf8")}catch(a){if(Dn(a))return{log:o,raw:""};throw a}finally{await r?.close()}let i=s.split(`
|
|
2
2
|
`);for(let a=0;a<i.length;a+=1){let c=i[a].trim();if(!c)continue;let d;try{d=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${a+1}`)}if(d.sequence!==o.version+1)throw new TypeError(`Invalid relationship event sequence at line ${a+1}`);o.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:o.version})}return{log:o,raw:s}}function mm(e,t,n,o){let s=Date.parse(t.timestamp),r;return t.action!=="remove"&&t.edge!==void 0&&(r=new Be(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(s)&&e.timestamp===new Date(s).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&D(e.edge)===D(r)}var bn=class e{#t;#n;#o;#r;#e;constructor(t,n,o,s){this.#t=t.pmRoot,this.#n=n,this.#o=t.registry,this.#r=o,this.#e=s}static async open(t){let n=Object.freeze([...t.nodes]),o=await De(t.pmRoot,t.relativePath),s=await gn(t.pmRoot);try{await De(t.pmRoot,o);let{log:r}=await yn(o,n,t.registry);return new e(t,n,o,r)}finally{await s()}}get path(){return this.#r}async currentVersion(){return this.#e=await this.#s(),this.#e.version}async append(t){let n=await gn(this.#t);try{let o=await De(this.#t,this.#r),{log:s}=await yn(o,this.#n,this.#o),r=s.append(t);await Uo(ye.dirname(o),{recursive:!0}),await De(this.#t,o);let i=await Mc(o,xt.O_APPEND|xt.O_CREAT|xt.O_WRONLY|Dc);try{await i.appendFile(`${JSON.stringify(r)}
|
|
3
3
|
`,"utf8")}finally{await i.close()}return this.#e=s,r}finally{await n()}}async appendBatch(t,n={}){let o=await gn(this.#t);try{let s=await De(this.#t,this.#r),{log:r,raw:i}=await yn(s,this.#n,this.#o),a=r.version,c=new Map(r.events().map(m=>[m.eventId,m])),d=[],l=[];for(let m of t){let f=m.eventId.trim(),_=c.get(f);if(_!==void 0){if(n.existingEventPolicy==="skip_identical"&&mm(_,m,this.#n,this.#o)){l.push(_.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let h=r.append(m);c.set(h.eventId,h),d.push(h)}if(d.length>0){let m=i.length===0||i.endsWith(`
|
|
4
4
|
`)?i:`${i}
|
|
@@ -2088,5 +2088,5 @@ end`}var xh={bash:'Add to ~/.bashrc or ~/.bash_profile: eval "$(pm completion ba
|
|
|
2088
2088
|
`)}catch{}}function Oh(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 $h(e,t,n,o){let s=[];return{candidates:await ni(e,t,n,s,o),warnings:s}}async function Bs(e,t,n,o,s){let r=Ve(T()),i=[];for(let a of t)if(!(s&&!s.has(a.metadata.id))){if(typeof a.body=="string"){i.push({metadata:a.metadata,body:a.body});continue}try{let c=await Ah.readFile(a.item_path,"utf8"),d=Gt(c,{format:a.item_format,schema:n,extensionFieldNames:r,onWarning:l=>o.push(l)});i.push({metadata:a.metadata,body:d.body})}catch{o.push(`item_list_item_read_failed:${Ot.relative(e,a.item_path)}`),i.push({metadata:a.metadata,body:""})}}return i}function Ph(e,t,n){let o=e.metadata;return{id:o.id,mode:t,updated_at:o.updated_at,corpus:ii(e,{fields:n})}}var lt=Qs;function Fh(e){let t=T(),n=lt(e.search?.provider);if(!n)return null;let o=_r(t,n);if(!o)return null;let s=o.runtime_definition??o.definition,r=lt(s.name)??lt(o.definition.name);if(!r)return null;let i=s.embedBatch,a=s.embed_batch,c=s.embed,d=typeof i=="function"?i:typeof a=="function"?a:void 0,l=typeof c=="function"?c:void 0;return!d&&!l?null:{name:r,embedBatch:d,embed:l}}function Lh(e){let t=T(),n=lt(e.vector_store?.adapter);if(!n)return null;let o=hr(t,n);if(!o)return null;let s=o.runtime_definition??o.definition,r=lt(s.name)??lt(o.definition.name);if(!r)return null;let i=s.upsert,a=s.delete;return{adapterName:r,...typeof i=="function"?{upsert:i}:{},...typeof a=="function"?{delete:a}:{}}}function Hs(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 Nh(e,t,n){let o=t.search?.embedding_model?.trim()||"text-embedding-3-small";if(e.embedBatch){let r=await Promise.resolve(e.embedBatch({inputs:n,settings:t,model:o}));if(!Array.isArray(r))throw new p(`Extension search provider "${e.name}" embedBatch must return an array of vectors`,u.GENERIC_FAILURE);return r.map((i,a)=>Hs(i,`extension search provider "${e.name}" embedBatch output at index ${a}`))}if(!e.embed)throw new p(`Extension search provider "${e.name}" does not implement embed/embedBatch`,u.GENERIC_FAILURE);let s=[];for(let[r,i]of n.entries()){let a=await Promise.resolve(e.embed({input:i,settings:t,model:o}));s.push(Hs(a,`extension search provider "${e.name}" embed output at index ${r}`))}return s}function Ol(e){return e.search?.embedding_model?.trim()||"text-embedding-3-small"}function $l(e,t,n){let o=n?vt(n.name,Ol(e)):t?vt(t.name,t.model):null;if(!o)throw new p("No embedding identity available for semantic reindex mode",u.USAGE);return o}function Mh(e,t){return Object.keys(e).filter(n=>!t.has(n)).sort((n,o)=>n.localeCompare(o))}async function Pl(e,t,n,o,s,r,i,a){let c=o?.name??n?.name,d=ai(c,e.search.embedding_corpus_max_characters).maxCharacters,l=io(e),m=s.map(h=>ci(h,{providerName:c,maxCharacters:d,fields:l})),f=[],_=null;if(o)try{f=await Nh(o,e,m),_=vt(o.name,Ol(e))}catch(h){if(!n)throw new p(`Extension search provider "${o.name}" failed to generate embeddings: ${h instanceof Error?h.message:String(h)}`,u.GENERIC_FAILURE);r.push(`Extension search provider "${o.name}" failed; falling back to built-in provider (${h instanceof Error?h.message:String(h)})`)}if(f.length===0){if(!n)throw new p(`No embedding executor available for reindex mode '${t}'`,u.USAGE);let h=await di(n,e,m,{onProgress:w=>{w.phase==="complete"&&(i.batches_completed=w.batch_index),M(a,`embedding_batch_${w.phase} batch=${w.batch_index}/${w.batch_total} size=${w.batch_size} completed_inputs=${w.completed_inputs}/${w.total_inputs}`)}});r.push(...h.warnings),f=h.vectors,_=vt(n.name,n.model)}if(M(a,`embedding_complete vectors=${f.length}`),f.length!==s.length)throw new p(`Embedding output size mismatch (expected ${s.length}, received ${f.length})`,u.GENERIC_FAILURE);if(!_)throw new p(`No embedding identity available for reindex mode '${t}'`,u.USAGE);return{vectors:f,embeddingIdentity:_}}async function Dh(e,t,n,o,s,r){let i=Object.keys(n);if(t){if(i.length>0&&t.delete)try{await Promise.resolve(t.delete({ids:i.sort((a,c)=>a.localeCompare(c)),settings:o}))}catch(a){throw new p(`Extension vector adapter "${t.adapterName}" failed to delete vectors during reindex reset: ${a instanceof Error?a.message:String(a)}`,u.GENERIC_FAILURE)}else i.length>0&&s.push(`search_semantic_reindex_reset_skipped:adapter=${t.adapterName}:known_ids=${i.length}`);if(!e)return}e&&await ui(e,i,{},r)}async function Fl(e,t,n,o,s){if(n.length!==0){if(t){if(t.delete)try{await Promise.resolve(t.delete({ids:n,settings:o}))}catch(r){throw new p(`Extension vector adapter "${t.adapterName}" failed to delete orphan vectors during reindex: ${r instanceof Error?r.message:String(r)}`,u.GENERIC_FAILURE)}else s.push(`search_semantic_reindex_orphan_prune_skipped:adapter=${t.adapterName}:count=${n.length}`);if(!e)return}e&&await pi(e,n)}}function jh(e){return{enabled:e!=="keyword",stale_items:0,unchanged_items:0,embedded_items:0,vector_upserted:0,batches_completed:0}}function Uh(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 Gh(e){if(e.requestedMode==="keyword")return{activeEmbeddingProvider:null,activeVectorStore:null};let t=ro(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=li(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 qh(e){let t=P(e.settings,T()),n=await $h(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 zh(e){let t=await co(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 $l(e.settings,ro(e.settings).active,e.extensionEmbedding)}catch{return null}})();n&&Jt(t.embedding,n)&&(e.reindexWarnings.push("search_semantic_reindex_requires_rebuild:embedding_identity_changed"),e.reindexWarnings.push(Ch))}async function Hh(e){let t=await co(e.pmRoot);e.semanticWarnings.push(...t.warnings);let n=$l(e.settings,e.activeEmbeddingProvider,e.extensionEmbedding),o=new Set(e.metadataDocuments.map(d=>d.metadata.id)),s=Mh(t.entries,o),r=Jt(t.embedding,n);e.forceFullSemantic&&!r&&e.semanticWarnings.push("search_semantic_reindex_full_rebuild_forced");let i=e.forceFullSemantic||r?e.metadataDocuments:e.metadataDocuments.filter(d=>t.entries[d.metadata.id]!==d.metadata.updated_at),a=new Set(i.map(d=>d.metadata.id)),c=a.size>0?await Bs(e.pmRoot,e.documentCandidates,e.settings.schema,e.reindexWarnings,a):[];return{ledgerEntries:t.entries,ledgerEmbedding:t.embedding,orphanIds:s,resetRequired:r,staleDocuments:c,freshDocuments:e.metadataDocuments.length-c.length}}async function Bh(e){let t=new Set(e.metadataDocuments.map(s=>s.metadata.id)),n=await Bs(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 Pl(e.settings,e.requestedMode,e.activeEmbeddingProvider,e.extensionEmbedding,n,e.semanticWarnings,e.semanticSummary,e.progressEnabled);return{...o,staleDocuments:n,vectorDimension:ao(o.vectors,"Reindex embeddings")}}async function Vh(e){let t=await Pl(e.settings,e.requestedMode,e.activeEmbeddingProvider,e.extensionEmbedding,e.staleDocuments,e.semanticWarnings,e.semanticSummary,e.progressEnabled),n=t.vectors,o=t.embeddingIdentity,s=ao(n,"Reindex embeddings");if(!(!e.resetRequired&&(Jt(e.ledgerEmbedding,o)||_i(e.ledgerEmbedding,s))))return{vectors:n,embeddingIdentity:o,staleDocuments:e.staleDocuments,vectorDimension:s,resetRequired:e.resetRequired};let i=await Bh(e);return n=i.vectors,o=i.embeddingIdentity,s=i.vectorDimension,{vectors:n,embeddingIdentity:o,staleDocuments:i.staleDocuments,vectorDimension:s,resetRequired:!0}}async function Wh(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 mi(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 Kh(e,t){return e.map((n,o)=>({id:n.metadata.id,vector:Hs(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 Yh(e){M(e.progressEnabled,`embedding_start items=${e.plan.staleDocuments.length} unchanged_items=${e.plan.freshDocuments}`);let t=await Vh({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 Dh(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 Fl(e.activeVectorStore,e.extensionVectorAdapter,e.plan.orphanIds,e.settings,e.semanticWarnings);let n=Kh(t.staleDocuments,t.vectors);return e.semanticSummary.embedded_items=t.vectors.length,await Wh({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:fi(t.embeddingIdentity,t.vectorDimension)}}async function Jh(e){let t=await Hh(e);e.semanticSummary.stale_items=t.staleDocuments.length,e.semanticSummary.unchanged_items=t.freshDocuments;let n=Object.fromEntries(e.metadataDocuments.map(r=>[r.metadata.id,r.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 Fl(e.activeVectorStore,e.extensionVectorAdapter,t.orphanIds,e.settings,e.semanticWarnings),{documentsForKeywordArtifacts:e.documentsForKeywordArtifacts,vectorizationLedgerEntries:n,vectorizationEmbeddingMetadata:t.ledgerEmbedding};let o=await Yh({...e,plan:t});t.freshDocuments>0&&e.semanticWarnings.push(`search_semantic_reindex_skipped_unchanged:count=${t.freshDocuments}`);let s=new Map(o.staleDocuments.map(r=>[r.metadata.id,r]));return{documentsForKeywordArtifacts:e.metadataDocuments.map(r=>s.get(r.metadata.id)??r),vectorizationLedgerEntries:n,vectorizationEmbeddingMetadata:o.embeddingMetadata}}async function Xh(e){let t=Ot.join(e.pmRoot,qs),n=Ot.join(e.pmRoot,zs),o=io(e.settings),s=e.documentsForKeywordArtifacts.map(i=>JSON.stringify(Ph(i,e.mode,o))).join(`
|
|
2089
2089
|
`);M(e.progressEnabled,"writing keyword artifacts"),await W(t,`${JSON.stringify(e.manifest,null,2)}
|
|
2090
2090
|
`),await W(n,`${s}
|
|
2091
|
-
`);let r=[];if(e.mode!=="keyword")try{M(e.progressEnabled,"writing vectorization status ledger"),await hi(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(i){r.push(`search_vectorization_status_ledger_write_failed:${i instanceof Error?i.message:String(i)}`)}return r}async function Zh(e,t){let n=Oh(e.mode),o=Th(e),s=e.full===!0;M(o,`start mode=${n}`);let r=E(process.cwd(),t.path);if(!await x(C(r)))throw new p(`Tracker is not initialized at ${r}. Run pm init first.`,u.NOT_FOUND);let i=ei(await R(r)).settings,a=null;try{a=await X(r,ti,i.locks.ttl_seconds,A(void 0,"pm-reindex"),!1,i.governance.force_required_for_stale_lock,i.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=Fh(i),d=Lh(i),l=Gh({requestedMode:n,pmRoot:r,settings:i,extensionEmbedding:c,extensionVectorAdapter:d}),m=n;M(o,"loading item corpus");let f=await qh({pmRoot:r,settings:i}),_=f.warnings,{documentCandidates:h,metadataDocuments:w}=f;M(o,`loaded_items=${w.length}`);let y=S(),g=Uh(m,y,w),k=Ot.join(r,qs),I=Ot.join(r,zs),F=m==="keyword"?await Bs(r,h,i.schema,_):w,$=[],B={},j=null,te=jh(m);if(m==="keyword"&&await zh({pmRoot:r,settings:i,forceFullSemantic:s,extensionEmbedding:c,reindexWarnings:_}),m!=="keyword"){let U=await Jh({pmRoot:r,settings:i,requestedMode:n,activeEmbeddingProvider:l.activeEmbeddingProvider,activeVectorStore:l.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:d,documentCandidates:h,metadataDocuments:w,documentsForKeywordArtifacts:F,forceFullSemantic:s,reindexWarnings:_,semanticWarnings:$,semanticSummary:te,progressEnabled:o});F=U.documentsForKeywordArtifacts,B=U.vectorizationLedgerEntries,j=U.vectorizationEmbeddingMetadata}let V=await Xh({pmRoot:r,mode:m,manifest:g,documentsForKeywordArtifacts:F,settings:i,vectorizationLedgerEntries:B,vectorizationEmbeddingMetadata:j,progressEnabled:o}),ie=[...await N({path:k,scope:"project",op:"reindex:manifest"}),...await N({path:I,scope:"project",op:"reindex:embeddings"}),...await ur({mode:m,total_items:w.length})];return M(o,"done"),{ok:!0,mode:m,total_items:w.length,semantic:te,artifacts:{manifest:qs,embeddings:zs},warnings:[..._,...$,...V,...ie],generated_at:y}}finally{await a?.()}}(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]="48d9b905-70a1-52c3-9b9c-33624661e6eb")}catch{}})();var jl=Symbol("pm.active-extension-host-context");function ee(e){return{fullChangedFields:!0,options:e}}var v=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[jl]=!0,n}run(t,n={}){return ag({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return Cc(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return hn(await this.list(Lo(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})}append(t,n,o={}){return this.runTyped("append",{id:t,...ee({...o,body:n})})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,s,r={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...s===void 0?{}:{value:s},options:r})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,s){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...s?{fieldTypeScope:s}:{}}})}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}})}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={},s,r){return this.runTyped("plan",{...n===void 0?{}:{id:n},...s===void 0?{}:{stepRef:s},...r===void 0?{}:{reorderTo:r},options:{...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,s={}){return this.plan("reorder-step",t,s,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",ee(t))}update(t,n={}){return this.runTyped("update",{id:t,...ee(n)})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...ee(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...ee(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...ee(t)})}release(t,n={}){return this.runTyped("release",{id:t,...ee(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...ee(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...ee(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},...ee(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...ee(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...ee(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...ee(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 vE(e={},t={}){return new v(t).context(e)}function kE(e={},t={}){return new v(t).list(e)}function SE(e={},t={}){return new v(t).listAllComplete(e)}function IE(e,t={},n={}){return new v(n).search(e,t)}function EE(e,t={},n={}){return new v(n).get(e,t)}function xE(e={},t={}){return new v(t).next(e)}function RE(e={},t={}){return new v(t).aggregate(e)}function AE(e={},t={}){return new v(t).stats(e)}function CE(e={},t={}){return new v(t).duplicates(e)}function TE(e,t={},n={}){return new v(n).comments(e,t)}function OE(e,t={},n={}){return new v(n).notes(e,t)}function $E(e,t={},n={}){return new v(n).learnings(e,t)}function PE(e,t={},n={}){return new v(n).files(e,t)}function FE(e,t={},n={}){return new v(n).filesDiscover(e,t)}function LE(e,t={}){return new v(t).filesLookup(e)}function NE(e,t={},n={}){return new v(n).docs(e,t)}function ME(e,t={},n={}){return new v(n).deps(e,t)}function DE(e,t={},n={},o={}){return new v(o).graph(e,t,n)}function jE(e,t,n={},o={}){return new v(o).append(e,t,n)}function UE(e,t={},n={}){return new v(n).init(e,t)}function GE(e,t,n,o,s={},r={}){return new v(r).config(e,t,n,o,s)}function qE(e,t={},n={}){return new v(n).schema(e,t)}function zE(e={}){return new v(e).schemaList()}function HE(e,t={}){return new v(t).schemaShow(e)}function BE(e,t={},n={}){return new v(n).schemaAddType(e,t)}function VE(e,t={},n={}){return new v(n).schemaRemoveType(e,t)}function WE(e,t={},n={}){return new v(n).schemaAddStatus(e,t)}function KE(e,t={},n={}){return new v(n).schemaRemoveStatus(e,t)}function YE(e,t={},n={}){return new v(n).schemaAddField(e,t)}function JE(e,t={},n={}){return new v(n).schemaRemoveField(e,t)}function XE(e={}){return new v(e).schemaListFields()}function ZE(e,t={}){return new v(t).schemaShowField(e)}function QE(e,t={},n={}){return new v(n).schemaApplyPreset(e,t)}function ex(e={},t={}){return new v(t).schemaInferTypes(e)}function tx(e,t,n,o={}){return new v(o).schemaRenameType(e,t,n)}function nx(e,t,n,o,s={}){return new v(s).schemaRenameField(e,t,n,o)}function ox(e,t,n,o={}){return new v(o).schemaRemapStatus(e,t,n)}function sx(e,t={}){return new v(t).schemaShowStatus(e)}function rx(e,t={},n={}){return new v(n).profile(e,t)}function ix(e={}){return new v(e).profileList()}function ax(e,t={}){return new v(t).profileShow(e)}function cx(e,t={},n={}){return new v(n).profileApply(e,t)}function dx(e,t={}){return new v(t).profileLint(e)}function lx(e={},t={}){return new v(t).validate(e)}function mx(e={},t={}){return new v(t).health(e)}function px(e={},t={}){return new v(t).gc(e)}function ux(e,t,n={}){return new v(n).historyRedact(e,t)}function fx(e,t={},n={}){return new v(n).historyRepair(e,t)}function _x(e={},t={}){return new v(t).historyRepairAll(e)}function hx(e,t={},n={}){return new v(n).historyCompact(e,t)}function gx(e,t={}){return new v(t).historyCompactBulk(e)}function yx(e={},t={}){return new v(t).create(e)}function bx(e,t={},n={}){return new v(n).update(e,t)}function wx(e,t,n={},o={}){return new v(o).close(e,t,n)}function vx(e,t={},n={}){return new v(n).claim(e,t)}function kx(e={},t={}){return new v(t).claimNext(e)}function Sx(e,t={},n={}){return new v(n).release(e,t)}function Ix(e,t={},n={}){return new v(n).copy(e,t)}function Ex(e,t={},n={}){return new v(n).delete(e,t)}function xx(e,t,n={},o={}){return new v(o).restore(e,t,n)}function Rx(e,t={},n={}){return new v(n).focus(e,t)}function Ax(e,t={},n={}){return new v(n).startTask(e,t)}function Cx(e,t={},n={}){return new v(n).pauseTask(e,t)}function Tx(e,t,n={},o={}){return new v(o).closeTask(e,t,n)}function Ox(e,t={},n={}){return new v(n).extension(e,t)}function $x(e={},t={}){return new v(t).extensionList(e)}function Px(e,t={},n={}){return new v(n).extensionActivate(e,t)}function Fx(e,t={},n={}){return new v(n).extensionDeactivate(e,t)}function Lx(e,t={},n={}){return new v(n).package(e,t)}function Nx(e={},t={}){return new v(t).packageList(e)}function Mx(e,t={},n={}){return new v(n).packageInstall(e,t)}function Dx(e,t={},n={}){return new v(n).packageUninstall(e,t)}function jx(e={},t={}){return new v(t).packageDoctor(e)}function Ux(e,t={},n={}){return new v(n).packageManage(e,t)}function Gx(e,t={},n={}){return new v(n).packageDescribe(e,t)}function qx(e={},t={}){return new v(t).packageReload(e)}function zx(e={},t={}){return new v(t).packageCatalog(e)}function Hx(e,t={},n={}){return new v(n).packageActivate(e,t)}function Bx(e,t={},n={}){return new v(n).packageDeactivate(e,t)}function Vx(e,t={},n={}){return new v(n).upgrade(e,t)}function eg(e,t,n){return JSON.stringify([Ll.resolve(e),Ll.resolve(n??process.cwd()),t.extensions.enabled,t.extensions.disabled,t.extensions.policy])}async function tg(e,t,n){let o=eg(e,t,n);return Pc(o,()=>Gg(e,t,n))}async function Wx(e,t={}){let n=await R(e),o=t.extensionRegistrations??(t.noExtensions===!0?null:await tg(e,n,t.cwd)),s=P(n,o),r=q(n.schema),i=ht(n.schema);return{types:[...s.types],statuses:r.definitions.map(a=>a.id),openStatus:r.open_status,closeStatus:r.close_status,canceledStatus:r.canceled_status,fields:Oc(i.definitions),extensionCommands:$c(o?.commands??[])}}async function Kx(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 Oo(n,o)}function me(e,t){let n=b(e,t);if(!n)throw new p(`Missing required argument: ${t}`,64);return n}var Nl=lr(),Ul=new Qh;function Ln(){Kn(nr()),Yn(or()),Jn(sr()),Xn(rr()),Zn(ir()),Qn(ar()),eo(cr())}async function Gl(e,t,n,o){return mr(()=>t===void 0?Nl.read(()=>Ml(e,n,o)):Nl.write(()=>og(t,()=>Ml(e,n,o))))}async function Yx(e,t){let n=e.cwd,o=n??process.cwd();return Gl(on({path:e.path,noExtensions:e.noExtensions}),n,o,()=>Ul.run(!0,t))}async function Ml(e,t,n){let o=E(t,e.path);if(e.noExtensions)return Ln(),Ho({pmRoot:o},()=>n(null));if(!await x(C(o)))return Ln(),n(null);let s=null,r;try{let i=await R(o),a=await Bn({pmRoot:o,settings:i,cwd:t,noExtensions:!1}),c=await Wn({...a,loaded:a.loaded});r={loadResult:a,activationResult:c},Kn(c.hooks),Yn(c.commands),Jn(c.parsers),Xn(c.preflight),Zn(c.services),Qn(c.renderers),eo(c.registrations),s={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:a.loaded}}catch(i){Ln(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",i)}try{return await Ho({pmRoot:o,packages:s?.packages},()=>n(s))}finally{Ln(),r&&await Vn(r.loadResult,r.activationResult).catch(()=>{})}}async function ng(e,t,n,o,s){if(!s)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let r=ke(e),a=s.registrations.commands.find(d=>ke(d.action)===r)?.command??s.commands.handlers.find(d=>ke(d.command)===r)?.command;if(!a)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let c=await fr({command:_o(a),args:K(n.args??t.args),options:ho(t,n),global:o,pm_root:s.pmRoot,sdk:jc(s.pmRoot,v.forActiveExtensionHost({pmRoot:s.pmRoot,author:typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension"}))});if(!c.handled){let d=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${d}`,u.USAGE)}return c.result}async function og(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}var sg=new Set(["activity","aggregate","context","contracts","deps","files-discover","get","graph","health","history","list","next","search","stats","telemetry","validate"]);function rg(e){let t=me(e,"action"),n=ke(t),o=mt(Mo,n),s=o?.action??n,r={...e,action:s};return o?.options!==void 0&&(r.options={...o.options,...jn(e.options)}),s==="package"&&(r.options={...jn(r.options),vocabulary:"package"}),{action:s,args:r}}function ig(e){return!sg.has(ke(e))}async function ag(e){let t=rg(e),n=on(t.args),o=ig(t.action),s=b(t.args,"cwd"),r=s??process.cwd();try{return e[jl]===!0||Ul.getStore()===!0?await Dl(t.action,t.args,n,null):await Gl(n,s,r,i=>Dl(t.action,t.args,n,i))}finally{o&&No()}}function mt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Nn(e){return b(e.args,"target")??b(e.options,"target")}function L(e,t=e.options){return e.id??me(t,"id")}async function cg(e){let t=Je("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Fo(await Se(b(e.args,"status")??b(t,"status"),t,e.global),t)}async function dg(e){let t=Je("search",e.options);return t.compact===void 0&&t.full===void 0&&t.fields===void 0&&(t.compact=!0),Fo(await To(me(e.args,"query"),t,e.global),t)}async function lg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options);return fe(await Et(o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function mg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options),s={...o,...o.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...o.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return fe(await ds(L(e,s),s,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function pg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options);return fe(await Ie(L(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function ug(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options),s=b(e.args,"reason")??b(e.args,"text")??b(o,"reason")??b(o,"text");return fe(await tt(L(e,o),s,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function fg(e){let t=mn(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),Wc(L(e),t,e.global)}function ql(e,t){return Ya(dl(e.options,t,se),e.global)}function _g(e){let t=K(e.options.lookupPath);if(t&&t.length>0)return ql(e,t);let n=L(e);return e.options.discover===!0?wo(n,fo(e.options),e.global):Ka(n,sn(e.options),e.global)}function hg(e){return kc({subcommand:b(e.args,"subcommand")??b(e.options,"subcommand"),limit:pa(e.args,e.options)},e.global)}function gg(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Va(e.global,t)}function yg(e){let t=b(e.args,"configAction")??b(e.options,"configAction")??b(e.options,"action");if(t===void 0)throw new p("Missing required argument: configAction",64);return cc(b(e.args,"scope")??b(e.options,"scope")??"project",t,b(e.args,"key")??b(e.options,"key"),e.options,e.global,b(e.args,"value")??b(e.options,"value"))}function bg(e){let t=e.options;return ia(ra(t),e.global)}function wg(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new p(`${t} must be a finite integer.`,64);let o=Number.parseInt(n,10);if(!Number.isInteger(o))throw new p(`${t} must be a finite integer.`,64);return o}}function vg(e){let t=b(e.args,"subcommand")??me(e.options,"subcommand"),n=e.options;return pd({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:kg(e),reorderTo:wg(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function kg(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function Sg(e){let t=b(e.args,"subcommand")??me(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:b(e.args,"name")??b(e.options,"name"),author:b(e.args,"author")??b(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:K(n)}}function Ig(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,a=mt({list:()=>Ta(t.global),show:()=>Oa(o,t.global),"show-status":()=>$a(o,t.global),"list-fields":()=>La(t.global),"show-field":()=>Na(o,t.global),"remove-type":()=>xa(o,{author:s,force:r},t.global),"remove-field":()=>Fa(o,{author:s,force:r},t.global),"remove-status":()=>Ca(o,{author:s,force:r},t.global),"apply-preset":()=>Ma(b(t.args,"typePreset")??b(t.options,"typePreset"),{author:s,force:r},t.global)},n);return a?a():null}function Eg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return Pa(n,{type:b(t.args,"fieldType")??b(t.options,"fieldType"),commands:i===void 0?void 0:K(i),description:b(t.args,"description")??b(t.options,"description"),cliFlag:b(t.args,"cliFlag")??b(t.options,"cliFlag"),alias:r,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:K(a),author:o,force:s},t.global)}function xg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.role??t.options.role;return Aa(n,{role:i===void 0?void 0:K(i),alias:r,description:b(t.args,"description")??b(t.options,"description"),order:se(t.args.order??t.options.order,"schema add-status order"),author:o,force:s},t.global)}function Rg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e;return Ea(n,{description:b(t.args,"description")??b(t.options,"description"),defaultStatus:b(t.args,"defaultStatus")??b(t.args,"default_status")??b(t.options,"defaultStatus")??b(t.options,"default_status"),folder:b(t.args,"folder")??b(t.options,"folder"),alias:r,author:o,force:s},t.global)}function Ag(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,i=b(t.args,"to")??me(t.options,"to"),a=b(t.args,"migrationId")??b(t.args,"migration_id")??b(t.options,"migrationId")??b(t.options,"migration_id"),c=b(t.args,"fieldTypeScope")??b(t.options,"fieldTypeScope")??b(t.args,"type")??b(t.options,"type"),d=n==="rename-type"?{kind:"rename-type",from:o??"",to:i}:n==="rename-field"?{kind:"rename-field",from:o??"",to:i,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:o??"",to:i};return Sa(d,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:s,force:r},t.global)}function Cg(e){let t=Sg(e),n=Ig(t);if(n!==null)return n;if(t.subcommand==="rename-type"||t.subcommand==="rename-field"||t.subcommand==="remap-status")return Ag(t);if(t.subcommand==="add-field")return Eg(t);if(t.subcommand==="add-status")return xg(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?Da({minCount:se(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):Rg(t);throw pe({command_path:"schema",token:t.subcommand,allowed:Ia,exit_code:64})}function Tg(e){let t=b(e.args,"subcommand")??me(e.options,"subcommand"),n=t.trim().toLowerCase(),o=b(e.args,"name")??b(e.options,"name"),r=mt({list:()=>Zd(),show:()=>Qd(o),lint:()=>el(o),apply:()=>tl(o,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:b(e.args,"author")??b(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!r)throw pe({command_path:"profile",token:t,allowed:Xd,exit_code:64});return r()}async function Og(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options);return fe(await qc(L(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function $g(e){let{changedFields:t,runnerOptions:n}=de(e.args,e.options);return fe(await ed(yo(n),e.global),{changedFields:t})}async function Pg(e){let{changedFields:t,runnerOptions:n}=de(e.args,e.options),o=b(e.args,"reason"),s=o!==void 0&&n.reason===void 0?{...n,reason:o}:{...n};return e.force&&s.force===void 0&&(s.force=!0),fe(await Vc(go(s),e.global),{changedFields:t})}async function Fg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options),s=b(o,"target")??me(e.args,"target");return fe(await je(L(e,o),s,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function zl(e){let t={...e};return delete t.assignee,t}async function Lg(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=Ec(q(n.schema)),s=L(e),r=await Eo(s,e.force,e.global,e.options),i=await Ie(s,{...zl(e.options),status:o,force:e.force},e.global);return{id:s,action:"start_task",claim:r,update:i}}async function Ng(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=L(e),s=q(n.schema).open_status,r=await Ie(o,{...zl(e.options),status:s,force:e.force},e.global),i=await un(o,e.force,e.global,e.options);return{id:o,action:"pause_task",update:r,release:i}}async function Mg(e){let t=L(e),n=b(e.args,"reason")??b(e.args,"text")??b(e.options,"reason")??b(e.options,"text"),o=await tt(t,n,{...e.options,force:e.force},e.global),s=await un(t,e.force,e.global,e.options);return{id:t,action:"close_task",close:o,release:s}}function Dg(e){let t={...e.args,...e.options};return ca(me(t,"subcommand"),b(t,"id")??e.id,b(t,"target"),_a(t),e.global)}function jg(e){return ga(E(process.cwd(),e.global.path),{...e.args,...e.options})}var Hl={init:e=>dc(b(e.args,"prefix"),e.global,e.options),context:e=>So(Je("context",e.options),e.global),next:e=>Io(Je("next",e.options),e.global),eval:Ad,events:Cd,merge:Td,workspace:Od,meet:En,event:En,remind:En,list:cg,get:e=>Co(L(e),e.global,Je("get",e.options)),search:dg,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:K(e.options.status);return Po(e.global,{...t.length===0?{}:{status:t},since:b(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:se(e.options.limit,"limit")})},create:lg,copy:mg,focus:e=>ms(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:pg,restore:Fg,claim:e=>e.options.next===!0||e.args.next===!0?ec(e.force,e.global,{...e.options,...e.args},{...e.options,...e.args}):Eo(L(e),e.force,e.global,e.options),release:e=>un(L(e),e.force,e.global,e.options),"start-task":Lg,"pause-task":Ng,"close-task":Mg,close:ug,comments:fg,notes:e=>Yc(L(e),mn(e.options),e.global),learnings:e=>Kc(L(e),mn(e.options),e.global),files:_g,docs:e=>Wa(L(e),sn(e.options),e.global),test:e=>Sc(L(e),e.options,e.global),"test-all":e=>Ic(e.options,e.global),telemetry:hg,validate:e=>ln(e.options,e.global,{runUpdate:(t,n,o)=>Ie(t,n,o)}),health:gg,assurance:e=>Ja(e.args,e.options,e.global),contracts:e=>Oo(e.options,e.global),config:yg,activity:bg,aggregate:e=>vo(e.options,e.global),extension:e=>dn(Nn(e),e.options,e.global),package:e=>dn(Nn(e),e.options,e.global),install:e=>dn(Nn(e),{...e.options,install:!0},e.global),upgrade:e=>sc(Nn(e),e.options,e.global),delete:e=>ls(L(e),e.options,e.global),deps:e=>aa(L(e),e.options,e.global),graph:Dg,"files-discover":e=>wo(L(e),e.options,e.global),"files-lookup":e=>ql(e,K(e.options.paths)),history:e=>tc(L(e),e.options,e.global),"history-redact":e=>ta(L(e),e.options,e.global),"history-repair":al,"history-compact":cl,"history-author-acknowledge":jg,plan:vg,schema:Cg,profile:Tg,stats:e=>$o(e.global,ll(e.options)),append:Og,"update-many":$g,"close-many":Pg,gc:e=>rc(e.global,e.options)};function Jx(e=Tr){return e.map(t=>{let n=ke(t),o=mt(Mo,n),s=o?.action??n,r=mt(Hl,s)!==void 0;return{action:t,resolved_action:s,covered:r,route:r?o?"alias":"native":"missing"}})}async function Dl(e,t,n,o){let s=uo(t,e);Or(e,s),$r(e,s);let r={action:e,args:t,options:s,id:b(t,"id"),force:t.force===!0||s.force===!0,global:n,activeExtensions:o},i=mt(Hl,e),a=i?await i(r):await ng(e,t,s,n,o);return s.resolvedOutputFormat="json",Fr(e,s,a)}var Ug={closeManyOptionsFromFlat:go,extensionOptionsFromArgs:ho,globalOptions:on,mutationListOptions:fa,normalizeActionName:ke,normalizeCommandPath:_o,normalizeMcpUpdateOptions:ha,normalizeMcpOptionsArrays:ua,optionsWithAuthor:uo,readRequiredString:me,readScalarString:la,readScalarStringAllowBlank:ma,readStringArray:K,updateManyOptionsFromFlat:yo,withAddNoteOption:sn,withFilesDiscoveryOptions:fo,withMutationCompaction:de};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=Ug);async function Gg(e,t,n){let o=await Bn({pmRoot:e,settings:t,cwd:n??process.cwd(),noExtensions:!1}),s=await Wn(o);try{return s.registrations}finally{try{await Vn(o,s)}catch{}}}export{Lc as a,sm as b,Do as c,Rt as d,bn as e,jc as f,Kg as g,Yg as h,Jg as i,Xg as j,Zg as k,Rc as l,Qg as m,Wl as n,Yl as o,_n as p,Lo as q,Tc as r,hn as s,em as t,No as u,zo as v,Uc as w,_m as x,gm as y,ym as z,Ho as A,qc as B,je as C,Vc as D,Wc as E,Kc as F,Yc as G,ed as H,Np as I,td as J,ts as K,pd as L,ds as M,ls as N,ms as O,fd as P,_d as Q,Pu as R,Fu as S,yd as T,wd as U,vd as V,kd as W,Ku as X,At as Y,xd as Z,In as _,Rd as $,it as aa,ws as ba,ef as ca,qw as da,zw as ea,Ss as fa,Pd as ga,rv as ha,iv as ia,Ld as ja,Dd as ka,Iv as la,yf as ma,Ts as na,wf as oa,vf as pa,Xd as qa,Zd as ra,Qd as sa,el as ta,tl as ua,Kv as va,Yv as wa,Jv as xa,Xv as ya,Os as za,Gf as Aa,rl as Ba,il as Ca,Wf as Da,Kf as Ea,Yf as Fa,z as Ga,Jf as Ha,Xf as Ia,Zf as Ja,Qf as Ka,Ps as La,ml as Ma,ct as Na,$s as Oa,pl as Pa,e_ as Qa,ul as Ra,t_ as Sa,n_ as Ta,o_ as Ua,s_ as Va,r_ as Wa,p_ as Xa,gl as Ya,u_ as Za,w_ as _a,R_ as $a,C_ as ab,Rh as bb,Zh as cb,v as db,vE as eb,kE as fb,SE as gb,IE as hb,EE as ib,xE as jb,RE as kb,AE as lb,CE as mb,TE as nb,OE as ob,$E as pb,PE as qb,FE as rb,LE as sb,NE as tb,ME as ub,DE as vb,jE as wb,UE as xb,GE as yb,qE as zb,zE as Ab,HE as Bb,BE as Cb,VE as Db,WE as Eb,KE as Fb,YE as Gb,JE as Hb,XE as Ib,ZE as Jb,QE as Kb,ex as Lb,tx as Mb,nx as Nb,ox as Ob,sx as Pb,rx as Qb,ix as Rb,ax as Sb,cx as Tb,dx as Ub,lx as Vb,mx as Wb,px as Xb,ux as Yb,fx as Zb,_x as _b,hx as $b,gx as ac,yx as bc,bx as cc,wx as dc,vx as ec,kx as fc,Sx as gc,Ix as hc,Ex as ic,xx as jc,Rx as kc,Ax as lc,Cx as mc,Tx as nc,Ox as oc,$x as pc,Px as qc,Fx as rc,Lx as sc,Nx as tc,Mx as uc,Dx as vc,jx as wc,Ux as xc,Gx as yc,qx as zc,zx as Ac,Hx as Bc,Bx as Cc,Vx as Dc,Wx as Ec,Kx as Fc,me as Gc,Yx as Hc,ag as Ic,Jx as Jc};
|
|
2092
|
-
//# sourceMappingURL=chunk-
|
|
2091
|
+
`);let r=[];if(e.mode!=="keyword")try{M(e.progressEnabled,"writing vectorization status ledger"),await hi(e.pmRoot,e.vectorizationLedgerEntries,e.vectorizationEmbeddingMetadata)}catch(i){r.push(`search_vectorization_status_ledger_write_failed:${i instanceof Error?i.message:String(i)}`)}return r}async function Zh(e,t){let n=Oh(e.mode),o=Th(e),s=e.full===!0;M(o,`start mode=${n}`);let r=E(process.cwd(),t.path);if(!await x(C(r)))throw new p(`Tracker is not initialized at ${r}. Run pm init first.`,u.NOT_FOUND);let i=ei(await R(r)).settings,a=null;try{a=await X(r,ti,i.locks.ttl_seconds,A(void 0,"pm-reindex"),!1,i.governance.force_required_for_stale_lock,i.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=Fh(i),d=Lh(i),l=Gh({requestedMode:n,pmRoot:r,settings:i,extensionEmbedding:c,extensionVectorAdapter:d}),m=n;M(o,"loading item corpus");let f=await qh({pmRoot:r,settings:i}),_=f.warnings,{documentCandidates:h,metadataDocuments:w}=f;M(o,`loaded_items=${w.length}`);let y=S(),g=Uh(m,y,w),k=Ot.join(r,qs),I=Ot.join(r,zs),F=m==="keyword"?await Bs(r,h,i.schema,_):w,$=[],B={},j=null,te=jh(m);if(m==="keyword"&&await zh({pmRoot:r,settings:i,forceFullSemantic:s,extensionEmbedding:c,reindexWarnings:_}),m!=="keyword"){let U=await Jh({pmRoot:r,settings:i,requestedMode:n,activeEmbeddingProvider:l.activeEmbeddingProvider,activeVectorStore:l.activeVectorStore,extensionEmbedding:c,extensionVectorAdapter:d,documentCandidates:h,metadataDocuments:w,documentsForKeywordArtifacts:F,forceFullSemantic:s,reindexWarnings:_,semanticWarnings:$,semanticSummary:te,progressEnabled:o});F=U.documentsForKeywordArtifacts,B=U.vectorizationLedgerEntries,j=U.vectorizationEmbeddingMetadata}let V=await Xh({pmRoot:r,mode:m,manifest:g,documentsForKeywordArtifacts:F,settings:i,vectorizationLedgerEntries:B,vectorizationEmbeddingMetadata:j,progressEnabled:o}),ie=[...await N({path:k,scope:"project",op:"reindex:manifest"}),...await N({path:I,scope:"project",op:"reindex:embeddings"}),...await ur({mode:m,total_items:w.length})];return M(o,"done"),{ok:!0,mode:m,total_items:w.length,semantic:te,artifacts:{manifest:qs,embeddings:zs},warnings:[..._,...$,...V,...ie],generated_at:y}}finally{await a?.()}}(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]="95764dd9-1b0d-5732-9f10-b13b334ce27d")}catch{}})();var jl=Symbol("pm.active-extension-host-context");function ee(e){return{fullChangedFields:!0,options:e}}var v=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[jl]=!0,n}run(t,n={}){return ag({...this.defaults,...n,action:t})}runTyped(t,n={}){return this.run(t,n)}context(t={}){return this.runTyped("context",{options:t})}listAllItemMetadataLight(){return Cc(this.defaults.path,this.defaults.cwd)}list(t={}){return this.runTyped("list",{options:t})}async listAllComplete(t={}){return hn(await this.list(Lo(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})}append(t,n,o={}){return this.runTyped("append",{id:t,...ee({...o,body:n})})}init(t,n={}){return this.runTyped("init",{...t===void 0?{}:{prefix:t},options:n})}config(t,n,o,s,r={}){return this.runTyped("config",{scope:t,configAction:n,...o===void 0?{}:{key:o},...s===void 0?{}:{value:s},options:r})}schema(t,n={}){return this.runTyped("schema",{options:{...n,subcommand:t}})}schemaList(){return this.runTyped("schema",{options:{subcommand:"list"}})}schemaShow(t){return this.runTyped("schema",{name:t,options:{subcommand:"show"}})}schemaAddType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-type"}})}schemaRemoveType(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-type"}})}schemaAddStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-status"}})}schemaRemoveStatus(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-status"}})}schemaAddField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"add-field"}})}schemaRemoveField(t,n={}){return this.runTyped("schema",{name:t,options:{...n,subcommand:"remove-field"}})}schemaListFields(){return this.runTyped("schema",{options:{subcommand:"list-fields"}})}schemaShowField(t){return this.runTyped("schema",{name:t,options:{subcommand:"show-field"}})}schemaApplyPreset(t,n={}){return this.runTyped("schema",{typePreset:t,options:{...n,subcommand:"apply-preset"}})}schemaInferTypes(t={}){return this.runTyped("schema",{options:{...t,subcommand:"add-type",infer:!0}})}schemaRenameType(t,n,o){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-type",to:n}})}schemaRenameField(t,n,o,s){return this.runTyped("schema",{name:t,options:{...o,subcommand:"rename-field",to:n,...s?{fieldTypeScope:s}:{}}})}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}})}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={},s,r){return this.runTyped("plan",{...n===void 0?{}:{id:n},...s===void 0?{}:{stepRef:s},...r===void 0?{}:{reorderTo:r},options:{...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,s={}){return this.plan("reorder-step",t,s,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",ee(t))}update(t,n={}){return this.runTyped("update",{id:t,...ee(n)})}close(t,n,o={}){return this.runTyped("close",{id:t,reason:n,...ee(o)})}claim(t,n={}){return this.runTyped("claim",{id:t,...ee(n)})}claimNext(t={}){return this.runTyped("claim",{next:!0,...ee(t)})}release(t,n={}){return this.runTyped("release",{id:t,...ee(n)})}copy(t,n={}){return this.runTyped("copy",{id:t,...ee(n)})}delete(t,n={}){return this.runTyped("delete",{id:t,...ee(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},...ee(n)})}startTask(t,n={}){return this.runTyped("start-task",{id:t,...ee(n)})}pauseTask(t,n={}){return this.runTyped("pause-task",{id:t,...ee(n)})}closeTask(t,n,o={}){return this.runTyped("close-task",{id:t,reason:n,...ee(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 vE(e={},t={}){return new v(t).context(e)}function kE(e={},t={}){return new v(t).list(e)}function SE(e={},t={}){return new v(t).listAllComplete(e)}function IE(e,t={},n={}){return new v(n).search(e,t)}function EE(e,t={},n={}){return new v(n).get(e,t)}function xE(e={},t={}){return new v(t).next(e)}function RE(e={},t={}){return new v(t).aggregate(e)}function AE(e={},t={}){return new v(t).stats(e)}function CE(e={},t={}){return new v(t).duplicates(e)}function TE(e,t={},n={}){return new v(n).comments(e,t)}function OE(e,t={},n={}){return new v(n).notes(e,t)}function $E(e,t={},n={}){return new v(n).learnings(e,t)}function PE(e,t={},n={}){return new v(n).files(e,t)}function FE(e,t={},n={}){return new v(n).filesDiscover(e,t)}function LE(e,t={}){return new v(t).filesLookup(e)}function NE(e,t={},n={}){return new v(n).docs(e,t)}function ME(e,t={},n={}){return new v(n).deps(e,t)}function DE(e,t={},n={},o={}){return new v(o).graph(e,t,n)}function jE(e,t,n={},o={}){return new v(o).append(e,t,n)}function UE(e,t={},n={}){return new v(n).init(e,t)}function GE(e,t,n,o,s={},r={}){return new v(r).config(e,t,n,o,s)}function qE(e,t={},n={}){return new v(n).schema(e,t)}function zE(e={}){return new v(e).schemaList()}function HE(e,t={}){return new v(t).schemaShow(e)}function BE(e,t={},n={}){return new v(n).schemaAddType(e,t)}function VE(e,t={},n={}){return new v(n).schemaRemoveType(e,t)}function WE(e,t={},n={}){return new v(n).schemaAddStatus(e,t)}function KE(e,t={},n={}){return new v(n).schemaRemoveStatus(e,t)}function YE(e,t={},n={}){return new v(n).schemaAddField(e,t)}function JE(e,t={},n={}){return new v(n).schemaRemoveField(e,t)}function XE(e={}){return new v(e).schemaListFields()}function ZE(e,t={}){return new v(t).schemaShowField(e)}function QE(e,t={},n={}){return new v(n).schemaApplyPreset(e,t)}function ex(e={},t={}){return new v(t).schemaInferTypes(e)}function tx(e,t,n,o={}){return new v(o).schemaRenameType(e,t,n)}function nx(e,t,n,o,s={}){return new v(s).schemaRenameField(e,t,n,o)}function ox(e,t,n,o={}){return new v(o).schemaRemapStatus(e,t,n)}function sx(e,t={}){return new v(t).schemaShowStatus(e)}function rx(e,t={},n={}){return new v(n).profile(e,t)}function ix(e={}){return new v(e).profileList()}function ax(e,t={}){return new v(t).profileShow(e)}function cx(e,t={},n={}){return new v(n).profileApply(e,t)}function dx(e,t={}){return new v(t).profileLint(e)}function lx(e={},t={}){return new v(t).validate(e)}function mx(e={},t={}){return new v(t).health(e)}function px(e={},t={}){return new v(t).gc(e)}function ux(e,t,n={}){return new v(n).historyRedact(e,t)}function fx(e,t={},n={}){return new v(n).historyRepair(e,t)}function _x(e={},t={}){return new v(t).historyRepairAll(e)}function hx(e,t={},n={}){return new v(n).historyCompact(e,t)}function gx(e,t={}){return new v(t).historyCompactBulk(e)}function yx(e={},t={}){return new v(t).create(e)}function bx(e,t={},n={}){return new v(n).update(e,t)}function wx(e,t,n={},o={}){return new v(o).close(e,t,n)}function vx(e,t={},n={}){return new v(n).claim(e,t)}function kx(e={},t={}){return new v(t).claimNext(e)}function Sx(e,t={},n={}){return new v(n).release(e,t)}function Ix(e,t={},n={}){return new v(n).copy(e,t)}function Ex(e,t={},n={}){return new v(n).delete(e,t)}function xx(e,t,n={},o={}){return new v(o).restore(e,t,n)}function Rx(e,t={},n={}){return new v(n).focus(e,t)}function Ax(e,t={},n={}){return new v(n).startTask(e,t)}function Cx(e,t={},n={}){return new v(n).pauseTask(e,t)}function Tx(e,t,n={},o={}){return new v(o).closeTask(e,t,n)}function Ox(e,t={},n={}){return new v(n).extension(e,t)}function $x(e={},t={}){return new v(t).extensionList(e)}function Px(e,t={},n={}){return new v(n).extensionActivate(e,t)}function Fx(e,t={},n={}){return new v(n).extensionDeactivate(e,t)}function Lx(e,t={},n={}){return new v(n).package(e,t)}function Nx(e={},t={}){return new v(t).packageList(e)}function Mx(e,t={},n={}){return new v(n).packageInstall(e,t)}function Dx(e,t={},n={}){return new v(n).packageUninstall(e,t)}function jx(e={},t={}){return new v(t).packageDoctor(e)}function Ux(e,t={},n={}){return new v(n).packageManage(e,t)}function Gx(e,t={},n={}){return new v(n).packageDescribe(e,t)}function qx(e={},t={}){return new v(t).packageReload(e)}function zx(e={},t={}){return new v(t).packageCatalog(e)}function Hx(e,t={},n={}){return new v(n).packageActivate(e,t)}function Bx(e,t={},n={}){return new v(n).packageDeactivate(e,t)}function Vx(e,t={},n={}){return new v(n).upgrade(e,t)}function eg(e,t,n){return JSON.stringify([Ll.resolve(e),Ll.resolve(n??process.cwd()),t.extensions.enabled,t.extensions.disabled,t.extensions.policy])}async function tg(e,t,n){let o=eg(e,t,n);return Pc(o,()=>Gg(e,t,n))}async function Wx(e,t={}){let n=await R(e),o=t.extensionRegistrations??(t.noExtensions===!0?null:await tg(e,n,t.cwd)),s=P(n,o),r=q(n.schema),i=ht(n.schema);return{types:[...s.types],statuses:r.definitions.map(a=>a.id),openStatus:r.open_status,closeStatus:r.close_status,canceledStatus:r.canceled_status,fields:Oc(i.definitions),extensionCommands:$c(o?.commands??[])}}async function Kx(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 Oo(n,o)}function me(e,t){let n=b(e,t);if(!n)throw new p(`Missing required argument: ${t}`,64);return n}var Nl=lr(),Ul=new Qh;function Ln(){Kn(nr()),Yn(or()),Jn(sr()),Xn(rr()),Zn(ir()),Qn(ar()),eo(cr())}async function Gl(e,t,n,o){return mr(()=>t===void 0?Nl.read(()=>Ml(e,n,o)):Nl.write(()=>og(t,()=>Ml(e,n,o))))}async function Yx(e,t){let n=e.cwd,o=n??process.cwd();return Gl(on({path:e.path,noExtensions:e.noExtensions}),n,o,()=>Ul.run(!0,t))}async function Ml(e,t,n){let o=E(t,e.path);if(e.noExtensions)return Ln(),Ho({pmRoot:o},()=>n(null));if(!await x(C(o)))return Ln(),n(null);let s=null,r;try{let i=await R(o),a=await Bn({pmRoot:o,settings:i,cwd:t,noExtensions:!1}),c=await Wn({...a,loaded:a.loaded});r={loadResult:a,activationResult:c},Kn(c.hooks),Yn(c.commands),Jn(c.parsers),Xn(c.preflight),Zn(c.services),Qn(c.renderers),eo(c.registrations),s={registrations:c.registrations,commands:c.commands,pmRoot:o,packages:a.loaded}}catch(i){Ln(),console.error("[pm-sdk] extension activation failed; continuing without active extensions:",i)}try{return await Ho({pmRoot:o,packages:s?.packages},()=>n(s))}finally{Ln(),r&&await Vn(r.loadResult,r.activationResult).catch(()=>{})}}async function ng(e,t,n,o,s){if(!s)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let r=ke(e),a=s.registrations.commands.find(d=>ke(d.action)===r)?.command??s.commands.handlers.find(d=>ke(d.command)===r)?.command;if(!a)throw new p(`Unsupported native pm action: ${e}`,u.USAGE);let c=await fr({command:_o(a),args:K(n.args??t.args),options:ho(t,n),global:o,pm_root:s.pmRoot,sdk:jc(s.pmRoot,v.forActiveExtensionHost({pmRoot:s.pmRoot,author:typeof o.author=="string"&&o.author.trim()?o.author.trim():"pm-extension"}))});if(!c.handled){let d=c.warnings.length>0?` (${c.warnings.join(", ")})`:"";throw new p(`Unsupported native pm action: ${e}${d}`,u.USAGE)}return c.result}async function og(e,t){let n=process.cwd();process.chdir(e);try{return await t()}finally{process.chdir(n)}}var sg=new Set(["activity","aggregate","context","contracts","deps","files-discover","get","graph","health","history","list","next","search","stats","telemetry","validate"]);function rg(e){let t=me(e,"action"),n=ke(t),o=mt(Mo,n),s=o?.action??n,r={...e,action:s};return o?.options!==void 0&&(r.options={...o.options,...jn(e.options)}),s==="package"&&(r.options={...jn(r.options),vocabulary:"package"}),{action:s,args:r}}function ig(e){return!sg.has(ke(e))}async function ag(e){let t=rg(e),n=on(t.args),o=ig(t.action),s=b(t.args,"cwd"),r=s??process.cwd();try{return e[jl]===!0||Ul.getStore()===!0?await Dl(t.action,t.args,n,null):await Gl(n,s,r,i=>Dl(t.action,t.args,n,i))}finally{o&&No()}}function mt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Nn(e){return b(e.args,"target")??b(e.options,"target")}function L(e,t=e.options){return e.id??me(t,"id")}async function cg(e){let t=Je("list",e.options);return t.compact===void 0&&t.brief===void 0&&t.full===void 0&&t.fields===void 0&&t.includeBody===void 0&&(t.compact=!0),Fo(await Se(b(e.args,"status")??b(t,"status"),t,e.global),t)}async function dg(e){let t=me(e.args,"query"),n=Je("search",e.options,[t]);return n.compact===void 0&&n.full===void 0&&n.fields===void 0&&(n.compact=!0),Fo(await To(t,n,e.global),n)}async function lg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options);return fe(await Et(o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function mg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options),s={...o,...o.title===void 0&&typeof e.args.title=="string"?{title:e.args.title}:{},...o.message===void 0&&typeof e.args.message=="string"?{message:e.args.message}:{}};return fe(await ds(L(e,s),s,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function pg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options);return fe(await Ie(L(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function ug(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options),s=b(e.args,"reason")??b(e.args,"text")??b(o,"reason")??b(o,"text");return fe(await tt(L(e,o),s,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function fg(e){let t=mn(e.options);return t.add===void 0&&t.stdin===void 0&&t.file===void 0&&t.edit===void 0&&t.delete===void 0&&(t.includeMeta=!0,t.limit===void 0&&t.fullHistory!==!0&&(t.limit="20")),Wc(L(e),t,e.global)}function ql(e,t){return Ya(dl(e.options,t,se),e.global)}function _g(e){let t=K(e.options.lookupPath);if(t&&t.length>0)return ql(e,t);let n=L(e);return e.options.discover===!0?wo(n,fo(e.options),e.global):Ka(n,sn(e.options),e.global)}function hg(e){return kc({subcommand:b(e.args,"subcommand")??b(e.options,"subcommand"),limit:pa(e.args,e.options)},e.global)}function gg(e){let t={...e.options};return t.brief===void 0&&t.summary===void 0&&t.full===void 0&&(t.summary=!0),Va(e.global,t)}function yg(e){let t=b(e.args,"configAction")??b(e.options,"configAction")??b(e.options,"action");if(t===void 0)throw new p("Missing required argument: configAction",64);return cc(b(e.args,"scope")??b(e.options,"scope")??"project",t,b(e.args,"key")??b(e.options,"key"),e.options,e.global,b(e.args,"value")??b(e.options,"value"))}function bg(e){let t=e.options;return ia(ra(t),e.global)}function wg(e,t){if(typeof e=="number"){if(!Number.isFinite(e)||!Number.isInteger(e))throw new p(`${t} must be a finite integer.`,64);return e}if(typeof e=="string"&&e.trim().length>0){let n=e.trim();if(!/^[+-]?\d+(?:st|nd|rd|th)?$/i.test(n))throw new p(`${t} must be a finite integer.`,64);let o=Number.parseInt(n,10);if(!Number.isInteger(o))throw new p(`${t} must be a finite integer.`,64);return o}}function vg(e){let t=b(e.args,"subcommand")??me(e.options,"subcommand"),n=e.options;return pd({subcommand:t,id:typeof e.id=="string"?e.id:typeof n.id=="string"?n.id:void 0,stepRef:kg(e),reorderTo:wg(n.reorderTo??e.args.reorderTo,"plan reorderTo"),options:e.options,global:e.global})}function kg(e){return typeof e.options.stepRef=="string"?e.options.stepRef:typeof e.args.stepRef=="string"?e.args.stepRef:void 0}function Sg(e){let t=b(e.args,"subcommand")??me(e.options,"subcommand"),n=e.args.alias??e.options.alias;return{ctx:e,subcommand:t.trim().toLowerCase(),name:b(e.args,"name")??b(e.options,"name"),author:b(e.args,"author")??b(e.options,"author"),force:e.args.force===!0||e.options.force===!0,aliases:n===void 0?void 0:K(n)}}function Ig(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,a=mt({list:()=>Ta(t.global),show:()=>Oa(o,t.global),"show-status":()=>$a(o,t.global),"list-fields":()=>La(t.global),"show-field":()=>Na(o,t.global),"remove-type":()=>xa(o,{author:s,force:r},t.global),"remove-field":()=>Fa(o,{author:s,force:r},t.global),"remove-status":()=>Ca(o,{author:s,force:r},t.global),"apply-preset":()=>Ma(b(t.args,"typePreset")??b(t.options,"typePreset"),{author:s,force:r},t.global)},n);return a?a():null}function Eg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.commands??t.options.commands,a=t.args.requiredTypes??t.options.requiredTypes;return Pa(n,{type:b(t.args,"fieldType")??b(t.options,"fieldType"),commands:i===void 0?void 0:K(i),description:b(t.args,"description")??b(t.options,"description"),cliFlag:b(t.args,"cliFlag")??b(t.options,"cliFlag"),alias:r,required:t.args.required===!0||t.options.required===!0,requiredOnCreate:t.args.requiredOnCreate===!0||t.options.requiredOnCreate===!0,allowUnset:!(t.args.allowUnset===!1||t.options.allowUnset===!1),requiredTypes:a===void 0?void 0:K(a),author:o,force:s},t.global)}function xg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e,i=t.args.role??t.options.role;return Aa(n,{role:i===void 0?void 0:K(i),alias:r,description:b(t.args,"description")??b(t.options,"description"),order:se(t.args.order??t.options.order,"schema add-status order"),author:o,force:s},t.global)}function Rg(e){let{ctx:t,name:n,author:o,force:s,aliases:r}=e;return Ea(n,{description:b(t.args,"description")??b(t.options,"description"),defaultStatus:b(t.args,"defaultStatus")??b(t.args,"default_status")??b(t.options,"defaultStatus")??b(t.options,"default_status"),folder:b(t.args,"folder")??b(t.options,"folder"),alias:r,author:o,force:s},t.global)}function Ag(e){let{ctx:t,subcommand:n,name:o,author:s,force:r}=e,i=b(t.args,"to")??me(t.options,"to"),a=b(t.args,"migrationId")??b(t.args,"migration_id")??b(t.options,"migrationId")??b(t.options,"migration_id"),c=b(t.args,"fieldTypeScope")??b(t.options,"fieldTypeScope")??b(t.args,"type")??b(t.options,"type"),d=n==="rename-type"?{kind:"rename-type",from:o??"",to:i}:n==="rename-field"?{kind:"rename-field",from:o??"",to:i,...c===void 0?{}:{type:c}}:{kind:"remap-status",from:o??"",to:i};return Sa(d,{migrationId:a,dryRun:t.args.dryRun===!0||t.options.dryRun===!0,author:s,force:r},t.global)}function Cg(e){let t=Sg(e),n=Ig(t);if(n!==null)return n;if(t.subcommand==="rename-type"||t.subcommand==="rename-field"||t.subcommand==="remap-status")return Ag(t);if(t.subcommand==="add-field")return Eg(t);if(t.subcommand==="add-status")return xg(t);if(t.subcommand==="add-type")return e.args.infer===!0||e.options.infer===!0?Da({minCount:se(e.args.minCount??e.options.minCount,"schema infer minCount"),apply:e.args.apply===!0||e.options.apply===!0,author:t.author,force:t.force},e.global):Rg(t);throw pe({command_path:"schema",token:t.subcommand,allowed:Ia,exit_code:64})}function Tg(e){let t=b(e.args,"subcommand")??me(e.options,"subcommand"),n=t.trim().toLowerCase(),o=b(e.args,"name")??b(e.options,"name"),r=mt({list:()=>Zd(),show:()=>Qd(o),lint:()=>el(o),apply:()=>tl(o,{dryRun:e.args.dryRun===!0||e.options.dryRun===!0,author:b(e.args,"author")??b(e.options,"author"),force:e.args.force===!0||e.options.force===!0},e.global)},n);if(!r)throw pe({command_path:"profile",token:t,allowed:Xd,exit_code:64});return r()}async function Og(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options);return fe(await qc(L(e,o),o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}async function $g(e){let{changedFields:t,runnerOptions:n}=de(e.args,e.options);return fe(await ed(yo(n),e.global),{changedFields:t})}async function Pg(e){let{changedFields:t,runnerOptions:n}=de(e.args,e.options),o=b(e.args,"reason"),s=o!==void 0&&n.reason===void 0?{...n,reason:o}:{...n};return e.force&&s.force===void 0&&(s.force=!0),fe(await Vc(go(s),e.global),{changedFields:t})}async function Fg(e){let{changedFields:t,idOnly:n,runnerOptions:o}=de(e.args,e.options),s=b(o,"target")??me(e.args,"target");return fe(await je(L(e,o),s,o,e.global),{changedFields:t,compactEnvelope:t==="compact"&&!n,idOnly:n})}function zl(e){let t={...e};return delete t.assignee,t}async function Lg(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=Ec(q(n.schema)),s=L(e),r=await Eo(s,e.force,e.global,e.options),i=await Ie(s,{...zl(e.options),status:o,force:e.force},e.global);return{id:s,action:"start_task",claim:r,update:i}}async function Ng(e){let t=E(process.cwd(),e.global.path),n=await R(t),o=L(e),s=q(n.schema).open_status,r=await Ie(o,{...zl(e.options),status:s,force:e.force},e.global),i=await un(o,e.force,e.global,e.options);return{id:o,action:"pause_task",update:r,release:i}}async function Mg(e){let t=L(e),n=b(e.args,"reason")??b(e.args,"text")??b(e.options,"reason")??b(e.options,"text"),o=await tt(t,n,{...e.options,force:e.force},e.global),s=await un(t,e.force,e.global,e.options);return{id:t,action:"close_task",close:o,release:s}}function Dg(e){let t={...e.args,...e.options};return ca(me(t,"subcommand"),b(t,"id")??e.id,b(t,"target"),_a(t),e.global)}function jg(e){return ga(E(process.cwd(),e.global.path),{...e.args,...e.options})}var Hl={init:e=>dc(b(e.args,"prefix"),e.global,e.options),context:e=>So(Je("context",e.options),e.global),next:e=>Io(Je("next",e.options),e.global),eval:Ad,events:Cd,merge:Td,workspace:Od,meet:En,event:En,remind:En,list:cg,get:e=>{let t=L(e);return Co(t,e.global,Je("get",e.options,[t]))},search:dg,duplicates:e=>{let t=typeof e.options.status=="string"?[e.options.status]:K(e.options.status);return Po(e.global,{...t.length===0?{}:{status:t},since:b(e.options,"since"),threshold:typeof e.options.threshold=="number"?e.options.threshold:void 0,limit:e.options.limit==="default"?void 0:se(e.options.limit,"limit")})},create:lg,copy:mg,focus:e=>ms(e.id,{clear:e.options.clear===!0||e.args.clear===!0},e.global),update:pg,restore:Fg,claim:e=>e.options.next===!0||e.args.next===!0?ec(e.force,e.global,{...e.options,...e.args},{...e.options,...e.args}):Eo(L(e),e.force,e.global,e.options),release:e=>un(L(e),e.force,e.global,e.options),"start-task":Lg,"pause-task":Ng,"close-task":Mg,close:ug,comments:fg,notes:e=>Yc(L(e),mn(e.options),e.global),learnings:e=>Kc(L(e),mn(e.options),e.global),files:_g,docs:e=>Wa(L(e),sn(e.options),e.global),test:e=>Sc(L(e),e.options,e.global),"test-all":e=>Ic(e.options,e.global),telemetry:hg,validate:e=>ln(e.options,e.global,{runUpdate:(t,n,o)=>Ie(t,n,o)}),health:gg,assurance:e=>Ja(e.args,e.options,e.global),contracts:e=>Oo(e.options,e.global),config:yg,activity:bg,aggregate:e=>vo(e.options,e.global),extension:e=>dn(Nn(e),e.options,e.global),package:e=>dn(Nn(e),e.options,e.global),install:e=>dn(Nn(e),{...e.options,install:!0},e.global),upgrade:e=>sc(Nn(e),e.options,e.global),delete:e=>ls(L(e),e.options,e.global),deps:e=>aa(L(e),e.options,e.global),graph:Dg,"files-discover":e=>wo(L(e),e.options,e.global),"files-lookup":e=>ql(e,K(e.options.paths)),history:e=>tc(L(e),e.options,e.global),"history-redact":e=>ta(L(e),e.options,e.global),"history-repair":al,"history-compact":cl,"history-author-acknowledge":jg,plan:vg,schema:Cg,profile:Tg,stats:e=>$o(e.global,ll(e.options)),append:Og,"update-many":$g,"close-many":Pg,gc:e=>rc(e.global,e.options)};function Jx(e=Tr){return e.map(t=>{let n=ke(t),o=mt(Mo,n),s=o?.action??n,r=mt(Hl,s)!==void 0;return{action:t,resolved_action:s,covered:r,route:r?o?"alias":"native":"missing"}})}async function Dl(e,t,n,o){let s=uo(t,e);Or(e,s),$r(e,s);let r={action:e,args:t,options:s,id:b(t,"id"),force:t.force===!0||s.force===!0,global:n,activeExtensions:o},i=mt(Hl,e),a=i?await i(r):await ng(e,t,s,n,o);return s.resolvedOutputFormat="json",Fr(e,s,a)}var Ug={closeManyOptionsFromFlat:go,extensionOptionsFromArgs:ho,globalOptions:on,mutationListOptions:fa,normalizeActionName:ke,normalizeCommandPath:_o,normalizeMcpUpdateOptions:ha,normalizeMcpOptionsArrays:ua,optionsWithAuthor:uo,readRequiredString:me,readScalarString:la,readScalarStringAllowBlank:ma,readStringArray:K,updateManyOptionsFromFlat:yo,withAddNoteOption:sn,withFilesDiscoveryOptions:fo,withMutationCompaction:de};(process.env.NODE_ENV==="test"||process.env.VITEST!==void 0||process.env.VITEST_WORKER_ID!==void 0)&&(globalThis.__pmCliActionRunnerTestHooks=Ug);async function Gg(e,t,n){let o=await Bn({pmRoot:e,settings:t,cwd:n??process.cwd(),noExtensions:!1}),s=await Wn(o);try{return s.registrations}finally{try{await Vn(o,s)}catch{}}}export{Lc as a,sm as b,Do as c,Rt as d,bn as e,jc as f,Kg as g,Yg as h,Jg as i,Xg as j,Zg as k,Rc as l,Qg as m,Wl as n,Yl as o,_n as p,Lo as q,Tc as r,hn as s,em as t,No as u,zo as v,Uc as w,_m as x,gm as y,ym as z,Ho as A,qc as B,je as C,Vc as D,Wc as E,Kc as F,Yc as G,ed as H,Np as I,td as J,ts as K,pd as L,ds as M,ls as N,ms as O,fd as P,_d as Q,Pu as R,Fu as S,yd as T,wd as U,vd as V,kd as W,Ku as X,At as Y,xd as Z,In as _,Rd as $,it as aa,ws as ba,ef as ca,qw as da,zw as ea,Ss as fa,Pd as ga,rv as ha,iv as ia,Ld as ja,Dd as ka,Iv as la,yf as ma,Ts as na,wf as oa,vf as pa,Xd as qa,Zd as ra,Qd as sa,el as ta,tl as ua,Kv as va,Yv as wa,Jv as xa,Xv as ya,Os as za,Gf as Aa,rl as Ba,il as Ca,Wf as Da,Kf as Ea,Yf as Fa,z as Ga,Jf as Ha,Xf as Ia,Zf as Ja,Qf as Ka,Ps as La,ml as Ma,ct as Na,$s as Oa,pl as Pa,e_ as Qa,ul as Ra,t_ as Sa,n_ as Ta,o_ as Ua,s_ as Va,r_ as Wa,p_ as Xa,gl as Ya,u_ as Za,w_ as _a,R_ as $a,C_ as ab,Rh as bb,Zh as cb,v as db,vE as eb,kE as fb,SE as gb,IE as hb,EE as ib,xE as jb,RE as kb,AE as lb,CE as mb,TE as nb,OE as ob,$E as pb,PE as qb,FE as rb,LE as sb,NE as tb,ME as ub,DE as vb,jE as wb,UE as xb,GE as yb,qE as zb,zE as Ab,HE as Bb,BE as Cb,VE as Db,WE as Eb,KE as Fb,YE as Gb,JE as Hb,XE as Ib,ZE as Jb,QE as Kb,ex as Lb,tx as Mb,nx as Nb,ox as Ob,sx as Pb,rx as Qb,ix as Rb,ax as Sb,cx as Tb,dx as Ub,lx as Vb,mx as Wb,px as Xb,ux as Yb,fx as Zb,_x as _b,hx as $b,gx as ac,yx as bc,bx as cc,wx as dc,vx as ec,kx as fc,Sx as gc,Ix as hc,Ex as ic,xx as jc,Rx as kc,Ax as lc,Cx as mc,Tx as nc,Ox as oc,$x as pc,Px as qc,Fx as rc,Lx as sc,Nx as tc,Mx as uc,Dx as vc,jx as wc,Ux as xc,Gx as yc,qx as zc,zx as Ac,Hx as Bc,Bx as Cc,Vx as Dc,Wx as Ec,Kx as Fc,me as Gc,Yx as Hc,ag as Ic,Jx as Jc};
|
|
2092
|
+
//# sourceMappingURL=chunk-OIOKV6NO.js.map
|