@unbrained/pm-cli 2026.11.3 → 2026.11.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 (294) hide show
  1. package/.agents/skills/HARNESS_COMPATIBILITY.md +1 -1
  2. package/.agents/skills/README.md +14 -14
  3. package/.agents/skills/pm-developer/SKILL.md +16 -16
  4. package/.agents/skills/pm-developer/references/GRAPH_AND_RELATIONSHIPS.md +14 -14
  5. package/.agents/skills/pm-developer/references/SCRIPTING_COMPOSITION.md +10 -10
  6. package/.agents/skills/pm-extensions/SKILL.md +13 -13
  7. package/.agents/skills/pm-extensions/references/AUTHORING.md +12 -12
  8. package/.agents/skills/pm-sdk/SKILL.md +27 -27
  9. package/.agents/skills/pm-sdk/references/SURFACE_MAP.md +32 -32
  10. package/.agents/skills/pm-test-audit/references/AUDIT.md +1 -1
  11. package/.agents/skills/pm-user/SKILL.md +35 -35
  12. package/.claude-plugin/marketplace.json +1 -1
  13. package/AGENTS.md +9 -9
  14. package/CHANGELOG.md +19 -0
  15. package/README.md +13 -13
  16. package/dist/cli/error-guidance.d.ts +14 -35
  17. package/dist/cli/error-guidance.js +2 -2
  18. package/dist/cli/expected-revisions.d.ts +55 -0
  19. package/dist/cli/expected-revisions.js +2 -0
  20. package/dist/cli/main.js +2 -2
  21. package/dist/cli/register-setup.js +1 -1
  22. package/dist/cli/runtime/invocation-options.js +1 -1
  23. package/dist/cli-bundle/bundle-manifest.json +1 -1
  24. package/dist/cli-bundle/chunks/chunk-2RPORE7M.js +31 -0
  25. package/dist/cli-bundle/chunks/{chunk-Y7H55PCY.js → chunk-335BZ75D.js} +2 -2
  26. package/dist/cli-bundle/chunks/chunk-5GWEY4P6.js +122 -0
  27. package/dist/cli-bundle/chunks/chunk-6VRX2CM7.js +2 -0
  28. package/dist/cli-bundle/chunks/{chunk-5JZMF4M5.js → chunk-7DEKAXVA.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-32BCU6HN.js → chunk-7ZRCYESH.js} +47 -46
  30. package/dist/cli-bundle/chunks/chunk-AUEKTX7V.js +6 -0
  31. package/dist/cli-bundle/chunks/chunk-D7KYPRK4.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-2CBHQXYJ.js → chunk-DAX3AOFI.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-JPKIUWLG.js → chunk-F6NDMKZ4.js} +2 -2
  34. package/dist/cli-bundle/chunks/chunk-FRNMQM45.js +2 -0
  35. package/dist/cli-bundle/chunks/chunk-HNGLDMSZ.js +9 -0
  36. package/dist/cli-bundle/chunks/{chunk-DEJHTFEF.js → chunk-HRCMORE7.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-HRFGFIYU.js +2 -0
  38. package/dist/cli-bundle/chunks/{chunk-5IPXDZKU.js → chunk-JI2GDE4I.js} +66 -66
  39. package/dist/cli-bundle/chunks/{chunk-MQJXZX3Q.js → chunk-LS3GI3H4.js} +53 -53
  40. package/dist/cli-bundle/chunks/chunk-OH6WQ7VT.js +3 -0
  41. package/dist/cli-bundle/chunks/{chunk-TZ3D3DPQ.js → chunk-OJDMJT7Y.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-S4LPZ4TN.js +20 -0
  43. package/dist/cli-bundle/chunks/chunk-UEGXWXUZ.js +2 -0
  44. package/dist/cli-bundle/chunks/chunk-XLSHFYXZ.js +2 -0
  45. package/dist/cli-bundle/chunks/{chunk-UYNMKUGA.js → chunk-YKXATU2G.js} +2 -2
  46. package/dist/cli-bundle/chunks/item-revision-OJJVPQY7.js +2 -0
  47. package/dist/cli-bundle/chunks/item-transaction-QEPBUCMY.js +2 -0
  48. package/dist/cli-bundle/chunks/mutation-admission-INMM3HHG.js +2 -0
  49. package/dist/cli-bundle/chunks/{register-list-query-I6AZA3IX.js → register-list-query-5Y5JKWU5.js} +2 -2
  50. package/dist/cli-bundle/chunks/{register-mutation-3DAXCLXR.js → register-mutation-WC7OSQID.js} +2 -2
  51. package/dist/cli-bundle/chunks/register-operations-PO63DBZH.js +2 -0
  52. package/dist/cli-bundle/chunks/register-setup-RRFOS7IT.js +2 -0
  53. package/dist/cli-bundle/chunks/{stage-7H36OTDJ.js → stage-E3MMV4TV.js} +2 -2
  54. package/dist/cli-bundle/focused-chunks/chunk-5PMJOJCZ.js +44 -0
  55. package/dist/cli-bundle/focused-chunks/chunk-7KK66ISG.js +2 -0
  56. package/dist/cli-bundle/focused-chunks/{chunk-D4XQOMG4.js → chunk-AHWJPZSJ.js} +2 -2
  57. package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +2 -0
  58. package/dist/cli-bundle/focused-chunks/{chunk-LKN2WGGB.js → chunk-C6P6HPCX.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/chunk-CPMSL4HS.js +2 -0
  60. package/dist/cli-bundle/focused-chunks/chunk-CZM75DE3.js +2 -0
  61. package/dist/cli-bundle/focused-chunks/{chunk-TYHDZUL4.js → chunk-D2TBEBNW.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/chunk-E56OXRYH.js +2 -0
  63. package/dist/cli-bundle/focused-chunks/{chunk-I5FODKYB.js → chunk-F62XGAAY.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/chunk-G4QP365K.js +2 -0
  65. package/dist/cli-bundle/focused-chunks/chunk-G5PJCR7R.js +2 -0
  66. package/dist/cli-bundle/focused-chunks/chunk-GS3JC5UU.js +23 -0
  67. package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-LW64TINU.js +3 -0
  69. package/dist/cli-bundle/focused-chunks/chunk-M6V7UMWL.js +26 -0
  70. package/dist/cli-bundle/focused-chunks/chunk-MC7IE7D7.js +8 -0
  71. package/dist/cli-bundle/focused-chunks/chunk-MG7C3JUY.js +2 -0
  72. package/dist/cli-bundle/focused-chunks/{chunk-F3X6UWMI.js → chunk-MK4HV4JO.js} +2 -2
  73. package/dist/cli-bundle/focused-chunks/{chunk-ZQRCVRGS.js → chunk-NQ7GYFOX.js} +54 -54
  74. package/dist/cli-bundle/focused-chunks/chunk-O7EI33NP.js +91 -0
  75. package/dist/cli-bundle/focused-chunks/{chunk-RY4QEMAE.js → chunk-RFTJZ5VB.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/chunk-SNOXXRSJ.js +2 -0
  77. package/dist/cli-bundle/focused-chunks/chunk-UPJUTP2V.js +12 -0
  78. package/dist/cli-bundle/focused-chunks/{chunk-HJ27QLZV.js → chunk-VWWTIX5L.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/{chunk-HOXIIZEO.js → chunk-XHOBYCVE.js} +2 -2
  80. package/dist/cli-bundle/focused-chunks/chunk-YMGB2O4E.js +81 -0
  81. package/dist/cli-bundle/focused-chunks/item-revision-CTDO4H3I.js +2 -0
  82. package/dist/cli-bundle/focused-chunks/item-transaction-AEAYVVHA.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/mutation-admission-4WM7TNHZ.js +2 -0
  84. package/dist/cli-bundle/focused-chunks/{stage-4SQHVI3O.js → stage-WV7QXR4C.js} +2 -2
  85. package/dist/cli-bundle/main.js +25 -25
  86. package/dist/cli-bundle/sdk-authoring.js +1 -1
  87. package/dist/cli-bundle/sdk-contracts.js +5 -5
  88. package/dist/cli-bundle/sdk-core.js +1 -1
  89. package/dist/cli-bundle/sdk-governance.js +1 -1
  90. package/dist/cli-bundle/sdk-graph.js +1 -1
  91. package/dist/cli-bundle/sdk-merge.js +57 -57
  92. package/dist/cli-bundle/sdk-query.js +1 -1
  93. package/dist/cli-bundle/sdk-runtime.js +1 -1
  94. package/dist/cli-bundle/sdk-testing.js +1 -1
  95. package/dist/cli-bundle/sdk.js +11 -11
  96. package/dist/core/config/positional-value.d.ts +7 -1
  97. package/dist/core/config/positional-value.js +1 -1
  98. package/dist/core/extensions/reserved-host-flags.js +1 -1
  99. package/dist/core/history/history-rewrite.js +1 -1
  100. package/dist/core/item/literal-mutation-input.d.ts +17 -0
  101. package/dist/core/item/literal-mutation-input.js +1 -1
  102. package/dist/core/item/parent-reference-policy.d.ts +8 -4
  103. package/dist/core/item/parent-reference-policy.js +1 -1
  104. package/dist/core/item/sprint-release-format.d.ts +2 -1
  105. package/dist/core/item/sprint-release-format.js +1 -1
  106. package/dist/core/output/mutation-projection.js +1 -1
  107. package/dist/core/shared/command-types.d.ts +7 -0
  108. package/dist/core/store/item-mutation-precondition.d.ts +72 -6
  109. package/dist/core/store/item-mutation-precondition.js +1 -1
  110. package/dist/core/store/item-store.js +1 -1
  111. package/dist/core/store/settings-validator.js +1 -1
  112. package/dist/core/store/settings.d.ts +14 -0
  113. package/dist/core/store/settings.js +5 -4
  114. package/dist/core/telemetry/policy.d.ts +27 -1
  115. package/dist/core/telemetry/policy.js +1 -1
  116. package/dist/core/telemetry/runtime.d.ts +18 -7
  117. package/dist/core/telemetry/runtime.js +4 -4
  118. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
  119. package/dist/sdk/cli-contracts/completeness.js +1 -1
  120. package/dist/sdk/cli-contracts/enum-contracts.d.ts +11 -0
  121. package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
  122. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +1 -1
  123. package/dist/sdk/cli-contracts/registration-helpers.js +1 -1
  124. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  125. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  126. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +8 -5
  127. package/dist/sdk/cli-contracts.d.ts +1 -1
  128. package/dist/sdk/cli-contracts.js +1 -1
  129. package/dist/sdk/cli-program.js +1 -1
  130. package/dist/sdk/config.d.ts +3 -3
  131. package/dist/sdk/config.js +1 -1
  132. package/dist/sdk/environment/project-runtime-compatibility.js +1 -1
  133. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  134. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  135. package/dist/sdk/governance/health.d.ts +2 -2
  136. package/dist/sdk/governance/health.js +2 -2
  137. package/dist/sdk/governance/validate.js +1 -1
  138. package/dist/sdk/history/salvage.js +3 -3
  139. package/dist/sdk/history-compact.d.ts +7 -1
  140. package/dist/sdk/history-compact.js +1 -1
  141. package/dist/sdk/history-repair.d.ts +2 -1
  142. package/dist/sdk/history-repair.js +1 -1
  143. package/dist/sdk/index.d.ts +6 -1
  144. package/dist/sdk/index.js +1 -1
  145. package/dist/sdk/init.d.ts +4 -4
  146. package/dist/sdk/init.js +8 -8
  147. package/dist/sdk/lifecycle/checkpoint-rollback.d.ts +10 -2
  148. package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
  149. package/dist/sdk/lifecycle/claim.d.ts +4 -0
  150. package/dist/sdk/lifecycle/claim.js +1 -1
  151. package/dist/sdk/lifecycle/close-many.d.ts +11 -2
  152. package/dist/sdk/lifecycle/close-many.js +1 -1
  153. package/dist/sdk/lifecycle/close.d.ts +25 -0
  154. package/dist/sdk/lifecycle/close.js +1 -1
  155. package/dist/sdk/lifecycle/create.d.ts +7 -5
  156. package/dist/sdk/lifecycle/create.js +1 -1
  157. package/dist/sdk/lifecycle/item-revision.d.ts +162 -0
  158. package/dist/sdk/lifecycle/item-revision.js +2 -0
  159. package/dist/sdk/lifecycle/restore.js +1 -1
  160. package/dist/sdk/lifecycle/shared-unset-fields.d.ts +628 -4
  161. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
  162. package/dist/sdk/lifecycle/start-blockers.d.ts +52 -0
  163. package/dist/sdk/lifecycle/start-blockers.js +2 -0
  164. package/dist/sdk/lifecycle/task-composition.d.ts +11 -0
  165. package/dist/sdk/lifecycle/task-composition.js +1 -1
  166. package/dist/sdk/lifecycle/update-many.d.ts +11 -2
  167. package/dist/sdk/lifecycle/update-many.js +1 -1
  168. package/dist/sdk/lifecycle/update.d.ts +5 -4
  169. package/dist/sdk/lifecycle/update.js +2 -2
  170. package/dist/sdk/public-surface.json +1 -1
  171. package/dist/sdk/query/declared-blockers.d.ts +16 -0
  172. package/dist/sdk/query/declared-blockers.js +2 -0
  173. package/dist/sdk/query/get.d.ts +7 -0
  174. package/dist/sdk/query/get.js +1 -1
  175. package/dist/sdk/query/projection-contracts.js +1 -1
  176. package/dist/sdk/runtime/actions.js +1 -1
  177. package/dist/sdk/runtime/mutation-value-validation.js +1 -1
  178. package/dist/sdk/runtime-input.d.ts +12 -0
  179. package/dist/sdk/runtime-input.js +1 -1
  180. package/dist/sdk/runtime-primitives.d.ts +1 -0
  181. package/dist/sdk/runtime-primitives.js +1 -1
  182. package/dist/sdk/runtime.d.ts +10 -0
  183. package/dist/sdk/runtime.js +1 -1
  184. package/dist/sdk/structured-mutations.js +1 -1
  185. package/dist/sdk/telemetry.d.ts +1 -1
  186. package/dist/sdk/telemetry.js +2 -2
  187. package/dist/sdk/test/batch.js +2 -2
  188. package/dist/sdk/test/execution.js +2 -2
  189. package/dist/sdk/test/linked-command-detection.js +1 -1
  190. package/dist/sdk/workspace-transaction.d.ts +17 -6
  191. package/dist/sdk/workspace-transaction.js +1 -1
  192. package/dist/types.d.ts +6 -0
  193. package/dist/types.js +1 -1
  194. package/docs/AGENT_GUIDE.md +48 -48
  195. package/docs/AGENT_OUTPUT_ENCODINGS.md +20 -20
  196. package/docs/ASSURANCE.md +10 -10
  197. package/docs/BOUNDED_CONTEXT_READS.md +3 -3
  198. package/docs/CLAUDE_CODE_PLUGIN.md +1 -1
  199. package/docs/CLI_GRAMMAR.md +2 -2
  200. package/docs/COMMANDS.md +144 -32
  201. package/docs/COMMAND_NAMESPACES.md +1 -1
  202. package/docs/CONFIGURATION.md +82 -70
  203. package/docs/CONTEXT_ALGORITHM_PORTFOLIO.md +2 -2
  204. package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +5 -5
  205. package/docs/CORPUS_SHAPES.md +1 -1
  206. package/docs/DEPENDENCY_KIND_CONTRACT.md +6 -6
  207. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +5 -5
  208. package/docs/ECOSYSTEM_PLANNING_REVIEW.md +3 -3
  209. package/docs/EXTENSION_AUTHOR_CONTRACTS.md +4 -4
  210. package/docs/HISTORY_ATTESTATION.md +1 -1
  211. package/docs/HISTORY_MAINTENANCE.md +1 -1
  212. package/docs/LIFECYCLE_COMMANDS.md +1 -1
  213. package/docs/MCP_2026_07_28.md +16 -16
  214. package/docs/MCP_2026_07_28_CONFORMANCE.md +19 -19
  215. package/docs/MCP_REMOTE_TRANSPORT_SECURITY.md +22 -22
  216. package/docs/MCP_SKILLS_AND_APPS.md +1 -1
  217. package/docs/MERGE_SAFETY.md +6 -6
  218. package/docs/MUTATION_INTEGRITY.md +5 -5
  219. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +14 -14
  220. package/docs/PACKED_FIRST_RUN.md +1 -1
  221. package/docs/QUICKSTART.md +10 -10
  222. package/docs/README.md +21 -21
  223. package/docs/READ_OUTPUT_CONTRACTS.md +9 -9
  224. package/docs/RECURRENCE_RECOVERY_CONTRACTS.md +1 -1
  225. package/docs/RELEASING.md +19 -10
  226. package/docs/SCRIPTING.md +10 -10
  227. package/docs/SDK.md +183 -38
  228. package/docs/SDK_ARTIFACT_OUTPUT.md +1 -1
  229. package/docs/SDK_PRIMITIVE_INVENTORY.md +2 -2
  230. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +7 -7
  231. package/docs/TESTING.md +1 -1
  232. package/docs/WORKFLOW_POLICIES.md +2 -2
  233. package/docs/WORKSPACE_POSITION_AND_LIFECYCLE.md +8 -8
  234. package/docs/agent-task-token-baseline.json +1 -1
  235. package/docs/generated/AGENT_CAPABILITY_ROUTING.md +1 -1
  236. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -1
  237. package/docs/generated/FLAG_LEXICON_BUDGETS.md +112 -112
  238. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +13 -4
  239. package/docs/performance/cli-transport-overhead.md +7 -7
  240. package/marketplace.json +1 -1
  241. package/package.json +1 -1
  242. package/packages/pm-beads/package.json +1 -1
  243. package/packages/pm-calendar/package.json +1 -1
  244. package/packages/pm-command-kit/README.md +5 -5
  245. package/packages/pm-command-kit/package.json +1 -1
  246. package/packages/pm-digital-twin/GAP_REPORT.md +16 -16
  247. package/packages/pm-digital-twin/package.json +1 -1
  248. package/packages/pm-governance-audit/package.json +1 -1
  249. package/packages/pm-guide-shell/package.json +1 -1
  250. package/packages/pm-kanban/README.md +1 -1
  251. package/packages/pm-kanban/package.json +1 -1
  252. package/packages/pm-lifecycle-hooks/package.json +1 -1
  253. package/packages/pm-linked-test-adapters/package.json +1 -1
  254. package/packages/pm-search-advanced/package.json +1 -1
  255. package/packages/pm-templates/package.json +1 -1
  256. package/packages/pm-todos/package.json +1 -1
  257. package/packages/pm-vcs/GAP_REPORT.md +1 -1
  258. package/packages/pm-vcs/package.json +1 -1
  259. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  260. package/plugins/pm-claude/README.md +6 -6
  261. package/plugins/pm-claude/package.json +1 -1
  262. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  263. package/plugins/pm-codex/package.json +1 -1
  264. package/plugins/pm-codex/plugin.json +1 -1
  265. package/runtime-dependencies.json +1 -1
  266. package/dist/cli-bundle/chunks/chunk-7ZEFHFAU.js +0 -2
  267. package/dist/cli-bundle/chunks/chunk-B6UTLYLM.js +0 -3
  268. package/dist/cli-bundle/chunks/chunk-HBKD5HZB.js +0 -2
  269. package/dist/cli-bundle/chunks/chunk-L6LCLC37.js +0 -2
  270. package/dist/cli-bundle/chunks/chunk-NR4KABHC.js +0 -31
  271. package/dist/cli-bundle/chunks/chunk-PWD5RY2D.js +0 -2
  272. package/dist/cli-bundle/chunks/chunk-XRMYA4R7.js +0 -20
  273. package/dist/cli-bundle/chunks/chunk-YWS4XV4I.js +0 -6
  274. package/dist/cli-bundle/chunks/chunk-ZOAJNPBL.js +0 -129
  275. package/dist/cli-bundle/chunks/item-transaction-ZHLJTBD7.js +0 -2
  276. package/dist/cli-bundle/chunks/mutation-admission-ZQMRMGIB.js +0 -2
  277. package/dist/cli-bundle/chunks/register-operations-G3QGGQ5Z.js +0 -2
  278. package/dist/cli-bundle/chunks/register-setup-LDXHMNOT.js +0 -2
  279. package/dist/cli-bundle/focused-chunks/chunk-3XGKBVJ3.js +0 -2
  280. package/dist/cli-bundle/focused-chunks/chunk-4HY6EGPB.js +0 -2
  281. package/dist/cli-bundle/focused-chunks/chunk-AK2CI2GI.js +0 -2
  282. package/dist/cli-bundle/focused-chunks/chunk-HUXZCPWT.js +0 -26
  283. package/dist/cli-bundle/focused-chunks/chunk-IKXJ57XA.js +0 -8
  284. package/dist/cli-bundle/focused-chunks/chunk-MOY6KZGJ.js +0 -44
  285. package/dist/cli-bundle/focused-chunks/chunk-PWUTFKSI.js +0 -2
  286. package/dist/cli-bundle/focused-chunks/chunk-PZRB7IXH.js +0 -91
  287. package/dist/cli-bundle/focused-chunks/chunk-WSYPVBKS.js +0 -80
  288. package/dist/cli-bundle/focused-chunks/chunk-WXLG7HZ5.js +0 -3
  289. package/dist/cli-bundle/focused-chunks/chunk-WZDFCVLX.js +0 -12
  290. package/dist/cli-bundle/focused-chunks/chunk-YGO3FWA2.js +0 -2
  291. package/dist/cli-bundle/focused-chunks/chunk-YVLAP3BL.js +0 -23
  292. package/dist/cli-bundle/focused-chunks/chunk-ZYXQACPB.js +0 -2
  293. package/dist/cli-bundle/focused-chunks/item-transaction-PZ2FQ6B2.js +0 -2
  294. package/dist/cli-bundle/focused-chunks/mutation-admission-XOOK6XFH.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{$a as m,Za as b,ab as f,bb as k,lb as u}from"./chunk-M6V7UMWL.js";import{z as a}from"./chunk-G6ERMFJ5.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]="7c95b311-b408-50f7-87e8-2c2fa2323092")}catch{}})();var D=[{exit_code:a.SUCCESS,outcome:"effect",success:!0,meaning:"The requested operation completed with its intended effect."},{exit_code:a.GENERIC_FAILURE,outcome:"internal_failure",success:!1,meaning:"An unexpected runtime or internal failure prevented completion."},{exit_code:a.USAGE,outcome:"refused_input",success:!1,meaning:"The invocation was refused because its input or composition was invalid."},{exit_code:a.NOT_FOUND,outcome:"refused_tracker_state",success:!1,meaning:"The requested tracker, item, or resource was not present."},{exit_code:a.CONFLICT,outcome:"conflict",success:!1,meaning:"Current state or concurrency prevented the requested effect."},{exit_code:a.DEPENDENCY_FAILED,outcome:"dependency_failed",success:!1,meaning:"A required dependency operation failed."},{exit_code:a.NO_EFFECT,outcome:"no_effect",success:!0,meaning:"The request was valid and completed, but matched nothing to change."},{exit_code:a.PARTIAL_EFFECT,outcome:"partial_effect",success:!0,meaning:"The request completed and changed some, but not all, selected targets."}],h=[a.SUCCESS,a.GENERIC_FAILURE,a.USAGE,a.NOT_FOUND,a.CONFLICT,a.DEPENDENCY_FAILED],P=new Set(["close-many","update-many"]),w=u.map(e=>({command:e,exit_codes:P.has(e)?[...h,a.NO_EFFECT,a.PARTIAL_EFFECT]:[...h]})),v=new Map(w.map(e=>[e.command,e])),R=[a.SUCCESS,a.NO_EFFECT,a.PARTIAL_EFFECT];function Ee(e){return R.includes(e)}function Te(e){return D.some(t=>t.exit_code===e)}function Ae(e){let t=e.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(" ");return v.get(t)??v.get(t.split(" ")[0])}function Oe(e,t=u,s=w){let o=new Map(s.map(c=>[c.command,c])),i=t.filter(c=>!o.has(c)),r=e.filter(c=>{let n=o.get(c.command)??o.get(c.command.split(" ")[0]);return n===void 0||!n.exit_codes.includes(c.exit_code)}),d=new Set(e.map(c=>c.exit_code)),_=[...new Set(s.flatMap(c=>c.exit_codes))].filter(c=>!d.has(c)).sort((c,n)=>c-n);return{ok:i.length===0&&r.length===0&&_.length===0,missing_commands:i,undeclared_observations:r,unreachable_exit_codes:_}}function Se(e){return e.applied===0&&e.failed>0?{outcome:"dependency_failed",exit_code:a.DEPENDENCY_FAILED}:e.applied===0?{outcome:"no_effect",exit_code:a.NO_EFFECT}:e.skipped>0||e.failed>0||e.unmatched>0?{outcome:"partial_effect",exit_code:a.PARTIAL_EFFECT}:{outcome:"effect",exit_code:a.SUCCESS}}(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]="7df4fe91-e8a4-540f-8737-c67f2efa460e")}catch{}})();var x=[{exit_code:1,class:"generic_failure"},{exit_code:2,class:"usage"},{exit_code:3,class:"not_found"},{exit_code:4,class:"conflict"},{exit_code:5,class:"dependency_failed"}],L=new Map(x.map(e=>[e.exit_code,e.class]));function g(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort()}function q(e){if(!e)return[];let t=new Set,s=new Set;return e.map(o=>{let i=o.state.trim(),r=o.probe_id.trim(),d=g(o.entrypoints);if(!/^[a-z][a-z0-9_]*$/.test(i)||!/^[a-z][a-z0-9-]*$/.test(r)||d.length===0||t.has(i)||s.has(r))throw new TypeError("Invalid pm refusal state contract");return t.add(i),s.add(r),{state:i,probe_id:r,entrypoints:d,expected_exit_class:o.expected_exit_class}}).sort((o,i)=>o.state.localeCompare(i.state))}function F(e,t,s,o,i){return![[1,2,3,4,5].includes(e.exit_code),e.meaning.trim().length>0,e.recovery.trim().length>0,t.length>0,s.length>0,/^[a-z][a-z0-9_]*$/.test(o),i.every(r=>/^[a-z][a-z0-9_]*$/.test(r)),L.get(e.exit_code)===e.class].includes(!1)}function j(e,t){let s=e,o=new Set;for(;s.canonical_code!==s.code;){if(o.has(s.code))throw new TypeError(`Alias cycle in pm error code catalog: ${e.code}`);o.add(s.code);let i=t.get(s.canonical_code);if(!i)throw new TypeError(`Invalid pm error code contract: ${e.code}`);s=i}return s}function $(e){let t=new Map(e.map(s=>[s.code,s]));for(let s of e){let o=j(s,t);if(o.exit_code!==s.exit_code||o.class!==s.class)throw new TypeError(`Alias transport mismatch for pm error code: ${s.code}`);let i=e.filter(r=>r.code!==o.code&&r.canonical_code===o.code).map(r=>r.code).sort();if(s.code===o.code?JSON.stringify(s.aliases)!==JSON.stringify(i):s.aliases.length>0)throw new TypeError(`Invalid pm error code contract: ${s.code}`)}}function E(e){let t=new Set,s=e.map(o=>{let i=o.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(i))throw new TypeError(`Invalid pm error code: ${JSON.stringify(o.code)}`);if(t.has(i))throw new TypeError(`Duplicate pm error code: ${i}`);t.add(i);let r=g(o.sources),d=g(o.emitting_commands),_=(o.canonical_code??i).trim(),c=g(o.aliases??[]),n=q(o.owned_states);if(!F(o,r,d,_,c))throw new TypeError(`Invalid pm error code contract: ${i}`);if(n.some(l=>l.expected_exit_class!==o.class))throw new TypeError(`Invalid pm refusal state exit class: ${i}`);return Object.freeze({...o,code:i,meaning:o.meaning.trim(),recovery:o.recovery.trim(),sources:r,emitting_commands:d,canonical_code:_,aliases:c,owned_states:n})});return $(s),Object.freeze(s.sort((o,i)=>o.code.localeCompare(i.code)))}function Ne(e,t){let s=C(e,t);return C(s.canonical_code??s.code,t)}function C(e,t){let s=e.trim(),o=t.find(i=>i.code===s);if(!o)throw new TypeError(`Unknown pm error code "${s}"`);return o}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1e8c03e6-149a-5819-a000-65e7e3b12f6d")}catch{}})();var z="Inspect the structured error guidance and retry the suggested command.",U=new Map(x.map(e=>[e.exit_code,e.class]));function T(e){return e.map(t=>{let s=`${t.code.replaceAll("_"," ")} condition.`,o={code:t.code,meaning:`${s.charAt(0).toUpperCase()}${s.slice(1)}`,stability:t.stable?"stable":"provisional",exit_code:t.exit_code,class:U.get(t.exit_code),recovery:z,sources:t.sources,emitting_commands:t.emitting_commands??["*"],canonical_code:t.canonical_code??t.code,aliases:t.aliases??[]};return t.owned_states&&(o.owned_states=t.owned_states),o})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7ff182fc-44e0-5a2e-93e9-5e24ba113e67")}catch{}})();var A=[{code:"acceptance_criteria_mutation_conflict",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_remove_unmatched",exit_code:3,sources:["sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_semicolon_forbidden",exit_code:2,stable:!0,sources:["core/item/parse.ts"]},{code:"accepted_rejected_value",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"alias_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"alias_target_missing",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"already_claimed_by",exit_code:4,stable:!0,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"ambiguous_option_combination",exit_code:2,stable:!0,sources:["sdk/lifecycle/claim.ts","sdk/lifecycle/plan.ts"],emitting_commands:["claim","plan"]},{code:"annotation_alias_conflict",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"annotation_flag_like_value",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_if_absent_without_append",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_transposed_subcommand",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"append_empty_body",exit_code:2,stable:!0,sources:["sdk/lifecycle/append.ts"],emitting_commands:["append"]},{code:"assurance_registry_invalid",exit_code:1,sources:["sdk/governance/assurance.ts"]},{code:"bare_comma_entry_ambiguous",exit_code:2,sources:["core/item/parse.ts"]},{code:"blocker_identity_read_failed",exit_code:1,sources:["sdk/query/declared-blockers.ts"]},{code:"body_file_conflicts_with_body",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",exit_code:3,stable:!0,sources:["core/io/body-file.ts"]},{code:"budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"bulk_create_route",exit_code:2,sources:["cli/register-mutation.ts"]},{code:"bulk_ids_input_empty",exit_code:2,sources:["core/io/bulk-ids-input.ts","sdk/history-compact.ts","sdk/history-mcp.ts"],owned_states:[{state:"bulk_ids_stdin_contains_no_nonempty_ids",probe_id:"bulk-ids-stdin-empty",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_missing_path",exit_code:2,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_token_omits_its_path",probe_id:"bulk-ids-file-path-missing",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_unreadable",exit_code:3,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_path_cannot_be_read",probe_id:"bulk-ids-file-unreadable",entrypoints:["update-many"],expected_exit_class:"not_found"}]},{code:"bundle_integrity_torn_install",exit_code:1,stable:!0,sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"capability_unused",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",exit_code:1,stable:!0,sources:["sdk/item-children.ts"]},{code:"close_reason_required",exit_code:2,stable:!0,sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"],emitting_commands:["*","close-many"]},{code:"close_through_update",exit_code:1,stable:!0,sources:["core/telemetry/observability.ts"]},{code:"close_validation_missing_fields",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"collected_zero_items",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"collection_transposed_subcommand",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"command_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"command_namespace",exit_code:2,stable:!0,sources:["sdk/cli-contracts/runtime-contracts.ts"]},{code:"command_override_conflict",exit_code:4,stable:!0,sources:["sdk/compose.ts"]},{code:"config_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"config_key_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"config_value_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"conflicting_lifecycle_owner",exit_code:2,stable:!0,sources:["cli/register-operations.ts"]},{code:"context_evaluation_read_incomplete",exit_code:2,sources:["sdk/context-relevance.ts"]},{code:"context_signal_store_invalid",exit_code:2,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_stale",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_write_failed",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_takes_no_item_argument",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"core_item_field_requires_dedicated_flag",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"create_positional_type_without_title",exit_code:2,stable:!0,sources:["cli/register-mutation.ts"]},{code:"dependency_cardinality_created",exit_code:2,sources:["sdk/graph/cardinality-integrity.ts"]},{code:"dependency_edge_not_allowed",exit_code:2,stable:!0,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_flag_value_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_remove_no_match",exit_code:3,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"dependency_target_not_found",exit_code:3,sources:["sdk/dependency-flag-validation.ts"]},{code:"dependency_temporal_order_invalid",exit_code:2,sources:["sdk/dependency-flag-validation.ts"]},{code:"duplicate_canonical_flag",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"duplicate_command",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"duplicate_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"duplicate_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"duplicate_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"duplicate_probe",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"duplicate_sweep_cost_limit",exit_code:4,stable:!0,sources:["sdk/query/duplicate-candidates.ts"],emitting_commands:["duplicate-candidates"]},{code:"duplicate_target_circular",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_is_duplicate",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_missing",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"duplicate_target_self",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"empty_corpus",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"empty_surface",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"event_cursor_query_mismatch",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"event_history_integrity_failed",exit_code:1,sources:["core/history/event-index.ts"]},{code:"event_index_unavailable",exit_code:1,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"exit_code_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"expect_hash_background_unsupported",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invalid",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_invocation_rewritten",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_requires_mutation",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expect_hash_target_required",exit_code:2,sources:["sdk/lifecycle/item-revision.ts"]},{code:"expected_revision_duplicate",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"expected_revision_scope_conflict",exit_code:2,sources:["core/store/item-mutation-precondition.ts"]},{code:"extension_command_activation_failed",exit_code:1,stable:!0,sources:["cli/commander-usage.ts"]},{code:"extension_dependency_name_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_spec_invalid",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_dependency_version_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"extension_flag_value_invalid",exit_code:2,sources:["cli/extension-command-options.ts"]},{code:"extension_install_incomplete_source_scan",exit_code:2,sources:["sdk/extension/install-plan.ts"]},{code:"extension_install_rollback_failed",exit_code:1,sources:["sdk/extension/install-snapshot.ts"]},{code:"extension_install_soft_failed",exit_code:1,stable:!0,sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",exit_code:2,stable:!0,sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_read_output_invalid",exit_code:2,sources:["sdk/read-output/extension.ts"]},{code:"extension_update_health_partial_coverage",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"extensions_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"field_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_mcp_input_collision",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"github_source_entry_unbuilt",exit_code:2,stable:!0,sources:["sdk/extension/shared.ts"]},{code:"hierarchy_cardinality_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_cycle_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"hierarchy_parent_divergence_created",exit_code:4,sources:["sdk/graph/hierarchy-integrity.ts"]},{code:"history_author_acknowledge_plan_conflict",exit_code:4,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_plan_fingerprint_required",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_preview_limit_invalid",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_required_values_missing",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_conflict",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_selector_required",exit_code:2,stable:!0,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_not_actionable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_author_acknowledge_target_unreadable",exit_code:2,sources:["sdk/author-attribution.ts"]},{code:"history_baseline_unavailable",exit_code:1,sources:["core/history/projection.ts"]},{code:"history_drift_chain_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_chain_mismatches"]},{code:"history_drift_hash_mismatch",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_hash_mismatches"]},{code:"history_drift_merge_receipt",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"history_drift_missing_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_missing_streams"]},{code:"history_drift_unreadable_stream",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_unreadable_streams"]},{code:"history_drift_version_skew",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_drift_version_skews"]},{code:"history_json_invalid",exit_code:1,sources:["core/history/read.ts"]},{code:"history_merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/history/read.ts"],canonical_code:"merge_conflict_markers_detected"},{code:"history_replay_invalid",exit_code:1,sources:["core/history/projection.ts","core/history/tombstone.ts"]},{code:"history_salvage_refused",exit_code:4,sources:["sdk/history/salvage.ts"]},{code:"history_stream_over_compact_threshold",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"history_target_out_of_range",exit_code:1,stable:!0,sources:["core/history/projection.ts"]},{code:"history_timestamp_invalid",exit_code:1,sources:["core/history/event-index.ts","core/history/history.ts"]},{code:"history_union_rebase_conflict",exit_code:4,sources:["sdk/merge/history-scalar-rebase.ts"]},{code:"history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_history_unknown_author_events"]},{code:"history_version_mapping_unavailable",exit_code:2,sources:["core/history/version-address.ts"]},{code:"history_version_pruned",exit_code:2,sources:["core/history/projection.ts"]},{code:"host_environment_capacity_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_operation_invalid",exit_code:2,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_permission_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"host_environment_resource_fault",exit_code:1,sources:["core/fs/host-environment-errors.ts"]},{code:"improvement_metric_contract_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"improvement_observation_conflict",exit_code:4,sources:["sdk/improvement-ledger.ts"]},{code:"incomplete_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"inconsistent_concept_kind",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"init_existing_settings_requires_force",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_gitignore_unwritable",exit_code:1,stable:!0,sources:["sdk/workspace.ts"]},{code:"init_id_prefix_conflict",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"init_id_prefix_path_like",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"integrity_history_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_history_conflict_markers"]},{code:"integrity_history_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_history_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_ahead_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_ahead_items"]},{code:"integrity_item_conflict_marker",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_outdated_format_version",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_format_version_outdated_items"]},{code:"integrity_item_parse_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"integrity_item_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"invalid_argument_value",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/item/priority.ts","core/telemetry/observability.ts","sdk/config.ts","sdk/context-intent-contracts.ts","sdk/dependencies.ts","sdk/governance/assurance-mutation-error.ts","sdk/lifecycle/create.ts","sdk/lifecycle/task-composition.ts","sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts","sdk/query/next.ts","sdk/runtime-input.ts","sdk/runtime/mutation-admission.ts","sdk/runtime/mutation-value-validation.ts","sdk/runtime/schema-preview.ts","sdk/workspace.ts"],emitting_commands:["*","create","next","task-composition","update","update-many"]},{code:"invalid_command_usage",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"invalid_event_cursor",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_cursor_mode",exit_code:2,sources:["cli/register-list-query.ts","sdk/mutation-events.ts","sdk/runtime-extended-actions.ts"]},{code:"invalid_event_follow_interval",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_limit",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_event_since",exit_code:2,stable:!0,sources:["sdk/mutation-events.ts"]},{code:"invalid_history_analytics_limit",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_minimum_sample",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_history_analytics_since",exit_code:2,sources:["sdk/history-analytics.ts"]},{code:"invalid_improvement_ledger",exit_code:1,sources:["sdk/improvement-ledger-validation.ts"]},{code:"invalid_improvement_metric",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_limit",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_improvement_observation_timestamp",exit_code:2,sources:["sdk/improvement-ledger.ts"]},{code:"invalid_provenance_predicate",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"invalid_query_cursor",exit_code:2,stable:!0,sources:["sdk/pagination.ts","sdk/query/window-pagination.ts"]},{code:"invalid_read_output_session",exit_code:2,sources:["sdk/read-output-session.ts"]},{code:"invalid_reproducible_process_environment",exit_code:2,sources:["sdk/reproducibility/process.ts"]},{code:"invalid_workspace_snapshot_target",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"item_already_active",exit_code:4,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"item_already_exists",exit_code:4,stable:!0,sources:["sdk/lifecycle/create.ts"],emitting_commands:["create"]},{code:"item_deleted",exit_code:3,sources:["core/history/tombstone.ts"]},{code:"item_document_encoding_invalid",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_document_invalid",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_document_roundtrip_failed",exit_code:1,stable:!0,sources:["core/item/item-format.ts"]},{code:"item_format_version_unsupported",exit_code:4,sources:["core/item/item-format.ts"]},{code:"item_id_collision",exit_code:4,stable:!0,sources:["sdk/lifecycle/copy.ts"],emitting_commands:["copy"]},{code:"item_identity_ambiguous",exit_code:4,sources:["core/store/item-store.ts"]},{code:"item_identity_conflict",exit_code:4,sources:["sdk/governance/validate-history-drift.ts","sdk/lifecycle/item-revision.ts","sdk/merge/three-way.ts","sdk/query/declared-blockers.ts"]},{code:"item_identity_reserved",exit_code:4,sources:["core/history/history.ts"]},{code:"item_not_found",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/item-store.ts","core/telemetry/observability.ts","sdk/governance/validate-history-drift.ts"]},{code:"item_revision_conflict",exit_code:4,sources:["core/store/item-mutation-precondition.ts"]},{code:"likely_duplicate",exit_code:4,stable:!0,sources:["sdk/similarity.ts"]},{code:"linked_artifact_mutation_conflict",exit_code:2,sources:["sdk/linked-artifacts.ts"]},{code:"linked_resource_positional_value",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"linked_test_command_immutable",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_command_not_executable",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_context_invalid",exit_code:2,sources:["sdk/test/entry.ts"]},{code:"linked_test_patch_fields_unsupported",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_remove_no_match",exit_code:3,sources:["sdk/test/execution.ts"]},{code:"linked_test_update_ambiguous",exit_code:2,sources:["sdk/test/update.ts"]},{code:"linked_test_update_no_match",exit_code:3,sources:["sdk/test/update.ts"]},{code:"linked_test_value_not_quoted",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"list_source_incomplete",exit_code:1,stable:!0,sources:["sdk/query/list.ts"],emitting_commands:["list"]},{code:"local_package_archive_unsafe",exit_code:2,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"local_source_not_found_bare_name",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"lock_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/lock/lock.ts","core/telemetry/observability.ts"]},{code:"lock_lost",exit_code:4,sources:["core/lock/lock.ts"]},{code:"lock_path_unsafe",exit_code:4,sources:["core/lock/lock-confinement.ts"]},{code:"locks_stale_count",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"locks_unreadable",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"malformed_plan_step_evidence",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"managed_state_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"managed_state_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_capabilities_absent",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"manifest_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"manifest_unknown_key",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_declares_an_unknown_top_level_key",probe_id:"author-manifest-unknown-key",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"manifest_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"mcp_annotation_file_unavailable",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"mcp_stdin_unavailable",exit_code:2,sources:["sdk/annotations.ts"]},{code:"mcp_task_not_found_or_not_authorized",exit_code:3,sources:["sdk/mcp/tasks.ts"]},{code:"merge_artifacts_ignored",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_bun_launcher_unavailable",exit_code:5,sources:["sdk/merge/install.ts"]},{code:"merge_conflict_markers_detected",exit_code:1,stable:!0,sources:["core/item/item-format.ts"],aliases:["history_merge_conflict_markers_detected"]},{code:"merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_driver_configuration_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_fence_drift",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_fence_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_git_config_unwritable",exit_code:5,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_receipt_evidence_invalid",exit_code:4,sources:["core/diagnostics/remediation.ts","sdk/merge/reconcile.ts"]},{code:"merge_receipt_history_reference_missing",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_receipt_not_portable",exit_code:4,sources:["sdk/merge/receipts.ts"]},{code:"merge_receipts_pending",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"merge_reconcile_receipt_evidence_untrusted",exit_code:4,sources:["sdk/history-repair.ts"]},{code:"merge_root_not_found",exit_code:3,stable:!0,sources:["sdk/merge/install.ts"]}];(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]="7a831620-2973-5048-b691-f90e85f99dc2")}catch{}})();var O=[{code:"merge_settlement_hook_conflict",exit_code:4,sources:["sdk/merge/settlement-hook.ts"]},{code:"merge_settlement_review_required",exit_code:4,sources:["sdk/merge/ignored-artifacts.ts","sdk/merge/reconcile.ts","sdk/merge/stage.ts"]},{code:"missing_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"missing_cli_flag",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_directory",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"missing_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_lifecycle_target",exit_code:2,stable:!0,sources:["sdk/extension.ts"]},{code:"missing_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"missing_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_parameter_alias",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_positive_execution_receipt",exit_code:1,sources:["sdk/test/execution.ts"]},{code:"missing_probe",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_required_argument",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","cli/schema/registration.ts","core/telemetry/observability.ts","sdk/governance/assurance-action.ts","sdk/history-redact.ts","sdk/invocation-author.ts","sdk/lifecycle/claim.ts"],emitting_commands:["*","claim"]},{code:"missing_required_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/context-intent-contracts.ts","sdk/lifecycle/create.ts","sdk/lifecycle/plan.ts"],emitting_commands:["*","create","plan"]},{code:"missing_suggested_retry",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_suggested_retry_args",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"module_import_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"multi_target_github_install_ambiguous",exit_code:2,stable:!0,sources:["cli/register-setup.ts"]},{code:"mutation_author_required",exit_code:2,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"mutation_document_unreadable",exit_code:2,sources:["cli/register-structured-mutation.ts"]},{code:"mutation_option_value_invalid",exit_code:2,sources:["sdk/lifecycle/mutation-option-validation.ts"],emitting_commands:["item mutate"]},{code:"mutation_secret_guard_blocked",exit_code:4,stable:!0,sources:["sdk/mutation-guard.ts"]},{code:"no_matching_tests",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_projects_matched_filters",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_test_files_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_tests_found",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"no_update_fields",exit_code:1,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts"]},{code:"no_version_bounds_declared",exit_code:1,sources:["core/extensions/manifest-schema.ts"],owned_states:[{state:"author_workspace_manifest_omits_canonical_pm_version_bounds",probe_id:"author-manifest-version-bounds-missing",entrypoints:["health"],expected_exit_class:"generic_failure"}]},{code:"non_refusal_exit",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"npm_pack_json_shape_unsupported",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_missing",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_archive_unsafe",exit_code:1,sources:["sdk/extension/install-sources.ts"]},{code:"npm_package_not_found",exit_code:3,stable:!0,sources:["sdk/extension/install-sources.ts"]},{code:"ownership_conflict",exit_code:4,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/annotations.ts"]},{code:"ownership_dependency_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"ownership_metadata_bypass_restricted_options",exit_code:1,stable:!0,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"package_spec_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"package_upgrade_modes_mutually_exclusive",exit_code:2,sources:["sdk/governance/upgrade.ts"]},{code:"positional_shape_budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"positional_signature_mismatch",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"profile_name_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_name_not_normalized",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_summary_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"profile_title_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"project_runtime_history_epoch_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_item_format_incompatible",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_mutation",exit_code:4,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_runtime_stale_read",exit_code:1,sources:["sdk/environment/project-runtime-compatibility.ts"]},{code:"project_schema_field_requires_declared_flag",exit_code:2,sources:["core/extensions/item-fields.ts"]},{code:"projection_options_mutually_exclusive",exit_code:2,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"provenance_value_domain_invalid",exit_code:2,sources:["core/diagnostics/remediation.ts"]},{code:"read_output_cursor_command_mismatch",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_invalid",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"read_output_cursor_stale",exit_code:2,sources:["sdk/read-output/continuation.ts"]},{code:"recovery_kind_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"redundant_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"refusal_allowed_values_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_exit_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_mutated_state",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_probe_missing",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_recovery_failed",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"reindex_already_running",exit_code:4,stable:!0,sources:["sdk/governance/reindex.ts"]},{code:"removed_canonical_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"removed_compatibility_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"reopen_reason_required",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reopen_receipt_missing",exit_code:1,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"reopen_target_status_invalid",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reported_zero_passes",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reported_zero_tests",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reserved_item_field",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"retry_failed",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"schema_migration_input_required",exit_code:2,stable:!0,sources:["cli/migration-gates.ts"]},{code:"semantic_spelling_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"settings_invalid",exit_code:2,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_read_fs_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_invalid_schema",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_read_merge_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"settings_section_document_malformed",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_document_missing",exit_code:3,sources:["core/store/settings-sections.ts"]},{code:"settings_section_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_name_invalid",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_reserved",exit_code:2,sources:["core/store/settings-sections.ts"]},{code:"settings_section_revision_conflict",exit_code:4,sources:["core/store/settings-sections.ts"]},{code:"settings_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"settings_write_assigned_path_invalid",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_json",exit_code:2,sources:["core/store/settings.ts"]},{code:"settings_write_invalid_existing_schema",exit_code:2,sources:["core/store/settings.ts"]},{code:"stale_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"stale_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"stale_revision",exit_code:4,sources:["core/store/item-store.ts"]},{code:"start_blocked_by_open_dependency",exit_code:4,sources:["sdk/lifecycle/start-blockers.ts"],emitting_commands:["claim","start-task","update"]},{code:"status_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"status_lifecycle_role_required",exit_code:2,sources:["sdk/schema.ts"]},{code:"stdin_json_invalid",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"stdin_json_persisted_annotation_changed",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"stdin_json_unknown_key",exit_code:2,stable:!0,sources:["sdk/structured-mutations.ts"]},{code:"structured_event_immutable",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"structured_event_input_conflict",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_empty",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_json_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"structured_event_since_invalid",exit_code:2,stable:!0,sources:["sdk/notes.ts"]},{code:"suggested_retry_args_mismatch",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"telemetry_endpoint_probe_failed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_endpoint_probe_http_status",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_otel_export_failing",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_high_retries",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_invalid_rows",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_queue_pending",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_schema_version_behind",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"telemetry_state_invalid_json",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"template_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"terminal_plan_mutation",exit_code:4,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"terminal_state_conflict",exit_code:4,stable:!0,sources:["core/telemetry/observability.ts","sdk/lifecycle/claim.ts"],emitting_commands:["*","claim"]},{code:"test_measure_requires_execution",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"test_measure_requires_run",exit_code:2,sources:["sdk/test/prerequisites.ts"]},{code:"text_unpaired_surrogate",exit_code:2,sources:["core/item/item-format.ts","core/shared/output-unicode.ts"]},{code:"tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],aliases:["validate_storage_tracked_runtime_cache_files"]},{code:"tracker_not_initialized",exit_code:3,stable:!0,sources:["cli/error-guidance.ts","core/store/tracker-preflight.ts","core/telemetry/observability.ts"],owned_states:[{state:"selected_tracker_root_exists_without_settings",probe_id:"tracker-root-settings-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_missing",exit_code:3,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_does_not_exist",probe_id:"tracker-root-missing",entrypoints:["list"],expected_exit_class:"not_found"}]},{code:"tracker_root_not_directory",exit_code:2,stable:!0,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_a_regular_file",probe_id:"tracker-root-not-directory",entrypoints:["list"],expected_exit_class:"usage"}]},{code:"tracker_root_unreadable",exit_code:1,sources:["core/store/tracker-preflight.ts"],owned_states:[{state:"selected_tracker_root_is_not_readable",probe_id:"tracker-root-unreadable",entrypoints:["list"],expected_exit_class:"generic_failure"}]},{code:"transaction_abandoned",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_committed",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_create_compensated",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_journal_invalid",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_partial_mutation",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_plan_mismatch",exit_code:4,sources:["sdk/workspace-transaction.ts"]},{code:"transaction_preview_external_schema",exit_code:2,sources:["sdk/item-transaction.ts"]},{code:"transaction_preview_non_regular_file",exit_code:2,sources:["core/fs/fs-utils.ts"]},{code:"transaction_preview_snapshot_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"transaction_recovery_plan_missing",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"type_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"type_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"undeclared_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"unexpected_refusal_probe",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"unknown_command",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","core/telemetry/observability.ts","sdk/cli-contracts/runtime-contracts.ts"]},{code:"unknown_context_intent",exit_code:2,stable:!0,sources:["sdk/context-intent-contracts.ts"]},{code:"unknown_error",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"unknown_field",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_field_projection",exit_code:2,stable:!0,sources:["sdk/query/get.ts","sdk/query/list.ts","sdk/query/search-contracts.ts"],emitting_commands:["get","list","search"]},{code:"unknown_item_type",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_lifecycle_action",exit_code:2,stable:!0,sources:["sdk/agent/subcommand-recovery.ts"],canonical_code:"unknown_subcommand"},{code:"unknown_noun",exit_code:2,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"unknown_option",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/runtime/invocation-options.ts","core/telemetry/observability.ts"],owned_states:[{state:"declared_option_is_rejected_on_the_selected_command_path",probe_id:"cross-command-unknown-option",entrypoints:["deps"],expected_exit_class:"usage"}]},{code:"unknown_plan_template",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"unknown_provenance_dimension",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"unknown_status",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_subcommand",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","sdk/agent/subcommand-recovery.ts"],aliases:["unknown_lifecycle_action"],owned_states:[{state:"config_action_token_is_not_declared",probe_id:"config-unknown-action",entrypoints:["config"],expected_exit_class:"usage"},{state:"graph_command_token_is_not_declared",probe_id:"graph-unknown-subcommand",entrypoints:["graph"],expected_exit_class:"usage"},{state:"nested_command_token_is_not_declared_by_its_family",probe_id:"schema-unknown-subcommand",entrypoints:["schema"],expected_exit_class:"usage"},{state:"package_lifecycle_token_is_not_declared",probe_id:"package-unknown-action",entrypoints:["package"],expected_exit_class:"usage"}]},{code:"unsafe_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"unsupported_update_option",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"upsert_key_ambiguous",exit_code:4,sources:["sdk/structured-mutations.ts"]},{code:"upsert_key_conflict",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"upsert_key_duplicate",exit_code:2,sources:["sdk/item-transaction.ts","sdk/structured-mutations.ts"]},{code:"upsert_key_missing",exit_code:2,sources:["sdk/structured-mutations.ts"]},{code:"upsert_match_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"validate_command_references_stale_pm_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_ahead_format_version"},{code:"validate_format_version_outdated_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_outdated_format_version"},{code:"validate_hierarchy_parent_cycle",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_chain_mismatch"},{code:"validate_history_drift_hash_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_hash_mismatch"},{code:"validate_history_drift_missing_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_missing_stream"},{code:"validate_history_drift_unreadable_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_unreadable_stream"},{code:"validate_history_drift_version_skews",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_version_skew"},{code:"validate_history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_unknown_author_events"},{code:"validate_lifecycle_active_closure_like_metadata",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_driver_configuration",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_closed_at",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_duplicate_item_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_history_conflict_markers",exit_code:4,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_history_conflict_marker"},{code:"validate_storage_resurrected_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_tracked_runtime_cache_files",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"tracked_runtime_cache_files"},{code:"validate_storage_unparseable_config",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unparseable_history",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_storage_unreadable_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_embedding_identity_changed",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"vectorization_stale_items_remaining",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"visible_surface_ceiling_exceeded",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"workflow_duplicate_type",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_policy_approval_history_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_audit_failed",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_input_unreadable",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_invalid",exit_code:2,sources:["core/policy/workflow-policy.ts"]},{code:"workflow_policy_refused",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_policy_registry_invalid",exit_code:4,sources:["core/policy/workflow-policy-store.ts"]},{code:"workflow_status_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_transition_malformed",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_empty",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workflow_type_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"workspace_history_chain_invalid",exit_code:4,sources:["core/history/workspace-history.ts"]},{code:"workspace_history_state_conflict",exit_code:4,stable:!0,sources:["core/history/workspace-history.ts"]},{code:"workspace_root_pm_path",exit_code:2,stable:!0,sources:["sdk/init.ts"]},{code:"workspace_snapshot_force_required",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_manifest_mismatch",exit_code:4,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_name_reserved_fingerprint",exit_code:2,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_not_found",exit_code:3,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_permission_denied",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_resource_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"workspace_snapshot_storage_exhausted",exit_code:1,sources:["sdk/workspace-snapshot.ts"]},{code:"wrong_item_type",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]}];(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]="b525d8c8-3a70-52bd-83db-c956aba0c6fb")}catch{}})();var ze=E(T([...A,...O]));(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c2e89d3c-9abc-5ca7-a290-69a54dd694ab")}catch{}})();var G=Object.freeze({"--body":"Set the item body.","--body-file":"Read the item body from a file, or from stdin when set to -.","--description":"Set the item description.","--stdin":"Read the value from stdin.","--stdin-json":"Read a complete JSON document from stdin."}),B=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),V=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),Y=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),X=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),W=["--allow-","--check-","--dry-run","--explain","--fail-","--fix-","--full","--has-","--include-","--json","--no-","--prune-","--quiet","--refresh-","--require-","--runtime-only","--schema-only","--skip-","--stream","--strict-","--summary","--today","--verbose"],H=new Set(["--activate","--active-only","--adopt","--adopt-all","--all","--all-actionable","--all-affected-ids","--all-day","--all-streams","--acknowledge-linked-tests","--append-stable","--auto-fix","--auto-pm-context","--availability-only","--background","--brief","--by-assignee","--by-priority","--by-tag","--catalog","--claim","--clear","--clear-comments","--clear-criteria","--clear-deps","--clear-docs","--clear-events","--clear-files","--clear-learnings","--clear-notes","--clear-reminders","--clear-tests","--clear-type-options","--cli-only","--closed","--compact","--completion","--count","--counts","--deactivate","--declarative","--defaults","--describe","--diff","--doctor","--empty-body","--explore","--field-utilization","--filter-empty-body","--flags-only","--follow","--force","--global","--highlight","--hybrid","--id-only","--if-available","--ignore-global","--include_unparented","--infer","--init","--install","--isolated","--lean","--list","--local","--manage","--markdown","--metadata-coverage","--next","--normalize-provenance","--only","--only-last","--output-row-contract","--override-linked-pm-context","--override-linked-workspace-context","--packages-only","--past","--phrase-exact","--profile","--progress","--project","--promote-to-item-dep","--provenance","--provenance-summary","--raw","--ready-only","--ready_only","--rebuild","--recent","--reload","--repair","--replace-deps","--replace-docs","--replace-files","--replace-tests","--required","--required-on-create","--run","--runtime-probe","--save-baseline","--scaffold","--semantic","--shared-host-safe","--storage","--title-exact","--token-accounting","--trace","--tree","--unbounded","--uninstall","--validate-paths","--verify","--watch","--with-packages"]),J=new Set(["--only-index"]),K=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Q=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),Z=new Set(["--regression"]);function ee(e,t){return t==="--stdin"||t==="--stdin-json"?["stdin"]:Y.has(`${e}:${t}`)?["argv","file","stdin"]:t.endsWith("-file")?["argv","file"]:B.has(t)&&V.has(e)?["argv","stdin"]:["argv"]}function te(e,t){let s=K.has(`${e}:${t.flag}`)||t.value_name!==void 0||t.value_type==="string"||t.value_type==="number"||t.list===!0||t.repeatable===!0,o=t.value_type==="boolean"||t.flag==="--stdin"||t.flag==="--stdin-json"||t.flag.startsWith("--filter-")&&(t.flag.endsWith("-missing")||t.flag.startsWith("--filter-has-")||t.flag.startsWith("--filter-no-"))||W.some(i=>t.flag.startsWith(i));return s||J.has(t.flag)||!H.has(t.flag)&&!o}function se(e,t){return t.value_arity!==void 0?t.value_arity:te(e,t)?Z.has(t.flag)||Q.has(`${e}:${t.flag}`)?"optional":"required":"none"}function oe(e,t){let s=f(e),o=se(s,t),i=o!=="none",r=ee(s,t.flag),d=t.description??G[t.flag]??`${i?"Set":"Enable"} ${t.flag.slice(2).replaceAll("-"," ")}.`;return{...t,description:d,takes_value:i,value_required:o==="required",...i?{value_name:t.value_name??"value"}:{},value_type:i?t.value_type??"string":"boolean",required:t.required===!0,repeatable:t.repeatable===!0||t.list===!0,input_sources:r,...r.includes("stdin")&&t.flag!=="--stdin"&&t.flag!=="--stdin-json"?{stdin_token:"-"}:{},...X.has(`${s}:${t.flag}`)?{file_token_prefix:"@"}:{}}}function Be(e,t){return t.map(s=>oe(e,s))}function Ve(e,t,s){let o=e.trim().toLowerCase(),i=[],r=new Map,d=0;for(let c of s)if(c.command.trim().toLowerCase()===o){if(d+=1,r.has(c.flag)){i.push({code:"duplicate_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} was observed more than once.`});continue}r.set(c.flag,c)}let _=new Set(t.map(({flag:c})=>c));for(let c of t){let n=r.get(c.flag);if(!n){i.push({code:"missing_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} has no executable option observation.`});continue}for(let[l,I]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[l]!==n[l]&&i.push({code:I,command:o,flag:c.flag,detail:`${o} ${c.flag} declares ${l}=${String(c[l])} but the executable option reports ${String(n[l])}.`})}for(let c of r.values())_.has(c.flag)||i.push({code:"undeclared_observation",command:o,flag:c.flag,detail:`${o} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,n)=>c.flag.localeCompare(n.flag)||c.code.localeCompare(n.code)),{ok:i.length===0,declared_count:t.length,observed_count:d,findings:i}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="76c420db-b520-5fde-bd43-16a7324feb0a")}catch{}})();var ie=["mutation_receipt","entity","collection","diagnostic","stream"],ce=new Set(["append","claim","close","close-task","copy","create","delete","focus","pause-task","release","restore","start-task","update"]),re=new Set(["close-many","update-many"]),ae=new Set(["activity","comments","contracts","events","history","learnings","list","notes","search"]),ne=new Set(["aggregate","deps","graph","health","history-redact","history-repair","history-compact","stats","validate"]);function p(e){if(e.command.trim().length===0)throw new TypeError("command must be a non-empty command path");if(!ie.includes(e.kind))throw new TypeError(`Unsupported output envelope kind: ${e.kind}`);return e}function S(e){let t=e.trim().replace(/\s+/gu," "),[s=t]=t.split(" ");return re.has(s)?p({command:t,kind:"collection",wrapper_key:"rows",cardinality:"many",format_flag:"--json"}):ce.has(s)?p({command:t,kind:"mutation_receipt",wrapper_key:null,cardinality:"one",format_flag:"--json"}):ae.has(s)?p({command:t,kind:"collection",wrapper_key:s==="contracts"?null:"items",cardinality:"many",format_flag:"--json"}):ne.has(s)?p({command:t,kind:"diagnostic",wrapper_key:null,cardinality:"none",format_flag:"--json"}):p({command:t,kind:s==="get"?"entity":"diagnostic",wrapper_key:s==="get"?"item":null,cardinality:s==="get"?"one":"none",format_flag:"--json"})}var de=u.map(e=>S(e)),_e=new Map(de.map(e=>[e.command,e]));function He(e){let t=e.trim().replace(/\s+/gu," ");if(t.length===0)throw new TypeError("command must be a non-empty command path");let[s=t]=f(t).split(" "),o=_e.get(s);return o?{...o,command:t}:S(t)}function le(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ue(e){return le(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.status=="string"&&e.status.length>0&&Number.isSafeInteger(e.changed_field_count)&&Number(e.changed_field_count)>=0&&(e.close_reason===void 0||typeof e.close_reason=="string")&&(e.deleted===void 0||typeof e.deleted=="boolean")&&(e.previous_status===void 0||typeof e.previous_status=="string")&&(e.warnings===void 0||Array.isArray(e.warnings))}function Je(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(s){throw new TypeError(`Mutation receipt must be valid JSON: ${String(s)}`,{cause:s})}if(!ue(t))throw new TypeError("Mutation receipt must be a flat object with top-level id, status, and changed_field_count fields");return{id:t.id,status:t.status,changedFieldCount:t.changed_field_count,...typeof t.close_reason=="string"?{closeReason:t.close_reason}:{},...typeof t.deleted=="boolean"?{deleted:t.deleted}:{},...typeof t.previous_status=="string"?{previousStatus:t.previous_status}:{},...Array.isArray(t.warnings)?{warnings:t.warnings}:{}}}(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]="0c0bb7ab-6157-5861-ad7e-a63ae62220f4")}catch{}})();var me=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),pe=new Set(["append","comments","config","contracts","deps","docs","events","files","focus","graph","health","history","learnings","list-all","list-blocked","list-closed","list-in-progress","list-open","notes","profile","schema","test"]),fe=Object.freeze({workspace:new Set(["config","gc","health","init","merge","profile","schema","telemetry","workspace"]),intake:new Set(["copy","create","focus","item","restore"]),context:new Set(["activity","aggregate","context","ctx","duplicates","eval","get","help","list","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","next","search","stats"]),lifecycle:new Set(["claim","close","close-many","close-task","delete","pause-task","item-reopen","release","start-task","update","update-many"]),evidence:new Set(["append","comments","docs","events","files","history","history-attest","history-author-acknowledge","history-compact","history-redact","history-repair","learnings","notes"]),graph:new Set(["deps","graph","plan"]),quality:new Set(["assurance","contracts","test","test-all","validate"]),automation:new Set(["event","meet","remind"])}),ge=new Set(["extension","install","package","packages","upgrade"]);function xe(e){let t=m(e.trim().toLowerCase());if(t==="ops")return"quality";for(let[s,o]of Object.entries(fe))if(o.has(t))return s;return ge.has(t)?"extensions":"internal"}var y=Object.freeze([...u.flatMap(e=>e==="item"?["item","item-reopen"]:[e,...b.filter(t=>t.alias===e).map(t=>t.canonical)]).map(e=>({command:e,tier:me.has(m(e))?"core":pe.has(m(e))?"standard":"full",family:xe(e)})),{command:"ops",tier:"core",family:"quality"},{command:"completion-statuses",tier:"internal",family:"internal"},{command:"completion-tags",tier:"internal",family:"internal"},{command:"completion-types",tier:"internal",family:"internal"},{command:"test-runs-worker",tier:"internal",family:"internal"},{command:"item test worker",tier:"internal",family:"internal"}]),ye=y,et=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),tt=Object.freeze(["-V, --version","--all","--json","--output-include <fields>","--output-limit <count>","--output-budget <tokens|unbounded>","--output-cursor <cursor>","--pm-path <dir>","--no-extensions","--no-pager","--explain","-h, --help"]);var M={core:0,standard:1,full:2,internal:3},N=new Map(ye.map(({command:e,tier:t})=>[e,t]));function st(e,t="standard"){return N.get(e.trim().toLowerCase())??N.get(m(e.trim().toLowerCase()))??t}function ot(e){return be(e,y)}function be(e,t){let s=M[e];return t.filter(o=>o.tier!=="internal"&&M[o.tier]<=s).map(o=>o.command)}function ke(e,t){return t.filter(s=>s.family===e).map(s=>s.command)}var he=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],ve=new Set([...k.filter(e=>e.hidden).map(e=>e.alias),"ctx","extension","install","item-reopen","list-all","list-blocked","list-canceled","list-closed","list-draft","list-in-progress","list-open","packages","upgrade"]);function it(e=y){return he.map(t=>({family:t,commands:ke(t,e).filter(s=>e.find(o=>o.command===s)?.tier!=="internal"&&!ve.has(s))})).filter(({commands:t})=>t.length>0)}var ct=Object.freeze({pm_append:"append",pm_claim:"claim",pm_close:"close",pm_comments:"comments",pm_config:"config",pm_context:"context",pm_contracts:"contracts",pm_copy:"copy",pm_create:"create",pm_deps:"deps",pm_discover:"help",pm_docs:"docs",pm_events:"history",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_mutate:"update",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_run:"package",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"});var rt=Object.freeze([{uri:"pm://workspace/context",name:"Workspace context",description:"Bounded project context for orientation, including active hierarchy and progress.",mimeType:"application/json"},{uri:"pm://workspace/focus",name:"Active focus",description:"The session focus that supplies the default create parent.",mimeType:"application/json"},{uri:"pm://workspace/claims",name:"Active claims",description:"Bounded in-progress work and active ownership context.",mimeType:"application/json"},{uri:"pm://workspace/agent-guide",name:"Agent guidance",description:"Repository-local AGENTS.md instructions, bounded for safe host attachment.",mimeType:"text/markdown"}]),at=Object.freeze([{name:"orient",description:"Build bounded live context, search all statuses, and select canonical work without creating duplicates.",arguments:[{name:"request",description:"The user's requested outcome or topic.",required:!0},{name:"scope",description:"Optional bounded workspace or subsystem scope.",required:!1}],template:"Orient to the live pm workspace for: {{request}}. Scope hint: {{scope}}. Read context, search all statuses, inspect full metadata for relevant items, and select canonical lineage before any mutation."},{name:"claim-and-start",description:"Claim one canonical item and begin implementation with linked context.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0}],template:"Read {{id}} in full, claim it, set it in_progress, then implement only its acceptance scope while linking files, docs, tests, and evidence."},{name:"record-evidence-and-close",description:"Record exact verification evidence, close the item, and release ownership.",arguments:[{name:"id",description:"Canonical pm item id.",required:!0},{name:"evidence",description:"Exact verification and outcome evidence.",required:!0}],template:"For {{id}}, record this evidence: {{evidence}}. Verify linked tests, close only if acceptance is met, then release the claim."}]);export{D as a,w as b,R as c,Ee as d,Te as e,Ae as f,Oe as g,Se as h,x as i,E as j,Ne as k,C as l,ze as m,oe as n,Be as o,Ve as p,y as q,st as r,ot as s,it as t,ie as u,p as v,de as w,He as x,ue as y,Je as z};
2
+ //# sourceMappingURL=chunk-CZM75DE3.js.map
@@ -1,3 +1,3 @@
1
- import{a as c}from"./chunk-HJ27QLZV.js";import{g as d,oa as w,pa as u}from"./chunk-HUXZCPWT.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]="158d5065-075c-5355-a65c-f3edc9c5f1f0")}catch{}})();var _=new Map(d.map(e=>[e.toLowerCase(),e])),$=/^[A-Za-z][A-Za-z0-9_-]*$/;function g(e,t){if(!$.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function y(e){return _.get(e.trim().toLowerCase())}function A(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function I(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function b(e){let t=new Map;for(let o of e){let n=o.trim();if(n.length===0)continue;let i=n.toLowerCase();t.has(i)||t.set(i,n)}return[...t.values()].sort((o,n)=>o.localeCompare(n))}function S(e){let t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");g(t,"Type name");let o=y(t);if(o)throw new Error(`Cannot redefine built-in item type "${o}". Built-in types are reserved: ${d.join(", ")}.`);let n=e.description?.trim(),i=e.defaultStatus?.trim(),r=e.folder?.trim(),a=r&&r.length>0?u(r):void 0,s=b(e.aliases??[]);for(let l of s){g(l,"Alias");let f=y(l);if(f)throw new Error(`Alias "${l}" collides with built-in item type "${f}". Built-in types are reserved: ${d.join(", ")}.`)}return{name:t,description:n&&n.length>0?n:void 0,defaultStatus:i&&i.length>0?i:void 0,folder:a,aliases:s}}function x(e,t){let o=e.name.toLowerCase(),n=new Map;for(let r of t.definitions){if(typeof r.name!="string")continue;let a=r.name.trim();if(!(a.length===0||a.toLowerCase()===o)){n.set(a.toLowerCase(),a);for(let s of A(r.aliases))s.trim().length>0&&n.set(s.trim().toLowerCase(),a)}}let i=n.get(o);if(i)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${i}".`);for(let r of e.aliases){let a=n.get(r.toLowerCase());if(a)throw new Error(`Alias "${r}" already maps to existing item type "${a}".`)}}function h(e,t){return typeof t=="string"&&t.trim().length>0?u(t).toLowerCase():w(e).toLowerCase()}function D(e,t,o){let n=e.name.toLowerCase(),i=h(e.name,e.folder),r=s=>{throw new Error(`Item type "${e.name}" would store items in folder "${i}", which already belongs to existing item type "${s}". Pass a distinct --folder to keep their storage separate.`)};for(let s of t.definitions){if(typeof s.name!="string")continue;let l=s.name.trim();l.length===0||l.toLowerCase()===n||h(l,s.folder)===i&&r(l)}let a=o?.get(i);a!==void 0&&a.toLowerCase()!==n&&r(a)}function j(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:L(t)}}function L(e){let t=C(e);if(!t)return[];let o=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.name!="string"||i.name.trim().length===0||o.push(i)}return o}function C(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let o=t.item_types;if(Array.isArray(o.definitions))return o.definitions}}function z(e,t){let o=t.name.toLowerCase(),n=e.definitions.slice(),i=n.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===o),r=i>=0?n[i]:void 0,a=b([...A(r?.aliases),...t.aliases]),s={...r,name:t.name};return t.folder!==void 0&&(s.folder=t.folder),a.length>0?s.aliases=a:s.aliases!==void 0&&delete s.aliases,T(s,"description",t.description),T(s,"default_status",t.defaultStatus),i>=0?n[i]=s:n.push(s),n.sort((l,f)=>l.name.localeCompare(f.name)),{file:{definitions:n},definition:s,replaced:i>=0,...r&&typeof r.name=="string"?{previousName:r.name}:{}}}function F(e,t){let o=(t??"").trim();if(o.length===0)throw new Error("Type name must not be empty.");let n=y(o);if(n)throw new Error(`Cannot remove built-in item type "${n}". Built-in types are reserved: ${d.join(", ")}.`);let i=o.toLowerCase(),r=e.definitions.slice(),a=r.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===i);if(a<0)return{file:{definitions:r},removed:!1};let[s]=r.splice(a,1);return{file:{definitions:r},removed:!0,definition:s}}function T(e,t,o){let n=e;o!==void 0&&(n[t]=o)}function M(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
1
+ import{a as c}from"./chunk-VWWTIX5L.js";import{g as d,pa as w,qa as u}from"./chunk-M6V7UMWL.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]="158d5065-075c-5355-a65c-f3edc9c5f1f0")}catch{}})();var _=new Map(d.map(e=>[e.toLowerCase(),e])),$=/^[A-Za-z][A-Za-z0-9_-]*$/;function g(e,t){if(!$.test(e))throw new Error(`${t} "${e}" is not a valid identifier. Use a single letter-led token of letters, digits, hyphen, or underscore with no spaces or punctuation (e.g. "Spike" or "code-review").`)}function y(e){return _.get(e.trim().toLowerCase())}function A(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function I(e){return e.replace(/[\\"`$]/g,t=>`\\${t}`)}function b(e){let t=new Map;for(let o of e){let n=o.trim();if(n.length===0)continue;let i=n.toLowerCase();t.has(i)||t.set(i,n)}return[...t.values()].sort((o,n)=>o.localeCompare(n))}function S(e){let t=(e.name??"").trim();if(t.length===0)throw new Error("Type name must not be empty.");g(t,"Type name");let o=y(t);if(o)throw new Error(`Cannot redefine built-in item type "${o}". Built-in types are reserved: ${d.join(", ")}.`);let n=e.description?.trim(),i=e.defaultStatus?.trim(),r=e.folder?.trim(),a=r&&r.length>0?u(r):void 0,s=b(e.aliases??[]);for(let l of s){g(l,"Alias");let f=y(l);if(f)throw new Error(`Alias "${l}" collides with built-in item type "${f}". Built-in types are reserved: ${d.join(", ")}.`)}return{name:t,description:n&&n.length>0?n:void 0,defaultStatus:i&&i.length>0?i:void 0,folder:a,aliases:s}}function x(e,t){let o=e.name.toLowerCase(),n=new Map;for(let r of t.definitions){if(typeof r.name!="string")continue;let a=r.name.trim();if(!(a.length===0||a.toLowerCase()===o)){n.set(a.toLowerCase(),a);for(let s of A(r.aliases))s.trim().length>0&&n.set(s.trim().toLowerCase(),a)}}let i=n.get(o);if(i)throw new Error(`Type name "${e.name}" collides with an alias of existing item type "${i}".`);for(let r of e.aliases){let a=n.get(r.toLowerCase());if(a)throw new Error(`Alias "${r}" already maps to existing item type "${a}".`)}}function h(e,t){return typeof t=="string"&&t.trim().length>0?u(t).toLowerCase():w(e).toLowerCase()}function D(e,t,o){let n=e.name.toLowerCase(),i=h(e.name,e.folder),r=s=>{throw new Error(`Item type "${e.name}" would store items in folder "${i}", which already belongs to existing item type "${s}". Pass a distinct --folder to keep their storage separate.`)};for(let s of t.definitions){if(typeof s.name!="string")continue;let l=s.name.trim();l.length===0||l.toLowerCase()===n||h(l,s.folder)===i&&r(l)}let a=o?.get(i);a!==void 0&&a.toLowerCase()!==n&&r(a)}function j(e){if(e==null||e.trim().length===0)return{definitions:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/types.json contains invalid JSON.")}return{definitions:L(t)}}function L(e){let t=C(e);if(!t)return[];let o=[];for(let n of t){if(typeof n!="object"||n===null||Array.isArray(n))continue;let i=n;typeof i.name!="string"||i.name.trim().length===0||o.push(i)}return o}function C(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.definitions))return t.definitions;if(typeof t.item_types=="object"&&t.item_types!==null){let o=t.item_types;if(Array.isArray(o.definitions))return o.definitions}}function z(e,t){let o=t.name.toLowerCase(),n=e.definitions.slice(),i=n.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===o),r=i>=0?n[i]:void 0,a=b([...A(r?.aliases),...t.aliases]),s={...r,name:t.name};return t.folder!==void 0&&(s.folder=t.folder),a.length>0?s.aliases=a:s.aliases!==void 0&&delete s.aliases,T(s,"description",t.description),T(s,"default_status",t.defaultStatus),i>=0?n[i]=s:n.push(s),n.sort((l,f)=>l.name.localeCompare(f.name)),{file:{definitions:n},definition:s,replaced:i>=0,...r&&typeof r.name=="string"?{previousName:r.name}:{}}}function F(e,t){let o=(t??"").trim();if(o.length===0)throw new Error("Type name must not be empty.");let n=y(o);if(n)throw new Error(`Cannot remove built-in item type "${n}". Built-in types are reserved: ${d.join(", ")}.`);let i=o.toLowerCase(),r=e.definitions.slice(),a=r.findIndex(l=>typeof l.name=="string"&&l.name.trim().toLowerCase()===i);if(a<0)return{file:{definitions:r},removed:!1};let[s]=r.splice(a,1);return{file:{definitions:r},removed:!0,definition:s}}function T(e,t,o){let n=e;o!==void 0&&(n[t]=o)}function M(e){return`${JSON.stringify({definitions:e.definitions},null,2)}
2
2
  `}function E(e,t){let o=e.trim().length>0?e.trim():e,n=t?.trim()||".agents/pm/schema/types.json";return`To register a custom type, run: pm schema add-type "${I(o)}" (writes ${n}).`}function O(e,t,o){return`Invalid type value "${e}". Allowed: ${t.join(", ")}. ${E(e,o)}`}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="77a7b77a-907c-541d-ac55-e06174dbbf11")}catch{}})();function v(e){return typeof e=="string"?e.trim().toLowerCase():""}function m(e,t){let o=c(e);return o.length===0?"":t?.alias_to_id?.get(o)??o}function U(e){let t=Array.isArray(e?.type_workflows)?e.type_workflows:[],o=new Map;for(let n of t){let i=v(n?.type);if(i.length===0||!Array.isArray(n?.allowed_transitions))continue;let r=n.allowed_transitions,a=o.get(i)??{pairs:[],denyAll:!1};r.length===0&&(a.denyAll=!0);for(let s of r){if(!Array.isArray(s)||s.length!==2)continue;let l=c(s[0]),f=c(s[1]);l.length===0||f.length===0||a.pairs.some(p=>p[0]===l&&p[1]===f)||a.pairs.push([l,f])}o.set(i,a)}return[...o.entries()].filter(([,n])=>n.pairs.length>0||n.denyAll).map(([n,i])=>({type:n,allowed_transitions:i.pairs})).sort((n,i)=>n.type.localeCompare(i.type))}function J(e){let t=v(e.typeName),o=e.typeWorkflows.find(r=>r.type===t);if(!o)return{allowed:!0,hasRule:!1,allowedTransitions:[]};let n=m(e.fromStatus,e.statusRegistry),i=m(e.toStatus,e.statusRegistry);return n.length>0&&n===i?{allowed:!0,hasRule:!0,allowedTransitions:o.allowed_transitions}:{allowed:o.allowed_transitions.some(r=>{let a=m(r[0],e.statusRegistry),s=m(r[1],e.statusRegistry);return a===n&&s===i}),hasRule:!0,allowedTransitions:o.allowed_transitions}}function W(e){return e.length===0?"(no transitions allowed)":e.map(t=>`${t[0]} -> ${t[1]}`).join(", ")}export{y as a,I as b,S as c,x as d,D as e,j as f,z as g,F as h,M as i,O as j,U as k,J as l,W as m};
3
- //# sourceMappingURL=chunk-TYHDZUL4.js.map
3
+ //# sourceMappingURL=chunk-D2TBEBNW.js.map
@@ -0,0 +1,2 @@
1
+ import{c as T,f as L}from"./chunk-7KK66ISG.js";import{M as f,N as D,aa as R,e as y,f as v}from"./chunk-O7EI33NP.js";import{fb as E,kb as x}from"./chunk-YMGB2O4E.js";import{j as I}from"./chunk-VWWTIX5L.js";import{a as k,b as C}from"./chunk-C3O6JJPO.js";import{Da as l,U as m,ra as g,xa as h,xc as _}from"./chunk-M6V7UMWL.js";import{A as s,C as w,z as a}from"./chunk-G6ERMFJ5.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="59842825-3a81-53f4-845d-db2257ec6286")}catch{}})();async function X(e){let o=h(process.cwd(),e);await x(o);let i=await E(o),r=g(i,_());return{pmRoot:o,settings:i,typeRegistry:r}}async function j(e,o,i,r){l(e,y(o));let t=await f(e,o,i.id_prefix,i.item_format,r);if(t)return{id:t.id,historyPath:l(e,t.id),located:t};let n=v(o,i.id_prefix),d=y(o),c=n===d?[n]:[n,d];for(let p of c){let b=l(e,p);if(await w(b))return{id:p,historyPath:b,located:null}}throw new s(`Item ${o} not found`,a.NOT_FOUND)}import{readdir as P}from"node:fs/promises";import u from"node:path";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="e9b7731d-e6f5-51a8-970b-462c0b728a9c")}catch{}})();function B(e,o){let i=new Map;for(let r of e){let t=r.external?r.id:o.get(r.id.toLowerCase())?.id??r.id;i.set(r.external?`external:${t}`:`local:${t.toLowerCase()}`,{...r,id:t})}return[...i.values()]}async function $(e,o){let i=u.basename(e),r=(await P(u.dirname(e)).catch(t=>{throw R("Cannot verify the blocker's physical file identity",{exitCode:a.GENERIC_FAILURE,context:{code:"blocker_identity_read_failed",required:"Restore access to the blocker item directory, then retry the item read."},cause:t})})).filter(t=>t.toLowerCase()===i.toLowerCase()).sort((t,n)=>+(n===i)-+(t===i)||t.localeCompare(n)).map(t=>u.parse(t).name)[0];if(r===void 0)throw new s(`Blocker canonical file disappeared during identity verification: ${o}`,a.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker file and validate storage integrity before retrying the item read."});return r}async function te(e){let o=T(e.metadata);if(o.length===0)return[];let i=new Map([e.metadata.blocked_by,...(e.metadata.dependencies??[]).filter(t=>m(t.kind)==="blocked_by").map(t=>t.id)].filter(t=>typeof t=="string").map(t=>[t.trim().toLowerCase(),t.trim()])),r=new Map;for(let t of o){if(k(t)||!/^(?!\.{1,2}$)[^/\\:\0]+$/u.test(t)||e.metadata.dependencies?.some(c=>c.id.trim()===t&&m(c.kind)==="blocked_by"&&C(c.source_kind)))continue;let n=await f(e.pmRoot,i.get(t),e.settings.id_prefix,e.settings.item_format,e.typeToFolder);if(n===null)continue;let d=await D(n,{schema:e.settings.schema});if(n.id=await $(n.itemPath,n.id),d.document.metadata.id!==n.id)throw new s(`Blocker identity differs from its canonical file: ${n.id}`,a.CONFLICT,{code:"item_identity_conflict",required:"Restore the canonical blocker identity and validate storage integrity before retrying the item read."});r.set(t.toLowerCase(),d.document.metadata)}return B(L({blocked_by:e.metadata.blocked_by,dependencies:e.metadata.dependencies,updated_at:e.metadata.updated_at},r,I(e.settings.schema)),r)}export{X as a,j as b,$ as c,te as d};
2
+ //# sourceMappingURL=chunk-E56OXRYH.js.map
@@ -1,6 +1,6 @@
1
- import{c as T}from"./chunk-TYHDZUL4.js";import{a,d as I}from"./chunk-HJ27QLZV.js";import{Y as w,j as g,k as v,l as E}from"./chunk-HUXZCPWT.js";import{A as u,C as m,m as k,z as f}from"./chunk-G6ERMFJ5.js";import C from"node:fs/promises";import p 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]="74b72dd8-0877-55a4-9c80-d043f19e1f96")}catch{}})();var P=["extensions","docs","examples","assets","prompts"],U=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function R(e){return P.includes(e)}function q(e,t){if(t==null)return[];let n=Array.isArray(t)?t:[t],r=[];for(let o of n){if(typeof o!="string"||o.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);r.push(o.trim())}return[...new Set(r)].sort((o,i)=>o.localeCompare(i))}function G(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},n=e;for(let[r,o]of Object.entries(n)){if(!R(r))continue;let i=q(r,o);i.length>0&&(t[r]=i)}return t}function c(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n.trim():void 0}function S(e){if(!Array.isArray(e))return;let t=e.map(n=>typeof n=="string"?n.trim():"").filter(n=>n.length>0);return t.length>0?[...new Set(t)].sort((n,r)=>n.localeCompare(r)):void 0}function x(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function J(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={docs:c(t,"docs"),npm:c(t,"npm"),repository:c(t,"repository"),report:c(t,"report")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={image:c(t,"image"),video:c(t,"video")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={display_name:c(t,"display_name")??c(t,"displayName"),category:c(t,"category"),summary:c(t,"summary"),links:J(t.links),media:K(t.media),tags:S(t.tags)};return Object.values(n).some(r=>r!==void 0)?n:void 0}async function Y(e){let t=p.join(e,"package.json");if(!await m(t))return{source:"convention",resources:{}};let n;try{n=JSON.parse(await C.readFile(t,"utf8"))}catch(l){throw new u(`Failed to parse package manifest at "${t}": ${String(l)}`,f.USAGE)}if(typeof n!="object"||n===null||Array.isArray(n))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let r=n,o=r.pm,i=o!=null,s=typeof o=="object"&&o!==null&&!Array.isArray(o)?o:{};return{source:i?"pm":"convention",package_json_path:t,package_name:typeof r.name=="string"?r.name:void 0,package_version:typeof r.version=="string"?r.version:void 0,package_private:r.private===!0,package_description:typeof r.description=="string"?r.description:void 0,package_keywords:S(r.keywords),package_homepage:typeof r.homepage=="string"?r.homepage:void 0,package_repository_url:x(r.repository),package_bugs_url:x(r.bugs),aliases:S(s.aliases),resources:G(o),catalog:V(s.catalog)}}async function j(e){if(!await m(e))return[];let t=await C.readdir(e,{withFileTypes:!0}),n=[];for(let r of t){if(!r.isDirectory())continue;let o=p.join(e,r.name);await m(p.join(o,"manifest.json"))&&n.push(o)}return n.sort((r,o)=>r.localeCompare(o))}async function he(e){if(await m(p.join(e,"manifest.json")))return[e];let t=(await Y(e)).resources.extensions??[],n=new Set;for(let r of t){if(r.includes("*")||r.startsWith("!"))throw new u(`Package extension entry "${r}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,r);if(!w(e,o))throw new u(`Package extension entry "${r}" resolves outside package root.`,f.USAGE);if(await m(p.join(o,"manifest.json"))){n.add(o);continue}for(let i of await j(o))n.add(i)}if(t.length===0)for(let r of U.extensions)for(let o of await j(p.join(e,r)))n.add(o);return[...n].sort((r,o)=>r.localeCompare(o))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3984f1ef-1703-5a83-a4fa-ec1cdc738572")}catch{}})();var D=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function A(e){return"#".repeat(e)}function $(e){if(!e.includes("`"))return`\`${e}\``;let t=0,n=0;for(let i of e)n=i==="`"?n+1:0,t=Math.max(t,n);let r="`".repeat(t+1),o=e.startsWith("`")||e.endsWith("`")?" ":"";return`${r}${o}${e}${o}${r}`}function B(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map($).join(", ")}`}function W(e,t,n){let r=[`${A(t)} ${e}`,""];return n.length===0?(r.push("_None._",""),r):(r.push(...n.map(o=>`- ${$(o)}`),""),r)}function H(e,t,n){return e===0&&!n?[]:[`${A(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function be(e,t={}){let n=t.headingLevel??2;if(!Number.isInteger(n)||n<1||n>6)throw new RangeError(`headingLevel must be an integer in [1, 6], received ${String(t.headingLevel)}`);let r=Math.min(n+1,6),o=t.includeEmpty===!0,i=t.title??"Extension surfaces",s=[`${A(n)} ${i}`,""];(o||e.capabilities.length>0)&&s.push(B(e.capabilities),"");for(let[l,d]of D){let y=e[l]??[];y.length===0&&!o||s.push(...W(d,r,y))}return s.push(...H(e.preflight_overrides,r,o)),!(e.preflight_overrides>0||D.some(([l])=>(e[l]?.length??0)>0))&&!o&&s.push("_This extension registers no surfaces._",""),`${s.join(`
1
+ import{c as T}from"./chunk-D2TBEBNW.js";import{a,d as I}from"./chunk-VWWTIX5L.js";import{Z as w,j as g,k as v,l as E}from"./chunk-M6V7UMWL.js";import{A as u,C as m,m as k,z as f}from"./chunk-G6ERMFJ5.js";import C from"node:fs/promises";import p 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]="74b72dd8-0877-55a4-9c80-d043f19e1f96")}catch{}})();var P=["extensions","docs","examples","assets","prompts"],U=Object.freeze({extensions:Object.freeze([".agents/pm/extensions","extensions",".custom/pm-extensions",".custom/pm-extension"]),docs:Object.freeze(["docs","documentation"]),examples:Object.freeze(["examples","docs/examples"]),assets:Object.freeze(["assets",".agents/pm/assets"]),prompts:Object.freeze(["prompts",".agents/pm/prompts"])});function R(e){return P.includes(e)}function q(e,t){if(t==null)return[];let n=Array.isArray(t)?t:[t],r=[];for(let o of n){if(typeof o!="string"||o.trim().length===0)throw new u(`Package manifest field pm.${e} must contain string paths.`,f.USAGE);r.push(o.trim())}return[...new Set(r)].sort((o,i)=>o.localeCompare(i))}function G(e){if(e==null)return{};if(typeof e!="object"||Array.isArray(e))throw new u("Package manifest field pm must be an object.",f.USAGE);let t={},n=e;for(let[r,o]of Object.entries(n)){if(!R(r))continue;let i=q(r,o);i.length>0&&(t[r]=i)}return t}function c(e,t){let n=e[t];return typeof n=="string"&&n.trim().length>0?n.trim():void 0}function S(e){if(!Array.isArray(e))return;let t=e.map(n=>typeof n=="string"?n.trim():"").filter(n=>n.length>0);return t.length>0?[...new Set(t)].sort((n,r)=>n.localeCompare(r)):void 0}function x(e){if(typeof e=="string"&&e.trim().length>0)return e.trim();if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let t=e.url;return typeof t=="string"&&t.trim().length>0?t.trim():void 0}}function J(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={docs:c(t,"docs"),npm:c(t,"npm"),repository:c(t,"repository"),report:c(t,"report")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function K(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={image:c(t,"image"),video:c(t,"video")};return Object.values(n).some(r=>typeof r=="string")?n:void 0}function V(e){if(typeof e!="object"||e===null||Array.isArray(e))return;let t=e,n={display_name:c(t,"display_name")??c(t,"displayName"),category:c(t,"category"),summary:c(t,"summary"),links:J(t.links),media:K(t.media),tags:S(t.tags)};return Object.values(n).some(r=>r!==void 0)?n:void 0}async function Y(e){let t=p.join(e,"package.json");if(!await m(t))return{source:"convention",resources:{}};let n;try{n=JSON.parse(await C.readFile(t,"utf8"))}catch(l){throw new u(`Failed to parse package manifest at "${t}": ${String(l)}`,f.USAGE)}if(typeof n!="object"||n===null||Array.isArray(n))throw new u(`Package manifest at "${t}" must be a JSON object.`,f.USAGE);let r=n,o=r.pm,i=o!=null,s=typeof o=="object"&&o!==null&&!Array.isArray(o)?o:{};return{source:i?"pm":"convention",package_json_path:t,package_name:typeof r.name=="string"?r.name:void 0,package_version:typeof r.version=="string"?r.version:void 0,package_private:r.private===!0,package_description:typeof r.description=="string"?r.description:void 0,package_keywords:S(r.keywords),package_homepage:typeof r.homepage=="string"?r.homepage:void 0,package_repository_url:x(r.repository),package_bugs_url:x(r.bugs),aliases:S(s.aliases),resources:G(o),catalog:V(s.catalog)}}async function j(e){if(!await m(e))return[];let t=await C.readdir(e,{withFileTypes:!0}),n=[];for(let r of t){if(!r.isDirectory())continue;let o=p.join(e,r.name);await m(p.join(o,"manifest.json"))&&n.push(o)}return n.sort((r,o)=>r.localeCompare(o))}async function he(e){if(await m(p.join(e,"manifest.json")))return[e];let t=(await Y(e)).resources.extensions??[],n=new Set;for(let r of t){if(r.includes("*")||r.startsWith("!"))throw new u(`Package extension entry "${r}" uses a glob/exclusion pattern. pm package installs currently require concrete extension paths or directories.`,f.USAGE);let o=p.resolve(e,r);if(!w(e,o))throw new u(`Package extension entry "${r}" resolves outside package root.`,f.USAGE);if(await m(p.join(o,"manifest.json"))){n.add(o);continue}for(let i of await j(o))n.add(i)}if(t.length===0)for(let r of U.extensions)for(let o of await j(p.join(e,r)))n.add(o);return[...n].sort((r,o)=>r.localeCompare(o))}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3984f1ef-1703-5a83-a4fa-ec1cdc738572")}catch{}})();var D=[["commands","Commands"],["command_overrides","Command overrides"],["flag_commands","Flag commands"],["item_types","Item types"],["item_fields","Item fields"],["migrations","Migrations"],["profiles","Profiles"],["importers","Importers"],["exporters","Exporters"],["search_providers","Search providers"],["vector_store_adapters","Vector store adapters"],["assurance_providers","Assurance measurement providers"],["hooks","Lifecycle hooks"],["parser_overrides","Parser overrides"],["service_overrides","Service overrides"],["renderer_overrides","Renderer overrides"]];function A(e){return"#".repeat(e)}function $(e){if(!e.includes("`"))return`\`${e}\``;let t=0,n=0;for(let i of e)n=i==="`"?n+1:0,t=Math.max(t,n);let r="`".repeat(t+1),o=e.startsWith("`")||e.endsWith("`")?" ":"";return`${r}${o}${e}${o}${r}`}function B(e){return e.length===0?"Capabilities: _none registered_":`Capabilities: ${e.map($).join(", ")}`}function W(e,t,n){let r=[`${A(t)} ${e}`,""];return n.length===0?(r.push("_None._",""),r):(r.push(...n.map(o=>`- ${$(o)}`),""),r)}function H(e,t,n){return e===0&&!n?[]:[`${A(t)} Preflight overrides`,"",e>0?`- ${e} registered (this surface carries no per-entry identifier)`:"_None._",""]}function be(e,t={}){let n=t.headingLevel??2;if(!Number.isInteger(n)||n<1||n>6)throw new RangeError(`headingLevel must be an integer in [1, 6], received ${String(t.headingLevel)}`);let r=Math.min(n+1,6),o=t.includeEmpty===!0,i=t.title??"Extension surfaces",s=[`${A(n)} ${i}`,""];(o||e.capabilities.length>0)&&s.push(B(e.capabilities),"");for(let[l,d]of D){let y=e[l]??[];y.length===0&&!o||s.push(...W(d,r,y))}return s.push(...H(e.preflight_overrides,r,o)),!(e.preflight_overrides>0||D.some(([l])=>(e[l]?.length??0)>0))&&!o&&s.push("_This extension registers no surfaces._",""),`${s.join(`
2
2
  `).trimEnd()}
3
3
  `}(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]="abb182c9-6d6c-5be4-a2ad-c91b00a098d0")}catch{}})();var X=["agile","ops","research"],Q={agile:[{name:"Story",description:"User-facing outcome or capability slice expressed from a stakeholder perspective.",defaultStatus:"open",folder:"stories",aliases:["user-story"]},{name:"Spike",description:"Time-boxed investigation used to reduce uncertainty before implementation.",defaultStatus:"open",folder:"spikes",aliases:["research-spike"]}],ops:[{name:"Incident",description:"Operational disruption, degradation, or support escalation with recovery tracking.",defaultStatus:"open",folder:"incidents",aliases:["outage"]},{name:"Runbook",description:"Repeatable operational procedure, diagnostic path, or response playbook.",defaultStatus:"open",folder:"runbooks",aliases:["playbook"]}],research:[{name:"Experiment",description:"Validated-learning activity with hypothesis, method, and outcome tracking.",defaultStatus:"open",folder:"experiments",aliases:["study"]},{name:"Hypothesis",description:"Testable claim or assumption that should be supported, rejected, or refined.",defaultStatus:"open",folder:"hypotheses",aliases:["assumption"]}]};function Se(e){if(e===void 0)return;let t=e.trim().toLowerCase().replaceAll("-","_");if(t.length===0)throw new Error("Type preset name must not be empty.");if(t==="agile"||t==="ops"||t==="research")return t;throw new Error(`Invalid type preset "${e}". Allowed: ${X.join(", ")}.`)}function Ae(e){return Q[e].map(t=>T(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]="1abceae0-299e-5fff-aa8c-46c015115571")}catch{}})();var Z=new Set(v),ee=new Set(E),F=new Set([...k.filter(e=>e!=="severity"),"id","title","type","status","priority","tags","assignee","parent","description","body","created_at","updated_at","closed_at","completed_at","author","deadline","estimate","sprint","release","risk","confidence","reviewer","resolution","expected","actual"]),te=["create","update"];function z(e){if(typeof e!="string")return"";let t=e.trim().toLowerCase().replaceAll(/[\s_]+/g,"-");return t.startsWith("--")?t.slice(2):t}function N(e){return e.replaceAll("_","-")}function re(e,t){let n=new Set;for(let r of e){let o=z(r);o.length>0&&o!==t&&n.add(o)}return[...n].sort((r,o)=>r.localeCompare(o))}function ne(e){let t=new Set;for(let n of e??[]){let r=n.trim();r.length>0&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function oe(e){let t=new Set,n=[];for(let r of e??[]){let o=r.trim().toLowerCase();if(o.length!==0){if(!ee.has(o))throw new Error(`Invalid field command "${r}". Allowed: ${E.join(", ")}.`);t.has(o)||(t.add(o),n.push(o))}}return e===void 0||n.length===0?[...te]:n}function je(e){let t=a(e.key);if(t.length===0)throw new Error("Field key must not be empty.");if(t.includes(","))throw new Error(`Field key "${t}" must not contain commas: commas separate field names in list flags such as --unset and --fields.`);if(F.has(t))throw new Error(`Cannot define custom field "${t}": custom schema field "${t}" collides with built-in item metadata "${t}". Rename the custom field with a project-specific prefix. Reserved fields: ${[...F].sort((b,M)=>b.localeCompare(M)).join(", ")}.`);let n=typeof e.type=="string"&&e.type.trim().length>0?e.type.trim().toLowerCase():"string";if(!Z.has(n))throw new Error(`Invalid field type "${e.type}". Allowed: ${v.join(", ")}.`);let r=n,o=oe(e.commands),i=z(e.cliFlag),s=i.length>0&&i!==N(t)?i:void 0,l=s??N(t),d=re(e.aliases??[],l),y=[l,...d].find(b=>b.includes(","));if(y!==void 0)throw new Error(`Field flag "${y}" must not contain commas.`);let _=e.description?.trim();return{key:t,type:r,commands:o,description:_&&_.length>0?_:void 0,cliFlag:s,cliAliases:d,required:e.required===!0,requiredOnCreate:e.requiredOnCreate===!0,allowUnset:e.allowUnset!==!1,requiredTypes:ne(e.requiredTypes)}}function ie(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.fields))return t.fields;if(Array.isArray(t.definitions))return t.definitions}function se(e){let t=ie(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.key!="string"||o.key.trim().length===0||n.push(o)}return n}function Ce(e){if(e==null||e.trim().length===0)return{fields:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/fields.json contains invalid JSON.")}return{fields:se(t)}}function De(e){return`${JSON.stringify({fields:e.fields},null,2)}
4
4
  `}function $e(e,t){let n=e.fields.find(s=>a(s.key)===t.key),r=n!==void 0,o=e.fields.filter(s=>a(s.key)!==t.key),i={...n,key:t.key,type:t.type,commands:[...t.commands]};return O(i,"description",t.description),O(i,"cli_flag",t.cliFlag),t.cliAliases.length>0?i.cli_aliases=[...t.cliAliases]:delete i.cli_aliases,L(i,"required",t.required),L(i,"required_on_create",t.requiredOnCreate),t.allowUnset===!1?i.allow_unset=!1:delete i.allow_unset,t.requiredTypes.length>0?i.required_types=[...t.requiredTypes]:delete i.required_types,o.push(i),o.sort((s,l)=>a(s.key).localeCompare(a(l.key))),{file:{fields:o},definition:i,replaced:r}}function Fe(e,t){let n=a(t);if(n.length===0)throw new Error("Field key must not be empty.");let r=[],o=e.fields.filter(i=>a(i.key)===n?(r.push(i),!1):!0);return r.length===0?{file:{fields:o},removed:!1}:{file:{fields:o},removed:!0,definition:r[0]}}function O(e,t,n){let r=e;n!==void 0&&n.length>0?r[t]=n:delete r[t]}function L(e,t,n){let r=e;n?r[t]=!0:delete r[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]="b1e4c04e-0ade-5d24-95e3-b8dca3832c5a")}catch{}})();var ae=new Set(g),h=new Set(I.map(e=>a(e.id)).filter(e=>e.length>0));function le(e){let t=new Set;for(let n of e){let r=a(n);r.length>0&&t.add(r)}return[...t].sort((n,r)=>n.localeCompare(r))}function Pe(e){let t=a(e.id);if(t.length===0)throw new Error("Status id must not be empty.");if(h.has(t))throw new Error(`Cannot add-status the built-in status "${t}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let n;if(e.roles!==void 0){n=[];let s=new Set;for(let l of e.roles){let d=typeof l=="string"?l.trim().toLowerCase():"";if(d.length!==0){if(!ae.has(d))throw new Error(`Invalid status role "${l}". Allowed roles: ${g.join(", ")}.`);s.has(d)||(s.add(d),n.push(d))}}if(n.length===0)throw new Error(`Status role must include at least one lifecycle role. Allowed roles: ${g.join(", ")}.`)}let r=e.aliases===void 0?void 0:le(e.aliases).filter(s=>s!==t),o=e.description?.trim(),i=typeof e.order=="number"&&Number.isFinite(e.order)?Math.trunc(e.order):void 0;return{id:t,roles:n,aliases:r,description:o&&o.length>0?o:void 0,order:i}}function de(e){if(Array.isArray(e))return e;if(typeof e!="object"||e===null)return;let t=e;if(Array.isArray(t.statuses))return t.statuses;if(Array.isArray(t.definitions))return t.definitions}function ce(e){let t=de(e);if(!t)return[];let n=[];for(let r of t){if(typeof r!="object"||r===null||Array.isArray(r))continue;let o=r;typeof o.id!="string"||o.id.trim().length===0||n.push(o)}return n}function Ue(e){if(e==null||e.trim().length===0)return{statuses:[]};let t;try{t=JSON.parse(e)}catch{throw new Error("schema/statuses.json contains invalid JSON.")}return{statuses:ce(t)}}function Re(e){return`${JSON.stringify({statuses:e.statuses},null,2)}
5
5
  `}function qe(e,t,n){let r=e.statuses.slice(),o=r.findIndex(l=>a(l.id)===t.id),i=o>=0?r[o]:n,s={...i,id:t.id};return t.roles!==void 0&&(t.roles.length>0?s.roles=[...t.roles]:s.roles!==void 0&&delete s.roles),t.aliases!==void 0&&(t.aliases.length>0?s.aliases=[...t.aliases]:s.aliases!==void 0&&delete s.aliases),t.description!==void 0&&(s.description=t.description),t.order!==void 0&&(s.order=t.order),o>=0?r[o]=s:r.push(s),{file:{statuses:r},definition:s,replaced:i!==void 0}}function Ge(e,t){let n=a(t);if(n.length===0)throw new Error("Status id must not be empty.");if(h.has(n))throw new Error(`Cannot remove built-in status "${n}". Built-in statuses are reserved: ${[...h].join(", ")}.`);let r=e.statuses.slice(),o=r.findIndex(s=>a(s.id)===n);if(o<0)return{file:{statuses:r},removed:!1};let[i]=r.splice(o,1);return{file:{statuses:r},removed:!0,definition:i}}function Je(e,t){let n=[e.id,...e.aliases??[]];for(let r of n){let o=a(r);if(o.length===0)continue;let i=t.get(o);if(i!==void 0&&i!==e.id)throw new Error(`Status token "${o}" already belongs to status "${i}". Choose a different id/alias to avoid shadowing it.`)}}export{P as a,U as b,Y as c,he as d,X as e,Q as f,Se as g,Ae as h,je as i,Ce as j,De as k,$e as l,Fe as m,h as n,Pe as o,Ue as p,Re as q,qe as r,Ge as s,Je as t,be as u};
6
- //# sourceMappingURL=chunk-I5FODKYB.js.map
6
+ //# sourceMappingURL=chunk-F62XGAAY.js.map
@@ -0,0 +1,2 @@
1
+ import{M as Ie,N as Te,Q as De,aa as Se,f as Ce}from"./chunk-O7EI33NP.js";import{fb as xe,kb as Re,x as G}from"./chunk-YMGB2O4E.js";import{j as pe}from"./chunk-VWWTIX5L.js";import{a as A,b as R}from"./chunk-C3O6JJPO.js";import{Bd as ye,Be as be,Ce as we,Ga as ue,Ge as Ee,Id as _e,Jd as ke,Kc as Y,Nd as ve,Qc as F,S as C,X as ce,bd as O,nd as me,ra as ae,sd as ge,xa as le,xc as K,xd as he,yc as fe}from"./chunk-M6V7UMWL.js";import{A as v,z as b}from"./chunk-G6ERMFJ5.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]="283dfa35-9a8e-524c-b6e2-d433d51215ca")}catch{}})();function w(){let e=C();for(let t of K()?.relationship_kinds??[])for(let o of t.definitions)e.register(o);return 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]="8b57e560-4ac4-53b6-9fb1-eebb1f30562a")}catch{}})();function N(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function z(e){return[e.parent_id,e.child_id,e.source,e.kind,e.holder_id,e.target_id??""].join("\0")}function Qe(e,t){let o=new Set,n=[];for(let r of[...e].sort()){if(o.has(r))continue;o.add(r);let i=[{nodeId:r,children:[...t.get(r)??[]].sort(),nextChild:0}];for(;i.length>0;){let s=i.at(-1),d=s.children[s.nextChild];d===void 0?(n.push(s.nodeId),i.pop()):(s.nextChild+=1,o.has(d)||(o.add(d),i.push({nodeId:d,children:[...t.get(d)??[]].sort(),nextChild:0})))}}return n}function Ze(e,t){let o=[...e].sort(),n=Qe(o,t),r=new Set,i=et(o,t),s=[];for(let d of n.reverse()){if(r.has(d))continue;let c=tt(d,i,r);(c.length>1||t.get(c[0])?.has(c[0]))&&s.push(c)}return s.sort((d,c)=>d.join("\0").localeCompare(c.join("\0")))}function et(e,t){let o=new Map(e.map(n=>[n,new Set]));for(let[n,r]of t)for(let i of r)o.get(i)?.add(n);return o}function tt(e,t,o){let n=[],r=[e];for(o.add(e);r.length>0;){let i=r.pop();n.push(i);for(let s of[...t.get(i)].sort())o.has(s)||(o.add(s),r.push(s))}return n.sort()}function Le(e){let t=new Map;for(let o of e){let n=N(o?.id);n&&!t.has(n)&&t.set(n,o)}return t}function nt(e,t,o){let n=N(t.parent);if(!(!n||!o.has(n)))return{parent_id:n,child_id:e,source:"scalar_parent",kind:"parent",holder_id:e,child_cardinality:"one"}}function ot(e,t,o,n){let r=N(t?.id),i=n.resolve(t?.kind);if(!r||!o.has(r)||!i?.hierarchy)return;let s=i.hierarchyDirection==="source_parent";return{parent_id:s?e:r,child_id:s?r:e,source:"dependency",kind:i.kind,holder_id:e,target_id:r,child_cardinality:s?i.incoming:i.outgoing}}function Oe(e,t){let o=new Map;for(let[n,r]of e){let i=nt(n,r,e);i&&o.set(z(i),i);for(let s of r.dependencies??[]){let d=ot(n,s,e,t);d&&o.set(z(d),d)}}return[...o.values()].sort((n,r)=>z(n).localeCompare(z(r)))}function ln(e,t=w()){return Oe(Le(e),t)}function rt(e,t,o){let n=new Set(e.filter(r=>r.child_cardinality==="one").map(r=>r.child_id));return[...t].filter(([r,i])=>i.length>1&&n.has(r)).map(([r,i])=>({child_id:r,parent_ids:[...i],legacy_terminal:o.has(r)&&i.every(s=>o.has(s))})).sort((r,i)=>r.child_id.localeCompare(i.child_id))}function it(e,t,o){let n=new Map;for(let i of t){if(i.source!=="dependency")continue;let s=n.get(i.child_id)??new Set;s.add(i.parent_id),n.set(i.child_id,s)}let r=[];for(let[i,s]of e){let d=N(s.parent);if(!d||!e.has(d))continue;let c=[...n.get(i)??[]].filter(l=>l!==d).sort();c.length!==0&&r.push({child_id:i,scalar_parent_id:d,dependency_parent_ids:c,legacy_terminal:o.has(i)&&o.has(d)&&c.every(l=>o.has(l))})}return r.sort((i,s)=>i.child_id.localeCompare(s.child_id))}function H(e,t=n=>n==="closed"||n==="canceled",o=w()){let n=Le(e),r=Oe(n,o),i=st(r),s=new Set([...n].filter(([,c])=>t(c.status)).map(([c])=>c)),d=Ze([...n.keys()],new Map([...i.children_by_parent].map(([c,l])=>[c,new Set(l)]))).map(c=>({item_ids:c,legacy_terminal:c.every(l=>s.has(l))}));return{relations:r,cycles:d,cardinality_violations:rt(r,i.parents_by_child,s),divergences:it(n,r,s)}}function un(e){return e.source==="scalar_parent"?`${e.parent_id} -> ${e.child_id} (scalar parent on ${e.holder_id})`:`${e.parent_id} -> ${e.child_id} (${e.kind} dependency on ${e.holder_id})`}function st(e){let t=new Map,o=new Map;for(let n of e){let r=t.get(n.child_id)??new Set;r.add(n.parent_id),t.set(n.child_id,r);let i=o.get(n.parent_id)??new Set;i.add(n.child_id),o.set(n.parent_id,i)}return{parents_by_child:new Map([...t].map(([n,r])=>[n,[...r].sort()])),children_by_parent:new Map([...o].map(([n,r])=>[n,[...r].sort()]))}}function J(e,t){let o=new Set(t);return e.every(n=>o.has(n))}function pn(e,t,o,n,r){let i=N(o);if(!i)return;let s=H(e,n,r),d=H(t,n,r),c=d.divergences.find(a=>!s.divergences.some(p=>p.child_id===a.child_id&&p.scalar_parent_id===a.scalar_parent_id&&J(a.dependency_parent_ids,p.dependency_parent_ids)));if(c){let a=[c.scalar_parent_id,...c.dependency_parent_ids].sort();throw new v(`Hierarchy mutation would assign ${c.child_id} to multiple parents: ${a.join(", ")}.`,b.CONFLICT,{code:"hierarchy_parent_divergence_created",source_id:i,target_id:c.child_id,verification_errors:a})}let l=d.cardinality_violations.find(a=>(a.child_id===i||a.parent_ids.includes(i))&&!s.cardinality_violations.some(p=>p.child_id===a.child_id&&J(a.parent_ids,p.parent_ids)));if(l)throw new v(`Hierarchy mutation would assign ${l.child_id} to multiple parents: ${l.parent_ids.join(", ")}.`,b.CONFLICT,{code:"hierarchy_cardinality_created",source_id:i,target_id:l.child_id,verification_errors:l.parent_ids});let u=d.cycles.find(a=>a.item_ids.includes(i)&&!s.cycles.some(p=>J(a.item_ids,p.item_ids)));if(u)throw new v(`Hierarchy mutation would create a cycle: ${u.item_ids.join(" -> ")}.`,b.CONFLICT,{code:"hierarchy_cycle_created",source_id:i,verification_errors:u.item_ids})}(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]="6c580b70-76eb-51db-8587-99b73dd20875")}catch{}})();var dt="global";function yn(e){let t=e?.trim();if(t)return R(t)?dt:t}function _n(e,t,o){return ct(e,t,o)}function ct(e,t,o){let n=e.trim();return R(o)||A(n)?n:Ce(n,t)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="41f814be-ee87-5cae-b674-69c2e7f42655")}catch{}})();function D(e){if(typeof e!="string")return;let t=e.trim();if(!(!t||["none","null","n/a","na"].includes(t.toLowerCase())))return t}function M(e){let t=D(e);return t?.toLowerCase()==="no-active-blocker"?void 0:t}function $(e,t,o=!0){let n=D(e);return o&&(R(t)||n!==void 0&&A(n))}function Q(e,t){return $(e,t)?`external\0${e}`:`local\0${e.toLowerCase()}`}function Ae(e,t,o,n){return $(e,t)?n.get(e):o.get(e.toLowerCase())}function T(e,t){let o=e.toLowerCase(),n=t.toLowerCase();return o!==n?o<n?-1:1:e!==t?e<t?-1:1:0}function at(e){let t=new Map;for(let o of e.dependencies??[]){if(typeof o!="object"||o===null)continue;let n=o,r=D(n.id);if(!r)continue;let i=typeof n.kind=="string"?n.kind:"related",s=`${i}\0${Q(r,n.source_kind)}`,d=t.get(s);d?d.count+=1:t.set(s,{target_id:r,kind:i,count:1})}return t}function lt(e,t=o=>o==="closed"||o==="canceled"){let o=[];for(let n of e)if(!(typeof n?.id!="string"||n.id.trim().length===0))for(let r of at(n).values())r.count<2||o.push({holder_id:n.id.trim(),target_id:r.target_id,kind:r.kind,occurrences:r.count,holder_status:n.status,legacy_terminal:t(n.status)});return o.sort((n,r)=>{let i=T(n.holder_id,r.holder_id);if(i!==0)return i;let s=T(n.target_id,r.target_id);return s!==0?s:T(n.kind,r.kind)})}function ut(e,t,o,n,r){if(typeof o!="object"||o===null)return;let i=D(o.id);if(!i||Q(i,o.source_kind)!==Q(t))return;let s=r.resolve(typeof o.kind=="string"?o.kind:"related");if(!(s?.ordering!==!0||(s.precedence??"source_before_target")!=="source_before_target"))return{holder_id:e.id.trim(),target_id:i,dependency_kind:s.kind,holder_status:e.status,legacy_terminal:n(e.status)}}function pt(e,t=n=>n==="closed"||n==="canceled",o=w()){let n=new Map;for(let r of e){if(typeof r?.id!="string"||r.id.trim().length===0)continue;let i=D(r.blocked_by);if(i)for(let s of r.dependencies??[]){let d=ut(r,i,s,t,o);d&&n.set(`${d.holder_id.toLowerCase()}\0${d.target_id.toLowerCase()}\0${d.dependency_kind}`,d)}}return[...n.values()].sort((r,i)=>{let s=T(r.holder_id,i.holder_id);if(s!==0)return s;let d=T(r.target_id,i.target_id);return d!==0?d:T(r.dependency_kind,i.dependency_kind)})}function Z(e,t=o=>o==="closed"||o==="canceled"){let o=e.filter(c=>typeof c?.id=="string"&&c.id.trim().length>0),n=new Set(o.map(c=>c.id.trim().toLowerCase())),r=new Map,i=(c,l,u,a,p)=>{let m=D(l);if(!m||n.has(m.toLowerCase())||$(m,void 0,p))return;let f={holder_id:c.id.trim(),target_id:m,kind:u,source:a,holder_status:c.status,legacy_terminal:t(c.status),no_active_blocker_sentinel:m.toLowerCase()==="no-active-blocker"};r.set(`${f.holder_id}::${f.target_id}::${f.kind}::${f.source}`,f)};for(let c of o){i(c,c.parent,"parent","parent",!1),i(c,c.blocked_by,"blocked_by","blocked_by",!0);for(let l of c.dependencies??[]){if(typeof l!="object"||l===null)continue;let u=l;R(u.source_kind)||i(c,u.id,typeof u.kind=="string"?u.kind:"related","dependency",!0)}}let s=[...r.values()].sort((c,l)=>c.holder_id.localeCompare(l.holder_id)||c.target_id.localeCompare(l.target_id)||c.kind.localeCompare(l.kind)||c.source.localeCompare(l.source)),d=s.filter(c=>c.legacy_terminal);return{active:s.filter(c=>!c.legacy_terminal),legacy_terminal:d,no_active_blocker_sentinels:s.filter(c=>c.no_active_blocker_sentinel)}}function ft(e){let t=new Map;for(let o of[...e.active,...e.legacy_terminal]){if(o.no_active_blocker_sentinel)continue;let n=o.target_id.trim(),r=n.toLowerCase();t.has(r)||t.set(r,n)}return[...t.values()].sort((o,n)=>o.localeCompare(n))}function mt(e){let t=new Map;for(let o of e){let n=M(o.blocked_by);n&&$(n)&&!t.has(n)&&t.set(n,n);for(let r of o.dependencies??[]){if(typeof r!="object"||r===null||!$(r.id,r.source_kind))continue;let i=M(r.id);i&&!t.has(i)&&t.set(i,i)}}return[...t.values()].sort((o,n)=>o.localeCompare(n))}var Ne=new WeakMap;function xn(e){return e.hierarchyIntegrity??Ne.get(e)}function gt(e,t=w()){let o={};for(let n of e)for(let r of n.dependencies??[]){if(typeof r!="object"||r===null)continue;let i=r.kind;if(typeof i!="string")continue;let s=i.trim().toLowerCase().replaceAll("-","_"),d=t.resolve(i);d&&s!==d.kind&&(o[s]=(o[s]??0)+1)}return Object.fromEntries(Object.entries(o).sort(([n],[r])=>n.localeCompare(r)))}function ee(e,t,o){let n=o??w(),r=e.filter(f=>typeof f?.id=="string"&&f.id.trim().length>0),i=new Map(r.map(f=>[f.id.trim().toLowerCase(),f.id.trim()])),s=Z(r,t),d=ft(s);for(let f of d)i.set(f.toLowerCase(),f);let c=mt(r),l=new Set(i.keys()),u=new Map;for(let f of c){let y=f;for(;l.has(y.toLowerCase());)y=`external:${y}`;u.set(f,y),l.add(y.toLowerCase())}let a=r.map(f=>{let y=M(f.parent),g=M(f.blocked_by),h=(f.dependencies??[]).flatMap(_=>{if(typeof _!="object"||_===null)return[];let k=_,E=M(k.id);return E?[{id:Ae(E,k.source_kind,i,u),kind:typeof k.kind=="string"?k.kind:"related"}]:[]});return{id:f.id.trim(),...y?{parent:i.get(y.toLowerCase())}:{},...g?{blocked_by:Ae(g,void 0,i,u)}:{},dependencies:h}}),p=H(r,t,n),m={graph:ce.fromItems([...a,...d.map(f=>({id:f})),...c.map(f=>({id:u.get(f)}))],n),details:[...r.map(f=>({id:f.id.trim(),title:f.title,status:f.status,...typeof f.type=="string"&&f.type.trim().length>0?{type:f.type.trim()}:{}})),...d.map(f=>({id:f,title:`[missing] ${f}`,status:"missing"})),...c.map(f=>({id:u.get(f),title:`[external] ${f}`,status:"external"}))],missingIdSet:new Set(d.map(f=>f.toLowerCase())),dangling:s,duplicateRows:lt(r,t),orderingContradictions:pt(r,t,n),legacyAliasCounts:gt(r,n),hierarchyIntegrity:p};return Ne.set(m,p),m}import{createHash as ht}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]="e31ef0fb-e803-500b-b1e5-db9edfc880c4")}catch{}})();var yt=64,_t=8;function kt(e,t){let o=(e.dependencies??[]).map(n=>{if(typeof n!="object"||n===null)return"";let r=n;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??"",o].join("\0")}function $e(e,t=n=>n==="closed"||n==="canceled",o=C()){let n=e.filter(i=>typeof i?.id=="string"&&i.id.trim().length>0).map(i=>kt(i,t)).sort(),r=o.list().map(i=>ue(i)).sort();return ht("sha256").update(n.join("")).update("").update(r.join("")).digest("hex")}function Me(e,t,o){let n=t??o;if(!Number.isInteger(n)||n<1)throw new TypeError(`Invalid ${e} bound: ${String(t)}`);return n}var te=class{#e=new Map;#t;#n;constructor(t={}){this.#t=Me("maxResultsPerWorkspace",t.maxResultsPerWorkspace,yt),this.#n=Me("maxWorkspaces",t.maxWorkspaces,_t)}lookup(t,o,n){let r=this.#e.get(t),i=!0;(r===void 0||r.fingerprint!==o)&&(r={fingerprint:o,assembly:n(),results:new Map},i=!1,!this.#e.has(t)&&this.#e.size>=this.#n&&this.#e.delete(this.#e.keys().next().value)),this.#e.delete(t),this.#e.set(t,r);let s=r,d=this.#t;return{assembly:s.assembly,assemblyReused:i,fingerprint:o,memoize(c,l){let u=s.results.get(c);if(u!==void 0||s.results.has(c))return s.results.delete(c),s.results.set(c,u),{value:structuredClone(u),reused:!0};let a=l();return s.results.size>=d&&s.results.delete(s.results.keys().next().value),s.results.set(c,structuredClone(a)),{value:a,reused:!1}}}}clear(){this.#e.clear()}},Be=new te;function Pe(){return Be}function Sn(){Be.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]="3b494263-6359-57e9-8f34-b0bdcdeda93f")}catch{}})();var P=1200,vt=["prerequisite","dependent","ancestor","descendant","provenance","related"],bt=new TextEncoder;function ne(e,t,o){let n=e??t;if(!Number.isInteger(n)||n<1)throw new TypeError(`Relationship context ${o} must be positive`);return n}function B(e){return Math.max(1,Math.ceil(bt.encode(JSON.stringify(e)).byteLength/4))}function W(e,t,o){let n=o.resolve(e.kind);if(n?.ordering){let r=(n.precedence??"source_before_target")==="source_before_target"?e.source:e.target;return t===r?"prerequisite":"dependent"}if(n?.hierarchy){let r=n.hierarchyDirection==="source_parent"?e.source:e.target;return t===r?"ancestor":"descendant"}return e.kind==="discovered_from"||e.kind==="incident_from"?"provenance":"related"}function wt(e,t,o,n){let r=e.filter(i=>i.source===t&&i.target===o||i.target===t&&i.source===o).map(i=>W(i,o,n));return[...new Set(r)].sort()}function Et(e){return vt.find(t=>e.includes(t))}function Ct(e,t,o,n){let r=n.direction??"both",i=n.maxDepth??3;if(!Number.isInteger(i)||i<0)throw new TypeError("Relationship context maxDepth must be non-negative");let s=new Set([t]),d=[{id:t,distance:0}],c=[],l=0,u=!1;for(let a=0;a<d.length;a+=1){n.signal?.throwIfAborted();let p=d[a];if(p.distance>=i&&u)continue;let m=e.neighborEdges(p.id,{direction:r,kinds:n.kinds,signal:n.signal});if(l+=m.meta.inspectedEdges,p.distance>=i){m.value.some(f=>!s.has(f.id))&&(u=!0);continue}for(let{id:f,edge:y}of m.value){if(s.has(f))continue;s.add(f);let g={id:f,distance:p.distance+1,via:p.id,role:W(y,f,o)};c.push(g),d.push(g)}}return{rows:c,visitedNodes:d.length,inspectedEdges:l,depthTruncated:u}}function xt(e,t,o,n){let r={prerequisite:0,dependent:0,ancestor:0,descendant:0,provenance:0,related:0},i=e.neighborEdges(t,{direction:n.direction??"both",kinds:n.kinds,signal:n.signal}).value;for(let{id:s,edge:d}of i)r[W(d,s,o)]+=1;return{directEdges:r,directTotal:i.length,rootEdges:i.map(({edge:s})=>s)}}function Rt(e,t,o,n){let r=new Set;for(let i of t){let s=i.source===o?i.target:i.source,d=W(i,s,n);(d==="prerequisite"||d==="ancestor")&&r.add(s)}return[...e].sort((i,s)=>Number(r.has(s.id))-Number(r.has(i.id))||i.distance-s.distance||i.id.localeCompare(s.id))}function It(e,t){let o=e.distance===1?wt(t.rootEdges,t.rootId,e.id,t.registry):[];return{...t.details.get(e.id)??{id:e.id},distance:e.distance,role:o.length>0?Et(o):e.role,via:e.via,reasons:o.length>0?o:[`${e.role} via ${e.via} (depth ${e.distance})`]}}function Tt(e){let t=[],o=e.initialTokens,n=0;for(let r of e.candidates){if(t.length>=e.nodeLimit)break;let i=It(r,e),s=B(i);if(o+s>e.tokenBudget)break;let d=e.rootEdges.filter(c=>c.source===r.id||c.target===r.id).reduce((c,l)=>c+B(l),0);if(o+n+s+d>e.tokenBudget){if(t.length>0)break}else n+=d;t.push(i),o+=s}if(e.candidates.length>0&&t.length===0)throw new TypeError("Relationship context tokenBudget cannot fit one node");return{nodes:t,usedTokens:o}}function Dt(e){let t=e.options.kinds?new Set(e.options.kinds.map(i=>e.registry.require(i).kind)):void 0,o=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 s=e.registry.resolve(i.kind)?.inverse;return s!==void 0&&t.has(s)}).sort((i,s)=>+(s.source===e.rootId||s.target===e.rootId)-+(i.source===e.rootId||i.target===e.rootId)),n=[],r=e.initialTokens;for(let i of o){if(n.length>=e.edgeLimit)break;let s=B(i);r+s>e.tokenBudget||(n.push(i),r+=s)}return{edges:n,usedTokens:r,candidateCount:o.length}}function Ue(e,t,o,n={}){if(!e.nodes().includes(t))throw new TypeError(`Relationship node not found: ${t}`);let r=ne(n.nodeLimit,20,"nodeLimit"),i=ne(n.edgeLimit,40,"edgeLimit"),s=ne(n.tokenBudget,P,"tokenBudget"),d=n.registry??C(),c=new Map(o.map(I=>[I.id,I])),l=c.get(t)??{id:t},{evidence:u=[],...a}=l,p=[...u],m=Ct(e,t,d,n),{rootEdges:f,...y}=xt(e,t,d,n),g=Rt(m.rows,f,t,d),h=_e("relationship-context",{rootId:t,direction:n.direction??"both",kinds:[...n.kinds??[]].sort(),maxDepth:n.maxDepth??3,ordering:"required-root-evidence-first-v1"}),_=ve(g,n.cursor,h,({id:I})=>I,"--cursor"),k=g.slice(_),E=B(a)+B(p);if(E>s)throw new TypeError("Relationship context tokenBudget cannot fit root and evidence");let U=Tt({candidates:k,details:c,rootEdges:f,rootId:t,registry:d,nodeLimit:r,tokenBudget:s,initialTokens:E}),{nodes:L}=U,Ve=new Set([t,...L.map(({id:I})=>I)]),ie=Dt({graph:e,rootId:t,included:Ve,options:n,registry:d,edgeLimit:i,tokenBudget:s,initialTokens:U.usedTokens}),{edges:X,usedTokens:Ye}=ie,j=_+L.length,q=j<g.length,se=L.at(-1),V=ie.candidateCount-X.length,de=m.depthTruncated||q||V>0,Je={rootId:t,...a.status===void 0?{}:{rootStatus:a.status},...y,discoveredNodes:g.length,returnedNodes:L.length,returnedEdges:X.length,omittedNodes:g.length-j,omittedEdges:V,evidenceCount:p.length,hasMore:q};return{root:a,summary:Je,nodes:L,edges:X,evidence:p,meta:{exact:!0,truncated:de,completeness:de?"truncated":"complete",nodeLimit:r,edgeLimit:i,tokenBudget:s,usedTokens:Ye,visitedNodes:m.visitedNodes,inspectedEdges:m.inspectedEdges,omittedNodes:g.length-j,omittedEdges:V,...q&&se?{nextCursor:ke(h,se.id,j-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]="196b7f2d-b09b-5432-b4ef-9cdf82e92731")}catch{}})();var St=["tree","graph","context"],Lt=["none","repeated"],Ot=["outgoing","incoming","both"],At=32,Nt=200,Mt=400,$t=16e3;function Bt(e){let t=e?.trim().toLowerCase()??"tree";if(St.includes(t))return t;throw new v(`Invalid --format value "${e}". Use "tree", "graph", or "context".`,b.USAGE)}function S(e,t){if(e===void 0)return;let o=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(o)||o<1)throw new v(`Invalid --${t} value "${e}". Use a positive integer.`,b.USAGE);return o}function Ke(e){if(e===void 0)return;let t=typeof e=="number"?e:Number(e.trim());if(!Number.isInteger(t)||t<0)throw new v(`Invalid --max-depth value "${e}". Use a non-negative integer.`,b.USAGE);return t}function Pt(e){let t=e?.trim().toLowerCase()??"none";if(Lt.includes(t))return t;throw new v(`Invalid --collapse value "${e}". Use "none" or "repeated".`,b.USAGE)}function Ut(e){let t=e?.trim().toLowerCase()??"both";if(Ot.includes(t))return t;throw new v(`Invalid --direction value "${e}". Use "outgoing", "incoming", or "both".`,b.USAGE)}function jt(e,t=C()){if(e===void 0)return;let o=(Array.isArray(e)?e:[e]).flatMap(r=>r.split(",")).map(r=>r.trim()).filter(r=>r.length>0);if(o.length===0)return;let n=new Set;for(let r of o){let i=t.resolve(r);if(!i){let s=t.list().map(d=>d.kind).join(", ");throw new v(`Invalid --kind value "${r}". Registered kinds: ${s}.`,b.USAGE)}n.add(i.kind)}return[...n].sort()}function Kt(e){if(!e||e.length===0)return[];let t=e.map(({id:n,kind:r})=>({id:n.trim(),kind:r.trim().toLowerCase()})).sort((n,r)=>{let i=n.kind.localeCompare(r.kind);return i!==0?i:n.id.localeCompare(r.id)}),o=new Map;for(let n of t){let r=`${n.kind.toLowerCase()}::${n.id.toLowerCase()}`;o.has(r)||o.set(r,{id:n.id,kind:n.kind})}return[...o.values()]}function Ft(e){return{id:e.id,title:e.title,type:e.type,status:e.status,dependencies:Kt(e.dependencies)}}function Gt(e){return O(new TextEncoder().encode(JSON.stringify({...e,dependencies:void 0})).byteLength)}function zt(e,t,o,n,r,i,s,d,c){for(let l of t.dependencies){let u=Math.max(1,Math.ceil(JSON.stringify({from:e.id,to:l.id,kind:l.kind}).length/3));if(d.nodes>=d.nodeLimit){e.truncated=!0,d.reasons.add("node_limit");break}if(d.edges>=d.edgeLimit){e.truncated=!0,d.reasons.add("edge_limit");break}if(d.estimatedTokens+u>=d.tokenBudget){e.truncated=!0,d.reasons.add("token_budget");break}d.edges+=1,d.estimatedTokens+=u,e.dependencies.push(Fe(l.id,o,n,r,i,s,d,c+1,l.kind))}}function Ht(e,t,o,n,r,i,s,d){return s.estimatedTokens>=s.tokenBudget&&t?.dependencies.length?(e.truncated=!0,s.reasons.add("token_budget"),!0):!t||e.cycle?!0:n!==void 0&&d>=n?(t.dependencies.length>0&&(e.truncated=!0,s.reasons.add("max_depth")),!0):r==="repeated"&&i.has(o)?(e.collapsed=!0,!0):!1}function Fe(e,t,o,n,r,i,s,d=0,c){let l=e.trim().toLowerCase(),u=t.get(l),a={id:u?.id??e,title:u?.title,type:u?.type,status:u?.status,via:c,missing:!u,cycle:o.has(l),dependencies:[]};if(s.nodes+=1,s.estimatedTokens+=Gt(a),Ht(a,u,l,n,r,i,s,d))return a;r==="repeated"&&i.add(l);let p=new Set(o);return p.add(l),zt(a,u,t,p,n,r,i,s,d),a}function je(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 Wt(e){let t=new Map,o=new Map,n=[e];for(;n.length>0;){let d=n.pop();t.set(d.id,je(t.get(d.id),{id:d.id,title:d.title,type:d.type,status:d.status,missing:d.missing}));for(let c of d.dependencies){t.set(c.id,je(t.get(c.id),{id:c.id,title:c.title,type:c.type,status:c.status,missing:c.missing}));let l=c.via??"related",u=`${d.id}::${c.id}::${l}`;o.has(u)||o.set(u,{from:d.id,to:c.id,kind:l}),c.cycle||n.push(c)}}let r=[...t.values()].sort((d,c)=>d.id.localeCompare(c.id)),i=[...o.values()].sort((d,c)=>{let l=d.from.localeCompare(c.from);if(l!==0)return l;let u=d.to.localeCompare(c.to);return u!==0?u:d.kind.localeCompare(c.kind)}),s=r.filter(d=>d.missing).map(d=>d.id);return{root_id:e.id,nodes:r,edges:i,missing_ids:s}}function Ge(e,t,o){let n=new Set,r=new Set,i=new Set,s=new Set,d=[{id:e,depth:0}],c=0;for(;c<d.length;){let l=d[c++],u=l.id.trim().toLowerCase();n.add(u);let a=t.get(u);if(!a){i.add(u);continue}if(!(o!==void 0&&l.depth>=o)&&!s.has(u)){s.add(u);for(let p of a.dependencies)r.add(`${u}::${p.id.trim().toLowerCase()}::${p.kind}`),d.push({id:p.id,depth:l.depth+1})}}return{node_count:n.size,edge_count:r.size,edge_basis:"deduplicated_directed",missing_count:i.size}}function Xt(e,t=C()){let o=Ke(e.maxDepth),n=S(e.nodeLimit,"node-limit"),r=S(e.edgeLimit,"edge-limit"),i=S(e.tokenBudget,"token-budget"),s=jt(e.kind,t);return{direction:Ut(e.direction),...s===void 0?{}:{kinds:s},...o===void 0?{}:{maxDepth:o},...n===void 0?{}:{nodeLimit:n},...r===void 0?{}:{edgeLimit:r},...i===void 0?{}:{tokenBudget:i},...e.cursor?.trim()?{cursor:e.cursor.trim()}:{}}}function qt(e,t,o,n){return Ue(e.graph,t,e.details.map(r=>r.id===t&&n.length>0?{...r,evidence:n}:r),o)}function oe(e,t,o,n){for(let r of o.slice(0,n)){let i=r?.trim();i&&e.push(`${t}:${i}`)}}async function Vt(e,t,o,n){let r=await Ie(e,t,o.id_prefix,o.item_format,n);if(!r)return[];let{document:i}=await Te(r,{schema:o.schema}),s=i.metadata,d=s.files??[],c=s.tests??[],l=s.docs??[],u=[["files",d.length],["tests",c.length],["docs",l.length],["comments",(s.comments??[]).length],["notes",(s.notes??[]).length],["learnings",(s.learnings??[]).length]];if(u.every(([,p])=>p===0))return[];let a=[`linked:${u.map(([p,m])=>`${p}=${m}`).join(",")}`];return oe(a,"file",d.map(p=>p.path),3),oe(a,"test",c.map(p=>p.command??p.path),2),oe(a,"doc",l.map(p=>p.path),2),a}function Yt(e){let{canonicalId:t,context:o,missingCount:n,missingReferences:r,referenceLimit:i,summaryOnly:s}=e;return{id:t,format:"context",node_count:o.nodes.length+1,edge_count:o.edges.length,edge_basis:"deduplicated_directed",missing_count:n,missing_scope:"traversal",missing_reference_count:r.length,...s?{}:{missing_references:r.slice(0,i),context:o}}}function Jt(e){let{row:t,missingReachableSet:o,packetIds:n,filteredKinds:r,registry:i}=e;if(t.no_active_blocker_sentinel||!o.has(t.target_id.trim().toLowerCase())||!n.has(t.holder_id))return!1;if(r===void 0)return!0;let s=i.resolve(t.kind);return s!==void 0&&(r.has(s.kind)||s.inverse!==void 0&&r.has(s.inverse))}function ze(e,t){let o=fe(),n=t.commandOptionsOverride??(o?.command==="deps"?o.options:t.commandOptions);return be("deps",{...n,...t.global,resolvedOutputFormat:t.format},e)}function re(e,t){let o=ze(e,t),n=r=>Ee(r,t.format,t.global.lean===!0);return n(t.global.tokenAccounting===!0?we(o,n):o)}function He(e,t,o){let n;for(;;){let r=O(new TextEncoder().encode(re(e,t)).byteLength);if(r===n)return r;o(r),n=r}}function We(e){return e instanceof TypeError&&e.message.startsWith("Relationship context tokenBudget cannot fit ")}function Xe(e){let{assembly:t,canonicalId:o,contextOptions:n,rootEvidence:r,summaryOnly:i,rendering:s,missingCount:d,missingReferences:c}=e,l=n.edgeLimit??40,u=Math.min(l,c.length),a=n.tokenBudget,p;for(;;){let m=qt(t,o,{...n,...a===void 0?{}:{tokenBudget:a}},r);p??=m.meta.tokenBudget,a??=p;let f=Yt({canonicalId:o,context:m,missingCount:d,missingReferences:c,referenceLimit:u,summaryOnly:i});if(i){if(O(new TextEncoder().encode(re(x(f,!0,s.legacyAliasCounts),s)).byteLength)>p)throw new TypeError("Relationship context tokenBudget cannot fit the rendered summary");return f}if(m.meta.tokenBudget=p,m.meta.usedTokens=He(x(f,!1,s.legacyAliasCounts),s,h=>{m.meta.usedTokens=h}),m.meta.usedTokens<=p)return f;if(u>0){u-=1;continue}let y=a,g=y*p/m.meta.usedTokens;a=Math.min(y-1,Math.max(1,Math.floor(g*.9)))}}function qe(e,t){let o=e.contextOptions,n={...e.rendering.global,outputFormat:e.rendering.format},r=["--pm-path",e.pmRoot,"item","deps",e.canonicalId,"--format","context","--output-format",e.rendering.format,"--token-budget"],i=r.length;r.push(String(t));let s=new Set(["--pm-path","--format","--output-format","--token-budget"]),d={format:"context",tokenBudget:t,kind:o.kinds},c=[["--max-depth","maxDepth",o.maxDepth],["--node-limit","nodeLimit",o.nodeLimit],["--edge-limit","edgeLimit",o.edgeLimit],["--direction","direction",o.direction],["--cursor","cursor",o.cursor],["--output-include","outputInclude",n.outputInclude],["--output-limit","outputLimit",n.outputLimit],["--output-budget","outputBudget",n.outputBudget],["--output-session","outputSession",n.outputSession],["--output-cursor","outputCursor",n.outputCursor]];for(let[a,p,m]of c)m!==void 0&&(r.push(a,String(m)),s.add(a),d[p]=m);for(let a of o.kinds??[])r.push("--kind",a),s.add("--kind");let l=[["--summary","summary",e.summaryOnly],["--full","full",e.rendering.commandOptions.full],["--json","json",n.json],["--lean","lean",n.lean],["--output-row-contract","outputRowContract",n.outputRowContract],["--token-accounting","tokenAccounting",n.tokenAccounting],["--no-extensions","noExtensions",n.noExtensions],["--no-pager","noPager",n.noPager]];for(let[a,p,m]of l)m===!0&&(r.push(a),s.add(a),d[p]=!0);let u=ge.find(a=>a.command==="deps");return Reflect.set(d,me,{canonical_include_modes:[],cli_invocation_observed:!0,explicit_legacy_aliases:Object.values(u.dimensions).flatMap(a=>a.legacy_aliases.flatMap(p=>s.has(p.flag)?[p.flag]:[]))}),he("deps",d),Y(d.summary===!0,d.full===!0,"--summary"),n.outputInclude=d.outputInclude,{args:r,budgetIndex:i,summaryOnly:d.summary===!0,rendering:{...e.rendering,global:n,commandOptionsOverride:d}}}function Qt(e,t,o){let n={...t.rendering,commandOptionsOverride:{...t.rendering.commandOptionsOverride,tokenBudget:o}},r;try{r=Xe({...e,contextOptions:{...e.contextOptions,tokenBudget:o},summaryOnly:t.summaryOnly,rootEvidence:t.summaryOnly?[]:e.rootEvidence,rendering:n})}catch(s){if(!We(s))throw s;return"native_floor"}let i=ze(x(r,t.summaryOnly,n.legacyAliasCounts),n);return ye(i)?"output_constraints":"fits"}async function Zt(e,t){let o=e.contextOptions.tokenBudget??P,n=qe(e,o),r=(n.summaryOnly?1:1+Math.min(e.contextOptions.edgeLimit??40,e.missingReferences.length))*(e.assembly.details.reduce((a,p)=>a+p.id.length+p.title.length+p.status.length+(p.type?.length??0),e.assembly.graph.edges().length+e.missingReferences.length)+(n.summaryOnly?[]:e.rootEvidence).reduce((a,p)=>a+p.length,0)),{findContextBudgetRecovery:i}=await import("./context-budget-recovery-5MKOCGY5.js"),s=i({requested:o,initialBudget:P,workUnits:r,probe:a=>Qt(e,n,a)}),d=["--pm-path",e.pmRoot,"item","deps",e.canonicalId,"--format","tree","--summary"],c=F(d),l=s.feasible_tokens===null?d:[...n.args];s.feasible_tokens!==null&&(l[n.budgetIndex]=String(s.feasible_tokens));let u=F(l);return Se("Relationship context tokenBudget cannot fit the required rendered packet",{exitCode:b.USAGE,cause:t,context:{code:"invalid_argument_value",field:"tokenBudget",value:String(o),required:s.feasible_tokens===null?"Inspect the compact summary and review the output constraints.":"Retry the preserved context query with --token-budget "+s.feasible_tokens+".",why:"Budget advice is verified against the current query. A minimum is reported only after every smaller positive budget is checked.",examples:[u,c],nextSteps:[u],recovery:{recovery_mode:"compact",suggested_flags:["--token-budget"],token_budget:s,suggested_retry_args:l,suggested_retry:u,next_best_command:c,fallback_candidates:[{source:"relationship_summary",command:c,reason:"Inspect bounded counts separately from context rows."}]}}})}async function en(e){let{pmRoot:t,assembly:o,canonicalId:n,options:r,rootEvidence:i,summaryOnly:s,rendering:d}=e,c=Xt(r,o.graph.registry()),l=o.graph.closure(n,{direction:c.direction,...c.kinds===void 0?{}:{kinds:c.kinds},maxDepth:c.maxDepth??3}),u=l.value.filter(h=>o.missingIdSet.has(h.toLowerCase())),a=new Set(u.map(h=>h.toLowerCase())),p=o.graph.registry(),m=c.kinds?new Set(c.kinds.map(h=>p.require(h).kind)):void 0,f=new Set([n,...l.value]),y=[...o.dangling.active,...o.dangling.legacy_terminal].filter(h=>Jt({row:h,missingReachableSet:a,packetIds:f,filteredKinds:m,registry:p})),g={pmRoot:t,assembly:o,canonicalId:n,contextOptions:c,rootEvidence:i,summaryOnly:s,rendering:d,missingCount:u.length,missingReferences:y};try{return Xe(g)}catch(h){if(h instanceof v&&h.code==="invalid_query_cursor"){let _=qe({...g,contextOptions:{...c,cursor:void 0},rendering:{...d,global:{...d.global,outputCursor:void 0}}},c.tokenBudget??P),k=F(_.args);throw new v(h.message,h.exitCode,{...h.context,nextSteps:[...h.context.nextSteps,k],recovery:{suggested_retry:k,suggested_retry_args:_.args}})}throw We(h)?await Zt(g,h):h}}function tn(e){let t=[e],o;for(;t.length>0;){let n=t.pop();n.dependencies.length>0&&(o=n,t.push(...n.dependencies))}return o?(o.dependencies.pop(),o.truncated=!0,!0):!1}function nn(e,t,o,n,r,i,s){let d=r??At,c=S(o.nodeLimit,"node-limit")??Nt,l=S(o.edgeLimit,"edge-limit")??Mt,u=S(o.tokenBudget,"token-budget")??$t,a={nodeLimit:c,edgeLimit:l,tokenBudget:u,nodes:0,edges:0,estimatedTokens:0,reasons:new Set},p=Fe(e,n,new Set,d,t==="graph"?"repeated":i,new Set,a),m=Ge(e,n,void 0),f;for(;;){let y=Wt(p),g=a.reasons.size===0?void 0:{reasons:[...a.reasons].sort(),limits:{max_depth:d,node_limit:c,edge_limit:l,token_budget:u},estimated_tokens:0,total_node_count:m.node_count,total_edge_count:m.edge_count,omitted_node_count:Math.max(0,m.node_count-y.nodes.length),omitted_edge_count:Math.max(0,m.edge_count-y.edges.length)},h={id:e,format:t,node_count:y.nodes.length,edge_count:y.edges.length,edge_basis:"deduplicated_directed",missing_count:y.missing_ids.length,...g?{truncation:g}:{}};if(f=t==="tree"?{...h,tree:p}:{...h,graph:y},(f.truncation===void 0?O(new TextEncoder().encode(re(x(f,!1,s.legacyAliasCounts),s)).byteLength):He(x(f,!1,s.legacyAliasCounts),s,_=>{f.truncation.estimated_tokens=_}))<=u)return f;if(!tn(p))return a.reasons.add("token_budget"),f;a.reasons.add("token_budget")}}function x(e,t,o={}){let n={name:e.format==="tree"?"dependency_tree":e.format==="graph"?"dependency_graph":"relationship_context",restore_with:"--full"},r=e.context?.meta.truncated?[{name:"relationship_context_bounds",restore_with:"--token-budget <n> --node-limit <n> --edge-limit <n> --max-depth <n>"}]:[];return{...e,legacy_alias_counts:o,projection:{mode:t?"summary":"full",declared_field_groups:[n,...r],included_field_groups:t?[]:[n.name]}}}async function ro(e,t,o){let n=le(process.cwd(),o.path);await Re(n);let r=Bt(t.format),i=Ke(t.maxDepth),s=Pt(t.collapse);Y(t.summary===!0,t.full===!0,"--summary");let d=t.summary===!0,c=await xe(n),l=ae(c,K()),u=await De(n,c.item_format,l.type_to_folder,void 0,c.schema),a=pe(c.schema),p=new Map(u.map(g=>[g.id.trim().toLowerCase(),Ft(g)])),m=Z(u,g=>G(g,a));for(let g of[...m.active,...m.legacy_terminal]){let h=p.get(g.holder_id.trim().toLowerCase()),_=g.kind.trim().toLowerCase();h&&!h.dependencies.some(k=>k.id.trim().toLowerCase()===g.target_id.trim().toLowerCase()&&k.kind===_)&&h.dependencies.push({id:g.target_id,kind:_})}if(!p.has(e.trim().toLowerCase()))throw new v(`Item ${e} not found`,b.NOT_FOUND);let f=o.outputFormat??(o.json===!0||o.json===void 0&&o.defaultOutputFormat==="json"?"json":"toon");if(r==="context"){let g=p.get(e.trim().toLowerCase()).id,h=d?[]:await Vt(n,g,c,l.type_to_folder),_=U=>G(U,a),k=w(),E=Pe().lookup(n,$e(u,_,k),()=>ee(u,_,k));return x(await en({pmRoot:n,assembly:E.assembly,canonicalId:g,options:t,rootEvidence:h,summaryOnly:d,rendering:{format:f,global:o,commandOptions:t,legacyAliasCounts:E.assembly.legacyAliasCounts}}),d,E.assembly.legacyAliasCounts)}let y=Object.fromEntries(Object.entries(ee(u,g=>G(g,a)).legacyAliasCounts));return d?x({id:e,format:r,...Ge(e,p,i)},!0,y):x(nn(e,r,t,p,i,s,{format:f,global:o,commandOptions:t,legacyAliasCounts:y}),!1,y)}export{yn as a,_n as b,ct as c,w as d,ln as e,H as f,un as g,st as h,pn as i,M as j,lt as k,pt as l,Z as m,ft as n,xn as o,ee as p,$e as q,te as r,Pe as s,Sn as t,P as u,Ue as v,S as w,Ke as x,Ut as y,jt as z,ro as A};
2
+ //# sourceMappingURL=chunk-G4QP365K.js.map
@@ -0,0 +1,2 @@
1
+ import{b as ze}from"./chunk-E56OXRYH.js";import{$a as Y,Ya as V,Za as W,_a as X,fa as Ce,ga as Ae,ja as Re,ka as ke}from"./chunk-GS3JC5UU.js";import{t as me}from"./chunk-MK4HV4JO.js";import{d as Be,e as Ge,h as $e}from"./chunk-G4QP365K.js";import{g as je}from"./chunk-7KK66ISG.js";import{D as H,F as q,H as Ne,J as R,P as Pe,Q as k,R as Ue,h as De,i as Ke,k as xe,l as Oe}from"./chunk-O7EI33NP.js";import{Ga as Le,Ka as Me,d as Se,fb as S,ha as Ie,kb as O,v as ve,wa as Fe,x as E,xa as Ee,ya as Te}from"./chunk-YMGB2O4E.js";import{b as ue}from"./chunk-RFTJZ5VB.js";import{j as M,l as fe}from"./chunk-VWWTIX5L.js";import{Ec as pe,Hd as ge,Id as _e,Jd as $,Nd as he,Qc as ye,Rd as be,Vd as A,Wd as we,Xd as z,Zb as j,_b as B,ac as G,ba as h,ra as I,sa as x,xa as w,xc as C}from"./chunk-M6V7UMWL.js";import{A as f,z as m}from"./chunk-G6ERMFJ5.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]="738a98bc-eaf0-578d-88e3-1c5f83c8894b")}catch{}})();function N(e,t="--limit"){if(e===void 0)return;let r=String(e).trim(),i=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(i)||i<0)throw new f(`${t} must be a non-negative integer`,m.USAGE);return i}function He(e,t="--priority"){if(e===void 0)return;let r=String(e).trim(),i=r.length===0?Number.NaN:Number(r);if(!Number.isInteger(i)||i<0||i>4)throw new f(`${t} filter must be 0..4`,m.USAGE);return i}function ti(e,t,r="--type"){if(e===void 0)return;let i=x(e,t);if(!i)throw new f(`${r} filter must be one of ${t.types.join("|")}`,m.USAGE);return i}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="75ecca0c-fac8-5a9b-9043-c65731daad4a")}catch{}})();function Q(e,t){if(e===void 0)return;let r=[],i="";for(let o=0;o<e.length;o+=1){let a=e[o];if(a==="\\"){let l=e[o+1];if(l===","||l==="\\"){i+=l,o+=1;continue}i+=a;continue}if(a===","){r.push(i),i="";continue}i+=a}r.push(i);let n=r.map(o=>o.trim());if(n.some(o=>o.length===0))throw new f(`${t.label} requires at least one non-empty value`,m.USAGE);let s=n.map(o=>t.normalize?.(o)??o);return[...new Set(s)]}function D(e,t){let r=Q(e,t);return r===void 0?void 0:new Set(r)}function qe(e,t,r="--type"){let i=Q(e,{label:r});if(i===void 0)return;let n=i.map(s=>{let o=x(s,t);if(!o)throw new f(`${r} filter token "${s}" must be one of ${t.types.join("|")}`,m.USAGE);return o});return new Set(n)}function Ve(e,t="--priority"){let r=Q(e,{label:t});if(r!==void 0)return new Set(r.map(i=>He(i,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]="f9d73d74-7c4e-5ea9-b34c-c984b4c15ab3")}catch{}})();function We(e,t){let r=e.trim().toLowerCase();return t.alias_to_id.get(r)??r}function Je(e){return{isTerminal(t){return e.terminal_statuses.has(We(t,e))},classify(t){let r=We(t,e);return e.terminal_canceled_statuses.has(r)?"canceled":e.terminal_statuses.has(r)?"closed":e.blocked_statuses.has(r)?"blocked":e.draft_statuses.has(r)?"draft":r===e.open_status?"open":e.active_statuses.has(r)?"in_progress":"other"}}}function J(e){return h(e.acceptance_criteria)===void 0}function Z(e){return!Number.isFinite(e.estimated_minutes)}function Ze(e,t){return t.isTerminal(e.status)?h(e.resolution)===void 0:!1}function qt(e){return h(e.reviewer)===void 0}function Vt(e){return h(e.risk)===void 0}function Wt(e){return typeof e.confidence=="number"?!Number.isFinite(e.confidence):h(e.confidence)===void 0}function Xt(e){return h(e.sprint)===void 0}function Yt(e){return h(e.release)===void 0}function ee(e){return!!(e.acMissing||e.estimatesMissing||e.resolutionMissing||e.reviewerMissing||e.riskMissing||e.confidenceMissing||e.sprintMissing||e.releaseMissing||e.metadataMissing)}function Qt(e,t,r){return[[t.acMissing,J(e)],[t.estimatesMissing,Z(e)],[t.resolutionMissing,Ze(e,r)],[t.reviewerMissing,qt(e)],[t.riskMissing,Vt(e)],[t.confidenceMissing,Wt(e)],[t.sprintMissing,Xt(e)],[t.releaseMissing,Yt(e)]].every(([i,n])=>i!==!0||n)}function Jt(e,t){return J(e)||Z(e)||Ze(e,t)}function et(e,t,r){return ee(t)?!(!Qt(e,t,r)||t.metadataMissing&&!Jt(e,r)):!0}var te=["acceptance_criteria","estimated_minutes","resolution","tags","parent"];function Zt(e,t){switch(t){case"acceptance_criteria":return!J(e);case"estimated_minutes":return!Z(e);case"resolution":return h(e.resolution)!==void 0;case"tags":return Array.isArray(e.tags)&&e.tags.length>0;default:return h(e.parent)!==void 0}}function er(e,t,r){return t==="resolution"?r.isTerminal(e.status):!0}function tr(e,t){return t===0?100:Math.round(e/t*1e3)/10}function Xe(){let e={};for(let t of te)e[t]={present:0,applicable:0,percent:100};return e}function Ye(e,t,r){for(let i of te){if(!er(t,i,r))continue;let n=e[i];n.applicable+=1,Zt(t,i)&&(n.present+=1)}}function Qe(e){for(let t of te){let r=e[t];r.percent=tr(r.present,r.applicable)}}function di(e,t){let r=Xe(),i={};for(let n of e){Ye(r,n,t);let s=i[n.type]??(i[n.type]=Xe());Ye(s,n,t)}Qe(r);for(let n of Object.values(i))Qe(n);return{overall:r,by_type:i}}var rr={assignee:"(unassigned)",priority:"(no priority)",tag:"(untagged)",parent:"(unparented)",type:"(untyped)",status:"(no status)"};function ir(e){return rr[e]}function nr(){return{open:0,in_progress:0,blocked:0,draft:0,closed:0,canceled:0,other:0}}function sr(e,t,r){switch(t){case"assignee":return[h(e.assignee)??null];case"parent":return[h(e.parent)??null];case"type":return[h(e.type)??null];case"status":return[h(e.status)??null];case"priority":return[typeof e.priority=="number"?`P${e.priority}`:null];default:{let i=r.tagPrefix?.trim(),n=(Array.isArray(e.tags)?e.tags:[]).filter(s=>typeof s=="string"&&s.length>0&&(!i||s.startsWith(i)));return n.length>0?n:[null]}}}function ci(e,t,r,i={}){let n=new Map,s=0;for(let a of e){s+=1;let l=r.classify(a.status);for(let d of sr(a,t,i)){let c=d??"\0empty",u=n.get(c);u||(u={label:d??ir(t),key:d,buckets:nr(),total:0},n.set(c,u)),u.buckets[l]+=1,u.total+=1}}let o=[...n.values()].sort((a,l)=>l.total!==a.total?l.total-a.total:a.key===null?1:l.key===null?-1:a.label.localeCompare(l.label));return{dimension:t,rows:o,total_items: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]="67f9184e-08b6-5f21-9f92-e60974adbf1e")}catch{}})();var T=["notes","learnings","files","docs","tests","comments","deps","body","linked_command"];function F(e){return Array.isArray(e)&&e.length>0}function or(e){return typeof e=="string"&&e.trim().length>0}function ar(e){return Array.isArray(e)?e.some(t=>{if(typeof t!="object"||t===null)return!1;let r=t.command;return typeof r=="string"&&r.trim().length>0}):!1}function rt(e,t){switch(t){case"notes":return F(e.notes);case"learnings":return F(e.learnings);case"files":return F(e.files);case"docs":return F(e.docs);case"tests":return F(e.tests);case"comments":return F(e.comments);case"deps":return F(e.dependencies);case"body":return or(e.body);case"linked_command":return ar(e.tests)}}function it(e){return T.some(t=>e[t]!==void 0)}function nt(e,t){for(let r of T){let i=t[r];if(i===void 0)continue;let n=rt(e,r);if(i==="present"&&!n||i==="absent"&&n)return!1}return!0}function st(e){return T.some(t=>t!=="body"&&e[t]!==void 0)}function ot(e){return e.body!==void 0}function tt(e,t){return t===0?100:Math.round(e/t*1e3)/10}function lr(){let e={};for(let t of T)e[t]={present:0,total:0,percent:100};return e}function mi(e){let t=lr(),r=e.length;for(let o of e)for(let a of T)rt(o,a)&&(t[a].present+=1);for(let o of T)t[o].total=r,t[o].percent=tt(t[o].present,r);let i=t.body,n=r-i.present,s={present:n,total:r,percent:tt(n,r)};return{total_items:r,fields:t,body_populated:i,empty_body: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]="084aad9c-485f-5bdc-8da7-225c9c4f695c")}catch{}})();var mt=e=>({acMissing:e.filterAcMissing===!0,estimatesMissing:e.filterEstimatesMissing===!0,resolutionMissing:e.filterResolutionMissing===!0,metadataMissing:e.filterMetadataMissing===!0,reviewerMissing:e.filterReviewerMissing===!0,riskMissing:e.filterRiskMissing===!0,confidenceMissing:e.filterConfidenceMissing===!0,sprintMissing:e.filterSprintMissing===!0,releaseMissing:e.filterReleaseMissing===!0}),at=[{field:"notes",presentKey:"hasNotes",absentKey:"noNotes",presentFlag:"--has-notes",absentFlag:"--no-notes"},{field:"learnings",presentKey:"hasLearnings",absentKey:"noLearnings",presentFlag:"--has-learnings",absentFlag:"--no-learnings"},{field:"files",presentKey:"hasFiles",absentKey:"noFiles",presentFlag:"--has-files",absentFlag:"--no-files"},{field:"docs",presentKey:"hasDocs",absentKey:"noDocs",presentFlag:"--has-docs",absentFlag:"--no-docs"},{field:"tests",presentKey:"hasTests",absentKey:"noTests",presentFlag:"--has-tests",absentFlag:"--no-tests"},{field:"comments",presentKey:"hasComments",absentKey:"noComments",presentFlag:"--has-comments",absentFlag:"--no-comments"},{field:"deps",presentKey:"hasDeps",absentKey:"noDeps",presentFlag:"--has-deps",absentFlag:"--no-deps"},{field:"body",presentKey:"hasBody",absentKey:"emptyBody",presentFlag:"--has-body",absentFlag:"--empty-body"},{field:"linked_command",presentKey:"hasLinkedCommand",absentKey:"noLinkedCommand",presentFlag:"--has-linked-command",absentFlag:"--no-linked-command"}],ie=e=>{let t=at.find(r=>e[r.presentKey]===!0&&e[r.absentKey]===!0);if(t)throw new f(`Cannot combine ${t.presentFlag} with ${t.absentFlag} for the same field.`,m.USAGE);return Object.fromEntries(at.flatMap(r=>e[r.presentKey]===!0?[[r.field,"present"]]:e[r.absentKey]===!0?[[r.field,"absent"]]:[]))},lt=["priority","deadline","updated_at","created_at","title","parent"],dt=["asc","desc"],ft=new Set(Ne);function dr(e,t,r){let i=e.filter(o=>o.startsWith("item_list_item_read_failed:")).length,n=e.filter(o=>o.startsWith("item_list_directory_read_failed:")).length,s={status:t?"unchecked":i+n>0?"partial":"complete",unreadable_item_count:i,unreadable_directory_count:n};if(r&&s.status==="partial")throw new f(`List source is incomplete: ${i} item document(s) and ${n} item directory/directories could not be read.`,m.GENERIC_FAILURE,{code:"list_source_incomplete",why:"Strict list reads fail closed so agents and SDK consumers never treat an omitted item as a complete workspace.",nextSteps:["Run pm validate --check-storage-integrity to locate unreadable tracker artifacts.","Repair the reported files or align the installed decoder version, then retry."]});return s}function cr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length>0}var ur=[{key:"hasNotes",summaryKey:"has_notes"},{key:"hasLearnings",summaryKey:"has_learnings"},{key:"hasFiles",summaryKey:"has_files"},{key:"hasDocs",summaryKey:"has_docs"},{key:"hasTests",summaryKey:"has_tests"},{key:"hasComments",summaryKey:"has_comments"},{key:"hasDeps",summaryKey:"has_deps"},{key:"hasBody",summaryKey:"has_body"},{key:"hasLinkedCommand",summaryKey:"has_linked_command"},{key:"noNotes",summaryKey:"no_notes"},{key:"noLearnings",summaryKey:"no_learnings"},{key:"noFiles",summaryKey:"no_files"},{key:"noDocs",summaryKey:"no_docs"},{key:"noTests",summaryKey:"no_tests"},{key:"noComments",summaryKey:"no_comments"},{key:"noDeps",summaryKey:"no_deps"},{key:"emptyBody",summaryKey:"empty_body"},{key:"noLinkedCommand",summaryKey:"no_linked_command"}],mr=[{key:"filterReviewerMissing",summaryKey:"filter_reviewer_missing"},{key:"filterRiskMissing",summaryKey:"filter_risk_missing"},{key:"filterConfidenceMissing",summaryKey:"filter_confidence_missing"},{key:"filterSprintMissing",summaryKey:"filter_sprint_missing"},{key:"filterReleaseMissing",summaryKey:"filter_release_missing"}];function pt(e,t){for(let r of ur)t[r.key]===!0&&(e[r.summaryKey]=!0)}function yt(e,t){for(let r of mr)t[r.key]===!0&&(e[r.summaryKey]=!0)}function fr(e,t,r){for(let i of r){let n=t[i.optionKey];n!==void 0&&(e[i.summaryKey]=i.normalize?i.normalize(n):n)}}function gt(e){let t={};return pt(t,e),t}function _t(e){let t={};return yt(t,e),t}var pr=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"}],yr=[{optionKey:"type",summaryKey:"type"},{optionKey:"tag",summaryKey:"tag"},{optionKey:"priority",summaryKey:"priority"},{optionKey:"deadlineBefore",summaryKey:"deadline_before"},{optionKey:"deadlineAfter",summaryKey:"deadline_after"},{optionKey:"updatedAfter",summaryKey:"updated_after"},{optionKey:"updatedBefore",summaryKey:"updated_before"},{optionKey:"createdAfter",summaryKey:"created_after"},{optionKey:"createdBefore",summaryKey:"created_before"},{optionKey:"ids",summaryKey:"ids"},{optionKey:"assignee",summaryKey:"assignee"},{optionKey:"assigneeFilter",summaryKey:"assignee_filter"},{optionKey:"parent",summaryKey:"parent"},{optionKey:"sprint",summaryKey:"sprint"},{optionKey:"release",summaryKey:"release"},{optionKey:"limit",summaryKey:"limit"},{optionKey:"offset",summaryKey:"offset"},{optionKey:"includeBody",summaryKey:"include_body"},{optionKey:"compact",summaryKey:"compact"},{optionKey:"fields",summaryKey:"fields"}],gr=[{key:"filterAcMissing",summaryKey:"filter_ac_missing"},{key:"filterEstimatesMissing",summaryKey:"filter_estimates_missing"},{key:"filterResolutionMissing",summaryKey:"filter_resolution_missing"},{key:"filterMetadataMissing",summaryKey:"filter_metadata_missing"}],_r="-7d";function ht(e){let{filtersStatus:t,options:r,treeEnabled:i,treeDepth:n,sortField:s,sortOrder:o,runtimeFieldFilters:a}=e,l={};return t!==null&&(l.status=t),r.dependencyBlocked===!0&&(l.blocked_semantics="status_or_dependency"),fr(l,r,pr),wt(l,r),r.filterAcMissing===!0&&(l.filter_ac_missing=!0),r.filterEstimatesMissing===!0&&(l.filter_estimates_missing=!0),r.filterResolutionMissing===!0&&(l.filter_resolution_missing=!0),r.filterMetadataMissing===!0&&(l.filter_metadata_missing=!0),yt(l,r),pt(l,r),r.limit!==void 0&&(l.limit=r.limit),r.offset!==void 0&&(l.offset=r.offset),r.includeBody===!0&&(l.include_body=!0),r.fields!==void 0&&(l.fields=r.fields),i&&(l.tree=!0,n!==void 0&&(l.tree_depth=n)),s!==void 0&&(l.sort=s,l.order=o),cr(a)&&(l.runtime_filters=a),l}function ne(e,t,r){let i=E(e.status,r),n=E(t.status,r);if(i!==n)return i?1:-1;let s=e.priority-t.priority;if(s!==0)return s;let o=A(t.updated_at,e.updated_at);return o!==0?o:(e.id??"").localeCompare(t.id??"")}function hr(e,t){return[...e].sort((r,i)=>ne(r,i,t))}function ct(e,t){if(e!==void 0)return z(e,new Date,t)}function K(e,t){if(e==null)return;let r=String(e).trim();if(r.length!==0)return z(r,new Date,t)}function bt(e){let t=e.updatedAfter!=null&&String(e.updatedAfter).trim().length>0;if([e.today===!0,e.recent===!0,t].filter(r=>r).length>1)throw new f("Choose only one updated_at window: --today, --recent, or --updated-after.",m.USAGE);if(e.today===!0){let r=new Date;return r.setHours(0,0,0,0),r.toISOString()}return e.recent===!0?K(_r,"recent"):K(e.updatedAfter,"updated-after")}function wt(e,t){t.today===!0&&(e.today=!0),t.recent===!0&&(e.recent=!0)}function St(e){if(e==null)return;let t=String(e).trim();if(t.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);let r=t.split(",").map(i=>i.trim()).filter(i=>i.length>0);if(r.length===0)throw new f("--ids requires at least one non-empty item ID",m.USAGE);return new Set(r)}function se(e){if(e===void 0)return;let t=String(e).trim(),r=t.length===0?Number.NaN:Number(t);if(!Number.isInteger(r)||r<0)throw new f("Offset filter must be a non-negative integer",m.USAGE);return r}function vt(e){if(e===void 0)return;let t=e.split(",").map(r=>r.trim()).filter(r=>r.length>0);if(t.length===0)throw new f("List --fields requires a comma-separated list of field names",m.USAGE);return[...new Set(t)]}function It(e,t=e.projectionCommand??"list"){let r=e.compact===!0,i=e.brief===!0,n=e.full===!0,s=vt(e.fields);if(Number(r)+Number(i)+Number(n)+ +(s!==void 0)>1)throw new f("List projection options are mutually exclusive. Use one of --compact, --brief, --full, or --fields.",m.USAGE,{code:"projection_options_mutually_exclusive",recovery:{suggested_retry:`pm ${t} --brief`,suggested_retry_args:[t,"--brief"]}});if(n)return{mode:"full",fields:[]};if(i){let o=oe(e.sort);return{mode:"brief",fields:[...new Set([...B,o??"priority"])]}}return r?{mode:"compact",fields:[...j]}:s?{mode:"fields",fields:[...new Set(s.map(o=>v(o)))]}:{mode:"full",fields:[]}}function v(e){return e.startsWith("item.")?e.slice(5):e}function br(e,t,r){if(e.mode!=="fields")return;let i=G(t),n=new Set(i.map(o=>v(o))),s=e.fields.filter(o=>!n.has(v(o)));if(s.length>0){let o=[r,"--fields",e.fields.filter(a=>!s.includes(a)).join(",")||"id,title,status"];throw new f(`Unknown list --fields value(s): ${s.join(", ")}`,m.USAGE,{code:"unknown_field_projection",examples:["pm list --status open --fields id,title,status","pm list --fields id,title,parent,priority --limit 10","pm list --all --fields id,title,body --limit 5"],recovery:{allowed_values:i,suggested_retry:ye(o),suggested_retry_args:o}})}}var wr=new Map([["updated","updated_at"],["update","updated_at"],["modified","updated_at"],["created","created_at"],["create","created_at"]]);function oe(e){if(e===void 0)return;let t=e.trim().toLowerCase(),r=wr.get(t);if(r)return r;if(!lt.includes(t))throw new f(`Sort field must be one of ${lt.join("|")} (aliases: updated->updated_at, created->created_at)`,m.USAGE);return t}function Ft(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!dt.includes(t))throw new f(`Sort order must be one of ${dt.join("|")}`,m.USAGE);return t}function Sr(e){return N(e,"--tree-depth")}function Et(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(!t)throw new f("Assignee filter must be one of assigned|unassigned",m.USAGE);if(t!=="assigned"&&t!=="unassigned")throw new f(`Invalid assignee filter "${e}". Allowed: assigned|unassigned`,m.USAGE);return t}function ut(e,t){return Ae(e,t,{strict:!0})}function Tt(e){return D(e,{label:"--tag",normalize:t=>t.toLowerCase()})}function vr(e,t,r){let i=Tt(t);if(i===void 0)return;let n=new Set(e.flatMap(o=>o.tags.map(a=>a.trim().toLowerCase()))),s=[...i].filter(o=>!n.has(o));s.length>0&&r.push(`unknown_tags:${s.join(",")}`)}function Ir(e,t){if(e&&[...e].some(r=>r.toLowerCase()==="none"||r.toLowerCase()==="null"))throw new f('--assignee no longer accepts "none" or "null". Use --assignee-filter unassigned.',m.USAGE);if(e!==void 0&&t==="unassigned")throw new f("Cannot combine --assignee with --assignee-filter unassigned",m.USAGE)}function Fr(e,t,r,i){let n=D(t.assignee,{label:"--assignee"}),s=Et(t.assigneeFilter);Ir(n,s);let o=mt(t),a=ie(t);return{idsFilter:St(t.ids),statusSet:e&&e.length>0?new Set(e):void 0,excludeTerminal:t.excludeTerminal===!0,typeFilter:qe(t.type,r),tagFilters:Tt(t.tag),priorityFilter:Ve(t.priority),deadlineBefore:ct(t.deadlineBefore,"deadline-before"),deadlineAfter:ct(t.deadlineAfter,"deadline-after"),updatedAfter:bt(t),updatedBefore:K(t.updatedBefore,"updated-before"),createdAfter:K(t.createdAfter,"created-after"),createdBefore:K(t.createdBefore,"created-before"),assigneeFilter:n,assigneeModeFilter:s,parentFilter:t.parent?.trim(),treeEnabled:t.tree===!0,sprintFilter:D(t.sprint,{label:"--sprint"}),releaseFilter:D(t.release,{label:"--release"}),missingMetadataFilters:o,missingMetadataActive:ee(o),lifecycleClassifier:Je(i),contentFieldFilters:a,contentFiltersActive:it(a)}}function Er(e,t,r){return t.idsFilter&&!t.idsFilter.has(e.id)||t.statusSet&&!t.statusSet.has(e.status)||t.excludeTerminal&&E(e.status,r)||t.typeFilter&&!t.typeFilter.has(e.type)||t.tagFilters&&![...t.tagFilters].some(i=>(e.tags??[]).some(n=>n.trim().toLowerCase()===i))?!1:t.priorityFilter===void 0||t.priorityFilter.has(e.priority)}function Tr(e,t){return we(e,t)}function Lr(e,t){return t.assigneeModeFilter==="assigned"&&!e.assignee||t.assigneeModeFilter==="unassigned"&&e.assignee?!1:t.assigneeFilter===void 0||e.assignee!==void 0&&t.assigneeFilter.has(e.assignee)}function Mr(e,t,r){let i=e.parent?.trim().toLowerCase(),n=[...new Set([...r?.get(e.id.trim().toLowerCase())??[],...i?[i]:[]])];return t.parentFilter!==void 0&&!t.treeEnabled&&!n.includes(t.parentFilter.trim().toLowerCase())||t.sprintFilter!==void 0&&(e.sprint===void 0||!t.sprintFilter.has(e.sprint))?!1:t.releaseFilter===void 0||e.release!==void 0&&t.releaseFilter.has(e.release)}function Cr(e,t,r,i,n){return!(!Er(e,t,r)||!Tr(e,t)||!Lr(e,t)||!Mr(e,t,n)||t.missingMetadataActive&&!et(e,t.missingMetadataFilters,t.lifecycleClassifier)||t.contentFiltersActive&&!nt(e,t.contentFieldFilters)||!ke(e,i))}function Lt(e,t,r,i,n,s,o){let a=Fr(t,r,i,n);return e.filter(l=>Cr(l,a,n,s,o))}function L(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function re(e,t,r,i){let n=e,s=typeof n.title=="string"?n.title:"",o=i??L(typeof n.parent=="string"?n.parent:void 0)??null;return{...e,tree_depth:t,tree_parent:o,tree_children:r,tree_title:`${" ".repeat(t)}${s}`}}function Ar(e,t){let r=new Map,i=new Map;for(let n of e){let s=n.id.trim().toLowerCase();r.set(s,n);let o=t?t.parents_by_child.get(s)??[]:[L(n.parent)?.toLowerCase()].filter(a=>a!==void 0);for(let a of o){let l=i.get(a)??[];l.push(n),i.set(a,l)}}return{byId:r,childrenByParent:i}}function Rr(e,t,r,i,n){return t?[...i.get(t.toLowerCase())??[]]:e.filter(s=>(n?n.parents_by_child.get(s.id.trim().toLowerCase())??[]:[L(s.parent)?.toLowerCase()].filter(o=>o!==void 0)).every(o=>!r.has(o)))}function Mt(e,t,r,i,n=e){let{byId:s,childrenByParent:o}=Ar(e,i),a=Rr(e,t,s,o,i),l=[],d=new Set,c=new Map(n.map(p=>[p.id.trim().toLowerCase(),p.id.trim()])),u=[...a].reverse().map(p=>({node:p,depth:0,parentId:t===void 0?void 0:c.get(t.trim().toLowerCase())??t.trim()}));for(;u.length>0;){let{node:p,depth:y,parentId:g}=u.pop(),_=p.id.trim().toLowerCase();if(d.has(_))continue;d.add(_);let b=o.get(_)??[];if(l.push(re(p,y,b.length,g)),!(r!==void 0&&y>=r))for(let U of[...b].reverse())u.push({node:U,depth:y+1,parentId:c.get(_)})}if(t===void 0&&r===void 0)for(let p of e){let y=p.id.trim().toLowerCase();d.has(y)||(d.add(y),l.push(re(p,0,o.get(y)?.length??0)))}return l}function Ct(e,t){return e===t?0:e===null?1:t===null?-1:e.localeCompare(t)}function At(e,t){return e===t?0:e===null?1:t===null?-1:A(e,t)}function Rt(e,t,r){switch(r){case"priority":return e.priority-t.priority;case"deadline":return At(e.deadline??null,t.deadline??null);case"updated_at":return A(e.updated_at,t.updated_at);case"created_at":return A(e.created_at,t.created_at);case"title":return(e.title??"").localeCompare(t.title??"");case"parent":return Ct(e.parent??null,t.parent??null);default:return 0}}function kt(e,t,r,i){return t?[...e].sort((n,s)=>{let o=Rt(n,s,t);if(o!==0)return r==="desc"?-o:o;let a=ne(n,s,i);return r==="desc"?-a:a}):hr(e,i)}function Dt(e,t,r=!1){let i=v(t.trim());if(i.length===0)return null;let n=e;return r&&i==="title"&&typeof n.tree_title=="string"?n.tree_title:Object.prototype.hasOwnProperty.call(n,i)?n[i]??null:null}function ae(e,t,r=!1){return t.mode==="full"?e:e.map(i=>{let n={};for(let s of t.fields)n[s]=Dt(i,s,r);return n})}function Kt(e){let t=[];for(let r of e)t.push(r.metadata_key);return[...t,...ue(C())]}function xt(e,t){let r=N(e.limit);if(r!==void 0)return r;if(e.noTruncate!==!0)return t>=1e4?20:void 0}function kr(e,t,r){return t.after===void 0?se(t.offset)??0:he(e,t.after,r,i=>i.id)}function Ot(e,t,r){return{...e!==void 0?{applied_limit:e}:{},has_more:t,truncated:t,next_cursor:r??null}}async function Dr(e,t){let r=w(process.cwd(),t.path);await O(r);let i=await S(r),n=M(i.schema),s=fe(i.schema),o=e.projectionCommand??"list",a=It(e,o);return br(a,Kt(s.definitions),o),{pmRoot:r,settings:i,statusRegistry:n,runtimeFieldFilters:Re(e,s,"list"),typeRegistry:I(i,C()),projection:a}}async function Kr(e,t,r){let i=t.projection.fields.some(l=>v(l)==="body"),n=t.projection.mode==="full"||t.projection.fields.some(l=>ft.has(v(l))),s=ie(e),o=st(s),a=ot(s);return e.includeBody||i||a?await Ue(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):n||o?await Pe(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema):await k(t.pmRoot,t.settings.item_format,t.typeRegistry.type_to_folder,r,t.settings.schema)}function xr(e){let t=oe(e.sort),r=Ft(e.order)??"asc",i=e.tree===!0;if(!i&&e.treeDepth!==void 0)throw new f("List --tree-depth requires --tree",m.USAGE);if(!t&&e.order!==void 0)throw new f("List --order requires --sort",m.USAGE);return{sortField:t,sortOrder:r,treeEnabled:i,treeDepth:i?Sr(e.treeDepth):void 0,parentRoot:i?L(e.parent):void 0}}function Or(e,t,r){let i=ut(t.status,r),n;t.lifecycleBucket==="in_progress"?n=[r.in_progress_status]:t.lifecycleBucket==="open"&&(n=[...r.active_statuses].filter(d=>d!==r.in_progress_status).sort((d,c)=>d.localeCompare(c)));let s=i??n??ut(e,r),o=Ce(t.status),a=i||o?{...t,excludeTerminal:!1}:t,l="all";return o?l="all":i!==void 0?l=i.length===1?i[0]:i:t.lifecycleBucket!==void 0?l=t.lifecycleBucket:s!==void 0?l=s.length===1?s[0]:s:a.excludeTerminal===!0&&(l=null),{resolvedStatus:s,explicitAllStatuses:o,effectiveOptions:a,filtersStatus:l}}function Nr(e,t,r,i,n){if(t.after!==void 0&&t.offset!==void 0)throw new f("List --after cannot be combined with --offset.",m.USAGE);let s=xt(t,e.length),o=kr(e,t,n),a=s===void 0?e.slice(o):e.slice(o,o+s),l=ae(a,r,i),d=e.length,c=a.length>0&&o+a.length<d,u=c&&a.length>0?$(n,a[a.length-1].id,o+a.length-1):void 0;return{projected:l,totalMatched:d,pageExtras:Ot(s,c,u)}}function Nt(e,t,r,i){return _e("list",{pmRoot:i,status:e,options:ge(t,me),sort:r.sortField??"default",order:r.sortOrder,tree:r.treeEnabled,tree_depth:r.treeDepth??null})}async function Pr(e){let{options:t,runtime:r,statusSelection:i,ordering:n}=e,s=new Set(["status","limit","offset","compact","brief","full","fields","format","stream","includeBody","excludeTerminal","dependencyBlocked","lifecycleBucket","noTruncate","projectionCommand","truncate","notes","learnings","files","docs","tests","comments","deps","linkedCommand"]),o=[r.projection.mode==="full",r.projection.fields.some(y=>{let g=v(y);return g==="body"||ft.has(g)})].includes(!0);if([t.limit===void 0,t.after!==void 0,t.noTruncate===!0,t.includeBody===!0,t.dependencyBlocked===!0,t.strictRead===!0,n.treeEnabled,n.sortField!==void 0,o,pe(),Object.keys(r.runtimeFieldFilters).length>0,Object.entries(t).some(([y,g])=>g!==void 0&&!s.has(y))].includes(!0))return null;let a=await R(r.pmRoot,[...new Set(Object.values(r.typeRegistry.type_to_folder))]);if(!a)return null;let l=N(t.limit),d=se(t.offset)??0,c=await H({pmRoot:r.pmRoot,expectedSourceCursor:a.source_cursor,query:{statuses:i.resolvedStatus,excludeStatuses:i.resolvedStatus===void 0&&i.effectiveOptions.excludeTerminal===!0?[...r.statusRegistry.terminal_statuses]:void 0,terminalStatuses:[...r.statusRegistry.terminal_statuses],limit:l,offset:d}});if(!c)return null;let u=c.items.length>0&&d+c.items.length<c.total,p=u?$(Nt(i.filtersStatus,t,n,r.pmRoot),c.items.at(-1).id,d+c.items.length-1):void 0;return{projected:ae(c.items,r.projection,!1),totalMatched:c.total,pageExtras:Ot(l,u,p)}}function Ur(e){let{filtersStatus:t,options:r,noTruncate:i,treeEnabled:n,treeDepth:s,sortField:o,sortOrder:a,runtimeFieldFilters:l}=e,d={};t!==null&&(d.status=t),r.dependencyBlocked===!0&&(d.blocked_semantics="status_or_dependency");let c=r;for(let u of yr){let p=c[u.optionKey];p!=null&&(d[u.summaryKey]=p)}for(let u of gr)c[u.key]===!0&&(d[u.summaryKey]=!0);return Object.assign(d,_t(r),gt(r)),wt(d,r),i&&(d.no_truncate=!0),r.strictRead===!0&&(d.strict_read=!0),n&&(d.tree=!0,s!==void 0&&(d.tree_depth=s)),o!==void 0&&(d.sort=o,d.order=a),d.runtime_filters=l,d}async function Hi(e,t,r){let i=await Dr(t,r),n=[],s=xr(t),o=Or(e,t,i.statusRegistry),a=t.noTruncate===!0,l=await Pr({options:t,runtime:i,statusSelection:o,ordering:s}),d=l;if(!d){let g=await Kr(t,i,n),_=s.treeEnabled||L(t.parent)!==void 0?$e(Ge(g,Be())):void 0;vr(g,t.tag,n);let b=Lt(g,o.resolvedStatus,o.effectiveOptions,i.typeRegistry,i.statusRegistry,i.runtimeFieldFilters,_?.parents_by_child),U=t.dependencyBlocked===!0?(()=>{let zt=je(g,i.statusRegistry);return b.filter(Ht=>zt.has(Ht.id.trim().toLowerCase()))})():b,ce=kt(U,s.sortField,s.sortOrder,i.statusRegistry),$t=s.treeEnabled?Mt(ce,s.parentRoot,s.treeDepth,_,g):ce;d=Nr($t,t,i.projection,s.treeEnabled,Nt(o.filtersStatus,t,s,i.pmRoot))}let c=be(),u=[...new Set(n)].sort((g,_)=>g.localeCompare(_)),p=dr(u,l!==null,t.strictRead===!0),y=i.projection.mode==="full"?null:[...i.projection.fields];if(i.projection.mode==="compact"&&t.compact===!0){let g=ht({filtersStatus:o.filtersStatus,options:t,treeEnabled:s.treeEnabled,treeDepth:s.treeDepth,sortField:s.sortField,sortOrder:s.sortOrder,runtimeFieldFilters:i.runtimeFieldFilters});return{items:d.projected,count:d.projected.length,total:d.totalMatched,...d.pageExtras,completeness:p,filters:g,projection:{mode:"compact",fields:y},...u.length>0?{warnings:u}:{}}}return{items:d.projected,count:d.projected.length,total:d.totalMatched,...d.pageExtras,completeness:p,filters:Ur({filtersStatus:o.filtersStatus,options:t,noTruncate:a,treeEnabled:s.treeEnabled,treeDepth:s.treeDepth,sortField:s.sortField,sortOrder:s.sortOrder,runtimeFieldFilters:i.runtimeFieldFilters}),projection:{mode:i.projection.mode,fields:y},sorting:{sort:s.sortField??"default",order:s.sortField?s.sortOrder:"asc",...s.sortField===void 0&&!s.treeEnabled?{effective_keys:[["status_registry:nonterminal_before_terminal","asc"],["priority","asc"],["updated_at","desc"],["id","asc"]]}:{}},now:c,...u.length>0?{warnings:u}:{}}}var qi={applyFilters:Lt,buildCompactListFilterSummary:ht,buildContentFilterEcho:gt,buildGovernanceMissingFilterEcho:_t,resolveContentFieldFilters:ie,resolveMissingMetadataFilters:mt,compareBySortField:Rt,compareDefaultSort:ne,compareNullableString:Ct,compareNullableTimestamp:At,normalizeProjectionField:v,parseAssigneeFilter:Et,parseFieldSelectors:vt,parseIdsFilter:St,parseOffset:se,parseProjectionConfig:It,resolveListUpdatedAfter:bt,resolveListPageLimit:xt,parseSortField:oe,parseSortOrder:Ft,orderItemsAsTree:Mt,projectListItems:ae,readListFieldValue:Dt,runtimeMetadataKeysForProjection:Kt,sortItems:kt,trimNonEmpty:L,withTreeMetadata:re};(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]="eb2e6046-156c-56ee-a03a-ecaa1cccfb45")}catch{}})();function fn(e,t){let r=Me(e),i=e.length>0?e[e.length-1].after_hash:Te(),n=t===void 0||r.item_hash_version===void 0?void 0:Ee(t,r.item_hash_version,Se(e.at(-1)?.hash_algorithm)),s=t===void 0?void 0:n===void 0?Fe(t):n[Math.max(0,n.indexOf(i))],o=s===void 0?void 0:s===i,a=[...r.errors];return o===!1&&a.push("verify_failed:current_item_hash_mismatch"),{ok:a.length===0,entries:e.length,errors:a,latest_after_hash:e.length>0?e[e.length-1].after_hash:void 0,current_item_hash:s,current_matches_latest:o}}async function pn(e,t,r={}){let i=w(r.cwd??process.cwd(),r.pmRoot);await O(i);let n=await S(i),s=I(n,C()),o=await ze(i,e,n,s.type_to_folder),a=await Ie(o.historyPath,o.id);if(a.length===0)throw new f(`No history exists for ${o.id}; point-in-time reads are unavailable.`,m.NOT_FOUND);let l=Ke(t,a),d=Oe(xe(a,l.historyIndex),l),c=Le(d,{schema:n.schema});if(c.metadata.id!==o.id)throw new f(`History target resolved to item ${c.metadata.id}, expected ${o.id}.`,m.GENERIC_FAILURE);let u=a[l.historyIndex],p=De(a,!0);return{document:c,reconstructed:!0,as_of_version:p===null?null:p+l.historyIndex+1,as_of_timestamp:u.ts,target:l,history_length:a.length}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="e524f0ad-faad-5d89-b8f5-1283979919ad")}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]="67d97df8-6551-52ed-9307-8b573a087831")}catch{}})();var P=1e6;function le(e,t=P,r=.8,i=!1){let n=new Set,s=(c,u)=>{if(n.add(`${c}:${u}`),n.size>t)throw new f(`Duplicate sweep exceeded ${t} candidate pairs; narrow it with statuses or since.`,m.CONFLICT,{code:"duplicate_sweep_cost_limit",required:"Narrow the duplicate query or increase its similarity threshold. No partial result was returned."})};if(i||r===0){for(let c=0;c<e.length;c+=1)for(let u=0;u<c;u+=1)s(u,c);return n}let o=new Map;for(let{prepared:c}of e)for(let u of c.tokens)o.set(u,(o.get(u)??0)+1);let a=new Map,l=new Map,d=new Map;for(let[c,{prepared:u}]of e.entries()){let p=[...u.tokens].sort((_,b)=>o.get(_)-o.get(b)||_.localeCompare(b)),y=p.length-Math.ceil(r*p.length-1e-12)+1,g=[{index:a,keys:[u.normalized],lengthFilter:!1},{index:l,keys:r<=.99?u.issueCodes:[],lengthFilter:!1},{index:d,keys:p.length===0?[""]:p.slice(0,y),lengthFilter:!0}];for(let _ of g)jr(e,c,_,r,s)}return n}function jr(e,t,r,i,n){let s=e[t].prepared.tokens.length;for(let o of r.keys){let a=r.index.get(o)??[];for(let l of a){let d=e[l].prepared.tokens.length;r.lengthFilter&&Math.min(d,s)/Math.max(d,s)+1e-12<i||n(l,t)}a.push(t),r.index.set(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]="a5f450bd-8970-5b1b-8250-b76b7818e6e1")}catch{}})();var Br=3,Pt=20,Gr=.8,$r=100,Ut=1e3;function Bn(e){return e===void 0?[]:[`likely_duplicates:${e.result.items.map(t=>t.id).join(",")}`,`likely_duplicate_recovery:${e.recovery.action}:${e.recovery.item_id}`]}async function zr(e,t){let r=e.items[0],i=w(t.cwd??process.cwd(),t.pmRoot),n=M((await S(i)).schema);return E(r.status,n)?{action:"reopen",item_id:r.id,command:`pm item reopen ${r.id} "<recurrence reason>"`,args:["item","reopen",r.id,"<recurrence reason>"]}:{action:"reuse",item_id:r.id,command:`pm get ${r.id} --full`,args:["get",r.id,"--full"]}}function de(e){let t=e.limit??Br,r=e.threshold??Gr;if(!Number.isSafeInteger(t)||t<0||t>Pt)throw new f(`Similarity limit must be an integer from 0 to ${Pt}.`,m.USAGE);if(!Number.isFinite(r)||r<0||r>1)throw new f("Similarity threshold must be a number from 0 to 1.",m.USAGE);return{limit:t,threshold:r}}function jt(e){let t=e.limit??$r;if(!Number.isSafeInteger(t)||t<0||t>Ut)throw new f(`Duplicate cluster limit must be an integer from 0 to ${Ut}.`,m.USAGE);let r=e.since===void 0?void 0:new Date(e.since);if(r&&Number.isNaN(r.getTime()))throw new f("Duplicate cluster --since must be a valid ISO timestamp.",m.USAGE);return{limit:t,since:r}}async function Hr(e,t){let r=w(e.cwd??process.cwd(),e.pmRoot),i=await S(r),n=I(i),s=e.statuses?.map(u=>u.trim().toLowerCase()).filter(Boolean);if(e.statuses!==void 0&&s?.length===0)throw new f("Duplicate cluster statuses must include at least one lifecycle status or all.",m.USAGE);let o=M(i.schema),a=s?.map(u=>{if(u==="all")return u;let p=ve(u,o);if(!p)throw new f(`Unknown duplicate-cluster status "${u}". Allowed: all, ${o.definitions.map(y=>y.id).join(", ")}.`,m.USAGE);return p}),l=a?.includes("all")===!0;if(l&&a?.some(u=>u!=="all"))throw new f('The "all" status cannot be combined with other statuses.',m.USAGE);let d=l?void 0:a,c=d?new Set(d):void 0;return{items:(await k(r,i.item_format,n.type_to_folder,void 0,i.schema)).filter(u=>(!c||c.has(u.status))&&(!t||new Date(u.created_at).getTime()>=t.getTime())),statuses:d}}var Gn={buildDuplicateClusters:Gt,collectDuplicateCandidatePairs:le,createDuplicateUnionFind:Bt};function Bt(e){let t=Array.from({length:e},(r,i)=>i);return{parent:t,findRoot:r=>{let i=r;for(;t[i]!==i;)i=t[i];for(;t[r]!==r;){let n=t[r];t[r]=i,r=n}return i}}}function qr(e,t,r,i){let n=[];for(let s of t){let[o,a]=s.split(":").map(u=>Number.parseInt(u,10)),l=Y(e[o].prepared,e[a].prepared);if(l.score<r)continue;let d=i.findRoot(o),c=i.findRoot(a);d!==c&&(i.parent[c]=d),n.push({left_id:e[o].item.id,right_id:e[a].item.id,...l})}return n}function Gt(e,t,r,i){let n=new Map;for(let a of e.keys()){let l=r.findRoot(a),d=n.get(l)??[];d.push(a),n.set(l,d)}let s=new Map(e.map(({item:a},l)=>[a.id,r.findRoot(l)])),o=new Map;for(let a of t){let l=s.get(a.left_id),d=o.get(l)??[];d.push(a),o.set(l,d)}return[...n.values()].filter(a=>a.length>1).map(a=>{let l=(o.get(r.findRoot(a[0]))??[]).sort((d,c)=>c.score-d.score||d.left_id.localeCompare(c.left_id)||d.right_id.localeCompare(c.right_id));return{id:e[a[0]].item.id,items:a.map(d=>{let c=e[d].item;return{id:c.id,title:c.title,status:c.status,type:c.type}}),matches:l,max_score:l[0]?.score??0}}).sort((a,l)=>l.max_score-a.max_score||a.id.localeCompare(l.id)).slice(0,i)}function Vr(e,t,r,i,n){return t.filter(s=>!r.has(s.id)).map(s=>({id:s.id,title:s.title,status:s.status,type:s.type,...X(e,s.title)})).filter(s=>s.score>=i).sort((s,o)=>o.score-s.score||s.id.localeCompare(o.id)).slice(0,n)}async function Wr(e,t={}){let r=e.title.trim();if(r.length===0)throw new f("Similarity candidate title must not be empty.",m.USAGE);let{limit:i,threshold:n}=de(t),s=w(t.cwd??process.cwd(),t.pmRoot),o=await S(s),a=I(o),l=await R(s,Object.values(a.type_to_folder)),d=V(r),c=l&&d.length>0?await q({pmRoot:s,expectedSourceCursor:l.source_cursor,query:d.map(y=>`"${y.replaceAll('"','""')}"`).join(" OR "),limit:Math.max(i*10,50)}):null,u=c===null?await k(s,o.item_format,a.type_to_folder,void 0,o.schema):c.items,p=Vr(r,u,new Set(e.excludeIds??[]),n,i);return{items:p,count:p.length,threshold:n,source:c?"persistent_index":"metadata_fallback"}}function Xr(e,t={}){let{threshold:r}=de({...t,limit:void 0}),{limit:i}=jt(t),n=new Set;for(let c of e){if(!c.id.trim()||n.has(c.id))throw new f("Duplicate analysis requires unique non-empty item ids.",m.USAGE);n.add(c.id)}let s=[...e].sort((c,u)=>c.id.localeCompare(u.id)).map(c=>({item:c,prepared:W(c.title)})),o=le(s,P,r,t.exhaustive===!0),a=Bt(s.length),l=qr(s,o,r,a),d=Gt(s,l,a,i);return{clusters:d,count:d.length,threshold:r,cost:{item_count:s.length,algorithm:t.exhaustive===!0||r===0?"exhaustive":"prefix_exact",possible_pairs:s.length*(s.length-1)/2,pair_limit:P,recall_guarantee:"exact",candidate_pairs:o.size,scored_pairs:o.size}}}async function $n(e={}){de({...e,limit:void 0});let{since:t}=jt(e),{items:r,statuses:i}=await Hr(e,t);return{...Xr(r,e),source:"metadata_scan",filters:{statuses:i??null,since:e.since??null}}}async function zn(e,t){if(t.mode==="off")return;let r=await Wr(e,t);if(r.count===0)return;let i=await zr(r,t),n=t.mode==="strict"&&t.allowDuplicate===!0;if(t.mode==="strict"&&!n){let s=r.items.map(a=>`${a.id} (${a.status}): ${a.title}`).join("; "),o=i.action==="reopen"?"Reopen the canonical item":"Reuse the canonical item";throw new f(`Likely duplicate item(s) found: ${s}. ${o} or pass --allow-duplicate with explicit intent.`,m.CONFLICT,{code:"likely_duplicate",required:`${o}, or explicitly acknowledge the duplicate with --allow-duplicate.`,recovery:{suggested_flags:["--allow-duplicate"],suggested_retry:i.command,suggested_retry_args:i.args}})}return{mode:t.mode,bypassed:n,result:r,recovery:i}}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f091d0c3-f2a7-5d76-8656-4aebe82e9798")}catch{}})();function qn(e,t){let r=t??{};return e.filter(i=>r[i.id]!==i.updated_at).map(i=>i.id).sort((i,n)=>i.localeCompare(n))}export{N as a,He as b,ti as c,Q as d,D as e,qe as f,Ve as g,Je as h,ee as i,et as j,di as k,ci as l,it as m,nt as n,mi as o,mt as p,ie as q,lt as r,dt as s,fr as t,gt as u,_t as v,Hi as w,qi as x,fn as y,pn as z,Bn as A,Gn as B,Wr as C,Xr as D,$n as E,zn as F,qn as G};
2
+ //# sourceMappingURL=chunk-G5PJCR7R.js.map