@unbrained/pm-cli 2026.11.23 → 2026.11.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/main.js +5 -5
  3. package/dist/cli/register-annotations.js +1 -1
  4. package/dist/cli/runtime/invocation-options.js +1 -1
  5. package/dist/cli-bundle/bundle-manifest.json +1 -1
  6. package/dist/cli-bundle/chunks/{chunk-2UQU7HRR.js → chunk-23K6DQQY.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-O7JHS64G.js → chunk-37UDIJ2K.js} +2 -2
  8. package/dist/cli-bundle/chunks/chunk-7IROAPWI.js +3 -0
  9. package/dist/cli-bundle/chunks/{chunk-KZHIBEJL.js → chunk-7VRFEURZ.js} +2 -2
  10. package/dist/cli-bundle/chunks/chunk-7X253M6Z.js +3 -0
  11. package/dist/cli-bundle/chunks/chunk-AWB5KBJS.js +2 -0
  12. package/dist/cli-bundle/chunks/chunk-DQDRA3SW.js +2 -0
  13. package/dist/cli-bundle/chunks/chunk-FXJYZBWV.js +113 -0
  14. package/dist/cli-bundle/chunks/{chunk-BSRIVYTM.js → chunk-HNKK2UG6.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-HZZLSBIJ.js +2 -0
  16. package/dist/cli-bundle/chunks/chunk-I2OJ5B4A.js +2 -0
  17. package/dist/cli-bundle/chunks/chunk-I3BFCKZR.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-ENKXRSFZ.js → chunk-MXUSC5RS.js} +31 -31
  19. package/dist/cli-bundle/chunks/chunk-PLIUU37C.js +3 -0
  20. package/dist/cli-bundle/chunks/chunk-PQUBVRV5.js +2 -0
  21. package/dist/cli-bundle/chunks/chunk-PW7U7WCE.js +3 -0
  22. package/dist/cli-bundle/chunks/chunk-SSALO4DB.js +2 -0
  23. package/dist/cli-bundle/chunks/chunk-STOOTHZZ.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-TKRY22SO.js +2 -0
  25. package/dist/cli-bundle/chunks/{chunk-AEOHUSUI.js → chunk-TVIJ2VCU.js} +68 -68
  26. package/dist/cli-bundle/chunks/{chunk-F2Z6XLZB.js → chunk-VJSGUXGU.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-H7JEXRIN.js → chunk-WWTPNIC2.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-J2PDAVBC.js → chunk-XFADNMGD.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-TZY5MVJF.js → chunk-YOPTAIBD.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-CFWLQFJM.js → chunk-YW2HBHRO.js} +50 -51
  31. package/dist/cli-bundle/chunks/chunk-Z7MFVRDV.js +2 -0
  32. package/dist/cli-bundle/chunks/chunk-ZOX4SWRL.js +8 -0
  33. package/dist/cli-bundle/chunks/chunk-ZYCOM4MS.js +9 -0
  34. package/dist/cli-bundle/chunks/field-option-collisions-W66HSWMK.js +2 -0
  35. package/dist/cli-bundle/{focused-chunks/item-revision-YDACCDVY.js → chunks/item-revision-D3LSBNIR.js} +2 -2
  36. package/dist/cli-bundle/chunks/item-transaction-M6NTBYH3.js +2 -0
  37. package/dist/cli-bundle/chunks/mutation-actor-OKL3CQVX.js +2 -0
  38. package/dist/cli-bundle/chunks/mutation-admission-EKPEOZMF.js +2 -0
  39. package/dist/cli-bundle/chunks/{register-list-query-L4IBU64P.js → register-list-query-3LBV6CS2.js} +2 -2
  40. package/dist/cli-bundle/chunks/register-mutation-72AGTMNE.js +21 -0
  41. package/dist/cli-bundle/chunks/register-operations-XERFG2SH.js +2 -0
  42. package/dist/cli-bundle/chunks/register-setup-W22L34Z4.js +2 -0
  43. package/dist/cli-bundle/chunks/runtime-schema-JP2KBHBY.js +2 -0
  44. package/dist/cli-bundle/chunks/stage-T2LKWN7C.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-24VRBNKE.js +26 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-3ELVASVA.js +2 -0
  47. package/dist/cli-bundle/focused-chunks/{chunk-XRS3VNC6.js → chunk-3GT4A3ZN.js} +23 -23
  48. package/dist/cli-bundle/focused-chunks/{chunk-IROZDIDX.js → chunk-3OCDKITJ.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-3Z7MCUJM.js +3 -0
  50. package/dist/cli-bundle/focused-chunks/chunk-46MP7IZN.js +5 -0
  51. package/dist/cli-bundle/focused-chunks/{chunk-OTMMOKPM.js → chunk-5LDBS6MS.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/{chunk-ZHWPCVQL.js → chunk-B6BNHKUW.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-C7WHWI7K.js +3 -0
  54. package/dist/cli-bundle/focused-chunks/chunk-EUQGZPGO.js +2 -0
  55. package/dist/cli-bundle/focused-chunks/{chunk-UFTUNBMY.js → chunk-FDZPRJXJ.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/chunk-GXP7Q4XM.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-HL47UQZJ.js +8 -0
  58. package/dist/cli-bundle/focused-chunks/chunk-LMFIAQ2V.js +2 -0
  59. package/dist/cli-bundle/focused-chunks/chunk-LMU7DDOA.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-OZOCEB2Q.js +8 -0
  61. package/dist/cli-bundle/focused-chunks/{chunk-NQTEE66P.js → chunk-Q2HY44LV.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/chunk-REFMQY47.js +2 -0
  63. package/dist/cli-bundle/focused-chunks/chunk-RIQUIHYU.js +3 -0
  64. package/dist/cli-bundle/focused-chunks/{chunk-QQIIMMFU.js → chunk-RLO2HCZT.js} +2 -2
  65. package/dist/cli-bundle/focused-chunks/chunk-SMMOZ3H3.js +100 -0
  66. package/dist/cli-bundle/focused-chunks/chunk-UVTUX54T.js +2 -0
  67. package/dist/cli-bundle/focused-chunks/{chunk-Y2ESLKCF.js → chunk-XDBHD4CY.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/chunk-YD66IRSL.js +2 -0
  69. package/dist/cli-bundle/focused-chunks/chunk-Z7W2RQIB.js +2 -0
  70. package/dist/cli-bundle/focused-chunks/field-option-collisions-UODPSV6W.js +2 -0
  71. package/dist/cli-bundle/focused-chunks/item-revision-QH7RNBX4.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/item-transaction-ZO72OINF.js +2 -0
  73. package/dist/cli-bundle/focused-chunks/mutation-actor-PHVLKG4I.js +2 -0
  74. package/dist/cli-bundle/focused-chunks/mutation-admission-ZSG5OECH.js +2 -0
  75. package/dist/cli-bundle/focused-chunks/runtime-schema-6RQMIDTN.js +2 -0
  76. package/dist/cli-bundle/focused-chunks/stage-AQMKRVX4.js +2 -0
  77. package/dist/cli-bundle/main.js +26 -26
  78. package/dist/cli-bundle/sdk-authoring.js +1 -1
  79. package/dist/cli-bundle/sdk-contracts.js +4 -4
  80. package/dist/cli-bundle/sdk-core.js +1 -1
  81. package/dist/cli-bundle/sdk-governance.js +1 -1
  82. package/dist/cli-bundle/sdk-graph.js +1 -1
  83. package/dist/cli-bundle/sdk-merge.js +63 -63
  84. package/dist/cli-bundle/sdk-query.js +1 -1
  85. package/dist/cli-bundle/sdk-runtime.js +1 -1
  86. package/dist/cli-bundle/sdk-testing.js +1 -1
  87. package/dist/cli-bundle/sdk.js +11 -11
  88. package/dist/core/profile/profile-lint.d.ts +1 -1
  89. package/dist/core/profile/profile-lint.js +1 -1
  90. package/dist/core/schema/fields-file.js +2 -2
  91. package/dist/core/schema/runtime-field-values.js +1 -1
  92. package/dist/core/schema/runtime-schema.d.ts +2 -0
  93. package/dist/core/schema/runtime-schema.js +1 -1
  94. package/dist/sdk/extension/command-options.d.ts +26 -1
  95. package/dist/sdk/extension/command-options.js +1 -1
  96. package/dist/sdk/extension-command-context.js +2 -2
  97. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  98. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  99. package/dist/sdk/index.d.ts +1 -1
  100. package/dist/sdk/public-surface.json +1 -1
  101. package/dist/sdk/read-output-contracts.d.ts +11 -0
  102. package/dist/sdk/read-output-contracts.js +1 -1
  103. package/dist/sdk/schema/field-flag-spelling.d.ts +22 -0
  104. package/dist/sdk/schema/field-flag-spelling.js +2 -0
  105. package/dist/sdk/schema/field-option-collisions.js +1 -1
  106. package/docs/COMMANDS.md +1 -1
  107. package/docs/EXTENSIONS.md +1 -1
  108. package/docs/READ_OUTPUT_CONTRACTS.md +2 -0
  109. package/docs/SDK.md +20 -1
  110. package/docs/SDK_AUDITED_MUTATIONS.md +11 -0
  111. package/marketplace.json +1 -1
  112. package/package.json +1 -1
  113. package/packages/pm-beads/package.json +1 -1
  114. package/packages/pm-calendar/package.json +1 -1
  115. package/packages/pm-command-kit/package.json +1 -1
  116. package/packages/pm-digital-twin/package.json +1 -1
  117. package/packages/pm-governance-audit/package.json +1 -1
  118. package/packages/pm-guide-shell/package.json +1 -1
  119. package/packages/pm-kanban/package.json +1 -1
  120. package/packages/pm-lifecycle-hooks/package.json +1 -1
  121. package/packages/pm-linked-test-adapters/package.json +1 -1
  122. package/packages/pm-search-advanced/package.json +1 -1
  123. package/packages/pm-templates/package.json +1 -1
  124. package/packages/pm-todos/package.json +1 -1
  125. package/packages/pm-vcs/package.json +1 -1
  126. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  127. package/plugins/pm-claude/package.json +1 -1
  128. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  129. package/plugins/pm-codex/package.json +1 -1
  130. package/plugins/pm-codex/plugin.json +1 -1
  131. package/runtime-dependencies.json +1 -1
  132. package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +0 -3
  133. package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +0 -2
  134. package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +0 -2
  135. package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +0 -2
  136. package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +0 -2
  137. package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +0 -115
  138. package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +0 -2
  139. package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +0 -2
  140. package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +0 -2
  141. package/dist/cli-bundle/chunks/chunk-OPJF254V.js +0 -9
  142. package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +0 -2
  143. package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +0 -2
  144. package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +0 -8
  145. package/dist/cli-bundle/chunks/item-revision-FMD4KWBB.js +0 -2
  146. package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +0 -2
  147. package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +0 -2
  148. package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +0 -2
  149. package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +0 -21
  150. package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +0 -2
  151. package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +0 -2
  152. package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +0 -2
  153. package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +0 -6
  154. package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +0 -2
  155. package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +0 -8
  156. package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +0 -2
  157. package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +0 -2
  158. package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +0 -2
  159. package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +0 -26
  160. package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +0 -2
  161. package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +0 -2
  162. package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +0 -2
  163. package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +0 -8
  164. package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +0 -2
  165. package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +0 -2
  166. package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +0 -102
  167. package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +0 -2
  168. package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +0 -2
  169. package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +0 -2
  170. package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.js +0 -2
@@ -1,4 +1,4 @@
1
- import{E as Ho,G as Wo,a as q,b as Eo,c as xo,e as $e,f as Co,g as To,h as Io,i as Ro,j as Ao,m as Mo,n as Fo,p as Lo,q as Do,t as Po,u as xn,v as Cn,w as H,y as jo,z as Uo}from"./chunk-OXOCZJC6.js";import{d as Go}from"./chunk-6LPXMFLM.js";import{Aa as oo,Ab as ho,Ba as kt,Bb as go,Ca as so,Cb as _o,Da as St,Db as yo,Ea as Et,Eb as wo,Fa as xt,Ga as ao,Hb as vo,Jb as bo,Ka as co,La as kn,Ua as uo,ca as Ki,da as Vi,ga as vn,ha as Yi,sa as yt,sb as lo,ua as _e,ub as fo,va as wt,vb as mo,wa as vt,wb as Sn,xa as eo,xb as po,za as io}from"./chunk-UFTUNBMY.js";import{Za as gi,fb as _i,g as gn,h as _n,j as yn,k as pi,l as hi}from"./chunk-IR2J3NOT.js";import{d as Oo,e as $o,h as No,w as Bo}from"./chunk-ITKDHSBR.js";import{a as Fe,c as Oe,f as En,g as ko,h as So,i as Ct}from"./chunk-QLAHEDT6.js";import{E as bt,G as to,H as ye,I as we,K as no,L as ve,O as ro,b as le,f as Qi,g as Xi,j as Zi,l as bn}from"./chunk-OTMMOKPM.js";import{a as ge,b as _t,c as Ji,s as A,y as B}from"./chunk-HMDQDRV2.js";import{$f as Ae,A as de,Ah as gt,Ba as hn,Bd as vi,Da as fe,F as mn,Fc as M,G as rt,Ga as ct,Ge as Ri,Ic as yi,Ig as Ni,Jc as S,Jg as Li,Kc as wi,Lc as G,Nc as pe,Ng as Di,Nh as qi,Oh as zi,Qc as ut,Qd as bi,Rd as ki,Sd as Si,Td as Ei,Tf as C,Ub as me,Ud as xi,Uh as wn,We as Ai,Yd as Re,Zb as mi,_ as pn,a as si,ba as Ie,bg as Me,bh as Pi,ca as at,eg as Fi,fe as Ci,ff as Mi,ga as di,gg as Oi,ha as li,hh as lt,ig as dt,ih as he,jh as ji,kh as Ui,lh as Bi,mc as L,md as F,mh as Hi,nd as E,nh as Wi,oc as J,od as Z,oe as ne,oh as ft,pe as Ti,qe as Ii,ra as R,sh as mt,te as ee,uh as pt,wh as ht,xa as I,yg as $i,za as fi,zh as Gi}from"./chunk-Z2X7HH3C.js";import{A as h,C as ui,D as it,E as ot,I as st,t as ai,x as ci,z as p}from"./chunk-A6VEMCRR.js";var Ne=class extends RangeError{code;work;minimum_tokens;constructor(t,n,r){super(t),this.name="OutputEnvelopeFitError",this.code=t,this.work=Object.freeze({...n}),this.minimum_tokens=r}};function Tn(e,t){if(!Number.isSafeInteger(e)||e<1)throw new RangeError(`${t} must be a positive safe integer`)}function lc(e,t,n,r){return t.map(([i,o])=>{if(r.render_calls>=r.max_render_calls)throw new Ne("output_envelope_work_limit",r);r.render_calls+=1;let s=o(e);if(typeof s!="string")throw new TypeError("Envelope renderers must return strings");let a=n(s);if(!Number.isSafeInteger(a)||a<0)throw new RangeError("Envelope token estimates must be non-negative safe integers");return{name:i,text:s,bytes:Buffer.byteLength(s,"utf8"),estimated_tokens:a}})}function qo(e,t,n,r){let i=t,o=Object.entries(n.renderers),s=n.estimateTokens??(a=>$i(Buffer.byteLength(a,"utf8")));for(let a=0;a<(n.maxStabilizationPasses??16);a+=1){let u=Object.freeze({...i}),c={...n.buildEnvelope(e,u),output_fit:u},d=lc(c,o,s,r),l=Math.max(...d.map(m=>m.bytes)),f=Math.max(...d.map(m=>m.estimated_tokens));if(l===i.output_bytes&&f===i.estimated_tokens)return{envelope:c,renderings:d};i={...i,output_bytes:l,estimated_tokens:f}}throw new Ne("output_envelope_unstable",r)}function th(e,t){Tn(t.tokenBudget,"tokenBudget"),Tn(t.maxRenderCalls??1e4,"maxRenderCalls"),Tn(t.maxStabilizationPasses??16,"maxStabilizationPasses");let n=t.policy??"prefix";if(n!=="prefix"&&n!=="skip")throw new TypeError("Unknown output envelope fit policy");if(Object.entries(t.renderers).length===0||Object.entries(t.renderers).some(([u,c])=>!u.trim()||typeof c!="function"))throw new TypeError("Envelope fitting requires named callable renderers");let r={evaluated_candidates:0,render_calls:0,max_render_calls:t.maxRenderCalls??1e4},i=[],o=[],s=u=>({version:1,policy:n,total_candidates:e.length,included_indices:Object.freeze([...u]),omitted_count:e.length-u.length,token_budget:t.tokenBudget,estimated_tokens:0,output_bytes:0}),a=qo(i,s(o),t,r);if(a.envelope.output_fit.estimated_tokens>t.tokenBudget)throw new Ne("output_envelope_infeasible",r,a.envelope.output_fit.estimated_tokens);for(let[u,c]of e.entries()){r.evaluated_candidates+=1;let d=[...i,c],l=[...o,u],f=qo(d,s(l),t,r);if(f.envelope.output_fit.estimated_tokens<=t.tokenBudget)i=d,o=l,a=f;else if(n==="prefix")break}return{rows:i,...a,complete:i.length===e.length,work:Object.freeze({...r})}}var fc=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],In=class extends Error{receipt;constructor(t,n={}){super(`Complete-list certification failed: ${t.map(i=>i.code).join(", ")}.`),this.name="PmCompleteListValidationError";let r=n.includeBody===!0;this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:`pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded${r?" --include-body":""} --json`,sdk:r?"await client.listAllComplete({ includeBody: true })":"await client.listAllComplete()"}}}};function ih(e={}){return Di({excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0},["full"])}function P(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function T(e,t,n,r){t&&e.push({code:n,message:r})}function mc(e,t){let n=P(e.completeness)?e.completeness:{};T(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),T(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let r=n.unreadable_item_count,i=n.unreadable_directory_count;T(t,n.status==="complete"&&(r!==0||i!==0)&&Number.isSafeInteger(r)&&Number.isSafeInteger(i),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),T(t,n.status==="complete"&&(!Number.isSafeInteger(r)||!Number.isSafeInteger(i)||Number(r)<0||Number(i)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let o=P(e.filters)?e.filters:{},s=P(o.runtime_filters)?o.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return T(t,o.status!=="all"||Object.keys(s).length>0||Object.keys(o).some(u=>!a.has(u)),"filtered_corpus","The list did not explicitly select every lifecycle status."),T(t,o.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),T(t,o.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),o}function pc(e,t,n){T(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."),T(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let r=P(e.projection)?e.projection:{};T(n,r.mode!=="full"||r.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let i=P(e.omission_receipt)?e.omission_receipt:void 0;T(n,i===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),T(n,i!==void 0&&(i.has_omissions!==!1||i.omitted_field_group_count!==0||!Number.isSafeInteger(i.omitted_field_group_count)||!Array.isArray(i.omitted_field_groups)||i.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),T(n,i?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function hc(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function gc(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function _c(e,t){let n=P(e.read_output)?e.read_output:void 0;T(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),T(t,n!==void 0&&hc(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),T(t,n!==void 0&&!gc(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),T(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let r=P(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;T(t,n?.result_omitted===!0||r?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),T(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function yc(e,t){let n=e.map(r=>P(r)&&typeof r.id=="string"?r.id.trim():"");T(t,n.some(r=>r.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),T(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function wc(e){if(!P(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:fc[0],message:"The result must be an object with an items array."}]};let t=e,n=[],r=mc(t,n);return pc(t,r,n),_c(t,n),yc(t.items,n),{ok:n.length===0,findings:n}}function vc(e,t){return t.includeBody!==void 0?t.includeBody:P(e)&&P(e.filters)&&e.filters.include_body===!0}function bc(e,t={}){let n=wc(e);if(!n.ok)throw new In(n.findings,{includeBody:vc(e,t)});let r=e;return{...r,complete_list:{contract_version:1,item_count:r.items.length,unique_item_id_count:new Set(r.items.map(i=>i.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function oh(e,t={}){bc(e,t)}async function uh(e,t={}){let n=await Ho({pmRoot:I(process.cwd(),e.path),exhaustive:t.exhaustive,...t.status===void 0?{}:{statuses:t.status.flatMap(r=>r.split(",").map(i=>i.trim()).filter(Boolean))},...t.since===void 0?{}:{since:t.since},...t.threshold===void 0?{}:{threshold:t.threshold},...t.limit===void 0?{}:{limit:t.limit}});return{...n,clusters:n.clusters.map(r=>{let i=r.id;return{...r,canonical_id:i,close_command:`pm close <duplicate-id> --duplicate-of ${i}`}}),guidance:{strategy:"review_then_close_duplicate",command:"pm close <duplicate-id> --duplicate-of <canonical-id>"}}}var zo=16;async function Ko(e,t,n){let r=R(t,C()).type_to_folder,i=[],o=new Set,s=n;for(;s&&i.length<zo;){let a=s.trim().toLowerCase();if(!a||o.has(a))break;o.add(a);let u=await ye(e,s,t.id_prefix,t.item_format,r);if(!u)break;let c=await we(u,{schema:t.schema});i.push(c.document.metadata.id),s=c.document.metadata.parent}return i}async function hh(e){await Si({pmRoot:e.pmRoot,principal:e.principal,itemId:e.itemId,lineageIds:await Ko(e.pmRoot,e.settings,e.itemId)})}async function gh(e){await Ei(e)}async function _h(e){await xi({pmRoot:e.pmRoot,principal:e.principal,...e.itemId?{itemId:e.itemId,lineageIds:await Ko(e.pmRoot,e.settings,e.itemId)}:{}})}var yh={lineage_depth:zo,active_items:64,evidence_rows:32};function Vo(e){if(!e)return;let t={};for(let n of e.active_item_ids)t[n]=1;e.focused_item_id&&(t[e.focused_item_id]=1);for(let n of e.evidence){let r=/^lineage:(.+)$/u.exec(n)?.[1];r&&t[r]===void 0&&(t[r]=.75)}return Object.keys(t).length>0?t:void 0}var Le=["priority_floor","weighted"],kc="default-weighted-v1";function Yo(e,t,n,r){let i=new Map(e.map(a=>[a.id,a.rank]));if(n!=="priority_floor"||r!==kc)return i;let o=t.in_progress_status,s=a=>E(a.item.status,t)===o?-1:a.item.priority;return e.sort((a,u)=>s(a)-s(u)||a.rank-u.rank),e.forEach((a,u)=>{a.rank=u+1}),i}function Qo(e,t,n,r){let i=e[0];if(!i)return;if(r==="priority_floor"){let a=t.get(i.item.id);return a!==void 0&&a!==1?`priority floor (relevance rank ${a})`:void 0}let o=n.in_progress_status,s=e.slice(1).filter(a=>a.item.priority<i.item.priority&&E(a.item.status,n)!==o).map(a=>a.item.priority);return s.length>0?`relevance over p${Math.min(...s)} ready work`:void 0}import{encode as Ec}from"@toon-format/toon";import{createHash as Sc}from"node:crypto";function Rn(e){let t=Sc("sha256").update("[");for(let n of e)t.update(ct(n)).update("\0");return t.update("]").digest("hex")}function De(e,t){if(t===void 0)return M();let n=Ui(t).snapshot,r=`${e}:`,i=n?.slice(r.length);if(!n?.startsWith(r)||!i||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u.test(i)||!Number.isFinite(Date.parse(i)))throw new h("Query cursor has no supported fixed-window clock.",p.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]});return i}function Pe(e,t){let n=e.map((a,u)=>({row:a,index:u})),r=he(t.command,{query:t.query,rows_digest:Rn(e)}),i=t.after===void 0?void 0:Bi(t.after,r);if(i&&(i.after_index===void 0||i.after_id!==String(i.after_index)||i.after_index>=e.length))throw new h("Query cursor position is outside the matching window.",p.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]});let o=ft(n,{cursor:t.after,fingerprint:r,snapshot:`${t.command}:${t.clock}`,limit:t.limit??e.length,readId:({index:a})=>String(a)}),s=i?.after_index===void 0?0:i.after_index+1;return{...o,rows:o.rows.map(({row:a})=>a),count:o.rows.length,total_count:e.length,page_start:s,omitted_count:e.length-s-o.rows.length,has_more:s+o.rows.length<e.length}}var An=["agenda","day","week","month"],Mn=["markdown","toon","json"],xc=["sun","mon","tue","wed","thu","fri","sat"],Cc=365,Tc=365,ns=28,Ic=1e3;function Fn(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw new h(`${t} must be a non-negative integer`,p.USAGE);return n}function Rc(e){if(!e)return new Set(["deadlines","reminders","events"]);let t=e.trim().toLowerCase();if(t==="all")return new Set(["deadlines","reminders","events"]);let n=t.split(/[|,]/).map(i=>i.trim()).filter(i=>i.length>0);if(n.length===0)throw new h("Calendar include filter must not be empty",p.USAGE);let r=new Set;for(let i of n){if(i==="deadlines"||i==="deadline"){r.add("deadlines");continue}if(i==="reminders"||i==="reminder"){r.add("reminders");continue}if(i==="events"||i==="event"||i==="scheduled"){r.add("events");continue}throw new h("Calendar include filter must be deadlines|reminders|events|scheduled|all",p.USAGE)}return r}function rs(e,t){let n;for(let r of t){let i=si(e,r,2);i!==null&&(n===void 0||i<n.distance)&&(n={choice:r,distance:i})}return n?.choice}function Ac(e){if(!e)return"agenda";let t=e.trim().toLowerCase();if(!An.includes(t)){let n=rs(t,An);throw new h(`Calendar view must be one of ${An.join("|")}${n?`. Did you mean "${n}"?`:"."}`,p.USAGE)}return t}function Mc(e){if(!e)return;let t=e.trim().toLowerCase();if(!Mn.includes(t)){let n=rs(t,Mn);throw new h(`Calendar format must be one of ${Mn.join("|")}${n?`. Did you mean "${n}"?`:"."}`,p.USAGE)}return t}function Fh(e,t){let n=Mc(e.format);if(t.json&&n&&n!=="json")throw new h("Cannot combine --json with --format markdown|toon",p.USAGE);return t.json?"json":n??"markdown"}function Fc(e,t){if(e===void 0)return;let n=F(e,t);if(!n){let r=t.definitions.map(i=>i.id);throw new h(`Calendar status filter must be one of ${r.join("|")}`,p.USAGE)}return n}function Oc(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new h("Calendar assignee filter must be one of assigned|unassigned",p.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new h(`Invalid calendar assignee filter "${e}". Allowed: assigned|unassigned`,p.USAGE);return t}function Tt(e){return new Date(e).toISOString().slice(0,10)}function is(e,t){if(!t||t==="UTC")return Tt(e);try{let n=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(e)),r=n.find(s=>s.type==="year")?.value,i=n.find(s=>s.type==="month")?.value,o=n.find(s=>s.type==="day")?.value;if(r&&i&&o)return`${r}-${i}-${o}`}catch{}return Tt(e)}function Ln(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)).toISOString()}function z(e,t){let n=new Date(e);return new Date(n.getTime()+t*24*60*60*1e3).toISOString()}function os(e){let t=new Date(Ln(e)),n=t.getUTCDay(),r=n===0?-6:1-n;return z(t.toISOString(),r)}function $c(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1,0,0,0,0)).toISOString()}function Nc(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,1,0,0,0,0)).toISOString()}function Lc(e,t){return S(e,t)>=0?e:t}function Xo(e){return Object.fromEntries([...e.entries()].sort(([t],[n])=>t.localeCompare(n)))}function Jo(e,t){e.set(t,(e.get(t)??0)+1)}function Dc(e){if(!e)return null;let t=[`freq=${e.freq}`];if(e.interval!==void 0&&t.push(`interval=${e.interval}`),e.count!==void 0&&t.push(`count=${e.count}`),e.until&&t.push(`until=${e.until}`),e.by_weekday&&e.by_weekday.length>0){let n=[...e.by_weekday].sort((r,i)=>de(r)-de(i));t.push(`by_weekday=${n.join("|")}`)}if(e.by_month_day&&e.by_month_day.length>0){let n=[...e.by_month_day].sort((r,i)=>r-i);t.push(`by_month_day=${n.join("|")}`)}if(e.exdates&&e.exdates.length>0){let n=[...e.exdates].sort((r,i)=>r.localeCompare(i));t.push(`exdates=${n.join("|")}`)}return t.join(",")}function ss(e,t,n,r){let i=new Date(Date.UTC(e,t,n,r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()));if(!(i.getUTCFullYear()!==e||i.getUTCMonth()!==t||i.getUTCDate()!==n))return i.toISOString()}function as(e){return xc[new Date(e).getUTCDay()]}function Pc(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function jc(e){let t=new Set;for(let n of e??[]){let r=Pc(n);r&&t.add(r)}return t}function Uc(e,t,n,r,i){let o=e??z(n,-(r??Tc)),s=t??z(e??n,i??Cc);return{start:o,end:S(s,o)>0?s:z(o,1)}}function Bc(e,t,n,r){let i=t.by_weekday!==void 0?[...t.by_weekday]:[as(e)],o=t.by_month_day!==void 0?[...t.by_month_day]:[new Date(e).getUTCDate()];return{startAt:e,startDate:new Date(e),window:n,maxOccurrences:r??Ic,interval:t.interval??1,countLimit:t.count??Number.POSITIVE_INFINITY,until:t.until,excluded:jc(t.exdates),weekdayFilter:t.by_weekday!==void 0?new Set(t.by_weekday):void 0,monthDayFilter:t.by_month_day!==void 0?new Set(t.by_month_day):void 0,sortedWeekdays:[...new Set(i)].sort((s,a)=>de(s)-de(a)),sortedMonthDays:[...new Set(o)].sort((s,a)=>s-a),occurrences:[],produced:0}}function It(e,t){return S(t,e.startAt)<0?"continue":e.until&&S(t,e.until)>0||S(t,e.window.end)>=0?"stop":e.excluded.has(t)?"continue":(e.produced+=1,S(t,e.window.start)>=0&&e.occurrences.push(t),e.produced>=e.countLimit||e.occurrences.length>=e.maxOccurrences?"stop":"continue")}function Rt(e,t){let n=as(t),r=new Date(t).getUTCDate(),i=!e.weekdayFilter||e.weekdayFilter.has(n),o=!e.monthDayFilter||e.monthDayFilter.has(r);return i&&o}function Hc(e){let t=e.startAt;for(let n=0;n<e.maxOccurrences&&!(Rt(e,t)&&It(e,t)==="stop");n+=1)t=z(t,e.interval);return e.occurrences}function Wc(e,t,n){let r=de(n),i=z(t,r),o=new Date(i);return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),e.startDate.getUTCHours(),e.startDate.getUTCMinutes(),e.startDate.getUTCSeconds(),e.startDate.getUTCMilliseconds())).toISOString()}function Gc(e){let t=os(e.startAt);for(let n=0;n<e.maxOccurrences;n+=1){let r=z(t,n*e.interval*7);for(let i of e.sortedWeekdays){let o=Wc(e,r,i);if(Rt(e,o)&&It(e,o)==="stop")return e.occurrences}}return e.occurrences}function qc(e){let t=e.startDate.getUTCFullYear(),n=e.startDate.getUTCMonth();for(let r=0;r<e.maxOccurrences;r+=1){let i=new Date(Date.UTC(t,n+r*e.interval,1,0,0,0,0));for(let o of e.sortedMonthDays){let s=ss(i.getUTCFullYear(),i.getUTCMonth(),o,e.startDate);if(!(!s||!Rt(e,s))&&It(e,s)==="stop")return e.occurrences}}return e.occurrences}function zc(e){let t=e.startDate.getUTCFullYear(),n=e.startDate.getUTCMonth();for(let r=0;r<e.maxOccurrences;r+=1){let i=t+r*e.interval;for(let o of e.sortedMonthDays){let s=ss(i,n,o,e.startDate);if(!(!s||!Rt(e,s))&&It(e,s)==="stop")return e.occurrences}}return e.occurrences}function Kc(e,t,n,r){let i=Bc(e,t,n,r);return t.freq==="daily"?Hc(i):t.freq==="weekly"?Gc(i):t.freq==="monthly"?qc(i):zc(i)}function cs(e){return[...e].sort((t,n)=>{let r=S(t.at,n.at);if(r!==0)return r;let i=t.item_priority-n.item_priority;if(i!==0)return i;let o=t.item_id.localeCompare(n.item_id);if(o!==0)return o;let s=t.kind.localeCompare(n.kind);if(s!==0)return s;let a=String(t.event_title).localeCompare(String(n.event_title));return a!==0?a:String(t.reminder_text).localeCompare(String(n.reminder_text))})}function Dn(e){return{item_id:e.id,item_title:e.title,item_type:e.type,item_status:e.status,item_priority:e.priority,item_assignee:e.assignee??null,item_deadline:e.deadline??null,item_tags:e.tags}}function Vc(e){return e.deadline?{at:e.deadline,date:Tt(e.deadline),kind:"deadline",reminder_text:null,event_title:null,event_end:null,event_location:null,event_all_day:null,event_timezone:null,event_recurring:null,event_recurrence_rule:null,...Dn(e),item_deadline:e.deadline}:null}function Yc(e){return(e.reminders??[]).map(t=>({at:t.at,date:Tt(t.at),kind:"reminder",reminder_text:t.text,event_title:null,event_end:null,event_location:null,event_all_day:null,event_timezone:null,event_recurring:null,event_recurrence_rule:null,...Dn(e)}))}function Qc(e,t){if(!t)return null;let n=Date.parse(t)-Date.parse(e);return Number.isFinite(n)&&n>0?n:null}function Xc(e,t,n){return t.recurrence&&n!==null?new Date(new Date(e).getTime()+n).toISOString():t.end_at??null}function Jc(e,t,n,r){let i=Dc(t.recurrence),o=Qc(t.start_at,t.end_at);return(t.recurrence?Kc(t.start_at,t.recurrence,n,r):[t.start_at]).map(a=>({at:a,date:t.all_day===!0?a.slice(0,10):is(a,t.timezone),kind:"event",reminder_text:t.description??null,event_title:t.title??e.title,event_end:Xc(a,t,o),event_location:t.location??null,event_all_day:t.all_day??null,event_timezone:t.timezone??null,event_recurring:!!t.recurrence,event_recurrence_rule:i,...Dn(e)}))}function Zc(e,t,n,r){let i=[];for(let o of e){let s=n.has("deadlines")?Vc(o):null;s&&i.push(s),n.has("reminders")&&i.push(...Yc(o));for(let a of n.has("events")?o.events??[]:[])i.push(...Jc(o,a,t,r))}return cs(i)}function eu(e,t,n,r,i){let o=xo(t.type,n),s=t.tag?.trim().toLowerCase(),a=Eo(t.priority),u=Fc(t.status,r),c=t.assignee?.trim(),d=Oc(t.assigneeFilter),l=t.sprint?.trim(),f=t.release?.trim();if(c&&(c.toLowerCase()==="none"||c.toLowerCase()==="null"))throw new h('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',p.USAGE);if(c!==void 0&&d==="unassigned")throw new h("Cannot combine --assignee with --assignee-filter unassigned",p.USAGE);return e.filter(m=>tu(m,{typeFilter:o,tagFilter:s,priorityFilter:a,statusFilter:u,assigneeFilter:c,assigneeModeFilter:d,sprintFilter:l,releaseFilter:f,runtimeFieldFilters:i}))}function tu(e,t){return nu(e,t)&&ru(e,t)&&vt(e,t.runtimeFieldFilters)}function nu(e,t){return!(t.typeFilter&&e.type!==t.typeFilter||t.tagFilter&&!e.tags.some(n=>n.trim().toLowerCase()===t.tagFilter)||t.priorityFilter!==void 0&&e.priority!==t.priorityFilter||t.statusFilter&&e.status!==t.statusFilter)}function ru(e,t){return!(t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee||t.assigneeFilter!==void 0&&e.assignee!==t.assigneeFilter||t.sprintFilter!==void 0&&e.sprint!==t.sprintFilter||t.releaseFilter!==void 0&&e.release!==t.releaseFilter)}function iu(e,t,n){return!(t&&S(e.at,t)<0||n&&S(e.at,n)>=0)}function On(e,t,n){return e.trim().toLowerCase()==="today"?Ln(t):G(e,new Date(t),n)}function ou(e,t,n){let r=t.date?On(t.date,n,"--date"):n,i=t.past===!0,o=t.fullPeriod===!0,s=t.from?On(t.from,n,"--from"):void 0,a=t.to?On(t.to,n,"--to"):void 0;if(s&&a&&S(s,a)>=0)throw new h("Calendar --from must be before --to",p.USAGE);if(e!=="agenda"&&(t.from!==void 0||t.to!==void 0))throw new h("--from and --to are only supported for --view agenda",p.USAGE);if(e==="agenda")return su(r,t,n,i,o,s,a);if(e==="day"){let c=Ln(r);return $n(r,n,i,o,c,z(c,1))}if(e==="week"){let c=os(r);return $n(r,n,i,o,c,z(c,7))}let u=$c(r);return $n(r,n,i,o,u,Nc(r))}function su(e,t,n,r,i,o,s){if(i)throw new h("--full-period is only supported for --view day|week|month. For agenda windows, use --from and --to.",p.USAGE);return{anchor:e,start:o??(t.date?e:r?void 0:n),end:s,fullPeriod:!1}}function $n(e,t,n,r,i,o){let s=n||r;return{anchor:e,start:s?i:Lc(i,t),end:o,periodStart:i,periodEnd:o,fullPeriod:s}}function au(e){let t=new Map;for(let n of e){let r=t.get(n.date)??[];r.push(n),t.set(n.date,r)}return[...t.entries()].sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>({date:n,count:r.length,events:cs(r)}))}function cu(e){let t=new Set,n=new Map,r=new Map,i=0,o=0,s=0,a=0;for(let u of e)t.add(u.item_id),Jo(n,u.item_type),Jo(r,u.item_status),u.kind==="deadline"?i+=1:u.kind==="reminder"?o+=1:(s+=1,u.event_recurring===!0&&(a+=1));return{events:e.length,items:t.size,deadlines:i,reminders:o,scheduled:s,by_kind:{deadline:i,reminder:o,event:s},by_type:Xo(n),by_status:Xo(r),recurring_events:a}}function uu(e){let t=e.start??"unbounded",n=e.end??"unbounded";return`${t} -> ${n}`}function us(e,t){if(t&&t!=="UTC")try{let n=new Intl.DateTimeFormat("en-GB",{timeZone:t,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(new Date(e)),r=n.find(o=>o.type==="hour")?.value,i=n.find(o=>o.type==="minute")?.value;if(r&&i)return`${r}:${i}`}catch{}return`${new Date(e).toISOString().slice(11,16)}Z`}function Nn(e){let t=Object.entries(e);return t.length===0?"empty":t.map(([n,r])=>`${n}=${r}`).join(", ")}function du(e){return e.event_end?e.event_all_day===!0?e.event_end.slice(0,10):e.date===is(e.event_end,e.event_timezone)?us(e.event_end,e.event_timezone):e.event_end:null}function lu(e){let t=`${us(e.at,e.event_timezone)} [${e.kind}] ${e.item_id} type=${e.item_type} p${e.item_priority} ${e.item_status} ${e.item_title}`;if(e.kind==="reminder"){let n=e.reminder_text??"";return`${t} \u2014 ${n} reminder=${JSON.stringify(n)}`}if(e.kind==="event"){let n=[],r=e.event_title??e.item_title;e.event_title!==null&&e.event_title!==e.item_title&&(n.push(r),n.push(`title=${JSON.stringify(r)}`)),e.event_recurring&&(n.push("(recurring)"),n.push("recurring=true"));let o=du(e);return o&&n.push(`end=${o}`),e.event_all_day!==null&&n.push(`all_day=${e.event_all_day?"true":"false"}`),e.event_timezone&&n.push(`timezone=${e.event_timezone}`),e.event_location&&(n.push(`@ ${e.event_location}`),n.push(`location=${JSON.stringify(e.event_location)}`)),e.event_recurrence_rule&&n.push(`recurrence=${e.event_recurrence_rule}`),e.reminder_text&&n.push(`description=${JSON.stringify(e.reminder_text)}`),`${t} \u2014 ${n.join(" ")}`}return t}function Zo(e,t){if(t&&t.length>0){e.push("### warnings");for(let n of t)e.push(`- ${n}`);e.push("")}}function Oh(e){let t=[];if(t.push(`# pm calendar (${e.view})`),t.push(""),t.push(`- now: ${e.now}`),t.push(`- window: ${uu(e.range)}`),e.range.period_start&&e.range.period_end&&(t.push(`- period: ${e.range.period_start} -> ${e.range.period_end}`),t.push(`- period-mode: ${e.range.full_period?"full-period":"active-window"}`)),t.push(`- events: ${e.summary.events} (deadlines: ${e.summary.deadlines}, reminders: ${e.summary.reminders}, scheduled: ${e.summary.scheduled})`),t.push(`- items: ${e.summary.items}`),t.push(`- matching-events: ${e.total_count}; returned: ${e.count}; remaining: ${e.omitted_count} (summary: ${e.summary_scope})`),e.next_cursor&&t.push(`- continue: repeat the same query with --after ${e.next_cursor}`),t.push(`- by-kind: ${Nn(e.summary.by_kind)}`),t.push(`- by-type: ${Nn(e.summary.by_type)}`),t.push(`- by-status: ${Nn(e.summary.by_status)}`),t.push(`- recurring-events: ${e.summary.recurring_events}`),t.push(""),e.events.length===0)return t.push(e.total_count===0?"No calendar events matched the selected filters.":"No calendar events returned on this page. Repeat the same query with --limit 1 or greater to retrieve matching events."),t.push(""),Zo(t,e.warnings),es(t.join(`
1
+ import{E as Ho,G as Wo,a as q,b as Eo,c as xo,e as $e,f as Co,g as To,h as Io,i as Ro,j as Ao,m as Mo,n as Fo,p as Lo,q as Do,t as Po,u as xn,v as Cn,w as H,y as jo,z as Uo}from"./chunk-EUQGZPGO.js";import{d as Go}from"./chunk-GXP7Q4XM.js";import{Aa as oo,Ab as ho,Ba as kt,Bb as go,Ca as so,Cb as _o,Da as St,Db as yo,Ea as Et,Eb as wo,Fa as xt,Ga as ao,Hb as vo,Jb as bo,Ka as co,La as kn,Ua as uo,ca as Ki,da as Vi,ga as vn,ha as Yi,sa as yt,sb as lo,ua as _e,ub as fo,va as wt,vb as mo,wa as vt,wb as Sn,xa as eo,xb as po,za as io}from"./chunk-FDZPRJXJ.js";import{Za as gi,fb as _i,g as gn,h as _n,j as yn,k as pi,l as hi}from"./chunk-LMFIAQ2V.js";import{d as Oo,e as $o,h as No,w as Bo}from"./chunk-YD66IRSL.js";import{a as Fe,c as Oe,f as En,g as ko,h as So,i as Ct}from"./chunk-LMU7DDOA.js";import{E as bt,G as to,H as ye,I as we,K as no,L as ve,O as ro,b as le,f as Qi,g as Xi,j as Zi,l as bn}from"./chunk-5LDBS6MS.js";import{a as ge,b as _t,c as Ji,s as A,y as B}from"./chunk-HL47UQZJ.js";import{$e as Li,A as Ie,Ae as dt,B as at,Bf as lt,Cf as he,Df as ji,Eb as F,Ef as Ui,F as di,Fb as E,Ff as Bi,G as li,Gb as Z,Gc as ne,Gf as Hi,Hc as Ti,Hf as Wi,Ic as Ii,If as ft,Lc as ee,Mf as mt,Of as pt,Q as R,Qe as $i,Qf as ht,Tb as vi,Tf as Gi,Uf as gt,W as I,Y as fi,Yc as Ri,_ as hn,_e as Ni,a as si,aa as fe,bb as me,df as Di,fg as qi,gb as mi,gc as bi,gg as zi,hc as ki,ic as Si,jc as Ei,je as C,kc as xi,md as Ai,mg as wn,oc as Re,re as Ae,te as Me,vf as Pi,we as Fi,x as pn,xc as Ci,xd as Mi,ye as Oi}from"./chunk-SMMOZ3H3.js";import{B as pe,E as ut,c as ct,t as M,w as yi,x as S,y as wi,z as G}from"./chunk-3Z7MCUJM.js";import{A as rt,O as L,Q as J,u as de,z as mn}from"./chunk-RIQUIHYU.js";import{A as h,C as ui,D as it,E as ot,I as st,t as ai,x as ci,z as p}from"./chunk-A6VEMCRR.js";var Ne=class extends RangeError{code;work;minimum_tokens;constructor(t,n,r){super(t),this.name="OutputEnvelopeFitError",this.code=t,this.work=Object.freeze({...n}),this.minimum_tokens=r}};function Tn(e,t){if(!Number.isSafeInteger(e)||e<1)throw new RangeError(`${t} must be a positive safe integer`)}function lc(e,t,n,r){return t.map(([i,o])=>{if(r.render_calls>=r.max_render_calls)throw new Ne("output_envelope_work_limit",r);r.render_calls+=1;let s=o(e);if(typeof s!="string")throw new TypeError("Envelope renderers must return strings");let a=n(s);if(!Number.isSafeInteger(a)||a<0)throw new RangeError("Envelope token estimates must be non-negative safe integers");return{name:i,text:s,bytes:Buffer.byteLength(s,"utf8"),estimated_tokens:a}})}function qo(e,t,n,r){let i=t,o=Object.entries(n.renderers),s=n.estimateTokens??(a=>$i(Buffer.byteLength(a,"utf8")));for(let a=0;a<(n.maxStabilizationPasses??16);a+=1){let u=Object.freeze({...i}),c={...n.buildEnvelope(e,u),output_fit:u},d=lc(c,o,s,r),l=Math.max(...d.map(m=>m.bytes)),f=Math.max(...d.map(m=>m.estimated_tokens));if(l===i.output_bytes&&f===i.estimated_tokens)return{envelope:c,renderings:d};i={...i,output_bytes:l,estimated_tokens:f}}throw new Ne("output_envelope_unstable",r)}function th(e,t){Tn(t.tokenBudget,"tokenBudget"),Tn(t.maxRenderCalls??1e4,"maxRenderCalls"),Tn(t.maxStabilizationPasses??16,"maxStabilizationPasses");let n=t.policy??"prefix";if(n!=="prefix"&&n!=="skip")throw new TypeError("Unknown output envelope fit policy");if(Object.entries(t.renderers).length===0||Object.entries(t.renderers).some(([u,c])=>!u.trim()||typeof c!="function"))throw new TypeError("Envelope fitting requires named callable renderers");let r={evaluated_candidates:0,render_calls:0,max_render_calls:t.maxRenderCalls??1e4},i=[],o=[],s=u=>({version:1,policy:n,total_candidates:e.length,included_indices:Object.freeze([...u]),omitted_count:e.length-u.length,token_budget:t.tokenBudget,estimated_tokens:0,output_bytes:0}),a=qo(i,s(o),t,r);if(a.envelope.output_fit.estimated_tokens>t.tokenBudget)throw new Ne("output_envelope_infeasible",r,a.envelope.output_fit.estimated_tokens);for(let[u,c]of e.entries()){r.evaluated_candidates+=1;let d=[...i,c],l=[...o,u],f=qo(d,s(l),t,r);if(f.envelope.output_fit.estimated_tokens<=t.tokenBudget)i=d,o=l,a=f;else if(n==="prefix")break}return{rows:i,...a,complete:i.length===e.length,work:Object.freeze({...r})}}var fc=["invalid_envelope","source_incomplete","source_unchecked","filtered_corpus","terminal_items_excluded","strict_read_unproven","page_incomplete","count_mismatch","projection_incomplete","field_omission","omission_receipt_missing","omission_receipt_invalid","read_output_missing","read_output_invalid","read_output_dimensions_incomplete","budget_compaction","budget_omission","session_projection","invalid_item_id","duplicate_item_id"],In=class extends Error{receipt;constructor(t,n={}){super(`Complete-list certification failed: ${t.map(i=>i.code).join(", ")}.`),this.name="PmCompleteListValidationError";let r=n.includeBody===!0;this.receipt={contract_version:1,contract:"complete_list",findings:t,recovery:{suggested_retry:`pm list --all --output-include full --strict-read --no-truncate --output-budget unbounded --output-limit unbounded${r?" --include-body":""} --json`,sdk:r?"await client.listAllComplete({ includeBody: true })":"await client.listAllComplete()"}}}};function ih(e={}){return Di({excludeTerminal:!1,full:!0,...e.includeBody===void 0?{}:{includeBody:e.includeBody},noTruncate:!0,outputBudget:"unbounded",outputLimit:"unbounded",strictRead:!0},["full"])}function P(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function T(e,t,n,r){t&&e.push({code:n,message:r})}function mc(e,t){let n=P(e.completeness)?e.completeness:{};T(t,n.status==="partial","source_incomplete","The source scan reported unreadable tracker artifacts."),T(t,n.status!=="complete"&&n.status!=="partial","source_unchecked","The source scan did not prove completeness.");let r=n.unreadable_item_count,i=n.unreadable_directory_count;T(t,n.status==="complete"&&(r!==0||i!==0)&&Number.isSafeInteger(r)&&Number.isSafeInteger(i),"source_incomplete","The source scan reports unreadable tracker artifacts despite a complete status."),T(t,n.status==="complete"&&(!Number.isSafeInteger(r)||!Number.isSafeInteger(i)||Number(r)<0||Number(i)<0),"source_unchecked","The source scan did not report safe non-negative unreadable counts.");let o=P(e.filters)?e.filters:{},s=P(o.runtime_filters)?o.runtime_filters:{},a=new Set(["exclude_terminal","include_body","no_truncate","runtime_filters","status","strict_read"]);return T(t,o.status!=="all"||Object.keys(s).length>0||Object.keys(o).some(u=>!a.has(u)),"filtered_corpus","The list did not explicitly select every lifecycle status."),T(t,o.exclude_terminal===!0,"terminal_items_excluded","Terminal lifecycle states were explicitly excluded."),T(t,o.strict_read!==!0,"strict_read_unproven","The result does not echo strict source-read enforcement."),o}function pc(e,t,n){T(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."),T(n,e.count!==e.items.length||e.total!==e.items.length,"count_mismatch","Envelope counts do not equal the returned item count.");let r=P(e.projection)?e.projection:{};T(n,r.mode!=="full"||r.fields!==null,"projection_incomplete","The result is not the full metadata projection.");let i=P(e.omission_receipt)?e.omission_receipt:void 0;T(n,i===void 0,"omission_receipt_missing","The result carries no field-omission receipt."),T(n,i!==void 0&&(i.has_omissions!==!1||i.omitted_field_group_count!==0||!Number.isSafeInteger(i.omitted_field_group_count)||!Array.isArray(i.omitted_field_groups)||i.omitted_field_groups.length!==0),"omission_receipt_invalid","The field-omission receipt is malformed or contradicts its no-omission claim."),T(n,i?.has_omissions===!0,"field_omission","The omission receipt reports withheld field groups.")}function hc(e){return e.contract_version!==1||e.command!=="list"||e.within_budget!==!0||e.strings_compacted!==!1||e.rows_compacted!==!1||e.result_omitted!==!1}function gc(e){if(!Array.isArray(e.requested_dimensions))return!1;let t=new Set(e.requested_dimensions);return["include","amount","cost"].every(n=>t.has(n))}function _c(e,t){let n=P(e.read_output)?e.read_output:void 0;T(t,n===void 0,"read_output_missing","The result carries no universal read-output receipt."),T(t,n!==void 0&&hc(n),"read_output_invalid","The universal read-output receipt does not prove an intact list result."),T(t,n!==void 0&&!gc(n),"read_output_dimensions_incomplete","The universal read-output receipt does not prove full, unbounded include, amount, and cost dimensions."),T(t,n?.strings_compacted===!0||n?.rows_compacted===!0||e.output_budget_truncation!==void 0,"budget_compaction","Universal output shaping compacted the result.");let r=P(e.output_budget_exceeded)?e.output_budget_exceeded:void 0;T(t,n?.result_omitted===!0||r?.omitted_result===!0,"budget_omission","Universal output shaping omitted the useful result."),T(t,e.read_session!==void 0,"session_projection","A cross-call read session can suppress previously served facts.")}function yc(e,t){let n=e.map(r=>P(r)&&typeof r.id=="string"?r.id.trim():"");T(t,n.some(r=>r.length===0),"invalid_item_id","Every full item row must carry a non-empty string id."),T(t,new Set(n).size!==n.length,"duplicate_item_id","Every item id must occur exactly once.")}function wc(e){if(!P(e)||!Array.isArray(e.items))return{ok:!1,findings:[{code:fc[0],message:"The result must be an object with an items array."}]};let t=e,n=[],r=mc(t,n);return pc(t,r,n),_c(t,n),yc(t.items,n),{ok:n.length===0,findings:n}}function vc(e,t){return t.includeBody!==void 0?t.includeBody:P(e)&&P(e.filters)&&e.filters.include_body===!0}function bc(e,t={}){let n=wc(e);if(!n.ok)throw new In(n.findings,{includeBody:vc(e,t)});let r=e;return{...r,complete_list:{contract_version:1,item_count:r.items.length,unique_item_id_count:new Set(r.items.map(i=>i.id)).size,terminal_items_included:!0,source_complete:!0,full_projection:!0,no_omissions:!0,unbounded:!0}}}function oh(e,t={}){bc(e,t)}async function uh(e,t={}){let n=await Ho({pmRoot:I(process.cwd(),e.path),exhaustive:t.exhaustive,...t.status===void 0?{}:{statuses:t.status.flatMap(r=>r.split(",").map(i=>i.trim()).filter(Boolean))},...t.since===void 0?{}:{since:t.since},...t.threshold===void 0?{}:{threshold:t.threshold},...t.limit===void 0?{}:{limit:t.limit}});return{...n,clusters:n.clusters.map(r=>{let i=r.id;return{...r,canonical_id:i,close_command:`pm close <duplicate-id> --duplicate-of ${i}`}}),guidance:{strategy:"review_then_close_duplicate",command:"pm close <duplicate-id> --duplicate-of <canonical-id>"}}}var zo=16;async function Ko(e,t,n){let r=R(t,C()).type_to_folder,i=[],o=new Set,s=n;for(;s&&i.length<zo;){let a=s.trim().toLowerCase();if(!a||o.has(a))break;o.add(a);let u=await ye(e,s,t.id_prefix,t.item_format,r);if(!u)break;let c=await we(u,{schema:t.schema});i.push(c.document.metadata.id),s=c.document.metadata.parent}return i}async function hh(e){await Si({pmRoot:e.pmRoot,principal:e.principal,itemId:e.itemId,lineageIds:await Ko(e.pmRoot,e.settings,e.itemId)})}async function gh(e){await Ei(e)}async function _h(e){await xi({pmRoot:e.pmRoot,principal:e.principal,...e.itemId?{itemId:e.itemId,lineageIds:await Ko(e.pmRoot,e.settings,e.itemId)}:{}})}var yh={lineage_depth:zo,active_items:64,evidence_rows:32};function Vo(e){if(!e)return;let t={};for(let n of e.active_item_ids)t[n]=1;e.focused_item_id&&(t[e.focused_item_id]=1);for(let n of e.evidence){let r=/^lineage:(.+)$/u.exec(n)?.[1];r&&t[r]===void 0&&(t[r]=.75)}return Object.keys(t).length>0?t:void 0}var Le=["priority_floor","weighted"],kc="default-weighted-v1";function Yo(e,t,n,r){let i=new Map(e.map(a=>[a.id,a.rank]));if(n!=="priority_floor"||r!==kc)return i;let o=t.in_progress_status,s=a=>E(a.item.status,t)===o?-1:a.item.priority;return e.sort((a,u)=>s(a)-s(u)||a.rank-u.rank),e.forEach((a,u)=>{a.rank=u+1}),i}function Qo(e,t,n,r){let i=e[0];if(!i)return;if(r==="priority_floor"){let a=t.get(i.item.id);return a!==void 0&&a!==1?`priority floor (relevance rank ${a})`:void 0}let o=n.in_progress_status,s=e.slice(1).filter(a=>a.item.priority<i.item.priority&&E(a.item.status,n)!==o).map(a=>a.item.priority);return s.length>0?`relevance over p${Math.min(...s)} ready work`:void 0}import{encode as Ec}from"@toon-format/toon";import{createHash as Sc}from"node:crypto";function Rn(e){let t=Sc("sha256").update("[");for(let n of e)t.update(ct(n)).update("\0");return t.update("]").digest("hex")}function De(e,t){if(t===void 0)return M();let n=Ui(t).snapshot,r=`${e}:`,i=n?.slice(r.length);if(!n?.startsWith(r)||!i||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u.test(i)||!Number.isFinite(Date.parse(i)))throw new h("Query cursor has no supported fixed-window clock.",p.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]});return i}function Pe(e,t){let n=e.map((a,u)=>({row:a,index:u})),r=he(t.command,{query:t.query,rows_digest:Rn(e)}),i=t.after===void 0?void 0:Bi(t.after,r);if(i&&(i.after_index===void 0||i.after_id!==String(i.after_index)||i.after_index>=e.length))throw new h("Query cursor position is outside the matching window.",p.USAGE,{code:"invalid_query_cursor",nextSteps:["Repeat the original query without --after to obtain a fresh cursor."]});let o=ft(n,{cursor:t.after,fingerprint:r,snapshot:`${t.command}:${t.clock}`,limit:t.limit??e.length,readId:({index:a})=>String(a)}),s=i?.after_index===void 0?0:i.after_index+1;return{...o,rows:o.rows.map(({row:a})=>a),count:o.rows.length,total_count:e.length,page_start:s,omitted_count:e.length-s-o.rows.length,has_more:s+o.rows.length<e.length}}var An=["agenda","day","week","month"],Mn=["markdown","toon","json"],xc=["sun","mon","tue","wed","thu","fri","sat"],Cc=365,Tc=365,ns=28,Ic=1e3;function Fn(e,t){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0)throw new h(`${t} must be a non-negative integer`,p.USAGE);return n}function Rc(e){if(!e)return new Set(["deadlines","reminders","events"]);let t=e.trim().toLowerCase();if(t==="all")return new Set(["deadlines","reminders","events"]);let n=t.split(/[|,]/).map(i=>i.trim()).filter(i=>i.length>0);if(n.length===0)throw new h("Calendar include filter must not be empty",p.USAGE);let r=new Set;for(let i of n){if(i==="deadlines"||i==="deadline"){r.add("deadlines");continue}if(i==="reminders"||i==="reminder"){r.add("reminders");continue}if(i==="events"||i==="event"||i==="scheduled"){r.add("events");continue}throw new h("Calendar include filter must be deadlines|reminders|events|scheduled|all",p.USAGE)}return r}function rs(e,t){let n;for(let r of t){let i=si(e,r,2);i!==null&&(n===void 0||i<n.distance)&&(n={choice:r,distance:i})}return n?.choice}function Ac(e){if(!e)return"agenda";let t=e.trim().toLowerCase();if(!An.includes(t)){let n=rs(t,An);throw new h(`Calendar view must be one of ${An.join("|")}${n?`. Did you mean "${n}"?`:"."}`,p.USAGE)}return t}function Mc(e){if(!e)return;let t=e.trim().toLowerCase();if(!Mn.includes(t)){let n=rs(t,Mn);throw new h(`Calendar format must be one of ${Mn.join("|")}${n?`. Did you mean "${n}"?`:"."}`,p.USAGE)}return t}function Fh(e,t){let n=Mc(e.format);if(t.json&&n&&n!=="json")throw new h("Cannot combine --json with --format markdown|toon",p.USAGE);return t.json?"json":n??"markdown"}function Fc(e,t){if(e===void 0)return;let n=F(e,t);if(!n){let r=t.definitions.map(i=>i.id);throw new h(`Calendar status filter must be one of ${r.join("|")}`,p.USAGE)}return n}function Oc(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new h("Calendar assignee filter must be one of assigned|unassigned",p.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new h(`Invalid calendar assignee filter "${e}". Allowed: assigned|unassigned`,p.USAGE);return t}function Tt(e){return new Date(e).toISOString().slice(0,10)}function is(e,t){if(!t||t==="UTC")return Tt(e);try{let n=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(e)),r=n.find(s=>s.type==="year")?.value,i=n.find(s=>s.type==="month")?.value,o=n.find(s=>s.type==="day")?.value;if(r&&i&&o)return`${r}-${i}-${o}`}catch{}return Tt(e)}function Ln(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate(),0,0,0,0)).toISOString()}function z(e,t){let n=new Date(e);return new Date(n.getTime()+t*24*60*60*1e3).toISOString()}function os(e){let t=new Date(Ln(e)),n=t.getUTCDay(),r=n===0?-6:1-n;return z(t.toISOString(),r)}function $c(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),1,0,0,0,0)).toISOString()}function Nc(e){let t=new Date(e);return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth()+1,1,0,0,0,0)).toISOString()}function Lc(e,t){return S(e,t)>=0?e:t}function Xo(e){return Object.fromEntries([...e.entries()].sort(([t],[n])=>t.localeCompare(n)))}function Jo(e,t){e.set(t,(e.get(t)??0)+1)}function Dc(e){if(!e)return null;let t=[`freq=${e.freq}`];if(e.interval!==void 0&&t.push(`interval=${e.interval}`),e.count!==void 0&&t.push(`count=${e.count}`),e.until&&t.push(`until=${e.until}`),e.by_weekday&&e.by_weekday.length>0){let n=[...e.by_weekday].sort((r,i)=>de(r)-de(i));t.push(`by_weekday=${n.join("|")}`)}if(e.by_month_day&&e.by_month_day.length>0){let n=[...e.by_month_day].sort((r,i)=>r-i);t.push(`by_month_day=${n.join("|")}`)}if(e.exdates&&e.exdates.length>0){let n=[...e.exdates].sort((r,i)=>r.localeCompare(i));t.push(`exdates=${n.join("|")}`)}return t.join(",")}function ss(e,t,n,r){let i=new Date(Date.UTC(e,t,n,r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()));if(!(i.getUTCFullYear()!==e||i.getUTCMonth()!==t||i.getUTCDate()!==n))return i.toISOString()}function as(e){return xc[new Date(e).getUTCDay()]}function Pc(e){let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toISOString():null}function jc(e){let t=new Set;for(let n of e??[]){let r=Pc(n);r&&t.add(r)}return t}function Uc(e,t,n,r,i){let o=e??z(n,-(r??Tc)),s=t??z(e??n,i??Cc);return{start:o,end:S(s,o)>0?s:z(o,1)}}function Bc(e,t,n,r){let i=t.by_weekday!==void 0?[...t.by_weekday]:[as(e)],o=t.by_month_day!==void 0?[...t.by_month_day]:[new Date(e).getUTCDate()];return{startAt:e,startDate:new Date(e),window:n,maxOccurrences:r??Ic,interval:t.interval??1,countLimit:t.count??Number.POSITIVE_INFINITY,until:t.until,excluded:jc(t.exdates),weekdayFilter:t.by_weekday!==void 0?new Set(t.by_weekday):void 0,monthDayFilter:t.by_month_day!==void 0?new Set(t.by_month_day):void 0,sortedWeekdays:[...new Set(i)].sort((s,a)=>de(s)-de(a)),sortedMonthDays:[...new Set(o)].sort((s,a)=>s-a),occurrences:[],produced:0}}function It(e,t){return S(t,e.startAt)<0?"continue":e.until&&S(t,e.until)>0||S(t,e.window.end)>=0?"stop":e.excluded.has(t)?"continue":(e.produced+=1,S(t,e.window.start)>=0&&e.occurrences.push(t),e.produced>=e.countLimit||e.occurrences.length>=e.maxOccurrences?"stop":"continue")}function Rt(e,t){let n=as(t),r=new Date(t).getUTCDate(),i=!e.weekdayFilter||e.weekdayFilter.has(n),o=!e.monthDayFilter||e.monthDayFilter.has(r);return i&&o}function Hc(e){let t=e.startAt;for(let n=0;n<e.maxOccurrences&&!(Rt(e,t)&&It(e,t)==="stop");n+=1)t=z(t,e.interval);return e.occurrences}function Wc(e,t,n){let r=de(n),i=z(t,r),o=new Date(i);return new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate(),e.startDate.getUTCHours(),e.startDate.getUTCMinutes(),e.startDate.getUTCSeconds(),e.startDate.getUTCMilliseconds())).toISOString()}function Gc(e){let t=os(e.startAt);for(let n=0;n<e.maxOccurrences;n+=1){let r=z(t,n*e.interval*7);for(let i of e.sortedWeekdays){let o=Wc(e,r,i);if(Rt(e,o)&&It(e,o)==="stop")return e.occurrences}}return e.occurrences}function qc(e){let t=e.startDate.getUTCFullYear(),n=e.startDate.getUTCMonth();for(let r=0;r<e.maxOccurrences;r+=1){let i=new Date(Date.UTC(t,n+r*e.interval,1,0,0,0,0));for(let o of e.sortedMonthDays){let s=ss(i.getUTCFullYear(),i.getUTCMonth(),o,e.startDate);if(!(!s||!Rt(e,s))&&It(e,s)==="stop")return e.occurrences}}return e.occurrences}function zc(e){let t=e.startDate.getUTCFullYear(),n=e.startDate.getUTCMonth();for(let r=0;r<e.maxOccurrences;r+=1){let i=t+r*e.interval;for(let o of e.sortedMonthDays){let s=ss(i,n,o,e.startDate);if(!(!s||!Rt(e,s))&&It(e,s)==="stop")return e.occurrences}}return e.occurrences}function Kc(e,t,n,r){let i=Bc(e,t,n,r);return t.freq==="daily"?Hc(i):t.freq==="weekly"?Gc(i):t.freq==="monthly"?qc(i):zc(i)}function cs(e){return[...e].sort((t,n)=>{let r=S(t.at,n.at);if(r!==0)return r;let i=t.item_priority-n.item_priority;if(i!==0)return i;let o=t.item_id.localeCompare(n.item_id);if(o!==0)return o;let s=t.kind.localeCompare(n.kind);if(s!==0)return s;let a=String(t.event_title).localeCompare(String(n.event_title));return a!==0?a:String(t.reminder_text).localeCompare(String(n.reminder_text))})}function Dn(e){return{item_id:e.id,item_title:e.title,item_type:e.type,item_status:e.status,item_priority:e.priority,item_assignee:e.assignee??null,item_deadline:e.deadline??null,item_tags:e.tags}}function Vc(e){return e.deadline?{at:e.deadline,date:Tt(e.deadline),kind:"deadline",reminder_text:null,event_title:null,event_end:null,event_location:null,event_all_day:null,event_timezone:null,event_recurring:null,event_recurrence_rule:null,...Dn(e),item_deadline:e.deadline}:null}function Yc(e){return(e.reminders??[]).map(t=>({at:t.at,date:Tt(t.at),kind:"reminder",reminder_text:t.text,event_title:null,event_end:null,event_location:null,event_all_day:null,event_timezone:null,event_recurring:null,event_recurrence_rule:null,...Dn(e)}))}function Qc(e,t){if(!t)return null;let n=Date.parse(t)-Date.parse(e);return Number.isFinite(n)&&n>0?n:null}function Xc(e,t,n){return t.recurrence&&n!==null?new Date(new Date(e).getTime()+n).toISOString():t.end_at??null}function Jc(e,t,n,r){let i=Dc(t.recurrence),o=Qc(t.start_at,t.end_at);return(t.recurrence?Kc(t.start_at,t.recurrence,n,r):[t.start_at]).map(a=>({at:a,date:t.all_day===!0?a.slice(0,10):is(a,t.timezone),kind:"event",reminder_text:t.description??null,event_title:t.title??e.title,event_end:Xc(a,t,o),event_location:t.location??null,event_all_day:t.all_day??null,event_timezone:t.timezone??null,event_recurring:!!t.recurrence,event_recurrence_rule:i,...Dn(e)}))}function Zc(e,t,n,r){let i=[];for(let o of e){let s=n.has("deadlines")?Vc(o):null;s&&i.push(s),n.has("reminders")&&i.push(...Yc(o));for(let a of n.has("events")?o.events??[]:[])i.push(...Jc(o,a,t,r))}return cs(i)}function eu(e,t,n,r,i){let o=xo(t.type,n),s=t.tag?.trim().toLowerCase(),a=Eo(t.priority),u=Fc(t.status,r),c=t.assignee?.trim(),d=Oc(t.assigneeFilter),l=t.sprint?.trim(),f=t.release?.trim();if(c&&(c.toLowerCase()==="none"||c.toLowerCase()==="null"))throw new h('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',p.USAGE);if(c!==void 0&&d==="unassigned")throw new h("Cannot combine --assignee with --assignee-filter unassigned",p.USAGE);return e.filter(m=>tu(m,{typeFilter:o,tagFilter:s,priorityFilter:a,statusFilter:u,assigneeFilter:c,assigneeModeFilter:d,sprintFilter:l,releaseFilter:f,runtimeFieldFilters:i}))}function tu(e,t){return nu(e,t)&&ru(e,t)&&vt(e,t.runtimeFieldFilters)}function nu(e,t){return!(t.typeFilter&&e.type!==t.typeFilter||t.tagFilter&&!e.tags.some(n=>n.trim().toLowerCase()===t.tagFilter)||t.priorityFilter!==void 0&&e.priority!==t.priorityFilter||t.statusFilter&&e.status!==t.statusFilter)}function ru(e,t){return!(t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee||t.assigneeFilter!==void 0&&e.assignee!==t.assigneeFilter||t.sprintFilter!==void 0&&e.sprint!==t.sprintFilter||t.releaseFilter!==void 0&&e.release!==t.releaseFilter)}function iu(e,t,n){return!(t&&S(e.at,t)<0||n&&S(e.at,n)>=0)}function On(e,t,n){return e.trim().toLowerCase()==="today"?Ln(t):G(e,new Date(t),n)}function ou(e,t,n){let r=t.date?On(t.date,n,"--date"):n,i=t.past===!0,o=t.fullPeriod===!0,s=t.from?On(t.from,n,"--from"):void 0,a=t.to?On(t.to,n,"--to"):void 0;if(s&&a&&S(s,a)>=0)throw new h("Calendar --from must be before --to",p.USAGE);if(e!=="agenda"&&(t.from!==void 0||t.to!==void 0))throw new h("--from and --to are only supported for --view agenda",p.USAGE);if(e==="agenda")return su(r,t,n,i,o,s,a);if(e==="day"){let c=Ln(r);return $n(r,n,i,o,c,z(c,1))}if(e==="week"){let c=os(r);return $n(r,n,i,o,c,z(c,7))}let u=$c(r);return $n(r,n,i,o,u,Nc(r))}function su(e,t,n,r,i,o,s){if(i)throw new h("--full-period is only supported for --view day|week|month. For agenda windows, use --from and --to.",p.USAGE);return{anchor:e,start:o??(t.date?e:r?void 0:n),end:s,fullPeriod:!1}}function $n(e,t,n,r,i,o){let s=n||r;return{anchor:e,start:s?i:Lc(i,t),end:o,periodStart:i,periodEnd:o,fullPeriod:s}}function au(e){let t=new Map;for(let n of e){let r=t.get(n.date)??[];r.push(n),t.set(n.date,r)}return[...t.entries()].sort(([n],[r])=>n.localeCompare(r)).map(([n,r])=>({date:n,count:r.length,events:cs(r)}))}function cu(e){let t=new Set,n=new Map,r=new Map,i=0,o=0,s=0,a=0;for(let u of e)t.add(u.item_id),Jo(n,u.item_type),Jo(r,u.item_status),u.kind==="deadline"?i+=1:u.kind==="reminder"?o+=1:(s+=1,u.event_recurring===!0&&(a+=1));return{events:e.length,items:t.size,deadlines:i,reminders:o,scheduled:s,by_kind:{deadline:i,reminder:o,event:s},by_type:Xo(n),by_status:Xo(r),recurring_events:a}}function uu(e){let t=e.start??"unbounded",n=e.end??"unbounded";return`${t} -> ${n}`}function us(e,t){if(t&&t!=="UTC")try{let n=new Intl.DateTimeFormat("en-GB",{timeZone:t,hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(new Date(e)),r=n.find(o=>o.type==="hour")?.value,i=n.find(o=>o.type==="minute")?.value;if(r&&i)return`${r}:${i}`}catch{}return`${new Date(e).toISOString().slice(11,16)}Z`}function Nn(e){let t=Object.entries(e);return t.length===0?"empty":t.map(([n,r])=>`${n}=${r}`).join(", ")}function du(e){return e.event_end?e.event_all_day===!0?e.event_end.slice(0,10):e.date===is(e.event_end,e.event_timezone)?us(e.event_end,e.event_timezone):e.event_end:null}function lu(e){let t=`${us(e.at,e.event_timezone)} [${e.kind}] ${e.item_id} type=${e.item_type} p${e.item_priority} ${e.item_status} ${e.item_title}`;if(e.kind==="reminder"){let n=e.reminder_text??"";return`${t} \u2014 ${n} reminder=${JSON.stringify(n)}`}if(e.kind==="event"){let n=[],r=e.event_title??e.item_title;e.event_title!==null&&e.event_title!==e.item_title&&(n.push(r),n.push(`title=${JSON.stringify(r)}`)),e.event_recurring&&(n.push("(recurring)"),n.push("recurring=true"));let o=du(e);return o&&n.push(`end=${o}`),e.event_all_day!==null&&n.push(`all_day=${e.event_all_day?"true":"false"}`),e.event_timezone&&n.push(`timezone=${e.event_timezone}`),e.event_location&&(n.push(`@ ${e.event_location}`),n.push(`location=${JSON.stringify(e.event_location)}`)),e.event_recurrence_rule&&n.push(`recurrence=${e.event_recurrence_rule}`),e.reminder_text&&n.push(`description=${JSON.stringify(e.reminder_text)}`),`${t} \u2014 ${n.join(" ")}`}return t}function Zo(e,t){if(t&&t.length>0){e.push("### warnings");for(let n of t)e.push(`- ${n}`);e.push("")}}function Oh(e){let t=[];if(t.push(`# pm calendar (${e.view})`),t.push(""),t.push(`- now: ${e.now}`),t.push(`- window: ${uu(e.range)}`),e.range.period_start&&e.range.period_end&&(t.push(`- period: ${e.range.period_start} -> ${e.range.period_end}`),t.push(`- period-mode: ${e.range.full_period?"full-period":"active-window"}`)),t.push(`- events: ${e.summary.events} (deadlines: ${e.summary.deadlines}, reminders: ${e.summary.reminders}, scheduled: ${e.summary.scheduled})`),t.push(`- items: ${e.summary.items}`),t.push(`- matching-events: ${e.total_count}; returned: ${e.count}; remaining: ${e.omitted_count} (summary: ${e.summary_scope})`),e.next_cursor&&t.push(`- continue: repeat the same query with --after ${e.next_cursor}`),t.push(`- by-kind: ${Nn(e.summary.by_kind)}`),t.push(`- by-type: ${Nn(e.summary.by_type)}`),t.push(`- by-status: ${Nn(e.summary.by_status)}`),t.push(`- recurring-events: ${e.summary.recurring_events}`),t.push(""),e.events.length===0)return t.push(e.total_count===0?"No calendar events matched the selected filters.":"No calendar events returned on this page. Repeat the same query with --limit 1 or greater to retrieve matching events."),t.push(""),Zo(t,e.warnings),es(t.join(`
2
2
  `));for(let n of e.days){t.push(`## ${n.date} (${n.count})`);for(let r of n.events)t.push(`- ${lu(r)}`);t.push("")}return Zo(t,e.warnings),es(t.join(`
3
3
  `))}function $h(e){return Ec(e)}function es(e){let t=e.length;for(;t>0&&e[t-1]===`
4
4
  `;)t-=1;return e.slice(0,t)}function fu(e){let t=De("calendar",e.after),n=Ac(e.view),r=ou(n,e,t),i=q(e.limit),o=Rc(e.include),s=Fn(e.recurrenceLookaheadDays,"Calendar recurrence lookahead days"),a=Fn(e.recurrenceLookbackDays,"Calendar recurrence lookback days"),u=Fn(e.occurrenceLimit,"Calendar occurrence limit");if(u!==void 0&&u<1)throw new h("Calendar occurrence limit must be >= 1",p.USAGE);let c=o.has("events")&&!o.has("deadlines")&&!o.has("reminders"),d=e.to!==void 0||s!==void 0||a!==void 0||u!==void 0,l=c&&!d;return{nowValue:t,view:n,rangeBounds:r,limit:i,includeSources:o,occurrenceLimit:u,recurrenceLookaheadDays:l?ns:s,recurrenceLookbackWindowDays:l&&a===void 0?0:a,eventsOnlyCapApplied:l}}function mu(e,t){t&&e.push(`recurring_events_default_cap_applied:lookback=0d,lookahead=${ns}d -- use --recurrence-lookback-days/--recurrence-lookahead-days or --to for wider range`)}function ts(e,t){return{type:e.type??null,tag:e.tag??null,priority:e.priority??null,status:e.status??null,assignee:e.assignee??null,assignee_filter:e.assigneeFilter??null,sprint:e.sprint??null,release:e.release??null,runtime_filters:t,limit:e.limit??null,include:e.include??null,full_period:e.fullPeriod===!0?"true":null,recurrence_lookahead_days:e.recurrenceLookaheadDays??null,recurrence_lookback_days:e.recurrenceLookbackDays??null,occurrence_limit:e.occurrenceLimit??null}}function pu(e,t){return{start:t.start??null,end:t.end??null,period_start:t.periodStart??null,period_end:t.periodEnd??null,full_period:t.fullPeriod,past:e.past===!0,from:e.from??null,to:e.to??null}}async function ds(e,t){let n=I(process.cwd(),t.path);await B(n);let r=fu(e),i=await A(n),o=L(i.schema),s=J(i.schema),a=wt(e,s,"calendar"),u=R(i,C()),c=[];mu(c,r.eventsOnlyCapApplied);let d=await ve(n,i.item_format,u.type_to_folder,c,i.schema),l=eu(d,e,u,o,a),f=Uc(r.rangeBounds.start,r.rangeBounds.end,r.nowValue,r.recurrenceLookbackWindowDays,r.recurrenceLookaheadDays),_=Zc(l,f,r.includeSources,r.occurrenceLimit).filter(v=>iu(v,r.rangeBounds.start,r.rangeBounds.end)),{rows:y,...g}=Pe(_,{command:"calendar",after:e.after,clock:r.nowValue,limit:r.limit,query:{pmRoot:n,view:r.view,range:r.rangeBounds,filters:{...ts(e,a),limit:void 0},recurringWindow:f,occurrenceLimit:r.occurrenceLimit}}),w=au(y),x=[...new Set(c)].sort((v,b)=>v.localeCompare(b));return{view:r.view,output_default:"markdown",now:r.nowValue,anchor:r.rangeBounds.anchor,range:pu(e,r.rangeBounds),filters:ts(e,a),...g,summary_scope:"returned_rows",summary:cu(y),events:y,days:w,...x.length>0?{warnings:x}:{}}}import ju from"node:fs/promises";import Es from"node:path";import{createHash as ps}from"node:crypto";import K from"node:fs/promises";import hu from"node:os";import Ft from"node:path";var gu="runtime/history-stream-summary.json",hs=1,ls=64,_u=2000000000n,yu=500,wu=yu,vu=()=>Date.now(),bu=()=>ku(Su(process,hu.userInfo));function ku(e){return e===void 0?void 0:ps("sha256").update(e).digest("hex").slice(0,16)}function Su(e,t){try{if(e.geteuid&&e.getegid&&e.getgroups){let r=[...new Set(e.getgroups())].sort((i,o)=>i-o);return`uid:${e.geteuid()}:gid:${e.getegid()}:groups:${r.join(",")}`}let{username:n}=t();return n.length>0?`user:${n}`:void 0}catch{return}}var Eu=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/u;function xu(e,t){return t===2?e%4===0&&e%100!==0||e%400===0?29:28:t===4||t===6||t===9||t===11?30:31}function gs(e){if(typeof e!="string"||!Eu.test(e))return!1;let t=Number(e.slice(0,4)),n=Number(e.slice(5,7)),r=Number(e.slice(8,10));return n>=1&&n<=12&&r>=1&&r<=xu(t,n)&&Number(e.slice(11,13))<24&&Number(e.slice(14,16))<60&&Number(e.slice(17,19))<60}function Cu(e){let t=null,n=null,r=!1;for(let i of e){let o=typeof i=="object"&&i!==null?i.ts:void 0;if(!gs(o)){r=!0;continue}(t===null||o<t)&&(t=o),(n===null||o>n)&&(n=o)}return{count:e.length,oldest:t,newest:n,irregular:r}}function Tu(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="EEXIST"}function Mt(e){return Ft.join(e,...gu.split("/"))}function _s(e,t){if(!(!e.isFile()||e.ino===0n||t===void 0))return{size:e.size,signature:[e.dev,e.ino,e.size,e.mtimeNs,e.ctimeNs,t].join(":"),changedAtNs:e.mtimeNs>e.ctimeNs?e.mtimeNs:e.ctimeNs}}async function fs(e,t,n){let r=new Map;for(let i=0;i<t.length;i+=ls){let o=t.slice(i,i+ls);(await Promise.all(o.map(a=>K.stat(Ft.join(e,a),{bigint:!0}).catch(()=>{})))).forEach((a,u)=>{let c=a===void 0?void 0:_s(a,n);c!==void 0&&r.set(o[u],c)})}return r}function ms(e){return e===null||gs(e)}function Iu(e){return e.oldest===null!=(e.newest===null)?!1:e.count===0?e.oldest===null&&!e.irregular:e.oldest===null?e.irregular:e.oldest<=e.newest}function Ru(e){if(!Array.isArray(e)||e.length!==5)return;let[t,n,r,i,o]=e;if(typeof t!="string"||!Number.isSafeInteger(n)||n<0||!ms(r)||!ms(i)||typeof o!="boolean")return;let s={count:n,oldest:r,newest:i,irregular:o};return Iu(s)?{signature:t,bounds:s}:void 0}function ys(e){return 4096+e*1024}function Au(e,t,n){return!e.isFile()||e.nlink!==1||e.size>ys(t)?!1:n===void 0||e.uid===n&&(e.mode&18)===0}async function Pn(e){return(await K.lstat(Ft.join(e,"runtime"))).isDirectory()}async function ws(e){try{return!(await K.lstat(Mt(e))).isFile()}catch{return!1}}async function Mu(e){try{if(!await Pn(e))return!0}catch{return!1}return ws(e)}async function Fu(e,t){if(!await Pn(e))throw new Error("runtime directory is redirected");if((await K.lstat(Mt(e))).isSymbolicLink())throw new Error("history stream summary is a link");let n=await K.open(Mt(e),K.constants.O_RDONLY|K.constants.O_NOFOLLOW|K.constants.O_NONBLOCK);try{let r=await n.stat();if(!Au(r,t,process.geteuid?.()))throw new Error("history stream summary is not a trusted file");return await Ou(n,ys(t),r.size)}finally{await n.close()}}async function Ou(e,t,n){let r=Buffer.alloc(Math.min(Math.max(n,0),t)+1),i=0;for(;;){if(i===r.length){let s=Buffer.alloc(Math.min(r.length*2,t+1));r.copy(s,0,0,i),r=s}let{bytesRead:o}=await e.read(r,i,r.length-i,i);if(o===0)break;if(i+=o,i>t)throw new Error("history stream summary grew past its size cap")}return r.subarray(0,i).toString("utf8")}async function $u(e,t){let n;try{n=await Fu(e,t)}catch(r){return{state:ot(r)?"missing":"invalid",streams:new Map}}try{let r=JSON.parse(n);if(r.version!==hs||typeof r.streams!="object"||r.streams===null||Array.isArray(r.streams)||r.checksum!==vs(r.streams))return{state:"invalid",streams:new Map};let i=new Map;for(let[o,s]of Object.entries(r.streams)){let a=Ru(s);if(a===void 0)return{state:"invalid",streams:new Map};i.set(o,a)}return{state:"loaded",streams:i}}catch{return{state:"invalid",streams:new Map}}}function Nu(e){let t=[...e.entries()].sort(([r],[i])=>r<i?-1:1),n={};for(let[r,{signature:i,bounds:o}]of t)n[r]=[i,o.count,o.oldest,o.newest,o.irregular];return`${JSON.stringify({version:hs,checksum:vs(n),streams:n})}
@@ -10,4 +10,4 @@ import{E as Ho,G as Wo,a as q,b as Eo,c as xo,e as $e,f as Co,g as To,h as Io,i
10
10
  `)}catch{}}function Ja(e,t){return[`vector_index_stale:${e}`,`vector_index_recovery:${t.args.join(" ")}`,...t.follow_up_args?[`vector_index_recovery_follow_up:${t.follow_up_args.join(" ")}`]:[]]}function an(e,t,n,r){if(!t.active)throw new h(`Search mode '${e}' requires a configured embedding provider in settings.providers.openai or settings.providers.ollama`,p.USAGE);if(!n.active&&!r)throw new h(`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`,p.USAGE);return{provider:t.active,vectorStore:n.active??null}}var U=at;function Je(e){let t=C(),n=Ki(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=U(r.name)??U(n.definition.name)??e;if(!a)return null;let u={providerName:a,...typeof i=="function"?{query:i}:{},...typeof o=="function"?{queryExpansion:o}:{},...typeof s=="function"?{rerank:s}:{}};return!u.query&&!u.queryExpansion&&!u.rerank?null:u}function Lr(e){let t=U(e.search?.provider),n=Je(t);return n?.query?{providerName:n.providerName,query:n.query}:null}function Dr(e){let t=C(),n=U(e.vector_store?.adapter),r=Vi(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:U(i.name)??U(r.definition.name)??n??"extension",query:o,...typeof s=="function"?{upsert:s}:{}}}function Pr(e,t,n){let r=Array.isArray(t)?t:t?.hits;if(!Array.isArray(r))throw new h(`Extension search provider "${e}" must return an array of hits or { hits: [...] }`,p.GENERIC_FAILURE);let i=new Set,o=[];for(let s of r){if(typeof s!="object"||s===null)continue;let a=U(s.id),u=s.score;if(!a||typeof u!="number"||!Number.isFinite(u)||i.has(a))continue;let c=n.get(a);if(!c)continue;let d=s.matched_fields,l=Array.isArray(d)&&d.every(f=>typeof f=="string")?[...new Set(d.map(f=>f.trim()).filter(f=>f.length>0))].sort((f,m)=>f.localeCompare(m)):[`provider:${e}`];i.add(a),o.push({item:c.metadata,score:u,matched_fields:l})}return o}function jr(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 rn(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,d)=>Math.max(c,d.score),0),s=n.sort((c,d)=>d.score-c.score),a=o+s.length+1;return[...s.map((c,d)=>({...c,score:a-d,matched_fields:["id"]})),...i]}function cn(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=Xe(t),u=Xe(o),c=new Set([...t.keys(),...o.keys()]),d=1-r;return[...c].map(l=>{let f=e.get(l),m=a.get(l)??0,_=u.get(l)??0,y=m*r+_*d;if(y<=0)return null;let g=new Set;t.has(l)&&g.add(i);for(let w of s.get(l)??[])g.add(w);return{item:f.metadata,score:y,matched_fields:[...g].sort((w,x)=>w.localeCompare(x))}}).filter(l=>l!==null)}function Ur(e){let t=e.configuredProvider?.trim().toLowerCase();return t==="bm25"?"explicit":t==="auto"&&!e.hasEmbeddingProvider&&!e.hasExtensionSearchProvider?"auto-fallback":null}function Br(e){let t=e.filteredDocuments.map(s=>({id:s.metadata.id,text:ja(ao(s,{fields:e.corpusFields}))})),n=Da(t),r=Pa(n,kr(e.query),e.bm25Params),i=new Map(e.filteredDocuments.map(s=>[s.metadata.id,s]));if(e.requestedMode==="semantic"){let s=[...r].map(([a,u])=>({item:i.get(a).metadata,score:u,matched_fields:["bm25"]}));return rn(s,e.keywordHits)}let o=cn(i,r,e.keywordHits,e.hybridSemanticWeight,"bm25");return rn(o,e.keywordHits)}function Hr(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 Wr(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(`
11
11
  `)}async function Dp(e,t){let n=e.queryExpansion.enabled?Ba(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 Wa(r,Ha(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 Pp(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 h(`Extension vector adapter query failed and no built-in fallback store is configured (${i instanceof Error?i.message:String(i)})`,p.GENERIC_FAILURE);return e.warnings.push(`search_vector_adapter_failed:${e.extensionVectorAdapter.adapterName}:using_builtin`),await kn(e.vectorStore,t,n,r)}if(e.vectorStore)return await kn(e.vectorStore,t,n,r);throw new h("Semantic search requires either a configured vector store or an extension vector adapter query handler",p.USAGE)}function jp(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:Wr(o)}:null}).filter(i=>i!==null)}async function Up(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=za(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 Bp(e,t,n){let r=await Up(e,t,n);if(r)return r;let i=n.map(o=>({id:o.hit.item.id,text:o.text}));try{return await Va(e.provider,e.rerank.model,t,i,e.embeddingTimeoutMs)}catch{return e.warnings.push("search_rerank_failed:using_hybrid_scores"),null}}function Hp(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,u)=>a.localeCompare(u))}});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 Wp(e,t,n,r){if(!e.rerank.enabled||n.length<=1)return n;let i=jp(n,r,e.rerank.top_k),o=await Bp(e,t,i);return o&&o.size>0?Hp(n,o):n}async function Gr(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 Dp(e,i),s=await kt(e.provider,o,n),a=await Promise.all(s.map(async _=>await Pp(e,_,t,r))),u=Hr(a),c=new Map(e.filteredDocuments.map(_=>[_.metadata.id,_])),{semanticHits:d,semanticScores:l}=jr(u,c),f=l.size;if(e.requestedMode==="semantic")return{hits:rn(d,e.keywordHits),vectorMatchCount:f};let m=await Wp(e,i,cn(c,l,e.keywordHits,e.hybridSemanticWeight),c);return{hits:rn(m,e.keywordHits),vectorMatchCount:f}}function Za(e){let t=Je(e.provider??void 0);return t?.queryExpansion?{providerName:t.providerName,expand:t.queryExpansion}:null}function ec(e){let t=Je(U(e.search?.provider));return t?.rerank?{providerName:t.providerName,rerank:t.rerank}:null}import un from"node:fs/promises";import qr from"node:path";function zr(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 tc(e){let t=qr.resolve(e);try{let n=await un.realpath(t);return{resolved:t,realpath:n}}catch{return null}}async function Kr(e,t){let[n,r]=await Promise.all([tc(e),tc(t)]);return{projectContainmentRoot:n,globalContainmentRoot:r}}async function Vr(e,t){let n=zr(e.metadata),r=[];for(let i of n){let o=i.scope==="global"?t.globalContainmentRoot:t.projectContainmentRoot;if(!o)continue;let s=qr.resolve(o.resolved,i.path);if(!pn(o.resolved,s))continue;let a;try{a=await un.realpath(s)}catch{continue}if(pn(o.realpath,a))try{await Ae({path:s,scope:i.scope}),r.push(await un.readFile(s,"utf8"))}catch{}}return r.join(`
12
12
  `)}async function Yr(e,t,n,r){let i=le(C()),o=async(c,d,l)=>{let f=async(m,_)=>{await Ae({path:m,scope:"project"});let y=await un.readFile(m,"utf8");return vi(y,{format:_,schema:r,extensionFieldNames:i,onWarning:w=>s.push(w)}).body};try{return await f(d,l)}catch{let m=l==="toon"?"json_markdown":"toon",_=hn(e,c.type,c.id,m,n);try{return await f(_,m)}catch{return s.push(`item_list_item_read_failed:${qr.relative(e,_)}`),""}}},s=[],a=await to(e,t,n,s,r),u=[];if(a.length===0){let c=await no(e,t,n,s,r);for(let d of c){let l=hn(e,d.type,d.id,t,n),f=await o(d,l,t);u.push({metadata:d,body:f})}return{documents:u,warnings:[...new Set(s)].sort((d,l)=>d.localeCompare(l))}}for(let c of a){if(typeof c.body=="string"){u.push({metadata:c.metadata,body:c.body});continue}let d=await o(c.metadata,c.item_path,c.item_format);u.push({metadata:c.metadata,body:d})}return{documents:u,warnings:[...new Set(s)].sort((c,d)=>c.localeCompare(d))}}async function nc(e,t,n){let r=new Map;if(!e||t!=="keyword"&&t!=="hybrid")return r;let i=process.cwd(),o=await Kr(i,fi(i)),s=await Promise.all(n.map(async a=>[a.metadata.id,await Vr(a,o)]));for(let[a,u]of s)r.set(a,u);return r}var rc=["tag","status","type","priority"];function Qr(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=rc.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 Xr(e,t,n){let r={...e};for(let i of rc){let o=t[i];if(o!==void 0){if(at(r[i])!==void 0){n.push(`search_inline_filter_ignored:${i}:flag_takes_precedence`);continue}r[i]=o}}return r}function ic(e,t){let n=[],r=Qr(e),i=Object.keys(r.inlineFilters).length>0;if(i&&r.residualQuery.trim().length===0)throw new h("Inline field:value tokens consumed the entire query, leaving no search terms.",p.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=Xr(t,r.inlineFilters,n);return{query:o,options:s,inlineWarnings:n,highlight:s.highlight===!0,includeLinked:Xt(s.includeLinked),titleExact:Xt(s.titleExact),phraseExact:Xt(s.phraseExact),matchMode:Fa(typeof s.matchMode=="string"?s.matchMode:void 0),minScoreOverride:Oa(s.minScore),countOnly:s.count===!0,tokens:Zt(o),normalizedQuery:j(o),limit:_e(s.limit),projection:Jt(s,e),modeWasExplicit:typeof s.mode=="string"&&s.mode.trim().length>0}}function oc(e){if(e.after!==void 0&&e.count===!0)throw new h("Search --after cannot be combined with --count.",p.USAGE)}function Zr(e,t,n,r,i,o,s,a,u,c,d,l,f,m){let _=f?{total:0,count_only:!0}:{};if(c.mode==="compact"&&r.compact===!0){let w=oe({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,...ii(m),items:[],count:0,..._,filters:w,...d.length>0?{warnings:d}:{}}}let g=c.mode==="full"?null:[...c.fields];return{query:e.trim(),mode:t,mode_source:m,items:[],count:0,..._,filters:ri({effectiveMode:t,matchMode:n,options:r,includeLinked:i,titleExact:r.titleExact===!0,phraseExact:r.phraseExact===!0,scoreThreshold:o,hybridSemanticWeight:s,queryExpansion:a,rerank:u,runtimeFieldFilters:l??{}},c),projection:{mode:c.mode,fields:g},now:M(),...d.length>0?{warnings:d}:{}}}function ei(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 ti(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]=ei(n,i);return r})}function ni(e,t){return Zr(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,e.modeSource)}function sc(e,t){if(e.projection.mode==="compact"&&e.options.compact===!0)return Jr({query:e.query.trim(),mode:e.effectiveMode,...ii(e.modeSource),items:[],count:t,total:t,count_only:!0,filters:oe({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 Jr({query:e.query.trim(),mode:e.effectiveMode,mode_source:e.modeSource,items:[],count:t,total:t,count_only:!0,filters:ri(e,e.projection),projection:{mode:e.projection.mode,fields:n},now:M()},e.warnings)}function ri(e,t){let n={matchMode:e.matchMode,options:e.options,includeLinked:e.includeLinked,titleExact:e.titleExact,phraseExact:e.phraseExact,scoreThreshold:e.scoreThreshold,hybridSemanticWeight:e.hybridSemanticWeight,runtimeFieldFilters:e.runtimeFieldFilters};return t.mode==="fields"?oe({...n,mode:e.effectiveMode}):en({...n,effectiveMode:e.effectiveMode,queryExpansion:e.queryExpansion,rerank:e.rerank})}function ii(e){return e==="settings"?{mode_source:e}:{}}function Jr(e,t){return t.length===0?e:{...e,warnings:t}}function Ze(e,t){return t?{...e,workspace_memory:t}:e}function ac(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:nn(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 cc(e,t,n,r,i,o){let s=r<n?{total:n}:{};if(e.projection.mode==="compact"&&e.options.compact===!0)return Jr({query:e.query.trim(),mode:e.effectiveMode,...ii(e.modeSource),items:t,count:t.length,...s,...o,filters:oe({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,mode_source:e.modeSource,items:t,count:t.length,...s,...o,filters:ri(e,i),projection:{mode:i.mode,fields:a},now:M(),...e.warnings.length>0?{warnings:e.warnings}:{}}}var Tv={applyFilters:Ir,applyExactQueryFilters:Tr,applyInlineQueryFilters:Xr,buildHitHighlights:nn,buildVerboseSearchFilters:en,buildExplicitSemanticFallbackWarning:$r,buildCompactSearchFilterSummary:oe,buildHybridLexicalScore:Or,buildRerankCorpus:Wr,buildSemanticHits:jr,classifyImplicitSemanticFallbackReason:sn,collectErrorCauseCodes:on,collectExactPhraseFields:xr,collectLinkedPaths:zr,combineHybridHits:cn,computeBuiltInBm25Hits:Br,computeSemanticOrHybridHits:Gr,resolveBuiltInBm25Mode:Ur,countOccurrences:tn,dependencyEntries:Qe,documentContainsExactPhrase:Cr,emptySearchResult:Zr,highlightFieldSnippet:Ar,loadDocuments:Yr,markTokenRuns:Rr,parseInlineQueryFilters:Qr,maybeEmitVectorIndexStaleWarning:Nr,loadLinkedCorpus:Vr,mergeVectorHitsById:Hr,normalizeExtensionProviderHits:Pr,normalizeScoreMap:Xe,parseProjectionConfig:Jt,parseTimestampWindow:ie,parseTokens:Zt,projectSearchHits:ti,readSearchFieldValue:ei,requireSemanticDependencies:an,resolveExtensionSearchProvider:Lr,resolveExtensionSearchProviderByName:Je,resolveExtensionVectorAdapter:Dr,resolveLinkedCorpusRoots:Kr,scoreDocument:Mr,sortHits:Fr,stringArray:xe,textEntries:V,validateSearchProjectionFields:hr};async function Gp(e,t){let n=I(process.cwd(),t.path);await B(n);let r=await A(n),i=eo(r).settings,o=L(i.schema),s=J(i.schema);hr(e.projection,s,e.query);let a=wt(e.options,s,"search"),u=R(i,C()),c=oo(i),d=co(i,n),l=Lr(i),f=Dr(i),m=Ma(e.options.semanticWeight),_=Ga(i,c.active?.name??null),y=qa(i,c.active?.model??U(i.search?.embedding_model)??"text-embedding-3-small");return{pmRoot:n,settings:i,statusRegistry:o,runtimeFieldRegistry:s,runtimeFieldFilters:a,typeRegistry:u,maxResults:gr(i),scoreThreshold:e.minScoreOverride??yr(i),semanticWeightProvided:e.options.semanticWeight!==void 0,semanticWeightOverride:m,hybridSemanticWeight:m??wr(i),tuning:vr(i),providerResolution:c,vectorResolution:d,extensionSearchProvider:l,extensionVectorAdapter:f,bm25Mode:Ur({configuredProvider:U(i.search?.provider),hasEmbeddingProvider:c.active!==null,hasExtensionSearchProvider:l!==null}),queryExpansion:_,queryExpansionExtension:Za(_),rerank:y,rerankExtension:ec(i),...qp({requested:e.options.mode,settings:i,configuredProvider:r.search?.provider??null,providerResolution:c,vectorResolution:d,extensionSearchProvider:l,extensionVectorAdapter:f})}}function qp(e){let n=io(e.providerResolution.active?.name,e.configuredProvider)==="configured"&&(e.vectorResolution.active!==null||e.extensionVectorAdapter!==null),r=e.extensionSearchProvider!==null||n,i=_r({requested:e.requested,settings:e.settings,semanticRunnable:r});return{effectiveMode:i.mode,modeSource:i.source}}async function zp(e,t){let n=await Yr(t.pmRoot,t.settings.item_format??"toon",t.typeRegistry.type_to_folder,t.settings.schema),r=yt(typeof e.options.status=="string"?e.options.status:void 0,t.statusRegistry,{strict:!0}),i=Io(t.statusRegistry),o=Ir(n.documents,e.options,t.typeRegistry,t.runtimeFieldFilters,r,i);return{warnings:n.warnings,allDocuments:n.documents,filteredDocuments:Tr(o,e.normalizedQuery,{titleExact:e.titleExact,phraseExact:e.phraseExact||e.matchMode==="exact"})}}async function Kp(e,t,n){let r=await nc(e.includeLinked,t.effectiveMode,n),i=e.matchMode==="or";return n.map(o=>Or(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)}async function Vp(e,t,n,r,i){if(t.bm25Mode===null||t.effectiveMode==="keyword")return null;let o=Br({requestedMode:t.effectiveMode,query:e.query,filteredDocuments:n,keywordHits:r,corpusFields:so(t.settings),bm25Params:Ua(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 Yp(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 Pr(t.extensionSearchProvider.providerName,o,r)}catch(o){if(!i)throw new h(`Extension search provider "${t.extensionSearchProvider.providerName}" failed: ${o instanceof Error?o.message:String(o)}`,p.GENERIC_FAILURE);return null}}function Qp(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 Xp(e,t,n,r,i){let o=!e.extensionSearchProvider&&e.providerResolution.active!==null&&(e.vectorResolution.active!==null||e.extensionVectorAdapter!==null);i&&o&&await Nr(e.pmRoot,n,r),e.extensionSearchProvider||an(t,e.providerResolution,e.vectorResolution,e.extensionVectorAdapter!==null)}async function Jp(e){let{prepared:t,runtime:n,filteredDocuments:r,keywordHits:i,warnings:o,modeWasExplicit:s}=e,a=i,u=await Vp(t,n,r,i,o),c=n.effectiveMode;if(u!==null||c==="keyword")return{effectiveMode:n.effectiveMode,hits:u??a};try{if(await Xp(n,c,r,o,s),r.length===0||t.limit===0)return{effectiveMode:n.effectiveMode,hits:[]};let d=new Map(r.map(l=>[l.metadata.id,l]));if(a=await Yp(t,n,r,d)??a,a===i){let{provider:l,vectorStore:f}=an(c,n.providerResolution,n.vectorResolution,n.extensionVectorAdapter!==null),m=await Gr({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=Qp(c,m,i,o)}return{effectiveMode:n.effectiveMode,hits:a}}catch(d){return o.push($r(n.effectiveMode,d)),{effectiveMode:"keyword",hits:i}}}function uc(e){e.searchOptions.after!==void 0&&Hi(e.searchOptions.after,br(e))}async function Iv(e,t,n){oc(t);let r=ic(e,t),i=await Gp(r,n),o=await zp(r,i),s=o.warnings;s.push(...r.inlineWarnings);let a=await Bt(o.allDocuments.map(b=>b.metadata),{pmRoot:i.pmRoot,statusRegistry:i.statusRegistry,now:M()});s.push(...a.warnings);let u=Qs(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,modeSource:i.modeSource,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 uc({query:r.query,mode:i.effectiveMode,searchOptions:r.options,pmRoot:i.pmRoot}),Ze(ni({...c,effectiveMode:i.effectiveMode},r.countOnly),u);let d=await Kp(r,i,o.filteredDocuments),l=await Jp({prepared:r,runtime:i,filteredDocuments:o.filteredDocuments,keywordHits:d,warnings:s,modeWasExplicit:r.modeWasExplicit});if(l.effectiveMode!=="keyword"&&l.hits.length===0&&(o.filteredDocuments.length===0||r.limit===0&&!r.countOnly))return uc({query:r.query,mode:l.effectiveMode,searchOptions:r.options,pmRoot:i.pmRoot}),Ze(ni({...c,effectiveMode:l.effectiveMode},r.countOnly),u);let f=l.hits.filter(b=>b.exact_id_match===!0||b.score>=i.scoreThreshold),m=Fr(f,i.statusRegistry),_=m.length,y=$a({pmRoot:i.pmRoot,sorted:m,query:r.query,mode:l.effectiveMode,searchOptions:r.options,limit:r.limit??i.maxResults}),g={...c,effectiveMode:l.effectiveMode};if(r.countOnly)return Ze(sc(g,_),u);let{hits:w,projection:x}=ac(r,o.filteredDocuments,y.limited),v=ti(w,x);return Ze(cc(g,v,_,y.limited.length,x,y.pageExtras),u)}var dc=["ndcg","mrr","precision","recall"];function Zp(e){if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Eval minimum must be an object of metric floors");let t={};for(let[n,r]of Object.entries(e)){if(!dc.some(i=>i===n))throw new TypeError(`Unknown eval minimum metric: ${n}`);if(typeof r!="number"||!Number.isFinite(r)||r<0||r>1)throw new TypeError(`Eval minimum.${n} must be a finite number in [0, 1]`);t[n]=r}return t}function Fv(e,t){let n=Zp(t),r=[];for(let i of dc){let o=n[i];if(o===void 0)continue;let s=e[i];!Number.isFinite(s)||s<0||s>1?r.push(`${i}:invalid`):s<o&&r.push(`${i}:${s}<${o}`)}return r}export{Ne as a,th as b,fc as c,In as d,ih as e,wc as f,bc as g,oh as h,uh as i,j_ as j,Ko as k,hh as l,gh as m,_h as n,yh as o,Vo as p,ua as q,Le as r,Fh as s,Oh as t,$h as u,ds as v,Ot as w,Pu as x,$t as y,Lt as z,og as A,sg as B,$s as C,zn as D,Pt as E,hd as F,Ps as G,vd as H,jt as I,bd as J,kd as K,Cd as L,Td as M,_g as N,Id as O,js as P,Kn as Q,Vn as R,Pd as S,Gd as T,Ig as U,Yn as V,Qn as W,Ut as X,Yd as Y,Zd as Z,Bt as _,sl as $,Ys as aa,al as ba,Qs as ca,cl as da,hl as ea,We as fa,s_ as ga,tr as ha,yl as ia,wl as ja,rr as ka,re as la,or as ma,sr as na,ar as oa,ke as pa,ze as qa,zt as ra,a_ as sa,xf as ta,c_ as ua,Pf as va,F_ as wa,O_ as xa,$_ as ya,N_ as za,L_ as Aa,q_ as Ba,z_ as Ca,xa as Da,Ca as Ea,Ta as Fa,yy as Ga,wy as Ha,Ay as Ia,gr as Ja,_r as Ka,yr as La,wr as Ma,vr as Na,br as Oa,$a as Pa,oe as Qa,en as Ra,on as Sa,sn as Ta,Xa as Ua,Ja as Va,Tv as Wa,Iv as Xa,dc as Ya,Zp as Za,Fv as _a};
13
- //# sourceMappingURL=chunk-NQTEE66P.js.map
13
+ //# sourceMappingURL=chunk-Q2HY44LV.js.map
@@ -0,0 +1,2 @@
1
+ import{ua as l}from"./chunk-SMMOZ3H3.js";import{k as y,m,n as f,o as h}from"./chunk-3Z7MCUJM.js";import{z as a}from"./chunk-A6VEMCRR.js";var R=[{exit_code:a.SUCCESS,outcome:"effect",success:!0,meaning:"The requested operation completed with its intended effect."},{exit_code:a.GENERIC_FAILURE,outcome:"internal_failure",success:!1,meaning:"An unexpected runtime or internal failure prevented completion."},{exit_code:a.USAGE,outcome:"refused_input",success:!1,meaning:"The invocation was refused because its input or composition was invalid."},{exit_code:a.NOT_FOUND,outcome:"refused_tracker_state",success:!1,meaning:"The requested tracker, item, or resource was not present."},{exit_code:a.CONFLICT,outcome:"conflict",success:!1,meaning:"Current state or concurrency prevented the requested effect."},{exit_code:a.DEPENDENCY_FAILED,outcome:"dependency_failed",success:!1,meaning:"A required dependency operation failed."},{exit_code:a.NO_EFFECT,outcome:"no_effect",success:!0,meaning:"The request was valid and completed, but matched nothing to change."},{exit_code:a.PARTIAL_EFFECT,outcome:"partial_effect",success:!0,meaning:"The request completed and changed some, but not all, selected targets."}],b=[a.SUCCESS,a.GENERIC_FAILURE,a.USAGE,a.NOT_FOUND,a.CONFLICT,a.DEPENDENCY_FAILED],I=new Set(["close-many","update-many"]),w=l.map(t=>({command:t,exit_codes:I.has(t)?[...b,a.NO_EFFECT,a.PARTIAL_EFFECT]:[...b]})),v=new Map(w.map(t=>[t.command,t])),D=[a.SUCCESS,a.NO_EFFECT,a.PARTIAL_EFFECT];function Ee(t){return D.includes(t)}function Ae(t){return R.some(e=>e.exit_code===t)}function Oe(t){let e=t.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(" ");return v.get(e)??v.get(e.split(" ")[0])}function Te(t,e=l,s=w){let o=new Map(s.map(r=>[r.command,r])),i=e.filter(r=>!o.has(r)),n=t.filter(r=>{let _=o.get(r.command)??o.get(r.command.split(" ")[0]);return _===void 0||!_.exit_codes.includes(r.exit_code)}),d=new Set(t.map(r=>r.exit_code)),c=[...new Set(s.flatMap(r=>r.exit_codes))].filter(r=>!d.has(r)).sort((r,_)=>r-_);return{ok:i.length===0&&n.length===0&&c.length===0,missing_commands:i,undeclared_observations:n,unreachable_exit_codes:c}}function Se(t){return t.applied===0&&t.failed>0?{outcome:"dependency_failed",exit_code:a.DEPENDENCY_FAILED}:t.applied===0?{outcome:"no_effect",exit_code:a.NO_EFFECT}:t.skipped>0||t.failed>0||t.unmatched>0?{outcome:"partial_effect",exit_code:a.PARTIAL_EFFECT}:{outcome:"effect",exit_code:a.SUCCESS}}var g=[{exit_code:1,class:"generic_failure"},{exit_code:2,class:"usage"},{exit_code:3,class:"not_found"},{exit_code:4,class:"conflict"},{exit_code:5,class:"dependency_failed"}],q=new Map(g.map(t=>[t.exit_code,t.class]));function x(t){return[...new Set(t.map(e=>e.trim()).filter(Boolean))].sort()}function L(t){if(!t)return[];let e=new Set,s=new Set;return t.map(o=>{let i=o.state.trim(),n=o.probe_id.trim(),d=x(o.entrypoints);if(!/^[a-z][a-z0-9_]*$/.test(i)||!/^[a-z][a-z0-9-]*$/.test(n)||d.length===0||e.has(i)||s.has(n))throw new TypeError("Invalid pm refusal state contract");return e.add(i),s.add(n),{state:i,probe_id:n,entrypoints:d,expected_exit_class:o.expected_exit_class}}).sort((o,i)=>o.state.localeCompare(i.state))}function j(t,e,s,o,i){return![[1,2,3,4,5].includes(t.exit_code),t.meaning.trim().length>0,t.recovery.trim().length>0,e.length>0,s.length>0,/^[a-z][a-z0-9_]*$/.test(o),i.every(n=>/^[a-z][a-z0-9_]*$/.test(n)),q.get(t.exit_code)===t.class].includes(!1)}function F(t,e){let s=t,o=new Set;for(;s.canonical_code!==s.code;){if(o.has(s.code))throw new TypeError(`Alias cycle in pm error code catalog: ${t.code}`);o.add(s.code);let i=e.get(s.canonical_code);if(!i)throw new TypeError(`Invalid pm error code contract: ${t.code}`);s=i}return s}function $(t){let e=new Map(t.map(s=>[s.code,s]));for(let s of t){let o=F(s,e);if(o.exit_code!==s.exit_code||o.class!==s.class)throw new TypeError(`Alias transport mismatch for pm error code: ${s.code}`);let i=t.filter(n=>n.code!==o.code&&n.canonical_code===o.code).map(n=>n.code).sort();if(s.code===o.code?JSON.stringify(s.aliases)!==JSON.stringify(i):s.aliases.length>0)throw new TypeError(`Invalid pm error code contract: ${s.code}`)}}function E(t){let e=new Set,s=t.map(o=>{let i=o.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(i))throw new TypeError(`Invalid pm error code: ${JSON.stringify(o.code)}`);if(e.has(i))throw new TypeError(`Duplicate pm error code: ${i}`);e.add(i);let n=x(o.sources),d=x(o.emitting_commands),u=(o.canonical_code??i).trim(),c=x(o.aliases??[]),r=L(o.owned_states);if(!j(o,n,d,u,c))throw new TypeError(`Invalid pm error code contract: ${i}`);if(r.some(_=>_.expected_exit_class!==o.class))throw new TypeError(`Invalid pm refusal state exit class: ${i}`);return Object.freeze({...o,code:i,meaning:o.meaning.trim(),recovery:o.recovery.trim(),sources:n,emitting_commands:d,canonical_code:u,aliases:c,owned_states:r})});return $(s),Object.freeze(s.sort((o,i)=>o.code.localeCompare(i.code)))}function Ne(t,e){let s=C(t,e);return C(s.canonical_code??s.code,e)}function C(t,e){let s=t.trim(),o=e.find(i=>i.code===s);if(!o)throw new TypeError(`Unknown pm error code "${s}"`);return o}var z="Inspect the structured error guidance, then retry the suggested command when one is present.",U=new Map(g.map(t=>[t.exit_code,t.class]));function A(t){return t.map(e=>{let s=`${e.code.replaceAll("_"," ")} condition.`,o={code:e.code,meaning:`${s.charAt(0).toUpperCase()}${s.slice(1)}`,stability:e.stable?"stable":"provisional",exit_code:e.exit_code,class:U.get(e.exit_code),recovery:z,sources:e.sources,emitting_commands:e.emitting_commands??["*"],canonical_code:e.canonical_code??e.code,aliases:e.aliases??[]};return e.owned_states&&(o.owned_states=e.owned_states),o})}var O=[{code:"acceptance_criteria_mutation_conflict",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_remove_unmatched",exit_code:3,sources:["sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_semicolon_forbidden",exit_code:2,stable:!0,sources:["core/item/parse.ts"]},{code:"accepted_rejected_value",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"alias_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"alias_target_missing",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"already_claimed_by",exit_code:4,stable:!0,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"ambiguous_option_combination",exit_code:2,stable:!0,sources:["sdk/lifecycle/claim.ts","sdk/lifecycle/plan.ts"],emitting_commands:["claim","plan"]},{code:"annotation_alias_conflict",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"annotation_entry_mismatch",exit_code:4,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_invalid",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_without_target",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_flag_like_value",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_if_absent_without_append",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_text_compacted",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_text_source_conflict",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"annotation_transposed_subcommand",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"append_empty_body",exit_code:2,stable:!0,sources:["sdk/lifecycle/append.ts"],emitting_commands:["append"]},{code:"assurance_registry_invalid",exit_code:1,sources:["sdk/governance/assurance.ts"]},{code:"bare_comma_entry_ambiguous",exit_code:2,sources:["core/item/parse.ts"]},{code:"blocker_identity_read_failed",exit_code:1,sources:["sdk/query/declared-blockers.ts"]},{code:"body_file_conflicts_with_body",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",exit_code:3,stable:!0,sources:["core/io/body-file.ts"]},{code:"budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"bulk_create_route",exit_code:2,sources:["cli/register-mutation.ts"]},{code:"bulk_ids_input_empty",exit_code:2,sources:["core/io/bulk-ids-input.ts","sdk/history-compact.ts","sdk/history-mcp.ts"],owned_states:[{state:"bulk_ids_stdin_contains_no_nonempty_ids",probe_id:"bulk-ids-stdin-empty",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_missing_path",exit_code:2,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_token_omits_its_path",probe_id:"bulk-ids-file-path-missing",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_unreadable",exit_code:3,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_path_cannot_be_read",probe_id:"bulk-ids-file-unreadable",entrypoints:["update-many"],expected_exit_class:"not_found"}]},{code:"bundle_integrity_torn_install",exit_code:1,stable:!0,sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"capability_unused",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",exit_code:1,stable:!0,sources:["sdk/item-children.ts"]},{code:"close_reason_required",exit_code:2,stable:!0,sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"],emitting_commands:["*","close-many"]},{code:"close_through_update",exit_code:1,stable:!0,sources:["core/telemetry/observability.ts"]},{code:"close_validation_deferred_fields",exit_code:2,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"close_validation_missing_fields",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"collected_zero_items",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"collection_transposed_subcommand",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"command_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"command_namespace",exit_code:2,stable:!0,sources:["sdk/cli-contracts/runtime-contracts.ts"]},{code:"command_override_conflict",exit_code:4,stable:!0,sources:["sdk/compose.ts"]},{code:"config_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"config_key_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts","sdk/config.ts"]},{code:"config_value_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"conflicting_lifecycle_owner",exit_code:2,stable:!0,sources:["cli/register-operations.ts"]},{code:"context_evaluation_read_incomplete",exit_code:2,sources:["sdk/context-relevance.ts"]},{code:"context_signal_store_invalid",exit_code:2,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_stale",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_write_failed",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_takes_no_item_argument",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"core_item_field_requires_dedicated_flag",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"create_deferral_conflict",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_deferral_field_unsupported",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_deferral_fields_required",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_deferral_reason_required",exit_code:2,sources:["sdk/lifecycle/create-deferrals.ts"],emitting_commands:["create"]},{code:"create_positional_type_without_title",exit_code:2,stable:!0,sources:["cli/register-mutation.ts"]},{code:"dependency_cardinality_created",exit_code:2,sources:["sdk/graph/cardinality-integrity.ts"]},{code:"dependency_edge_not_allowed",exit_code:2,stable:!0,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_flag_value_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_remove_no_match",exit_code:3,sources:["sdk/lifecycle/dependency-removal.ts"],emitting_commands:["update"]},{code:"dependency_target_not_found",exit_code:3,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_temporal_order_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"duplicate_canonical_flag",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"duplicate_command",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"duplicate_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"duplicate_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"duplicate_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"duplicate_probe",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"duplicate_sweep_cost_limit",exit_code:4,stable:!0,sources:["sdk/query/duplicate-candidates.ts"],emitting_commands:["duplicate-candidates"]},{code:"duplicate_target_circular",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_is_duplicate",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_missing",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_self",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"empty_corpus",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"empty_surface",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"event_cursor_query_mismatch",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"event_history_integrity_failed",exit_code:1,sources:["core/history/event-index.ts"]},{code:"event_index_unavailable",exit_code:1,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"exit_code_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"expect_hash_background_unsupported",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invalid",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invocation_rewritten",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_requires_mutation",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_target_required",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expected_revision_duplicate",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"expected_revision_scope_conflict",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"extension_command_activation_failed",exit_code:1,stable:!0,sources:["cli/commander-usage.ts"]},{code:"extension_dependency_name_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_spec_invalid",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_version_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_flag_value_invalid",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_install_incomplete_source_scan",exit_code:2,sources:["sdk/extension/install-plan.ts"]},{code:"extension_install_rollback_failed",exit_code:1,sources:["sdk/extension/install-snapshot.ts"]},{code:"extension_install_soft_failed",exit_code:1,stable:!0,sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",exit_code:2,stable:!0,sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_option_disabled",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_option_spelling_conflict",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_read_output_invalid",exit_code:2,sources:["sdk/read-output/extension.ts"]},{code:"extension_update_health_partial_coverage",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"extensions_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"field_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_flag_invalid",exit_code:2,sources:["core/profile/profile-lint.ts"]},{code:"field_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_mcp_input_collision",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_option_collision",exit_code:1,sources:["core/profile/profile-lint.ts"]},{code:"finalization_invalid_document",exit_code:2,sources:["sdk/transactions/item-finalization.ts"]},{code:"github_source_entry_unbuilt",exit_code:2,stable:!0,sources:["sdk/extension/shared.ts"]},{code:"hierarchy_cardinality_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_cycle_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_parent_divergence_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"history_append_only_repair_unavailable",exit_code:4,sources:["sdk/history/append-only-repair.ts"]},{code:"history_author_acknowledge_plan_conflict",exit_code:4,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_plan_fingerprint_required",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_preview_limit_invalid",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_required_values_missing",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_conflict",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_required",exit_code:2,stable:!0,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_not_actionable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_unreadable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_baseline_unavailable",exit_code:1,sources:["core/history/projection.ts"]},{code:"history_compact_boundary_bridged",exit_code:2,sources:["sdk/history-compact.ts"]},{code:"history_drift_chain_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_chain_mismatches"]},{code:"history_drift_chain_unbridgeable",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_hash_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_hash_mismatches"]},{code:"history_drift_merge_receipt",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_missing_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_missing_streams"]},{code:"history_drift_unreadable_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_unreadable_streams"]},{code:"history_drift_unrepairable_stream",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_version_skew",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_version_skews"]},{code:"history_json_invalid",exit_code:1,sources:["core/history/read.ts"]},{code:"history_merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/history/read.ts"],canonical_code:"merge_conflict_markers_detected"},{code:"history_record_integrity_invalid",exit_code:4,sources:["sdk/history/reanchor-refusal.ts"]},{code:"history_record_invalid",exit_code:1,sources:["core/history/read.ts"]},{code:"history_record_version_unsupported",exit_code:4,sources:["sdk/history/reanchor-refusal.ts"]},{code:"history_redact_bridge_unlocated",exit_code:1,sources:["sdk/history-redact.ts"]},{code:"history_replay_invalid",exit_code:1,sources:["core/history/projection.ts","core/history/tombstone.ts"]},{code:"history_salvage_refused",exit_code:4,sources:["sdk/history/salvage.ts"]},{code:"history_stream_over_compact_threshold",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"history_target_out_of_range",exit_code:1,stable:!0,sources:["core/history/projection.ts"]},{code:"history_timestamp_invalid",exit_code:1,sources:["core/history/event-index.ts","core/history/history.ts"]},{code:"history_union_rebase_conflict",exit_code:4,sources:["sdk/merge/history-scalar-rebase.ts"]},{code:"history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_unknown_author_events"]},{code:"history_version_mapping_unavailable",exit_code:2,sources:["core/history/version-address.ts"]},{code:"history_version_pruned",exit_code:2,sources:["core/history/projection.ts"]},{code:"history_version_unreconstructable",exit_code:2,sources:["core/history/projection.ts"]},{code:"host_environment_capacity_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_operation_invalid",exit_code:2,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_permission_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_resource_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"improvement_metric_contract_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"improvement_observation_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"in_progress_idle",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"in_progress_unowned",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"incomplete_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"inconsistent_concept_kind",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"init_existing_settings_requires_force",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_gitignore_unwritable",exit_code:1,stable:!0,sources:["sdk/workspace.ts"]},{code:"init_id_prefix_conflict",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_id_prefix_path_like",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"integrity_history_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_history_conflict_markers"]},{code:"integrity_history_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_history_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_ahead_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_ahead_items"]},{code:"integrity_item_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_outdated_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_outdated_items"]},{code:"integrity_item_parse_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"invalid_argument_value",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/item/priority.ts","core/shared/url-credentials.ts","core/telemetry/observability.ts","sdk/config.ts","sdk/context-intent-contracts.ts","sdk/dependencies.ts","sdk/governance/assurance-mutation-error.ts","sdk/history-redact.ts","sdk/lifecycle/create.ts","sdk/lifecycle/task-composition.ts","sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts","sdk/linked-artifacts.ts","sdk/query/next.ts","sdk/runtime-input.ts","sdk/runtime.ts","sdk/runtime/mutation-admission.ts","sdk/runtime/mutation-value-validation.ts","sdk/runtime/schema-preview.ts","sdk/test/run-phases.ts","sdk/workspace.ts"],emitting_commands:["*","create","next","task-composition","update","update-many"]},{code:"invalid_command_usage",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"invalid_event_cursor",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_cursor_mode",exit_code:2,sources:["cli/register-list-query.ts","sdk/mutation-events.ts","sdk/runtime-extended-actions.ts"]},{code:"invalid_event_follow_interval",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_limit",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_since",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_history_analytics_limit",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_minimum_sample",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_since",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_improvement_ledger",exit_code:1,sources:["sdk/improvement-ledger-validation.ts"]},{code:"invalid_improvement_metric",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_limit",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_timestamp",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_provenance_predicate",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"invalid_query_cursor",exit_code:2,stable:!0,sources:["sdk/pagination.ts","sdk/query/window-pagination.ts"]},{code:"invalid_read_output_session",exit_code:2,sources:["sdk/read-output-session.ts"]},{code:"invalid_reproducible_process_environment",exit_code:2,sources:["sdk/reproducibility/process.ts"]},{code:"invalid_workspace_snapshot_target",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"item_already_active",exit_code:4,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"item_already_exists",exit_code:4,stable:!0,sources:["sdk/lifecycle/create.ts"],emitting_commands:["create"]},{code:"item_deleted",exit_code:3,sources:["core/history/tombstone.ts"]},{code:"item_document_encoding_invalid",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_document_invalid",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_document_roundtrip_failed",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_format_version_unsupported",exit_code:4,sources:["core/item/item-format.ts"]},{code:"item_id_collision",exit_code:4,stable:!0,sources:["sdk/lifecycle/copy.ts"],emitting_commands:["copy"]},{code:"item_identity_ambiguous",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_identity_conflict",exit_code:4,sources:["sdk/governance/validate-history-drift.ts","sdk/lifecycle/item-revision.ts","sdk/merge/three-way.ts","sdk/query/declared-blockers.ts"]},{code:"item_identity_reserved",exit_code:4,sources:["core/history/history.ts"]},{code:"item_not_found",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/item-store.ts","core/telemetry/observability.ts","sdk/governance/validate-history-drift.ts"]},{code:"item_revision_conflict",exit_code:4,sources:["core/store/item-mutation-precondition.ts"]},{code:"likely_duplicate",exit_code:4,stable:!0,sources:["sdk/similarity.ts"]},{code:"linked_artifact_mutation_conflict",exit_code:2,sources:["sdk/linked-artifacts.ts"]},{code:"linked_artifact_note_conflict",exit_code:4,sources:["sdk/linked-artifacts.ts"]},{code:"linked_artifact_note_key_misread",exit_code:2,sources:["sdk/linked-artifacts.ts"]},{code:"linked_resource_positional_value",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"linked_test_command_immutable",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_command_not_executable",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_context_invalid",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_patch_fields_unsupported",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_remove_no_match",exit_code:3,sources:["sdk/test/execution.ts"]},{code:"linked_test_update_ambiguous",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_update_no_match",exit_code:3,sources:["sdk/test/update.ts"]},{code:"linked_test_value_not_quoted",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"list_source_incomplete",exit_code:1,stable:!0,sources:["sdk/query/list.ts"],emitting_commands:["list"]},{code:"local_package_archive_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"local_source_not_found_bare_name",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"lock_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/lock/lock.ts","core/telemetry/observability.ts"]},{code:"lock_lost",exit_code:4,sources:["core/lock/lock.ts"]},{code:"lock_path_unsafe",exit_code:4,sources:["core/lock/lock-confinement.ts"]},{code:"locks_stale_count",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"locks_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"malformed_plan_step_evidence",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"managed_state_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"managed_state_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_capabilities_absent",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"manifest_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_unknown_key",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_declares_an_unknown_top_level_key",probe_id:"author-manifest-unknown-key",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"manifest_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"mcp_annotation_file_unavailable",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"mcp_stdin_unavailable",exit_code:2,sources:["sdk/annotations.ts"]},{code:"mcp_task_not_found_or_not_authorized",exit_code:3,sources:["sdk/mcp/tasks.ts"]},{code:"merge_artifacts_ignored",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_bun_launcher_unavailable",exit_code:5,sources:["sdk/merge/install.ts"]},{code:"merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/item/item-format.ts"],aliases:["history_merge_conflict_markers_detected"]},{code:"merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]}];var T=[{code:"merge_fence_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_fence_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_git_config_unwritable",exit_code:5,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_receipt_evidence_invalid",exit_code:4,sources:["core/diagnostics/remediation.ts","sdk/merge/reconcile.ts"]},{code:"merge_receipt_history_reference_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_receipt_not_portable",exit_code:4,sources:["sdk/merge/receipts.ts"]},{code:"merge_receipts_pending",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_reconcile_receipt_evidence_untrusted",exit_code:4,sources:["sdk/history-repair.ts"]},{code:"merge_root_not_found",exit_code:3,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_settlement_hook_conflict",exit_code:4,sources:["sdk/merge/settlement-hook.ts"]},{code:"merge_settlement_review_required",exit_code:4,sources:["sdk/merge/ignored-artifacts.ts","sdk/merge/reconcile.ts","sdk/merge/stage.ts"]},{code:"missing_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"missing_cli_flag",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_directory",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"missing_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_lifecycle_target",exit_code:2,stable:!0,sources:["sdk/extension.ts"]},{code:"missing_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"missing_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_parameter_alias",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_positive_execution_receipt",exit_code:1,sources:["sdk/test/execution.ts"]},{code:"missing_probe",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_required_argument",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","cli/schema/registration.ts","core/telemetry/observability.ts","sdk/governance/assurance-action.ts","sdk/history-redact.ts","sdk/invocation-author.ts","sdk/lifecycle/claim.ts","sdk/linked-artifacts.ts"],emitting_commands:["*","claim"]},{code:"missing_required_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/context-intent-contracts.ts","sdk/extension/command-options.ts","sdk/lifecycle/create.ts","sdk/lifecycle/plan.ts"],emitting_commands:["*","create","plan"]},{code:"missing_suggested_retry",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_suggested_retry_args",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"module_import_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"multi_target_github_install_ambiguous",exit_code:2,stable:!0,sources:["cli/register-setup.ts"]},{code:"mutation_author_required",exit_code:2,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"mutation_document_unreadable",exit_code:2,sources:["cli/register-structured-mutation.ts"]},{code:"mutation_option_value_invalid",exit_code:2,sources:["sdk/lifecycle/mutation-option-validation.ts"],emitting_commands:["item mutate"]},{code:"mutation_secret_guard_blocked",exit_code:4,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"no_matching_tests",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_projects_matched_filters",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_test_files_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_tests_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_update_fields",exit_code:1,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"no_version_bounds_declared",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_omits_canonical_pm_version_bounds",probe_id:"author-manifest-version-bounds-missing",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"non_refusal_exit",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"npm_pack_json_shape_unsupported",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_missing",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_unsafe",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_not_found",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"output_budget_exceeded",exit_code:2,sources:["sdk/testing.ts"]},{code:"ownership_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/annotations.ts"]},{code:"ownership_dependency_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"ownership_metadata_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"package_spec_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"package_upgrade_modes_mutually_exclusive",exit_code:2,sources:["sdk/governance/upgrade.ts"]},{code:"positional_shape_budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"positional_signature_mismatch",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"profile_name_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_name_not_normalized",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_summary_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_title_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"project_runtime_history_epoch_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_item_format_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_mutation",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_read",exit_code:1,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_schema_field_requires_declared_flag",exit_code:2,sources:["core/extensions/item-fields.ts"]},{code:"projection_options_mutually_exclusive",exit_code:2,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"provenance_value_domain_invalid",exit_code:2,sources:["core/diagnostics/remediation.ts"]},{code:"read_output_cursor_command_mismatch",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_invalid",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_stale",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_mutation_conflict",exit_code:2,sources:["sdk/read-output-contracts.ts"]},{code:"read_output_surface_unsupported",exit_code:2,sources:["sdk/read-output-contracts.ts"]},{code:"recovery_kind_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"redundant_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"refusal_allowed_values_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_exit_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_mutated_state",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_probe_missing",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_recovery_failed",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"reindex_already_running",exit_code:4,stable:!0,sources:["sdk/governance/reindex.ts"]},{code:"removed_canonical_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"removed_compatibility_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"reopen_reason_required",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reopen_receipt_missing",exit_code:1,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"reopen_target_status_invalid",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reported_zero_passes",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reported_zero_tests",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reserved_item_field",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"retry_failed",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"schema_field_flag_invalid",exit_code:2,sources:["sdk/schema/field-option-collisions.ts"]},{code:"schema_field_option_collision",exit_code:2,sources:["sdk/schema/field-option-collisions.ts"]},{code:"schema_migration_input_required",exit_code:2,stable:!0,sources:["cli/migration-gates.ts"]},{code:"semantic_spelling_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"settings_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_read_fs_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_schema",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_merge_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_section_document_malformed",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_document_missing",exit_code:3,sources:["core/store/settings-sections.ts"]},{code:"settings_section_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_name_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_reserved",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_revision_conflict",exit_code:4,sources:["core/store/settings-sections.ts"]},{code:"settings_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_write_assigned_path_invalid",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_json",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_schema",exit_code:2,sources:["core/store/settings.ts"]},{code:"stale_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"stale_claim_takeover_refused",exit_code:4,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"stale_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_in_progress_items",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"stale_lock_requires_override",exit_code:4,sources:["core/lock/lock.ts"]},{code:"stale_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_revision",exit_code:4,sources:["core/store/item-store.ts"]},{code:"start_blocked_by_open_dependency",exit_code:4,sources:["sdk/lifecycle/start-blockers.ts"],emitting_commands:["claim","start-task","update"]},{code:"status_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_lifecycle_role_required",exit_code:2,sources:["sdk/schema.ts"]},{code:"stdin_json_invalid",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"stdin_json_persisted_annotation_changed",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"stdin_json_unknown_key",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"structured_entry_key_repeated",exit_code:2,sources:["core/item/parse.ts"]},{code:"structured_event_immutable",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"structured_event_input_conflict",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_empty",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_since_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"suggested_retry_args_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"telemetry_endpoint_probe_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_endpoint_probe_http_status",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_otel_export_failing",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_high_retries",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_invalid_rows",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_pending",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_schema_version_behind",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_state_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"template_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"terminal_plan_mutation",exit_code:4,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"terminal_state_conflict",exit_code:4,stable:!0,sources:["core/telemetry/observability.ts","sdk/lifecycle/claim.ts"],emitting_commands:["*","claim"]},{code:"test_measure_requires_execution",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"test_measure_requires_run",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"text_unpaired_surrogate",exit_code:2,sources:["core/item/item-format.ts","core/shared/output-unicode.ts"]},{code:"tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_tracked_runtime_cache_files"]},{code:"tracker_not_initialized",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/tracker-preflight.ts","core/telemetry/observability.ts"],owned_states:[{state:"selected_tracker_root_exists_without_settings",probe_id:"tracker-root-settings-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_missing",exit_code:3,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_does_not_exist",probe_id:"tracker-root-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_not_directory",exit_code:2,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_a_regular_file",probe_id:"tracker-root-not-directory",entrypoints:["list"],expected_exit_class:"usage"}]},{code:"tracker_root_unreadable",exit_code:1,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_not_readable",probe_id:"tracker-root-unreadable",entrypoints:["list"],expected_exit_class:"generic_failure"}]},{code:"transaction_abandoned",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_committed",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_create_compensated",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_journal_invalid",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_partial_mutation",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_plan_mismatch",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_preview_external_schema",exit_code:2,sources:["sdk/item-transaction.ts"]},{code:"transaction_preview_non_regular_file",exit_code:2,sources:["core/fs/fs-utils.ts"]},{code:"transaction_preview_snapshot_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_recovery_plan_missing",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"type_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"type_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"undeclared_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"unexpected_refusal_probe",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"unknown_command",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/cli-contracts/runtime-contracts.ts"]},{code:"unknown_context_intent",exit_code:2,stable:!0,sources:["sdk/context-intent-contracts.ts"]},{code:"unknown_error",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"unknown_field",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_field_projection",exit_code:2,stable:!0,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"unknown_item_type",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_lifecycle_action",exit_code:2,stable:!0,sources:["sdk/agent/subcommand-recovery.ts"],canonical_code:"unknown_subcommand"},{code:"unknown_noun",exit_code:2,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"unknown_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/runtime/invocation-options.ts","core/telemetry/observability.ts","sdk/extension/command-options.ts"],owned_states:[{state:"declared_option_is_rejected_on_the_selected_command_path",probe_id:"cross-command-unknown-option",entrypoints:["deps"],expected_exit_class:"usage"}]},{code:"unknown_plan_template",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"unknown_provenance_dimension",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"unknown_status",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_subcommand",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","sdk/agent/subcommand-recovery.ts"],aliases:["unknown_lifecycle_action"],owned_states:[{state:"config_action_token_is_not_declared",probe_id:"config-unknown-action",entrypoints:["config"],expected_exit_class:"usage"},{state:"graph_command_token_is_not_declared",probe_id:"graph-unknown-subcommand",entrypoints:["graph"],expected_exit_class:"usage"},{state:"nested_command_token_is_not_declared_by_its_family",probe_id:"schema-unknown-subcommand",entrypoints:["schema"],expected_exit_class:"usage"},{state:"package_lifecycle_token_is_not_declared",probe_id:"package-unknown-action",entrypoints:["package"],expected_exit_class:"usage"}]},{code:"unsafe_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"unsupported_update_option",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"upsert_key_ambiguous",exit_code:4,sources:["sdk/structured-mutations.ts"]},{code:"upsert_key_conflict",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"upsert_key_duplicate",exit_code:2,sources:["sdk/item-transaction.ts","sdk/structured-mutations.ts"]},{code:"upsert_key_missing",exit_code:2,sources:["sdk/structured-mutations.ts"]},{code:"upsert_match_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"validate_command_references_stale_pm_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_ahead_format_version"},{code:"validate_format_version_outdated_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_outdated_format_version"},{code:"validate_hierarchy_parent_cycle",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_chain_mismatch"},{code:"validate_history_drift_hash_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_hash_mismatch"},{code:"validate_history_drift_missing_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_missing_stream"},{code:"validate_history_drift_unreadable_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_unreadable_stream"},{code:"validate_history_drift_version_skews",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_version_skew"},{code:"validate_history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_unknown_author_events"},{code:"validate_lifecycle_active_closure_like_metadata",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_driver_configuration",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_closed_at",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_schema_field_option_collision",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_duplicate_item_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_history_conflict_markers",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_history_conflict_marker"},{code:"validate_storage_resurrected_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"tracked_runtime_cache_files"},{code:"validate_storage_unparseable_config",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unparseable_history",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unreadable_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_embedding_identity_changed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_stale_items_remaining",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"visible_surface_ceiling_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"workflow_duplicate_type",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_policy_approval_history_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_audit_failed",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_input_unreadable",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_invalid",exit_code:2,sources:["core/policy/workflow-policy.ts"]},{code:"workflow_policy_refused",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_registry_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_status_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_transition_malformed",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workspace_history_chain_invalid",exit_code:4,sources:["core/history/workspace-history.ts"]},{code:"workspace_history_state_conflict",exit_code:4,stable:!0,sources:["core/history/workspace-history.ts"]},{code:"workspace_root_pm_path",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"workspace_snapshot_force_required",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_manifest_mismatch",exit_code:4,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_name_reserved_fingerprint",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_not_found",exit_code:3,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_permission_denied",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_resource_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_storage_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"wrong_item_type",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]}];var ze=E(A([...O,...T]));var G=Object.freeze({"--body":"Set the item body.","--body-file":"Read the item body from a file, or from stdin when set to -.","--description":"Set the item description.","--stdin":"Read the value from stdin.","--stdin-json":"Read a complete JSON document from stdin."}),B=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),V=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),Y=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),X=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),W=["--allow-","--check-","--dry-run","--explain","--fail-","--fix-","--full","--has-","--include-","--json","--no-","--prune-","--quiet","--refresh-","--require-","--runtime-only","--schema-only","--skip-","--stream","--strict-","--summary","--today","--verbose"],H=new Set(["--activate","--active-only","--adopt","--adopt-all","--all","--all-actionable","--all-affected-ids","--all-day","--all-streams","--acknowledge-linked-tests","--append-stable","--auto-fix","--auto-pm-context","--availability-only","--background","--brief","--by-assignee","--by-priority","--by-tag","--catalog","--claim","--clear","--clear-comments","--clear-criteria","--clear-deps","--clear-docs","--clear-events","--clear-files","--clear-learnings","--clear-notes","--clear-reminders","--clear-tests","--clear-type-options","--cli-only","--closed","--compact","--completion","--count","--counts","--deactivate","--declarative","--defaults","--describe","--diff","--doctor","--empty-body","--explore","--field-utilization","--filter-empty-body","--flags-only","--follow","--force","--global","--highlight","--hybrid","--id-only","--if-available","--ignore-global","--include_unparented","--infer","--init","--install","--isolated","--lean","--list","--local","--manage","--markdown","--metadata-coverage","--next","--normalize-provenance","--only","--only-last","--output-row-contract","--override-linked-pm-context","--override-linked-workspace-context","--packages-only","--past","--phrase-exact","--profile","--progress","--project","--promote-to-item-dep","--provenance","--provenance-summary","--raw","--ready-only","--ready_only","--rebuild","--recent","--reload","--repair","--replace-deps","--replace-docs","--replace-files","--replace-tests","--required","--required-on-create","--run","--runtime-probe","--save-baseline","--scaffold","--semantic","--shared-host-safe","--storage","--takeover-stale","--title-exact","--token-accounting","--trace","--tree","--unbounded","--uninstall","--validate-paths","--verify","--watch","--with-packages"]),J=new Set(["--only-index"]),K=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Q=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),Z=new Set(["--regression"]);function ee(t,e){return e==="--stdin"||e==="--stdin-json"?["stdin"]:Y.has(`${t}:${e}`)?["argv","file","stdin"]:e.endsWith("-file")?["argv","file"]:B.has(e)&&V.has(t)?["argv","stdin"]:["argv"]}function te(t,e){let s=K.has(`${t}:${e.flag}`)||e.value_name!==void 0||e.value_type==="string"||e.value_type==="number"||e.list===!0||e.repeatable===!0,o=e.value_type==="boolean"||e.flag==="--stdin"||e.flag==="--stdin-json"||e.flag.startsWith("--filter-")&&(e.flag.endsWith("-missing")||e.flag.startsWith("--filter-has-")||e.flag.startsWith("--filter-no-"))||W.some(i=>e.flag.startsWith(i));return s||J.has(e.flag)||!H.has(e.flag)&&!o}function se(t,e){return e.value_arity!==void 0?e.value_arity:te(t,e)?Z.has(e.flag)||Q.has(`${t}:${e.flag}`)?"optional":"required":"none"}function oe(t,e){let s=f(t),o=se(s,e),i=o!=="none",n=ee(s,e.flag),d=e.description??G[e.flag]??`${i?"Set":"Enable"} ${e.flag.slice(2).replaceAll("-"," ")}.`;return{...e,description:d,takes_value:i,value_required:o==="required",...i?{value_name:e.value_name??"value"}:{},value_type:i?e.value_type??"string":"boolean",required:e.required===!0,repeatable:e.repeatable===!0||e.list===!0,input_sources:n,...n.includes("stdin")&&e.flag!=="--stdin"&&e.flag!=="--stdin-json"?{stdin_token:"-"}:{},...X.has(`${s}:${e.flag}`)?{file_token_prefix:"@"}:{}}}function Be(t,e){return e.map(s=>oe(t,s))}function Ve(t,e,s){let o=t.trim().toLowerCase(),i=[],n=new Map,d=0;for(let c of s)if(c.command.trim().toLowerCase()===o){if(d+=1,n.has(c.flag)){i.push({code:"duplicate_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} was observed more than once.`});continue}n.set(c.flag,c)}let u=new Set(e.map(({flag:c})=>c));for(let c of e){let r=n.get(c.flag);if(!r){i.push({code:"missing_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} has no executable option observation.`});continue}for(let[_,P]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[_]!==r[_]&&i.push({code:P,command:o,flag:c.flag,detail:`${o} ${c.flag} declares ${_}=${String(c[_])} but the executable option reports ${String(r[_])}.`})}for(let c of n.values())u.has(c.flag)||i.push({code:"undeclared_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,r)=>c.flag.localeCompare(r.flag)||c.code.localeCompare(r.code)),{ok:i.length===0,declared_count:e.length,observed_count:d,findings:i}}var ie=["mutation_receipt","entity","collection","diagnostic","stream"],ce=new Set(["append","claim","close","close-task","copy","create","delete","focus","pause-task","release","restore","start-task","update"]),re=new Set(["close-many","update-many"]),ne=new Set(["activity","comments","contracts","events","history","learnings","list","notes","search"]),ae=new Set(["aggregate","deps","graph","health","history-redact","history-repair","history-compact","stats","validate"]);function p(t){if(t.command.trim().length===0)throw new TypeError("command must be a non-empty command path");if(!ie.includes(t.kind))throw new TypeError(`Unsupported output envelope kind: ${t.kind}`);return t}function S(t){let e=t.trim().replace(/\s+/gu," "),[s=e]=e.split(" ");return re.has(s)?p({command:e,kind:"collection",wrapper_key:"rows",cardinality:"many",format_flag:"--json"}):ce.has(s)?p({command:e,kind:"mutation_receipt",wrapper_key:null,cardinality:"one",format_flag:"--json"}):ne.has(s)?p({command:e,kind:"collection",wrapper_key:s==="contracts"?null:"items",cardinality:"many",format_flag:"--json"}):ae.has(s)?p({command:e,kind:"diagnostic",wrapper_key:null,cardinality:"none",format_flag:"--json"}):p({command:e,kind:s==="get"?"entity":"diagnostic",wrapper_key:s==="get"?"item":null,cardinality:s==="get"?"one":"none",format_flag:"--json"})}var de=l.map(t=>S(t)),_e=new Map(de.map(t=>[t.command,t]));function He(t){let e=t.trim().replace(/\s+/gu," ");if(e.length===0)throw new TypeError("command must be a non-empty command path");let[s=e]=f(e).split(" "),o=_e.get(s);return o?{...o,command:e}:S(e)}function le(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ue(t){return le(t)&&typeof t.id=="string"&&t.id.length>0&&typeof t.status=="string"&&t.status.length>0&&Number.isSafeInteger(t.changed_field_count)&&Number(t.changed_field_count)>=0&&(t.close_reason===void 0||typeof t.close_reason=="string")&&(t.deleted===void 0||typeof t.deleted=="boolean")&&(t.previous_status===void 0||typeof t.previous_status=="string")&&(t.warnings===void 0||Array.isArray(t.warnings))}function Je(t){let e=t;if(typeof t=="string")try{e=JSON.parse(t)}catch(s){throw new TypeError(`Mutation receipt must be valid JSON: ${String(s)}`,{cause:s})}if(!ue(e))throw new TypeError("Mutation receipt must be a flat object with top-level id, status, and changed_field_count fields");return{id:e.id,status:e.status,changedFieldCount:e.changed_field_count,...typeof e.close_reason=="string"?{closeReason:e.close_reason}:{},...typeof e.deleted=="boolean"?{deleted:e.deleted}:{},...typeof e.previous_status=="string"?{previousStatus:e.previous_status}:{},...Array.isArray(e.warnings)?{warnings:e.warnings}:{}}}var me=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),pe=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]),fe=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])}),xe=new Set(["extension","install","package","packages","upgrade"]);function ge(t){let e=m(t.trim().toLowerCase());if(e==="ops")return"quality";for(let[s,o]of Object.entries(fe))if(o.has(e))return s;return xe.has(e)?"extensions":"internal"}var k=Object.freeze([...l.flatMap(t=>t==="item"?["item","item-reopen"]:[t,...y.filter(e=>e.alias===t).map(e=>e.canonical)]).map(t=>({command:t,tier:me.has(m(t))?"core":pe.has(m(t))?"standard":"full",family:ge(t)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]),ke=k,et=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),tt=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);var M={core:0,standard:1,full:2,internal:3},N=new Map(ke.map(({command:t,tier:e})=>[t,e]));function st(t,e="standard"){return N.get(t.trim().toLowerCase())??N.get(m(t.trim().toLowerCase()))??e}function ot(t){return ye(t,k)}function ye(t,e){let s=M[t];return e.filter(o=>o.tier!=="internal"&&M[o.tier]<=s).map(o=>o.command)}function he(t,e){return e.filter(s=>s.family===t).map(s=>s.command)}var be=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],ve=new Set([...h.filter(t=>t.hidden).map(t=>t.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function it(t=k){return be.map(e=>({family:e,commands:he(e,t).filter(s=>t.find(o=>o.command===s)?.tier!=="internal"&&!ve.has(s))})).filter(({commands:e})=>e.length>0)}var ct=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});var rt=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]),nt=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:!0},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:!1}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0},{name:"evidence",description:"Exact verification and outcome evidence.",required:!0}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);export{R as a,w as b,D as c,Ee as d,Ae as e,Oe as f,Te as g,Se as h,g as i,E as j,Ne as k,C as l,ze as m,oe as n,Be as o,Ve as p,k as q,st as r,ot as s,it as t,ie as u,p as v,de as w,He as x,ue as y,Je as z};
2
+ //# sourceMappingURL=chunk-REFMQY47.js.map
@@ -0,0 +1,3 @@
1
+ import{C as V,F as P,n as x,o as C}from"./chunk-A6VEMCRR.js";import H from"node:path";import{link as te,mkdir as re,mkdtemp as ne,open as se,rm as oe,writeFile as ie}from"node:fs/promises";import R from"node:path";var ae=new Set(["EPERM","ENOTSUP","EOPNOTSUPP","ENOSYS"]),O=class extends Error{code;constructor(t,r){super(`The filesystem cannot publish a file by hard link (${t}).`,{cause:r}),this.name="AtomicLinkUnsupportedError",this.code=t}};async function le(e,t){let r=await se(e,"wx");try{await r.writeFile(t,"utf8"),await r.sync()}finally{await r.close()}}async function z(e,t,r={}){let n=R.dirname(e);await re(n,{recursive:!0});let s=await ne(R.join(n,".pm-seed-")),i=R.join(s,"value");try{await(r.sync===!0?le(i,t):ie(i,t,"utf8"));try{return await te(i,e),!0}catch(l){let a=l.code??"";if(a==="EEXIST")return!1;throw ae.has(a)?new O(a,l):l}}finally{await oe(s,{recursive:!0,force:!0}).catch(()=>{})}}var ce=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],Ke=ce,j=["draft","open","in_progress","blocked","closed","canceled"],v=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],K=["string","number","boolean","string_array","array","object"],W=["create","update","update_many","list","search","calendar","context"],q=["allow","warn","reject"],We=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","recurs_from","supersedes","task","verifies"],qe=["project","global"],Ye=["low","medium","high","critical"],He=["low","medium","high","critical"],Ge=["low","medium","high"];var Xe=["minimal","default","strict","custom"],$e=["none","warn","strict"],Be=["progressive","strict"],Je=["off","warn","strict"],Qe=["off","warn","strict"],Ze=["off","warn","strict"];var et=["daily","weekly","monthly","yearly"],de=["mon","tue","wed","thu","fri","sat","sun"];function tt(e){return de.indexOf(e)}var rt=["draft","research","review","approved","executing","paused","completed","superseded"],nt=["pending","in_progress","completed","blocked","skipped","superseded"],st=["codex","claude-code","cursor","generic"],ot=["related","blocks","blocked_by","depends_on","discovered_from","implements","recurs_from","verifies","supersedes"],it=["brief","standard","deep","full"],at=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];function Y(e){let t=Math.ceil(e.size/2);for(let r of e.keys()){if(t===0)return;e.delete(r),t-=1}}var ue=2e3,L=new Map;function A(e){if(typeof e!="string")return"";let t=L.get(e);if(t!==void 0)return t;let r=e.trim().toLowerCase().replaceAll(/[\s-]+/g,"_");return L.size>=ue&&Y(L),L.set(e,r),r}var p=Object.freeze({types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"}),$=C,D=x,fe=["create","update"],_e=new Set(v),pe=new Set(K),me=new Set(W),ye=new Set(q),Ee=new Set(["string","number","boolean","array","object"]),Se=16;function B(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ae=[e=>e.type===void 0||typeof e.type=="string"&&Ee.has(e.type),e=>!Object.hasOwn(e,"const")||U(e.const),e=>e.enum===void 0||Array.isArray(e.enum)&&e.enum.every(t=>U(t)),e=>e.min_length===void 0||Number.isInteger(e.min_length)&&e.min_length>=0,e=>e.min_items===void 0||Number.isInteger(e.min_items)&&e.min_items>=0,e=>e.format===void 0||e.format==="date-time",e=>e.required===void 0||Array.isArray(e.required)&&e.required.every(t=>typeof t=="string"&&t.length>0),e=>e.additional_properties===void 0||typeof e.additional_properties=="boolean",e=>e.properties===void 0||B(e.properties),e=>e.one_of===void 0||Array.isArray(e.one_of)&&e.one_of.length>0];function U(e,t=new Set){if(e===null||typeof e=="string"||typeof e=="boolean")return!0;if(typeof e=="number")return Number.isFinite(e);if(typeof e!="object"||t.has(e))return!1;t.add(e);let r=Array.isArray(e)?e.every(n=>U(n,t)):Object.values(e).every(n=>U(n,t));return t.delete(e),r}function I(e,t=0,r=new Set){if(!B(e)||t>Se||r.has(e))return;r.add(e);let n=e,s=n.type,i=n.enum,l=n.one_of,a=n.properties,o=n.items,d=n.required,u=n.min_length,c=n.min_items,m=n.format,E=n.additional_properties;if(!Ae.every(_=>_(n))){r.delete(e);return}let w=a===void 0?void 0:Object.fromEntries(Object.entries(a).map(([_,F])=>[_,I(F,t+1,r)])),T=o===void 0?void 0:I(o,t+1,r),h=l===void 0?void 0:l.map(_=>I(_,t+1,r));if([...Object.values(w??{}),...o===void 0?[]:[T],...h??[]].some(_=>_===void 0)){r.delete(e);return}return r.delete(e),Object.fromEntries(Object.entries({type:s,const:Object.hasOwn(n,"const")?n.const:void 0,enum:i,min_length:u,min_items:c,format:m,properties:w,required:d===void 0?void 0:[...new Set(d)],additional_properties:E,items:T,one_of:h}).filter(([,_])=>_!==void 0))}function N(e){let t=Array.isArray(e)?e:[];return[...new Set(t.map(r=>typeof r=="string"?r.trim():"").filter(r=>r.length>0))].sort((r,n)=>r.localeCompare(n))}function f(e){if(typeof e!="string"||e.length===0)return;let t=A(e);return t.length>0?t:void 0}function we(e){return e.startsWith("--")?e.slice(2):e}function G(e){return typeof e=="string"?we(e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-")):""}function J(e){return e.replaceAll("_","-")}function Te(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g," ").trim().split(/\s+/).filter(s=>s.length>0).map(s=>s.toLowerCase());if(t.length===0)return e;let[r,...n]=t;return`${r}${n.map(s=>`${s.slice(0,1).toUpperCase()}${s.slice(1)}`).join("")}`}function b(e,t){let r=f(e.id);if(!r)return null;let n=[...new Set(N(e.aliases).map(A).filter(a=>a.length>0))].sort((a,o)=>a.localeCompare(o)),s=N(e.roles).filter(a=>_e.has(a)),i=e.description?.trim(),l=typeof e.order=="number"&&Number.isFinite(e.order)?e.order:t;return{id:r,aliases:n,roles:s,description:i&&i.length>0?i:void 0,order:l}}function he(e){return{draft_status:f(e?.draft_status),open_status:f(e?.open_status),in_progress_status:f(e?.in_progress_status),blocked_status:f(e?.blocked_status),close_status:f(e?.close_status),canceled_status:f(e?.canceled_status)}}function Q(e,t){if(!Array.isArray(t)||t.length!==2)return;let r=A(t[0]),n=A(t[1]);r.length===0||n.length===0||e.pairs.some(s=>s[0]===r&&s[1]===n)||e.pairs.push([r,n])}function ke(e){let t=typeof e?.type=="string"?e.type.trim():"";if(t.length===0||!Array.isArray(e?.allowed_transitions))return null;let r={type:t,pairs:[],denyAll:e.allowed_transitions.length===0};for(let n of e.allowed_transitions)Q(r,n);return{typeKey:t.toLowerCase(),record:r}}function Ne(e){if(!Array.isArray(e)||e.length===0)return;let t=new Map;for(let n of e){let s=ke(n);if(s===null)continue;let i=t.get(s.typeKey)??s.record;i.denyAll||=s.record.denyAll;for(let l of s.record.pairs)Q(i,l);t.set(s.typeKey,i)}let r=[];for(let n of t.values())(n.pairs.length>0||n.denyAll)&&r.push({type:n.type,allowed_transitions:n.pairs});return r.sort((n,s)=>n.type.localeCompare(s.type)),r.length>0?r:void 0}function Z(e){let t=A(e.key??"");if(!t)return null;let r=A(e.metadata_key??e.front_matter_key??t),n=G(e.cli_flag??J(t));if(!n)return null;let s=N(e.cli_aliases).map(c=>G(c)).filter(c=>c.length>0&&c!==n),i=typeof e.type=="string"?e.type.trim().toLowerCase():"string",l=pe.has(i)?i:"string",a=(()=>{let c=N(e.commands).filter(m=>me.has(m));return c.length>0?c:[...fe]})(),o=e.description?.trim(),d=N(e.required_types),u=e.value_schema===void 0?void 0:I(e.value_schema);return e.value_schema!==void 0&&u===void 0?null:{key:t,metadata_key:r,cli_flag:n,cli_aliases:s,description:o&&o.length>0?o:void 0,type:l,commands:a,repeatable:[e.repeatable===!0,l==="string_array"].includes(!0),required:e.required===!0,required_on_create:e.required_on_create===!0,required_types:d,allow_unset:e.allow_unset!==!1,value_schema:u}}function ge(e){let t=new Map;for(let[n,s]of e.entries()){let i=b(s,n);i&&t.set(i.id,i)}let r=X([...t.values()]);return r.length>0?r:X(D.map((n,s)=>b(n,s)).filter(n=>n!==null))}function X(e){return e.sort((t,r)=>t.order===r.order?t.id.localeCompare(r.id):t.order-r.order)}function Le(e){let t=new Map;for(let r of e??[]){let n=Z(r);n&&t.set(n.key,n)}return[...t.values()].sort((r,n)=>r.key.localeCompare(n.key))}function Ie(e){return{id:e.id,aliases:e.aliases.length>0?[...e.aliases]:void 0,roles:e.roles.length>0?[...e.roles]:void 0,description:e.description,order:e.order}}function Ue(e){return{key:e.key,metadata_key:e.metadata_key!==e.key?e.metadata_key:void 0,cli_flag:e.cli_flag!==J(e.key)?e.cli_flag:void 0,cli_aliases:e.cli_aliases.length>0?[...e.cli_aliases]:void 0,description:e.description,type:e.type,commands:[...e.commands],repeatable:e.repeatable===!0?!0:void 0,required:e.required===!0?!0:void 0,required_on_create:e.required_on_create===!0?!0:void 0,required_types:e.required_types.length>0?[...e.required_types]:void 0,allow_unset:e.allow_unset===!1?!1:void 0,value_schema:e.value_schema}}function Fe(e){let t=typeof e=="string"?e.trim().toLowerCase():"allow";return ye.has(t)?t:"allow"}function g(e){let t={...p,...e?.files},r=e?.statuses&&e.statuses.length>0?e.statuses:D,n=ge(r),s=Le(e?.fields);return{version:typeof e?.version=="number"&&Number.isFinite(e.version)?Math.floor(e.version):1,files:t,statuses:n.map(Ie),fields:s.map(Ue),workflow:{...$,...he(e?.workflow)},type_workflows:Ne(e?.type_workflows),unknown_field_policy:Fe(e?.unknown_field_policy)}}function Re(e,t,r){try{return JSON.parse(e)}catch{r.push(t);return}}function Oe(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let r=t.item_types;if(Array.isArray(r.definitions))return r.definitions}}function be(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function De(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function Me(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;return typeof t.workflow=="object"&&t.workflow!==null&&!Array.isArray(t.workflow)?t.workflow:typeof t.workflows=="object"&&t.workflows!==null&&!Array.isArray(t.workflows)?t.workflows:t}function xe(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e;if(Array.isArray(t.type_workflows))return t.type_workflows}function y(e,t,r){let n=t?.trim()||r;return H.isAbsolute(n)?n:H.join(e,n)}function wt(e,t){return y(e,t.files.types,p.types)}async function Tt(e,t){let r=g(t),n=[{path:y(e,r.files.types,p.types),seed:{definitions:[]}},{path:y(e,r.files.statuses,p.statuses),seed:{statuses:D}},{path:y(e,r.files.fields,p.fields),seed:{fields:[]}},{path:y(e,r.files.workflows,p.workflows),seed:{workflow:$}}],s=[];for(let i of n)await V(i.path)||await z(i.path,`${JSON.stringify(i.seed,null,2)}
2
+ `)&&s.push(i.path);return{created_paths:s}}async function ht(e,t){let r=g(t),n=[],s=y(e,r.files.types,p.types),i=y(e,r.files.statuses,p.statuses),l=y(e,r.files.fields,p.fields),a=y(e,r.files.workflows,p.workflows),o,d,u,c,m,E=async(F,ee)=>{let M=await P(F);if(M!==null)return Re(M,ee,n)},w=await E(s,"runtime_schema_types_invalid_json");w!==void 0&&(o=Oe(w),o===void 0&&n.push("runtime_schema_types_invalid_shape"));let T=await E(i,"runtime_schema_statuses_invalid_json");T!==void 0&&(d=be(T),d===void 0&&n.push("runtime_schema_statuses_invalid_shape"));let h=await E(l,"runtime_schema_fields_invalid_json");h!==void 0&&(u=De(h),u===void 0&&n.push("runtime_schema_fields_invalid_shape"));let S=await E(a,"runtime_schema_workflows_invalid_json");return S!==void 0&&(c=Me(S),c===void 0&&n.push("runtime_schema_workflows_invalid_shape"),m=xe(S)),{schema:g({...r,statuses:[...r.statuses,...d??[]],fields:[...r.fields,...u??[]],workflow:{...r.workflow,...c},type_workflows:[...r.type_workflows??[],...m??[]]}),type_definitions_from_file:o,warnings:n,created_paths:[]}}function k(e,t,r,n=!1){let i=r.map(a=>f(a)).filter(a=>typeof a=="string").find(a=>e.some(o=>o.id===a));if(n&&i!==void 0)return i;let l=e.find(a=>a.roles.includes(t));return l!==void 0?l.id:i??e[0]?.id}function Ce(e){let t=new Map,r=new Map;for(let n of e){r.set(n.id,n),t.set(n.id,n.id),t.set(n.id.replaceAll("_","-"),n.id),t.set(n.id.replaceAll("_"," "),n.id);for(let s of n.aliases)t.set(s,n.id),t.set(s.replaceAll("_","-"),n.id),t.set(s.replaceAll("_"," "),n.id)}return{aliasToId:t,byId:r}}function Ve(e){let t={activeStatuses:new Set,blockedStatuses:new Set,draftStatuses:new Set,terminalCanceledStatuses:new Set,terminalDoneStatuses:new Set,terminalStatuses:new Set};for(let r of e){let n=new Set(r.roles);(n.has("terminal")||n.has("terminal_done")||n.has("terminal_canceled"))&&t.terminalStatuses.add(r.id),n.has("terminal_done")&&t.terminalDoneStatuses.add(r.id),n.has("terminal_canceled")&&t.terminalCanceledStatuses.add(r.id),n.has("active")&&t.activeStatuses.add(r.id),n.has("blocked")&&t.blockedStatuses.add(r.id),n.has("draft")&&t.draftStatuses.add(r.id)}return t}function kt(e){let t=g(e),r=t.statuses.map((S,_)=>b(S,_)).filter(S=>S!==null),{aliasToId:n,byId:s}=Ce(r),{activeStatuses:i,blockedStatuses:l,draftStatuses:a,terminalCanceledStatuses:o,terminalDoneStatuses:d,terminalStatuses:u}=Ve(r),c=t.workflow,m=f(c.open_status)??k(r,"default_open",["open","in_progress",j[0]]),E=f(c.in_progress_status)??k(r,"active",["in_progress","in-progress",m],!0),w=f(c.blocked_status)??k(r,"blocked",["blocked"]),T=f(c.close_status)??k(r,"default_close",["closed","done","complete"]),h=f(c.canceled_status)??k(r,"default_cancel",["canceled","cancelled"]);return{definitions:r,by_id:s,alias_to_id:n,terminal_statuses:u,terminal_done_statuses:d,terminal_canceled_statuses:o,active_statuses:i,blocked_statuses:l,draft_statuses:a,open_status:m,in_progress_status:E,blocked_status:w,close_status:T,canceled_status:h}}function Pe(e,t){let r=A(e);if(r)return t.alias_to_id.get(r)}function Nt(e){let t=g(e),r=new Map,n=t.fields.map(o=>Z(o)).filter(o=>o!==null);for(let o of n)r.set(o.key,o);let s=[...r.values()].sort((o,d)=>o.key.localeCompare(d.key)),i=new Map,l=new Map,a=new Map;for(let o of s){i.set(o.key,o),l.set(o.cli_flag,o);for(let d of o.cli_aliases)l.set(d,o);for(let d of o.commands){let u=a.get(d)??[];u.push(o),a.set(d,u)}}for(let[o,d]of a.entries())d.sort((u,c)=>u.key.localeCompare(c.key)),a.set(o,d);return{definitions:s,by_key:i,by_cli_token:l,command_to_fields:a}}function gt(e){return Te(e.key)}function Lt(e,t){let r=Pe(e,t);return r?t.terminal_statuses.has(r):!1}export{ce as a,Ke as b,j as c,v as d,K as e,W as f,q as g,We as h,qe as i,Ye as j,He as k,Ge as l,Xe as m,$e as n,Be as o,Je as p,Qe as q,Ze as r,et as s,de as t,tt as u,rt as v,nt as w,st as x,ot as y,it as z,at as A,Y as B,A as C,O as D,z as E,p as F,$ as G,D as H,G as I,g as J,y as K,wt as L,Tt as M,ht as N,kt as O,Pe as P,Nt as Q,gt as R,Lt as S};
3
+ //# sourceMappingURL=chunk-RIQUIHYU.js.map
@@ -1,2 +1,2 @@
1
- import{ca as R}from"./chunk-IROZDIDX.js";import{mb as r}from"./chunk-IR2J3NOT.js";import{Pg as S,Qg as N,Sg as E,sb as a}from"./chunk-Z2X7HH3C.js";var u=new Set(["--author","--expect-hash","--follow","--help","--lean","--token-accounting","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor","--output-row-contract","--no-changed-fields","--no-extensions","--no-pager","--pm-path","--profile","--quiet","--interval-ms"]),I=new Set([...S,...N]),p=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),P=new Set(["--body-file","--file","--stdin-json"]),m=new Set(["--global","--local","--project"]),d=new Set(["--activity-limit","--default-depth","--section-activity","--section-blockers","--section-files","--section-hierarchy","--section-progress","--section-staleness","--section-tests","--section-workload","--stale-threshold-days"]),f=new Set(["action","fullChangedFields","idOnly","path","pmExecutable","timeoutMs"]),M=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),G={assurance:{id:"<id>",kind:"<kind>",preset:"[kind]|[id]",subcommand:"<action>"},event:{title:"<title>"},files:{lookupPath:"lookup <path...>"},meet:{title:"<title>"},"item-reopen":{id:"<id>",reason:"<reason>"},merge:{subcommand:"<subcommand>"},remind:{title:"<title>"},workspace:{name:"<name>",subcommand:"snapshot",snapshotAction:"<snapshot-action>",target:"<target>"}},F={append:{"--text":"body"},assurance:{"--tree":"treeId","--owner":"owner","--apply":"apply","--enforcement":"enforcement"},init:{"--id-prefix":"idPrefix","--no-merge-fence":"mergeFence","--workspace":"workspace"},create:{"--no-inherit-focus":"inheritFocus","--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},plan:{"--no-inherit-focus":"inheritFocus"},update:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},"update-many":{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},files:{"--note":"addNote","--note-conflict":"noteConflict","--full-history":"full"},docs:{"--note":"addNote","--note-conflict":"noteConflict","--full-history":"full"},test:{"--full-history":"full"},comments:{"--full-history":"full"},notes:{"--file":"text","--full-history":"full"},learnings:{"--file":"text","--full-history":"full"},gc:{"--scope":"gcScope"},contracts:{"--action":"contractAction"},schema:{"--no-allow-unset":"allowUnset","--type":"fieldTypeScope"},"history-author-acknowledge":{"--event":"historyEvent","--all-actionable":"allActionable"},"extension-init":{"--capability":"capability"},"package-init":{"--capability":"capability"},"extension-install":{"--gh":"github"},"package-install":{"--gh":"github"},"extension-adopt":{"--gh":"github"},"package-adopt":{"--gh":"github"},extension:{"--gh":"github","--scaffold":"init"},package:{"--gh":"github","--scaffold":"init"},install:{"--gh":"github"}},D={"--pm-path":"path"},c={stats:{"--analytics":["measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]}};function h(t){return t.startsWith("extension-")?`extension ${t.slice(10)}`:t.startsWith("package-")?`package ${t.slice(8)}`:t.startsWith("item-")?`item ${t.slice(5)}`:t}function l(t,e){let T=F[t]?.[e]??D[e];return T!==void 0?T:e.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(O,_)=>_.toUpperCase())}function g(t){let e=new Set;return t.filter(({flag:T})=>!T.startsWith("--")||e.has(T)?!1:(e.add(T),!0))}function U(t,e){return e.find(({aliases:T})=>T?.includes(t))?.flag}function y(t,e,T,O){let _=c[t]?.[e.flag];if(_!==void 0&&_.every(A=>O.has(A)))return{surface:"cli",input:e.flag,counterpart:_[0],disposition:"shared",reason:"The validated CLI JSON object fans out across strict SDK parameters."};let i=l(t,e.flag);if(O.has(i))return{surface:"cli",input:e.flag,counterpart:i,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let C=U(e.flag,T);if(C!==void 0){let A=l(t,C);if(O.has(A))return{surface:"cli",input:e.flag,counterpart:A,disposition:"compatibility_alias",reason:`Compatibility spelling for ${C}.`}}return u.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:p.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:P.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:d.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"key",disposition:"compatibility_alias",reason:"CLI config shorthand normalizes to the SDK configAction/key/value contract."}:m.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"scope",disposition:"cli_scope_selector",reason:"Mutually exclusive CLI scope switches normalize to the SDK scope parameter."}:{surface:"cli",input:e.flag,counterpart:i,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function b(t,e,T){let O=Object.entries(c[t]??{}).find(([C,A])=>A.includes(e)&&T.some(({input:o,disposition:s})=>o===C&&s==="shared"));if(O!==void 0)return{surface:"sdk",input:e,counterpart:O[0],disposition:"shared",reason:"The strict SDK parameter is reachable through the validated CLI JSON object."};let _=T.find(({counterpart:C,disposition:A})=>C===e&&(A==="shared"||A==="compatibility_alias"||A==="cli_scope_selector"));if(_!==void 0)return{surface:"sdk",input:e,counterpart:_.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let i=G[t]?.[e];return i!==void 0?{surface:"sdk",input:e,counterpart:i,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:f.has(e)?{surface:"sdk",input:e,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:M.has(e)?{surface:"sdk",input:e,disposition:"cli_positional",reason:"The CLI accepts this SDK parameter as a positional command argument."}:{surface:"sdk",input:e,disposition:"sdk_native",reason:"The typed SDK exposes this structured input without a canonical CLI long flag."}}function x(t={}){let e=t.actions??a,T=t.resolveFlags??r,O=t.resolveParameters??R;return e.map(_=>{let i=h(_),C=g(T(i)).filter(({flag:n})=>E(_)!==void 0||!I.has(n)),A=new Set(O(_)??[]),o=C.map(n=>y(_,n,C,A)),s=[...A].sort((n,L)=>n.localeCompare(L)).map(n=>b(_,n,o));return{action:_,command:i,cli:o,sdk:s,unclassified:[...o,...s].filter(({disposition:n})=>n==="unclassified")}})}export{x as a};
2
- //# sourceMappingURL=chunk-QQIIMMFU.js.map
1
+ import{ca as R}from"./chunk-3OCDKITJ.js";import{mb as r}from"./chunk-LMFIAQ2V.js";import{Ba as a,ff as S,gf as N,if as E}from"./chunk-SMMOZ3H3.js";var u=new Set(["--author","--expect-hash","--follow","--help","--lean","--token-accounting","--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor","--output-row-contract","--no-changed-fields","--no-extensions","--no-pager","--pm-path","--profile","--quiet","--interval-ms"]),I=new Set([...S,...N]),p=new Set(["--brief","--format","--full","--full-changed-fields","--id-only","--no-truncate","--stream"]),P=new Set(["--body-file","--file","--stdin-json"]),m=new Set(["--global","--local","--project"]),d=new Set(["--activity-limit","--default-depth","--section-activity","--section-blockers","--section-files","--section-hierarchy","--section-progress","--section-staleness","--section-tests","--section-workload","--stale-threshold-days"]),f=new Set(["action","fullChangedFields","idOnly","path","pmExecutable","timeoutMs"]),M=new Set(["configAction","id","name","query","reason","subcommand","target","text"]),G={assurance:{id:"<id>",kind:"<kind>",preset:"[kind]|[id]",subcommand:"<action>"},event:{title:"<title>"},files:{lookupPath:"lookup <path...>"},meet:{title:"<title>"},"item-reopen":{id:"<id>",reason:"<reason>"},merge:{subcommand:"<subcommand>"},remind:{title:"<title>"},workspace:{name:"<name>",subcommand:"snapshot",snapshotAction:"<snapshot-action>",target:"<target>"}},F={append:{"--text":"body"},assurance:{"--tree":"treeId","--owner":"owner","--apply":"apply","--enforcement":"enforcement"},init:{"--id-prefix":"idPrefix","--no-merge-fence":"mergeFence","--workspace":"workspace"},create:{"--no-inherit-focus":"inheritFocus","--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},plan:{"--no-inherit-focus":"inheritFocus"},update:{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},"update-many":{"--ac":"acceptanceCriteria","--estimated-minutes":"estimate","--file":"linkedFile","--test":"linkedTest","--expected":"expectedResult","--actual":"actualResult"},files:{"--note":"addNote","--note-conflict":"noteConflict","--full-history":"full"},docs:{"--note":"addNote","--note-conflict":"noteConflict","--full-history":"full"},test:{"--full-history":"full"},comments:{"--full-history":"full"},notes:{"--file":"text","--full-history":"full"},learnings:{"--file":"text","--full-history":"full"},gc:{"--scope":"gcScope"},contracts:{"--action":"contractAction"},schema:{"--no-allow-unset":"allowUnset","--type":"fieldTypeScope"},"history-author-acknowledge":{"--event":"historyEvent","--all-actionable":"allActionable"},"extension-init":{"--capability":"capability"},"package-init":{"--capability":"capability"},"extension-install":{"--gh":"github"},"package-install":{"--gh":"github"},"extension-adopt":{"--gh":"github"},"package-adopt":{"--gh":"github"},extension:{"--gh":"github","--scaffold":"init"},package:{"--gh":"github","--scaffold":"init"},install:{"--gh":"github"}},D={"--pm-path":"path"},c={stats:{"--analytics":["measurements","metric","measurementLimit","observe","improvementDirection","measurementSource","measurementItem","measurementRevision","author","message","provenanceCoverage","fleetAttribution","since","eventLimit","minimumSample"]}};function h(t){return t.startsWith("extension-")?`extension ${t.slice(10)}`:t.startsWith("package-")?`package ${t.slice(8)}`:t.startsWith("item-")?`item ${t.slice(5)}`:t}function l(t,e){let T=F[t]?.[e]??D[e];return T!==void 0?T:e.replace(/^--/,"").replaceAll("_","-").replace(/-([a-z])/g,(O,_)=>_.toUpperCase())}function g(t){let e=new Set;return t.filter(({flag:T})=>!T.startsWith("--")||e.has(T)?!1:(e.add(T),!0))}function U(t,e){return e.find(({aliases:T})=>T?.includes(t))?.flag}function y(t,e,T,O){let _=c[t]?.[e.flag];if(_!==void 0&&_.every(A=>O.has(A)))return{surface:"cli",input:e.flag,counterpart:_[0],disposition:"shared",reason:"The validated CLI JSON object fans out across strict SDK parameters."};let i=l(t,e.flag);if(O.has(i))return{surface:"cli",input:e.flag,counterpart:i,disposition:"shared",reason:"The CLI flag maps directly to a strict SDK action parameter."};let C=U(e.flag,T);if(C!==void 0){let A=l(t,C);if(O.has(A))return{surface:"cli",input:e.flag,counterpart:A,disposition:"compatibility_alias",reason:`Compatibility spelling for ${C}.`}}return u.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_transport",reason:"CLI process transport is supplied by the in-process SDK host."}:p.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_presentation",reason:"CLI rendering or mutation projection does not alter the SDK result envelope."}:P.has(e.flag)?{surface:"cli",input:e.flag,disposition:"cli_adapter",reason:"Local file or stdin adaptation is a CLI boundary concern."}:d.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"key",disposition:"compatibility_alias",reason:"CLI config shorthand normalizes to the SDK configAction/key/value contract."}:m.has(e.flag)?{surface:"cli",input:e.flag,counterpart:"scope",disposition:"cli_scope_selector",reason:"Mutually exclusive CLI scope switches normalize to the SDK scope parameter."}:{surface:"cli",input:e.flag,counterpart:i,disposition:"unclassified",reason:"The CLI flag has no strict SDK parameter or approved boundary classification."}}function b(t,e,T){let O=Object.entries(c[t]??{}).find(([C,A])=>A.includes(e)&&T.some(({input:o,disposition:s})=>o===C&&s==="shared"));if(O!==void 0)return{surface:"sdk",input:e,counterpart:O[0],disposition:"shared",reason:"The strict SDK parameter is reachable through the validated CLI JSON object."};let _=T.find(({counterpart:C,disposition:A})=>C===e&&(A==="shared"||A==="compatibility_alias"||A==="cli_scope_selector"));if(_!==void 0)return{surface:"sdk",input:e,counterpart:_.input,disposition:"shared",reason:"The strict SDK parameter is reachable from the CLI contract."};let i=G[t]?.[e];return i!==void 0?{surface:"sdk",input:e,counterpart:i,disposition:"shared",reason:"The strict SDK parameter maps to a canonical CLI positional argument."}:f.has(e)?{surface:"sdk",input:e,disposition:"sdk_transport",reason:"The SDK host supplies in-process transport and workspace selection."}:M.has(e)?{surface:"sdk",input:e,disposition:"cli_positional",reason:"The CLI accepts this SDK parameter as a positional command argument."}:{surface:"sdk",input:e,disposition:"sdk_native",reason:"The typed SDK exposes this structured input without a canonical CLI long flag."}}function x(t={}){let e=t.actions??a,T=t.resolveFlags??r,O=t.resolveParameters??R;return e.map(_=>{let i=h(_),C=g(T(i)).filter(({flag:n})=>E(_)!==void 0||!I.has(n)),A=new Set(O(_)??[]),o=C.map(n=>y(_,n,C,A)),s=[...A].sort((n,L)=>n.localeCompare(L)).map(n=>b(_,n,o));return{action:_,command:i,cli:o,sdk:s,unclassified:[...o,...s].filter(({disposition:n})=>n==="unclassified")}})}export{x as a};
2
+ //# sourceMappingURL=chunk-RLO2HCZT.js.map