@unbrained/pm-cli 2026.8.4 → 2026.8.5

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 (214) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +39 -13
  3. package/dist/cli/error-guidance.js +4 -4
  4. package/dist/cli/register-structured-mutation.d.ts +2 -0
  5. package/dist/cli/register-structured-mutation.js +124 -12
  6. package/dist/cli-bundle/bundle-manifest.json +407 -407
  7. package/dist/cli-bundle/chunks/append-VXXGOXSG.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-QVO3VTA4.js → chunk-2WFXWAYX.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-NM5G7RLU.js → chunk-3FTILRJ2.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-VH2EAGUG.js → chunk-42E7YPLG.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-RB65T4RX.js → chunk-43HQQI6S.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-J4EPW4GT.js → chunk-45G53IU4.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-PQXEB7W4.js → chunk-4VN6GS4U.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-4YUBDMQM.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-D2MBVMVE.js → chunk-54FNT7U2.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-NRDKVOUE.js → chunk-5ZBOIPGP.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-3XZYTRPC.js → chunk-6MSQJOTG.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-GOICHIX4.js → chunk-7A5OT5J2.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-HTYC76A4.js → chunk-7C4PTJG6.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-BKMZTZYL.js → chunk-A62CYISG.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-5H47J5FG.js → chunk-BPELKUQD.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-HE3DZFN4.js → chunk-BXQLRKWF.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-BLINBTMX.js → chunk-CSI3WS5I.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-KH4GVBMC.js → chunk-DXDREUXT.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-KIKLF2W4.js → chunk-E2RKBKWB.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-377OOXUF.js → chunk-EGJ4JTUG.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-SULWTPQO.js → chunk-FPBQHMFT.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-V5K52PYW.js → chunk-GE4KCSZP.js} +35 -35
  29. package/dist/cli-bundle/chunks/{chunk-NPUJ7OLK.js → chunk-HNFD72UK.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-QMWUL66F.js → chunk-HWRRMBJO.js} +5 -5
  31. package/dist/cli-bundle/chunks/chunk-L3AZOELJ.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-CGY5I2GO.js → chunk-LKDGK44W.js} +2 -2
  33. package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +2 -0
  34. package/dist/cli-bundle/chunks/{chunk-ZSH4GNBH.js → chunk-M72BKL5Q.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-HQ2WU7OY.js → chunk-MHK6LIWE.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-H6FITE7D.js → chunk-NE5VRDAI.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-NY4T3JWN.js +2 -0
  38. package/dist/cli-bundle/chunks/{chunk-DCJ6CM6F.js → chunk-OMXVBQ2N.js} +2 -2
  39. package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +8 -0
  40. package/dist/cli-bundle/chunks/{chunk-CU5ENFNP.js → chunk-OTHLDSFP.js} +2 -2
  41. package/dist/cli-bundle/chunks/{chunk-NH35JNK5.js → chunk-PMXJEU3F.js} +2 -2
  42. package/dist/cli-bundle/chunks/{chunk-SVDH5CHC.js → chunk-Q35VBGOQ.js} +4 -4
  43. package/dist/cli-bundle/chunks/{chunk-5PZGZMPG.js → chunk-R546TPDE.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-Q5F6OI7C.js → chunk-RKAVWO3O.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-JMKVCQSE.js → chunk-SSF4PIUR.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-PA5XRN2A.js → chunk-UN66FZRO.js} +3 -3
  47. package/dist/cli-bundle/chunks/{chunk-FQ4EFFDU.js → chunk-UP7DTVMD.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-NFF3JAQR.js → chunk-UZBWIUYD.js} +2 -2
  49. package/dist/cli-bundle/chunks/{chunk-2POYGY53.js → chunk-V3774P7D.js} +2 -2
  50. package/dist/cli-bundle/chunks/{chunk-B5ZLCD5Z.js → chunk-V3EUXXOF.js} +2 -2
  51. package/dist/cli-bundle/chunks/{chunk-6S7I3UKV.js → chunk-VCKLFEUN.js} +19 -19
  52. package/dist/cli-bundle/chunks/{chunk-PYYPQLHC.js → chunk-VN5VITU3.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +20 -0
  54. package/dist/cli-bundle/chunks/{chunk-UJHUR3LZ.js → chunk-XCEZYMNI.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-JDPKBV5P.js → chunk-YEWNL576.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-OB7TRZ2G.js → chunk-YSO3YFZ4.js} +2 -2
  57. package/dist/cli-bundle/chunks/{chunk-UVZREFZU.js → chunk-ZYHOB3SN.js} +2 -2
  58. package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +2 -0
  59. package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +2 -0
  60. package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +2 -0
  61. package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +2 -0
  62. package/dist/cli-bundle/chunks/{create-RLLCBCXM.js → create-XLKTXTUF.js} +2 -2
  63. package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +2 -0
  64. package/dist/cli-bundle/chunks/{deps-J4ONTF4X.js → deps-ITTY3GIC.js} +2 -2
  65. package/dist/cli-bundle/chunks/{docs-YL2DJ4WD.js → docs-W4OSRTYR.js} +2 -2
  66. package/dist/cli-bundle/chunks/{files-NGNAIYKK.js → files-EOK4AZI4.js} +2 -2
  67. package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +2 -0
  68. package/dist/cli-bundle/chunks/{history-compact-HW62K5XP.js → history-compact-7UGTMLL3.js} +2 -2
  69. package/dist/cli-bundle/chunks/{history-redact-HVBKUJOW.js → history-redact-4DZRMD6Z.js} +2 -2
  70. package/dist/cli-bundle/chunks/{history-repair-OPNBH5JJ.js → history-repair-UPOSZW5R.js} +2 -2
  71. package/dist/cli-bundle/chunks/{learnings-F36PZXT6.js → learnings-GMRNCBS3.js} +2 -2
  72. package/dist/cli-bundle/chunks/{profile-N3XMWBM7.js → profile-2MUUMHRE.js} +2 -2
  73. package/dist/cli-bundle/chunks/{register-list-query-BKGHBI7Y.js → register-list-query-LR3SQ5ZF.js} +2 -2
  74. package/dist/cli-bundle/chunks/register-mutation-SUOHFVWM.js +20 -0
  75. package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +2 -0
  76. package/dist/cli-bundle/chunks/{register-setup-KWV6UD77.js → register-setup-O6AYP6NP.js} +2 -2
  77. package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +2 -0
  78. package/dist/cli-bundle/chunks/{schema-4PJQMGUY.js → schema-FJ4EA3XF.js} +2 -2
  79. package/dist/cli-bundle/chunks/update-YHV52CSS.js +2 -0
  80. package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/chunk-7J5TUBUJ.js +153 -0
  82. package/dist/cli-bundle/focused-chunks/{chunk-ONIX2KKW.js → chunk-A7BJ5SS6.js} +2 -2
  83. package/dist/cli-bundle/focused-chunks/chunk-B7LJWAZE.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/{chunk-QM2BIVK7.js → chunk-BIMTMOS7.js} +3 -3
  85. package/dist/cli-bundle/focused-chunks/{chunk-BOGRY7M6.js → chunk-FGKY4MBE.js} +10 -10
  86. package/dist/cli-bundle/focused-chunks/chunk-G6ETT4QK.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/{chunk-C2QSL62X.js → chunk-GJ2TG2CW.js} +2 -2
  88. package/dist/cli-bundle/focused-chunks/{chunk-RO5BQFG3.js → chunk-IPWSFADF.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/{chunk-UFCPSWIL.js → chunk-MJ7HWSFK.js} +2 -2
  90. package/dist/cli-bundle/focused-chunks/{chunk-2VIIXOAD.js → chunk-N5XU5UVK.js} +2 -2
  91. package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +2 -0
  92. package/dist/cli-bundle/focused-chunks/{chunk-OYTK4VNH.js → chunk-PIMMYG7Q.js} +2 -2
  93. package/dist/cli-bundle/focused-chunks/{chunk-K37BB4JL.js → chunk-QVHKCI4T.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-SQXVGHMH.js → chunk-RUR5I3TK.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/chunk-SV3O7TSH.js +8 -0
  96. package/dist/cli-bundle/focused-chunks/{chunk-L6A4NVQC.js → chunk-UIL2M2NA.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-WVGJAD7L.js → chunk-VLYOEYML.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +2 -0
  99. package/dist/cli-bundle/focused-chunks/{chunk-DQ4PLKEE.js → chunk-WEM2E2PE.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/chunk-WVIVUWVL.js +5 -0
  101. package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +2 -0
  102. package/dist/cli-bundle/main.js +4 -4
  103. package/dist/cli-bundle/sdk-authoring.js +1 -1
  104. package/dist/cli-bundle/sdk-contracts.js +1 -1
  105. package/dist/cli-bundle/sdk-core.js +28 -28
  106. package/dist/cli-bundle/sdk-governance.js +1 -1
  107. package/dist/cli-bundle/sdk-graph.js +1 -1
  108. package/dist/cli-bundle/sdk-merge.js +1 -1
  109. package/dist/cli-bundle/sdk-query.js +1 -1
  110. package/dist/cli-bundle/sdk-runtime.js +1 -1
  111. package/dist/cli-bundle/sdk-testing.js +1 -1
  112. package/dist/cli-bundle/sdk.js +1 -1
  113. package/dist/core/extensions/loader.js +5 -2
  114. package/dist/core/item/item-format.js +14 -20
  115. package/dist/core/shared/constants.js +3 -2
  116. package/dist/core/store/item-store.js +2 -2
  117. package/dist/core/store/settings.js +2 -2
  118. package/dist/mcp/server.js +12 -6
  119. package/dist/mcp/tool-definitions.js +14 -7
  120. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +18 -18
  121. package/dist/sdk/cli-contracts/agent-output-contracts.js +51 -23
  122. package/dist/sdk/cli-contracts/commander-mutation-options.js +26 -2
  123. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  124. package/dist/sdk/cli-contracts/flag-contracts.js +28 -2
  125. package/dist/sdk/cli-contracts/registration-helpers.js +4 -2
  126. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +10 -2
  127. package/dist/sdk/cli-contracts/runtime-contracts.js +20 -5
  128. package/dist/sdk/cli-contracts/tool-schema.js +4 -2
  129. package/dist/sdk/cli-contracts.d.ts +2 -2
  130. package/dist/sdk/cli-contracts.js +4 -4
  131. package/dist/sdk/cli-program.js +3 -3
  132. package/dist/sdk/contracts.d.ts +1 -0
  133. package/dist/sdk/contracts.js +3 -2
  134. package/dist/sdk/dependency-provenance.d.ts +2 -0
  135. package/dist/sdk/dependency-provenance.js +7 -3
  136. package/dist/sdk/error-code-catalog.d.ts +23 -0
  137. package/dist/sdk/error-code-catalog.js +25 -5
  138. package/dist/sdk/generated-error-code-catalog.js +499 -3
  139. package/dist/sdk/graph/governance.js +3 -3
  140. package/dist/sdk/graph/remediation.js +3 -3
  141. package/dist/sdk/graph/run.js +4 -8
  142. package/dist/sdk/index.d.ts +2 -1
  143. package/dist/sdk/index.js +4 -3
  144. package/dist/sdk/item-transaction.d.ts +51 -6
  145. package/dist/sdk/item-transaction.js +132 -22
  146. package/dist/sdk/lifecycle/create.d.ts +4 -0
  147. package/dist/sdk/lifecycle/create.js +26 -10
  148. package/dist/sdk/lifecycle-policy.d.ts +9 -0
  149. package/dist/sdk/lifecycle-policy.js +22 -9
  150. package/dist/sdk/merge/driver.js +6 -3
  151. package/dist/sdk/output-contracts.d.ts +67 -0
  152. package/dist/sdk/output-contracts.js +173 -0
  153. package/dist/sdk/package-import-adapters.js +2 -2
  154. package/dist/sdk/structured-mutations.d.ts +23 -0
  155. package/dist/sdk/structured-mutations.js +219 -10
  156. package/dist/sdk/workspace-snapshot.js +58 -12
  157. package/dist/sdk/workspace.js +30 -4
  158. package/docs/COMMANDS.md +40 -10
  159. package/docs/EXTENSIONS.md +1 -1
  160. package/docs/MERGE_SAFETY.md +2 -0
  161. package/docs/PR_REVIEW_LOOP.md +10 -4
  162. package/docs/README.md +22 -22
  163. package/docs/RELEASING.md +3 -3
  164. package/docs/SCRIPTING.md +32 -9
  165. package/docs/SDK.md +91 -11
  166. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  167. package/docs/TESTING.md +25 -0
  168. package/docs/examples/sdk-contract-consumer/README.md +11 -1
  169. package/docs/examples/sdk-contract-consumer/package.json +2 -1
  170. package/docs/examples/sdk-contract-consumer/parse-receipt.mjs +22 -0
  171. package/marketplace.json +2 -2
  172. package/package.json +3 -2
  173. package/packages/pm-beads/package.json +1 -1
  174. package/packages/pm-calendar/package.json +1 -1
  175. package/packages/pm-command-kit/package.json +1 -1
  176. package/packages/pm-digital-twin/package.json +1 -1
  177. package/packages/pm-governance-audit/package.json +1 -1
  178. package/packages/pm-guide-shell/package.json +1 -1
  179. package/packages/pm-kanban/package.json +1 -1
  180. package/packages/pm-lifecycle-hooks/package.json +1 -1
  181. package/packages/pm-linked-test-adapters/package.json +1 -1
  182. package/packages/pm-search-advanced/package.json +1 -1
  183. package/packages/pm-templates/package.json +1 -1
  184. package/packages/pm-todos/package.json +1 -1
  185. package/packages/pm-vcs/package.json +1 -1
  186. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  187. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  188. package/sdk/public-surface.json +292 -14
  189. package/dist/cli-bundle/chunks/append-DHBRLHHS.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-2INN52SU.js +0 -8
  191. package/dist/cli-bundle/chunks/chunk-6RSK4IFN.js +0 -20
  192. package/dist/cli-bundle/chunks/chunk-ASJJKA57.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-IYAVULRN.js +0 -2
  194. package/dist/cli-bundle/chunks/chunk-RRQBHQOV.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-XBLOD5TZ.js +0 -2
  196. package/dist/cli-bundle/chunks/close-VLHNN6YB.js +0 -2
  197. package/dist/cli-bundle/chunks/close-many-LSJNZKU6.js +0 -2
  198. package/dist/cli-bundle/chunks/comments-AAIA6A6X.js +0 -2
  199. package/dist/cli-bundle/chunks/copy-Z7YMLEHN.js +0 -2
  200. package/dist/cli-bundle/chunks/delete-KNOHHQJM.js +0 -2
  201. package/dist/cli-bundle/chunks/focus-LFRCGALV.js +0 -2
  202. package/dist/cli-bundle/chunks/register-mutation-GU3DCECN.js +0 -20
  203. package/dist/cli-bundle/chunks/register-operations-PTWH727R.js +0 -2
  204. package/dist/cli-bundle/chunks/restore-4HZSLILR.js +0 -2
  205. package/dist/cli-bundle/chunks/update-E6LPS5IV.js +0 -2
  206. package/dist/cli-bundle/chunks/update-many-OSIC6KRO.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-5MTKO7TV.js +0 -153
  208. package/dist/cli-bundle/focused-chunks/chunk-6GIZK7VQ.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-AOP2WIZZ.js +0 -2
  210. package/dist/cli-bundle/focused-chunks/chunk-CL75YW32.js +0 -2
  211. package/dist/cli-bundle/focused-chunks/chunk-E7OFMWGT.js +0 -8
  212. package/dist/cli-bundle/focused-chunks/chunk-I5F5UK3Q.js +0 -2
  213. package/dist/cli-bundle/focused-chunks/chunk-T5TSY36R.js +0 -5
  214. package/dist/cli-bundle/focused-chunks/chunk-VT6BF2IX.js +0 -2
@@ -1,2 +0,0 @@
1
- (function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="804df95b-c2fc-5ea7-bfb5-aea890a65abc")}catch{}})();function n(t){let e=new Set,i=t.map(r=>{let s=r.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(s))throw new TypeError(`Invalid pm error code: ${JSON.stringify(r.code)}`);if(e.has(s))throw new TypeError(`Duplicate pm error code: ${s}`);if(e.add(s),![1,2,3,4,5].includes(r.exit_code)||r.meaning.trim().length===0||r.recovery.trim().length===0||r.sources.length===0)throw new TypeError(`Invalid pm error code contract: ${s}`);return Object.freeze({...r,code:s,meaning:r.meaning.trim(),recovery:r.recovery.trim(),sources:[...new Set(r.sources.map(o=>o.trim()).filter(Boolean))].sort()})});return Object.freeze(i.sort((r,s)=>r.code.localeCompare(s.code)))}function y(t,e){let i=t.trim(),r=e.find(s=>s.code===i);if(!r)throw new TypeError(`Unknown pm error code "${i}"`);return r}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="7041fa57-f2d5-557e-9ee0-d1ab29b2d8b8")}catch{}})();var p=n([{code:"acceptance_criteria_semicolon_forbidden",meaning:"Acceptance criteria semicolon forbidden condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/item/parse.ts"]},{code:"already_claimed_by",meaning:"Already claimed by condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/claim.ts"]},{code:"ambiguous_list_all",meaning:"Ambiguous list all condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-list-query.ts"]},{code:"ambiguous_option_combination",meaning:"Ambiguous option combination condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/plan.ts"]},{code:"annotation_flag_like_value",meaning:"Annotation flag like value condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",meaning:"Annotation message without text condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/annotations.ts"]},{code:"append_empty_body",meaning:"Append empty body condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/append.ts"]},{code:"body_file_conflicts_with_body",meaning:"Body file conflicts with body condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",meaning:"Body file missing path condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",meaning:"Body file unreadable condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/io/body-file.ts"]},{code:"bundle_integrity_torn_install",meaning:"Bundle integrity torn install condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",meaning:"Capability undeclared condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"capability_unused",meaning:"Capability unused condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",meaning:"Child projection item bound exceeded condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/item-children.ts"]},{code:"close_reason_required",meaning:"Close reason required condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"]},{code:"close_through_update",meaning:"Close through update condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/telemetry/observability.ts"]},{code:"close_validation_missing_fields",meaning:"Close validation missing fields condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/close.ts"]},{code:"collected_zero_items",meaning:"Collected zero items condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/test/execution.ts"]},{code:"command_failed",meaning:"Command failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts"]},{code:"command_namespace",meaning:"Command namespace condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/cli-contracts/runtime-contracts.ts"]},{code:"command_override_conflict",meaning:"Command override conflict condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"config_duplicate",meaning:"Config duplicate condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"config_key_unknown",meaning:"Config key unknown condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"config_value_invalid",meaning:"Config value invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"conflicting_lifecycle_owner",meaning:"Conflicting lifecycle owner condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-operations.ts"]},{code:"context_takes_no_item_argument",meaning:"Context takes no item argument condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts"]},{code:"core_item_field_requires_dedicated_flag",meaning:"Core item field requires dedicated flag condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/item-fields.ts"]},{code:"create_positional_type_without_title",meaning:"Create positional type without title condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-mutation.ts"]},{code:"dependency_edge_not_allowed",meaning:"Dependency edge not allowed condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/dependency-flag-validation.ts"]},{code:"duplicate_command",meaning:"Duplicate command condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"duplicate_edge",meaning:"Duplicate edge condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/graph/remediation.ts"]},{code:"duplicate_sweep_cost_limit",meaning:"Duplicate sweep cost limit condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/similarity.ts"]},{code:"duplicate_target_circular",meaning:"Duplicate target circular condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/close.ts"]},{code:"duplicate_target_is_duplicate",meaning:"Duplicate target is duplicate condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/close.ts"]},{code:"duplicate_target_missing",meaning:"Duplicate target missing condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/close.ts"]},{code:"duplicate_target_self",meaning:"Duplicate target self condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/close.ts"]},{code:"empty_surface",meaning:"Empty surface condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"event_cursor_query_mismatch",meaning:"Event cursor query mismatch condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-events.ts"]},{code:"event_index_unavailable",meaning:"Event index unavailable condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-events.ts"]},{code:"extension_command_activation_failed",meaning:"Extension command activation failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/commander-usage.ts"]},{code:"extension_dependency_name_unsafe",meaning:"Extension dependency name unsafe condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_spec_invalid",meaning:"Extension dependency spec invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_version_unsafe",meaning:"Extension dependency version unsafe condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-sources.ts"]},{code:"extension_install_soft_failed",meaning:"Extension install soft failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",meaning:"Extension install source contains destination condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",meaning:"Extension item field reserved condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",meaning:"Extension item field type conflict condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",meaning:"Extension item field unknown condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",meaning:"Extension mutation guard failed condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",meaning:"Extension mutation guard invalid decision condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",meaning:"Extension mutation guard invalid denial condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",meaning:"Extension mutation guard timed out condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_update_health_partial_coverage",meaning:"Extension update health partial coverage condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"field_duplicate",meaning:"Field duplicate condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"field_invalid",meaning:"Field invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"field_mcp_input_collision",meaning:"Field mcp input collision condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"github_source_entry_unbuilt",meaning:"Github source entry unbuilt condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/shared.ts"]},{code:"history_author_acknowledge_selector_required",meaning:"History author acknowledge selector required condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-history-author.ts"]},{code:"history_drift_chain_mismatch",meaning:"History drift chain mismatch condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_hash_mismatch",meaning:"History drift hash mismatch condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_missing_stream",meaning:"History drift missing stream condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_unreadable_stream",meaning:"History drift unreadable stream condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"history_merge_conflict_markers_detected",meaning:"History merge conflict markers detected condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/history/read.ts"]},{code:"history_stream_over_compact_threshold",meaning:"History stream over compact threshold condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"history_target_out_of_range",meaning:"History target out of range condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/history/projection.ts"]},{code:"history_unknown_author_events",meaning:"History unknown author events condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"init_existing_settings_requires_force",meaning:"Init existing settings requires force condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/init.ts"]},{code:"init_id_prefix_conflict",meaning:"Init id prefix conflict condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/init.ts"]},{code:"init_id_prefix_path_like",meaning:"Init id prefix path like condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/init.ts"]},{code:"integrity_history_conflict_marker",meaning:"Integrity history conflict marker condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_history_invalid_json",meaning:"Integrity history invalid json condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_history_unreadable",meaning:"Integrity history unreadable condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_ahead_format_version",meaning:"Integrity item ahead format version condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_conflict_marker",meaning:"Integrity item conflict marker condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_outdated_format_version",meaning:"Integrity item outdated format version condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_parse_failed",meaning:"Integrity item parse failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_unreadable",meaning:"Integrity item unreadable condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"invalid_argument_value",meaning:"Invalid argument value condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/context-intent-contracts.ts","sdk/lifecycle/create.ts"]},{code:"invalid_command_usage",meaning:"Invalid command usage condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"invalid_event_cursor",meaning:"Invalid event cursor condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-events.ts"]},{code:"invalid_event_follow_interval",meaning:"Invalid event follow interval condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-events.ts"]},{code:"invalid_event_limit",meaning:"Invalid event limit condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-events.ts"]},{code:"invalid_event_since",meaning:"Invalid event since condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-events.ts"]},{code:"invalid_provenance_predicate",meaning:"Invalid provenance predicate condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/history-provenance.ts"]},{code:"invalid_query_cursor",meaning:"Invalid query cursor condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/pagination.ts"]},{code:"item_document_invalid",meaning:"Item document invalid condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/item/item-format.ts"]},{code:"item_document_roundtrip_failed",meaning:"Item document roundtrip failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/item/item-format.ts"]},{code:"item_id_collision",meaning:"Item id collision condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/copy.ts"]},{code:"item_not_found",meaning:"Item not found condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"likely_duplicate",meaning:"Likely duplicate condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/similarity.ts"]},{code:"linked_test_value_not_quoted",meaning:"Linked test value not quoted condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts"]},{code:"list_source_incomplete",meaning:"List source incomplete condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/query/list.ts"]},{code:"local_package_archive_unsafe",meaning:"Local package archive unsafe condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-sources.ts"]},{code:"local_source_not_found_bare_name",meaning:"Local source not found bare name condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-sources.ts"]},{code:"lock_conflict",meaning:"Lock conflict condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/lock/lock.ts","core/telemetry/observability.ts"]},{code:"locks_stale_count",meaning:"Locks stale count condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"locks_unreadable",meaning:"Locks unreadable condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"malformed_plan_step_evidence",meaning:"Malformed plan step evidence condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/plan.ts"]},{code:"manifest_capabilities_absent",meaning:"Manifest capabilities absent condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"merge_conflict_markers_detected",meaning:"Merge conflict markers detected condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/item/item-format.ts"]},{code:"merge_git_config_unwritable",meaning:"Merge git config unwritable condition.",stability:"stable",exit_code:5,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/merge/install.ts"]},{code:"merge_root_not_found",meaning:"Merge root not found condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/merge/install.ts"]},{code:"missing_directory",meaning:"Missing directory condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"missing_lifecycle_target",meaning:"Missing lifecycle target condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension.ts"]},{code:"missing_required_argument",meaning:"Missing required argument condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","core/telemetry/observability.ts","sdk/history-redact.ts","sdk/invocation-author.ts"]},{code:"missing_required_option",meaning:"Missing required option condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/context-intent-contracts.ts","sdk/lifecycle/create.ts","sdk/lifecycle/plan.ts"]},{code:"module_import_failed",meaning:"Module import failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts"]},{code:"multi_target_github_install_ambiguous",meaning:"Multi target github install ambiguous condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-setup.ts"]},{code:"mutation_author_required",meaning:"Mutation author required condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-guard.ts"]},{code:"mutation_secret_guard_blocked",meaning:"Mutation secret guard blocked condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/mutation-guard.ts"]},{code:"no_matching_tests",meaning:"No matching tests condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/test/execution.ts"]},{code:"no_projects_matched_filters",meaning:"No projects matched filters condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/test/execution.ts"]},{code:"no_test_files_found",meaning:"No test files found condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/test/execution.ts"]},{code:"no_tests_found",meaning:"No tests found condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/test/execution.ts"]},{code:"no_update_fields",meaning:"No update fields condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"npm_package_not_found",meaning:"Npm package not found condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension/install-sources.ts"]},{code:"ownership_conflict",meaning:"Ownership conflict condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/annotations.ts"]},{code:"ownership_dependency_bypass_restricted_options",meaning:"Ownership dependency bypass restricted options condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/update.ts"]},{code:"ownership_metadata_bypass_restricted_options",meaning:"Ownership metadata bypass restricted options condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/update.ts"]},{code:"package_spec_empty",meaning:"Package spec empty condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"profile_name_empty",meaning:"Profile name empty condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"profile_name_not_normalized",meaning:"Profile name not normalized condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"profile_summary_empty",meaning:"Profile summary empty condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"profile_title_empty",meaning:"Profile title empty condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"redundant_edge",meaning:"Redundant edge condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/graph/remediation.ts"]},{code:"reindex_already_running",meaning:"Reindex already running condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/governance/reindex.ts"]},{code:"reserved_item_field",meaning:"Reserved item field condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/compose.ts"]},{code:"schema_migration_input_required",meaning:"Schema migration input required condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/migration-gates.ts"]},{code:"settings_read_fs_error",meaning:"Settings read fs error condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_json",meaning:"Settings read invalid json condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_schema",meaning:"Settings read invalid schema condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_merge_failed",meaning:"Settings read merge failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"status_duplicate",meaning:"Status duplicate condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"status_invalid",meaning:"Status invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"stdin_json_invalid",meaning:"Stdin json invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/structured-mutations.ts"]},{code:"stdin_json_unknown_key",meaning:"Stdin json unknown key condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/structured-mutations.ts"]},{code:"structured_event_immutable",meaning:"Structured event immutable condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/annotations.ts"]},{code:"structured_event_input_conflict",meaning:"Structured event input conflict condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/notes.ts"]},{code:"structured_event_json_empty",meaning:"Structured event json empty condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/notes.ts"]},{code:"structured_event_json_invalid",meaning:"Structured event json invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/notes.ts"]},{code:"structured_event_since_invalid",meaning:"Structured event since invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/notes.ts"]},{code:"telemetry_endpoint_probe_failed",meaning:"Telemetry endpoint probe failed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_endpoint_probe_http_status",meaning:"Telemetry endpoint probe http status condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_otel_export_failing",meaning:"Telemetry otel export failing condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_high_retries",meaning:"Telemetry queue high retries condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_invalid_rows",meaning:"Telemetry queue invalid rows condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_pending",meaning:"Telemetry queue pending condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_schema_version_behind",meaning:"Telemetry schema version behind condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_state_invalid_json",meaning:"Telemetry state invalid json condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"template_type_unknown",meaning:"Template type unknown condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"terminal_plan_mutation",meaning:"Terminal plan mutation condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/plan.ts"]},{code:"terminal_state_conflict",meaning:"Terminal state conflict condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/telemetry/observability.ts"]},{code:"tracked_runtime_cache_files",meaning:"Tracked runtime cache files condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"tracker_not_initialized",meaning:"Tracker not initialized condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"tracker_root_missing",meaning:"Tracker root missing condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/store/item-store.ts"]},{code:"tracker_root_not_directory",meaning:"Tracker root not directory condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/store/item-store.ts"]},{code:"type_duplicate",meaning:"Type duplicate condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"type_invalid",meaning:"Type invalid condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"unknown_command",meaning:"Unknown command condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/cli-contracts/runtime-contracts.ts"]},{code:"unknown_context_intent",meaning:"Unknown context intent condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/context-intent-contracts.ts"]},{code:"unknown_error",meaning:"Unknown error condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts"]},{code:"unknown_field",meaning:"Unknown field condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/schema.ts"]},{code:"unknown_field_projection",meaning:"Unknown field projection condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/query/get.ts","sdk/query/list.ts"]},{code:"unknown_item_type",meaning:"Unknown item type condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/schema.ts"]},{code:"unknown_lifecycle_action",meaning:"Unknown lifecycle action condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/extension.ts"]},{code:"unknown_option",meaning:"Unknown option condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"unknown_plan_template",meaning:"Unknown plan template condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/plan.ts"]},{code:"unknown_provenance_dimension",meaning:"Unknown provenance dimension condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/history-provenance.ts"]},{code:"unknown_status",meaning:"Unknown status condition.",stability:"stable",exit_code:3,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/schema.ts"]},{code:"unknown_subcommand",meaning:"Unknown subcommand condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/register-mutation.ts","cli/register-operations.ts","sdk/runtime-extended-actions.ts","sdk/telemetry.ts"]},{code:"unsupported_update_option",meaning:"Unsupported update option condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["cli/error-guidance.ts"]},{code:"validate_command_references_stale_pm_ids",meaning:"Validate command references stale pm ids condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",meaning:"Validate files missing linked paths condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",meaning:"Validate files orphaned paths condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",meaning:"Validate files tracked all strict forces pm internals condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",meaning:"Validate format version ahead items condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_outdated_items",meaning:"Validate format version outdated items condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle",meaning:"Validate hierarchy parent cycle condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",meaning:"Validate hierarchy parent cycle error condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",meaning:"Validate history drift chain mismatches condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_hash_mismatches",meaning:"Validate history drift hash mismatches condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_missing_streams",meaning:"Validate history drift missing streams condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_unreadable_streams",meaning:"Validate history drift unreadable streams condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_unknown_author_events",meaning:"Validate history unknown author events condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_closure_like_metadata",meaning:"Validate lifecycle active closure like metadata condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",meaning:"Validate lifecycle active terminal parent condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",meaning:"Validate lifecycle dependency cycles condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",meaning:"Validate lifecycle dependency cycles error condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",meaning:"Validate lifecycle stale blockers condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",meaning:"Validate merge fence drift condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",meaning:"Validate metadata custom profile missing required fields condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",meaning:"Validate metadata duplicate issue codes condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",meaning:"Validate metadata missing acceptance criteria condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",meaning:"Validate metadata missing close reason condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",meaning:"Validate metadata missing confidence condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",meaning:"Validate metadata missing estimate condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",meaning:"Validate metadata missing release condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",meaning:"Validate metadata missing reviewer condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",meaning:"Validate metadata missing risk condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",meaning:"Validate metadata missing sprint condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",meaning:"Validate resolution missing fields condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_duplicate_item_ids",meaning:"Validate storage duplicate item ids condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_history_conflict_markers",meaning:"Validate storage history conflict markers condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_resurrected_items",meaning:"Validate storage resurrected items condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_tracked_runtime_cache_files",meaning:"Validate storage tracked runtime cache files condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unparseable_config",meaning:"Validate storage unparseable config condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unparseable_history",meaning:"Validate storage unparseable history condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unreadable_items",meaning:"Validate storage unreadable items condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_embedding_identity_changed",meaning:"Vectorization embedding identity changed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_stale_items_remaining",meaning:"Vectorization stale items remaining condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/diagnostics/remediation.ts"]},{code:"workflow_duplicate_type",meaning:"Workflow duplicate type condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"workflow_status_unknown",meaning:"Workflow status unknown condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"workflow_transition_malformed",meaning:"Workflow transition malformed condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_empty",meaning:"Workflow type empty condition.",stability:"stable",exit_code:1,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_unknown",meaning:"Workflow type unknown condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/profile/profile-lint.ts"]},{code:"workspace_history_state_conflict",meaning:"Workspace history state conflict condition.",stability:"stable",exit_code:4,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["core/history/workspace-history.ts"]},{code:"workspace_root_pm_path",meaning:"Workspace root pm path condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/init.ts"]},{code:"wrong_item_type",meaning:"Wrong item type condition.",stability:"stable",exit_code:2,recovery:"Inspect the structured error guidance and retry the suggested command.",sources:["sdk/lifecycle/plan.ts"]}]);(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="3b72f4a5-9e0b-5f8e-8ee9-e45cd83d6f92")}catch{}})();var c=Object.freeze({"--body":"Set the item body.","--body-file":"Read the item body from a file.","--description":"Set the item description.","--stdin":"Read the value from stdin.","--stdin-json":"Read a complete JSON document from stdin."}),d=new Set(["--add","--body","--comment","--dep","--description","--doc","--field","--file","--learning","--note","--remove","--test","--type-option"]),a=new Set(["append","comments","create","docs","files","learnings","notes","test","update"]),u=["--allow-","--check-","--dry-run","--explain","--filter-","--full","--has-","--include-","--json","--no-","--only","--quiet","--require-","--runtime-only","--schema-only","--stream","--strict-","--summary","--today","--verbose"];function l(t,e){return e==="--stdin"||e==="--stdin-json"?["stdin"]:e.endsWith("-file")?["argv","file"]:d.has(e)&&a.has(t)?["argv","stdin"]:["argv"]}function g(t){let e=t.value_name!==void 0||t.value_type==="string"||t.value_type==="number"||t.list===!0||t.repeatable===!0,i=t.flag==="--stdin"||t.flag==="--stdin-json"||u.some(r=>t.flag.startsWith(r));return e||!i}function m(t,e){let i=g(e),r=l(t,e.flag),s=e.description??c[e.flag]??`${i?"Set":"Enable"} ${e.flag.slice(2).replaceAll("-"," ")}.`;return{...e,description:s,takes_value:i,value_required:i,...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:r,...r.includes("stdin")&&e.flag!=="--stdin"&&e.flag!=="--stdin-json"?{stdin_token:"-"}:{}}}function v(t,e){return e.map(i=>m(t,i))}export{n as a,y as b,p as c,m as d,v as e};
2
- //# sourceMappingURL=chunk-AOP2WIZZ.js.map
@@ -1,2 +0,0 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="938c39a8-6545-5d8b-b717-69138932d528")}catch{}})();var b=["commands","renderers","hooks","schema","importers","search","parser","preflight","services"],W=2,H=Object.freeze({migration:"schema",validation:"schema"}),qe=Object.freeze({version:W,capabilities:[...b],legacy_aliases:{...H}}),T=["off","warn","enforce"],N=["off","warn","enforce"],I=["none","restricted","strict"],ze=["block","warn"],w=["commands.override","commands.handler","hooks.beforecommand","hooks.beforemutation","hooks.aftercommand","hooks.onwrite","hooks.onread","hooks.onindex","schema.flags","schema.itemfields","schema.itemtypes","schema.relationshipkinds","schema.migrations","schema.profiles","parser.override","preflight.override","services.override","renderers.override","importers.importer","importers.exporter","search.provider","search.vectorstore"],x=["output_format","error_format","help_format","lock_acquire","lock_release","history_append","item_store_write","item_store_delete","context_relevance","command_result"];function R(){return{mode:"off",trust_mode:"off",require_provenance:!1,trusted_extensions:[],default_sandbox_profile:"none",allowed_extensions:[],blocked_extensions:[],allowed_capabilities:[],blocked_capabilities:[],allowed_surfaces:[],blocked_surfaces:[],allowed_commands:[],blocked_commands:[],allowed_actions:[],blocked_actions:[],allowed_services:[],blocked_services:[],extension_overrides:[]}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2a2072c1-f4a7-579e-ac11-4c75758d76d3")}catch{}})();var $=["Epic","Feature","Task","Chore","Issue","Decision","Event","Reminder","Milestone","Meeting","Plan"],We=$,He=["draft","open","in_progress","blocked","closed","canceled"],$e=["draft","active","blocked","terminal","terminal_done","terminal_canceled","default_open","default_close","default_cancel"],Je=["string","number","boolean","string_array","array","object"],Qe=["create","update","update_many","list","search","calendar","context"],Ze=["allow","warn","reject"],et=["blocks","parent","child","parent_child","child_of","related","related_to","discovered_from","blocked_by","incident_from","epic","implements","supersedes","task","verifies"],tt=["project","global"],nt=["low","medium","high","critical"],ot=["low","medium","high","critical"],rt=["low","medium","high"];var st=["minimal","default","strict","custom"],it=["none","warn","strict"],at=["progressive","strict"],ct=["off","warn","strict"],dt=["off","warn","strict"];var lt=["daily","weekly","monthly","yearly"],J=["mon","tue","wed","thu","fri","sat","sun"];function ut(e){return J.indexOf(e)}var _t=["draft","research","review","approved","executing","paused","completed","superseded"],ft=["pending","in_progress","completed","blocked","skipped","superseded"],pt=["codex","claude-code","cursor","generic"],mt=["related","blocks","blocked_by","depends_on","discovered_from","implements","verifies","supersedes"],Et=["brief","standard","deep","full"],gt=["hierarchy","activity","progress","recently_created","unparented","blockers","files","workload","staleness","tests"];(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8a44d44d-70c7-5321-b436-08aa6505a854")}catch{}})();var Q=Object.freeze([{id:"draft",roles:["draft"]},{id:"open",roles:["active","default_open"]},{id:"in_progress",aliases:["in-progress"],roles:["active"]},{id:"blocked",roles:["blocked"]},{id:"closed",roles:["terminal","terminal_done","default_close"]},{id:"canceled",aliases:["cancelled"],roles:["terminal","terminal_canceled","default_cancel"]}]),Z=Object.freeze({draft_status:"draft",open_status:"open",in_progress_status:"in_progress",blocked_status:"blocked",close_status:"closed",canceled_status:"canceled"}),ht=".agents/pm",At="settings.json";var ee=["","epics","features","tasks","chores","issues","schema","history","search","extensions","locks"],te=["decisions","events","reminders","milestones","meetings","plans"],Ot=[...ee,...te],St={Epic:"epics",Feature:"features",Task:"tasks",Chore:"chores",Issue:"issues",Decision:"decisions",Event:"events",Reminder:"reminders",Milestone:"milestones",Meeting:"meetings",Plan:"plans"},ne=["goal","objective","value","impact","outcome","why_now","parent","reviewer","risk","confidence","sprint","release","blocked_by","blocked_reason","unblock_note","reporter","severity","environment","repro_steps","resolution","expected_result","actual_result"],Tt=["id","title","description","type","pm_format_version","source_type","type_options","status","priority","tags","created_at","updated_at","deadline","reminders","events","closed_at","completed_at","assignee","claim_principal","source_owner","author","estimated_minutes","acceptance_criteria","design","external_ref","definition_of_ready","order",...ne,"affected_version","fixed_version","component","regression","customer_impact","dependencies","comments","notes","learnings","files","tests","test_runs","docs","close_reason","duplicate_of","plan_mode","plan_scope","plan_harness","plan_resume_context","plan_validation","plan_decisions","plan_discoveries","plan_steps"],oe={minimal:{ownership_enforcement:"none",create_mode_default:"progressive",close_validation_default:"off",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!1,duplicate_detection_mode:"off",duplicate_detection_threshold:.8,duplicate_detection_limit:3},default:{ownership_enforcement:"warn",create_mode_default:"progressive",close_validation_default:"warn",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"core",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3},strict:{ownership_enforcement:"strict",create_mode_default:"strict",close_validation_default:"strict",require_close_reason:!0,parent_reference:"strict_error",metadata_profile:"strict",force_required_for_stale_lock:!0,duplicate_detection_mode:"strict",duplicate_detection_threshold:.8,duplicate_detection_limit:3}},re=["no active blocker","ready for planned execution sequencing","work completed","work is closed"],h={blocked_reason:["no active blocker because work is closed","work is closed"],resolution:["closed with implementation evidence","closed with verification evidence","work completed and recorded","work is closed"],actual_result:["closed and recorded","work completed","work completed and recorded"]};function k(e){return e?[...e]:void 0}var Nt={version:1,id_prefix:"pm-",ids:{token_length:4},author_default:"",agent_identity:{probes_enabled:!0,identity_vocabulary:{version:1,aliases:{}},harness_signals:[]},mutation_guard:{require_attributed_author:!1,secret_guard:"advise",stale_in_progress_hours:72},item_format:"toon",locks:{ttl_seconds:1800,wait_ms:3e3},checkpoints:{retention_days:14},output:{default_format:"toon"},history:{missing_stream:"auto_create",compact_policy:{enabled:!1,max_entries:500,trigger:"health_warn"}},validation:{sprint_release_format:"warn",parent_reference:"warn",metadata_profile:"core",metadata_required_fields:[],lifecycle_stale_blocker_reason_patterns:[...re],lifecycle_closure_like_blocked_reason_patterns:[...h.blocked_reason],lifecycle_closure_like_resolution_patterns:[...h.resolution],lifecycle_closure_like_actual_result_patterns:[...h.actual_result],estimate_defaults_by_type:{}},governance:{preset:"minimal",...oe.minimal},workflow:{definition_of_done:[]},testing:{record_results_to_items:!1},telemetry:{enabled:!0,first_run_prompt_completed:!1,capture_level:"redacted",endpoint:"https://pm-cli.unbrained.dev/v1/events",installation_id:"",retention_days:365},agent_guidance:{prompt_completed:!1,declined:!1,declined_at:"",template_version:1,last_checked_files:[]},item_types:{definitions:[]},schema:{version:1,files:{types:"schema/types.json",statuses:"schema/statuses.json",fields:"schema/fields.json",workflows:"schema/workflows.json"},statuses:Q.map(e=>({...e,aliases:k(e.aliases),roles:k(e.roles)})),fields:[],workflow:{...Z},unknown_field_policy:"allow"},extensions:{enabled:[],disabled:[],policy:R()},search:{score_threshold:0,hybrid_semantic_weight:.7,max_results:50,embedding_model:"",embedding_batch_size:32,embedding_timeout_ms:3e4,scanner_max_batch_retries:3,provider:"",mutation_refresh_policy:"semantic_configured",query_expansion:{enabled:!1,provider:""},rerank:{enabled:!1,model:"",top_k:20}},providers:{openai:{base_url:"",api_key:"",model:""},ollama:{base_url:"",model:""}},context:{default_depth:"brief",activity_limit:10,stale_threshold_days:7,sections:{hierarchy:!0,activity:!0,progress:!0,recently_created:!0,unparented:!0,blockers:!0,files:!0,workload:!0,staleness:!0,tests:!0}},vector_store:{adapter:"",collection_name:"pm_items",qdrant:{url:"",api_key:""},lancedb:{path:""}}},It={metadata:{},body:""},E={SUCCESS:0,GENERIC_FAILURE:1,USAGE:2,NOT_FOUND:3,CONFLICT:4,DEPENDENCY_FAILED:5},wt=Object.freeze({unknown_command:"usage",unknown_option:"usage",missing_required_option:"usage",missing_required_argument:"usage",invalid_command_usage:"usage",linked_test_value_not_quoted:"usage",invalid_argument_value:"validation",health_findings:"validation",validation_findings:"validation",close_through_update:"validation",no_update_fields:"validation",unsupported_update_option:"validation",tracker_not_initialized:"validation",item_not_found:"validation",ownership_conflict:"conflict",lock_conflict:"conflict",terminal_state_conflict:"conflict",dependency_failed:"runtime",merge_git_config_unwritable:"runtime",command_failed:"runtime",unknown_error:"runtime"});(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2c9251e-86bf-5a92-acdb-581e59d269d8")}catch{}})();var l=class extends Error{exitCode;code;context;constructor(t,n,o={}){super(t),this.name="PmCliError",this.exitCode=n,this.context=o,this.code=o.code}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="15daa637-4d30-5794-bdb5-87585d443cd3")}catch{}})();var se=[...b],ie=[...x],ae=[...T],Ct=[...N],vt=[...I],ce=[...w],C=["init","config","extension","package","packages","install","upgrade","create","item","copy","focus","list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled","aggregate","context","ctx","get","graph","search","duplicates","eval","next","history","events","history-redact","history-repair","history-compact","history-author-acknowledge","merge","schema","profile","activity","restore","update","update-many","close","close-many","delete","append","comments","notes","learnings","files","docs","deps","plan","test","test-all","telemetry","stats","health","validate","gc","workspace","contracts","claim","release","start-task","pause-task","close-task","meet","event","remind","help"],Dt=["ancestors","descendants","predecessors","successors","paths","impact","analyze","audit","communities","redundancy","dominators","slack","centrality","articulation","plan","index"],de=["init","install","uninstall","explore","manage","describe","reload","doctor","catalog","adopt","adopt-all","activate","deactivate"],v={help:"Commander help rendering has no SDK operation result.",item:"The item namespace only groups lifecycle subcommands already exposed as actions.",packages:"The plural package alias only renders package-oriented help."},D=Object.freeze(C.flatMap(e=>e in v?[]:e==="extension"||e==="package"?[...de.map(t=>`${e}-${t}`),e]:[e]));function Lt(e=C,t=D,n=v){let o=new Set(t),r=new Set(e);return{missing_cli_actions:e.filter(s=>!o.has(s)&&n[s]===void 0),waived_cli_actions:e.filter(s=>!o.has(s)&&n[s]!==void 0),stale_waivers:Object.keys(n).filter(s=>!r.has(s)||o.has(s))}}function Ut(e){return D.includes(e)}function Pt(e){return se.includes(e)}function Mt(e){return ie.includes(e)}function Vt(e){return ae.includes(e)}function jt(e){return ce.includes(e)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="64c4e6e1-d7c4-50e0-a444-fb2fa3c65443")}catch{}})();var le=8,ue=64;function L(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function _e(e){let t=e.row_contract;return L(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function A(e,t){return typeof e=="string"?e.length<=240?e:(t.compacted=!0,`${e.slice(0,240)}\u2026`):Array.isArray(e)?e.map(n=>A(n,t)):L(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>[n,A(o,t)])):e}function p(e,t){let n=t.estimated_tokens;for(let o=0;o<le;o+=1){t.estimated_tokens=n;let r=Math.ceil(Buffer.byteLength(JSON.stringify(e),"utf8")/4);if(r===n)return;n=r}t.estimated_tokens=n}function fe(e,t,n){let o=_e(e);for(let r=0;r<ue;r+=1){if(p(e,t),t.estimated_tokens<=n)return;let s=o.map(i=>({key:i,rows:Array.isArray(e[i])?e[i]:[]})).filter(({rows:i})=>i.length>1).sort((i,c)=>c.rows.length-i.rows.length||i.key.localeCompare(c.key))[0];if(!s)return;s.rows.splice(-Math.max(1,Math.ceil(s.rows.length/2))),t.rows_compacted=!0,e.has_more=!0,e.truncated=!0,typeof e.count=="number"&&(e.count=o.reduce((i,c)=>i+(Array.isArray(e[c])?e[c].length:0),0))}}function U(e,t,n){let o={compacted:!1},r=A(e,o);return t.strings_compacted=o.compacted,r.read_output=t,fe(r,t,n),p(r,t),r}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="27431a6b-6f2e-5020-b4f1-b94cfa8a1c26")}catch{}})();var u=["include","amount","cost","encoding"],F=["list","context","search","get","next","health","deps","graph","history","activity","validate","events","contracts","comments","notes","files","docs","stats","aggregate"],K=["canonical","legacy","intent","default"],S={include:"--output-include",amount:"--output-limit",cost:"--output-budget",encoding:"--output-format"},qt=Object.freeze(u.map(e=>S[e])),pe={list:{include:["--brief","--compact","--fields","--full"],amount:["--after","--limit","--no-truncate"],cost:["--token-budget"],encoding:["--format","--stream"]},context:{include:["--fields","--section"],amount:["--after","--depth","--limit"],cost:["--token-budget"],encoding:["--format"]},search:{include:["--compact","--fields","--full"],amount:["--after","--limit"],cost:["--token-budget"],encoding:["--format"]},get:{include:["--fields","--full"],amount:["--depth"],cost:["--token-budget"],encoding:["--format"]},next:{amount:["--blocked-limit","--limit"],cost:["--token-budget"],encoding:["--format"]},health:{include:["--brief","--check-only","--full","--summary","--verbose"]},deps:{include:["--collapse","--full","--summary"],amount:["--edge-limit","--max-depth","--node-limit"],cost:["--token-budget"],encoding:["--format"]},graph:{include:["--full","--summary"],amount:["--after","--limit","--max-depth","--max-paths"]},history:{include:["--compact","--full"],amount:["--limit"],encoding:["--format"]},activity:{include:["--compact","--full"],amount:["--limit","--unbounded"],encoding:["--stream"]},validate:{include:["--counts","--full","--verbose"]},events:{include:["--full"],amount:["--limit"],encoding:["--follow"]},contracts:{include:["--full","--summary"]},comments:{amount:["--limit"]},notes:{amount:["--limit"]},files:{amount:["--limit","--no-truncate","--offset"]},docs:{},stats:{},aggregate:{}},me=new Set(["--fields","--section"]),Ee=Object.freeze({"--after":"--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.","--check-only":"--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.","--depth":"--depth retains traversal or detail-depth semantics; --output-limit does not replace it.","--follow":"--follow retains event-tail semantics; --output-format does not enable following.","--max-depth":"--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.","--max-paths":"--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.","--offset":"--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.","--stream":"--stream retains command streaming semantics; --output-format selects only static result encoding."});function Y(e){return e.slice(2).replaceAll("-","_")}function ge(e,t){let n=Ee[e];if(n!==void 0)return n;let o=t==="include"?me.has(e)?"<csv>":Y(e):t==="amount"?"<n>":t==="cost"?"<tokens>":"<toon|json>";return`${e} is a compatibility alias; prefer ${S[t]} ${o}.`}function ye(e){let t=pe[e],n=Object.freeze(Object.fromEntries(u.map(o=>[o,Object.freeze({dimension:o,canonical_option:S[o],applicable:!0,inapplicable_reason:null,legacy_aliases:Object.freeze((t[o]??[]).map(r=>Object.freeze({flag:r,migration_hint:ge(r,o),visibility:"hidden_alias"})))})])));return Object.freeze({command:e,dimensions:n,precedence:K})}var be=Object.freeze(F.map(ye)),he=new Map(be.map(e=>[e.command,e]));function X(e){let t=e.trim().toLowerCase().split(/\s+/u)[0],n=t.startsWith("list-")?"list":t==="ctx"?"context":t;return F.includes(n)?n:void 0}var Ae=["outputInclude","output_include","outputLimit","output_limit","outputBudget","output_budget","outputFormat","output_format"],Oe={comments:["add","body","stdin","file","edit","delete"],notes:["add","addJson","stdin","file","edit","delete"],files:["add","addGlob","remove","migrate","apply","note"],docs:["add","addGlob","remove","migrate","note"]};function Se(e){return Ae.some(t=>e[t]!==void 0)}var Te=[{keys:["outputInclude","output_include"],valid:e=>O(e)!==void 0,message:"--output-include requires at least one comma-separated field or section."},{keys:["outputLimit","output_limit"],valid:e=>e==="unbounded"||_(e)!==void 0,message:"--output-limit must be a positive integer or unbounded."},{keys:["outputBudget","output_budget"],valid:e=>_(e)!==void 0,message:"--output-budget must be a positive integer."},{keys:["outputFormat","output_format"],valid:e=>e==="toon"||e==="json",message:"--output-format must be toon or json."}];function zt(e,t){if(!Se(t))return;let n=X(e);if(!n)throw new l(`Universal output controls apply only to read commands; ${e||"this command"} is not a read surface.`,E.USAGE);if((Oe[n]??[]).some(o=>t[o]!==void 0&&t[o]!==!1))throw new l(`Universal output controls cannot be combined with a ${n} mutation.`,E.USAGE);for(let o of Te){let r=o.keys.map(s=>t[s]).find(s=>s!==void 0);if(r!==void 0&&!o.valid(r))throw new l(o.message,E.USAGE)}}function Ne(e){return e.slice(2).replace(/-([a-z])/gu,(t,n)=>n.toUpperCase())}function Ie(e,t){let n=Ne(t);if(Object.hasOwn(e,n))return e[n];let o=t.slice(2).replaceAll("-","_");if(Object.hasOwn(e,o))return e[o];if(t==="--no-truncate"&&e.truncate===!1)return!0}function we(e){return e!==void 0&&e!==!1&&e!==null}function O(e){let n=(Array.isArray(e)?e:[e]).flatMap(o=>typeof o=="string"?o.split(","):[]).map(o=>o.trim()).filter(Boolean);return n.length>0?[...new Set(n)]:void 0}function _(e){let t=typeof e=="number"?e:typeof e=="string"&&/^\d+$/u.test(e.trim())?Number(e):Number.NaN;return Number.isSafeInteger(t)&&t>0?t:void 0}function xe(e,t,n){for(let o of e.legacy_aliases){let r=Ie(t,o.flag),s={value:r,flag:o.flag};if(we(r)&&n(s))return s}}function P(e,t){let n=O(e);if(n)return{source:"canonical",value:n};if(t)return{source:"legacy",value:O(t.value)??[Y(t.flag)]}}function M(e,t){if(e==="unbounded")return{source:"canonical",value:"unbounded"};let n=_(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;if(t.flag==="--no-truncate"||t.flag==="--unbounded")return{source:"legacy",value:"unbounded"};let o=_(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function V(e,t){let n=_(e);if(n!==void 0)return{source:"canonical",value:n};if(!t)return;let o=_(t.value);return o===void 0?void 0:{source:"legacy",value:o}}function j(e,t){if(e==="json"||e==="toon")return{source:"canonical",value:e};if(t)return t.flag==="--stream"||t.flag==="--follow"?{source:"legacy",value:"stream"}:t.value==="json"||t.value==="toon"?{source:"legacy",value:t.value}:void 0}function B(e,t){let n=X(e);if(!n)return;let o=he.get(n),r={include:a=>P(void 0,a),amount:a=>M(void 0,a),cost:a=>V(void 0,a),encoding:a=>j(void 0,a)},s=Object.fromEntries(u.map(a=>[a,xe(o.dimensions[a],t,d=>r[a](d)!==void 0)])),i=u.flatMap(a=>{let d=s[a];return d?[d.flag]:[]}),c=u.flatMap(a=>{let d=s[a];return d?[o.dimensions[a].legacy_aliases.find(G=>G.flag===d.flag).migration_hint]:[]});return{command:n,include:P(t.outputInclude??t.output_include,s.include),amount:M(t.outputLimit??t.output_limit,s.amount),cost:V(t.outputBudget??t.output_budget,s.cost),encoding:j(t.outputFormat??t.output_format,s.encoding),legacy_aliases_used:i,migration_hints:c,precedence:K}}function g(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}var Re=new Set(["applied_bound","applied_limit","completeness","continuation_contract","count","filters","has_more","next_cursor","now","omission_receipt","projection","row_contract","sorting","total","truncated"]);function q(e){let t=e.row_contract;return g(t)&&Array.isArray(t.row_keys)?t.row_keys.filter(n=>typeof n=="string"):Object.entries(e).filter(([,n])=>Array.isArray(n)).map(([n])=>n)}function ke(e,t){let n=new Set(t.map(o=>o.split(".")[0]));return Object.fromEntries(Object.entries(e).filter(([o])=>n.has(o)))}function Ce(e,t){let n=q(e),o=t.some(r=>Object.hasOwn(e,r.split(".")[0]));return n.length>0&&!o?Object.fromEntries(Object.entries(e).map(([r,s])=>[r,n.includes(r)&&Array.isArray(s)?s.map(i=>g(i)?ke(i,t):i):s])):Object.fromEntries(Object.entries(e).filter(([r])=>t.some(s=>s.split(".")[0]===r)||Re.has(r)))}function ve(e,t){if(t==="unbounded")return e;let n=!1,o=q(e),r=new Set(o),s=Object.fromEntries(Object.entries(e).map(([i,c])=>!r.has(i)||!Array.isArray(c)||c.length<=t?[i,c]:(n=!0,[i,c.slice(0,t)])));return n&&(s.has_more=!0,s.truncated=!0,typeof s.count=="number"&&(s.count=o.reduce((i,c)=>i+(Array.isArray(s[c])?s[c].length:0),0)),s.applied_bound={kind:"output_limit",source:"explicit",value:t}),s}function De(e){return u.filter(t=>e[t]!==void 0)}function Gt(e,t,n){let o=B(e,t);if(!o)return n;let r=De(o);if(r.filter(d=>o[d]?.source==="canonical").length===0)return n;let i={...n};o.include?.source==="canonical"&&(i=Ce(i,o.include.value)),o.amount?.source==="canonical"&&(i=ve(i,o.amount.value));let c={contract_version:1,command:o.command,requested_dimensions:r,precedence:o.precedence,legacy_aliases_used:o.legacy_aliases_used,migration_hints:o.migration_hints,estimated_tokens:0,within_budget:!0,strings_compacted:!1,rows_compacted:!1,result_omitted:!1};i.read_output=c,p(i,c);let a=o.cost?.source==="canonical"?o.cost.value:void 0;if(a!==void 0&&c.estimated_tokens>a&&(i=U(i,c,a)),a!==void 0&&c.estimated_tokens>a){let d={contract_version:1,command:o.command,requested_dimensions:r,precedence:o.precedence,legacy_aliases_used:[],migration_hints:[],estimated_tokens:0,within_budget:!1,strings_compacted:!1,rows_compacted:!1,result_omitted:!0},f={output_budget_exceeded:{omitted_result:!0,reason:"requested_budget_infeasible",restore_with:"Increase --output-budget or narrow the read."},read_output:d};return p(f,d),f}return i}function Wt(e){return g(e)&&g(e.output_budget_exceeded)&&e.output_budget_exceeded.omitted_result===!0&&e.output_budget_exceeded.reason==="requested_budget_infeasible"}function Ht(e,t){let n=B(e,t)?.encoding;return n?.value==="json"||n?.value==="toon"?n.value:void 0}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f6e82c93-54e8-53a7-94df-10a573aae933")}catch{}})();(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="875ac35b-c6ce-5690-a05a-8e4d279a49bf")}catch{}})();var Le=Object.freeze([{flag:"--json"},{flag:"--lean"},{flag:"--token-accounting"},{flag:"--output-include",value_name:"fields"},{flag:"--output-limit",value_name:"count"},{flag:"--output-budget",value_name:"tokens"},{flag:"--output-format",value_name:"toon|json"},{flag:"--quiet"},{flag:"--no-changed-fields"},{flag:"--full-changed-fields"},{flag:"--id-only"},{flag:"--pm-path",aliases:["--path"]},{flag:"--no-extensions"},{flag:"--no-pager"},{flag:"--profile"},{flag:"--help"},{flag:"--author",value_name:"id"}]),Zt=new Set(Le.flatMap(e=>[e.flag,...e.aliases??[]]));import Ue from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83232698-197a-5aef-be7c-aa37f3c56822")}catch{}})();function Pe(e){if(e===null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e;if(typeof e=="bigint")return e.toString();if(e===void 0)return"undefined";if(typeof e=="symbol")return e.toString();if(typeof e=="function")return`[function:${e.name||"anonymous"}]`}function Me(e){let t=Object.keys(e).sort(),n={};for(let o of t){let r=e[o];r!==void 0&&(n[o]=y(r))}return n}function y(e){let t=Pe(e);if(t!==void 0)return t;if(Array.isArray(e))return e.map(o=>y(o));if(e instanceof Date)return e.toISOString();let n=e;if(typeof n.toJSON=="function"){let o=n.toJSON();if(o!==e)return y(o)}return Me(e)}function nn(e){return JSON.stringify(y(e))}function z(e,t,n,o){for(let r=0;r<t.length;r+=1)if(!n.has(r)&&o(e,t[r]))return n.add(r),!0;return!1}function Ve(e,t){if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.toString()===t.toString()}function je(e,t){if(e instanceof Date||t instanceof Date)return e instanceof Date&&t instanceof Date&&e.getTime()===t.getTime()}function Fe(e,t){if(!(e instanceof Set||t instanceof Set))return;if(!(e instanceof Set&&t instanceof Set)||e.size!==t.size)return!1;let n=[...t],o=new Set;for(let r of e)if(!z(r,n,o,m))return!1;return!0}function Ke(e,t){if(!(e instanceof Map||t instanceof Map))return;if(!(e instanceof Map&&t instanceof Map)||e.size!==t.size)return!1;let n=[...t.entries()],o=new Set;for(let[r,s]of e.entries())if(!z([r,s],n,o,([c,a],[d,f])=>m(c,d)&&m(a,f)))return!1;return!0}function Ye(e,t){if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((n,o)=>m(n,t[o]))}function Xe(e,t){let n=Object.keys(e).sort((r,s)=>r.localeCompare(s)),o=Object.keys(t).sort((r,s)=>r.localeCompare(s));if(n.length!==o.length)return!1;for(let r=0;r<n.length;r+=1){let s=n[r];if(s!==o[r]||!m(e[s],t[s]))return!1}return!0}var Be=[Ve,je,Fe,Ke,Ye];function m(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;for(let n of Be){let o=n(e,t);if(o!==void 0)return o}return Xe(e,t)}function on(e){return Ue.createHash("sha256").update(e,"utf8").digest("hex")}function rn(e,t){let n={};for(let r of t){let s=e[r];s!==void 0&&(n[r]=s)}let o=Object.keys(e).filter(r=>!t.includes(r)).sort((r,s)=>r.localeCompare(s));for(let r of o){let s=e[r];s!==void 0&&(n[r]=s)}return n}export{b as a,W as b,H as c,qe as d,T as e,N as f,I as g,ze as h,w as i,x as j,R as k,$ as l,We as m,He as n,$e as o,Je as p,Qe as q,Ze as r,et as s,tt as t,nt as u,ot as v,rt as w,st as x,it as y,at as z,ct as A,dt as B,lt as C,J as D,ut as E,_t as F,ft as G,pt as H,mt as I,Et as J,gt as K,Q as L,Z as M,ht as N,At as O,ee as P,Ot as Q,St as R,Tt as S,oe as T,re as U,h as V,Nt as W,It as X,E as Y,l as Z,Le as _,Zt as $,nn as aa,m as ba,on as ca,rn as da,se as ea,ie as fa,ae as ga,Ct as ha,vt as ia,ce as ja,C as ka,Dt as la,de as ma,v as na,D as oa,Lt as pa,Ut as qa,Pt as ra,Mt as sa,Vt as ta,jt as ua,u as va,F as wa,qt as xa,be as ya,X as za,zt as Aa,B as Ba,Gt as Ca,Wt as Da,Ht as Ea};
2
- //# sourceMappingURL=chunk-CL75YW32.js.map
@@ -1,8 +0,0 @@
1
- import{c as ut,d as A,f as lt,h as ie}from"./chunk-I5F5UK3Q.js";import{$a as ct,Ka as se,P as ne,aa as F,ab as dt,cb as re,ja as De,k as te}from"./chunk-5MTKO7TV.js";import{D as W,J as H,Ka as Y,M as J,aa as k,da as X,p as K,q as $,r as P,t as st}from"./chunk-QM2BIVK7.js";import{f as Q,g as Z,i as Re,k as L,l as ee,m as rt,n as it,o as ot,p as at}from"./chunk-6GIZK7VQ.js";import{Y as y,Z as w,aa as j,la as Se}from"./chunk-CL75YW32.js";import{constants as G}from"node:fs";import{lstat as ft,mkdir as Le,open as ht}from"node:fs/promises";import T from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c53bb1b7-12b9-5370-a85b-cdd8bef57936")}catch{}})();function Ce(e,t){if(typeof e!="string"||e.trim().length===0)throw new TypeError(`Relationship event ${t} must be non-empty`);return e.trim()}function Ae(e,t){let n=t.require(e.kind),s=n.direction==="undirected"?[e.source,e.target].sort().join("\0"):`${e.source}\0${e.target}`;return`${n.kind}\0${s}`}function yn(e){return Object.freeze({...e,...e.payload===void 0?{}:{payload:Object.freeze(structuredClone(e.payload))}})}function wn(e,t,n,s){let r=n.require(e.kind),i=s.outgoingOne.get(`${r.kind}\0${e.source}`);if(i!==void 0&&i!==t)throw new TypeError(`Relationship outgoing cardinality exceeded for ${r.kind}`);let o=s.incomingOne.get(`${r.kind}\0${e.target}`);if(o!==void 0&&o!==t)throw new TypeError(`Relationship incoming cardinality exceeded for ${r.kind}`);let a=Ae(e,n),c=s.identities.get(a);if(c!==void 0&&c!==t)throw new TypeError(`Relationship edge already active: ${a}`)}function bn(e){let t=new Map;for(let n of e)n.action==="remove"?t.delete(n.relationshipId):t.set(n.relationshipId,n.edge);return t}function _n(e,t,n){if(e.expectedVersion!==void 0&&e.expectedVersion!==t)throw new TypeError(`Relationship event version conflict: expected ${e.expectedVersion}, current ${t}`);let s=Ce(e.eventId,"eventId");if(n.has(s))throw new TypeError(`Relationship event already exists: ${s}`);if(e.action!=="add"&&e.action!=="remove"&&e.action!=="supersede")throw new TypeError(`Unknown relationship event action: ${e.action}`);if(!Number.isFinite(Date.parse(e.timestamp)))throw new TypeError("Relationship event timestamp must be valid");return{eventId:s,relationshipId:Ce(e.relationshipId,"relationshipId"),author:Ce(e.author,"author"),timestamp:new Date(e.timestamp).toISOString()}}function vn(e,t,n,s,r,i){let o=n.has(t);if(e.action==="add"&&o)throw new TypeError(`Relationship is already active: ${t}`);if(e.action!=="add"&&!o)throw new TypeError(`Relationship is not active: ${t}`);if(e.action==="remove")return;if(!e.edge)throw new TypeError(`Relationship ${e.action} event requires an edge`);let a=typeof e.edge.source=="string"?e.edge.source.trim():"",c=typeof e.edge.target=="string"?e.edge.target.trim():"";if(!s.has(a)||!s.has(c))throw new TypeError(`Relationship endpoint not found: ${a} -> ${c}`);let d=new X([a,c],[e.edge],r).edges()[0];return wn(d,t,r,i),yn(d)}var Ne=class{#e;#n;#s=[];#i=new Set;#t=new Map;#r={identities:new Map,outgoingOne:new Map,incomingOne:new Map};constructor(t,n={}){this.#e=new Set([...t].filter(s=>typeof s=="string").map(s=>s.trim()).filter(Boolean)),this.#n=n.registry??k()}get version(){return this.#s.length}events(){return Object.freeze([...this.#s])}*stream(t={}){let n=t.fromVersion??1,s=t.toVersion??this.version,r=t.batchSize??100;if(!Number.isInteger(n)||n<1)throw new TypeError("Relationship event stream fromVersion must be positive");if(!Number.isInteger(s)||s<0||s>this.version)throw new TypeError(`Relationship event stream toVersion out of range: ${s}`);if(!Number.isInteger(r)||r<1)throw new TypeError("Relationship event stream batchSize must be positive");if(n>s+1)throw new TypeError("Relationship event stream fromVersion exceeds the selected prefix");for(let i=n-1;i<s;i+=r)yield Object.freeze(this.#s.slice(i,Math.min(i+r,s)))}project(t,n,s={}){if(typeof n!="function")throw new TypeError("Relationship event projection requires a reducer");let r=t,i=0,o;for(let a of this.stream({...s,batchSize:256}))for(let c of a)r=n(r,c),i+=1,o=c;return Object.freeze({state:r,version:o?.sequence??Math.max(0,(s.fromVersion??1)-1),processed:i,...o===void 0?{}:{asOf:o.timestamp}})}#o(t,n){let s=this.#n.require(n.kind);this.#r.identities.set(Ae(n,this.#n),t),s.outgoing==="one"&&this.#r.outgoingOne.set(`${s.kind}\0${n.source}`,t),s.incoming==="one"&&this.#r.incomingOne.set(`${s.kind}\0${n.target}`,t)}#a(t){let n=this.#n.require(t.kind);this.#r.identities.delete(Ae(t,this.#n)),n.outgoing==="one"&&this.#r.outgoingOne.delete(`${n.kind}\0${t.source}`),n.incoming==="one"&&this.#r.incomingOne.delete(`${n.kind}\0${t.target}`)}append(t){let n=_n(t,this.version,this.#i),s=this.#t.get(n.relationshipId),r=vn(t,n.relationshipId,this.#t,this.#e,this.#n,this.#r),i=Object.freeze({eventId:n.eventId,relationshipId:n.relationshipId,action:t.action,...r===void 0?{}:{edge:r},author:n.author,timestamp:n.timestamp,...t.reason?.trim()?{reason:t.reason.trim()}:{},sequence:this.version+1});return this.#s.push(i),this.#i.add(n.eventId),s&&this.#a(s),t.action==="remove"?this.#t.delete(n.relationshipId):(this.#t.set(n.relationshipId,r),this.#o(n.relationshipId,r)),i}snapshot(t={}){if(t.atVersion!==void 0&&t.atTimestamp!==void 0)throw new TypeError("Relationship snapshot accepts one target");let n;if(t.atTimestamp!==void 0){let i=Date.parse(t.atTimestamp);if(!Number.isFinite(i))throw new TypeError("Relationship snapshot timestamp must be valid");n=this.#s.filter(o=>Date.parse(o.timestamp)<=i)}else{let i=t.atVersion??this.version;if(!Number.isInteger(i)||i<0||i>this.version)throw new TypeError(`Relationship snapshot version out of range: ${i}`);n=this.#s.slice(0,i)}let s=bn(n),r=new X(this.#e,s.values(),this.#n);return Object.freeze({version:n.at(-1)?.sequence??0,...n.at(-1)?{asOf:n.at(-1).timestamp}:{},edges:r.edges(),graph:r})}page(t){if(!Number.isInteger(t.limit)||t.limit<1)throw new TypeError("Relationship event page limit must be positive");let n=L("relationship-events",{order:"append-sequence"}),s=t.cursor===void 0?this.version:Number(rt(t.cursor,n).snapshot);if(!Number.isSafeInteger(s)||s<0||s>this.version)throw new TypeError("Relationship event cursor snapshot version is invalid");let r=at(this.#s.slice(0,s),{cursor:t.cursor,fingerprint:n,limit:t.limit,readId:i=>i.eventId,snapshot:String(s)});return{version:s,events:r.rows,hasMore:r.has_more,...r.next_cursor?{nextCursor:r.next_cursor}:{}}}},kn="relationship-event-store",gt=G.O_NOFOLLOW;function oe(e){return ne(e,kn,30,`relationship-store:${process.pid}`,!1,!1,3e3)}async function D(e,t="relationships/events.jsonl"){let n=T.resolve(e),s=T.resolve(n,t),r=T.relative(n,s);if(r.length===0)throw new TypeError("Relationship event path must name a file within the tracker root");if(r===".."||r.startsWith(`..${T.sep}`)||T.isAbsolute(r))throw new TypeError("Relationship event path must stay within the tracker root");if(await Le(n,{recursive:!0}),(await ft(n)).isSymbolicLink())throw new TypeError("Relationship event tracker root must not be a symbolic link");let o=n;for(let a of r.split(T.sep)){o=T.join(o,a);try{if((await ft(o)).isSymbolicLink())throw new TypeError("Relationship event path must not contain symbolic links")}catch(c){if(c.code==="ENOENT")break;throw c}}return s}async function ae(e,t,n){let s=new Ne(t,{registry:n}),r,i;try{i=await ht(e,G.O_RDONLY|gt),r=await i.readFile("utf8")}catch(a){if(a.code==="ENOENT")return{log:s,raw:""};throw a}finally{await i?.close()}let o=r.split(`
2
- `);for(let a=0;a<o.length;a+=1){let c=o[a].trim();if(!c)continue;let d;try{d=JSON.parse(c)}catch{throw new TypeError(`Invalid relationship event JSONL at line ${a+1}`)}if(d.sequence!==s.version+1)throw new TypeError(`Invalid relationship event sequence at line ${a+1}`);s.append({eventId:d.eventId,relationshipId:d.relationshipId,action:d.action,...d.edge===void 0?{}:{edge:d.edge},author:d.author,timestamp:d.timestamp,...d.reason===void 0?{}:{reason:d.reason},expectedVersion:s.version})}return{log:s,raw:r}}function xn(e,t,n,s){let r=Date.parse(t.timestamp),i;return t.action!=="remove"&&t.edge!==void 0&&(i=new X(n,[t.edge],s).edges()[0]),e.eventId===t.eventId.trim()&&e.relationshipId===t.relationshipId.trim()&&e.action===t.action&&e.author===t.author.trim()&&Number.isFinite(r)&&e.timestamp===new Date(r).toISOString()&&e.reason===(t.reason?.trim()||void 0)&&j(e.edge)===j(i)}var pt=class e{#e;#n;#s;#i;#t;constructor(t,n,s,r){this.#e=t.pmRoot,this.#n=n,this.#s=t.registry,this.#i=s,this.#t=r}static async open(t){let n=Object.freeze([...t.nodes]),s=await D(t.pmRoot,t.relativePath),r=await oe(t.pmRoot);try{await D(t.pmRoot,s);let{log:i}=await ae(s,n,t.registry);return new e(t,n,s,i)}finally{await r()}}get path(){return this.#i}async currentVersion(){return this.#t=await this.#r(),this.#t.version}async append(t){let n=await oe(this.#e);try{let s=await D(this.#e,this.#i),{log:r}=await ae(s,this.#n,this.#s),i=r.append(t);await Le(T.dirname(s),{recursive:!0}),await D(this.#e,s);let o=await ht(s,G.O_APPEND|G.O_CREAT|G.O_WRONLY|gt);try{await o.appendFile(`${JSON.stringify(i)}
3
- `,"utf8")}finally{await o.close()}return this.#t=r,i}finally{await n()}}async appendBatch(t,n={}){let s=await oe(this.#e);try{let r=await D(this.#e,this.#i),{log:i,raw:o}=await ae(r,this.#n,this.#s),a=i.version,c=new Map(i.events().map(l=>[l.eventId,l])),d=[],u=[];for(let l of t){let f=l.eventId.trim(),p=c.get(f);if(p!==void 0){if(n.existingEventPolicy==="skip_identical"&&xn(p,l,this.#n,this.#s)){u.push(p.eventId);continue}if(n.existingEventPolicy==="skip_identical")throw new TypeError(`Relationship event id collision with different content: ${f}`)}let h=i.append(l);c.set(h.eventId,h),d.push(h)}if(d.length>0){let l=o.length===0||o.endsWith(`
4
- `)?o:`${o}
5
- `;await Le(T.dirname(r),{recursive:!0}),await D(this.#e,r),await P(r,`${l}${d.map(f=>JSON.stringify(f)).join(`
6
- `)}
7
- `)}return this.#t=i,Object.freeze({version_before:a,version_after:i.version,appended:Object.freeze(d),skipped_event_ids:Object.freeze(u)})}finally{await s()}}async snapshot(t={}){return this.#t=await this.#r(),this.#t.snapshot(t)}async page(t){return this.#t=await this.#r(),this.#t.page(t)}async*stream(t={}){this.#t=await this.#r(),yield*this.#t.stream(t)}async project(t,n,s={}){return this.#t=await this.#r(),this.#t.project(t,n,s)}async#r(){let t=await oe(this.#e);try{let n=await D(this.#e,this.#i);return(await ae(n,this.#n,this.#s)).log}finally{await t()}}};(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3a33af50-3d2c-57bb-884a-4d5394599ba2")}catch{}})();function En(e,t,n,s,r,i){if(e.seen.has(t))return"skip";if(e.cursorFound&&e.affected.length>=i)return"truncate";e.seen.add(t),e.parents.set(t,n.id);let o=n.depth+1;return e.queue.push({id:t,depth:o}),e.cursorFound?(e.affected.push({id:t,distance:o,path:An(s,t,e.parents)}),"continue"):(e.cursorFound=t===r,"skip")}function In(e,t,n,s){let r=L("graph impact",{root:e,direction:n,kinds:[...t.kinds??[]].sort(),max_depth:Number.isFinite(s)?s:"unbounded"});return{fingerprint:r,after:t.after===void 0?void 0:it(t.after,r)}}function q(e,t,n){e.get(t).add(n)}function de(e){return new Map(e.map(t=>[t,new Set]))}function yt(e){for(let t of e)t.sort();return e.sort((t,n)=>n.length-t.length||t[0].localeCompare(n[0]))}function ce(e){if(Array.isArray(e))return e.map(n=>ce(n));if(e===null||typeof e!="object")return e;let t=e.toJSON;return typeof t=="function"?ce(t.call(e)):Object.fromEntries(Object.entries(e).sort(([n],[s])=>n.localeCompare(s)).map(([n,s])=>[n,ce(s)]))}function mt(e){return JSON.stringify(ce(e))}function Tn(e,t,n,s){let r=[{id:e,expanded:!1}];for(;r.length>0;){let i=r.pop();if(i.expanded){s.push(i.id);continue}if(n.has(i.id))continue;n.add(i.id),r.push({id:i.id,expanded:!0});let o=[...t.get(i.id)].sort().reverse();for(let a of o)n.has(a)||r.push({id:a,expanded:!1})}}function Sn(e,t){let n=new Set,s=[];for(let r of e)n.has(r)||Tn(r,t,n,s);return s}function Rn(e,t){let n=new Set,s=[];for(let r of[...e].reverse()){if(n.has(r))continue;let i=[],o=[r];for(n.add(r);o.length>0;){let a=o.pop();i.push(a);for(let c of t.get(a))n.has(c)||(n.add(c),o.push(c))}s.push(i)}return yt(s)}function wt(e,t){let n=de(e);for(let[s,r]of t)for(let i of r)q(n,i,s);return Rn(Sn(e,t),n)}function Dn(e,t){let n=de(e.nodes());for(let s of e.edges()){let r=t.require(s.kind);if(!r.ordering)continue;let i=(r.precedence??"source_before_target")==="source_before_target";q(n,i?s.source:s.target,i?s.target:s.source)}return n}function Cn(e,t){let n=new Map(e.map(i=>[i,0]));for(let i of t.values())for(let o of i)n.set(o,n.get(o)+1);let s=e.filter(i=>n.get(i)===0).sort(),r=[];for(;s.length>0;){r.push(s);let i=[];for(let o of s)for(let a of t.get(o)){let c=n.get(a)-1;n.set(a,c),c===0&&i.push(a)}s=i.sort()}return r}function Ln(e,t){let n=new Map(e.map(o=>[o,0])),s=new Map;for(let o of e)for(let a of t.get(o)){if(!n.has(a))continue;let c=n.get(o)+1,d=s.get(a);(c>n.get(a)||c===n.get(a)&&(d===void 0||o.localeCompare(d)<0))&&(n.set(a,c),s.set(a,o))}let r=[...e].sort((o,a)=>n.get(a)-n.get(o)||o.localeCompare(a))[0],i=r===void 0?[]:[r];for(;i[0]!==void 0&&s.has(i[0]);)i.unshift(s.get(i[0]));return{depth:Object.fromEntries(n),path:i}}function An(e,t,n){let s=[t],r=t;for(;r!==e;)r=n.get(r),s.push(r);return s.reverse()}function ue(e,t={}){let n=t.registry??k(),s=[...e.nodes()],r=Dn(e,n),i=Cn(s,r),o=i.flat(),a=o.length===s.length,c=a?[]:wt(s,r).filter(u=>u.length>1||r.get(u[0]).has(u[0])),d=Ln(o,r);return{exact:!0,acyclic:a,order:o,layers:i,frontier:i[0]??[],depth:d.depth,criticalPath:d.path,criticalPathLength:Math.max(0,d.path.length-1),cycles:c,provenance:{algorithm:"kahn-longest-path",edgeFamily:"ordering"}}}function bt(e,t,n={}){let s=n.direction??"outgoing",r=n.maxDepth??Number.POSITIVE_INFINITY,i=n.limit??Number.POSITIVE_INFINITY,{fingerprint:o,after:a}=In(t,n,s,r),c={queue:[{id:t,depth:0}],seen:new Set([t]),parents:new Map,affected:[],cursorFound:a===void 0||a===t},d=0,u=0,l=!1,f=!1;e:for(let p=0;p<c.queue.length;p+=1){n.signal?.throwIfAborted();let h=c.queue[p];d+=1;let g=e.adjacency(h.id,{direction:s,kinds:n.kinds,signal:n.signal});if(u+=g.meta.inspectedEdges,h.depth>=r){g.value.some(m=>!c.seen.has(m))&&(l=!0);continue}for(let m of g.value)if(En(c,m,h,t,a,i)==="truncate"){l=!0,f=!0;break e}}if(!c.cursorFound)throw new TypeError(`Unknown impact cursor item: ${a}`);return{root:t,affected:c.affected,exact:!0,truncated:l,...f?{nextCursor:ee(o,c.affected.at(-1)?.id??t)}:{},cost:{visitedNodes:d,inspectedEdges:u}}}function _t(e){let t=[...e.nodes()],n=de(t),s=de(t);for(let c of e.edges())q(n,c.source,c.target),q(n,c.target,c.source),q(s,c.source,c.target);let r=[],i=new Set;for(let c of t){if(i.has(c))continue;let d=[],u=[c];for(i.add(c);u.length>0;){let l=u.pop();d.push(l);for(let f of n.get(l))i.has(f)||(i.add(f),u.push(f))}r.push(d)}let o=t.map(c=>({id:c,degree:n.get(c).size})),a=Math.max(0,...o.map(({degree:c})=>c));return{components:yt(r),stronglyConnected:wt(t,s),orphans:o.filter(({degree:c})=>c===0).map(({id:c})=>c),hubs:o.filter(({degree:c})=>c>0&&c===a),exact:!0,provenance:{algorithm:"component-degree",edgeFamily:"all"}}}function Zr(e,t){let n=new Map(e.edges.map(r=>[mt(r),r])),s=new Map(t.edges.map(r=>[mt(r),r]));return{fromVersion:e.version,toVersion:t.version,added:[...s].filter(([r])=>!n.has(r)).map(([,r])=>r),removed:[...n].filter(([r])=>!s.has(r)).map(([,r])=>r),unchangedCount:[...n.keys()].filter(r=>s.has(r)).length,exact:!0}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c0fb747e-1f9f-55c4-808b-b77d3a881f87")}catch{}})();var Nn=5,On=1e4,Mn=8;function Oe(e,t){if(!Number.isFinite(t)||!Number.isInteger(t)||t<0)throw new TypeError(`Invalid path ${e} bound: ${String(t)}`)}function le(e,t){return t.hierarchyDirection==="target_parent"?e.target:e.source}function B(e,t){return(t.precedence??"source_before_target")==="target_before_source"?e.target:e.source}function fe(e,t){let n=B(e,t);return{predecessor:n,successor:n===e.source?e.target:e.source}}function $n(e,t,n){if(t===void 0)return;let s=e.registry(),r=new Set;for(let i of t){let o=s.require(i);if(!o[n])throw new TypeError(`Relationship kind ${o.kind} is not a ${n} kind`);r.add(o.kind)}return r}function Pn(e,t,n,s,r){let i=e.registry(),o=e.neighborEdges(t,{direction:"both",...n===void 0?{}:{kinds:[...n]}}),a=[],c=new Set;for(let d of o.value){let u=i.require(d.edge.kind);u[s]&&r(d,u,t)&&(c.has(d.id)||(c.add(d.id),a.push(d.id)))}return{neighbors:a,inspectedEdges:o.meta.inspectedEdges}}function jn(e,t,n,s,r,i){if(t>=n)return e.neighbors.some(o=>!i.seen.has(o))&&(i.truncated=!0),!1;for(let o of e.neighbors)if(!i.seen.has(o)){if(i.seen.add(o),i.queue.push({id:o,depth:t+1}),!i.resumed){o===r&&(i.resumed=!0);continue}if(i.value.length>=s)return i.truncated=!0,!0;i.value.push(o)}return!1}function pe(e,t,n,s,r){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);let i=$n(e,n.kinds,s),o=n.limit??Number.POSITIVE_INFINITY,a=n.maxDepth??Number.POSITIVE_INFINITY,c=n.after,d={seen:new Set([t]),value:[],queue:[{id:t,depth:0}],resumed:c===void 0,truncated:!1},u=0,l=0;for(let f=0;f<d.queue.length;f+=1){n.signal?.throwIfAborted();let p=d.queue[f];u+=1;let h=Pn(e,p.id,i,s,r);if(l+=h.inspectedEdges,jn(h,p.depth,a,o,c,d))break}if(!d.resumed)throw new TypeError(`Traversal cursor not found in sequence: ${c}`);return{value:d.value,meta:{visitedNodes:u,inspectedEdges:l,truncated:d.truncated,nextCursor:d.value.at(-1)}}}function vt(e,t){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`)}function kt(e,t,n,s,r){let i=e.neighborEdges(t.nodes.at(-1),{direction:s,...n.kinds===void 0?{}:{kinds:n.kinds}});return r.inspectedEdges+=i.meta.inspectedEdges,i.value.filter(o=>!t.nodeSet.has(o.id))}function Fn(e,t,n,s,r,i,o){for(let a of kt(e,t,s,r,o)){let c=[...t.nodes,a.id],d=new Set(t.nodeSet).add(a.id),u=[...t.edges,a.edge];if(a.id===n){if(o.value.push({nodes:c,edges:u,length:u.length}),o.value.length>=i)return!0}else o.queue.push({nodes:c,nodeSet:d,edges:u})}return!1}function xt(e,t,n={}){return pe(e,t,n,"hierarchy",(s,r)=>le(s.edge,r)===s.id)}function Et(e,t,n={}){return pe(e,t,n,"hierarchy",(s,r,i)=>le(s.edge,r)===i)}function It(e,t,n={}){return pe(e,t,n,"ordering",(s,r)=>B(s.edge,r)===s.id)}function Tt(e,t,n={}){return pe(e,t,n,"ordering",(s,r,i)=>B(s.edge,r)===i)}function Gn(e,t,n,s,r,i,o,a){let c={value:[],queue:[{nodes:[t],nodeSet:new Set([t]),edges:[]}],inspectedEdges:0},d=0,u=!1,l=r+1;for(let f=0;f<c.queue.length;f+=1){if(s.signal?.throwIfAborted(),c.value.length>=l||d>=i){u=!0;break}let p=c.queue[f];if(d+=1,p.edges.length>=o){kt(e,p,s,a,c).length>0&&(u=!0);continue}if(Fn(e,p,n,s,a,l,c)){u=!0;break}}return{value:c.value.slice(0,r),meta:{visitedNodes:d,inspectedEdges:c.inspectedEdges,truncated:u}}}function St(e,t,n,s={}){vt(e,t),vt(e,n);let r=s.maxPaths??Nn,i=s.maxVisitedPaths??On,o=s.maxDepth??Mn;Oe("maxPaths",r),Oe("maxVisitedPaths",i),Oe("maxDepth",o);let a=s.direction??"outgoing";s.signal?.throwIfAborted();for(let c of s.kinds??[])e.registry().require(c);return t===n?r===0?{value:[],meta:{visitedNodes:1,inspectedEdges:0,truncated:!0}}:{value:[{nodes:[t],edges:[],length:0}],meta:{visitedNodes:1,inspectedEdges:0,truncated:!1}}:Gn(e,t,n,s,r,i,o,a)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="24898402-1568-5b05-9072-f89dd91f25a6")}catch{}})();var qn=16,Bn=2,zn=8;function he(e,t){if(!Number.isInteger(t)||t<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`)}function ge(e,t,n){let s=e.registry(),r=t===void 0?void 0:new Set(t.map(i=>s.require(i).kind));for(let i of e.edges()){if(i.source===i.target)continue;let o=s.require(i.kind);r!==void 0&&!(r.has(o.kind)||o.inverse!==void 0&&r.has(o.inverse))||n(i,o)}}function Un(e,t){let n=new Map;ge(e,t,s=>{Rt(n,s.source,s.target),Rt(n,s.target,s.source)});for(let s of n.values())s.sort();return n}function Rt(e,t,n){let s=e.get(t);s===void 0?e.set(t,[n]):s.push(n)}function Vn(e,t){let n=new Map;for(let i of e){let o=t.get(i);n.set(o,(n.get(o)??0)+1)}let s,r=0;for(let[i,o]of n)(o>r||o===r&&i<s)&&(s=i,r=o);return s}function Kn(e,t){let n=new Map;for(let[r,i]of e){let o=n.get(i);o===void 0?n.set(i,[r]):o.push(r)}let s=[];for(let r of n.values())r.length<t||(r.sort(),s.push({representative:r[0],size:r.length,members:r}));return s.sort((r,i)=>i.size-r.size||r.representative.localeCompare(i.representative))}function Dt(e,t={}){let n=t.maxIterations??qn,s=t.minSize??Bn;he("maxIterations",n),he("minSize",s);let r=Un(e,t.kinds),i=e.nodes(),o=new Map(i.map(l=>[l,l])),a=0,c=!1,d=0,u=0;for(;a<n&&!c;){t.signal?.throwIfAborted(),a+=1,c=!0;for(let l of i){d+=1;let f=r.get(l);if(f===void 0)continue;u+=f.length;let p=Vn(f,o);p!==o.get(l)&&(o.set(l,p),c=!1)}}return{value:{communities:Kn(o,s),iterations:a,converged:c},meta:{visitedNodes:d,inspectedEdges:u,truncated:!c}}}function me(e){return e.direction==="directed"&&(e.ordering||e.hierarchy)}function ye(e){return e.inverse!==void 0&&e.inverse<e.kind?e.inverse:e.kind}function Me(e,t){return(t.hierarchy?le(e,t):e.source===B(e,t)?e.target:e.source)===e.target?{from:e.source,to:e.target}:{from:e.target,to:e.source}}function Wn(e,t){if(t===void 0)return;let n=e.registry(),s=new Set;for(let r of t){let i=n.require(r);if(!me(i))throw new TypeError(`Relationship kind ${i.kind} is not a directed ordering or hierarchy kind`);s.add(ye(i))}return s}function Hn(e,t){let n=e.registry(),s=new Map;for(let r of e.edges()){let i=n.require(r.kind);if(!me(i))continue;let o=ye(i);if(t!==void 0&&!t.has(o))continue;let a=Me(r,i);if(a.from===a.to)continue;let c=s.get(o);c===void 0&&(c={adjacency:new Map,records:[]},s.set(o,c));let d=c.adjacency.get(a.from);d===void 0?c.adjacency.set(a.from,new Set([a.to])):d.add(a.to),c.records.push({...a,edge:r})}return s}function Jn(e){let t=new Map;for(let[n,s]of e.adjacency)t.set(n,[...s].sort());return t}function Xn(e,t,n,s){let r=[s];for(let i=n;i!==t;i=e.get(i))r.push(i);return r.push(t),r.reverse()}function Yn(e,t,n,s,r,i){for(let o of e.get(n.id)??[])if(i.inspectedEdges+=1,!(n.depth===0&&o===t.to)&&!s.has(o)){if(s.set(o,n.id),o===t.to)return Xn(s,t.from,n.id,o);r.push({id:o,depth:n.depth+1})}}function Qn(e,t,n,s){let r=new Map([[t.from,t.from]]),i=[{id:t.from,depth:0}];for(let o=0;o<i.length;o+=1){let a=i[o];if(s.visitedNodes+=1,a.depth>=n)continue;let c=Yn(e,t,a,r,i,s);if(c!==void 0)return c}}function we(e,t={}){let n=t.maxDepth??zn;he("maxDepth",n),t.limit!==void 0&&he("limit",t.limit);let s=t.limit??Number.POSITIVE_INFINITY,r=Wn(e,t.kinds),i=Hn(e,r),o=[],a={visitedNodes:0,inspectedEdges:0},c=!1;e:for(let d of[...i.keys()].sort()){let u=i.get(d),l=Jn(u);for(let f of u.records){t.signal?.throwIfAborted();let p=Qn(l,f,n,a);if(p!==void 0){if(o.length>=s){c=!0;break e}o.push({edge:f.edge,witness:p})}}}return{value:o,meta:{visitedNodes:a.visitedNodes,inspectedEdges:a.inspectedEdges,truncated:c}}}function Zn(e,t,n,s,r){let i=new Set,o=[];for(let a of n){if(a.id===e||i.has(a.id))continue;if(!r.seen.has(a.id)){if(t>=s){r.truncated=!0;continue}r.seen.add(a.id),r.queue.push({id:a.id,depth:t+1})}i.add(a.id),o.push(a.id);let c=r.predecessors.get(a.id);c===void 0&&(c=new Set,r.predecessors.set(a.id,c)),c.add(e)}return o}function es(e,t,n){let s=n.direction??"outgoing",r=n.maxDepth??Number.POSITIVE_INFINITY,i=[],o=new Map,a={seen:new Set([t]),queue:[{id:t,depth:0}],predecessors:new Map,truncated:!1},c=0;for(let d=0;d<a.queue.length;d+=1){n.signal?.throwIfAborted();let{id:u,depth:l}=a.queue[d];i.push(u);let f=e.neighborEdges(u,{direction:s,...n.kinds===void 0?{}:{kinds:n.kinds}});c+=f.meta.inspectedEdges,o.set(u,Zn(u,l,f.value,r,a))}return{order:i,successors:o,predecessors:a.predecessors,inspectedEdges:c,truncated:a.truncated}}function ts(e,t){let n=[],s=new Set([t]),r=[{id:t,index:0}];for(;r.length>0;){let i=r.at(-1),o=e.successors.get(i.id);if(i.index<o.length){let a=o[i.index];i.index+=1,s.has(a)||(s.add(a),r.push({id:a,index:0}))}else n.push(i.id),r.pop()}return n.reverse()}function ns(e,t,n,s){let r=e,i=t;for(;r!==i;){for(;s.get(r)>s.get(i);)r=n.get(r);for(;s.get(i)>s.get(r);)i=n.get(i)}return r}function ss(e,t,n){let s;for(let r of[...e].sort())t.has(r)&&(s=s===void 0?r:ns(s,r,t,n));return s}function rs(e,t,n,s,r){let i=new Map([[t,t]]),o=!0;for(;o;){o=!1;for(let a of n){if(r?.throwIfAborted(),a===t)continue;let c=ss(e.predecessors.get(a),i,s);c!==void 0&&i.get(a)!==c&&(i.set(a,c),o=!0)}}return i}function Ct(e,t,n={}){if(!e.hasNode(t))throw new TypeError(`Relationship node not found: ${t}`);if(n.maxDepth!==void 0&&(!Number.isInteger(n.maxDepth)||n.maxDepth<0))throw new TypeError(`Invalid maxDepth bound: ${String(n.maxDepth)}`);let s=es(e,t,n),r=ts(s,t),i=new Map(r.map((d,u)=>[d,u])),o=rs(s,t,r,i,n.signal),a=new Map(r.map(d=>[d,1]));for(let d=r.length-1;d>=0;d-=1){let u=r[d];if(u===t)continue;let l=o.get(u);a.set(l,a.get(l)+a.get(u))}let c=r.filter(d=>d!==t).map(d=>({id:d,idom:o.get(d),dominatedCount:a.get(d)-1})).sort((d,u)=>u.dominatedCount-d.dominatedCount||d.id.localeCompare(u.id));return{value:{root:t,reachableCount:s.order.length,rows:c},meta:{visitedNodes:s.order.length,inspectedEdges:s.inspectedEdges,truncated:s.truncated}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="251ae2b0-10f4-528d-86b0-d224b126f8eb")}catch{}})();var is=25,Lt={error:0,warning:1,info:2};function Pe(e,t,n,s,r,i,o){let a=[...r].sort((c,d)=>c.localeCompare(d));return{code:e,severity:t,policy:n,message:s(a.length),count:a.length,sample:a.slice(0,i),sample_truncated:a.length>i,remediation:o}}function os(e){let t=e.graph.registry(),n=new Map;for(let s of e.graph.edges()){let r=t.require(s.kind);if(!r.ordering)continue;let[i,o]=(r.precedence??"source_before_target")==="target_before_source"?[s.target,s.source]:[s.source,s.target],a=n.get(i);a?a.push(o):n.set(i,[o])}for(let s of n.values())s.sort((r,i)=>r.localeCompare(i));return n}function Ot(e,t){t.indexes.set(e,t.nextIndex),t.lowLinks.set(e,t.nextIndex),t.nextIndex+=1,t.stack.push(e),t.onStack.add(e)}function as(e,t,n,s){let r=n.get(e.node)??[];if(e.neighborIndex>=r.length)return!1;let i=r[e.neighborIndex];return e.neighborIndex+=1,s.indexes.has(i)?s.onStack.has(i)&&s.lowLinks.set(e.node,Math.min(s.lowLinks.get(e.node),s.indexes.get(i))):(Ot(i,s),t.push({node:i,neighborIndex:0})),!0}function cs(e,t,n,s){t.pop();let r=t.at(-1);if(r&&s.lowLinks.set(r.node,Math.min(s.lowLinks.get(r.node),s.lowLinks.get(e.node))),s.lowLinks.get(e.node)!==s.indexes.get(e.node))return;let i=[];for(;;){let o=s.stack.pop();if(s.onStack.delete(o),i.push(o),o===e.node)break}(i.length>1||i.length===1&&n.get(i[0])?.includes(i[0]))&&s.components.push(i.sort((o,a)=>o.localeCompare(a)))}function Fe(e){let t={indexes:new Map,lowLinks:new Map,onStack:new Set,stack:[],components:[],nextIndex:0},n=[...e.keys()].sort((s,r)=>s.localeCompare(r));for(let s of n){if(t.indexes.has(s))continue;let r=[{node:s,neighborIndex:0}];for(Ot(s,t);r.length>0;){let i=r.at(-1);as(i,r,e,t)||cs(i,r,e,t)}}return t.components.sort((s,r)=>s[0].localeCompare(r[0]))}function $e(e){return`${e.holder_id} -> ${e.target_id} (${e.kind})`}function E(e,t,n,s,r,i,o,a){t.length!==0&&e.push(Pe(s,r,i,o,t,n,a))}function ds(e,t,n){let s=[],r=[...e.dangling.active,...e.dangling.legacy_terminal].filter(i=>!i.no_active_blocker_sentinel);return E(s,r.filter(i=>!t(i.holder_status)).map($e),n,"missing_reference_active","error","Active items must not reference absent targets; missing prerequisites distort scheduling.",i=>`${i} active dangling reference(s) to absent items`,"Restore or re-create the referenced item, or remove/retype the reference on the holder."),E(s,r.filter(i=>t(i.holder_status)).map($e),n,"missing_reference_terminal","info","Terminal items may retain historical references, but absent targets remain unexplainable context.",i=>`${i} terminal dangling reference(s) to absent items`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),E(s,e.dangling.no_active_blocker_sentinels.map($e),n,"legacy_no_blocker_sentinel","info","The pre-structured-dependency no-active-blocker sentinel is retired; real edges carry blocker state.",i=>`${i} legacy no-active-blocker sentinel reference(s)`,"Delete the sentinel reference; blocker state is derived from blocked_by edges."),s}function je(e,t){let n=t.get(e);return n?!n.terminal:!0}function us(e,t,n,s){let r=[],i=os(e);for(let c of Fe(i)){let d=c.some(u=>je(u,t));r.push(d?Pe("ordering_cycle","error","Order-bearing relationship kinds must stay acyclic; a cycle makes every member unschedulable.",u=>`execution-order cycle across ${u} item(s)`,c,s,"Remove or retype one ordering edge inside the cycle, or split the work so precedence is linear."):Pe("legacy_ordering_cycle","info","Ordering cycles between exclusively terminal items are historical contradictions with no scheduling effect.",u=>`terminal-only execution-order cycle across ${u} item(s)`,c,s,"Leave as history debt, or clean up in a dedicated changelog-safe closed-item batch; never repair closed items ad hoc."))}let o=new Map;for(let[c,d]of i)for(let u of d){let l=o.get(u);l?l.push(c):o.set(u,[c])}let a=[...t.values()].filter(c=>!c.missing&&!c.terminal&&n(c.status)&&!(o.get(c.id)??[]).some(d=>{let u=t.get(d);return u===void 0||!u.terminal})).map(c=>c.id);return E(r,a,s,"stale_lifecycle_block","warning","A blocked lifecycle status must be backed by at least one open ordering predecessor.",c=>`${c} status-blocked item(s) with no open blocker edge`,"Re-open the missing prerequisite as an edge, or move the item back to an active status."),r}function be(e){let t=e.edges.map(n=>n.kind).sort((n,s)=>n.localeCompare(s));return`${e.from} -> ${e.to} (${t.join(" + ")})`}function Ge(e){let t=e.graph.registry(),n=new Map;for(let r of e.graph.edges()){let i=t.require(r.kind);if(!me(i))continue;let o=Me(r,i);if(o.from===o.to)continue;let a=`${ye(i)}::${o.from}::${o.to}`,c=n.get(a);c?c.edges.push(r):n.set(a,{...o,edges:[r]})}let s=[...n.values()].filter(r=>r.edges.length>=2);for(let r of s)r.edges.sort((i,o)=>i.kind.localeCompare(o.kind));return s.sort((r,i)=>r.from.localeCompare(i.from)||r.to.localeCompare(i.to))}function ls(e,t,n){let s=[],r=[];for(let o of Ge(e))(je(o.from,t)||je(o.to,t)?s:r).push(be(o));let i=[];return E(i,s,n,"duplicate_edge","info","One semantic relationship should be stored once; parallel same-family spellings (reciprocal inverse pairs included) add no information and skew degree metrics.",o=>`${o} duplicated relationship(s) between active endpoints`,"Remove all but one stored spelling of the relationship; keep the canonical direction the holder declared first."),E(i,r,n,"legacy_duplicate_edge","info","Duplicated spellings between exclusively terminal items are historical noise with no scheduling effect.",o=>`${o} duplicated relationship(s) between terminal endpoints`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),i}function fs(e,t){let n=[],s=[];for(let i of e.duplicateRows??[])(i.legacy_terminal?s:n).push(`${i.holder_id} -> ${i.target_id} (${i.kind} x${i.occurrences})`);let r=[];return E(r,n,t,"duplicate_dependency_row","warning","One dependency row must be stored once per holder; identical repeated rows are a storage-layer defect invisible to the assembled graph.",i=>`${i} exactly duplicated stored dependency row(s) on active holder(s)`,"Remove the repeated rows so the dependency is stored exactly once; graph semantics are unchanged."),E(r,s,t,"legacy_duplicate_dependency_row","info","Identical repeated dependency rows on terminal holders are historical storage noise with no scheduling effect.",i=>`${i} exactly duplicated stored dependency row(s) on terminal holder(s)`,"Leave as history debt or clean up in a dedicated changelog-safe closed-item batch."),r}function ps(e,t,n,s,r){e.active+=1;let i=t.type??"(untyped)",o=e.byType.get(i);o||(o={active:0,isolated:0,degree_leq_one:0},e.byType.set(i,o)),o.active+=1,!(n>1)&&(e.degreeLeqOne+=1,o.degree_leq_one+=1,n===0&&(e.isolated+=1,o.isolated+=1),!(s.has(t.id.toLowerCase())||r.has(i.toLowerCase()))&&(n===0?e.isolates.push(t.id):e.sparse.push(t.id)))}function hs(e,t,n,s,r,i){let o={active:0,missing:0,isolated:0,degreeLeqOne:0,isolates:[],sparse:[],byType:new Map};for(let u of e.graph.nodes()){let l=t.get(u);if(l){if(l.missing){o.missing+=1;continue}l.terminal||ps(o,l,e.graph.incidentEdges(u).length,n,s)}}let{isolates:a,sparse:c}=o,d=[];return E(d,a,r,"isolated_active_node","warning","Active work should be reachable from the graph unless explicitly declared a valid isolate.",u=>`${u} active item(s) with no relationships`,"Link the item to its parent, prerequisite, or origin \u2014 or register it as an exempt isolate."),E(d,c,r,"sparse_active_node","info","Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.",u=>`${u} active item(s) with exactly one relationship`,"Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one."),{findings:d,profile:{nodes:e.graph.nodes().length,edges:e.graph.edges().length,edge_basis:"deduplicated_directed",edges_by_kind:Object.fromEntries(Object.entries(i).sort(([u],[l])=>u.localeCompare(l))),active_nodes:o.active,missing_nodes:o.missing,isolated_active_nodes:o.isolated,degree_leq_one_active_nodes:o.degreeLeqOne,coverage_by_type:Object.fromEntries([...o.byType.entries()].sort(([u],[l])=>u<l?-1:1))}}}function _e(e,t={}){let n=t.isTerminal??(l=>l==="closed"||l==="canceled"),s=t.isBlocked??(l=>l==="blocked"),r=t.maxSampleSize??is;if(!Number.isInteger(r)||r<1)throw new TypeError(`Invalid audit sample bound: ${String(t.maxSampleSize)}`);let i=new Set((t.exemptIsolates??[]).filter(l=>typeof l=="string").map(l=>l.trim().toLowerCase())),o=new Set((t.isolateExemptTypes??[]).filter(l=>typeof l=="string").map(l=>l.trim().toLowerCase())),a=new Map(e.details.map(l=>[l.id,{id:l.id,status:l.status,missing:e.missingIdSet.has(l.id.toLowerCase()),terminal:n(l.status),...l.type===void 0?{}:{type:l.type}}]));t.signal?.throwIfAborted();let c={};for(let l of e.graph.edges())c[l.kind]=(c[l.kind]??0)+1;let d=ds(e,n,r);t.signal?.throwIfAborted(),d.push(...us(e,a,s,r)),t.signal?.throwIfAborted(),d.push(...ls(e,a,r),...fs(e,r)),t.signal?.throwIfAborted();let u=hs(e,a,i,o,r,c);return d.push(...u.findings),d.sort((l,f)=>Lt[l.severity]-Lt[f.severity]||l.code.localeCompare(f.code)||l.sample[0].localeCompare(f.sample[0])),{findings:d,profile:u.profile}}function At(e,t){let n=[...new Set([...Object.keys(e),...Object.keys(t)])].sort(),s={};for(let r of n){let i=(t[r]??0)-(e[r]??0);i!==0&&(s[r]=i)}return s}function Nt(e){return e.profile.coverage_by_type??{}}function Mt(e,t){let n={},s=Nt(e),r=Nt(t),i=[...new Set([...Object.keys(s),...Object.keys(r)])].sort();for(let o of i){let a=s[o],c=r[o],d={active:(c?.active??0)-(a?.active??0),isolated:(c?.isolated??0)-(a?.isolated??0),degree_leq_one:(c?.degree_leq_one??0)-(a?.degree_leq_one??0)};Object.values(d).some(u=>u!==0)&&(n[o]=d)}return{baseline_saved_at:e.saved_at,same_snapshot:e.fingerprint===t.fingerprint,affected_subjects_by_code:At(e.affected_subjects_by_code,t.affected_subjects_by_code),profile:{nodes:t.profile.nodes-e.profile.nodes,edges:t.profile.edges-e.profile.edges,active_nodes:t.profile.active_nodes-e.profile.active_nodes,missing_nodes:t.profile.missing_nodes-e.profile.missing_nodes,isolated_active_nodes:t.profile.isolated_active_nodes-e.profile.isolated_active_nodes,degree_leq_one_active_nodes:t.profile.degree_leq_one_active_nodes-e.profile.degree_leq_one_active_nodes,edges_by_kind:At(e.profile.edges_by_kind,t.profile.edges_by_kind),coverage_by_type:n}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="4198a3b2-2541-50eb-bec5-93ac58601f40")}catch{}})();function $t(e){return[...e].sort().join("\0")}function gs(e,t,n){let s=e.successors.get(t);s?s.push(n):e.successors.set(t,[n]);let r=e.predecessors.get(n);r?r.push(t):e.predecessors.set(n,[t])}function Pt(e,t,n,s,r){let i=t.resolve(r);if(i?.ordering!==!0)return;let o=ut(s),a=o===void 0?void 0:e.canonicalIds.get(o.toLowerCase());if(a===void 0)return;let c=(i.precedence??"source_before_target")==="source_before_target";gs(e,c?n:a,c?a:n)}function ms(e,t){let n={successors:new Map,predecessors:new Map,canonicalIds:new Map},s=e.filter(r=>typeof r?.id=="string"&&r.id.trim().length>0);for(let r of s){let i=r.id.trim();n.canonicalIds.set(i.toLowerCase(),i)}for(let r of s){let i=r.id.trim();Pt(n,t,i,r.blocked_by,"blocked_by");for(let o of r.dependencies??[])typeof o!="object"||o===null||Pt(n,t,i,o.id,typeof o.kind=="string"?o.kind:"related")}for(let r of[n.successors,n.predecessors])for(let i of r.values())i.sort();return n}function ys(e,t){let n=new Set([t]),s=[t];for(;s.length>0;){let r=s.pop();for(let i of[e.successors,e.predecessors])for(let o of i.get(r)??[])n.has(o)||(n.add(o),s.push(o))}return n}function ws(e,t){let n=new Map;for(let s of t){let r=(e.successors.get(s)??[]).filter(i=>t.has(i));r.length>0&&n.set(s,r)}return n}function jt(e,t,n){let s=ms(e,t),r=s.canonicalIds.get(n.trim().toLowerCase());if(r===void 0)return{cycles:[],successors:new Map,canonical:n};let i=ws(s,ys(s,r));return{cycles:Fe(i).filter(o=>o.includes(r)),successors:i,canonical:r}}function bs(e,t,n){let s=new Set(t),r=s.has(n)?n:t[0];if(e.get(r)?.includes(r))return[r,r];for(let i of e.get(r)??[]){if(!s.has(i))continue;let o=_s(e,s,r,i);if(o)return o}return[...t,t[0]]}function _s(e,t,n,s){let r=[[s]],i=new Set([n,s]);for(;r.length>0;){let o=r.shift(),a=o.at(-1);for(let c of e.get(a)??[]){if(c===n)return[n,...o,n];!t.has(c)||i.has(c)||(i.add(c),r.push([...o,c]))}}}function ci(e,t,n){let s=A(),r=jt(e,s,n),i=jt(t,s,n),o=new Set(r.cycles.map($t));return i.cycles.filter(a=>!o.has($t(a))).map(a=>`ordering_cycle_created:${bs(i.successors,a,i.canonical).join(" -> ")}:items_will_not_be_ready:run_pm_graph_audit`)}import{createHash as vs}from"node:crypto";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dea35fb9-9f9f-56ce-afc0-f4dc993012c3")}catch{}})();var ks=64,xs=8;function Es(e,t){let n=(e.dependencies??[]).map(s=>{if(typeof s!="object"||s===null)return"";let r=s;return`${typeof r.kind=="string"?r.kind:"related"}:${typeof r.id=="string"?r.id:""}`}).sort().join(",");return[e.id,e.title,e.status,t(e.status)?"1":"0",typeof e.type=="string"?e.type.trim():"",e.parent??"",e.blocked_by??"",n].join("\0")}function ve(e,t=s=>s==="closed"||s==="canceled",n=k()){let s=e.filter(i=>typeof i?.id=="string"&&i.id.trim().length>0).map(i=>Es(i,t)).sort(),r=n.list().map(i=>j(i)).sort();return vs("sha256").update(s.join("")).update("").update(r.join("")).digest("hex")}function Ft(e,t,n){let s=t??n;if(!Number.isInteger(s)||s<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`);return s}var qe=class{#e=new Map;#n;#s;constructor(t={}){this.#n=Ft("maxResultsPerWorkspace",t.maxResultsPerWorkspace,ks),this.#s=Ft("maxWorkspaces",t.maxWorkspaces,xs)}lookup(t,n,s){let r=this.#e.get(t),i=!0;(r===void 0||r.fingerprint!==n)&&(r={fingerprint:n,assembly:s(),results:new Map},i=!1,!this.#e.has(t)&&this.#e.size>=this.#s&&this.#e.delete(this.#e.keys().next().value)),this.#e.delete(t),this.#e.set(t,r);let o=r,a=this.#n;return{assembly:o.assembly,assemblyReused:i,fingerprint:n,memoize(c,d){let u=o.results.get(c);if(u!==void 0||o.results.has(c))return o.results.delete(c),o.results.set(c,u),{value:structuredClone(u),reused:!0};let l=d();return o.results.size>=a&&o.results.delete(o.results.keys().next().value),o.results.set(c,structuredClone(l)),{value:l,reused:!1}}}}clear(){this.#e.clear()}},Gt=new qe;function ke(){return Gt}function pi(){Gt.clear()}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="31a800f7-1374-5e7c-ad23-ae3d8ebcebe0")}catch{}})();var Is=["prerequisite","dependent","ancestor","descendant","provenance","related"],Ts=new TextEncoder;function Be(e,t,n){let s=e??t;if(!Number.isInteger(s)||s<1)throw new TypeError(`Relationship context ${n} must be positive`);return s}function xe(e){return Math.max(1,Math.ceil(Ts.encode(JSON.stringify(e)).byteLength/4))}function ze(e,t,n){let s=n.resolve(e.kind);if(s?.ordering){let i=(s.precedence??"source_before_target")==="source_before_target"?e.source:e.target;return t===i?"prerequisite":"dependent"}if(s?.hierarchy){let i=(s.hierarchyDirection??"source_parent")==="source_parent"?e.source:e.target;return t===i?"ancestor":"descendant"}return e.kind==="discovered_from"||e.kind==="incident_from"?"provenance":"related"}function Ss(e,t,n,s){let r=e.filter(i=>i.source===t&&i.target===n||i.target===t&&i.source===n).map(i=>ze(i,n,s));return[...new Set(r)].sort()}function Rs(e){return Is.find(t=>e.includes(t))}function Ds(e,t,n,s){let r=s.direction??"both",i=s.maxDepth??3;if(!Number.isInteger(i)||i<0)throw new TypeError("Relationship context maxDepth must be non-negative");let o=new Set([t]),a=[{id:t,distance:0}],c=[],d=0,u=!1;for(let l=0;l<a.length;l+=1){s.signal?.throwIfAborted();let f=a[l];if(f.distance>=i&&u)continue;let p=e.neighborEdges(f.id,{direction:r,kinds:s.kinds,signal:s.signal});if(d+=p.meta.inspectedEdges,f.distance>=i){p.value.some(h=>!o.has(h.id))&&(u=!0);continue}for(let{id:h,edge:g}of p.value){if(o.has(h))continue;o.add(h);let m={id:h,distance:f.distance+1,via:f.id,role:ze(g,h,n)};c.push(m),a.push(m)}}return c.sort((l,f)=>l.distance-f.distance||l.id.localeCompare(f.id)),{rows:c,visitedNodes:a.length,inspectedEdges:d,depthTruncated:u}}function Cs(e,t,n,s){let r={prerequisite:0,dependent:0,ancestor:0,descendant:0,provenance:0,related:0},i=e.neighborEdges(t,{direction:s.direction??"both",kinds:s.kinds,signal:s.signal}).value;for(let{id:o,edge:a}of i)r[ze(a,o,n)]+=1;return{directEdges:r,directTotal:i.length,rootEdges:i.map(({edge:o})=>o)}}function Ls(e){let t=[],n=e.initialTokens;for(let s of e.candidates){if(t.length>=e.nodeLimit)break;let r=s.distance===1?Ss(e.rootEdges,e.rootId,s.id,e.registry):[],i={...e.details.get(s.id)??{id:s.id},distance:s.distance,role:r.length>0?Rs(r):s.role,via:s.via,reasons:r.length>0?r:[`${s.role} via ${s.via} (depth ${s.distance})`]},o=xe(i);if(n+o>e.tokenBudget)break;t.push(i),n+=o}if(e.candidates.length>0&&t.length===0)throw new TypeError("Relationship context tokenBudget cannot fit one node");return{nodes:t,usedTokens:n}}function As(e){let t=e.options.kinds?new Set(e.options.kinds.map(i=>e.registry.require(i).kind)):void 0,n=e.graph.edges().filter(i=>{if(!e.included.has(i.source)||!e.included.has(i.target))return!1;if(t===void 0||t.has(i.kind))return!0;let o=e.registry.resolve(i.kind)?.inverse;return o!==void 0&&t.has(o)}),s=[],r=e.initialTokens;for(let i of n){if(s.length>=e.edgeLimit)break;let o=xe(i);if(r+o>e.tokenBudget)break;s.push(i),r+=o}return{edges:s,usedTokens:r,candidateCount:n.length}}function qt(e,t,n,s={}){if(!e.nodes().includes(t))throw new TypeError(`Relationship node not found: ${t}`);let r=Be(s.nodeLimit,20,"nodeLimit"),i=Be(s.edgeLimit,40,"edgeLimit"),o=Be(s.tokenBudget,1200,"tokenBudget"),a=s.registry??k(),c=new Map(n.map(C=>[C.id,C])),d=c.get(t)??{id:t},{evidence:u=[],...l}=d,f=[...u],p=Ds(e,t,a,s),{rootEdges:h,...g}=Cs(e,t,a,s),m=L("relationship-context",{rootId:t,direction:s.direction??"both",kinds:[...s.kinds??[]].sort(),maxDepth:s.maxDepth??3}),b=ot(p.rows,s.cursor,m,({id:C})=>C),x=p.rows.slice(b),_=xe(l)+xe(f);if(_>o)throw new TypeError("Relationship context tokenBudget cannot fit root and evidence");let R=Ls({candidates:x,details:c,rootEdges:h,rootId:t,registry:a,nodeLimit:r,tokenBudget:o,initialTokens:_}),{nodes:v}=R,U=new Set([t,...v.map(({id:C})=>C)]),O=As({graph:e,included:U,options:s,registry:a,edgeLimit:i,tokenBudget:o,initialTokens:R.usedTokens}),{edges:M,usedTokens:gn}=O,V=b+v.length,Ie=V<p.rows.length,tt=v.at(-1),Te=O.candidateCount-M.length,nt=p.depthTruncated||Ie||Te>0,mn={rootId:t,...l.status===void 0?{}:{rootStatus:l.status},...g,discoveredNodes:p.rows.length,returnedNodes:v.length,returnedEdges:M.length,omittedNodes:p.rows.length-V,omittedEdges:Te,evidenceCount:f.length,hasMore:Ie};return{root:l,summary:mn,nodes:v,edges:M,evidence:f,meta:{exact:!0,truncated:nt,completeness:nt?"truncated":"complete",nodeLimit:r,edgeLimit:i,tokenBudget:o,usedTokens:gn,visitedNodes:p.visitedNodes,inspectedEdges:p.inspectedEdges,omittedNodes:p.rows.length-V,omittedEdges:Te,...Ie&&tt?{nextCursor:ee(m,tt.id,V-1)}:{}}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="348c9246-2fb9-529e-b627-f60c901a6cf2")}catch{}})();function Bt(e){return Math.round(e*1e6)/1e6}function zt(e,t,n){let s=e.get(t);s===void 0?e.set(t,new Set([n])):s.add(n)}function Ut(e,t){let n=new Map(e.nodes().map(r=>[r,new Set]));ge(e,t,r=>{n.get(r.source).add(r.target),n.get(r.target).add(r.source)});let s=new Map;for(let[r,i]of n)s.set(r,[...i].sort());return s}function Ns(e,t){let n=new Map,s=new Map;return ge(e,t,(r,i)=>{if(!i.ordering)return;let{predecessor:o,successor:a}=fe(r,i);zt(s,o,a),zt(n,a,o)}),{incoming:n,outgoing:s}}function Os(e,t,n){let s=new Map([[e,0]]),r=new Map([[e,1]]),i=new Map,o=[],a=[e],c=0,d=0;for(let u=0;u<a.length;u+=1){let l=a[u];n.visitedNodes+=1,o.push(l);let f=s.get(l);l!==e&&(c+=1,d+=f);for(let p of t.get(l))if(n.inspectedEdges+=1,s.has(p)||(s.set(p,f+1),a.push(p)),s.get(p)===f+1){r.set(p,(r.get(p)??0)+r.get(l));let h=i.get(p);h===void 0?i.set(p,[l]):h.push(l)}}return{stack:o,sigma:r,predecessors:i,reachableCount:c,distanceSum:d}}function Ms(e,t,n){let s=new Map;for(let r=e.stack.length-1;r>=0;r-=1){let i=e.stack[r],o=(1+(s.get(i)??0))/e.sigma.get(i);for(let a of e.predecessors.get(i)??[])s.set(a,(s.get(a)??0)+e.sigma.get(a)*o);i!==t&&n.set(i,(n.get(i)??0)+(s.get(i)??0))}}function $s(e,t){return t<=1||e.reachableCount===0?0:e.reachableCount/(t-1)*(e.reachableCount/e.distanceSum)}function Ps(e,t,n,s,r){return{id:e,degree:t.get(e).length,inDegree:n.incoming.get(e)?.size??0,outDegree:n.outgoing.get(e)?.size??0,betweenness:Bt((s.get(e)??0)/2),closeness:Bt(r.get(e))}}function Vt(e,t={}){let n=Ut(e,t.kinds),s=Ns(e,t.kinds),r=e.nodes(),i=new Map,o=new Map,a={visitedNodes:0,inspectedEdges:0};for(let u of r){t.signal?.throwIfAborted();let l=Os(u,n,a);o.set(u,$s(l,r.length)),Ms(l,u,i)}let c=0;for(let u of n.values())c+=u.length;let d=r.map(u=>Ps(u,n,s,i,o)).sort((u,l)=>l.betweenness-u.betweenness||l.degree-u.degree||u.id.localeCompare(l.id));return{value:{nodeCount:r.length,edgeCount:c/2,rows:d},meta:{visitedNodes:a.visitedNodes,inspectedEdges:a.inspectedEdges,truncated:!1}}}function js(e,t){return e<=t?{source:e,target:t}:{source:t,target:e}}function Fs(e,t,n){let r=t.get(e.node)[e.neighborIndex];if(e.neighborIndex+=1,n.inspectedEdges+=1,r!==e.parent){if(n.discovery.has(r)){n.low.set(e.node,Math.min(n.low.get(e.node),n.discovery.get(r)));return}return e.children+=1,n.discovery.set(r,n.timer),n.low.set(r,n.timer),n.timer+=1,{node:r,parent:e.node,neighborIndex:0,children:0}}}function Gs(e,t,n){if(e.parent===null){e.children>1&&n.articulation.add(e.node);return}let s=e.parent,r=n.low.get(e.node);n.low.set(s,Math.min(n.low.get(s),r)),s!==t&&r>=n.discovery.get(s)&&n.articulation.add(s),r>n.discovery.get(s)&&n.bridges.push(js(s,e.node))}function qs(e,t,n,s){n.discovery.set(e,n.timer),n.low.set(e,n.timer),n.timer+=1;let r=[{node:e,parent:null,neighborIndex:0,children:0}];for(;r.length>0;){s?.throwIfAborted();let i=r.at(-1);if(i.neighborIndex<t.get(i.node).length){let o=Fs(i,t,n);o!==void 0&&r.push(o)}else Gs(i,e,n),r.pop()}}function Kt(e,t={}){let n=Ut(e,t.kinds),s={discovery:new Map,low:new Map,timer:0,articulation:new Set,bridges:[],inspectedEdges:0};for(let r of e.nodes())s.discovery.has(r)||qs(r,n,s,t.signal);return{value:{articulationPoints:[...s.articulation].sort(),bridges:s.bridges.sort((r,i)=>r.source.localeCompare(i.source)||r.target.localeCompare(i.target))},meta:{visitedNodes:s.discovery.size,inspectedEdges:s.inspectedEdges,truncated:!1}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f155ac72-64eb-5316-b016-954abd48c0e7")}catch{}})();function Bs(e){let t=e.registry(),n=new Map,s=new Set;for(let r of e.edges()){let i=t.require(r.kind);if(!i.ordering)continue;let{predecessor:o,successor:a}=fe(r,i);if(s.add(o),s.add(a),o===a)continue;let c=n.get(o);c===void 0?n.set(o,new Set([a])):c.add(a)}return{forward:n,participants:s}}function zs(e,t,n,s){if(e===void 0)return s;let r=s;for(let i of e)t.has(i)&&(r=Math.min(r,n.get(i)));return r}function Us(e,t,n){let s=n-t;return{id:e,earliestStart:t,earliestFinish:t+1,latestStart:n,latestFinish:n+1,slack:s,critical:s===0}}function Vs(e,t,n,s,r){let i=new Map;for(let o=e.length-1;o>=0;o-=1){let a=e[o],c=zs(t.forward.get(a),s,i,r);i.set(a,c-1)}return e.map(o=>Us(o,n[o],i.get(o))).sort((o,a)=>o.slack-a.slack||o.earliestStart-a.earliestStart||o.id.localeCompare(a.id))}function Wt(e,t={}){t.signal?.throwIfAborted();let n=ue(e,{registry:e.registry()}),s=Bs(e),r=new Set(n.order),i=n.order.filter(d=>s.participants.has(d)),o=i.reduce((d,u)=>Math.max(d,n.depth[u]+1),0),a=Vs(i,s,n.depth,r,o),c=a.length>0;return{exact:!0,acyclic:n.acyclic,makespan:o,scheduledCount:a.length,criticalPath:c?n.criticalPath:[],criticalPathLength:c?n.criticalPathLength:0,cycles:n.cycles,rows:a,provenance:{algorithm:"critical-path-method",edgeFamily:"ordering",weighting:"unit"}}}import Jt from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ee260dcf-f4df-5997-a8d7-691c19c66a41")}catch{}})();var Xt=1,Ue=500,Ks=64,Ws="graph-durable-cache";function Yt(e){return ne(e,Ws,30,`graph-cache:${process.pid}`,!1,!1,3e3)}function z(e){return Jt.join(e,"runtime","graph-cache.json")}function Qt(e){return Jt.join(e,"runtime","graph-audit-baseline.json")}function Ve(e){if(e!==null)try{let t=JSON.parse(e);return typeof t!="object"||t===null||t.version!==Xt||typeof t.fingerprint!="string"||typeof t.saved_at!="string"||typeof t.results!="object"||t.results===null||Array.isArray(t.results)?void 0:t}catch{return}}async function Ke(e,t){let n=await $(z(e)),s=Ve(n),r=s?.fingerprint===t;return{exists:n!==null,fresh:r,results:r?s.results:{}}}async function We(e,t,n,s,r){let i=await Yt(e);try{let o=Ve(await $(z(e))),a=o?.fingerprint===t?o.results:{};delete a[s],a[s]=r;let c=Object.keys(a);for(let d of c.slice(0,Math.max(0,c.length-Ks)))delete a[d];await P(z(e),JSON.stringify({version:Xt,fingerprint:t,saved_at:new Date().toISOString(),results:a})),n.results=a}finally{await i()}}async function He(e){let t=await Yt(e);try{await st(z(e))}finally{await t()}}async function Zt(e,t){let n=z(e),s=await $(n),r=Ve(s);return r===void 0?{exists:s!==null,fresh:!1,entry_count:0}:{exists:!0,fresh:r.fingerprint===t,entry_count:Object.keys(r.results).length,fingerprint:r.fingerprint.slice(0,12),saved_at:r.saved_at,bytes:Buffer.byteLength(s,"utf8")}}function Je(e,t){return t||e>=Ue}function Ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.values(e).every(t=>Number.isInteger(t)&&t>=0)}function Hs(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.values(e).every(t=>typeof t=="object"&&t!==null&&!Array.isArray(t)&&[t.active,t.isolated,t.degree_leq_one].every(n=>Number.isInteger(n)&&n>=0))}function Js(e){if(e!==null)try{let t=JSON.parse(e);if(typeof t!="object"||t===null)return;let n=t,s=n.profile;return typeof n.saved_at!="string"||typeof n.fingerprint!="string"||!Ht(n.affected_subjects_by_code)||typeof s!="object"||s===null||![s.nodes,s.edges,s.active_nodes,s.missing_nodes,s.isolated_active_nodes,s.degree_leq_one_active_nodes].every(r=>Number.isInteger(r)&&r>=0)||!Ht(s.edges_by_kind)||s.coverage_by_type!==void 0&&!Hs(s.coverage_by_type)?void 0:{...n,profile:{...s,coverage_by_type:s.coverage_by_type??{}}}}catch{return}}async function en(e){return Js(await $(Qt(e)))}async function tn(e,t){await P(Qt(e),JSON.stringify(t))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1f26594a-5843-556e-90b4-d733733f8828")}catch{}})();var Xs={missing_reference_active:{op:"investigate",confidence:"medium",rationale:"Restore or re-create the referenced item, or remove/retype the reference on the active holder; the correct fix depends on why the target is absent."},missing_reference_terminal:{op:"waive",confidence:"high",rationale:"Terminal-holder reference to an absent item is historical debt; waive it or clean it up only in a dedicated changelog-safe closed-item batch."},legacy_no_blocker_sentinel:{op:"remove",confidence:"high",rationale:"The pre-structured-dependency no-active-blocker sentinel is retired and carries no information; blocker state derives from blocked_by edges."},ordering_cycle:{op:"investigate",confidence:"low",rationale:"Every cycle member is unschedulable until one ordering edge is removed or retyped; the planner never chooses which edge to cut."},legacy_ordering_cycle:{op:"waive",confidence:"high",rationale:"Terminal-only ordering cycles have no scheduling effect; repairing them would mutate closed history (changelog drag)."},duplicate_edge:{op:"remove",confidence:"high",rationale:"Parallel same-family spellings state one relationship twice; remove all but one stored spelling, keeping the holder's canonical direction."},legacy_duplicate_edge:{op:"waive",confidence:"high",rationale:"Duplicated spellings between terminal items are historical noise; waive or batch changelog-safe cleanup."},duplicate_dependency_row:{op:"remove",confidence:"high",rationale:"The identical dependency row is stored more than once on the holder; drop the repeats so the row exists exactly once \u2014 graph semantics are unchanged."},legacy_duplicate_dependency_row:{op:"waive",confidence:"high",rationale:"Repeated identical rows on terminal holders are storage noise; waive or clean up only in a changelog-safe closed-item batch."},stale_lifecycle_block:{op:"investigate",confidence:"medium",rationale:"Re-open the missing prerequisite as an ordering edge, or move the item back to an active status; only the holder's owner knows which is true."},isolated_active_node:{op:"investigate",confidence:"medium",rationale:"Link the item to its parent, prerequisite, or origin \u2014 or register it as an explicitly exempt isolate; the audit never fabricates an edge."},sparse_active_node:{op:"investigate",confidence:"low",rationale:"Investigate for an honest second edge (story-to-task, defect family, cross-epic complement); sparse is not automatically defective."}};function nn(e){return`${e.source} -${e.kind}-> ${e.target}`}function Ys(e){let[t,...n]=e.edges;return n.map(s=>({op:"remove",code:"duplicate_edge",subject:nn(s),rationale:"This stored spelling restates the kept canonical edge of the same semantic family; removing it leaves the relationship stated exactly once.",evidence:[`keep: ${nn(t)}`,`group: ${be(e)}`],confidence:"high"}))}function Qs(e,t){if(e.code==="duplicate_edge")return e.sample.flatMap(s=>Ys(t.get(s)));let n=Xs[e.code];return e.sample.map(s=>({op:n.op,code:e.code,subject:s,rationale:n.rationale,evidence:[e.policy],confidence:n.confidence}))}function sn(e,t={}){let{redundancyLimit:n,...s}=t,r=_e(e,s),i=new Map(Ge(e).map(d=>[be(d),d])),o=r.findings.flatMap(d=>Qs(d,i)),a=r.findings.some(d=>d.sample_truncated);t.signal?.throwIfAborted();let c=we(e.graph,{limit:n??t.maxSampleSize??25,...t.signal===void 0?{}:{signal:t.signal}});for(let d of c.value)o.push({op:"remove",code:"redundant_edge",subject:`${d.edge.source} -> ${d.edge.target} (${d.edge.kind})`,rationale:"The stored edge is implied by a longer same-family witness path; shortcut edges are sometimes deliberate emphasis, so confirm intent before removing.",evidence:[`witness: ${d.witness.join(" -> ")}`],confidence:"medium"});return a=a||c.meta.truncated,{steps:o,report:r,truncated:a,cost:{visitedNodes:c.meta.visitedNodes,inspectedEdges:c.meta.inspectedEdges}}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a3535267-c69a-5a44-bdf9-02925e02aaeb")}catch{}})();var Zs=["tree","graph","context"],er=["none","repeated"],tr=["outgoing","incoming","both"],nr=32,sr=200,rr=400,ir=16e3;function or(e){let t=e?.trim().toLowerCase()??"tree";if(Zs.includes(t))return t;throw new w(`Invalid --format value "${e}". Use "tree", "graph", or "context".`,y.USAGE)}function I(e,t){if(e===void 0)return;let n=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(n)||n<1)throw new w(`Invalid --${t} value "${e}". Use a positive integer.`,y.USAGE);return n}function Ee(e){if(e===void 0)return;let t=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(t)||t<0)throw new w(`Invalid --max-depth value "${e}". Use a non-negative integer.`,y.USAGE);return t}function ar(e){let t=e?.trim().toLowerCase()??"none";if(er.includes(t))return t;throw new w(`Invalid --collapse value "${e}". Use "none" or "repeated".`,y.USAGE)}function Ye(e){let t=e?.trim().toLowerCase()??"both";if(tr.includes(t))return t;throw new w(`Invalid --direction value "${e}". Use "outgoing", "incoming", or "both".`,y.USAGE)}function Qe(e,t=k()){if(e===void 0)return;let n=(Array.isArray(e)?e:[e]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0);if(n.length===0)return;let s=new Set;for(let r of n){let i=t.resolve(r);if(!i){let o=t.list().map(a=>a.kind).join(", ");throw new w(`Invalid --kind value "${r}". Registered kinds: ${o}.`,y.USAGE)}s.add(i.kind)}return[...s].sort()}function cr(e){if(!e||e.length===0)return[];let t=e.map(({id:s,kind:r})=>({id:s.trim(),kind:r.trim().toLowerCase()})).sort((s,r)=>{let i=s.kind.localeCompare(r.kind);return i!==0?i:s.id.localeCompare(r.id)}),n=new Map;for(let s of t){let r=`${s.kind.toLowerCase()}::${s.id.toLowerCase()}`;n.has(r)||n.set(r,{id:s.id,kind:s.kind})}return[...n.values()]}function dr(e){return{id:e.id,title:e.title,type:e.type,status:e.status,dependencies:cr(e.dependencies)}}function ur(e){return Q(new TextEncoder().encode(JSON.stringify({...e,dependencies:void 0})).byteLength)}function lr(e,t,n,s,r,i,o,a,c){for(let d of t.dependencies){let u=Math.max(1,Math.ceil(JSON.stringify({from:e.id,to:d.id,kind:d.kind}).length/3));if(a.nodes>=a.nodeLimit){e.truncated=!0,a.reasons.add("node_limit");break}if(a.edges>=a.edgeLimit){e.truncated=!0,a.reasons.add("edge_limit");break}if(a.estimatedTokens+u>=a.tokenBudget){e.truncated=!0,a.reasons.add("token_budget");break}a.edges+=1,a.estimatedTokens+=u,e.dependencies.push(on(d.id,n,s,r,i,o,a,c+1,d.kind))}}function fr(e,t,n,s,r,i,o,a){return o.estimatedTokens>=o.tokenBudget&&t?.dependencies.length?(e.truncated=!0,o.reasons.add("token_budget"),!0):!t||e.cycle?!0:s!==void 0&&a>=s?(t.dependencies.length>0&&(e.truncated=!0,o.reasons.add("max_depth")),!0):r==="repeated"&&i.has(n)?(e.collapsed=!0,!0):!1}function on(e,t,n,s,r,i,o,a=0,c){let d=e.trim().toLowerCase(),u=t.get(d),l={id:u?.id??e,title:u?.title,type:u?.type,status:u?.status,via:c,missing:!u,cycle:n.has(d),dependencies:[]};if(o.nodes+=1,o.estimatedTokens+=ur(l),fr(l,u,d,s,r,i,o,a))return l;r==="repeated"&&i.add(d);let f=new Set(n);return f.add(d),lr(l,u,t,f,s,r,i,o,a),l}function rn(e,t){return!e||e.missing&&!t.missing?t:{...e,title:e.title??t.title,type:e.type??t.type,status:e.status??t.status}}function pr(e){let t=new Map,n=new Map,s=[e];for(;s.length>0;){let a=s.pop();t.set(a.id,rn(t.get(a.id),{id:a.id,title:a.title,type:a.type,status:a.status,missing:a.missing}));for(let c of a.dependencies){t.set(c.id,rn(t.get(c.id),{id:c.id,title:c.title,type:c.type,status:c.status,missing:c.missing}));let d=c.via??"related",u=`${a.id}::${c.id}::${d}`;n.has(u)||n.set(u,{from:a.id,to:c.id,kind:d}),c.cycle||s.push(c)}}let r=[...t.values()].sort((a,c)=>a.id.localeCompare(c.id)),i=[...n.values()].sort((a,c)=>{let d=a.from.localeCompare(c.from);if(d!==0)return d;let u=a.to.localeCompare(c.to);return u!==0?u:a.kind.localeCompare(c.kind)}),o=r.filter(a=>a.missing).map(a=>a.id);return{root_id:e.id,nodes:r,edges:i,missing_ids:o}}function an(e,t,n){let s=new Set,r=new Set,i=new Set,o=new Set,a=[{id:e,depth:0}],c=0;for(;c<a.length;){let d=a[c++],u=d.id.trim().toLowerCase();s.add(u);let l=t.get(u);if(!l){i.add(u);continue}if(!(n!==void 0&&d.depth>=n)&&!o.has(u)){o.add(u);for(let f of l.dependencies)r.add(`${u}::${f.id.trim().toLowerCase()}::${f.kind}`),a.push({id:f.id,depth:d.depth+1})}}return{node_count:s.size,edge_count:r.size,edge_basis:"deduplicated_directed",missing_count:i.size}}function hr(e,t=k()){let n=Ee(e.maxDepth),s=I(e.nodeLimit,"node-limit"),r=I(e.edgeLimit,"edge-limit"),i=I(e.tokenBudget,"token-budget"),o=Qe(e.kind,t);return{direction:Ye(e.direction),...o===void 0?{}:{kinds:o},...n===void 0?{}:{maxDepth:n},...s===void 0?{}:{nodeLimit:s},...r===void 0?{}:{edgeLimit:r},...i===void 0?{}:{tokenBudget:i},...e.cursor?.trim()?{cursor:e.cursor.trim()}:{}}}function gr(e,t,n,s){return qt(e.graph,t,e.details.map(r=>r.id===t&&s.length>0?{...r,evidence:s}:r),n)}function Xe(e,t,n,s){for(let r of n.slice(0,s)){let i=r?.trim();i&&e.push(`${t}:${i}`)}}async function mr(e,t,n,s){let r=await ct(e,t,n.id_prefix,n.item_format,s);if(!r)return[];let{document:i}=await dt(r,{schema:n.schema}),o=i.metadata,a=o.files??[],c=o.tests??[],d=o.docs??[],u=[["files",a.length],["tests",c.length],["docs",d.length],["comments",(o.comments??[]).length],["notes",(o.notes??[]).length],["learnings",(o.learnings??[]).length]];if(u.every(([,f])=>f===0))return[];let l=[`linked:${u.map(([f,p])=>`${f}=${p}`).join(",")}`];return Xe(l,"file",a.map(f=>f.path),3),Xe(l,"test",c.map(f=>f.command??f.path),2),Xe(l,"doc",d.map(f=>f.path),2),l}function yr(e){let{canonicalId:t,context:n,missingCount:s,missingReferences:r,referenceLimit:i,summaryOnly:o}=e;return{id:t,format:"context",node_count:n.nodes.length+1,edge_count:n.edges.length,edge_basis:"deduplicated_directed",missing_count:s,missing_scope:"traversal",missing_reference_count:r.length,...o?{}:{missing_references:r.slice(0,i),context:n}}}function wr(e){let{row:t,missingReachableSet:n,packetIds:s,filteredKinds:r,registry:i}=e;if(t.no_active_blocker_sentinel||!n.has(t.target_id.trim().toLowerCase())||!s.has(t.holder_id))return!1;if(r===void 0)return!0;let o=i.resolve(t.kind);return o!==void 0&&(r.has(o.kind)||o.inverse!==void 0&&r.has(o.inverse))}function cn(e,t,n){let s;for(;;){let r=Q(new TextEncoder().encode(De(Re("deps",e),t)).byteLength);if(r===s)return r;n(r),s=r}}function br(e){return e instanceof TypeError&&e.message.startsWith("Relationship context tokenBudget cannot fit ")}function _r(e){try{return gr(e.assembly,e.canonicalId,{...e.contextOptions,...e.internalTokenBudget===void 0?{}:{tokenBudget:e.internalTokenBudget}},e.rootEvidence)}catch(t){if(e.smallestResult!==void 0&&br(t))return e.smallestResult;throw t}}function vr(e){let{assembly:t,canonicalId:n,contextOptions:s,rootEvidence:r,summaryOnly:i,outputFormat:o,missingCount:a,missingReferences:c}=e,u=s.edgeLimit??40,l=s.tokenBudget,f,p;for(;;){let h=_r({assembly:t,canonicalId:n,contextOptions:s,internalTokenBudget:l,rootEvidence:r,smallestResult:p});if("format"in h)return h;let g=h;f??=g.meta.tokenBudget,l??=f;let m=yr({canonicalId:n,context:g,missingCount:a,missingReferences:c,referenceLimit:u,summaryOnly:i});if(p=m,i||(g.meta.tokenBudget=f,g.meta.usedTokens=cn(N(m,!1),o,_=>{g.meta.usedTokens=_}),g.meta.usedTokens<=f))return m;if(u>0){u-=1;continue}let b=l,x=b*f/g.meta.usedTokens;l=Math.min(b-1,Math.max(1,Math.floor(x*.9)))}}function kr(e){let{assembly:t,canonicalId:n,options:s,rootEvidence:r,summaryOnly:i,outputFormat:o}=e,a=hr(s,t.graph.registry()),c=t.graph.closure(n,{direction:a.direction,...a.kinds===void 0?{}:{kinds:a.kinds},maxDepth:a.maxDepth??3}),d=c.value.filter(g=>t.missingIdSet.has(g.toLowerCase())),u=new Set(d.map(g=>g.toLowerCase())),l=t.graph.registry(),f=a.kinds?new Set(a.kinds.map(g=>l.require(g).kind)):void 0,p=new Set([n,...c.value]),h=[...t.dangling.active,...t.dangling.legacy_terminal].filter(g=>wr({row:g,missingReachableSet:u,packetIds:p,filteredKinds:f,registry:l}));return vr({assembly:t,canonicalId:n,contextOptions:a,rootEvidence:r,summaryOnly:i,outputFormat:o,missingCount:d.length,missingReferences:h})}function xr(e){let t=[e],n;for(;t.length>0;){let s=t.pop();s.dependencies.length>0&&(n=s,t.push(...s.dependencies))}return n?(n.dependencies.pop(),n.truncated=!0,!0):!1}function Er(e,t,n,s,r,i,o){let a=r??nr,c=I(n.nodeLimit,"node-limit")??sr,d=I(n.edgeLimit,"edge-limit")??rr,u=I(n.tokenBudget,"token-budget")??ir,l={nodeLimit:c,edgeLimit:d,tokenBudget:u,nodes:0,edges:0,estimatedTokens:0,reasons:new Set},f=on(e,s,new Set,a,t==="graph"?"repeated":i,new Set,l),p=an(e,s,void 0),h;for(;;){let g=pr(f),m=l.reasons.size===0?void 0:{reasons:[...l.reasons].sort(),limits:{max_depth:a,node_limit:c,edge_limit:d,token_budget:u},estimated_tokens:0,total_node_count:p.node_count,total_edge_count:p.edge_count,omitted_node_count:Math.max(0,p.node_count-g.nodes.length),omitted_edge_count:Math.max(0,p.edge_count-g.edges.length)},b={id:e,format:t,node_count:g.nodes.length,edge_count:g.edges.length,edge_basis:"deduplicated_directed",missing_count:g.missing_ids.length,...m?{truncation:m}:{}};if(h=t==="tree"?{...b,tree:f}:{...b,graph:g},(h.truncation===void 0?Q(new TextEncoder().encode(De(Re("deps",N(h,!1)),o)).byteLength):cn(N(h,!1),o,_=>{h.truncation.estimated_tokens=_}))<=u)return h;if(!xr(f))return l.reasons.add("token_budget"),h;l.reasons.add("token_budget")}}function N(e,t){let n={name:e.format==="tree"?"dependency_tree":e.format==="graph"?"dependency_graph":"relationship_context",restore_with:"--full"};return{...e,projection:{mode:t?"summary":"full",declared_field_groups:[n],included_field_groups:t?[]:[n.name]}}}async function Hi(e,t,n){let s=H(process.cwd(),n.path);if(!await K(J(s)))throw new w(`Tracker is not initialized at ${s}. Run pm init first.`,y.NOT_FOUND);let r=or(t.format),i=Ee(t.maxDepth),o=ar(t.collapse);Z(t.summary===!0,t.full===!0,"--summary");let a=t.summary===!0,c=await se(s),d=W(c,te()),u=await re(s,c.item_format,d.type_to_folder,void 0,c.schema),l=Y(c.schema),f=new Map(u.map(h=>[h.id.trim().toLowerCase(),dr(h)])),p=lt(u,h=>F(h,l));for(let h of[...p.active,...p.legacy_terminal]){let g=f.get(h.holder_id.trim().toLowerCase()),m=h.kind.trim().toLowerCase();g&&!g.dependencies.some(b=>b.id.trim().toLowerCase()===h.target_id.trim().toLowerCase()&&b.kind===m)&&g.dependencies.push({id:h.target_id,kind:m})}if(!f.has(e.trim().toLowerCase()))throw new w(`Item ${e} not found`,y.NOT_FOUND);if(r==="context"){let h=f.get(e.trim().toLowerCase()).id,g=a?[]:await mr(s,h,c,d.type_to_folder),m=_=>F(_,l),b=A(),x=ke().lookup(s,ve(u,m,b),()=>ie(u,m,b));return N(kr({assembly:x.assembly,canonicalId:h,options:t,rootEvidence:g,summaryOnly:a,outputFormat:n.json===!0?"json":"toon"}),a)}return a?N({id:e,format:r,...an(e,f,i)},!0):N(Er(e,r,t,f,i,o,n.json===!0?"json":"toon"),!1)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ab1a6d49-f6e6-5a02-a948-8fd6e9be265a")}catch{}})();var fn=new Set(["ancestors","descendants","predecessors","successors","paths","impact","dominators"]),S=10;function dn(e,t,n){return{...e,projection:{mode:t?"summary":"full",declared_field_groups:n===void 0?[]:[{name:n,restore_with:"--full"}],included_field_groups:n===void 0||t?[]:[n]}}}function un(e){return e===void 0?[]:(Array.isArray(e)?e:[e]).flatMap(t=>t.split(",")).map(t=>t.trim()).filter(t=>t.length>0)}function Ir(e,t,n){let s=e.trim().toLowerCase();if(!Se.includes(s))throw new w(`Invalid graph subcommand "${e}". Use one of: ${Se.join(", ")}.`,y.USAGE);let r=s;if(fn.has(r)&&!t?.trim())throw new w(`graph ${r} requires an item id.`,y.USAGE);if(r==="paths"&&!n?.trim())throw new w("graph paths requires a source and a target item id.",y.USAGE);return r}function Ze(e){throw e instanceof TypeError?new w(e.message,y.USAGE):e}function et(e){return{truncated:e.truncated,cost:{visited_nodes:e.visitedNodes,inspected_edges:e.inspectedEdges}}}function ln(e,t){let n=t.trim().toLowerCase();for(let s of e.details)if(s.id.trim().toLowerCase()===n&&!e.missingIdSet.has(s.id.toLowerCase()))return s.id;throw new w(`Item ${t} not found`,y.NOT_FOUND)}function Tr(e,t,n){let s={ancestors:xt,descendants:Et,predecessors:It,successors:Tt}[e],r;try{r=s(n.assembly.graph,t,{...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.limit===void 0?{}:{limit:n.limit},...n.after===void 0?{}:{after:n.after}})}catch(o){Ze(o)}let i=et(r.meta);return{subcommand:e,root:t,count:r.value.length,...i,...r.meta.nextCursor===void 0?{}:{next_cursor:r.meta.nextCursor},...n.summary?{}:{ids:r.value}}}function Sr(e,t,n){let s=St(n.assembly.graph,e,t,{direction:n.direction,...n.kinds===void 0?{}:{kinds:n.kinds},...n.maxDepth===void 0?{}:{maxDepth:n.maxDepth},...n.maxPaths===void 0?{}:{maxPaths:n.maxPaths}});return{subcommand:"paths",root:e,target:t,direction:n.direction,count:s.value.length,...et(s.meta),...n.summary?{}:{paths:s.value.map(r=>({nodes:r.nodes,kinds:r.edges.map(i=>i.kind),length:r.length}))}}}function Rr(e,t){let n;try{n=bt(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth},...t.unbounded?{}:{limit:t.limit??S},...t.after===void 0?{}:{after:t.after}})}catch(s){Ze(s)}return{subcommand:"impact",root:e,direction:t.direction,count:n.affected.length,truncated:n.truncated,...n.nextCursor===void 0?{}:{next_cursor:n.nextCursor},cost:{visited_nodes:n.cost.visitedNodes,inspected_edges:n.cost.inspectedEdges},...t.summary?{}:{affected:n.affected}}}function Dr(e){let t=e.assembly.graph,n=e.limit??S,s=ue(t,{registry:t.registry()}),r=_t(t);return{subcommand:"analyze",node_count:t.nodes().length,edge_count:t.edges().length,edge_basis:"deduplicated_directed",sample_limit:n,execution:{acyclic:s.acyclic,ordered_node_count:s.order.length,layer_count:s.layers.length,frontier_count:s.frontier.length,critical_path_length:s.criticalPathLength,cycle_count:s.cycles.length,...e.summary?{}:{frontier:s.frontier.slice(0,n),critical_path:s.criticalPath.slice(0,n),cycles:s.cycles.slice(0,n)}},knowledge:{component_count:r.components.length,largest_component_size:r.components[0]?.length??0,orphan_count:r.orphans.length,...e.summary?{}:{orphans:r.orphans.slice(0,n),hubs:r.hubs.slice(0,n)}}}}function Cr(e,t){let n=_e(e.assembly,{isTerminal:t,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),s={},r={},i={},o={};for(let a of n.findings)s[a.severity]=(s[a.severity]??0)+1,r[a.code]=(r[a.code]??0)+1,i[a.severity]=(i[a.severity]??0)+a.count,o[a.code]=(o[a.code]??0)+a.count;return{subcommand:"audit",finding_count:n.findings.length,findings_by_severity:s,findings_by_code:r,affected_subjects_by_severity:i,affected_subjects_by_code:o,profile:n.profile,...e.summary?{}:{findings:n.findings}}}function Lr(e){let t=e.limit??S,n={};e.kinds!==void 0&&(n.kinds=e.kinds);let s=Dt(e.assembly.graph,n),r=s.value;return{subcommand:"communities",community_count:r.communities.length,largest_community_size:r.communities[0]?.size??0,iterations:r.iterations,converged:r.converged,truncated:!r.converged||r.communities.length>t,cost:{visited_nodes:s.meta.visitedNodes,inspected_edges:s.meta.inspectedEdges},...e.summary?{}:{communities:r.communities.slice(0,t).map(i=>({representative:i.representative,size:i.size,members:i.members.slice(0,t)}))}}}function Ar(e){let t;try{t=we(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds},...e.maxDepth===void 0?{}:{maxDepth:e.maxDepth},...e.limit===void 0?{}:{limit:e.limit}})}catch(n){Ze(n)}return{subcommand:"redundancy",redundant_count:t.value.length,...et(t.meta),...e.summary?{}:{redundant:t.value.map(n=>({source:n.edge.source,target:n.edge.target,kind:n.edge.kind,witness:n.witness}))}}}function Nr(e,t){let n=t.limit??S,s=Ct(t.assembly.graph,e,{direction:t.direction,...t.kinds===void 0?{}:{kinds:t.kinds},...t.maxDepth===void 0?{}:{maxDepth:t.maxDepth}}),r=s.value.rows.filter(i=>i.dominatedCount>0);return{subcommand:"dominators",root:e,direction:t.direction,reachable_count:s.value.reachableCount,bottleneck_count:r.length,truncated:s.meta.truncated||r.length>n,cost:{visited_nodes:s.meta.visitedNodes,inspected_edges:s.meta.inspectedEdges},...t.summary?{}:{bottlenecks:r.slice(0,n).map(i=>({id:i.id,idom:i.idom,dominated_count:i.dominatedCount}))}}}function Or(e){let t=e.limit??S,n=Wt(e.assembly.graph),s=n.rows.filter(r=>r.critical).length;return{subcommand:"slack",acyclic:n.acyclic,makespan:n.makespan,scheduled_count:n.scheduledCount,critical_count:s,critical_path_length:n.criticalPathLength,cycle_count:n.cycles.length,truncated:n.rows.length>t,...e.summary?{}:{critical_path:n.criticalPath,rows:n.rows.slice(0,t).map(r=>({id:r.id,earliest_start:r.earliestStart,latest_start:r.latestStart,slack:r.slack,critical:r.critical}))}}}function Mr(e){let t=e.limit??S,n=Vt(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds}}),s=n.value;return{subcommand:"centrality",node_count:s.nodeCount,edge_count:s.edgeCount,edge_basis:"simple_undirected",truncated:s.rows.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{rows:s.rows.slice(0,t).map(r=>({id:r.id,degree:r.degree,in_degree:r.inDegree,out_degree:r.outDegree,betweenness:r.betweenness,closeness:r.closeness}))}}}function $r(e){let t=e.limit??S,n=Kt(e.assembly.graph,{...e.kinds===void 0?{}:{kinds:e.kinds}}),{articulationPoints:s,bridges:r}=n.value;return{subcommand:"articulation",articulation_count:s.length,bridge_count:r.length,truncated:s.length>t||r.length>t,cost:{visited_nodes:n.meta.visitedNodes,inspected_edges:n.meta.inspectedEdges},...e.summary?{}:{articulation_points:s.slice(0,t),bridges:r.slice(0,t)}}}function Pr(e,t){let n=e.limit??S,s=sn(e.assembly,{isTerminal:t,redundancyLimit:n,...e.sample===void 0?{}:{maxSampleSize:e.sample},...e.exemptIsolates.length===0?{}:{exemptIsolates:e.exemptIsolates},...e.exemptIsolateTypes.length===0?{}:{isolateExemptTypes:e.exemptIsolateTypes}}),r={},i={};for(let o of s.steps)r[o.op]=(r[o.op]??0)+1,i[o.code]=(i[o.code]??0)+1;return{subcommand:"plan",step_count:s.steps.length,steps_by_op:r,steps_by_code:i,finding_count:s.report.findings.length,truncated:s.truncated||s.steps.length>n,cost:{visited_nodes:s.cost.visitedNodes,inspected_edges:s.cost.inspectedEdges},...e.summary?{}:{steps:s.steps.slice(0,n)}}}function pn(e,t,n,s){return JSON.stringify({subcommand:e,root:t??null,target:n??null,kinds:s.kinds??null,maxDepth:s.maxDepth??null,limit:s.limit??null,after:s.after??null,direction:s.direction,maxPaths:s.maxPaths??null,sample:s.sample??null,exemptIsolates:[...new Set(s.exemptIsolates.map(r=>r.toLowerCase()))].sort(),exemptIsolateTypes:[...new Set(s.exemptIsolateTypes.map(r=>r.toLowerCase()))].sort(),summary:s.summary,unbounded:s.unbounded})}function hn(e,t,n,s,r){return e==="analyze"?Dr(s):e==="audit"?Cr(s,r):e==="plan"?Pr(s,r):e==="communities"?Lr(s):e==="redundancy"?Ar(s):e==="dominators"?Nr(t,s):e==="slack"?Or(s):e==="centrality"?Mr(s):e==="articulation"?$r(s):e==="paths"?Sr(t,n,s):e==="impact"?Rr(t,s):Tr(e,t,s)}function jr(e,t){if(e!=="index"&&(t.rebuild===!0||t.clear===!0))throw new w("--rebuild and --clear apply only to graph index.",y.USAGE);if(e!=="audit"&&t.saveBaseline===!0)throw new w("--save-baseline applies only to graph audit.",y.USAGE);if(e==="slack"&&t.kind!==void 0)throw new w("graph slack analyzes every ordering kind; --kind is not supported.",y.USAGE);if(t.rebuild===!0&&t.clear===!0)throw new w("graph index accepts either --rebuild or --clear, not both.",y.USAGE);if(e==="impact"&&t.full===!0&&t.limit!==void 0)throw new w("graph impact accepts either --full or --limit, not both.",y.USAGE)}async function Fr(e,t,n,s,r,i){let o="status";if(i.clear===!0&&(await He(e),o="cleared"),i.rebuild===!0){await He(e);let c=await Ke(e,t),d={assembly:n.assembly,direction:"both",exemptIsolates:[],exemptIsolateTypes:[],saveBaseline:!1,summary:!0,unbounded:!1};for(let u of["analyze","audit"])await We(e,t,c,pn(u,void 0,void 0,d),hn(u,void 0,void 0,d,r));o="rebuilt"}let a=await Zt(e,t);return{subcommand:"index",action:o,state:a.exists?a.fresh?"fresh":"stale":"absent",entry_count:a.entry_count,item_count:s,min_items_threshold:Ue,persist_enabled:Je(s,a.exists),current_fingerprint:t.slice(0,12),...a.saved_at===void 0?{}:{saved_at:a.saved_at},...a.bytes===void 0?{}:{bytes:a.bytes}}}async function Gr(e,t,n,s){let r={saved_at:new Date().toISOString(),fingerprint:t,affected_subjects_by_code:n.affected_subjects_by_code,profile:n.profile},i=await en(e);return s&&await tn(e,r),i===void 0?n:{...n,baseline:Mt(i,r)}}async function qr(e,t,n,s,r){try{await We(e,t,n,s,r)}catch{}}async function _o(e,t,n,s,r){let i=Ir(e,t,n);Z(s.summary===!0,s.full===!0,"--summary");let o=H(process.cwd(),r.path);if(!await K(J(o)))throw new w(`Tracker is not initialized at ${o}. Run pm init first.`,y.NOT_FOUND);let a=await se(o),c=W(a,te()),d=await re(o,a.item_format,c.type_to_folder,void 0,a.schema),u=Y(a.schema),l=M=>F(M,u);jr(i,s);let f=A(),p=Qe(s.kind,f),h=ke().lookup(o,ve(d,l,f),()=>ie(d,l,f)),g={assembly:h.assembly,...p===void 0?{}:{kinds:p},maxDepth:Ee(s.maxDepth),limit:I(s.limit,"limit"),after:s.after?.trim()||void 0,direction:Ye(s.direction),maxPaths:I(s.maxPaths,"max-paths"),sample:I(s.sample,"sample"),exemptIsolates:un(s.exemptIsolate),exemptIsolateTypes:un(s.exemptIsolateType),saveBaseline:s.saveBaseline===!0,summary:s.summary===!0,unbounded:s.full===!0};if(i==="index")return dn(await Fr(o,h.fingerprint,g,d.length,l,s),!1);let m=fn.has(i)?ln(g.assembly,t):void 0,b=i==="paths"?ln(g.assembly,n):void 0,x=pn(i,m,b,g),_=await Ke(o,h.fingerprint),R=_.results[x],v=h.memoize(x,()=>R!==void 0?structuredClone(R):hn(i,m,b,g,l)),U=Je(d.length,_.exists);!v.reused&&R===void 0&&U&&await qr(o,h.fingerprint,_,x,v.value);let O=v.value.subcommand==="audit"?await Gr(o,h.fingerprint,v.value,g.saveBaseline):v.value;return O.cache={fingerprint:h.fingerprint.slice(0,12),assembly:h.assemblyReused?"hit":"miss",result:v.reused?"hit":"miss",durable:R!==void 0?"hit":U?"miss":"off"},dn(O,g.summary,"result_rows")}export{Ne as a,pt as b,ue as c,bt as d,_t as e,Zr as f,xt as g,Et as h,It as i,Tt as j,St as k,ge as l,Dt as m,we as n,Ct as o,Fe as p,be as q,Ge as r,_e as s,Mt as t,ci as u,ve as v,qe as w,ke as x,pi as y,qt as z,Hi as A,Vt as B,Kt as C,Wt as D,Xt as E,Ue as F,z as G,Qt as H,Ke as I,We as J,He as K,Zt as L,Je as M,en as N,tn as O,sn as P,Ir as Q,_o as R};
8
- //# sourceMappingURL=chunk-E7OFMWGT.js.map
@@ -1,2 +0,0 @@
1
- import{Qa as x,k as L}from"./chunk-5MTKO7TV.js";import{aa as h,da as I}from"./chunk-QM2BIVK7.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="187a7342-71fc-5432-9f30-c40e444d4611")}catch{}})();var D="global";function u(t){return t?.trim().toLowerCase()===D}function G(t){let e=t?.trim();if(e)return u(e)?D:e}function j(t,e,r){let o=t.trim();return u(r)?o:x(o,e)}(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="8368a519-4c09-540e-b0fb-f74cfdc1d7b2")}catch{}})();function y(t){if(typeof t!="string")return;let e=t.trim();if(!(!e||["none","null","n/a","na"].includes(e.toLowerCase())))return e}function b(t){let e=y(t);return e?.toLowerCase()==="no-active-blocker"?void 0:e}function v(){let t=h();for(let e of L()?.relationship_kinds??[])for(let r of e.definitions)t.register(r);return t}function k(t,e){let r=t.toLowerCase(),o=e.toLowerCase();return r!==o?r<o?-1:1:t!==e?t<e?-1:1:0}function E(t){let e=new Map;for(let r of t.dependencies??[]){if(typeof r!="object"||r===null)continue;let o=r,i=y(o.id);if(!i)continue;let c=typeof o.kind=="string"?o.kind:"related",l=`${c}\0${i.toLowerCase()}`,p=e.get(l);p?p.count+=1:e.set(l,{target_id:i,kind:c,count:1})}return e}function z(t,e=r=>r==="closed"||r==="canceled"){let r=[];for(let o of t)if(!(typeof o?.id!="string"||o.id.trim().length===0))for(let i of E(o).values())i.count<2||r.push({holder_id:o.id.trim(),target_id:i.target_id,kind:i.kind,occurrences:i.count,holder_status:o.status,legacy_terminal:e(o.status)});return r.sort((o,i)=>{let c=k(o.holder_id,i.holder_id);if(c!==0)return c;let l=k(o.target_id,i.target_id);return l!==0?l:k(o.kind,i.kind)})}function T(t,e=r=>r==="closed"||r==="canceled"){let r=t.filter(s=>typeof s?.id=="string"&&s.id.trim().length>0),o=new Set(r.map(s=>s.id.trim().toLowerCase())),i=new Map,c=(s,d,f,m)=>{let n=y(d);if(!n||o.has(n.toLowerCase()))return;let a={holder_id:s.id.trim(),target_id:n,kind:f,source:m,holder_status:s.status,legacy_terminal:e(s.status),no_active_blocker_sentinel:n.toLowerCase()==="no-active-blocker"};i.set(`${a.holder_id}::${a.target_id}::${a.kind}::${a.source}`,a)};for(let s of r){c(s,s.parent,"parent","parent"),c(s,s.blocked_by,"blocked_by","blocked_by");for(let d of s.dependencies??[]){if(typeof d!="object"||d===null)continue;let f=d;u(f.source_kind)||c(s,f.id,typeof f.kind=="string"?f.kind:"related","dependency")}}let l=[...i.values()].sort((s,d)=>s.holder_id.localeCompare(d.holder_id)||s.target_id.localeCompare(d.target_id)||s.kind.localeCompare(d.kind)||s.source.localeCompare(d.source)),p=l.filter(s=>s.legacy_terminal);return{active:l.filter(s=>!s.legacy_terminal),legacy_terminal:p,no_active_blocker_sentinels:l.filter(s=>s.no_active_blocker_sentinel)}}function S(t){let e=new Map;for(let r of[...t.active,...t.legacy_terminal]){if(r.no_active_blocker_sentinel)continue;let o=r.target_id.trim(),i=o.toLowerCase();e.has(i)||e.set(i,o)}return[...e.values()].sort((r,o)=>r.localeCompare(o))}function $(t){let e=new Map;for(let r of t)for(let o of r.dependencies??[]){if(typeof o!="object"||o===null||!u(o.source_kind))continue;let i=y(o.id);i&&!e.has(i.toLowerCase())&&e.set(i.toLowerCase(),i)}return[...e.values()].sort((r,o)=>r.localeCompare(o))}function O(t,e,r){let o=r??v(),i=t.filter(n=>typeof n?.id=="string"&&n.id.trim().length>0),c=new Map(i.map(n=>[n.id.trim().toLowerCase(),n.id.trim()])),l=T(i,e),p=S(l);for(let n of p)c.set(n.toLowerCase(),n);let s=$(i),d=new Set(c.keys()),f=new Map;for(let n of s){let a=n;for(;d.has(a.toLowerCase());)a=`external:${a}`;f.set(n.toLowerCase(),a),d.add(a.toLowerCase())}let m=i.map(n=>{let a=b(n.parent),C=b(n.blocked_by),R=(n.dependencies??[]).flatMap(_=>{if(typeof _!="object"||_===null)return[];let g=_,w=b(g.id);return w?[{id:u(g.source_kind)?f.get(w.toLowerCase()):c.get(w.toLowerCase()),kind:typeof g.kind=="string"?g.kind:"related"}]:[]});return{id:n.id.trim(),...a?{parent:c.get(a.toLowerCase())}:{},...C?{blocked_by:c.get(C.toLowerCase())}:{},dependencies:R}});return{graph:I.fromItems([...m,...p.map(n=>({id:n})),...s.map(n=>({id:f.get(n.toLowerCase())}))],o),details:[...i.map(n=>({id:n.id.trim(),title:n.title,status:n.status,...typeof n.type=="string"&&n.type.trim().length>0?{type:n.type.trim()}:{}})),...p.map(n=>({id:n,title:`[missing] ${n}`,status:"missing"})),...s.map(n=>({id:f.get(n.toLowerCase()),title:`[external] ${n}`,status:"external"}))],missingIdSet:new Set(p.map(n=>n.toLowerCase())),dangling:l,duplicateRows:z(i,e)}}export{G as a,j as b,b as c,v as d,z as e,T as f,S as g,O as h};
2
- //# sourceMappingURL=chunk-I5F5UK3Q.js.map
@@ -1,5 +0,0 @@
1
- import{X as we,l as pe,t as T,u as ye,v as ge,w as _e}from"./chunk-BOGRY7M6.js";import{e as fe,f as he,g as me}from"./chunk-DQ4PLKEE.js";import{a as M}from"./chunk-OYTK4VNH.js";import{Aa as j,Ba as I,K as re,Ka as x,L as S,M as D,ab as ue,ba as $,da as ne,db as le,ea as ie,fa as oe,ga as se,k as F,la as ae,n as te,ta as O,wa as ce,xa as de,za as B}from"./chunk-5MTKO7TV.js";import{D as L,J as C,M as k,h as Z,p as E,q as ee}from"./chunk-QM2BIVK7.js";import{Y as y,Z as g,aa as w}from"./chunk-CL75YW32.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="582576df-8dbe-5f93-890b-5d872669dfe8")}catch{}})();function U(e,t){let n=$(e);if(n)throw new g(`History merge input (${t}) contains unresolved conflict markers at line ${n.line}. Merge drivers must receive clean per-side versions.`,y.GENERIC_FAILURE);let r=[];for(let[o,a]of e.split(/\r?\n/).entries()){let i=a.trim();if(i)try{let d=JSON.parse(i);if(typeof d!="object"||d===null||Array.isArray(d))throw new TypeError("history entry must be an object");r.push(d)}catch{throw new g(`History merge input (${t}) contains invalid JSON at line ${o+1}.`,y.GENERIC_FAILURE)}}return r}function v(e){return w({ts:e.ts,author:e.author,op:e.op,patch:e.patch,message:e.message??null})}function Ne(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&v(e[r])===v(t[r]);)r+=1;return r}function Re(e,t,n){U(e,"base");let r=U(t,"ours"),o=U(n,"theirs"),a=Ne(r,o);if(a===r.length&&a===o.length)return{merged:I(r),strategy:"identical",common_entries:a,entries_from_ours:0,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(a===o.length)return{merged:I(r),strategy:"fast_forward_ours",common_entries:a,entries_from_ours:r.length-a,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(a===r.length)return{merged:I(o),strategy:"fast_forward_theirs",common_entries:a,entries_from_ours:0,entries_from_theirs:o.length-a,entries_total:o.length,reanchored:!1};let i=r.slice(a),d=new Set(i.map(v)),c=o.slice(a).filter(u=>!d.has(v(u))),h=[...i,...c].sort((u,l)=>{let f=D(u.ts,l.ts);if(f!==0)return f;let m=d.has(v(u)),p=d.has(v(l));return m!==p?Number(p)-Number(m):v(u).localeCompare(v(l))}),s=j([...r.slice(0,a),...h]);return{merged:I(s.entries),strategy:"union_reanchor",common_entries:a,entries_from_ours:i.length,entries_from_theirs:c.length,entries_total:s.entries.length,reanchored:!0}}function J(e,t){let n=$(e);if(n)throw new g(`Relationship merge input (${t}) contains unresolved conflict markers at line ${n.line}. Merge drivers must receive clean per-side versions.`,y.GENERIC_FAILURE);let r=[];for(let[o,a]of e.split(/\r?\n/).entries()){let i=a.trim();if(!i)continue;let d;try{d=JSON.parse(i)}catch{throw new g(`Relationship merge input (${t}) contains invalid JSON at line ${o+1}.`,y.GENERIC_FAILURE)}if(typeof d!="object"||d===null||Array.isArray(d)||typeof d.eventId!="string"||typeof d.sequence!="number")throw new g(`Relationship merge input (${t}) line ${o+1} is not a relationship event (eventId + sequence required).`,y.GENERIC_FAILURE);r.push(d)}return r}function H(e){return e.length===0?"":`${e.map(t=>JSON.stringify(t)).join(`
2
- `)}
3
- `}function Pe(e){return e.map((t,n)=>({...t,sequence:n+1}))}function ve(e,t,n){J(e,"base");let r=J(t,"ours"),o=J(n,"theirs"),a=Math.min(r.length,o.length),i=0;for(;i<a&&r[i].eventId===o[i].eventId;)i+=1;if(i===r.length&&i===o.length)return{merged:H(r),strategy:"identical",common_entries:i,entries_from_ours:0,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(i===o.length)return{merged:H(r),strategy:"fast_forward_ours",common_entries:i,entries_from_ours:r.length-i,entries_from_theirs:0,entries_total:r.length,reanchored:!1};if(i===r.length)return{merged:H(o),strategy:"fast_forward_theirs",common_entries:i,entries_from_ours:0,entries_from_theirs:o.length-i,entries_total:o.length,reanchored:!1};let d=r.slice(i),c=new Set(d.map(l=>l.eventId)),h=o.slice(i).filter(l=>!c.has(l.eventId)),s=[...d,...h].sort((l,f)=>{if(l.timestamp!==void 0&&f.timestamp!==void 0){let _=D(l.timestamp,f.timestamp);if(_!==0)return _}else{if(l.timestamp===void 0&&f.timestamp!==void 0)return 1;if(l.timestamp!==void 0)return-1}let m=c.has(l.eventId),p=c.has(f.eventId);return m!==p?Number(p)-Number(m):0}),u=Pe([...r.slice(0,i),...s]);return{merged:H(u),strategy:"union_reanchor",common_entries:i,entries_from_ours:d.length,entries_from_theirs:h.length,entries_total:u.length,reanchored:!0}}var De=["tags","dependencies","comments","notes","learnings","files","tests","test_runs","docs","reminders","events"],$e=["updated_at"];function b(e,t){return w(e??null)===w(t??null)}function je(e,t,n){let r=s=>Array.isArray(s)?s:[],o=new Set(r(e).map(s=>w(s))),a=r(t),i=new Set(a.map(s=>w(s))),d=r(n),c=new Set(d.map(s=>w(s))),h=a.filter(s=>{let u=w(s);return!o.has(u)||c.has(u)});for(let s of d){let u=w(s);!i.has(u)&&!o.has(u)&&h.push(s)}return h}function Me(e,t){return D(String(e),String(t))>=0?e:t}function q(e,t,n,r){return b(t,n)?{value:t,from_theirs:!1,conflict:!1}:b(e,t)?{value:n,from_theirs:!0,conflict:!1}:b(e,n)?{value:t,from_theirs:!1,conflict:!1}:{value:r==="theirs"?n:t,from_theirs:r==="theirs",conflict:!0}}function G(e){return{...e.metadata}}function z(e,t,n){try{return oe(ne(e,n),n)}catch(r){throw new g(`Item merge input (${t}) is not a readable item document: ${String(r)}`,y.GENERIC_FAILURE)}}function He(e,t,n,r){let o=new Set(De),a=new Set($e),i=[...new Set([...Object.keys(t),...Object.keys(n)])].sort((c,h)=>c.localeCompare(h)),d={merged:{},conflictFields:[],fieldsFromTheirs:[],unionFields:[],conflictDecisions:[]};for(let c of i){let h=e[c],s=t[c],u=n[c];if(o.has(c)){let f=je(h,s,u);d.merged[c]=f,b(f,s)||d.unionFields.push(c);continue}if(a.has(c)){d.merged[c]=Me(s,u);continue}let l=q(h,s,u,r);l.value!==void 0&&(d.merged[c]=l.value),l.conflict?(d.conflictFields.push(c),d.conflictDecisions.push({field:c,base:h,ours:s,theirs:u,retained:l.value,discarded:r==="theirs"?s:u})):l.from_theirs&&d.fieldsFromTheirs.push(c)}return d}function Ie(e,t,n,r={}){let o=r.preferred??"ours",a=e.trim().length>0,i=z(t,"ours",r),d=z(n,"theirs",r),c=a?z(e,"base",r):i,h=a?G(c):{},s=G(i),u=G(d),{merged:l,conflictFields:f,fieldsFromTheirs:m,unionFields:p,conflictDecisions:_}=He(h,s,u,o),R=q(a?c.body:"",i.body,d.body,o);return R.conflict?(f.push("body"),_.push({field:"body",base:a?c.body:"",ours:i.body,theirs:d.body,retained:R.value,discarded:o==="theirs"?i.body:d.body})):R.from_theirs&&m.push("body"),{merged:ie({metadata:l,body:R.value},r),conflict_fields:f,fields_from_theirs:m,union_fields:p,conflict_decisions:_,preferred:o}}function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function W(e,t){let n=$(e);if(n)throw new g(`JSON merge input (${t}) contains unresolved conflict markers at line ${n.line}.`,y.GENERIC_FAILURE);if(e.trim().length!==0)try{return JSON.parse(e)}catch{throw new g(`JSON merge input (${t}) is not valid JSON.`,y.GENERIC_FAILURE)}}function Le(e,t,n){if(!Array.isArray(e)||!Array.isArray(t)||!Array.isArray(n))return null;let r=h=>{let s=new Map;for(let u of h){let l=w(u);s.set(l,(s.get(l)??0)+1)}return s},o=r(e),a=r(t),i=r(n);for(let[h,s]of o)if((a.get(h)??0)<s||(i.get(h)??0)<s)return null;let d=new Map(a),c=[];for(let h of n){let s=w(h),u=d.get(s)??0;u>0?d.set(s,u-1):c.push(h)}return{merged:[...t,...c],acceptedTheirs:c.length>0}}function Be(e,t,n,r,o,a,i){if(!V(t)||!V(n))return null;let d=V(e)?e:{},c={},h=[...new Set([...Object.keys(t),...Object.keys(n)])].sort((s,u)=>s.localeCompare(u));for(let s of h){let u=o.length>0?`${o}.${s}`:s,l=Ue(d,t,n,s,r,u,a,i);l!==void 0&&(c[s]=l)}return c}function be(e,t,n,r,o,a,i){if(b(t,n))return t;let d=Le(e,t,n);if(d!==null)return d.acceptedTheirs&&i.push(o),d.merged;let c=Be(e,t,n,r,o,a,i);if(c!==null)return c;let h=q(e,t,n,r);return h.conflict?a.push(o):h.from_theirs&&i.push(o),h.value}function Ue(e,t,n,r,o,a,i,d){let c=Object.prototype.hasOwnProperty.call(t,r),h=Object.prototype.hasOwnProperty.call(n,r),s=Object.prototype.hasOwnProperty.call(e,r);if(c&&h)return be(e[r],t[r],n[r],o,a,i,d);if(c){if(s&&b(e[r],t[r])){d.push(a);return}return s?(i.push(a),o==="theirs"?void 0:t[r]):t[r]}if(!(s&&b(e[r],n[r])))return s?(i.push(a),o==="theirs"?n[r]:void 0):(d.push(a),n[r])}function Ee(e,t,n,r={}){let o=r.preferred??"ours",a=W(e,"base"),i=W(t,"ours"),d=W(n,"theirs"),c=[],h=[],s=be(a,i,d,o,"",c,h);return{merged:`${JSON.stringify(s??null,null,2)}
4
- `,conflict_paths:c,paths_from_theirs:h,preferred:o}}import{readFile as Je,writeFile as Ge}from"node:fs/promises";import ze from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9426a3fa-19bd-598f-90f6-df26a03bd9eb")}catch{}})();var Se=["item","history","relationship","json"];function Ve(e){let t=e.trim().toLowerCase();if(Se.includes(t))return t;throw new g(`Unknown merge artifact "${e}". Supported values: ${Se.join(", ")}.`,y.USAGE)}function We(e){if(e===void 0)return"ours";let t=e.trim().toLowerCase();if(t==="ours"||t==="theirs")return t;throw new g(`Unknown --prefer value "${e}". Supported values: ours, theirs.`,y.USAGE)}async function X(e,t){try{return await Je(e,"utf8")}catch{throw new g(`Cannot read merge ${t} file at ${e}.`,y.NOT_FOUND)}}async function qe(e){let t=C(process.cwd(),e.path);return await E(k(t))?x(t):null}function Xe(e,t){return e.endsWith(".md")?"json_markdown":e.endsWith(".toon")?"toon":t?.item_format??"toon"}async function It(e,t){let n=Ve(e.artifact),r=We(e.prefer),o=ze.resolve(e.outputPath??e.oursPath),[a,i,d]=await Promise.all([X(e.basePath,"base"),X(e.oursPath,"ours"),X(e.theirsPath,"theirs")]),c,h,s=[],u={};if(n==="history"){let f=Re(a,i,d);c=f.merged,u.history={strategy:f.strategy,common_entries:f.common_entries,entries_from_ours:f.entries_from_ours,entries_from_theirs:f.entries_from_theirs,entries_total:f.entries_total,reanchored:f.reanchored}}else if(n==="relationship"){let f=ve(a,i,d);c=f.merged,u.relationship={strategy:f.strategy,common_entries:f.common_entries,entries_from_ours:f.entries_from_ours,entries_from_theirs:f.entries_from_theirs,entries_total:f.entries_total,reanchored:f.reanchored}}else if(n==="item"){let f=await qe(t),m=Ie(a,i,d,{format:Xe(e.itemPath??o,f),schema:f?.schema,extensionFieldNames:Z(F()),preferred:r});c=m.merged,s.push(...m.conflict_fields),u.item={fields_from_theirs:m.fields_from_theirs,union_fields:m.union_fields},e.itemPath!==void 0&&(h={cwd:process.cwd(),itemPath:e.itemPath,preferred:r,fieldsFromTheirs:m.fields_from_theirs,unionFields:m.union_fields,decisions:m.conflict_decisions})}else{let f=Ee(a,i,d,{preferred:r});c=f.merged,s.push(...f.conflict_paths),u.json={paths_from_theirs:f.paths_from_theirs}}if(await Ge(o,c,"utf8"),h!==void 0){let f=await ye(h);f!==null&&(u.receipt=T(f))}let l=[];return s.length>0&&l.push(`Both branches changed ${s.join(", ")}; the ${r} value was kept. Review the merged file, re-apply the losing change if needed, then "git add" it.`),n==="history"&&u.history?.reanchored&&l.push('The merged history chain was re-anchored. Run "pm validate --check-history-drift" and "pm history-repair --all" after the merge to reconcile item state with merged history.'),{ok:s.length===0,artifact:n,output_path:o,preferred:r,conflicts:s,...u,guidance:l,generated_at:S()}}import Ce from"fast-json-patch";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="dd5ab9c3-bc6f-59f1-be89-ad0ab2abe7b5")}catch{}})();function Oe(e,t){return t==="body"?e.body:e.metadata[t]}function K(e,t){if(e===void 0||Object.is(e,t))return!0;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let r=new Set;return e.every(o=>{let a=t.findIndex((i,d)=>!r.has(d)&&K(o,i));return a<0?!1:(r.add(a),!0)})}if(e===null||t===null||typeof e!="object"||typeof t!="object"||Array.isArray(t))return!1;let n=t;return Object.entries(e).every(([r,o])=>Object.hasOwn(n,r)&&K(o,n[r]))}function Ae(e,t){let n=new Set(t),r=[];for(let o=e.length-1;o>=0&&n.size>0;o-=1){let a=e[o],i=new Set;for(let c of de(a.patch))i.add(M(c.path)),c.from&&i.add(M(c.from));let d=[...n].filter(c=>i.has(c));if(d.length!==0){for(let c of d)n.delete(c);r.push({index:o+1,ts:a.ts,author:a.author,op:a.op,fields:d.sort((c,h)=>c.localeCompare(h))})}}return r.reverse()}function Ke(e,t,n){let r=Ce.compare(t,n);if(r.length===0)return;let o=new Set;for(let m of r)o.add(M(m.path));let a=new Set([...o].filter(m=>K(Oe(t,m),Oe(n,m)))),i=new Set([...o].filter(m=>!a.has(m))),d=Ae(e,i),c=Ae(e,a),h=[...o].sort((m,p)=>m.localeCompare(p)),s=[...i].sort((m,p)=>m.localeCompare(p)),u=[...a].sort((m,p)=>m.localeCompare(p)),l=[...new Set(d.map(m=>m.author))].sort((m,p)=>m.localeCompare(p)),f=[...new Set(c.map(m=>m.author))].sort((m,p)=>m.localeCompare(p));return{reconciled_field_count:o.size,reconciled_fields:h,reverted_field_count:i.size,reverted_fields:s,discarded_events:d,discarded_authors:l,preserved_field_count:a.size,preserved_fields:u,preserved_events:c,preserved_authors:f,recovery_hint:d.length>0?"Reconciliation keeps the on-disk item and overwrites these replayed mutations. To recover one, inspect it with pm history <id> --diff --field <field>, then re-apply the lost value with pm update.":null}}async function Qe(e,t,n){let r=e.located?.itemPath??null,o=e.located?await ue(e.located,{schema:t.schema}):null;if(!o)return{currentItemReplay:null,currentItemPath:r,matchedChainBefore:null,currentItemRawBeforeLock:null,loadedItem:null};let a=ce(o.document),i=n[n.length-1]?.after_hash;return{currentItemReplay:a,currentItemPath:r,matchedChainBefore:O(a)===i,currentItemRawBeforeLock:o.raw,loadedItem:o}}function Ye(e){return typeof e.message=="string"&&e.message.trim().length>0?e.message:`history-repair re-anchored ${e.entriesRehashed} entr${e.entriesRehashed===1?"y":"ies"}${e.entriesPatchRepaired>0?`, repaired ${e.entriesPatchRepaired} patch(es)`:""}${e.reconcileNeeded?", reconciled chain with on-disk item":""}.`}function Ze(e){let t=[...e.reanchorEntries];if(!e.changed)return{rewrittenEntries:t,auditEntryAdded:!1};let n=e.reconcileNeeded&&e.currentItemReplay?e.currentItemReplay:e.finalReplay;return t.push({ts:S(),author:e.author,op:e.auditOperation,patch:e.reconcileNeeded&&e.currentItemReplay?Ce.compare(e.finalReplay,e.currentItemReplay):[],before_hash:O(e.finalReplay),after_hash:O(n),message:e.message,...e.auditContext===void 0?{}:{context:e.auditContext}}),{rewrittenEntries:t,auditEntryAdded:!0}}function et(e,t){let n=[];return e||n.push("history_repair_no_changes"),t>0&&n.push(`history_repair_skipped_unresolvable_ops:${t}`),n}async function tt(e){return he({pmRoot:e.pmRoot,subject:e.subject,settings:e.settings,typeRegistry:e.typeRegistry,historyRawBeforeLock:e.historyRawBeforeLock,currentItemRawBeforeLock:e.currentItemRawBeforeLock,operation:"history-repair",author:e.author,force:e.force,itemDocument:e.loadedItem?.document??null,applyRewrite:async({historyRawUnderLock:t})=>fe({historyPath:e.historyPath,nextHistoryRaw:I(e.rewrittenEntries),historyRawUnderLock:t}),applyPostRewrite:async()=>te({path:e.historyPath,scope:"project",op:"history_repair:history"})})}async function Q(e,t,n){let r=C(process.cwd(),n.path);if(!await E(k(r)))throw new g(`Tracker is not initialized at ${r}. Run pm init first.`,y.NOT_FOUND);let o=await x(r),a=L(o,F()),i=await me(r,e,o,a.type_to_folder);if(!await E(i.historyPath))throw new g(`No history stream exists for ${i.id}.`,y.NOT_FOUND);let d=await ee(i.historyPath),c=await se(i.historyPath,i.id);if(c.length===0)throw new g(`No history entries exist for ${i.id}; nothing to repair.`,y.USAGE);let h=B(c),s=j(c),u=await Qe(i,o,c),l=s.finalDocument,f=u.currentItemReplay!==null&&O(l)!==O(u.currentItemReplay),m=f&&u.currentItemReplay?Ke(s.entries,l,u.currentItemReplay):void 0,p=[s.entriesRehashed>0,s.entriesPatchRepaired>0,f,t.forceAuditEntry===!0].some(Boolean),_=re(t.author,o.author_default),R=!!t.dryRun,A=Ye({message:t.message,entriesRehashed:s.entriesRehashed,entriesPatchRepaired:s.entriesPatchRepaired,reconcileNeeded:f}),{rewrittenEntries:Y,auditEntryAdded:Fe}=Ze({reanchorEntries:s.entries,changed:p,reconcileNeeded:f,currentItemReplay:u.currentItemReplay,finalReplay:l,author:_,message:A,auditOperation:t.auditOperation??"history_repair",auditContext:t.auditContext}),N=B(Y);if(!N.ok)throw new g(`history-repair produced an invalid rewritten chain (${N.errors.join(", ")}).`,y.GENERIC_FAILURE);let P=et(p,s.skippedOps);return m&&m.discarded_events.length>0&&(P.push(`history_repair_reconcile_discards_events:${m.discarded_events.length}`),P.push(`history_repair_discarded_authors:${m.discarded_authors.join(",")}`)),p&&!R&&P.push(...await tt({pmRoot:r,subject:i,settings:o,typeRegistry:a,historyRawBeforeLock:d,currentItemRawBeforeLock:u.currentItemRawBeforeLock,author:_,force:t.force,loadedItem:u.loadedItem,historyPath:i.historyPath,rewrittenEntries:Y})),{id:i.id,dry_run:R,changed:p,history:{path:i.historyPath,entries_scanned:c.length,chain_drift_before:!h.ok,entries_rehashed:s.entriesRehashed,entries_patch_repaired:s.entriesPatchRepaired,converted_replace_to_add:s.convertedReplaceToAdd,skipped_ops:s.skippedOps,reconciled_with_item:f,audit_entry_added:Fe,verify_ok:N.ok,verify_errors:N.errors},item:{exists:u.currentItemPath!==null,path:u.currentItemPath,matched_chain_before:u.matchedChainBefore},...m?{reconciliation:m}:{},warnings:[...new Set(P)].sort((xe,Te)=>xe.localeCompare(Te)),generated_at:S()}}function Ut(e,t){if(t&&e!==void 0)throw new g("history-repair: <id> and --all are mutually exclusive; pass an item id to repair one stream or --all to repair every drifted stream.",y.USAGE);if(!t&&e===void 0)throw new g("history-repair: provide an item <id> or pass --all to repair every drifted stream.",y.USAGE)}async function ke(e,t){let n=C(process.cwd(),t.path);if(!await E(k(n)))throw new g(`Tracker is not initialized at ${n}. Run pm init first.`,y.NOT_FOUND);let r=await x(n),o=L(r,F()),a=[],i=await le(n,r.item_format,o.type_to_folder,a,r.schema,{forceSourceScan:!0}),d=await pe(n,i),c=[],h=[],s={repaired:0,skipped_clean:0,failed:0};for(let u of d.driftedItems)try{let l=await Q(u,{...e,auditContext:e.auditContextById?.[u],auditContextById:void 0},t),f=l.changed?"repaired":"skipped_clean";s[f]+=1,h.push(...l.warnings.map(m=>`${u}:${m}`)),c.push({id:u,outcome:f,entries_rehashed:l.history.entries_rehashed,entries_patch_repaired:l.history.entries_patch_repaired,reconciled_with_item:l.history.reconciled_with_item,...l.reconciliation?{reconciliation:l.reconciliation}:{},warnings:l.warnings})}catch(l){s.failed+=1,c.push({id:u,outcome:"failed",error:l instanceof Error?l.message:String(l)})}return e.dryRun||await ae(n),{all:!0,dry_run:!!e.dryRun,scanned_streams:i.length,drifted_streams:d.driftedItems.length,streams:c,totals:s,warnings:[...new Set([...a,...h])].sort((u,l)=>u.localeCompare(l)),generated_at:S()}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b2f34565-7664-5612-815d-949b8b1d4f90")}catch{}})();async function Wt(e,t){let n=e.dryRun===!0,r=await ge(process.cwd()),o=r.reduce((p,_)=>((p[_.item_id]??=[]).push(_),p),{}),a=Object.fromEntries(Object.entries(o).map(([p,_])=>[p,{merge:{receipts:_.map(T)}}])),i=await ke({dryRun:n,author:e.author??t.author,message:e.message??"post-merge reconciliation of field-aware tracker history",force:e.force,auditOperation:"merge_reconcile",auditContextById:a},t),d=new Set(i.streams.map(p=>p.id)),c=Object.keys(o).filter(p=>!d.has(p));(await Promise.allSettled(c.map(p=>Q(p,{dryRun:n,author:e.author??t.author,message:e.message??"record field-aware branch merge provenance",force:e.force,auditOperation:"merge_reconcile",auditContext:a[p],forceAuditEntry:!0},t)))).forEach((p,_)=>{let R=c[_];if(p.status==="fulfilled"){let A=p.value.changed?"repaired":"skipped_clean";i.streams.push({id:R,outcome:A,entries_rehashed:p.value.history.entries_rehashed,entries_patch_repaired:p.value.history.entries_patch_repaired,reconciled_with_item:p.value.history.reconciled_with_item,warnings:p.value.warnings}),i.totals[A]+=1}else i.streams.push({id:R,outcome:"failed",error:p.reason instanceof Error?p.reason.message:String(p.reason)}),i.totals.failed+=1});let s=0;!n&&i.totals.failed===0&&(await Promise.all(r.map(p=>_e(process.cwd(),p))),s=r.length);let u=await we({checkHistoryDrift:!0,checkStorageIntegrity:!0},t),l=u.checks.every(p=>p.status==="ok"),f=i.totals.failed===0&&l,m=n?["Review repair.streams, then rerun pm merge reconcile without --dry-run to apply audited repairs.","No Git hook is installed automatically; invoke this command from an explicit post-merge hook only when your repository policy opts in."]:f?["Reconciliation is complete; commit changed history streams with the merge result.","Rerun pm merge reconcile --dry-run after future tracker-data merges as a non-mutating integrity check."]:["Reconciliation remains incomplete; inspect repair failures and non-green validation checks before retrying.","Do not commit repaired history streams as reconciled until pm merge reconcile returns ok=true."];return{ok:f,dry_run:n,repair:i,receipts:{pending_before:r.length,reconciled:s,summaries:r.map(T)},validation:u,guidance:m,generated_at:u.generated_at}}export{Re as a,ve as b,De as c,$e as d,Ie as e,Ee as f,Se as g,It as h,Q as i,Ut as j,ke as k,Wt as l};
5
- //# sourceMappingURL=chunk-T5TSY36R.js.map