@unbrained/pm-cli 2026.11.9 → 2026.11.11

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 (613) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +28 -0
  3. package/dist/cli/commander-usage.js +2 -2
  4. package/dist/cli/error-guidance.js +5 -5
  5. package/dist/cli/help-json-payload.js +1 -1
  6. package/dist/cli/main.js +4 -4
  7. package/dist/cli/public.d.ts +1 -1
  8. package/dist/cli/register-history-maintenance.js +2 -2
  9. package/dist/cli/register-setup.js +1 -1
  10. package/dist/cli/runtime/refusal-credential-redaction.js +2 -0
  11. package/dist/cli-bundle/bundle-manifest.json +1 -1
  12. package/dist/cli-bundle/chunks/{chunk-YV5ALMG2.js → chunk-4RHXGQMK.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-IGT252ES.js → chunk-5N3JMGXU.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-VATZTJE3.js → chunk-DIWTFDU7.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-MSJ7IHMJ.js → chunk-DV7WBAKQ.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-GZVOOHTO.js → chunk-EBAHNZJT.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-FM375BHH.js +3 -0
  18. package/dist/cli-bundle/chunks/{chunk-O2M3TNFY.js → chunk-GOLQYO6M.js} +5 -5
  19. package/dist/cli-bundle/chunks/chunk-GZ52WAY2.js +124 -0
  20. package/dist/cli-bundle/chunks/{chunk-6V4PGJBZ.js → chunk-JESMEJTD.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-XKY4LUXN.js → chunk-JLQ7O6UV.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-YK5GAWOT.js → chunk-L3SA3354.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-GDQ2T2OR.js → chunk-NIOOJ3AG.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-GCPP37N6.js → chunk-PZI6CR24.js} +46 -46
  25. package/dist/cli-bundle/chunks/{chunk-Z3QEEOAM.js → chunk-QCTA2UFR.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-EZRLW4R6.js → chunk-SPERPX27.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-ELNWRSGZ.js → chunk-SVVFJPNW.js} +2 -2
  28. package/dist/cli-bundle/chunks/chunk-WEAF3OY4.js +3 -0
  29. package/dist/cli-bundle/chunks/{chunk-JK7O7MFO.js → chunk-WWW5WHHJ.js} +3 -3
  30. package/dist/cli-bundle/chunks/{chunk-5VRJPPUC.js → chunk-XJUYJXHZ.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-XN2BRWDD.js +6 -0
  32. package/dist/cli-bundle/chunks/chunk-Z4YEH7VQ.js +2 -0
  33. package/dist/cli-bundle/chunks/{chunk-3BMIAI4P.js → chunk-ZJDYBXMC.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-G6Q4VQSI.js → chunk-ZSL6U53K.js} +2 -2
  35. package/dist/cli-bundle/chunks/{item-revision-Y5CE3EIN.js → item-revision-LNIHK36Q.js} +2 -2
  36. package/dist/cli-bundle/chunks/item-transaction-TMUYPSMR.js +2 -0
  37. package/dist/cli-bundle/chunks/{mutation-admission-TAQN2AKK.js → mutation-admission-WZY22LVH.js} +2 -2
  38. package/dist/cli-bundle/chunks/{register-list-query-XMQYFUFI.js → register-list-query-DYGPLVRL.js} +2 -2
  39. package/dist/cli-bundle/chunks/{register-mutation-OBVCFLDK.js → register-mutation-MP5JCBAJ.js} +2 -2
  40. package/dist/cli-bundle/chunks/{register-operations-CGNFZ6DR.js → register-operations-QEASK3EF.js} +2 -2
  41. package/dist/cli-bundle/chunks/{register-setup-LFB5ERXH.js → register-setup-G66U2WFV.js} +2 -2
  42. package/dist/cli-bundle/chunks/{stage-NQHF6JPC.js → stage-VIDXGF3T.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/{chunk-LDMBNTOG.js → chunk-2ZS3I5ZP.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-33EK522E.js +26 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-XLSTFUXM.js → chunk-3A6XMQZJ.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/{chunk-IS5FLEZW.js → chunk-3FN4ON2Z.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/{chunk-UIKLNSW3.js → chunk-3SH3L3DB.js} +2 -2
  48. package/dist/cli-bundle/focused-chunks/{chunk-ALLOWZSH.js → chunk-6ICHSVEY.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-6TJXTKZD.js +44 -0
  50. package/dist/cli-bundle/focused-chunks/{chunk-AH5IST3V.js → chunk-AXPRCCYM.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/chunk-DW5S67LO.js +2 -0
  52. package/dist/cli-bundle/focused-chunks/{chunk-C3DO4ZGZ.js → chunk-GBW2EAAG.js} +2 -2
  53. package/dist/cli-bundle/focused-chunks/chunk-HIKZYZ26.js +82 -0
  54. package/dist/cli-bundle/focused-chunks/{chunk-4FWMXQN3.js → chunk-JYWVRXLD.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/chunk-M5FZTPFA.js +2 -0
  56. package/dist/cli-bundle/focused-chunks/{chunk-2SQUWQP3.js → chunk-MK7UQEE5.js} +18 -18
  57. package/dist/cli-bundle/focused-chunks/{chunk-HNFY3XLC.js → chunk-NMU3QFAU.js} +2 -2
  58. package/dist/cli-bundle/focused-chunks/{chunk-QWUWNFQO.js → chunk-NP5C2TQM.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-RNZUORGI.js → chunk-NSOXVVQX.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-J7PWHKZK.js → chunk-NY65XTX7.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-Q45LDP7P.js → chunk-P6KYUJD4.js} +2 -2
  62. package/dist/cli-bundle/focused-chunks/{chunk-LWMPQRJT.js → chunk-UCUESVFW.js} +2 -2
  63. package/dist/cli-bundle/focused-chunks/{chunk-NZQYHPUN.js → chunk-V27M5UQH.js} +2 -2
  64. package/dist/cli-bundle/focused-chunks/chunk-VVGXPF4W.js +26 -0
  65. package/dist/cli-bundle/focused-chunks/{item-revision-M6FOLME2.js → item-revision-B3BIG66B.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{item-transaction-H6VA5JGB.js → item-transaction-4JDWOXNB.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/{mutation-admission-PRTQWQK6.js → mutation-admission-577MXOGD.js} +2 -2
  68. package/dist/cli-bundle/focused-chunks/{stage-7T77PSJD.js → stage-EKYWEU2Y.js} +2 -2
  69. package/dist/cli-bundle/main.js +32 -32
  70. package/dist/cli-bundle/sdk-authoring.js +1 -1
  71. package/dist/cli-bundle/sdk-contracts.js +1 -1
  72. package/dist/cli-bundle/sdk-core.js +1 -1
  73. package/dist/cli-bundle/sdk-governance.js +1 -1
  74. package/dist/cli-bundle/sdk-graph.js +1 -1
  75. package/dist/cli-bundle/sdk-merge.js +57 -57
  76. package/dist/cli-bundle/sdk-query.js +1 -1
  77. package/dist/cli-bundle/sdk-runtime.js +1 -1
  78. package/dist/cli-bundle/sdk-testing.js +1 -1
  79. package/dist/cli-bundle/sdk.js +11 -11
  80. package/dist/core/checkpoint/mutation-checkpoint.d.ts +12 -20
  81. package/dist/core/config/nested-settings.d.ts +14 -45
  82. package/dist/core/config/nested-settings.js +1 -1
  83. package/dist/core/config/positional-value.d.ts +11 -14
  84. package/dist/core/config/positional-value.js +1 -1
  85. package/dist/core/extensions/activation-summary-markdown.d.ts +4 -5
  86. package/dist/core/extensions/activation-summary.d.ts +7 -15
  87. package/dist/core/extensions/capability-usage.d.ts +7 -23
  88. package/dist/core/extensions/command-hook-context.d.ts +4 -7
  89. package/dist/core/extensions/command-metadata-contract.d.ts +2 -2
  90. package/dist/core/extensions/contribution-inventory.d.ts +3 -25
  91. package/dist/core/extensions/extension-capability-aliases.d.ts +7 -10
  92. package/dist/core/extensions/extension-hook-runtime.d.ts +2 -2
  93. package/dist/core/extensions/extension-policy.d.ts +12 -47
  94. package/dist/core/extensions/extension-registries.d.ts +2 -2
  95. package/dist/core/extensions/extension-types.d.ts +332 -545
  96. package/dist/core/extensions/flag-definition-validation.d.ts +11 -13
  97. package/dist/core/extensions/flag-value-types.d.ts +11 -13
  98. package/dist/core/extensions/index.d.ts +15 -20
  99. package/dist/core/extensions/item-field-types.d.ts +5 -5
  100. package/dist/core/extensions/item-fields.d.ts +4 -7
  101. package/dist/core/extensions/loader.d.ts +5 -69
  102. package/dist/core/extensions/manifest-parser.d.ts +3 -3
  103. package/dist/core/extensions/manifest-schema.d.ts +10 -13
  104. package/dist/core/extensions/registration-contracts.d.ts +2 -4
  105. package/dist/core/extensions/registration-validation.d.ts +1 -1
  106. package/dist/core/extensions/registration-values.d.ts +5 -7
  107. package/dist/core/extensions/runtime-registrations.d.ts +6 -6
  108. package/dist/core/extensions/version-compat.d.ts +9 -10
  109. package/dist/core/fs/fs-utils.d.ts +4 -6
  110. package/dist/core/fs/host-environment-errors.d.ts +8 -10
  111. package/dist/core/governance/content-fields.d.ts +10 -14
  112. package/dist/core/governance/issue-codes.d.ts +12 -18
  113. package/dist/core/governance/metadata-coverage.d.ts +24 -34
  114. package/dist/core/history/digest.d.ts +3 -3
  115. package/dist/core/history/event-classification.d.ts +5 -5
  116. package/dist/core/history/event-index.d.ts +14 -35
  117. package/dist/core/history/history-compact-bulk.d.ts +10 -13
  118. package/dist/core/history/history-diff.d.ts +6 -11
  119. package/dist/core/history/history-rewrite.d.ts +24 -40
  120. package/dist/core/history/history-storage-stats.d.ts +9 -17
  121. package/dist/core/history/history-stream-policy.d.ts +8 -11
  122. package/dist/core/history/history.d.ts +10 -44
  123. package/dist/core/history/identity.d.ts +4 -5
  124. package/dist/core/history/operation-contract.d.ts +5 -15
  125. package/dist/core/history/projection.d.ts +10 -14
  126. package/dist/core/history/read.d.ts +6 -7
  127. package/dist/core/history/replay.d.ts +16 -37
  128. package/dist/core/history/workspace-history.d.ts +27 -60
  129. package/dist/core/io/body-file.d.ts +2 -2
  130. package/dist/core/io/bulk-ids-input.d.ts +7 -8
  131. package/dist/core/item/actionability.d.ts +16 -22
  132. package/dist/core/item/dependency-reference.d.ts +2 -2
  133. package/dist/core/item/id.d.ts +5 -9
  134. package/dist/core/item/item-format-version.d.ts +11 -13
  135. package/dist/core/item/item-format.d.ts +11 -59
  136. package/dist/core/item/item-record.d.ts +2 -2
  137. package/dist/core/item/literal-mutation-input.d.ts +2 -2
  138. package/dist/core/item/parent-reference-policy.d.ts +4 -7
  139. package/dist/core/item/parse.d.ts +10 -26
  140. package/dist/core/item/plan-lifecycle.d.ts +3 -3
  141. package/dist/core/item/priority.d.ts +2 -2
  142. package/dist/core/item/sprint-release-format.d.ts +3 -7
  143. package/dist/core/item/status-filter.d.ts +5 -7
  144. package/dist/core/item/status.d.ts +3 -4
  145. package/dist/core/item/type-registry.d.ts +17 -24
  146. package/dist/core/item/type-synonyms.d.ts +1 -1
  147. package/dist/core/lock/lock-owner.d.ts +8 -10
  148. package/dist/core/lock/lock.d.ts +19 -67
  149. package/dist/core/output/output-control.d.ts +5 -6
  150. package/dist/core/output/output.d.ts +10 -19
  151. package/dist/core/output/tabular.d.ts +2 -2
  152. package/dist/core/packages/manifest.d.ts +13 -17
  153. package/dist/core/packages/root.d.ts +3 -3
  154. package/dist/core/policy/workflow-policy-schema.d.ts +2 -310
  155. package/dist/core/policy/workflow-policy-store.d.ts +5 -14
  156. package/dist/core/policy/workflow-policy.d.ts +25 -52
  157. package/dist/core/profile/profile-describe.d.ts +8 -11
  158. package/dist/core/profile/profile-lint.d.ts +11 -13
  159. package/dist/core/profile/profile-plan.d.ts +30 -49
  160. package/dist/core/profile/profile-presets.d.ts +25 -36
  161. package/dist/core/reproducibility/context.d.ts +6 -7
  162. package/dist/core/schema/fields-file.d.ts +14 -21
  163. package/dist/core/schema/item-types-file.d.ts +16 -22
  164. package/dist/core/schema/runtime-field-filters.d.ts +2 -2
  165. package/dist/core/schema/runtime-field-values.d.ts +6 -13
  166. package/dist/core/schema/runtime-schema.d.ts +19 -31
  167. package/dist/core/schema/status-defs-file.d.ts +15 -25
  168. package/dist/core/schema/status-token.d.ts +1 -1
  169. package/dist/core/schema/type-inference.d.ts +6 -8
  170. package/dist/core/schema/type-presets.d.ts +5 -5
  171. package/dist/core/schema/type-workflows.d.ts +11 -16
  172. package/dist/core/search/background-refresh.d.ts +6 -12
  173. package/dist/core/search/bm25.d.ts +11 -19
  174. package/dist/core/search/cache.d.ts +19 -41
  175. package/dist/core/search/corpus.d.ts +16 -19
  176. package/dist/core/search/embedding-batches.d.ts +12 -17
  177. package/dist/core/search/eval-thresholds.d.ts +3 -3
  178. package/dist/core/search/eval.d.ts +16 -34
  179. package/dist/core/search/http-client.d.ts +14 -18
  180. package/dist/core/search/providers.d.ts +22 -39
  181. package/dist/core/search/relevance.d.ts +14 -19
  182. package/dist/core/search/semantic-defaults.d.ts +4 -5
  183. package/dist/core/search/vector-stores.d.ts +35 -57
  184. package/dist/core/search/vectorization-metadata.d.ts +9 -11
  185. package/dist/core/sentry/helpers.d.ts +6 -31
  186. package/dist/core/sentry/instrument.d.ts +6 -59
  187. package/dist/core/sentry/instrument.js +1 -1
  188. package/dist/core/session/session-state.d.ts +12 -32
  189. package/dist/core/shared/agent-session-context.d.ts +10 -17
  190. package/dist/core/shared/author.d.ts +48 -69
  191. package/dist/core/shared/command-line.d.ts +3 -3
  192. package/dist/core/shared/command-types.d.ts +3 -4
  193. package/dist/core/shared/constants.d.ts +14 -32
  194. package/dist/core/shared/error-details.d.ts +5 -18
  195. package/dist/core/shared/errors.d.ts +42 -83
  196. package/dist/core/shared/html-entity-decode.d.ts +1 -1
  197. package/dist/core/shared/item-metadata-contract.d.ts +2 -2
  198. package/dist/core/shared/lazy-module.d.ts +1 -1
  199. package/dist/core/shared/levenshtein.d.ts +1 -1
  200. package/dist/core/shared/numeric-parsers.d.ts +1 -1
  201. package/dist/core/shared/option-alias-visibility.d.ts +2 -2
  202. package/dist/core/shared/output-unicode.d.ts +1 -1
  203. package/dist/core/shared/primitives.d.ts +10 -10
  204. package/dist/core/shared/secret-rules.d.ts +22 -92
  205. package/dist/core/shared/secret-rules.js +4 -2
  206. package/dist/core/shared/serial-queue.d.ts +7 -9
  207. package/dist/core/shared/serialization.d.ts +1 -1
  208. package/dist/core/shared/split-comma-list.d.ts +4 -5
  209. package/dist/core/shared/text-normalization.d.ts +1 -1
  210. package/dist/core/shared/time.d.ts +6 -20
  211. package/dist/core/shared/url-credentials.d.ts +37 -0
  212. package/dist/core/shared/url-credentials.js +2 -0
  213. package/dist/core/store/item-format-migration.d.ts +4 -5
  214. package/dist/core/store/item-metadata-cache.d.ts +22 -27
  215. package/dist/core/store/item-metadata-query-index.d.ts +20 -61
  216. package/dist/core/store/item-metadata-read-work.d.ts +3 -7
  217. package/dist/core/store/item-mutation-precondition.d.ts +19 -35
  218. package/dist/core/store/item-store.d.ts +18 -141
  219. package/dist/core/store/paths.d.ts +5 -10
  220. package/dist/core/store/settings-read-cache.d.ts +7 -9
  221. package/dist/core/store/settings-sections.d.ts +15 -19
  222. package/dist/core/store/settings-validator.d.ts +27 -143
  223. package/dist/core/store/settings-validator.js +1 -1
  224. package/dist/core/store/settings.d.ts +19 -94
  225. package/dist/core/store/sqlite-runtime.d.ts +3 -3
  226. package/dist/core/store/tracker-preflight.d.ts +2 -2
  227. package/dist/core/telemetry/consent.d.ts +2 -2
  228. package/dist/core/telemetry/observability.d.ts +8 -19
  229. package/dist/core/telemetry/policy.d.ts +8 -23
  230. package/dist/core/telemetry/runtime.d.ts +44 -254
  231. package/dist/core/telemetry/runtime.js +2 -2
  232. package/dist/core/test/background-runs.d.ts +35 -79
  233. package/dist/core/test/run-selectors.d.ts +10 -12
  234. package/dist/core/validate/fix-planning.d.ts +19 -28
  235. package/dist/core/validate/missing-by-type.d.ts +3 -4
  236. package/dist/core/validate/missing-link-owners.d.ts +12 -16
  237. package/dist/core/validate/stale-file-classification.d.ts +5 -6
  238. package/dist/mcp/tool-definitions.d.ts +7 -30
  239. package/dist/sdk/actionability.d.ts +1 -1
  240. package/dist/sdk/agent/closed-domain-contracts.d.ts +4 -5
  241. package/dist/sdk/agent/command-recovery.d.ts +9 -13
  242. package/dist/sdk/agent/command-suggestions.d.ts +2 -2
  243. package/dist/sdk/agent/create-option-policy.d.ts +2 -2
  244. package/dist/sdk/agent/identity-config.d.ts +13 -18
  245. package/dist/sdk/agent/item-addressing.d.ts +4 -5
  246. package/dist/sdk/agent/linked-resource-recovery.d.ts +3 -4
  247. package/dist/sdk/agent/refusal-closure-census.d.ts +13 -25
  248. package/dist/sdk/agent/refusal-closure.d.ts +8 -11
  249. package/dist/sdk/agent/refusal-corpus-contracts.d.ts +15 -21
  250. package/dist/sdk/agent/refusal-reachability.d.ts +38 -52
  251. package/dist/sdk/agent/subcommand-recovery.d.ts +7 -15
  252. package/dist/sdk/agent/task-transcript-contracts.d.ts +12 -15
  253. package/dist/sdk/agent/tracker-preflight-contracts.d.ts +13 -17
  254. package/dist/sdk/agent-capability-contracts.d.ts +19 -32
  255. package/dist/sdk/agent-session-context.d.ts +1 -1
  256. package/dist/sdk/annotations.d.ts +32 -68
  257. package/dist/sdk/author-attribution.d.ts +22 -33
  258. package/dist/sdk/authoring.d.ts +1 -19
  259. package/dist/sdk/cli-bootstrap.d.ts +22 -59
  260. package/dist/sdk/cli-contracts/agent-output-contracts.d.ts +31 -57
  261. package/dist/sdk/cli-contracts/command-aliases.d.ts +7 -8
  262. package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +19 -65
  263. package/dist/sdk/cli-contracts/commander-mutation-options.d.ts +2 -2
  264. package/dist/sdk/cli-contracts/commander-types.d.ts +6 -11
  265. package/dist/sdk/cli-contracts/completeness.d.ts +11 -15
  266. package/dist/sdk/cli-contracts/enum-contracts.d.ts +25 -37
  267. package/dist/sdk/cli-contracts/flag-contracts.d.ts +16 -20
  268. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +14 -19
  269. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +29 -47
  270. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +44 -265
  271. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +11 -564
  272. package/dist/sdk/cli-contracts/tool-schema.d.ts +18 -51
  273. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +18 -37
  274. package/dist/sdk/cli-contracts.d.ts +1 -16
  275. package/dist/sdk/cli-program.d.ts +2 -2
  276. package/dist/sdk/command-line.d.ts +3 -4
  277. package/dist/sdk/command-line.js +1 -1
  278. package/dist/sdk/comments.d.ts +6 -10
  279. package/dist/sdk/compile-cache.d.ts +4 -5
  280. package/dist/sdk/completion/bash.d.ts +2 -2
  281. package/dist/sdk/completion/fish.d.ts +2 -2
  282. package/dist/sdk/completion/shared.d.ts +10 -77
  283. package/dist/sdk/completion/shared.js +1 -1
  284. package/dist/sdk/completion/zsh.d.ts +2 -2
  285. package/dist/sdk/completion.d.ts +2 -6
  286. package/dist/sdk/compose.d.ts +49 -74
  287. package/dist/sdk/config.d.ts +18 -94
  288. package/dist/sdk/config.js +1 -1
  289. package/dist/sdk/context/recency.d.ts +2 -2
  290. package/dist/sdk/context/semantic-session-attribution.d.ts +6 -25
  291. package/dist/sdk/context/usage-ledger.d.ts +9 -21
  292. package/dist/sdk/context-intent-contracts.d.ts +24 -35
  293. package/dist/sdk/context-intent-runtime.d.ts +7 -9
  294. package/dist/sdk/context-packing.d.ts +16 -34
  295. package/dist/sdk/context-relevance.d.ts +58 -93
  296. package/dist/sdk/context-signal-store.d.ts +29 -60
  297. package/dist/sdk/context-usage.d.ts +22 -69
  298. package/dist/sdk/contracts.d.ts +1 -24
  299. package/dist/sdk/core-governance.d.ts +1 -5
  300. package/dist/sdk/core.d.ts +1 -27
  301. package/dist/sdk/corpus-shape.d.ts +16 -28
  302. package/dist/sdk/define.d.ts +10 -14
  303. package/dist/sdk/dependencies.d.ts +32 -50
  304. package/dist/sdk/dependency-provenance.d.ts +19 -23
  305. package/dist/sdk/docs.d.ts +6 -10
  306. package/dist/sdk/duplicates.d.ts +8 -15
  307. package/dist/sdk/environment/agent-environment.d.ts +60 -101
  308. package/dist/sdk/environment/host-environment-errors.d.ts +1 -1
  309. package/dist/sdk/environment/project-runtime-compatibility.d.ts +15 -29
  310. package/dist/sdk/environment/source-context.d.ts +6 -7
  311. package/dist/sdk/environment/tracker-preflight.d.ts +1 -1
  312. package/dist/sdk/error-code-catalog.d.ts +9 -26
  313. package/dist/sdk/error-runtime.d.ts +6 -8
  314. package/dist/sdk/errors.d.ts +10 -17
  315. package/dist/sdk/eval.d.ts +11 -21
  316. package/dist/sdk/extension/command-options.d.ts +14 -26
  317. package/dist/sdk/extension/describe.d.ts +14 -19
  318. package/dist/sdk/extension/doctor.d.ts +8 -48
  319. package/dist/sdk/extension/install-plan.d.ts +12 -26
  320. package/dist/sdk/extension/install-runtime.d.ts +10 -11
  321. package/dist/sdk/extension/install-sources.d.ts +22 -104
  322. package/dist/sdk/extension/managed-state.d.ts +13 -18
  323. package/dist/sdk/extension/migrations.d.ts +22 -37
  324. package/dist/sdk/extension/output-ownership.d.ts +3 -30
  325. package/dist/sdk/extension/shared.d.ts +9 -15
  326. package/dist/sdk/extension/source-resolution.d.ts +13 -18
  327. package/dist/sdk/extension/static-inventory.d.ts +17 -21
  328. package/dist/sdk/extension/update-check.d.ts +7 -11
  329. package/dist/sdk/extension-command-context.d.ts +2 -3
  330. package/dist/sdk/extension-contracts.d.ts +11 -14
  331. package/dist/sdk/extension.d.ts +31 -192
  332. package/dist/sdk/files.d.ts +27 -68
  333. package/dist/sdk/flag-invocation-contracts.d.ts +13 -17
  334. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  335. package/dist/sdk/generated-error-code-catalog.d.ts +1 -1
  336. package/dist/sdk/governance/artifact-ledgers.d.ts +9 -16
  337. package/dist/sdk/governance/assurance-action-contracts.d.ts +1 -1
  338. package/dist/sdk/governance/assurance-action.d.ts +13 -45
  339. package/dist/sdk/governance/assurance-mutation-error.d.ts +12 -17
  340. package/dist/sdk/governance/assurance-presets.d.ts +10 -21
  341. package/dist/sdk/governance/assurance-runtime.d.ts +5 -6
  342. package/dist/sdk/governance/assurance.d.ts +97 -154
  343. package/dist/sdk/governance/boundary-fixtures.d.ts +17 -23
  344. package/dist/sdk/governance/closure-timestamps.d.ts +5 -15
  345. package/dist/sdk/governance/coverage-assurance.d.ts +5 -6
  346. package/dist/sdk/governance/defect-recurrence-coverage.d.ts +13 -23
  347. package/dist/sdk/governance/defect-recurrence-graph.d.ts +9 -13
  348. package/dist/sdk/governance/defect-recurrence.d.ts +43 -67
  349. package/dist/sdk/governance/extension-host-version.d.ts +8 -10
  350. package/dist/sdk/governance/gc.d.ts +12 -20
  351. package/dist/sdk/governance/health/projection.d.ts +8 -23
  352. package/dist/sdk/governance/health.d.ts +23 -167
  353. package/dist/sdk/governance/hierarchy-validation.d.ts +2 -18
  354. package/dist/sdk/governance/linked-file-report.d.ts +6 -10
  355. package/dist/sdk/governance/merge-receipt-history.d.ts +12 -16
  356. package/dist/sdk/governance/provenance-health.d.ts +17 -23
  357. package/dist/sdk/governance/reindex.d.ts +13 -116
  358. package/dist/sdk/governance/reliability.d.ts +13 -17
  359. package/dist/sdk/governance/stale-work.d.ts +8 -11
  360. package/dist/sdk/governance/status-role-diagnostics.d.ts +4 -6
  361. package/dist/sdk/governance/storage-integrity.d.ts +16 -23
  362. package/dist/sdk/governance/upgrade.d.ts +17 -57
  363. package/dist/sdk/governance/validate-item-reader.d.ts +3 -11
  364. package/dist/sdk/governance/validate-normalization.d.ts +2 -2
  365. package/dist/sdk/governance/validate.d.ts +29 -175
  366. package/dist/sdk/governance/workflow-completeness.d.ts +5 -17
  367. package/dist/sdk/governance/workflow-policy.d.ts +8 -16
  368. package/dist/sdk/governance/workspace-position.d.ts +12 -43
  369. package/dist/sdk/governance.d.ts +1 -39
  370. package/dist/sdk/graph/adapter.d.ts +23 -41
  371. package/dist/sdk/graph/analytics.d.ts +20 -31
  372. package/dist/sdk/graph/assembly.d.ts +24 -35
  373. package/dist/sdk/graph/cache.d.ts +13 -25
  374. package/dist/sdk/graph/cardinality-integrity.d.ts +4 -6
  375. package/dist/sdk/graph/centrality.d.ts +14 -20
  376. package/dist/sdk/graph/conformance.d.ts +12 -19
  377. package/dist/sdk/graph/deadline-scheduling.d.ts +14 -20
  378. package/dist/sdk/graph/durable-cache.d.ts +11 -14
  379. package/dist/sdk/graph/governance-contracts.d.ts +2 -2
  380. package/dist/sdk/graph/governance.d.ts +22 -36
  381. package/dist/sdk/graph/hierarchy-integrity.d.ts +18 -26
  382. package/dist/sdk/graph/index.d.ts +1 -17
  383. package/dist/sdk/graph/lifecycle-coverage.d.ts +8 -12
  384. package/dist/sdk/graph/mutation-advisory.d.ts +5 -16
  385. package/dist/sdk/graph/query-contracts.d.ts +1 -2
  386. package/dist/sdk/graph/remediation.d.ts +11 -18
  387. package/dist/sdk/graph/run.d.ts +73 -115
  388. package/dist/sdk/graph/scheduling.d.ts +8 -15
  389. package/dist/sdk/graph/traversal.d.ts +9 -15
  390. package/dist/sdk/graph/workspace-relationship-kind-registry.d.ts +2 -2
  391. package/dist/sdk/graph.d.ts +1 -12
  392. package/dist/sdk/guide-topics.d.ts +7 -10
  393. package/dist/sdk/guide.d.ts +21 -43
  394. package/dist/sdk/history/attestation-command.d.ts +7 -10
  395. package/dist/sdk/history/attestation-contract.d.ts +19 -34
  396. package/dist/sdk/history/attestation.d.ts +2 -3
  397. package/dist/sdk/history/maintenance.d.ts +17 -27
  398. package/dist/sdk/history/salvage.d.ts +5 -22
  399. package/dist/sdk/history/subject.d.ts +5 -11
  400. package/dist/sdk/history-analytics.d.ts +28 -59
  401. package/dist/sdk/history-compact.d.ts +25 -66
  402. package/dist/sdk/history-provenance.d.ts +16 -33
  403. package/dist/sdk/history-read.d.ts +9 -16
  404. package/dist/sdk/history-redact.d.ts +19 -74
  405. package/dist/sdk/history-redact.js +1 -1
  406. package/dist/sdk/history-repair.d.ts +26 -71
  407. package/dist/sdk/improvement-ledger-validation.d.ts +2 -2
  408. package/dist/sdk/improvement-ledger.d.ts +20 -39
  409. package/dist/sdk/index.d.ts +1 -268
  410. package/dist/sdk/index.js +1 -1
  411. package/dist/sdk/init-agent-guidance.d.ts +13 -68
  412. package/dist/sdk/init.d.ts +24 -94
  413. package/dist/sdk/invocation-author.d.ts +1 -1
  414. package/dist/sdk/item-children.d.ts +10 -13
  415. package/dist/sdk/item-metadata-index.d.ts +1 -2
  416. package/dist/sdk/item-schedule.d.ts +8 -9
  417. package/dist/sdk/item-transaction.d.ts +46 -90
  418. package/dist/sdk/learnings.d.ts +6 -10
  419. package/dist/sdk/lifecycle/append.d.ts +7 -9
  420. package/dist/sdk/lifecycle/claim.d.ts +26 -42
  421. package/dist/sdk/lifecycle/cli-input.d.ts +1 -1
  422. package/dist/sdk/lifecycle/close-many.d.ts +14 -65
  423. package/dist/sdk/lifecycle/close.d.ts +10 -26
  424. package/dist/sdk/lifecycle/copy.d.ts +6 -10
  425. package/dist/sdk/lifecycle/create.d.ts +15 -83
  426. package/dist/sdk/lifecycle/delete.d.ts +7 -9
  427. package/dist/sdk/lifecycle/focus.d.ts +9 -11
  428. package/dist/sdk/lifecycle/item-revision.d.ts +25 -45
  429. package/dist/sdk/lifecycle/item-revision.js +1 -1
  430. package/dist/sdk/lifecycle/lifecycle-transitions.d.ts +4 -5
  431. package/dist/sdk/lifecycle/mutation-command-options.d.ts +6 -9
  432. package/dist/sdk/lifecycle/plan-mutation-receipt.d.ts +5 -13
  433. package/dist/sdk/lifecycle/plan.d.ts +34 -74
  434. package/dist/sdk/lifecycle/reopen.d.ts +8 -14
  435. package/dist/sdk/lifecycle/restore.d.ts +9 -38
  436. package/dist/sdk/lifecycle/shared-unset-fields.d.ts +23 -614
  437. package/dist/sdk/lifecycle/start-blockers.d.ts +7 -27
  438. package/dist/sdk/lifecycle/structured-mutation-plan.d.ts +8 -16
  439. package/dist/sdk/lifecycle/task-composition.d.ts +6 -14
  440. package/dist/sdk/lifecycle/update-many.d.ts +15 -65
  441. package/dist/sdk/lifecycle/update.d.ts +21 -104
  442. package/dist/sdk/lifecycle/workflow-transition.d.ts +2 -11
  443. package/dist/sdk/lifecycle-completion.d.ts +11 -14
  444. package/dist/sdk/lifecycle-policy.d.ts +23 -32
  445. package/dist/sdk/linked-artifacts.d.ts +31 -41
  446. package/dist/sdk/mcp/apps.d.ts +12 -27
  447. package/dist/sdk/mcp/authorization.d.ts +30 -63
  448. package/dist/sdk/mcp/discovery.d.ts +23 -52
  449. package/dist/sdk/mcp/executable.d.ts +3 -10
  450. package/dist/sdk/mcp/interactions.d.ts +25 -47
  451. package/dist/sdk/mcp/protocol.d.ts +32 -64
  452. package/dist/sdk/mcp/skills.d.ts +21 -71
  453. package/dist/sdk/mcp/subscriptions.d.ts +14 -28
  454. package/dist/sdk/mcp/tasks.d.ts +21 -55
  455. package/dist/sdk/mcp/transport.d.ts +7 -15
  456. package/dist/sdk/merge/driver.d.ts +13 -37
  457. package/dist/sdk/merge/index.d.ts +1 -6
  458. package/dist/sdk/merge/install.d.ts +27 -55
  459. package/dist/sdk/merge/receipt-operation.d.ts +5 -6
  460. package/dist/sdk/merge/receipt-schema.d.ts +6 -9
  461. package/dist/sdk/merge/receipts.d.ts +29 -79
  462. package/dist/sdk/merge/reconcile.d.ts +9 -18
  463. package/dist/sdk/merge/three-way.d.ts +21 -30
  464. package/dist/sdk/merge.d.ts +1 -5
  465. package/dist/sdk/mutation-events.d.ts +21 -53
  466. package/dist/sdk/mutation-guard.d.ts +15 -135
  467. package/dist/sdk/notes.d.ts +6 -10
  468. package/dist/sdk/output/fit-envelope.d.ts +21 -28
  469. package/dist/sdk/output/list-envelope.d.ts +1 -1
  470. package/dist/sdk/output/table-rows.d.ts +8 -12
  471. package/dist/sdk/output-contracts.d.ts +11 -14
  472. package/dist/sdk/output-projection.d.ts +18 -130
  473. package/dist/sdk/output-token-accounting.d.ts +8 -15
  474. package/dist/sdk/output.d.ts +10 -15
  475. package/dist/sdk/ownership-source.d.ts +4 -5
  476. package/dist/sdk/package-import-adapters.d.ts +27 -37
  477. package/dist/sdk/package-migrations.d.ts +2 -2
  478. package/dist/sdk/package-runtime-options.d.ts +3 -3
  479. package/dist/sdk/pagination.d.ts +12 -24
  480. package/dist/sdk/profile.d.ts +25 -42
  481. package/dist/sdk/provenance.d.ts +21 -32
  482. package/dist/sdk/public-surface.json +1 -1
  483. package/dist/sdk/query/activity.d.ts +24 -77
  484. package/dist/sdk/query/aggregate.d.ts +20 -95
  485. package/dist/sdk/query/calendar.d.ts +26 -74
  486. package/dist/sdk/query/complete-list.d.ts +19 -35
  487. package/dist/sdk/query/context.d.ts +69 -240
  488. package/dist/sdk/query/declared-blockers.d.ts +2 -9
  489. package/dist/sdk/query/duplicate-candidates.d.ts +3 -5
  490. package/dist/sdk/query/get.d.ts +13 -55
  491. package/dist/sdk/query/history.d.ts +18 -29
  492. package/dist/sdk/query/item-filter-options.d.ts +7 -12
  493. package/dist/sdk/query/list-filter-shared.d.ts +4 -8
  494. package/dist/sdk/query/list.d.ts +44 -168
  495. package/dist/sdk/query/multi-value-filters.d.ts +7 -9
  496. package/dist/sdk/query/next-ranking-policy.d.ts +4 -10
  497. package/dist/sdk/query/next-ready-budget.d.ts +4 -5
  498. package/dist/sdk/query/next.d.ts +27 -86
  499. package/dist/sdk/query/parsers.d.ts +4 -6
  500. package/dist/sdk/query/projection-contracts.d.ts +12 -21
  501. package/dist/sdk/query/search/corpus.d.ts +5 -20
  502. package/dist/sdk/query/search/filters.d.ts +5 -17
  503. package/dist/sdk/query/search/input.d.ts +4 -9
  504. package/dist/sdk/query/search/lexical.d.ts +5 -9
  505. package/dist/sdk/query/search/response.d.ts +5 -22
  506. package/dist/sdk/query/search/semantic.d.ts +24 -170
  507. package/dist/sdk/query/search/types.d.ts +19 -73
  508. package/dist/sdk/query/search-contracts.d.ts +24 -34
  509. package/dist/sdk/query/search-pagination.d.ts +5 -24
  510. package/dist/sdk/query/search-rendering.d.ts +8 -32
  511. package/dist/sdk/query/search.d.ts +3 -63
  512. package/dist/sdk/query/workspace-contracts.d.ts +2 -2
  513. package/dist/sdk/query.d.ts +1 -43
  514. package/dist/sdk/read-output/continuation.d.ts +5 -6
  515. package/dist/sdk/read-output/options.d.ts +3 -8
  516. package/dist/sdk/read-output/session-result.d.ts +2 -33
  517. package/dist/sdk/read-output/tail-retention.d.ts +6 -8
  518. package/dist/sdk/read-output-budget.d.ts +14 -16
  519. package/dist/sdk/read-output-contracts.d.ts +59 -103
  520. package/dist/sdk/read-output-rows.d.ts +5 -9
  521. package/dist/sdk/read-output-session.d.ts +11 -14
  522. package/dist/sdk/relationship-analytics.d.ts +17 -37
  523. package/dist/sdk/relationship-context.d.ts +15 -33
  524. package/dist/sdk/relationship-history.d.ts +29 -50
  525. package/dist/sdk/relationship-kinds/contract.d.ts +11 -12
  526. package/dist/sdk/relationship-migration.d.ts +6 -10
  527. package/dist/sdk/relationships.d.ts +22 -34
  528. package/dist/sdk/reproducibility/process.d.ts +7 -11
  529. package/dist/sdk/runtime/context.d.ts +6 -22
  530. package/dist/sdk/runtime/schema-preview.d.ts +1 -1
  531. package/dist/sdk/runtime-input.d.ts +9 -20
  532. package/dist/sdk/runtime-primitives.d.ts +3 -82
  533. package/dist/sdk/runtime-public-contracts.d.ts +30 -50
  534. package/dist/sdk/runtime.d.ts +77 -302
  535. package/dist/sdk/scheduling-shortcuts.d.ts +8 -12
  536. package/dist/sdk/schema-migration.d.ts +18 -80
  537. package/dist/sdk/schema.d.ts +89 -192
  538. package/dist/sdk/search-refresh-worker.d.ts +1 -1
  539. package/dist/sdk/similarity-scoring.d.ts +6 -8
  540. package/dist/sdk/similarity.d.ts +33 -64
  541. package/dist/sdk/start-task-status.d.ts +2 -2
  542. package/dist/sdk/stats.d.ts +13 -48
  543. package/dist/sdk/structured-mutations.d.ts +18 -26
  544. package/dist/sdk/telemetry-flush.d.ts +1 -1
  545. package/dist/sdk/telemetry.d.ts +14 -20
  546. package/dist/sdk/templates.d.ts +14 -35
  547. package/dist/sdk/test/batch.d.ts +10 -25
  548. package/dist/sdk/test/execution.d.ts +44 -209
  549. package/dist/sdk/test/json-path.d.ts +2 -5
  550. package/dist/sdk/test/linked-command-detection.d.ts +10 -25
  551. package/dist/sdk/test/measurements.d.ts +10 -13
  552. package/dist/sdk/test/parsers.d.ts +16 -20
  553. package/dist/sdk/test/prerequisites.d.ts +2 -3
  554. package/dist/sdk/test/runs.d.ts +19 -52
  555. package/dist/sdk/test/trust.d.ts +8 -12
  556. package/dist/sdk/test/update.d.ts +9 -25
  557. package/dist/sdk/testing.d.ts +97 -206
  558. package/dist/sdk/traceability/source-traceability.d.ts +25 -56
  559. package/dist/sdk/tracker-root-discovery.d.ts +1 -1
  560. package/dist/sdk/workspace-contracts-cache.d.ts +2 -2
  561. package/dist/sdk/workspace-contracts.d.ts +8 -14
  562. package/dist/sdk/workspace-memory.d.ts +24 -42
  563. package/dist/sdk/workspace-recipe.d.ts +10 -14
  564. package/dist/sdk/workspace-snapshot.d.ts +26 -53
  565. package/dist/sdk/workspace-transaction-gc.d.ts +12 -16
  566. package/dist/sdk/workspace-transaction.d.ts +26 -40
  567. package/dist/sdk/workspace.d.ts +8 -10
  568. package/dist/types/index.d.ts +1 -1
  569. package/dist/types.d.ts +210 -353
  570. package/docs/CODEX_PLUGIN.md +2 -1
  571. package/docs/COMMANDS.md +8 -0
  572. package/docs/CONFIGURATION.md +33 -0
  573. package/docs/DIAGNOSTIC_OUTPUT_CONTRACTS.md +28 -9
  574. package/docs/MUTATION_INTEGRITY.md +65 -0
  575. package/docs/README.md +2 -2
  576. package/docs/RELEASING.md +25 -0
  577. package/docs/SDK.md +33 -2
  578. package/docs/TESTING.md +11 -0
  579. package/marketplace.json +1 -1
  580. package/package.json +2 -1
  581. package/packages/pm-beads/package.json +1 -1
  582. package/packages/pm-calendar/package.json +1 -1
  583. package/packages/pm-command-kit/package.json +1 -1
  584. package/packages/pm-digital-twin/package.json +1 -1
  585. package/packages/pm-governance-audit/package.json +1 -1
  586. package/packages/pm-guide-shell/package.json +1 -1
  587. package/packages/pm-kanban/package.json +1 -1
  588. package/packages/pm-lifecycle-hooks/package.json +1 -1
  589. package/packages/pm-linked-test-adapters/package.json +1 -1
  590. package/packages/pm-search-advanced/package.json +1 -1
  591. package/packages/pm-templates/package.json +1 -1
  592. package/packages/pm-todos/package.json +1 -1
  593. package/packages/pm-vcs/package.json +1 -1
  594. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  595. package/plugins/pm-claude/package.json +1 -1
  596. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  597. package/plugins/pm-codex/package.json +1 -1
  598. package/plugins/pm-codex/plugin.json +1 -1
  599. package/runtime-dependencies.json +1 -1
  600. package/scripts/finalize-build.mjs +41 -4
  601. package/dist/cli-bundle/chunks/chunk-ASJZMYKM.js +0 -122
  602. package/dist/cli-bundle/chunks/chunk-BLUCQ4T4.js +0 -2
  603. package/dist/cli-bundle/chunks/chunk-JYQXIC6C.js +0 -3
  604. package/dist/cli-bundle/chunks/chunk-LVDFPGD7.js +0 -3
  605. package/dist/cli-bundle/chunks/chunk-UFIM5ZC5.js +0 -6
  606. package/dist/cli-bundle/chunks/item-transaction-XBIN4KYM.js +0 -2
  607. package/dist/cli-bundle/focused-chunks/chunk-CUGJ2DY2.js +0 -24
  608. package/dist/cli-bundle/focused-chunks/chunk-HLQOGAWG.js +0 -26
  609. package/dist/cli-bundle/focused-chunks/chunk-IB6TCE7N.js +0 -2
  610. package/dist/cli-bundle/focused-chunks/chunk-JU62TKJP.js +0 -82
  611. package/dist/cli-bundle/focused-chunks/chunk-MYBKRV5R.js +0 -2
  612. package/dist/cli-bundle/focused-chunks/chunk-NUFO3OR6.js +0 -44
  613. package/docs/CHATGPT_CODEX_PLUGIN_IMPLEMENTATION.md +0 -776
@@ -1,5 +1,5 @@
1
- import{a as Nf}from"./chunk-UJMQP2HP.js";import{I as pf,a as os,b as hr,c as as,d as xe,e as cs,f as uf,g as ds,h as ls,i as gr,j as mf,k as us,l as ms,m as yr,q as wr,s as ps,t as Z,x as Xa}from"./chunk-VATZTJE3.js";import{Ba as Af,Ga as xf,Ka as rc,i as fp,ka as Za,ua as ec,va as Cf,wa as tc,x as Tf,xa as nc}from"./chunk-Z3QEEOAM.js";import{a as Sr,b as kf,i as xt,k as Tn,l as Cn,m as An}from"./chunk-YK5GAWOT.js";import{A as En,B as ae,D as _s,G as fs,H as gf,Ha as Of,Ia as Lf,Ic as Ff,J as Qa,Ja as Er,K as yf,Ka as ic,Lc as Uf,M as wf,Na as Df,U as vf,_a as Tr,bb as xn,eb as Rn,l as _f,lb as Mf,o as ff,oa as Rf,p as vr,pa as If,pb as $f,qb as Pf,s as hf,y as br,z as kr}from"./chunk-XKY4LUXN.js";import{a as _p}from"./chunk-6V4PGJBZ.js";import{$ as Kp,$a as F_,$b as of,A as Ga,Ab as ef,B as qa,C as kp,D as rs,Da as h_,E as Sp,Ea as g_,F as Ep,Fa as y_,G as Tp,Ga as w_,H as Cp,Ha as v_,I as Ap,Ia as b_,J as xp,Ja as k_,K as Rp,Ka as S_,L as Ip,La as E_,M as Op,Ma as T_,N as Lp,Na as C_,O as Dp,Oa as A_,P as Np,Pa as x_,Q as Mp,Qa as R_,R as $p,Ra as I_,S as Pp,Sa as O_,T as Fp,Ta as L_,Tb as tf,U as Up,Ua as D_,Ub as is,V as jp,Va as za,Vb as nf,W as Gp,Wa as N_,Wb as Ya,X as qp,Xa as M_,Ya as Ba,Yb as rf,Z as Wp,Za as $_,Zb as sf,_ as Wa,_a as P_,aa as zp,ab as U_,ac as af,b as hp,ba as Bp,bb as j_,bc as ss,c as gp,ca as Hp,cb as At,cc as cf,d as yp,da as Vp,db as G_,ea as Yp,eb as q_,fa as Jp,fb as W_,ga as Xp,gb as K_,ha as Qp,ia as Zp,ib as z_,ic as Ja,ja as e_,ka as t_,kb as fr,la as n_,ma as r_,mb as B_,mc as df,n as Ua,na as i_,nb as H_,o as wp,oa as Ka,ob as V_,pa as s_,pb as Y_,pc as lf,qa as o_,r as vp,ra as a_,rb as J_,s as ja,sa as c_,t as Ht,ta as d_,ua as l_,v as bp,va as u_,vb as Ha,wa as m_,wb as X_,xa as p_,xb as Q_,ya as __,yb as Va,za as f_,zb as Z_}from"./chunk-ELNWRSGZ.js";import{d as dp,j as lp,r as up,s as Bt,t as mp,w as pp}from"./chunk-BLUCQ4T4.js";import{A as ge,Aa as pr,B as Ci,Bd as ns,C as Ea,Cb as Km,Cd as cp,D as ir,Db as Zi,E as sr,Eb as zm,F as Oi,G as lt,Gb as V,Gc as tp,H as Du,Hb as le,I as Li,Jb as es,Ka as Qi,Kb as Ee,Kc as np,Lb as pt,Mb as Bm,Na as kn,Nb as Kt,Oa as Om,Pa as Lm,Pb as Sn,Q as $i,Qa as $m,Qb as ue,S as St,Sb as La,T as Ui,Tb as Hm,U as ji,X as Yu,Xa as Pm,bc as Vm,c as Xe,db as Fm,dd as Na,e as Qe,ed as Ma,f as uu,fa as Bi,fb as Um,fd as $a,g as ha,gc as Ym,gd as Pa,h as mu,i as ki,ic as Jm,id as rp,j as Si,ja as tt,k as pu,ka as xm,kb as jm,l as Ei,lc as Da,m as _u,ma as Hi,md as Fa,n as Q,na as Rm,nc as Xm,o as mn,oa as Vi,p as tr,pa as Yi,pb as Gm,pc as Qm,pd as ip,q as ve,qa as Ji,rc as Tt,sc as Zm,tc as Ct,u as Ze,ua as Xi,uc as _r,ud as sp,vc as zt,vd as op,w as Ut,wd as ts,xa as Im,xc as ep,xd as ap,y as Ti,yb as qm,z as pn,zb as Wm}from"./chunk-ASJZMYKM.js";import{$a as Ru,$d as Et,$e as fm,A as nu,Aa as va,Ad as ut,Ae as am,Ai as mr,B as ru,Ba as nr,Bc as cr,Bd as zu,C as iu,Ca as Ce,Cd as Fe,D as su,Dd as Bu,Di as vn,E as ou,Ed as Hu,Ei as bn,F as au,Fa as $,Fc as Gu,Fd as Vu,Fi as Oa,G as Je,Ga as ct,Gb as I,Ge as cm,H as cu,Ha as Ri,Hb as Nu,Ia as fn,Ib as Ta,Ja as rr,Jb as Mu,Jf as gm,Ka as jt,Kb as Ni,Ki as Dm,Lg as vm,Mb as de,Mg as bm,N as du,Na as R,Nb as $u,O as lu,Oa as et,Ob as or,Oe as dm,P as fa,Pa as We,Pb as Ca,Pd as Ju,Pe as lm,Qa as Ae,Qb as Mi,Qe as um,Qg as km,Ra as Su,Re as mm,Sa as Eu,Sb as Pu,Se as pm,Ta as dt,Te as wn,Th as Em,Ti as Nm,Ua as Ii,Ub as Fu,Ud as Gi,Ue as _m,Ui as x,Va as Tu,Vi as Mm,Wa as Cu,Wb as ar,Xa as ba,Xd as K,Ya as ka,Yb as Uu,Yc as Pi,Yd as Ke,Za as Au,Zd as Gt,_a as xu,_c as Fi,a as ne,ab as Iu,ae as Xu,b as $e,bb as Ou,be as Aa,c as eu,cb as Lu,cc as ju,ce as Qu,cf as lr,d as tu,db as Sa,de as xa,df as ur,dg as ym,ea as ga,ee as Zu,ej as U,gb as P,ge as em,ha as ya,hd as qu,he as tm,hg as wm,ia as Pe,ib as hn,ie as qi,ja as Ai,je as dr,ji as Tm,ka as xi,ki as Cm,la as hu,le as Wi,ma as gu,mb as gn,mg as Ia,mi as Am,na as yu,nf as hm,oa as wu,oe as Ki,pa as vu,pd as N,pe as oe,qa as bu,qe as qt,ra as ku,rb as ie,re as _e,rf as Ra,s as Ye,sa as wa,se as yn,sf as j,te as nm,u as W,ub as Di,ue as rm,uf as mt,v as bi,ve as im,w as Ft,wd as Wu,we as sm,xd as Ku,xh as Sm,ye as zi,ze as om,zi as Wt}from"./chunk-GCPP37N6.js";import{a as Ef}from"./chunk-SPPHDVZE.js";import{c as bf}from"./chunk-RSAN2YUU.js";import{b as Sf}from"./chunk-VS565KBX.js";import{A as m,C as p,D as kt,E as re,F as _n,G,H as X,K as Le,M as fu,a as Vl,m as Yl,p as Jl,s as Xl,u as Ql,w as Zl,x as vi,y as Pt}from"./chunk-O4ZLEN4T.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]="c2e89d3c-9abc-5ca7-a290-69a54dd694ab")}catch{}})();var K0=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."}),z0=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),B0=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),H0=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),V0=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),Y0=["--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"],J0=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"]),X0=new Set(["--only-index"]),Q0=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Z0=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),eS=new Set(["--regression"]);function tS(e,t){return t==="--stdin"||t==="--stdin-json"?["stdin"]:H0.has(`${e}:${t}`)?["argv","file","stdin"]:t.endsWith("-file")?["argv","file"]:z0.has(t)&&B0.has(e)?["argv","stdin"]:["argv"]}function nS(e,t){let n=Q0.has(`${e}:${t.flag}`)||t.value_name!==void 0||t.value_type==="string"||t.value_type==="number"||t.list===!0||t.repeatable===!0,r=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-"))||Y0.some(i=>t.flag.startsWith(i));return n||X0.has(t.flag)||!J0.has(t.flag)&&!r}function rS(e,t){return t.value_arity!==void 0?t.value_arity:nS(e,t)?eS.has(t.flag)||Z0.has(`${e}:${t.flag}`)?"optional":"required":"none"}function iS(e,t){let n=bi(e),r=rS(n,t),i=r!=="none",s=tS(n,t.flag),o=t.description??K0[t.flag]??`${i?"Set":"Enable"} ${t.flag.slice(2).replaceAll("-"," ")}.`;return{...t,description:o,takes_value:i,value_required:r==="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:s,...s.includes("stdin")&&t.flag!=="--stdin"&&t.flag!=="--stdin-json"?{stdin_token:"-"}:{},...V0.has(`${n}:${t.flag}`)?{file_token_prefix:"@"}:{}}}function jf(e,t){return t.map(n=>iS(e,n))}function _U(e,t,n){let r=e.trim().toLowerCase(),i=[],s=new Map,o=0;for(let c of n)if(c.command.trim().toLowerCase()===r){if(o+=1,s.has(c.flag)){i.push({code:"duplicate_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} was observed more than once.`});continue}s.set(c.flag,c)}let a=new Set(t.map(({flag:c})=>c));for(let c of t){let d=s.get(c.flag);if(!d){i.push({code:"missing_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} has no executable option observation.`});continue}for(let[l,u]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[l]!==d[l]&&i.push({code:u,command:r,flag:c.flag,detail:`${r} ${c.flag} declares ${l}=${String(c[l])} but the executable option reports ${String(d[l])}.`})}for(let c of s.values())a.has(c.flag)||i.push({code:"undeclared_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,d)=>c.flag.localeCompare(d.flag)||c.code.localeCompare(d.code)),{ok:i.length===0,declared_count:t.length,observed_count:o,findings:i}}import{readFile as sS}from"node:fs/promises";(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]="9c3ae5d4-5437-543d-90a3-67e92b073c18")}catch{}})();function LU(e){let t={...e,...e.full===!0?{fullHistory:!0}:{}};return delete t.full,Ze(e,t)}function Bf(e){return Object.prototype.toString.call(e)==="[object Object]"}function oS(e,t,n,r){let i=I();if(!Bf(e))return{...r({created_at:i,author:n,text:t}),text:t,edited_at:i};let s=o=>typeof o=="string"&&o!=="";return{...e,...s(e.created_at)?{}:{created_at:i},...s(e.author)?{}:{author:n},text:t,edited_at:i}}function Gf(e,t){if(typeof e=="object"&&e!==null&&"format"in e&&e.format==="json")throw new p(`Structured context events are append-only and cannot be ${t}.`,m.USAGE,{code:"structured_event_immutable"})}function aS(e,t){return t===void 0?e:t===0?[]:e.slice(Math.max(0,e.length-t))}function Vt(e,t){let n=e[t];return Array.isArray(n)?n:[]}function DU(e,t={}){let n=e.trim();if(!n)return"";let r=/^(?:[-*+]\s*)?text\s*[:=]/i.exec(n);if(t.stripPlainTextPrefix===!0&&r&&!n.startsWith("```"))return n.slice(r[0].length).trim()||n;if(!(/^(?:[-*+]\s*)?text\s*[:=]/im.test(n)||n.startsWith("```")))return n;try{let i=Q(n,"--add");return Object.keys(i).map(s=>s.trim().toLowerCase()).some(s=>s!=="text")?n:i.text?.trim()||n}catch{return n}}function cS(e){return typeof e=="object"&&e!==null&&"code"in e}function qf(e,t){if(!Ut(e))throw new p(`${t} cannot read process stdin through the MCP JSON-RPC transport. Pass annotation text in options.add instead.`,m.USAGE,{code:"mcp_stdin_unavailable",required:"Pass annotation text as JSON data; the MCP protocol already owns process stdin."})}async function dS(e,t){if(+(e.add!==void 0)+ +(e.stdin===!0)+ +(typeof e.file=="string")>1)throw new p(`Specify ${t} text using only one input source: --add, --stdin, or --file`,m.USAGE);let n=pn(),r=Ut(e);if(e.add!==void 0)return{value:await n.resolveValue(e.add,"--add",r)??"",rawValue:e.add,emptyFlag:"--add"};if(e.stdin===!0)return qf(e,"--stdin"),{value:await n.resolveValue("-","--stdin")??"",emptyFlag:"--stdin"};if(typeof e.file!="string")return;let i=e.file.trim();if(!i)throw new p("--file path cannot be empty",m.USAGE);if(i==="-")return qf(e,"--file -"),{value:await n.resolveValue("-","--file")??"",emptyFlag:"--file"};try{return{value:await sS(i,"utf8"),emptyFlag:"--file"}}catch(s){if(cS(s)&&_n(s))throw new p(`--file path not found: ${i}. Use --file - to read stdin.`,m.USAGE);let o=s instanceof Error?s.message:String(s);throw new p(`Failed to read --file path "${i}": ${o}. Use --file - to read stdin.`,m.USAGE)}}async function NU(e,t){if(e.edit!==void 0&&e.delete!==void 0)throw new p("Specify only one of --edit or --delete",m.USAGE);if(e.delete!==void 0){if(e.add!==void 0||e.stdin===!0||typeof e.file=="string")throw new p("--delete cannot be combined with replacement text",m.USAGE);if(!Number.isInteger(e.delete)||e.delete<1)throw new p("--delete must be a positive integer",m.USAGE);return{mode:"delete",index:e.delete}}if(e.edit!==void 0&&(!Number.isInteger(e.edit)||e.edit<1))throw new p("--edit must be a positive integer",m.USAGE);let n=await dS(e,t);if(e.edit!==void 0){if(!n)throw new p("--edit requires replacement text from --add, --stdin, or --file",m.USAGE);return{mode:"edit",index:e.edit,...n}}return n?{mode:"add",...n}:{mode:"list"}}function Cr(e,t){throw e instanceof p&&e.exitCode===m.CONFLICT&&e.message.includes("is assigned to")&&e.message.includes("Use --force to override")?new p(e.message,e.exitCode,{code:"ownership_conflict",required:t.required,examples:t.examples,nextSteps:t.nextSteps}):e}function Hf(e){return e==="comments"?"--stdin":"--add -"}var MU="annotation_flag_like_value";function lS(e){return/^-{1,2}[A-Za-z][\w-]*(?:=.*)?$/.test(e.trim())}function uS(e){return e==="--file"?"--file <path>":e.startsWith("--file=")?e:e==="--stdin"?"--stdin":void 0}function mS(e){let t=e.value.trim(),n=e.collectionKey.replace(/s$/,""),r=uS(t),i=Hf(e.collectionKey),s=e.retryArgs===void 0?{}:{field:e.textFlag,recovery:{suggested_flags:[t],suggested_retry:P(e.retryArgs),suggested_retry_args:[...e.retryArgs]}};if(r!==void 0){let o=r.split(/[ =]/,1)[0],a=o==="--file"?"that file":"stdin",c=e.conflictingOperand===void 0?"":` "${e.conflictingOperand}" was read as positional text, which ${o} cannot be combined with: drop it, or pass it as the text without ${o}.`;return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text: ${e.textFlag} took ${o} as its value. Drop ${e.textFlag} and pass ${r} on its own.${c}`,m.USAGE,{code:"annotation_flag_like_value",required:`Drop ${e.textFlag}: ${r} reads the ${n} text from ${a} by itself. Use ${e.textFlag} text=${t} only when the text really is "${t}".`,examples:[`${e.commandPrefix} ${r}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text. Use ${i} to read stdin, or use text=${t} for literal dash-leading text.`,m.USAGE,{code:"annotation_flag_like_value",required:`Use ${i} for stdin input, pass plain text, or use text=${t} when the text really starts with "-".`,examples:[`${e.commandPrefix} ${i}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}function pS(e,t){if(!((t.input.emptyFlag??"--add")!=="--add"||!lS(e)))throw mS({collectionKey:t.collectionKey,textFlag:"--add",value:e,commandPrefix:t.input.mode==="edit"?`pm ${t.collectionKey} <id> --edit <index>`:`pm ${t.collectionKey} <id>`})}function _S(e,t){if(t.ifAbsent===!0&&!["add","stdin","file"].includes(e.input.mode))throw new p(`--if-absent requires a ${e.collectionKey.replace(/s$/,"")} append`,m.USAGE,{code:"annotation_if_absent_without_append",required:"Combine --if-absent with one append text source; omit it for list, edit, and delete operations."});if(fS(e,t),e.input.mode!=="list"||t.message===void 0)return;let n=e.collectionKey.replace(/s$/,"");throw new p(`--message labels a ${n} mutation but does not provide ${n} text. Pass text positionally or with --add, --stdin, or --file.`,m.USAGE,{code:"annotation_message_without_text",required:`Provide ${n} text through a content source; --message only annotates the history entry of a mutation.`,examples:[`pm ${e.collectionKey} <id> --add "text" --message "why"`,`pm ${e.collectionKey} <id> ${Hf(e.collectionKey)}`]})}function fS(e,t){if(t.expectAt!==void 0){if(e.input.mode!=="edit"&&e.input.mode!=="delete")throw new p(`--expect-at guards an --edit or --delete of one ${e.collectionKey.replace(/s$/,"")}`,m.USAGE,{code:"annotation_expectation_without_target",required:"Combine --expect-at with --edit <index> or --delete <index>; omit it for list and append operations.",examples:[`pm ${e.collectionKey} <id> --edit <index> --expect-at <created_at> --add "<text>"`,`pm ${e.collectionKey} <id> --delete <index> --expect-at <created_at>`]});if(typeof t.expectAt!="string"||t.expectAt.trim().length===0)throw new p("--expect-at must be the non-empty created_at timestamp of the entry you read",m.USAGE,{code:"annotation_expectation_invalid",required:"Pass the created_at value of the row you read at that index, as a string."})}}function Wf(e,t,n,r,i){if(i===void 0)return;let s=t[n]?.created_at,o=typeof s=="string"?s:null;if(o===i)return;let a=t.flatMap((_,h)=>_?.created_at===i?[h+1]:[]),c=r.collectionKey.replace(/s$/,""),d=r.input.mode==="delete"?"--delete":"--edit",l=n+1,u=a.length===1?` The ${c} created at ${i} is at index ${a[0]}.`:a.length>1?` ${a.length} ${r.collectionKey} were created at ${i}: indexes ${a.join(", ")}.`:` No ${c} on ${e} was created at ${i}.`;throw new p(`${c.charAt(0).toUpperCase()}${c.slice(1)} ${l} on ${e} was created at ${o||"an unrecorded time (malformed entry)"}, not ${i}; refusing ${d} of an entry the caller did not read. Nothing was written.${u}`,m.CONFLICT,{code:"annotation_entry_mismatch",item_id:e,details:{collection:r.collectionKey,entry_index:l,expected_created_at:i,actual_created_at:o,matching_indexes:a},required:`Address the ${c} by the index its listing row reports and keep --expect-at set to that row's created_at. When several indexes share the timestamp, inspect those rows before retrying, because the guard compares timestamps, not entry identities.`,why:"A listing page's position or count is not an entry address; only the row's index is, and the expectation checks that the entry at that index still carries the created_at that was read.",examples:[`pm ${r.collectionKey} ${e} --limit 5`,`pm ${r.collectionKey} ${e} ${d} ${a.length===1?a[0]:"<index>"} --expect-at ${i}${d==="--edit"?' --add "<text>"':""}`]})}function hS(e,t,n,r,i,s){let o=Vt(e.metadata,t),a=i?o.findIndex(c=>Bf(c)&&c.author===n&&c.text===r):-1;return a>=0?{changedFields:[],written:o,position:a}:(o.push(s({created_at:I(),author:n,text:r})),e.metadata[t]=o,{changedFields:[t],written:o,position:o.length-1})}function Kf(e,t,n){return nm.has(e)?t.map((r,i)=>i).sort((r,i)=>rm(t[r],t[i])||r-i).indexOf(n)+1:n+1}async function $U(e,t,n,r){_S(r,t);let i=R(process.cwd(),n.path);await U(i);let s=await x(i),o=$(s,N()),a=pr(t.limit);if(r.input.mode==="list"){let f=await V(i,e,s.id_prefix,s.item_format,o.type_to_folder);if(!f)throw new p(`Item ${e} not found`,m.NOT_FOUND);let g=await le(f,{schema:s.schema}),y=Vt(g.document.metadata,r.collectionKey);return hs(f.id,r.collectionKey,y,a,t.includeMeta===!0)}let c=j(t.author,s.author_default);if(r.input.mode==="delete"){let f=r.deleteOp??r.op,g;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(w){let v=Vt(w.metadata,r.collectionKey),b=zf(r.input.index,v.length,r.collectionKey);return Wf(e,v,b,r,t.expectAt),Gf(v[b],"deleted"),v.splice(b,1),w.metadata[r.collectionKey]=v,{changedFields:[r.collectionKey]}}})}catch(w){Cr(w,r.conflictGuidance)}let y=Vt(g.item,r.collectionKey);return hs(g.item.id,r.collectionKey,y,a,t.includeMeta===!0,{action:"delete",entryIndex:r.input.index},t.fullHistory===!0)}let d=r.input.rawValue??r.input.value??"";pS(d,r);let l=r.parseText(r.input.value??"");if(!l.trim())throw new p(`${r.input.emptyFlag??"--add"} text cannot be empty`,m.USAGE);if(r.input.mode==="edit"){let f=r.editOp??r.op,g,y=0;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(b){let T=Vt(b.metadata,r.collectionKey),S=zf(r.input.index,T.length,r.collectionKey);Wf(e,T,S,r,t.expectAt);let A=T[S];return Gf(A,"edited"),T[S]=oS(A,l,c,r.createEntry),y=Kf(r.collectionKey,T,S),b.metadata[r.collectionKey]=T,{changedFields:[r.collectionKey]}}})}catch(b){Cr(b,r.conflictGuidance)}let w=Vt(g.item,r.collectionKey),v=y;return hs(g.item.id,r.collectionKey,w,a,t.includeMeta===!0,{action:"edit",entryIndex:v,entry:w[v-1]},t.fullHistory===!0)}let u,_=0;try{u=await ue({pmRoot:i,settings:s,id:e,op:r.op,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,skipNoop:t.ifAbsent===!0,mutate(f){let g=hS(f,r.collectionKey,c,l,t.ifAbsent===!0,r.createEntry);return _=Kf(r.collectionKey,g.written,g.position),{changedFields:g.changedFields}}})}catch(f){Cr(f,r.conflictGuidance)}let h=Vt(u.item,r.collectionKey);return hs(u.item.id,r.collectionKey,h,a,t.includeMeta===!0,{action:"add",entryIndex:_,entry:h[_-1],changedCount:t.ifAbsent===!0?Math.min(u.changedFields.length,1):void 0},t.fullHistory===!0)}function zf(e,t,n){if(e===void 0||!Number.isInteger(e)||e<1||e>t){let r=n.replace(/s$/,""),i=`${r.charAt(0).toUpperCase()}${r.slice(1)}`,s=t===1?`1 ${r}`:`${t} ${n}`;throw new p(`${i} index ${e??"(missing)"} out of range (item has ${s})`,m.USAGE)}return e-1}function gS(e,t,n){return t===void 0?{}:{mutation_receipt:{action:t.action,entry_index:t.entryIndex,changed_count:t.changedCount??1,full_history_included:!n},omission_receipt:{has_omissions:n,omitted_field_group_count:n?1:0,omitted_field_groups:n?[{name:`${e}_history`,restore_with:{selector:"full_history",cli_flag:"--full-history",sdk_option:"fullHistory",mcp_option:"full"}}]:[]}}}function Vf(e,t){if(Object.prototype.toString.call(e)!=="[object Object]")return e;let n={index:t,...e};return n.index=t,n}function yS(e,t){let n=e.length-t.length;return t.map((r,i)=>Vf(r,n+i+1))}function hs(e,t,n,r,i,s,o=!1){let a=s===void 0||o?yS(n,aS(n,s!==void 0&&o?void 0:r)):s.entry===void 0?[]:[Vf(s.entry,s.entryIndex)],c=s!==void 0&&a.length<n.length;return{id:e,[t]:a,count:a.length,...s?.changedCount===void 0?{}:{changed:s.changedCount===1},...[i,s!==void 0].includes(!0)?{total_count:n.length,returned_count:a.length,has_more:c||a.length<n.length,...r!==void 0?{limit:r}:{}}:{},...gS(t,s,c)}}import{isDeepStrictEqual as Jf}from"node:util";(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]="90fdc6f3-29d4-5266-a142-d9d14fbb12e7")}catch{}})();var wS=new Set(["__proto__","prototype","constructor"]),ys=Symbol("looseOptionOccurrences");function In(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function vS(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n),e[t]=r;return}e[t]=[r,n]}function oc(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(1,o).trim(),value:n.slice(o+1),attached:!0};let a=n.slice(1).trim(),c=e[t+1];return typeof c=="string"&&!c.startsWith("-")?{consumed:2,key:a,value:c}:{consumed:1,key:a,value:!0}}let r=n.indexOf("=");if(r>=0)return{consumed:1,key:n.slice(2,r).trim(),value:n.slice(r+1),attached:!0};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let i=n.slice(2).trim(),s=e[t+1];return typeof s=="string"&&!s.startsWith("-")?{consumed:2,key:i,value:s}:{consumed:1,key:i,value:!0}}function gs(e){return wS.has(e)}function ws(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return $u(t)}function Ar(e){let t=[],n=gn(e.long)??"",r=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let i=In(n.slice(2));i.length>0&&!gs(i)&&t.push(i)}if(r.startsWith("-")&&!r.startsWith("--")){let i=In(r.slice(1));i.length>0&&!gs(i)&&t.push(i)}return[...new Set(t)]}function GU(e){let t=new Set;for(let n of e)for(let r of Ar(n))t.add(r);return t}function On(e){let t=gn(e.long)??"";if(t.startsWith("--")){let n=In(t.slice(2));if(n.length>0&&!gs(n))return n}return Ar(e)[0]??null}function xr(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function bS(e,t){return[...(t.definitions??e).map(n=>xr(n)).filter(n=>n!==null),...t.inheritedFlags??[]]}function qU(e,t,n,r={}){if(t.length===0)return;let i=new Set,s=new Map,o=[],a=bS(t,r);for(let c of t){let d=Ar(c),l=xr(c);for(let u of d)i.add(u),c.enabled===!1&&s.set(u,l);c.required===!0&&c.enabled!==!1&&d.length>0&&o.push({keys:d,label:l})}for(let c of Object.keys(e)){if(!i.has(c)){let l=a.length>0?` Expected one of: ${[...new Set(a)].join(", ")}.`:"";throw new p(`Unknown option '--${c}' for extension command '${n}'.${l}`,m.USAGE,{code:"unknown_option",flag:`--${c}`,required:`Use a flag the command accepts; run pm contracts --command ${n} --flags-only --json to list them.`})}let d=s.get(c);if(d)throw new p(`Option '${d}' is disabled for extension command '${n}'.`,m.USAGE)}for(let c of o)if(!c.keys.some(d=>Object.hasOwn(e,d)))throw new p(`Missing required option '${c.label}' for extension command '${n}'.`,m.USAGE)}function kS(e){return typeof e=="string"||e==null?e:String(e)}function SS(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function Xf(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var ES={string:kS,number:SS,boolean:Xf};function Yt(e,t){return Array.isArray(e)?e.map(n=>Yt(n,t)):ES[t](e)}function Qf(e,t,n){let r=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(i=>i!=null&&i!==""):Ca(e);return t?r.map(i=>Yt(i,t)):r}function TS(e,t,n,r){return n?Qf(e,t,r):t?Yt(e,t):e}function CS(e,t,n){let r=e[ys];if(!r||r.length===0)return n;let i=new Set(t);return r.filter(s=>i.has(s.key)).map(s=>s.value)}function Zf(e){return or(e).value_arity==="none"}function ac(e,t,n,r,i){let s=xr(e),o=i?` for extension command '${i}'`:"",a=n===!0?"no value":JSON.stringify(n);throw new p(`Option '${s}'${o} expects ${r}; received ${a}.`,m.USAGE,{code:"extension_flag_value_invalid",required:`Pass ${s} ${t==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${t} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${t} value for ${s}.`,`Run pm ${i??"<command>"} --help to review the declared flag contract.`]})}function cc(e,t){return e.value_validation==="strict"&&t!=="string"}function AS(e,t){let n=e[ys];if(!n)return[];let r=new Set(t);return n.filter(i=>r.has(i.key))}function xS(e,t,n,r){if(Zf(e))for(let i of AS(n,t)){if(i.attached!==!0)continue;let s=e.list===!0&&e.repeatable!==!0?Ca(i.value):[i.value];for(let o of s){let a=Mi(Yt(o,"boolean"),"boolean");a!==null&&ac(e,"boolean",o,a.expected,r)}}}function RS(e,t,n,r,i){let s=Array.isArray(n)?n.flat(1/0):[n],o=r?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(let a of o)if(typeof a=="string"&&a.trim().length===0){let c=Mi(a,t);ac(e,t,a,c.expected,i)}}function dc(e,t,n,r){if(!cc(e,n))return t;let i=n==="boolean"&&Zf(e),s=o=>{let a=Mi(o,n);return a===null?o:i&&typeof o=="string"?!0:ac(e,n,o,a.expected,r)};return Array.isArray(t)?t.map(s):s(t)}function IS(e,t,n,r){for(let i of n)if(!(i===t||!Object.hasOwn(e,i))){if(Object.hasOwn(e,t)){if(r){let s=e[t],o=e[i];e[t]=[...Array.isArray(s)?s:[s],...Array.isArray(o)?o:[o]].filter(a=>a!=null)}delete e[i];continue}e[t]=e[i],delete e[i]}}function OS(e,t,n=e,r){if(t.length===0)return e;let i=Object.create(null);for(let[o,a]of Object.entries(e))i[o]=a;let s=new Set(t.map(o=>On(o)).filter(o=>o!==null));for(let o of t){let a=On(o);if(a){let c=Ar(o).filter(d=>d===a||!s.has(d));LS(i,o,a,c,n,r)}}return i}function LS(e,t,n,r,i,s){let o=t.list===!0,a=ws(t);a&&!o&&DS(e,t,n,r,a,s),IS(e,n,r,o);let c=t.repeatable===!0;if(!Object.hasOwn(e,n)){t.default!==void 0&&(e[n]=TS(t.default,a,o,c));return}if(a==="boolean"&&cc(t,a)&&xS(t,r,i,s),o){e[n]=NS(t,r,i,e[n],a,c,s);return}a&&(e[n]=dc(t,Yt(e[n],a),a,s))}function DS(e,t,n,r,i,s){for(let o of r)o!==n&&Object.hasOwn(e,o)&&dc(t,Yt(e[o],i),i,s)}function NS(e,t,n,r,i,s,o){let a=CS(n,t,r);i&&cc(e,i)&&RS(e,i,a,s,o);let c=Qf(a,i,s);return i?dc(e,c,i,o):c}function WU(e){let t=Object.create(null),n=[];Object.defineProperty(t,ys,{value:n});let r=0;for(;r<e.length;){let i=oc(e,r);if(!i){r+=1;continue}let s=In(i.key);if(s.length===0||gs(s)){r+=i.consumed;continue}vS(t,s,i.value),n.push({...i,key:s}),r+=i.consumed}return t}function KU(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let r=oc(e,n);if(r){n+=Math.max(1,r.consumed);continue}t.push(e[n]),n+=1}return t}function zU(e,t){if(t.length===0)return[...e];let n=new Set,r=new Set;for(let o of t){let a=ws(o);for(let c of Ar(o))n.add(c),a==="boolean"&&r.add(c)}if(n.size===0)return[...e];let i=[],s=0;for(;s<e.length;){if(e[s]==="--"){i.push(...e.slice(s+1));break}let o=oc(e,s);if(o){let a=In(o.key);if(n.has(a)){let c=e[s],d=r.has(a)&&!c.includes("=")?1:o.consumed;s+=d;continue}}i.push(e[s]),s+=1}return i}function lc(e){return On(e)}function Yf(e){return e.trim().toLowerCase().split(/\s+/u).filter(t=>t.length>0).join(" ")}function BU(e,t){let n=Yf(t);if(n.length===0)return[];let r=W(n);return e.flags.filter(i=>W(Yf(i.target_command))===r).flatMap(i=>[...i.flags])}function eh(e,t,n,r){let i=xr(e),[s,o]=n;throw new p(`Options '${s}' and '${o}' both set ${i} for extension command '${r}' with different values.`,m.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${i} once, under the handler key '${t}'.`,why:`'${s}' and '${o}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${o}' and pass one value as '${t}'.`,`Run pm contracts --command ${r} --flags-only --json to read each flag's sdk_option key.`]})}function HU(e,t,n){if(t.length===0)return e;let r=PS(t),i=US(e,r,n),s=new Set([...r.long.values()].map(({handlerKey:c})=>c)),o=Object.create(null),a=Object.create(null);for(let[c,d]of Object.entries(i))(s.has(c)?o:a)[c]=d;return $S(o,t,n),Object.assign(a,OS(o,t,MS(o,r),n))}function MS(e,t){let n=new Set([...t.long.values()].map(({handlerKey:s})=>s)),r=Object.entries(e).filter(([s])=>n.has(s)).flatMap(([s,o])=>(Array.isArray(o)?o.flat(1/0):[o]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),i=Object.create(null);return Object.defineProperty(i,ys,{value:r}),i}function $S(e,t,n){for(let r of t){let i=On(r);if(i===null)continue;let s=xr(r),o=Object.hasOwn(e,i);if(r.enabled===!1&&o)throw new p(`Option '${s}' is disabled for extension command '${n}'.`,m.USAGE);if(r.required===!0&&r.enabled!==!1&&!o)throw new p(`Missing required option '${s}' for extension command '${n}'.`,m.USAGE)}}function PS(e){let t={long:new Map,short:new Map},n=(r,i,s)=>{i.length>0&&!r.has(i)&&r.set(i,s)};for(let r of e){let i=On(r);if(i===null)continue;let s={handlerKey:i,definition:r};n(t.long,i,s);let o=typeof r.short=="string"?r.short.trim():"";o.startsWith("-")&&!o.startsWith("--")&&n(t.short,o.slice(1),s)}return t}function sc(e,t){return e.long.get(t)??e.short.get(t.replace(/^-(?!-)/u,""))??e.long.get(In(t.replace(/^-{1,2}/u,"")))}function FS(e,t,n){let r=/^(?:--)?no-(.+)$/u.exec(t)?.[1];if(r===void 0||sc(e,t)!==void 0)return{spelling:t,value:n};let i=sc(e,r),s=Xf(n);return i!==void 0&&ws(i.definition)==="boolean"&&typeof s=="boolean"?{spelling:r,value:!s}:{spelling:t,value:n}}function US(e,t,n){let r=Object.create(null),i=new Map;for(let[s,o]of Object.entries(e)){let{spelling:a,value:c}=FS(t,s,o),d=sc(t,a);if(d===void 0)r[a]=c;else if(c!==void 0){let l=i.get(d.handlerKey);l===void 0?(i.set(d.handlerKey,a),r[d.handlerKey]=c):Jf(r[d.handlerKey],c)||eh(d.definition,d.handlerKey,[l,a],n)}}return r}function jS(e){let t=new Map;for(let n of e){let r=On(n);if(r===null)continue;let i={definition:n,handlerKey:r,kind:ws(n),arity:or(n).value_arity,scalar:n.list!==!0},s=[gn(n.long),typeof n.short=="string"?n.short.trim():""];for(let o of s.filter(a=>a?.startsWith("-")===!0))t.has(o)||t.set(o,i)}return t}function GS(e,t,n){let r=e.optionOf(n),i=t.get(n),s=i?.scalar===!0?i:void 0;if(r!==void 0){let o={arity:r.arity,...r.variadic===!0?{variadic:!0}:{}};if(s?.handlerKey===r.key)return{...o,declared:s};let a=i===void 0&&n.startsWith("--no-")?t.get(`--${n.slice(5)}`):void 0;return a?.scalar===!0&&a.kind==="boolean"&&a.handlerKey===r.key?{...o,declared:a,negates:!0}:o}if(!(!e.includesLooseFlags||i===void 0))return s===void 0?{arity:i.arity,loose:!0}:{arity:i.arity,declared:s,loose:!0}}function uc(e){return e.length>1&&e.startsWith("-")}var th=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function qS(e,t,n){let{tokens:r}=e,i=0,s,o=!1,a=!1;for(;i<r.length||s!==void 0;){let c=s??r[i++];if(c==="--")return;if(a&&s===void 0&&WS(e,c))continue;let d=uc(c)?zS(e,c,r[i],t,n):{consumedByCommander:!1,consumed:0};if(i+=d.consumed,s=d.group,a=d.variadic===!0,!d.consumedByCommander){if(KS(e.stop,c,o))return;o=!0}}}function WS(e,t){return!uc(t)||e.negativeNumbersAreValues&&th.test(t)}function KS(e,t,n){return e!==void 0&&(e.atFirstUnrecognized||!n&&e.atSubcommand(t))}function zS(e,t,n,r,i){let s=BS(t,n,r);if(s!==void 0)return i(s.spelling,s.entry,s.value),{consumedByCommander:!1,consumed:s.consumed};let o=r(t);if(o!==void 0){let a=o.arity==="required"||o.arity==="optional"&&n!==void 0&&(!uc(n)||e.negativeNumbersAreValues&&th.test(n));return i(t,o,o.negates===!0?!1:a?n:!0),{consumedByCommander:!0,consumed:a?1:0,variadic:o.variadic===!0}}return t[1]!=="-"?{consumed:0,...HS(t,r,i)}:{consumedByCommander:VS(t,r,i,e.includesLooseFlags?i:()=>{}),consumed:0}}function BS(e,t,n){let r=e.indexOf("="),i=r>1?e.slice(0,r):e,s=n(i);if(s?.loose===!0)return r>1?{spelling:i,entry:s,value:e.slice(r+1),consumed:0}:t!==void 0&&!t.startsWith("-")?{spelling:i,entry:s,value:t,consumed:1}:{spelling:i,entry:s,value:!0,consumed:0};let o=r<0&&e.startsWith("--no-")?n(`--${e.slice(5)}`):void 0;return o?.loose===!0&&o.declared?.kind==="boolean"?{spelling:e,entry:o,value:!1,consumed:0}:void 0}function HS(e,t,n){let r=e.slice(0,2),i=e.length>2?t(r):void 0;return i===void 0||i.loose===!0?{consumedByCommander:!1}:i.arity!=="none"?(n(r,i,e.slice(2)),{consumedByCommander:!0}):(n(r,i,!0),{consumedByCommander:!0,group:`-${e.slice(2)}`})}function VS(e,t,n,r){let i=e.indexOf("=");if(i>2){let o=e.slice(0,i),a=t(o);return a!==void 0&&a.arity!=="none"?(n(o,a,e.slice(i+1)),!0):(a?.declared?.kind==="boolean"&&r(o,a,e.slice(i+1)),!1)}let s=e.startsWith("--no-")?t(`--${e.slice(5)}`):void 0;return s?.declared?.kind==="boolean"&&r(e,s,!1),!1}function VU(e,t,n){let r=jS(t),i=new Map;for(let s of e)qS(s,o=>GS(s,r,o),(o,a,c)=>{a.declared!==void 0&&YS(i,a.declared,o,c,n)})}function YS(e,t,n,r,i){let{definition:s,handlerKey:o,kind:a}=t,c=a?Yt(r,a):r,d=e.get(o)??new Map,l=[...d].find(([u,_])=>u!==n&&!Jf(_,c));l!==void 0&&eh(s,o,[l[0],n],i),d.set(n,c),e.set(o,d)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c0bb7ab-6157-5861-ad7e-a63ae62220f4")}catch{}})();var JS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),XS=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"]),QS=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"])}),ZS=new Set(["extension","install","package","packages","upgrade"]);function eE(e){let t=W(e.trim().toLowerCase());if(t==="ops")return"quality";for(let[n,r]of Object.entries(QS))if(r.has(t))return n;return ZS.has(t)?"extensions":"internal"}var Ln=Object.freeze([...Je.flatMap(e=>e==="item"?["item","item-reopen"]:[e,...Ye.filter(t=>t.alias===e).map(t=>t.canonical)]).map(e=>({command:e,tier:JS.has(W(e))?"core":XS.has(W(e))?"standard":"full",family:eE(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"}]),tE=Ln,nh=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),QU=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"]);function ZU(e){let t=e===""?0:e.split(/\r?\n/).length,n=Buffer.byteLength(e,"utf8");return{lines:t,utf8_bytes:n,within_budget:t<=nh.max_lines&&n<=nh.max_utf8_bytes}}var rh={core:0,standard:1,full:2,internal:3},ih=new Map(tE.map(({command:e,tier:t})=>[e,t]));function mc(e,t="standard"){return ih.get(e.trim().toLowerCase())??ih.get(W(e.trim().toLowerCase()))??t}function ej(e){return sh(e,Ln)}function sh(e,t){let n=rh[e];return t.filter(r=>r.tier!=="internal"&&rh[r.tier]<=n).map(r=>r.command)}function tj(e){return oh(e,Ln)}function oh(e,t){return t.filter(n=>n.family===e).map(n=>n.command)}var nE=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],rE=new Set([...Ft.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 nj(e=Ln){return nE.map(t=>({family:t,commands:oh(t,e).filter(n=>e.find(r=>r.command===n)?.tier!=="internal"&&!rE.has(n))})).filter(({commands:t})=>t.length>0)}var iE=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"});function rj(e,t){return sE(e,t,Ln)}function sE(e,t,n){if(t==="full")return[...e];let r=new Set(sh(t,n));return e.filter(i=>{let s=iE[i];return s!==void 0&&r.has(s)})}var ij=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"}]),sj=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."}]);function oj(){return oE(Ln)}function oE(e){return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...e.map(({command:t,tier:n,family:r})=>`| \`${t}\` | ${n} | ${r} |`),""].join(`
2
- `)}(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 pc=[{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"}],aE=new Map(pc.map(e=>[e.exit_code,e.class]));function vs(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort()}function cE(e){if(!e)return[];let t=new Set,n=new Set;return e.map(r=>{let i=r.state.trim(),s=r.probe_id.trim(),o=vs(r.entrypoints);if(!/^[a-z][a-z0-9_]*$/.test(i)||!/^[a-z][a-z0-9-]*$/.test(s)||o.length===0||t.has(i)||n.has(s))throw new TypeError("Invalid pm refusal state contract");return t.add(i),n.add(s),{state:i,probe_id:s,entrypoints:o,expected_exit_class:r.expected_exit_class}}).sort((r,i)=>r.state.localeCompare(i.state))}function dE(e,t,n,r,i){return![[1,2,3,4,5].includes(e.exit_code),e.meaning.trim().length>0,e.recovery.trim().length>0,t.length>0,n.length>0,/^[a-z][a-z0-9_]*$/.test(r),i.every(s=>/^[a-z][a-z0-9_]*$/.test(s)),aE.get(e.exit_code)===e.class].includes(!1)}function lE(e,t){let n=e,r=new Set;for(;n.canonical_code!==n.code;){if(r.has(n.code))throw new TypeError(`Alias cycle in pm error code catalog: ${e.code}`);r.add(n.code);let i=t.get(n.canonical_code);if(!i)throw new TypeError(`Invalid pm error code contract: ${e.code}`);n=i}return n}function uE(e){let t=new Map(e.map(n=>[n.code,n]));for(let n of e){let r=lE(n,t);if(r.exit_code!==n.exit_code||r.class!==n.class)throw new TypeError(`Alias transport mismatch for pm error code: ${n.code}`);let i=e.filter(s=>s.code!==r.code&&s.canonical_code===r.code).map(s=>s.code).sort();if(n.code===r.code?JSON.stringify(n.aliases)!==JSON.stringify(i):n.aliases.length>0)throw new TypeError(`Invalid pm error code contract: ${n.code}`)}}function ch(e){let t=new Set,n=e.map(r=>{let i=r.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(i))throw new TypeError(`Invalid pm error code: ${JSON.stringify(r.code)}`);if(t.has(i))throw new TypeError(`Duplicate pm error code: ${i}`);t.add(i);let s=vs(r.sources),o=vs(r.emitting_commands),a=(r.canonical_code??i).trim(),c=vs(r.aliases??[]),d=cE(r.owned_states);if(!dE(r,s,o,a,c))throw new TypeError(`Invalid pm error code contract: ${i}`);if(d.some(l=>l.expected_exit_class!==r.class))throw new TypeError(`Invalid pm refusal state exit class: ${i}`);return Object.freeze({...r,code:i,meaning:r.meaning.trim(),recovery:r.recovery.trim(),sources:s,emitting_commands:o,canonical_code:a,aliases:c,owned_states:d})});return uE(n),Object.freeze(n.sort((r,i)=>r.code.localeCompare(i.code)))}function cj(e,t){let n=ah(e,t);return ah(n.canonical_code??n.code,t)}function ah(e,t){let n=e.trim(),r=t.find(i=>i.code===n);if(!r)throw new TypeError(`Unknown pm error code "${n}"`);return r}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b0d726a-0fd5-5196-bee1-d34c433c0016")}catch{}})();var mE="Inspect the structured error guidance, then retry the suggested command when one is present.",pE=new Map(pc.map(e=>[e.exit_code,e.class]));function dh(e){return e.map(t=>{let n=`${t.code.replaceAll("_"," ")} condition.`,r={code:t.code,meaning:`${n.charAt(0).toUpperCase()}${n.slice(1)}`,stability:t.stable?"stable":"provisional",exit_code:t.exit_code,class:pE.get(t.exit_code),recovery:mE,sources:t.sources,emitting_commands:t.emitting_commands??["*"],canonical_code:t.canonical_code??t.code,aliases:t.aliases??[]};return t.owned_states&&(r.owned_states=t.owned_states),r})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="785ecacc-6f06-5d01-90c7-d29d23f796bf")}catch{}})();var lh=[{code:"acceptance_criteria_mutation_conflict",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_remove_unmatched",exit_code:3,sources:["sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_semicolon_forbidden",exit_code:2,stable:!0,sources:["core/item/parse.ts"]},{code:"accepted_rejected_value",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"alias_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"alias_target_missing",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"already_claimed_by",exit_code:4,stable:!0,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"ambiguous_option_combination",exit_code:2,stable:!0,sources:["sdk/lifecycle/claim.ts","sdk/lifecycle/plan.ts"],emitting_commands:["claim","plan"]},{code:"annotation_alias_conflict",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"annotation_entry_mismatch",exit_code:4,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_invalid",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_without_target",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_flag_like_value",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_if_absent_without_append",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_text_source_conflict",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"annotation_transposed_subcommand",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"append_empty_body",exit_code:2,stable:!0,sources:["sdk/lifecycle/append.ts"],emitting_commands:["append"]},{code:"assurance_registry_invalid",exit_code:1,sources:["sdk/governance/assurance.ts"]},{code:"bare_comma_entry_ambiguous",exit_code:2,sources:["core/item/parse.ts"]},{code:"blocker_identity_read_failed",exit_code:1,sources:["sdk/query/declared-blockers.ts"]},{code:"body_file_conflicts_with_body",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",exit_code:3,stable:!0,sources:["core/io/body-file.ts"]},{code:"budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"bulk_create_route",exit_code:2,sources:["cli/register-mutation.ts"]},{code:"bulk_ids_input_empty",exit_code:2,sources:["core/io/bulk-ids-input.ts","sdk/history-compact.ts","sdk/history-mcp.ts"],owned_states:[{state:"bulk_ids_stdin_contains_no_nonempty_ids",probe_id:"bulk-ids-stdin-empty",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_missing_path",exit_code:2,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_token_omits_its_path",probe_id:"bulk-ids-file-path-missing",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_unreadable",exit_code:3,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_path_cannot_be_read",probe_id:"bulk-ids-file-unreadable",entrypoints:["update-many"],expected_exit_class:"not_found"}]},{code:"bundle_integrity_torn_install",exit_code:1,stable:!0,sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"capability_unused",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",exit_code:1,stable:!0,sources:["sdk/item-children.ts"]},{code:"close_reason_required",exit_code:2,stable:!0,sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"],emitting_commands:["*","close-many"]},{code:"close_through_update",exit_code:1,stable:!0,sources:["core/telemetry/observability.ts"]},{code:"close_validation_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:["sdk/extension/command-options.ts"]},{code:"extension_install_incomplete_source_scan",exit_code:2,sources:["sdk/extension/install-plan.ts"]},{code:"extension_install_rollback_failed",exit_code:1,sources:["sdk/extension/install-snapshot.ts"]},{code:"extension_install_soft_failed",exit_code:1,stable:!0,sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",exit_code:2,stable:!0,sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_option_spelling_conflict",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_read_output_invalid",exit_code:2,sources:["sdk/read-output/extension.ts"]},{code:"extension_update_health_partial_coverage",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"extensions_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"field_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_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"]}];(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]="853917f6-6746-52c8-a2ce-df083ecbe6a6")}catch{}})();var uh=[{code:"merge_reconcile_receipt_evidence_untrusted",exit_code:4,sources:["sdk/history-repair.ts"]},{code:"merge_root_not_found",exit_code:3,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_settlement_hook_conflict",exit_code:4,sources:["sdk/merge/settlement-hook.ts"]},{code:"merge_settlement_review_required",exit_code:4,sources:["sdk/merge/ignored-artifacts.ts","sdk/merge/reconcile.ts","sdk/merge/stage.ts"]},{code:"missing_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"missing_cli_flag",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_directory",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"missing_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_lifecycle_target",exit_code:2,stable:!0,sources:["sdk/extension.ts"]},{code:"missing_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"missing_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_parameter_alias",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_positive_execution_receipt",exit_code:1,sources:["sdk/test/execution.ts"]},{code:"missing_probe",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_required_argument",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","cli/schema/registration.ts","core/telemetry/observability.ts","sdk/governance/assurance-action.ts","sdk/history-redact.ts","sdk/invocation-author.ts","sdk/lifecycle/claim.ts"],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:"read_output_mutation_conflict",exit_code:2,sources:["sdk/read-output-contracts.ts"]},{code:"recovery_kind_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"redundant_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"refusal_allowed_values_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_exit_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_mutated_state",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_probe_missing",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_recovery_failed",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"reindex_already_running",exit_code:4,stable:!0,sources:["sdk/governance/reindex.ts"]},{code:"removed_canonical_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"removed_compatibility_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"reopen_reason_required",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reopen_receipt_missing",exit_code:1,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"reopen_target_status_invalid",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reported_zero_passes",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reported_zero_tests",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reserved_item_field",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"retry_failed",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"schema_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","sdk/extension/command-options.ts"],owned_states:[{state:"declared_option_is_rejected_on_the_selected_command_path",probe_id:"cross-command-unknown-option",entrypoints:["deps"],expected_exit_class:"usage"}]},{code:"unknown_plan_template",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"unknown_provenance_dimension",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"unknown_status",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_subcommand",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","sdk/agent/subcommand-recovery.ts"],aliases:["unknown_lifecycle_action"],owned_states:[{state:"config_action_token_is_not_declared",probe_id:"config-unknown-action",entrypoints:["config"],expected_exit_class:"usage"},{state:"graph_command_token_is_not_declared",probe_id:"graph-unknown-subcommand",entrypoints:["graph"],expected_exit_class:"usage"},{state:"nested_command_token_is_not_declared_by_its_family",probe_id:"schema-unknown-subcommand",entrypoints:["schema"],expected_exit_class:"usage"},{state:"package_lifecycle_token_is_not_declared",probe_id:"package-unknown-action",entrypoints:["package"],expected_exit_class:"usage"}]},{code:"unsafe_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"unsupported_update_option",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"upsert_key_ambiguous",exit_code:4,sources:["sdk/structured-mutations.ts"]},{code:"upsert_key_conflict",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"upsert_key_duplicate",exit_code:2,sources:["sdk/item-transaction.ts","sdk/structured-mutations.ts"]},{code:"upsert_key_missing",exit_code:2,sources:["sdk/structured-mutations.ts"]},{code:"upsert_match_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"validate_command_references_stale_pm_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_ahead_format_version"},{code:"validate_format_version_outdated_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_outdated_format_version"},{code:"validate_hierarchy_parent_cycle",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_chain_mismatch"},{code:"validate_history_drift_hash_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_hash_mismatch"},{code:"validate_history_drift_missing_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_missing_stream"},{code:"validate_history_drift_unreadable_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_unreadable_stream"},{code:"validate_history_drift_version_skews",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_version_skew"},{code:"validate_history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_unknown_author_events"},{code:"validate_lifecycle_active_closure_like_metadata",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_driver_configuration",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_closed_at",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_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 mh=ch(dh([...lh,...uh]));(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 _E=["mutation_receipt","entity","collection","diagnostic","stream"],fE=new Set(["append","claim","close","close-task","copy","create","delete","focus","pause-task","release","restore","start-task","update"]),hE=new Set(["close-many","update-many"]),gE=new Set(["activity","comments","contracts","events","history","learnings","list","notes","search"]),yE=new Set(["aggregate","deps","graph","health","history-redact","history-repair","history-compact","stats","validate"]);function Rr(e){if(e.command.trim().length===0)throw new TypeError("command must be a non-empty command path");if(!_E.includes(e.kind))throw new TypeError(`Unsupported output envelope kind: ${e.kind}`);return e}function ph(e){let t=e.trim().replace(/\s+/gu," "),[n=t]=t.split(" ");return hE.has(n)?Rr({command:t,kind:"collection",wrapper_key:"rows",cardinality:"many",format_flag:"--json"}):fE.has(n)?Rr({command:t,kind:"mutation_receipt",wrapper_key:null,cardinality:"one",format_flag:"--json"}):gE.has(n)?Rr({command:t,kind:"collection",wrapper_key:n==="contracts"?null:"items",cardinality:"many",format_flag:"--json"}):yE.has(n)?Rr({command:t,kind:"diagnostic",wrapper_key:null,cardinality:"none",format_flag:"--json"}):Rr({command:t,kind:n==="get"?"entity":"diagnostic",wrapper_key:n==="get"?"item":null,cardinality:n==="get"?"one":"none",format_flag:"--json"})}var wE=Je.map(e=>ph(e)),vE=new Map(wE.map(e=>[e.command,e]));function _h(e){let t=e.trim().replace(/\s+/gu," ");if(t.length===0)throw new TypeError("command must be a non-empty command path");let[n=t]=bi(t).split(" "),r=vE.get(n);return r?{...r,command:t}:ph(t)}function bE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function kE(e){return bE(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 bj(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(n){throw new TypeError(`Mutation receipt must be valid JSON: ${String(n)}`,{cause:n})}if(!kE(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]="7c95b311-b408-50f7-87e8-2c2fa2323092")}catch{}})();var _c=[{exit_code:m.SUCCESS,outcome:"effect",success:!0,meaning:"The requested operation completed with its intended effect."},{exit_code:m.GENERIC_FAILURE,outcome:"internal_failure",success:!1,meaning:"An unexpected runtime or internal failure prevented completion."},{exit_code:m.USAGE,outcome:"refused_input",success:!1,meaning:"The invocation was refused because its input or composition was invalid."},{exit_code:m.NOT_FOUND,outcome:"refused_tracker_state",success:!1,meaning:"The requested tracker, item, or resource was not present."},{exit_code:m.CONFLICT,outcome:"conflict",success:!1,meaning:"Current state or concurrency prevented the requested effect."},{exit_code:m.DEPENDENCY_FAILED,outcome:"dependency_failed",success:!1,meaning:"A required dependency operation failed."},{exit_code:m.NO_EFFECT,outcome:"no_effect",success:!0,meaning:"The request was valid and completed, but matched nothing to change."},{exit_code:m.PARTIAL_EFFECT,outcome:"partial_effect",success:!0,meaning:"The request completed and changed some, but not all, selected targets."}],fh=[m.SUCCESS,m.GENERIC_FAILURE,m.USAGE,m.NOT_FOUND,m.CONFLICT,m.DEPENDENCY_FAILED],SE=new Set(["close-many","update-many"]),gh=Je.map(e=>({command:e,exit_codes:SE.has(e)?[...fh,m.NO_EFFECT,m.PARTIAL_EFFECT]:[...fh]})),hh=new Map(gh.map(e=>[e.command,e])),EE=[m.SUCCESS,m.NO_EFFECT,m.PARTIAL_EFFECT];function Tj(e){return EE.includes(e)}function Cj(e){return _c.some(t=>t.exit_code===e)}function yh(e){let t=e.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(" ");return hh.get(t)??hh.get(t.split(" ")[0])}function Aj(e,t=Je,n=gh){let r=new Map(n.map(c=>[c.command,c])),i=t.filter(c=>!r.has(c)),s=e.filter(c=>{let d=r.get(c.command)??r.get(c.command.split(" ")[0]);return d===void 0||!d.exit_codes.includes(c.exit_code)}),o=new Set(e.map(c=>c.exit_code)),a=[...new Set(n.flatMap(c=>c.exit_codes))].filter(c=>!o.has(c)).sort((c,d)=>c-d);return{ok:i.length===0&&s.length===0&&a.length===0,missing_commands:i,undeclared_observations:s,unreachable_exit_codes:a}}function xj(e){return e.applied===0&&e.failed>0?{outcome:"dependency_failed",exit_code:m.DEPENDENCY_FAILED}:e.applied===0?{outcome:"no_effect",exit_code:m.NO_EFFECT}:e.skipped>0||e.failed>0||e.unmatched>0?{outcome:"partial_effect",exit_code:m.PARTIAL_EFFECT}:{outcome:"effect",exit_code:m.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]="081bf1eb-4b9a-5fa9-a272-34ae781d250c")}catch{}})();var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Re=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},nt=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Dn(e){try{return await e()}catch(t){throw t instanceof L?new p(t.message,m.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function fc(e){try{return await e()}catch(t){throw t instanceof Re?new p(t.message,m.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as TE}from"node:crypto";import CE 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]="b00dcab2-22c6-55b7-b93d-f6f5413d4b04")}catch{}})();var Nn=1e3;(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]="eaede7d4-43ae-5551-915e-19befefc29d0")}catch{}})();var vh=1,_t=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Ir=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],AE=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],xE=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,bs=30,ks=5e3,bh=4,RE=50;function ft(e,t){if(!xE.test(e))throw new L(`${t} must be a stable lowercase id`)}function IE(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function Or(e){let t=AE.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function gc(e,t){return ne(e)===ne(t)}function kh(e,t){if(t.polarity==="equals")return gc(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function Sh(e){let t=Or(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>kh(r.observed,t)===(r.expected==="pass"))}function OE(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!gc(e.value,t.value)}function LE(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||ne(e.scope)!==ne(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return OE(Or(e),Or(t))||n[t.enforcement]<n[e.enforcement]||r}function DE(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function NE(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(t=>t!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function ME(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function yc(e){ft(e.id,"measurement.id"),e.max_cost!==void 0&&IE(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Ir.join(", ")}`);let n=Reflect.get(t,"kind");if(!Ir.includes(n))throw new L(`measurement.source.kind must be one of ${Ir.join(", ")}`);let r=t;if(r.kind==="items"&&DE(r),r.kind==="dependency_kind"&&NE(r),r.kind==="prose_edge_gap"&&ME(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(ft(r.provider,"provider source provider"),ft(r.key,"provider source key")),e}function wc(e){if(ft(e.id,"assertion.id"),ft(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=Or(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&ft(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!Sh(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function $E(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)ft(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!_t.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Eh(e){if(ft(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)ft(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${_t.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!_t.includes(t))throw new L(`gate trigger must be one of ${_t.join(", ")}`);return e.provider_policy&&$E(e.provider_policy),e}function Mn(e){if(e.version!==vh)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(yc(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(wc(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Eh(r);let i=r.assertion_ids.filter(s=>!e.assertions.some(o=>o.id===s));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Th(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function vc(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)vc(n,t)}function Th(e){let t=new Map,n=(r,i)=>{let s=t.get(r)??[];s.push(i),t.set(r,s)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];vc(r.source.expression,i);for(let s of i)n(s,`derived measurement ${r.id}`)}return t}function PE(e,t){let n=e.assertion_ids.flatMap(s=>{let o=t.assertions.find(a=>a.id===s);return[o.measurement_id,...o.scope.kind==="filter"?[o.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let s=n.pop();if(r.has(s))continue;r.add(s);let o=t.measurements.find(a=>a.id===s);o.source.kind==="provider"?i.add(o.source.provider):o.source.kind==="derived"&&vc(o.source.expression,n)}return i}function Lr(){return{version:vh,measurements:[],assertions:[],gates:[]}}function FE(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let s=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?s:!s}return gc(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function UE(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function jE(e,t){let n=[],r=ar(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let s of i.dependencies??[]){let o=ar(s.kind)??s.kind.trim().toLowerCase(),a=s.source_kind?.trim();o===r&&UE(e,a)&&n.push(`${i.id}->${s.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function GE(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let s=Reflect.get(i,"text");typeof s=="string"&&t.push(s)}}}return t}function qE(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function hc(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function WE(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,s=0;for(let o of e){t.set(o.id.toLowerCase(),o.id);for(let a of o.dependencies??[])n.add(hc(o.id,a.id));for(let a of[o.parent,o.blocked_by])typeof a=="string"&&n.add(hc(o.id,a));for(let a of GE(o)){let c=[...a.matchAll(i)].map(d=>d[0]);s+=c.length,r.push({holder_id:o.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:s}}function KE(e,t){let n=WE(t.items),r=new Map;for(let o of n.prose_mentions){let a=o.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==o.holder_id),c=[...new Set(a)];for(let d of c){let l=hc(o.holder_id,d);if(n.linked_pairs.has(l)||qE(e.exemptions??[],o.holder_id,d,o.segment))continue;let u=c.some(_=>_!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${o.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],s=i.map(o=>o.contributor).sort();return{value:s.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:s.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(o=>o.explicit).length,implicit_subject:i.filter(o=>!o.explicit).length}}}function zE(e,t){return{value:t.history.filter(n=>(e.op===void 0||n.op===e.op)&&(e.author===void 0||n.author===e.author)&&(e.harness===void 0||n.agent_harness===e.harness)&&(e.model===void 0||n.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function BE(e,t){let n=t.items.filter(r=>{let i=r[e.link],s=Array.isArray(i)&&i.length>0;return e.state==="present"?s:!s});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function HE(e,t){let n=e.source;return n.kind==="items"?FE(n,t):n.kind==="dependency_kind"?jE(n,t):n.kind==="prose_edge_gap"?KE(n,t):n.kind==="history"?zE(n,t):n.kind==="links"?BE(n,t):null}function Ch(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function VE(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Ah(e,t,n){let r=new Array(e.length),i=0,s=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let o=i;i+=1,r[o]=await n(e[o],o)}});return await Promise.all(s),r}async function xh(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let o=n.find(d=>d.id===e.measurement);if(!o)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Rh(o,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${o.id} is not numeric`);let c=i.charged.has(o.id)?[]:[a.cost];return i.charged.add(o.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let s=await Ah(e.operands,bh,o=>xh(o,t,n,r,i));return{value:VE(e.operator,s.map(o=>o.value)),costs:s.flatMap(o=>o.costs),population_size:Math.max(0,...s.map(o=>o.population_size)),contributors:[...new Set(s.flatMap(o=>o.contributors))]}}async function YE(e,t,n,r,i){yc(e);let s=Date.now(),o,a=[],c=0;if(e.source.kind==="derived"){let u=await xh(e.source.expression,t,n,[...r,e.id],i);o={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=HE(e,t);u!==null?o=u:(o=await t.external(e.source),c=1)}let d={units:o.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-s},l=Ch([...a,d],Date.now()-s);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Re(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${TE("sha256").update(ne(e)).digest("hex")}`,value:o.value,population_size:o.population_size,cost:l,contributors:o.contributors??[],...o.partitions?{partitions:o.partitions}:{}}}function Rh(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let s=i.cache.get(e.id);if(s)return s;let o=YE(e,t,n,r,i).catch(a=>{if(a instanceof nt&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new nt(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,o),o}async function bc(e,t,n=[e]){return Rh(e,t,n,[],{cache:new Map,charged:new Set})}function JE(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity,e-t.value)}function XE(e,t,n={}){wc(e);let r=Or(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:JE(t.value,r),verdict:i?"retired":kh(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:Sh(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function QE(e,t,n,r){let i=PE(e,t);if(i.size===0)return;let s=e.provider_policy,o=s?.triggers[r];if(!s||!o)throw new Re(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(s.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Re(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Re(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[o.max_cost_class])throw new Re(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!o.allow_network)throw new Re(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wh(e,t,n,r,i){try{return await bc(n,r,i)}catch(s){if(s instanceof nt){let o=s.check?` check ${s.check}`:"",a=s.measurement_id??n.id,c=new Re(`assurance gate ${e} assertion ${t} measurement ${a} source ${s.source_kind}${o} field ${s.field} could not resolve: ${s.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:s.source_kind,field:s.field,...s.check?{check:s.check}:{}});throw c.cause=s,c}throw s}}async function Ih(e,t,n,r){Mn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Re(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Re(`assurance gate ${e} does not declare trigger ${r.trigger}`);QE(i,t,n,r.trigger);let s=await Ah(i.assertion_ids,bh,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(g=>!f.has(g.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,g=t.measurements.find(v=>v.id===f),y=await wh(i.id,d.id,g,n,t.measurements),w=new Set(y.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let _=n.items.find(f=>f.id===d.owner_item_id),h=_!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(_.status);return XE(d,await wh(i.id,d.id,l,u,t.measurements),{owner_terminal:h})}),o=s.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=s.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:o?"block":a?"warn":"pass",exit_code:o?1:0,assertions:s,assertions_total:s.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Ch(s.map(c=>c.cost),Math.max(0,...s.map(c=>c.cost.duration_ms)))}}function Ss(e){return CE.join(e,"assurance.json")}async function Oh(e){let t=await X(Ss(e));return t===null?Lr():Es(t)}function Es(e){try{return Mn(JSON.parse(e))}catch(t){throw new p("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",m.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Ts(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function ZE(e,t){e==="measurement"?yc(t):e==="assertion"?wc(t):Eh(t)}async function Dr(e,t){let n=structuredClone(Ts(await Oh(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Lh(e,t,n){let r=Ts(await Oh(e),t).find(i=>i.id===n);if(!r)throw new Re(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Cs(e,t,n,r={}){ZE(t,n);let i=await x(e),s=j(r.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:`assurance:${t}:put`,author:s,message:r.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a),d=Ts(c,t),l=d.findIndex(_=>_.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&LE(d[l],n)){let _=n.authorization_decision;if(!_||!r.authorized_decision_ids?.includes(_))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Mn(c),{raw:`${JSON.stringify(c,null,2)}
1
+ import{a as Nf}from"./chunk-UJMQP2HP.js";import{I as pf,a as os,b as hr,c as as,d as xe,e as cs,f as uf,g as ds,h as ls,i as gr,j as mf,k as us,l as ms,m as yr,q as wr,s as ps,t as Z,x as Xa}from"./chunk-DIWTFDU7.js";import{Ba as Af,Ga as xf,Ka as rc,i as fp,ka as Za,ua as ec,va as Cf,wa as tc,x as Tf,xa as nc}from"./chunk-QCTA2UFR.js";import{a as Sr,b as kf,i as xt,k as Tn,l as Cn,m as An}from"./chunk-L3SA3354.js";import{A as En,B as ae,D as _s,G as fs,H as gf,Ha as Of,Ia as Lf,Ic as Ff,J as Qa,Ja as Er,K as yf,Ka as ic,Lc as Uf,M as wf,Na as Df,U as vf,_a as Tr,bb as xn,eb as Rn,l as _f,lb as Mf,o as ff,oa as Rf,p as vr,pa as If,pb as $f,qb as Pf,s as hf,y as br,z as kr}from"./chunk-JLQ7O6UV.js";import{a as _p}from"./chunk-JESMEJTD.js";import{$ as Kp,$a as F_,$b as of,A as Ga,Ab as ef,B as qa,C as kp,D as rs,Da as h_,E as Sp,Ea as g_,F as Ep,Fa as y_,G as Tp,Ga as w_,H as Cp,Ha as v_,I as Ap,Ia as b_,J as xp,Ja as k_,K as Rp,Ka as S_,L as Ip,La as E_,M as Op,Ma as T_,N as Lp,Na as C_,O as Dp,Oa as A_,P as Np,Pa as x_,Q as Mp,Qa as R_,R as $p,Ra as I_,S as Pp,Sa as O_,T as Fp,Ta as L_,Tb as tf,U as Up,Ua as D_,Ub as is,V as jp,Va as za,Vb as nf,W as Gp,Wa as N_,Wb as Ya,X as qp,Xa as M_,Ya as Ba,Yb as rf,Z as Wp,Za as $_,Zb as sf,_ as Wa,_a as P_,aa as zp,ab as U_,ac as af,b as hp,ba as Bp,bb as j_,bc as ss,c as gp,ca as Hp,cb as At,cc as cf,d as yp,da as Vp,db as G_,ea as Yp,eb as q_,fa as Jp,fb as W_,ga as Xp,gb as K_,ha as Qp,ia as Zp,ib as z_,ic as Ja,ja as e_,ka as t_,kb as fr,la as n_,ma as r_,mb as B_,mc as df,n as Ua,na as i_,nb as H_,o as wp,oa as Ka,ob as V_,pa as s_,pb as Y_,pc as lf,qa as o_,r as vp,ra as a_,rb as J_,s as ja,sa as c_,t as Ht,ta as d_,ua as l_,v as bp,va as u_,vb as Ha,wa as m_,wb as X_,xa as p_,xb as Q_,ya as __,yb as Va,za as f_,zb as Z_}from"./chunk-SVVFJPNW.js";import{d as dp,j as lp,r as up,s as Bt,t as mp,w as pp}from"./chunk-Z4YEH7VQ.js";import{A as ge,Aa as pr,B as Ci,Bd as ns,C as Ea,Cb as Km,Cd as cp,D as ir,Db as Zi,E as sr,Eb as zm,F as Oi,G as lt,Gb as V,Gc as tp,H as Du,Hb as le,I as Li,Jb as es,Ka as Qi,Kb as Ee,Kc as np,Lb as pt,Mb as Bm,Na as kn,Nb as Kt,Oa as Om,Pa as Lm,Pb as Sn,Q as $i,Qa as $m,Qb as ue,S as St,Sb as La,T as Ui,Tb as Hm,U as ji,X as Yu,Xa as Pm,bc as Vm,c as Xe,db as Fm,dd as Na,e as Qe,ed as Ma,f as uu,fa as Bi,fb as Um,fd as $a,g as ha,gc as Ym,gd as Pa,h as mu,i as ki,ic as Jm,id as rp,j as Si,ja as tt,k as pu,ka as xm,kb as jm,l as Ei,lc as Da,m as _u,ma as Hi,md as Fa,n as Q,na as Rm,nc as Xm,o as mn,oa as Vi,p as tr,pa as Yi,pb as Gm,pc as Qm,pd as ip,q as ve,qa as Ji,rc as Tt,sc as Zm,tc as Ct,u as Ze,ua as Xi,uc as _r,ud as sp,vc as zt,vd as op,w as Ut,wd as ts,xa as Im,xc as ep,xd as ap,y as Ti,yb as qm,z as pn,zb as Wm}from"./chunk-GZ52WAY2.js";import{$a as Ru,$b as ar,A as nu,Aa as va,Ae as im,B as ru,Ba as nr,Bd as Wu,Be as sm,C as iu,Ca as Ce,Cd as Ku,Ch as Sm,D as su,De as zi,E as ou,Ee as om,Ei as Wt,F as au,Fa as $,Fd as ut,Fe as am,Fi as mr,G as Je,Ga as ct,Gc as cr,Gd as zu,H as cu,Ha as Ri,Hd as Fe,Ia as fn,Id as Bu,Ii as vn,Ja as rr,Jd as Hu,Ji as bn,Ka as jt,Kc as Gu,Kd as Vu,Ki as Oa,Lb as I,Le as cm,Mb as Nu,N as du,Na as R,Nb as Ta,O as lu,Oa as et,Ob as Mu,Of as gm,P as fa,Pa as We,Pb as Ni,Pi as Dm,Qa as Ae,Qg as vm,Ra as Su,Rb as de,Rg as bm,Sa as Eu,Sb as $u,Ta as dt,Tb as or,Te as dm,Ua as Ii,Ub as Ca,Ud as Ju,Ue as lm,Va as Tu,Vb as Mi,Ve as um,Vg as km,Wa as Cu,We as mm,Xa as ba,Xb as Pu,Xe as pm,Ya as ka,Ye as wn,Yh as Em,Yi as Nm,Za as Au,Zb as Fu,Zd as Gi,Ze as _m,Zi as x,_a as xu,_i as Mm,a as ne,ab as Iu,ae as K,b as $e,bb as Ou,bc as Uu,bd as Pi,be as Ke,c as eu,cb as Lu,ce as Gt,d as tu,db as Sa,dd as Fi,ea as ga,ee as Et,ef as fm,fe as Xu,gb as P,ge as Aa,ha as ya,hc as ju,he as Qu,hf as lr,ia as Pe,ie as xa,if as ur,ig as ym,ja as Ai,je as Zu,jj as U,ka as xi,la as hu,le as em,ma as gu,md as qu,me as tm,mg as wm,na as yu,nb as hn,ne as qi,oa as wu,oe as dr,oi as Tm,pa as vu,pi as Cm,qa as bu,qe as Wi,ra as ku,rb as gn,rg as Ia,ri as Am,s as Ye,sa as wa,sf as hm,te as Ki,u as W,ud as N,ue as oe,v as bi,ve as qt,w as Ft,wb as ie,we as _e,wf as Ra,xe as yn,xf as j,ye as nm,zb as Di,ze as rm,zf as mt}from"./chunk-PZI6CR24.js";import{a as Ef}from"./chunk-SPPHDVZE.js";import{c as bf}from"./chunk-RSAN2YUU.js";import{b as Sf}from"./chunk-VS565KBX.js";import{A as m,C as p,D as kt,E as re,F as _n,G,H as X,K as Le,M as fu,a as Vl,m as Yl,p as Jl,s as Xl,u as Ql,w as Zl,x as vi,y as Pt}from"./chunk-O4ZLEN4T.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]="c2e89d3c-9abc-5ca7-a290-69a54dd694ab")}catch{}})();var K0=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."}),z0=new Set(["--add","--body","--comment","--dep","--dep-remove","--description","--doc","--event","--field","--file","--learning","--note","--remove","--reminder","--test","--type-option"]),B0=new Set(["append","comments","create","docs","files","learnings","notes","test","update","update-many"]),H0=new Set(["close-many:--ids","comments:--file","create:--body-file","history-compact:--ids","learnings:--file","notes:--file","update:--body-file","update-many:--ids"]),V0=new Set(["close-many:--ids","history-compact:--ids","update-many:--ids"]),Y0=["--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"],J0=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"]),X0=new Set(["--only-index"]),Q0=new Set(["activity:--stream","eval:--fail-under","validate:--fix-scope"]),Z0=new Set(["activity:--stream","close:--validate-close","close-many:--validate-close","comments:--author","learnings:--author","notes:--author"]),eS=new Set(["--regression"]);function tS(e,t){return t==="--stdin"||t==="--stdin-json"?["stdin"]:H0.has(`${e}:${t}`)?["argv","file","stdin"]:t.endsWith("-file")?["argv","file"]:z0.has(t)&&B0.has(e)?["argv","stdin"]:["argv"]}function nS(e,t){let n=Q0.has(`${e}:${t.flag}`)||t.value_name!==void 0||t.value_type==="string"||t.value_type==="number"||t.list===!0||t.repeatable===!0,r=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-"))||Y0.some(i=>t.flag.startsWith(i));return n||X0.has(t.flag)||!J0.has(t.flag)&&!r}function rS(e,t){return t.value_arity!==void 0?t.value_arity:nS(e,t)?eS.has(t.flag)||Z0.has(`${e}:${t.flag}`)?"optional":"required":"none"}function iS(e,t){let n=bi(e),r=rS(n,t),i=r!=="none",s=tS(n,t.flag),o=t.description??K0[t.flag]??`${i?"Set":"Enable"} ${t.flag.slice(2).replaceAll("-"," ")}.`;return{...t,description:o,takes_value:i,value_required:r==="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:s,...s.includes("stdin")&&t.flag!=="--stdin"&&t.flag!=="--stdin-json"?{stdin_token:"-"}:{},...V0.has(`${n}:${t.flag}`)?{file_token_prefix:"@"}:{}}}function jf(e,t){return t.map(n=>iS(e,n))}function _U(e,t,n){let r=e.trim().toLowerCase(),i=[],s=new Map,o=0;for(let c of n)if(c.command.trim().toLowerCase()===r){if(o+=1,s.has(c.flag)){i.push({code:"duplicate_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} was observed more than once.`});continue}s.set(c.flag,c)}let a=new Set(t.map(({flag:c})=>c));for(let c of t){let d=s.get(c.flag);if(!d){i.push({code:"missing_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} has no executable option observation.`});continue}for(let[l,u]of[["takes_value","takes_value_mismatch"],["value_required","value_required_mismatch"],["repeatable","repeatable_mismatch"]])c[l]!==d[l]&&i.push({code:u,command:r,flag:c.flag,detail:`${r} ${c.flag} declares ${l}=${String(c[l])} but the executable option reports ${String(d[l])}.`})}for(let c of s.values())a.has(c.flag)||i.push({code:"undeclared_observation",command:r,flag:c.flag,detail:`${r} ${c.flag} is executable but absent from invocation contracts.`});return i.sort((c,d)=>c.flag.localeCompare(d.flag)||c.code.localeCompare(d.code)),{ok:i.length===0,declared_count:t.length,observed_count:o,findings:i}}import{readFile as sS}from"node:fs/promises";(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]="9c3ae5d4-5437-543d-90a3-67e92b073c18")}catch{}})();function LU(e){let t={...e,...e.full===!0?{fullHistory:!0}:{}};return delete t.full,Ze(e,t)}function Bf(e){return Object.prototype.toString.call(e)==="[object Object]"}function oS(e,t,n,r){let i=I();if(!Bf(e))return{...r({created_at:i,author:n,text:t}),text:t,edited_at:i};let s=o=>typeof o=="string"&&o!=="";return{...e,...s(e.created_at)?{}:{created_at:i},...s(e.author)?{}:{author:n},text:t,edited_at:i}}function Gf(e,t){if(typeof e=="object"&&e!==null&&"format"in e&&e.format==="json")throw new p(`Structured context events are append-only and cannot be ${t}.`,m.USAGE,{code:"structured_event_immutable"})}function aS(e,t){return t===void 0?e:t===0?[]:e.slice(Math.max(0,e.length-t))}function Vt(e,t){let n=e[t];return Array.isArray(n)?n:[]}function DU(e,t={}){let n=e.trim();if(!n)return"";let r=/^(?:[-*+]\s*)?text\s*[:=]/i.exec(n);if(t.stripPlainTextPrefix===!0&&r&&!n.startsWith("```"))return n.slice(r[0].length).trim()||n;if(!(/^(?:[-*+]\s*)?text\s*[:=]/im.test(n)||n.startsWith("```")))return n;try{let i=Q(n,"--add");return Object.keys(i).map(s=>s.trim().toLowerCase()).some(s=>s!=="text")?n:i.text?.trim()||n}catch{return n}}function cS(e){return typeof e=="object"&&e!==null&&"code"in e}function qf(e,t){if(!Ut(e))throw new p(`${t} cannot read process stdin through the MCP JSON-RPC transport. Pass annotation text in options.add instead.`,m.USAGE,{code:"mcp_stdin_unavailable",required:"Pass annotation text as JSON data; the MCP protocol already owns process stdin."})}async function dS(e,t){if(+(e.add!==void 0)+ +(e.stdin===!0)+ +(typeof e.file=="string")>1)throw new p(`Specify ${t} text using only one input source: --add, --stdin, or --file`,m.USAGE);let n=pn(),r=Ut(e);if(e.add!==void 0)return{value:await n.resolveValue(e.add,"--add",r)??"",rawValue:e.add,emptyFlag:"--add"};if(e.stdin===!0)return qf(e,"--stdin"),{value:await n.resolveValue("-","--stdin")??"",emptyFlag:"--stdin"};if(typeof e.file!="string")return;let i=e.file.trim();if(!i)throw new p("--file path cannot be empty",m.USAGE);if(i==="-")return qf(e,"--file -"),{value:await n.resolveValue("-","--file")??"",emptyFlag:"--file"};try{return{value:await sS(i,"utf8"),emptyFlag:"--file"}}catch(s){if(cS(s)&&_n(s))throw new p(`--file path not found: ${i}. Use --file - to read stdin.`,m.USAGE);let o=s instanceof Error?s.message:String(s);throw new p(`Failed to read --file path "${i}": ${o}. Use --file - to read stdin.`,m.USAGE)}}async function NU(e,t){if(e.edit!==void 0&&e.delete!==void 0)throw new p("Specify only one of --edit or --delete",m.USAGE);if(e.delete!==void 0){if(e.add!==void 0||e.stdin===!0||typeof e.file=="string")throw new p("--delete cannot be combined with replacement text",m.USAGE);if(!Number.isInteger(e.delete)||e.delete<1)throw new p("--delete must be a positive integer",m.USAGE);return{mode:"delete",index:e.delete}}if(e.edit!==void 0&&(!Number.isInteger(e.edit)||e.edit<1))throw new p("--edit must be a positive integer",m.USAGE);let n=await dS(e,t);if(e.edit!==void 0){if(!n)throw new p("--edit requires replacement text from --add, --stdin, or --file",m.USAGE);return{mode:"edit",index:e.edit,...n}}return n?{mode:"add",...n}:{mode:"list"}}function Cr(e,t){throw e instanceof p&&e.exitCode===m.CONFLICT&&e.message.includes("is assigned to")&&e.message.includes("Use --force to override")?new p(e.message,e.exitCode,{code:"ownership_conflict",required:t.required,examples:t.examples,nextSteps:t.nextSteps}):e}function Hf(e){return e==="comments"?"--stdin":"--add -"}var MU="annotation_flag_like_value";function lS(e){return/^-{1,2}[A-Za-z][\w-]*(?:=.*)?$/.test(e.trim())}function uS(e){return e==="--file"?"--file <path>":e.startsWith("--file=")?e:e==="--stdin"?"--stdin":void 0}function mS(e){let t=e.value.trim(),n=e.collectionKey.replace(/s$/,""),r=uS(t),i=Hf(e.collectionKey),s=e.retryArgs===void 0?{}:{field:e.textFlag,recovery:{suggested_flags:[t],suggested_retry:P(e.retryArgs),suggested_retry_args:[...e.retryArgs]}};if(r!==void 0){let o=r.split(/[ =]/,1)[0],a=o==="--file"?"that file":"stdin",c=e.conflictingOperand===void 0?"":` "${e.conflictingOperand}" was read as positional text, which ${o} cannot be combined with: drop it, or pass it as the text without ${o}.`;return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text: ${e.textFlag} took ${o} as its value. Drop ${e.textFlag} and pass ${r} on its own.${c}`,m.USAGE,{code:"annotation_flag_like_value",required:`Drop ${e.textFlag}: ${r} reads the ${n} text from ${a} by itself. Use ${e.textFlag} text=${t} only when the text really is "${t}".`,examples:[`${e.commandPrefix} ${r}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}return new p(`${e.textFlag} value "${t}" looks like an option, not annotation text. Use ${i} to read stdin, or use text=${t} for literal dash-leading text.`,m.USAGE,{code:"annotation_flag_like_value",required:`Use ${i} for stdin input, pass plain text, or use text=${t} when the text really starts with "-".`,examples:[`${e.commandPrefix} ${i}`,`${e.commandPrefix} ${e.textFlag} text=${t}`],...s})}function pS(e,t){if(!((t.input.emptyFlag??"--add")!=="--add"||!lS(e)))throw mS({collectionKey:t.collectionKey,textFlag:"--add",value:e,commandPrefix:t.input.mode==="edit"?`pm ${t.collectionKey} <id> --edit <index>`:`pm ${t.collectionKey} <id>`})}function _S(e,t){if(t.ifAbsent===!0&&!["add","stdin","file"].includes(e.input.mode))throw new p(`--if-absent requires a ${e.collectionKey.replace(/s$/,"")} append`,m.USAGE,{code:"annotation_if_absent_without_append",required:"Combine --if-absent with one append text source; omit it for list, edit, and delete operations."});if(fS(e,t),e.input.mode!=="list"||t.message===void 0)return;let n=e.collectionKey.replace(/s$/,"");throw new p(`--message labels a ${n} mutation but does not provide ${n} text. Pass text positionally or with --add, --stdin, or --file.`,m.USAGE,{code:"annotation_message_without_text",required:`Provide ${n} text through a content source; --message only annotates the history entry of a mutation.`,examples:[`pm ${e.collectionKey} <id> --add "text" --message "why"`,`pm ${e.collectionKey} <id> ${Hf(e.collectionKey)}`]})}function fS(e,t){if(t.expectAt!==void 0){if(e.input.mode!=="edit"&&e.input.mode!=="delete")throw new p(`--expect-at guards an --edit or --delete of one ${e.collectionKey.replace(/s$/,"")}`,m.USAGE,{code:"annotation_expectation_without_target",required:"Combine --expect-at with --edit <index> or --delete <index>; omit it for list and append operations.",examples:[`pm ${e.collectionKey} <id> --edit <index> --expect-at <created_at> --add "<text>"`,`pm ${e.collectionKey} <id> --delete <index> --expect-at <created_at>`]});if(typeof t.expectAt!="string"||t.expectAt.trim().length===0)throw new p("--expect-at must be the non-empty created_at timestamp of the entry you read",m.USAGE,{code:"annotation_expectation_invalid",required:"Pass the created_at value of the row you read at that index, as a string."})}}function Wf(e,t,n,r,i){if(i===void 0)return;let s=t[n]?.created_at,o=typeof s=="string"?s:null;if(o===i)return;let a=t.flatMap((_,h)=>_?.created_at===i?[h+1]:[]),c=r.collectionKey.replace(/s$/,""),d=r.input.mode==="delete"?"--delete":"--edit",l=n+1,u=a.length===1?` The ${c} created at ${i} is at index ${a[0]}.`:a.length>1?` ${a.length} ${r.collectionKey} were created at ${i}: indexes ${a.join(", ")}.`:` No ${c} on ${e} was created at ${i}.`;throw new p(`${c.charAt(0).toUpperCase()}${c.slice(1)} ${l} on ${e} was created at ${o||"an unrecorded time (malformed entry)"}, not ${i}; refusing ${d} of an entry the caller did not read. Nothing was written.${u}`,m.CONFLICT,{code:"annotation_entry_mismatch",item_id:e,details:{collection:r.collectionKey,entry_index:l,expected_created_at:i,actual_created_at:o,matching_indexes:a},required:`Address the ${c} by the index its listing row reports and keep --expect-at set to that row's created_at. When several indexes share the timestamp, inspect those rows before retrying, because the guard compares timestamps, not entry identities.`,why:"A listing page's position or count is not an entry address; only the row's index is, and the expectation checks that the entry at that index still carries the created_at that was read.",examples:[`pm ${r.collectionKey} ${e} --limit 5`,`pm ${r.collectionKey} ${e} ${d} ${a.length===1?a[0]:"<index>"} --expect-at ${i}${d==="--edit"?' --add "<text>"':""}`]})}function hS(e,t,n,r,i,s){let o=Vt(e.metadata,t),a=i?o.findIndex(c=>Bf(c)&&c.author===n&&c.text===r):-1;return a>=0?{changedFields:[],written:o,position:a}:(o.push(s({created_at:I(),author:n,text:r})),e.metadata[t]=o,{changedFields:[t],written:o,position:o.length-1})}function Kf(e,t,n){return nm.has(e)?t.map((r,i)=>i).sort((r,i)=>rm(t[r],t[i])||r-i).indexOf(n)+1:n+1}async function $U(e,t,n,r){_S(r,t);let i=R(process.cwd(),n.path);await U(i);let s=await x(i),o=$(s,N()),a=pr(t.limit);if(r.input.mode==="list"){let f=await V(i,e,s.id_prefix,s.item_format,o.type_to_folder);if(!f)throw new p(`Item ${e} not found`,m.NOT_FOUND);let g=await le(f,{schema:s.schema}),y=Vt(g.document.metadata,r.collectionKey);return hs(f.id,r.collectionKey,y,a,t.includeMeta===!0)}let c=j(t.author,s.author_default);if(r.input.mode==="delete"){let f=r.deleteOp??r.op,g;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(w){let v=Vt(w.metadata,r.collectionKey),b=zf(r.input.index,v.length,r.collectionKey);return Wf(e,v,b,r,t.expectAt),Gf(v[b],"deleted"),v.splice(b,1),w.metadata[r.collectionKey]=v,{changedFields:[r.collectionKey]}}})}catch(w){Cr(w,r.conflictGuidance)}let y=Vt(g.item,r.collectionKey);return hs(g.item.id,r.collectionKey,y,a,t.includeMeta===!0,{action:"delete",entryIndex:r.input.index},t.fullHistory===!0)}let d=r.input.rawValue??r.input.value??"";pS(d,r);let l=r.parseText(r.input.value??"");if(!l.trim())throw new p(`${r.input.emptyFlag??"--add"} text cannot be empty`,m.USAGE);if(r.input.mode==="edit"){let f=r.editOp??r.op,g,y=0;try{g=await ue({pmRoot:i,settings:s,id:e,op:f,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,mutate(b){let T=Vt(b.metadata,r.collectionKey),S=zf(r.input.index,T.length,r.collectionKey);Wf(e,T,S,r,t.expectAt);let A=T[S];return Gf(A,"edited"),T[S]=oS(A,l,c,r.createEntry),y=Kf(r.collectionKey,T,S),b.metadata[r.collectionKey]=T,{changedFields:[r.collectionKey]}}})}catch(b){Cr(b,r.conflictGuidance)}let w=Vt(g.item,r.collectionKey),v=y;return hs(g.item.id,r.collectionKey,w,a,t.includeMeta===!0,{action:"edit",entryIndex:v,entry:w[v-1]},t.fullHistory===!0)}let u,_=0;try{u=await ue({pmRoot:i,settings:s,id:e,op:r.op,author:c,message:t.message,force:t.force,bypassAssigneeConflict:r.bypassOwnershipConflict,skipNoop:t.ifAbsent===!0,mutate(f){let g=hS(f,r.collectionKey,c,l,t.ifAbsent===!0,r.createEntry);return _=Kf(r.collectionKey,g.written,g.position),{changedFields:g.changedFields}}})}catch(f){Cr(f,r.conflictGuidance)}let h=Vt(u.item,r.collectionKey);return hs(u.item.id,r.collectionKey,h,a,t.includeMeta===!0,{action:"add",entryIndex:_,entry:h[_-1],changedCount:t.ifAbsent===!0?Math.min(u.changedFields.length,1):void 0},t.fullHistory===!0)}function zf(e,t,n){if(e===void 0||!Number.isInteger(e)||e<1||e>t){let r=n.replace(/s$/,""),i=`${r.charAt(0).toUpperCase()}${r.slice(1)}`,s=t===1?`1 ${r}`:`${t} ${n}`;throw new p(`${i} index ${e??"(missing)"} out of range (item has ${s})`,m.USAGE)}return e-1}function gS(e,t,n){return t===void 0?{}:{mutation_receipt:{action:t.action,entry_index:t.entryIndex,changed_count:t.changedCount??1,full_history_included:!n},omission_receipt:{has_omissions:n,omitted_field_group_count:n?1:0,omitted_field_groups:n?[{name:`${e}_history`,restore_with:{selector:"full_history",cli_flag:"--full-history",sdk_option:"fullHistory",mcp_option:"full"}}]:[]}}}function Vf(e,t){if(Object.prototype.toString.call(e)!=="[object Object]")return e;let n={index:t,...e};return n.index=t,n}function yS(e,t){let n=e.length-t.length;return t.map((r,i)=>Vf(r,n+i+1))}function hs(e,t,n,r,i,s,o=!1){let a=s===void 0||o?yS(n,aS(n,s!==void 0&&o?void 0:r)):s.entry===void 0?[]:[Vf(s.entry,s.entryIndex)],c=s!==void 0&&a.length<n.length;return{id:e,[t]:a,count:a.length,...s?.changedCount===void 0?{}:{changed:s.changedCount===1},...[i,s!==void 0].includes(!0)?{total_count:n.length,returned_count:a.length,has_more:c||a.length<n.length,...r!==void 0?{limit:r}:{}}:{},...gS(t,s,c)}}import{isDeepStrictEqual as Jf}from"node:util";(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]="90fdc6f3-29d4-5266-a142-d9d14fbb12e7")}catch{}})();var wS=new Set(["__proto__","prototype","constructor"]),ys=Symbol("looseOptionOccurrences");function In(e){return e.trim().toLowerCase().replaceAll(/-([a-z0-9])/g,(t,n)=>n.toUpperCase())}function vS(e,t,n){let r=e[t];if(r===void 0){e[t]=n;return}if(Array.isArray(r)){r.push(n),e[t]=r;return}e[t]=[r,n]}function oc(e,t){let n=e[t];if(!n.startsWith("-")||n==="-"||n==="--")return null;if(!n.startsWith("--")){let o=n.indexOf("=");if(o>=0)return{consumed:1,key:n.slice(1,o).trim(),value:n.slice(o+1),attached:!0};let a=n.slice(1).trim(),c=e[t+1];return typeof c=="string"&&!c.startsWith("-")?{consumed:2,key:a,value:c}:{consumed:1,key:a,value:!0}}let r=n.indexOf("=");if(r>=0)return{consumed:1,key:n.slice(2,r).trim(),value:n.slice(r+1),attached:!0};if(n.startsWith("--no-"))return{consumed:1,key:n.slice(5).trim(),value:!1};let i=n.slice(2).trim(),s=e[t+1];return typeof s=="string"&&!s.startsWith("-")?{consumed:2,key:i,value:s}:{consumed:1,key:i,value:!0}}function gs(e){return wS.has(e)}function ws(e){let t=(typeof e.value_type=="string"?e.value_type:void 0)??(typeof e.type=="string"?e.type:void 0);return $u(t)}function Ar(e){let t=[],n=gn(e.long)??"",r=typeof e.short=="string"?e.short.trim():"";if(n.startsWith("--")){let i=In(n.slice(2));i.length>0&&!gs(i)&&t.push(i)}if(r.startsWith("-")&&!r.startsWith("--")){let i=In(r.slice(1));i.length>0&&!gs(i)&&t.push(i)}return[...new Set(t)]}function GU(e){let t=new Set;for(let n of e)for(let r of Ar(n))t.add(r);return t}function On(e){let t=gn(e.long)??"";if(t.startsWith("--")){let n=In(t.slice(2));if(n.length>0&&!gs(n))return n}return Ar(e)[0]??null}function xr(e){let t=typeof e.long=="string"?e.long.trim():"";if(t.startsWith("--")&&t.length>2)return t;let n=typeof e.short=="string"?e.short.trim():"";return n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function bS(e,t){return[...(t.definitions??e).map(n=>xr(n)).filter(n=>n!==null),...t.inheritedFlags??[]]}function qU(e,t,n,r={}){if(t.length===0)return;let i=new Set,s=new Map,o=[],a=bS(t,r);for(let c of t){let d=Ar(c),l=xr(c);for(let u of d)i.add(u),c.enabled===!1&&s.set(u,l);c.required===!0&&c.enabled!==!1&&d.length>0&&o.push({keys:d,label:l})}for(let c of Object.keys(e)){if(!i.has(c)){let l=a.length>0?` Expected one of: ${[...new Set(a)].join(", ")}.`:"";throw new p(`Unknown option '--${c}' for extension command '${n}'.${l}`,m.USAGE,{code:"unknown_option",flag:`--${c}`,required:`Use a flag the command accepts; run pm contracts --command ${n} --flags-only --json to list them.`})}let d=s.get(c);if(d)throw new p(`Option '${d}' is disabled for extension command '${n}'.`,m.USAGE)}for(let c of o)if(!c.keys.some(d=>Object.hasOwn(e,d)))throw new p(`Missing required option '${c.label}' for extension command '${n}'.`,m.USAGE)}function kS(e){return typeof e=="string"||e==null?e:String(e)}function SS(e){if(typeof e=="number")return e;if(typeof e=="string"&&e.trim().length>0){let t=Number(e);return Number.isFinite(t)?t:e}return e}function Xf(e){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true"||t==="1")return!0;if(t==="false"||t==="0")return!1}return e}var ES={string:kS,number:SS,boolean:Xf};function Yt(e,t){return Array.isArray(e)?e.map(n=>Yt(n,t)):ES[t](e)}function Qf(e,t,n){let r=n?(Array.isArray(e)?e.flat(1/0):[e]).filter(i=>i!=null&&i!==""):Ca(e);return t?r.map(i=>Yt(i,t)):r}function TS(e,t,n,r){return n?Qf(e,t,r):t?Yt(e,t):e}function CS(e,t,n){let r=e[ys];if(!r||r.length===0)return n;let i=new Set(t);return r.filter(s=>i.has(s.key)).map(s=>s.value)}function Zf(e){return or(e).value_arity==="none"}function ac(e,t,n,r,i){let s=xr(e),o=i?` for extension command '${i}'`:"",a=n===!0?"no value":JSON.stringify(n);throw new p(`Option '${s}'${o} expects ${r}; received ${a}.`,m.USAGE,{code:"extension_flag_value_invalid",required:`Pass ${s} ${t==="number"?"<number>":"<true|false|1|0>"}.`,why:`The flag declares value_type ${t} with value_validation strict, so a malformed token is refused before the extension handler runs.`,nextSteps:[`Re-run with a valid ${t} value for ${s}.`,`Run pm ${i??"<command>"} --help to review the declared flag contract.`]})}function cc(e,t){return e.value_validation==="strict"&&t!=="string"}function AS(e,t){let n=e[ys];if(!n)return[];let r=new Set(t);return n.filter(i=>r.has(i.key))}function xS(e,t,n,r){if(Zf(e))for(let i of AS(n,t)){if(i.attached!==!0)continue;let s=e.list===!0&&e.repeatable!==!0?Ca(i.value):[i.value];for(let o of s){let a=Mi(Yt(o,"boolean"),"boolean");a!==null&&ac(e,"boolean",o,a.expected,r)}}}function RS(e,t,n,r,i){let s=Array.isArray(n)?n.flat(1/0):[n],o=r?s:s.flatMap(a=>typeof a=="string"?a.split(","):[a]);for(let a of o)if(typeof a=="string"&&a.trim().length===0){let c=Mi(a,t);ac(e,t,a,c.expected,i)}}function dc(e,t,n,r){if(!cc(e,n))return t;let i=n==="boolean"&&Zf(e),s=o=>{let a=Mi(o,n);return a===null?o:i&&typeof o=="string"?!0:ac(e,n,o,a.expected,r)};return Array.isArray(t)?t.map(s):s(t)}function IS(e,t,n,r){for(let i of n)if(!(i===t||!Object.hasOwn(e,i))){if(Object.hasOwn(e,t)){if(r){let s=e[t],o=e[i];e[t]=[...Array.isArray(s)?s:[s],...Array.isArray(o)?o:[o]].filter(a=>a!=null)}delete e[i];continue}e[t]=e[i],delete e[i]}}function OS(e,t,n=e,r){if(t.length===0)return e;let i=Object.create(null);for(let[o,a]of Object.entries(e))i[o]=a;let s=new Set(t.map(o=>On(o)).filter(o=>o!==null));for(let o of t){let a=On(o);if(a){let c=Ar(o).filter(d=>d===a||!s.has(d));LS(i,o,a,c,n,r)}}return i}function LS(e,t,n,r,i,s){let o=t.list===!0,a=ws(t);a&&!o&&DS(e,t,n,r,a,s),IS(e,n,r,o);let c=t.repeatable===!0;if(!Object.hasOwn(e,n)){t.default!==void 0&&(e[n]=TS(t.default,a,o,c));return}if(a==="boolean"&&cc(t,a)&&xS(t,r,i,s),o){e[n]=NS(t,r,i,e[n],a,c,s);return}a&&(e[n]=dc(t,Yt(e[n],a),a,s))}function DS(e,t,n,r,i,s){for(let o of r)o!==n&&Object.hasOwn(e,o)&&dc(t,Yt(e[o],i),i,s)}function NS(e,t,n,r,i,s,o){let a=CS(n,t,r);i&&cc(e,i)&&RS(e,i,a,s,o);let c=Qf(a,i,s);return i?dc(e,c,i,o):c}function WU(e){let t=Object.create(null),n=[];Object.defineProperty(t,ys,{value:n});let r=0;for(;r<e.length;){let i=oc(e,r);if(!i){r+=1;continue}let s=In(i.key);if(s.length===0||gs(s)){r+=i.consumed;continue}vS(t,s,i.value),n.push({...i,key:s}),r+=i.consumed}return t}function KU(e){let t=[],n=0;for(;n<e.length;){if(e[n]==="--"){t.push(...e.slice(n+1));break}let r=oc(e,n);if(r){n+=Math.max(1,r.consumed);continue}t.push(e[n]),n+=1}return t}function zU(e,t){if(t.length===0)return[...e];let n=new Set,r=new Set;for(let o of t){let a=ws(o);for(let c of Ar(o))n.add(c),a==="boolean"&&r.add(c)}if(n.size===0)return[...e];let i=[],s=0;for(;s<e.length;){if(e[s]==="--"){i.push(...e.slice(s+1));break}let o=oc(e,s);if(o){let a=In(o.key);if(n.has(a)){let c=e[s],d=r.has(a)&&!c.includes("=")?1:o.consumed;s+=d;continue}}i.push(e[s]),s+=1}return i}function lc(e){return On(e)}function Yf(e){return e.trim().toLowerCase().split(/\s+/u).filter(t=>t.length>0).join(" ")}function BU(e,t){let n=Yf(t);if(n.length===0)return[];let r=W(n);return e.flags.filter(i=>W(Yf(i.target_command))===r).flatMap(i=>[...i.flags])}function eh(e,t,n,r){let i=xr(e),[s,o]=n;throw new p(`Options '${s}' and '${o}' both set ${i} for extension command '${r}' with different values.`,m.USAGE,{code:"extension_option_spelling_conflict",required:`Pass ${i} once, under the handler key '${t}'.`,why:`'${s}' and '${o}' are spellings of the same declared flag, and pm refuses to choose between two different values.`,nextSteps:[`Remove '${s}' or '${o}' and pass one value as '${t}'.`,`Run pm contracts --command ${r} --flags-only --json to read each flag's sdk_option key.`]})}function HU(e,t,n){if(t.length===0)return e;let r=PS(t),i=US(e,r,n),s=new Set([...r.long.values()].map(({handlerKey:c})=>c)),o=Object.create(null),a=Object.create(null);for(let[c,d]of Object.entries(i))(s.has(c)?o:a)[c]=d;return $S(o,t,n),Object.assign(a,OS(o,t,MS(o,r),n))}function MS(e,t){let n=new Set([...t.long.values()].map(({handlerKey:s})=>s)),r=Object.entries(e).filter(([s])=>n.has(s)).flatMap(([s,o])=>(Array.isArray(o)?o.flat(1/0):[o]).map(a=>({consumed:1,key:s,value:a,attached:!0}))),i=Object.create(null);return Object.defineProperty(i,ys,{value:r}),i}function $S(e,t,n){for(let r of t){let i=On(r);if(i===null)continue;let s=xr(r),o=Object.hasOwn(e,i);if(r.enabled===!1&&o)throw new p(`Option '${s}' is disabled for extension command '${n}'.`,m.USAGE);if(r.required===!0&&r.enabled!==!1&&!o)throw new p(`Missing required option '${s}' for extension command '${n}'.`,m.USAGE)}}function PS(e){let t={long:new Map,short:new Map},n=(r,i,s)=>{i.length>0&&!r.has(i)&&r.set(i,s)};for(let r of e){let i=On(r);if(i===null)continue;let s={handlerKey:i,definition:r};n(t.long,i,s);let o=typeof r.short=="string"?r.short.trim():"";o.startsWith("-")&&!o.startsWith("--")&&n(t.short,o.slice(1),s)}return t}function sc(e,t){return e.long.get(t)??e.short.get(t.replace(/^-(?!-)/u,""))??e.long.get(In(t.replace(/^-{1,2}/u,"")))}function FS(e,t,n){let r=/^(?:--)?no-(.+)$/u.exec(t)?.[1];if(r===void 0||sc(e,t)!==void 0)return{spelling:t,value:n};let i=sc(e,r),s=Xf(n);return i!==void 0&&ws(i.definition)==="boolean"&&typeof s=="boolean"?{spelling:r,value:!s}:{spelling:t,value:n}}function US(e,t,n){let r=Object.create(null),i=new Map;for(let[s,o]of Object.entries(e)){let{spelling:a,value:c}=FS(t,s,o),d=sc(t,a);if(d===void 0)r[a]=c;else if(c!==void 0){let l=i.get(d.handlerKey);l===void 0?(i.set(d.handlerKey,a),r[d.handlerKey]=c):Jf(r[d.handlerKey],c)||eh(d.definition,d.handlerKey,[l,a],n)}}return r}function jS(e){let t=new Map;for(let n of e){let r=On(n);if(r===null)continue;let i={definition:n,handlerKey:r,kind:ws(n),arity:or(n).value_arity,scalar:n.list!==!0},s=[gn(n.long),typeof n.short=="string"?n.short.trim():""];for(let o of s.filter(a=>a?.startsWith("-")===!0))t.has(o)||t.set(o,i)}return t}function GS(e,t,n){let r=e.optionOf(n),i=t.get(n),s=i?.scalar===!0?i:void 0;if(r!==void 0){let o={arity:r.arity,...r.variadic===!0?{variadic:!0}:{}};if(s?.handlerKey===r.key)return{...o,declared:s};let a=i===void 0&&n.startsWith("--no-")?t.get(`--${n.slice(5)}`):void 0;return a?.scalar===!0&&a.kind==="boolean"&&a.handlerKey===r.key?{...o,declared:a,negates:!0}:o}if(!(!e.includesLooseFlags||i===void 0))return s===void 0?{arity:i.arity,loose:!0}:{arity:i.arity,declared:s,loose:!0}}function uc(e){return e.length>1&&e.startsWith("-")}var th=/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/u;function qS(e,t,n){let{tokens:r}=e,i=0,s,o=!1,a=!1;for(;i<r.length||s!==void 0;){let c=s??r[i++];if(c==="--")return;if(a&&s===void 0&&WS(e,c))continue;let d=uc(c)?zS(e,c,r[i],t,n):{consumedByCommander:!1,consumed:0};if(i+=d.consumed,s=d.group,a=d.variadic===!0,!d.consumedByCommander){if(KS(e.stop,c,o))return;o=!0}}}function WS(e,t){return!uc(t)||e.negativeNumbersAreValues&&th.test(t)}function KS(e,t,n){return e!==void 0&&(e.atFirstUnrecognized||!n&&e.atSubcommand(t))}function zS(e,t,n,r,i){let s=BS(t,n,r);if(s!==void 0)return i(s.spelling,s.entry,s.value),{consumedByCommander:!1,consumed:s.consumed};let o=r(t);if(o!==void 0){let a=o.arity==="required"||o.arity==="optional"&&n!==void 0&&(!uc(n)||e.negativeNumbersAreValues&&th.test(n));return i(t,o,o.negates===!0?!1:a?n:!0),{consumedByCommander:!0,consumed:a?1:0,variadic:o.variadic===!0}}return t[1]!=="-"?{consumed:0,...HS(t,r,i)}:{consumedByCommander:VS(t,r,i,e.includesLooseFlags?i:()=>{}),consumed:0}}function BS(e,t,n){let r=e.indexOf("="),i=r>1?e.slice(0,r):e,s=n(i);if(s?.loose===!0)return r>1?{spelling:i,entry:s,value:e.slice(r+1),consumed:0}:t!==void 0&&!t.startsWith("-")?{spelling:i,entry:s,value:t,consumed:1}:{spelling:i,entry:s,value:!0,consumed:0};let o=r<0&&e.startsWith("--no-")?n(`--${e.slice(5)}`):void 0;return o?.loose===!0&&o.declared?.kind==="boolean"?{spelling:e,entry:o,value:!1,consumed:0}:void 0}function HS(e,t,n){let r=e.slice(0,2),i=e.length>2?t(r):void 0;return i===void 0||i.loose===!0?{consumedByCommander:!1}:i.arity!=="none"?(n(r,i,e.slice(2)),{consumedByCommander:!0}):(n(r,i,!0),{consumedByCommander:!0,group:`-${e.slice(2)}`})}function VS(e,t,n,r){let i=e.indexOf("=");if(i>2){let o=e.slice(0,i),a=t(o);return a!==void 0&&a.arity!=="none"?(n(o,a,e.slice(i+1)),!0):(a?.declared?.kind==="boolean"&&r(o,a,e.slice(i+1)),!1)}let s=e.startsWith("--no-")?t(`--${e.slice(5)}`):void 0;return s?.declared?.kind==="boolean"&&r(e,s,!1),!1}function VU(e,t,n){let r=jS(t),i=new Map;for(let s of e)qS(s,o=>GS(s,r,o),(o,a,c)=>{a.declared!==void 0&&YS(i,a.declared,o,c,n)})}function YS(e,t,n,r,i){let{definition:s,handlerKey:o,kind:a}=t,c=a?Yt(r,a):r,d=e.get(o)??new Map,l=[...d].find(([u,_])=>u!==n&&!Jf(_,c));l!==void 0&&eh(s,o,[l[0],n],i),d.set(n,c),e.set(o,d)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0c0bb7ab-6157-5861-ad7e-a63ae62220f4")}catch{}})();var JS=new Set(["claim","close","context","create","get","help","init","list","next","plan","release","search","update","validate","workspace"]),XS=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"]),QS=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"])}),ZS=new Set(["extension","install","package","packages","upgrade"]);function eE(e){let t=W(e.trim().toLowerCase());if(t==="ops")return"quality";for(let[n,r]of Object.entries(QS))if(r.has(t))return n;return ZS.has(t)?"extensions":"internal"}var Ln=Object.freeze([...Je.flatMap(e=>e==="item"?["item","item-reopen"]:[e,...Ye.filter(t=>t.alias===e).map(t=>t.canonical)]).map(e=>({command:e,tier:JS.has(W(e))?"core":XS.has(W(e))?"standard":"full",family:eE(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"}]),tE=Ln,nh=Object.freeze({max_lines:50,max_utf8_bytes:6e3}),QU=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"]);function ZU(e){let t=e===""?0:e.split(/\r?\n/).length,n=Buffer.byteLength(e,"utf8");return{lines:t,utf8_bytes:n,within_budget:t<=nh.max_lines&&n<=nh.max_utf8_bytes}}var rh={core:0,standard:1,full:2,internal:3},ih=new Map(tE.map(({command:e,tier:t})=>[e,t]));function mc(e,t="standard"){return ih.get(e.trim().toLowerCase())??ih.get(W(e.trim().toLowerCase()))??t}function ej(e){return sh(e,Ln)}function sh(e,t){let n=rh[e];return t.filter(r=>r.tier!=="internal"&&rh[r.tier]<=n).map(r=>r.command)}function tj(e){return oh(e,Ln)}function oh(e,t){return t.filter(n=>n.family===e).map(n=>n.command)}var nE=["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],rE=new Set([...Ft.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 nj(e=Ln){return nE.map(t=>({family:t,commands:oh(t,e).filter(n=>e.find(r=>r.command===n)?.tier!=="internal"&&!rE.has(n))})).filter(({commands:t})=>t.length>0)}var iE=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"});function rj(e,t){return sE(e,t,Ln)}function sE(e,t,n){if(t==="full")return[...e];let r=new Set(sh(t,n));return e.filter(i=>{let s=iE[i];return s!==void 0&&r.has(s)})}var ij=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"}]),sj=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."}]);function oj(){return oE(Ln)}function oE(e){return["# Generated agent command surface","","This file is generated from `PM_COMMAND_CAPABILITY_CONTRACTS`. Do not edit it manually.","","| Command | Minimum visibility tier | Capability family |","| --- | --- | --- |",...e.map(({command:t,tier:n,family:r})=>`| \`${t}\` | ${n} | ${r} |`),""].join(`
2
+ `)}(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 pc=[{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"}],aE=new Map(pc.map(e=>[e.exit_code,e.class]));function vs(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort()}function cE(e){if(!e)return[];let t=new Set,n=new Set;return e.map(r=>{let i=r.state.trim(),s=r.probe_id.trim(),o=vs(r.entrypoints);if(!/^[a-z][a-z0-9_]*$/.test(i)||!/^[a-z][a-z0-9-]*$/.test(s)||o.length===0||t.has(i)||n.has(s))throw new TypeError("Invalid pm refusal state contract");return t.add(i),n.add(s),{state:i,probe_id:s,entrypoints:o,expected_exit_class:r.expected_exit_class}}).sort((r,i)=>r.state.localeCompare(i.state))}function dE(e,t,n,r,i){return![[1,2,3,4,5].includes(e.exit_code),e.meaning.trim().length>0,e.recovery.trim().length>0,t.length>0,n.length>0,/^[a-z][a-z0-9_]*$/.test(r),i.every(s=>/^[a-z][a-z0-9_]*$/.test(s)),aE.get(e.exit_code)===e.class].includes(!1)}function lE(e,t){let n=e,r=new Set;for(;n.canonical_code!==n.code;){if(r.has(n.code))throw new TypeError(`Alias cycle in pm error code catalog: ${e.code}`);r.add(n.code);let i=t.get(n.canonical_code);if(!i)throw new TypeError(`Invalid pm error code contract: ${e.code}`);n=i}return n}function uE(e){let t=new Map(e.map(n=>[n.code,n]));for(let n of e){let r=lE(n,t);if(r.exit_code!==n.exit_code||r.class!==n.class)throw new TypeError(`Alias transport mismatch for pm error code: ${n.code}`);let i=e.filter(s=>s.code!==r.code&&s.canonical_code===r.code).map(s=>s.code).sort();if(n.code===r.code?JSON.stringify(n.aliases)!==JSON.stringify(i):n.aliases.length>0)throw new TypeError(`Invalid pm error code contract: ${n.code}`)}}function ch(e){let t=new Set,n=e.map(r=>{let i=r.code.trim();if(!/^[a-z][a-z0-9_]*$/.test(i))throw new TypeError(`Invalid pm error code: ${JSON.stringify(r.code)}`);if(t.has(i))throw new TypeError(`Duplicate pm error code: ${i}`);t.add(i);let s=vs(r.sources),o=vs(r.emitting_commands),a=(r.canonical_code??i).trim(),c=vs(r.aliases??[]),d=cE(r.owned_states);if(!dE(r,s,o,a,c))throw new TypeError(`Invalid pm error code contract: ${i}`);if(d.some(l=>l.expected_exit_class!==r.class))throw new TypeError(`Invalid pm refusal state exit class: ${i}`);return Object.freeze({...r,code:i,meaning:r.meaning.trim(),recovery:r.recovery.trim(),sources:s,emitting_commands:o,canonical_code:a,aliases:c,owned_states:d})});return uE(n),Object.freeze(n.sort((r,i)=>r.code.localeCompare(i.code)))}function cj(e,t){let n=ah(e,t);return ah(n.canonical_code??n.code,t)}function ah(e,t){let n=e.trim(),r=t.find(i=>i.code===n);if(!r)throw new TypeError(`Unknown pm error code "${n}"`);return r}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0b0d726a-0fd5-5196-bee1-d34c433c0016")}catch{}})();var mE="Inspect the structured error guidance, then retry the suggested command when one is present.",pE=new Map(pc.map(e=>[e.exit_code,e.class]));function dh(e){return e.map(t=>{let n=`${t.code.replaceAll("_"," ")} condition.`,r={code:t.code,meaning:`${n.charAt(0).toUpperCase()}${n.slice(1)}`,stability:t.stable?"stable":"provisional",exit_code:t.exit_code,class:pE.get(t.exit_code),recovery:mE,sources:t.sources,emitting_commands:t.emitting_commands??["*"],canonical_code:t.canonical_code??t.code,aliases:t.aliases??[]};return t.owned_states&&(r.owned_states=t.owned_states),r})}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="84712a38-e3a5-542c-8f9b-76f7e83cc725")}catch{}})();var lh=[{code:"acceptance_criteria_mutation_conflict",exit_code:2,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_remove_unmatched",exit_code:3,sources:["sdk/lifecycle/update-many.ts","sdk/lifecycle/update.ts"],emitting_commands:["update","update-many"]},{code:"acceptance_criteria_semicolon_forbidden",exit_code:2,stable:!0,sources:["core/item/parse.ts"]},{code:"accepted_rejected_value",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"alias_collision",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"alias_target_missing",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"already_claimed_by",exit_code:4,stable:!0,sources:["sdk/lifecycle/claim.ts"],emitting_commands:["claim"]},{code:"ambiguous_option_combination",exit_code:2,stable:!0,sources:["sdk/lifecycle/claim.ts","sdk/lifecycle/plan.ts"],emitting_commands:["claim","plan"]},{code:"annotation_alias_conflict",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"annotation_entry_mismatch",exit_code:4,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_invalid",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_expectation_without_target",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_flag_like_value",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_if_absent_without_append",exit_code:2,sources:["sdk/annotations.ts"]},{code:"annotation_message_without_text",exit_code:2,stable:!0,sources:["sdk/annotations.ts"]},{code:"annotation_text_source_conflict",exit_code:2,sources:["sdk/runtime-input.ts"]},{code:"annotation_transposed_subcommand",exit_code:2,sources:["cli/register-annotations.ts"]},{code:"append_empty_body",exit_code:2,stable:!0,sources:["sdk/lifecycle/append.ts"],emitting_commands:["append"]},{code:"assurance_registry_invalid",exit_code:1,sources:["sdk/governance/assurance.ts"]},{code:"bare_comma_entry_ambiguous",exit_code:2,sources:["core/item/parse.ts"]},{code:"blocker_identity_read_failed",exit_code:1,sources:["sdk/query/declared-blockers.ts"]},{code:"body_file_conflicts_with_body",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_missing_path",exit_code:2,stable:!0,sources:["core/io/body-file.ts"]},{code:"body_file_unreadable",exit_code:3,stable:!0,sources:["core/io/body-file.ts"]},{code:"budget_exceeded",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"bulk_create_route",exit_code:2,sources:["cli/register-mutation.ts"]},{code:"bulk_ids_input_empty",exit_code:2,sources:["core/io/bulk-ids-input.ts","sdk/history-compact.ts","sdk/history-mcp.ts"],owned_states:[{state:"bulk_ids_stdin_contains_no_nonempty_ids",probe_id:"bulk-ids-stdin-empty",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_missing_path",exit_code:2,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_token_omits_its_path",probe_id:"bulk-ids-file-path-missing",entrypoints:["update-many"],expected_exit_class:"usage"}]},{code:"bulk_ids_input_unreadable",exit_code:3,sources:["core/io/bulk-ids-input.ts"],owned_states:[{state:"bulk_ids_file_path_cannot_be_read",probe_id:"bulk-ids-file-unreadable",entrypoints:["update-many"],expected_exit_class:"not_found"}]},{code:"bundle_integrity_torn_install",exit_code:1,stable:!0,sources:["cli/bundle-integrity.ts"]},{code:"capability_undeclared",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"capability_unused",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"child_projection_item_bound_exceeded",exit_code:1,stable:!0,sources:["sdk/item-children.ts"]},{code:"close_reason_required",exit_code:2,stable:!0,sources:["sdk/lifecycle-policy.ts","sdk/lifecycle/close-many.ts"],emitting_commands:["*","close-many"]},{code:"close_through_update",exit_code:1,stable:!0,sources:["core/telemetry/observability.ts"]},{code:"close_validation_missing_fields",exit_code:2,stable:!0,sources:["sdk/lifecycle/close.ts"],emitting_commands:["close"]},{code:"collected_zero_items",exit_code:1,stable:!0,sources:["sdk/test/execution-receipts.ts"]},{code:"collection_transposed_subcommand",exit_code:2,sources:["cli/error-guidance.ts"]},{code:"command_failed",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"command_namespace",exit_code:2,stable:!0,sources:["sdk/cli-contracts/runtime-contracts.ts"]},{code:"command_override_conflict",exit_code:4,stable:!0,sources:["sdk/compose.ts"]},{code:"config_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"config_key_unknown",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts","sdk/config.ts"]},{code:"config_value_invalid",exit_code:2,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"conflicting_lifecycle_owner",exit_code:2,stable:!0,sources:["cli/register-operations.ts"]},{code:"context_evaluation_read_incomplete",exit_code:2,sources:["sdk/context-relevance.ts"]},{code:"context_signal_store_invalid",exit_code:2,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_stale",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_signal_store_write_failed",exit_code:1,sources:["sdk/context-signal-store.ts"]},{code:"context_takes_no_item_argument",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"core_item_field_requires_dedicated_flag",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"create_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:["sdk/extension/command-options.ts"]},{code:"extension_install_incomplete_source_scan",exit_code:2,sources:["sdk/extension/install-plan.ts"]},{code:"extension_install_rollback_failed",exit_code:1,sources:["sdk/extension/install-snapshot.ts"]},{code:"extension_install_soft_failed",exit_code:1,stable:!0,sources:["cli/register-setup.ts"]},{code:"extension_install_source_contains_destination",exit_code:2,stable:!0,sources:["sdk/extension/install-runtime.ts"]},{code:"extension_item_field_reserved",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_type_conflict",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_item_field_unknown",exit_code:2,stable:!0,sources:["core/extensions/item-fields.ts"]},{code:"extension_mutation_guard_failed",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_decision",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_invalid_denial",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_mutation_guard_timed_out",exit_code:4,stable:!0,sources:["core/extensions/extension-hook-runtime.ts"]},{code:"extension_option_spelling_conflict",exit_code:2,sources:["sdk/extension/command-options.ts"]},{code:"extension_read_output_invalid",exit_code:2,sources:["sdk/read-output/extension.ts"]},{code:"extension_update_health_partial_coverage",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"extensions_unreadable",exit_code:1,sources:["sdk/extension/static-inventory.ts"]},{code:"field_duplicate",exit_code:1,stable:!0,sources:["core/profile/profile-lint.ts"]},{code:"field_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/history-redact.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"]}];(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]="853917f6-6746-52c8-a2ce-df083ecbe6a6")}catch{}})();var uh=[{code:"merge_reconcile_receipt_evidence_untrusted",exit_code:4,sources:["sdk/history-repair.ts"]},{code:"merge_root_not_found",exit_code:3,stable:!0,sources:["sdk/merge/install.ts"]},{code:"merge_settlement_hook_conflict",exit_code:4,sources:["sdk/merge/settlement-hook.ts"]},{code:"merge_settlement_review_required",exit_code:4,sources:["sdk/merge/ignored-artifacts.ts","sdk/merge/reconcile.ts","sdk/merge/stage.ts"]},{code:"missing_allowed_values",exit_code:1,sources:["sdk/agent/refusal-closure.ts"]},{code:"missing_budget",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"missing_cli_flag",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_destination",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_directory",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"missing_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_lifecycle_target",exit_code:2,stable:!0,sources:["sdk/extension.ts"]},{code:"missing_observation",exit_code:1,sources:["sdk/flag-invocation-contracts.ts"]},{code:"missing_observed_signature",exit_code:1,sources:["sdk/cli-contracts/grammar-contracts.ts"]},{code:"missing_parameter_alias",exit_code:1,sources:["sdk/cli-contracts/tool-option-contracts.ts"]},{code:"missing_positive_execution_receipt",exit_code:1,sources:["sdk/test/execution.ts"]},{code:"missing_probe",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"missing_required_argument",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","cli/main.ts","cli/register-mutation.ts","cli/schema/registration.ts","core/telemetry/observability.ts","sdk/governance/assurance-action.ts","sdk/history-redact.ts","sdk/invocation-author.ts","sdk/lifecycle/claim.ts"],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:"read_output_mutation_conflict",exit_code:2,sources:["sdk/read-output-contracts.ts"]},{code:"recovery_kind_mismatch",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"redundant_edge",exit_code:1,stable:!0,sources:["sdk/graph/remediation.ts"]},{code:"refusal_allowed_values_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_error_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_exit_code_mismatch",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_mutated_state",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_probe_missing",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"refusal_recovery_failed",exit_code:1,sources:["sdk/agent/refusal-corpus-contracts.ts"]},{code:"reindex_already_running",exit_code:4,stable:!0,sources:["sdk/governance/reindex.ts"]},{code:"removed_canonical_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"removed_compatibility_spelling",exit_code:1,sources:["sdk/cli-contracts/flag-lexicon-contracts.ts"]},{code:"reopen_reason_required",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reopen_receipt_missing",exit_code:1,sources:["sdk/lifecycle/update.ts"],emitting_commands:["update"]},{code:"reopen_target_status_invalid",exit_code:2,sources:["sdk/lifecycle/reopen.ts"],emitting_commands:["item reopen"]},{code:"reported_zero_passes",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reported_zero_tests",exit_code:1,sources:["sdk/test/execution-receipts.ts"]},{code:"reserved_item_field",exit_code:1,stable:!0,sources:["sdk/compose.ts"]},{code:"retry_failed",exit_code:1,sources:["sdk/agent/refusal-closure.ts","sdk/agent/tracker-preflight-contracts.ts"]},{code:"schema_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","sdk/extension/command-options.ts"],owned_states:[{state:"declared_option_is_rejected_on_the_selected_command_path",probe_id:"cross-command-unknown-option",entrypoints:["deps"],expected_exit_class:"usage"}]},{code:"unknown_plan_template",exit_code:2,stable:!0,sources:["sdk/lifecycle/plan.ts"],emitting_commands:["plan"]},{code:"unknown_provenance_dimension",exit_code:2,stable:!0,sources:["sdk/history-provenance.ts"]},{code:"unknown_status",exit_code:3,stable:!0,sources:["sdk/schema.ts"]},{code:"unknown_subcommand",exit_code:2,stable:!0,sources:["cli/error-guidance.ts","sdk/agent/subcommand-recovery.ts"],aliases:["unknown_lifecycle_action"],owned_states:[{state:"config_action_token_is_not_declared",probe_id:"config-unknown-action",entrypoints:["config"],expected_exit_class:"usage"},{state:"graph_command_token_is_not_declared",probe_id:"graph-unknown-subcommand",entrypoints:["graph"],expected_exit_class:"usage"},{state:"nested_command_token_is_not_declared_by_its_family",probe_id:"schema-unknown-subcommand",entrypoints:["schema"],expected_exit_class:"usage"},{state:"package_lifecycle_token_is_not_declared",probe_id:"package-unknown-action",entrypoints:["package"],expected_exit_class:"usage"}]},{code:"unsafe_init_recovery",exit_code:1,sources:["sdk/agent/tracker-preflight-contracts.ts"]},{code:"unsupported_update_option",exit_code:1,stable:!0,sources:["cli/error-guidance.ts"]},{code:"upsert_key_ambiguous",exit_code:4,sources:["sdk/structured-mutations.ts"]},{code:"upsert_key_conflict",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"upsert_key_duplicate",exit_code:2,sources:["sdk/item-transaction.ts","sdk/structured-mutations.ts"]},{code:"upsert_key_missing",exit_code:2,sources:["sdk/structured-mutations.ts"]},{code:"upsert_match_changed",exit_code:4,sources:["sdk/item-transaction.ts"]},{code:"validate_command_references_stale_pm_ids",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_missing_linked_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_orphaned_paths",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_files_tracked_all_strict_forces_pm_internals",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_format_version_ahead_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_ahead_format_version"},{code:"validate_format_version_outdated_items",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"integrity_item_outdated_format_version"},{code:"validate_hierarchy_parent_cycle",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_hierarchy_parent_cycle_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_history_drift_chain_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_chain_mismatch"},{code:"validate_history_drift_hash_mismatches",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_hash_mismatch"},{code:"validate_history_drift_missing_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_missing_stream"},{code:"validate_history_drift_unreadable_streams",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_unreadable_stream"},{code:"validate_history_drift_version_skews",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_drift_version_skew"},{code:"validate_history_unknown_author_events",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"],canonical_code:"history_unknown_author_events"},{code:"validate_lifecycle_active_closure_like_metadata",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_active_terminal_parent",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_dependency_cycles_error",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_lifecycle_stale_blockers",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_decisions_unreviewed",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_driver_configuration",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_merge_fence_drift",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_custom_profile_missing_required_fields",exit_code:2,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_duplicate_issue_codes",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_acceptance_criteria",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_close_reason",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_closed_at",exit_code:1,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_confidence",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_estimate",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_release",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_reviewer",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_risk",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_metadata_missing_sprint",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_resolution_missing_fields",exit_code:1,stable:!0,sources:["core/diagnostics/remediation.ts"]},{code:"validate_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 mh=ch(dh([...lh,...uh]));(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 _E=["mutation_receipt","entity","collection","diagnostic","stream"],fE=new Set(["append","claim","close","close-task","copy","create","delete","focus","pause-task","release","restore","start-task","update"]),hE=new Set(["close-many","update-many"]),gE=new Set(["activity","comments","contracts","events","history","learnings","list","notes","search"]),yE=new Set(["aggregate","deps","graph","health","history-redact","history-repair","history-compact","stats","validate"]);function Rr(e){if(e.command.trim().length===0)throw new TypeError("command must be a non-empty command path");if(!_E.includes(e.kind))throw new TypeError(`Unsupported output envelope kind: ${e.kind}`);return e}function ph(e){let t=e.trim().replace(/\s+/gu," "),[n=t]=t.split(" ");return hE.has(n)?Rr({command:t,kind:"collection",wrapper_key:"rows",cardinality:"many",format_flag:"--json"}):fE.has(n)?Rr({command:t,kind:"mutation_receipt",wrapper_key:null,cardinality:"one",format_flag:"--json"}):gE.has(n)?Rr({command:t,kind:"collection",wrapper_key:n==="contracts"?null:"items",cardinality:"many",format_flag:"--json"}):yE.has(n)?Rr({command:t,kind:"diagnostic",wrapper_key:null,cardinality:"none",format_flag:"--json"}):Rr({command:t,kind:n==="get"?"entity":"diagnostic",wrapper_key:n==="get"?"item":null,cardinality:n==="get"?"one":"none",format_flag:"--json"})}var wE=Je.map(e=>ph(e)),vE=new Map(wE.map(e=>[e.command,e]));function _h(e){let t=e.trim().replace(/\s+/gu," ");if(t.length===0)throw new TypeError("command must be a non-empty command path");let[n=t]=bi(t).split(" "),r=vE.get(n);return r?{...r,command:t}:ph(t)}function bE(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function kE(e){return bE(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 bj(e){let t=e;if(typeof e=="string")try{t=JSON.parse(e)}catch(n){throw new TypeError(`Mutation receipt must be valid JSON: ${String(n)}`,{cause:n})}if(!kE(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]="7c95b311-b408-50f7-87e8-2c2fa2323092")}catch{}})();var _c=[{exit_code:m.SUCCESS,outcome:"effect",success:!0,meaning:"The requested operation completed with its intended effect."},{exit_code:m.GENERIC_FAILURE,outcome:"internal_failure",success:!1,meaning:"An unexpected runtime or internal failure prevented completion."},{exit_code:m.USAGE,outcome:"refused_input",success:!1,meaning:"The invocation was refused because its input or composition was invalid."},{exit_code:m.NOT_FOUND,outcome:"refused_tracker_state",success:!1,meaning:"The requested tracker, item, or resource was not present."},{exit_code:m.CONFLICT,outcome:"conflict",success:!1,meaning:"Current state or concurrency prevented the requested effect."},{exit_code:m.DEPENDENCY_FAILED,outcome:"dependency_failed",success:!1,meaning:"A required dependency operation failed."},{exit_code:m.NO_EFFECT,outcome:"no_effect",success:!0,meaning:"The request was valid and completed, but matched nothing to change."},{exit_code:m.PARTIAL_EFFECT,outcome:"partial_effect",success:!0,meaning:"The request completed and changed some, but not all, selected targets."}],fh=[m.SUCCESS,m.GENERIC_FAILURE,m.USAGE,m.NOT_FOUND,m.CONFLICT,m.DEPENDENCY_FAILED],SE=new Set(["close-many","update-many"]),gh=Je.map(e=>({command:e,exit_codes:SE.has(e)?[...fh,m.NO_EFFECT,m.PARTIAL_EFFECT]:[...fh]})),hh=new Map(gh.map(e=>[e.command,e])),EE=[m.SUCCESS,m.NO_EFFECT,m.PARTIAL_EFFECT];function Tj(e){return EE.includes(e)}function Cj(e){return _c.some(t=>t.exit_code===e)}function yh(e){let t=e.trim().toLowerCase().split(/\s+/u).filter(Boolean).join(" ");return hh.get(t)??hh.get(t.split(" ")[0])}function Aj(e,t=Je,n=gh){let r=new Map(n.map(c=>[c.command,c])),i=t.filter(c=>!r.has(c)),s=e.filter(c=>{let d=r.get(c.command)??r.get(c.command.split(" ")[0]);return d===void 0||!d.exit_codes.includes(c.exit_code)}),o=new Set(e.map(c=>c.exit_code)),a=[...new Set(n.flatMap(c=>c.exit_codes))].filter(c=>!o.has(c)).sort((c,d)=>c-d);return{ok:i.length===0&&s.length===0&&a.length===0,missing_commands:i,undeclared_observations:s,unreachable_exit_codes:a}}function xj(e){return e.applied===0&&e.failed>0?{outcome:"dependency_failed",exit_code:m.DEPENDENCY_FAILED}:e.applied===0?{outcome:"no_effect",exit_code:m.NO_EFFECT}:e.skipped>0||e.failed>0||e.unmatched>0?{outcome:"partial_effect",exit_code:m.PARTIAL_EFFECT}:{outcome:"effect",exit_code:m.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]="081bf1eb-4b9a-5fa9-a272-34ae781d250c")}catch{}})();var L=class extends TypeError{constructor(t){super(t),this.name="AssuranceMutationRefusalError"}},Re=class extends TypeError{context;constructor(t,n={}){super(t),this.name="AssuranceEvaluationRefusalError",this.context=n}},nt=class extends TypeError{measurement_id;source_kind;field;check;constructor(t,n){super(t),this.name="AssuranceSourceResolutionError",this.measurement_id=n.measurement_id,this.source_kind=n.source_kind,this.field=n.field,this.check=n.check}};async function Dn(e){try{return await e()}catch(t){throw t instanceof L?new p(t.message,m.USAGE,{code:"invalid_argument_value",reason:"assurance_mutation_refused"}):t}}async function fc(e){try{return await e()}catch(t){throw t instanceof Re?new p(t.message,m.USAGE,{code:"invalid_argument_value",reason:"assurance_evaluation_refused",...t.context}):t}}import{createHash as TE}from"node:crypto";import CE 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]="b00dcab2-22c6-55b7-b93d-f6f5413d4b04")}catch{}})();var Nn=1e3;(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]="eaede7d4-43ae-5551-915e-19befefc29d0")}catch{}})();var vh=1,_t=["pre-commit","pre-push","pre-merge","ci","pre-release","post-release","scheduled","on-claim","on-close"],Ir=["items","dependency_kind","prose_edge_gap","graph","validate","health","history","links","provider","derived"],AE=["ceiling","floor","equals","zero","monotone_nondecreasing","monotone_nonincreasing","subset_of"],xE=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/,bs=30,ks=5e3,bh=4,RE=50;function ft(e,t){if(!xE.test(e))throw new L(`${t} must be a stable lowercase id`)}function IE(e,t){if(!Number.isFinite(e)||e<0)throw new L(`${t} must be a finite non-negative number`)}function Or(e){let t=AE.filter(i=>e[i]!==void 0);if(t.length!==1)throw new L(`assertion ${e.id} must declare exactly one polarity`);let n=t[0],r=e[n];return{polarity:n,value:n==="zero"?0:r}}function gc(e,t){return ne(e)===ne(t)}function kh(e,t){if(t.polarity==="equals")return gc(e,t.value);if(t.polarity==="subset_of"){if(!Array.isArray(e)||!Array.isArray(t.value))return!1;let r=t.value;return e.every(i=>r.includes(i))}if(typeof e!="number")return!1;let n=t.value;return t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?e<=n:t.polarity==="floor"||t.polarity==="monotone_nondecreasing"?e>=n:e===0}function Sh(e){let t=Or(e),n=e.negative_control.cases;return n.some(r=>r.expected==="pass")&&n.some(r=>r.expected==="fail")&&n.every(r=>kh(r.observed,t)===(r.expected==="pass"))}function OE(e,t){if(e.polarity!==t.polarity)return!0;if(typeof e.value=="number"&&typeof t.value=="number")return e.polarity==="ceiling"||e.polarity==="monotone_nonincreasing"?t.value>e.value:e.polarity==="floor"||e.polarity==="monotone_nondecreasing"?t.value<e.value:t.value!==e.value;if(e.polarity==="subset_of"){let n=e.value,r=t.value;return!Array.isArray(n)||!Array.isArray(r)||r.some(i=>!n.includes(i))}return!gc(e.value,t.value)}function LE(e,t){if(e.measurement_id!==t.measurement_id||e.owner_item_id!==t.owner_item_id||ne(e.scope)!==ne(t.scope))return!0;let n={observe:0,warn:1,block:2},r=(e.lifetime??"hold")==="hold"&&(t.lifetime??"hold")==="retire";return OE(Or(e),Or(t))||n[t.enforcement]<n[e.enforcement]||r}function DE(e){if(e.state!==void 0&&!(e.state==="present"||e.state==="missing"))throw new L("items source state must be present or missing");let t=Object.hasOwn(e,"equals"),n=e.state!==void 0,r=Number(t)+Number(n);if(e.field!==void 0&&r!==1)throw new L("items source with field requires exactly one of equals or state");if(e.field===void 0&&r!==0)throw new L("items source equals/state requires field")}function NE(e){if(typeof e.dependency_kind!="string"||e.dependency_kind.trim().length===0)throw new L("dependency_kind source requires dependency_kind");if([e.source_kind,e.source_kind_prefix,e.source_kind_state].filter(t=>t!==void 0).length>1)throw new L("dependency_kind source accepts at most one source_kind predicate");if(e.source_kind!==void 0&&e.source_kind.trim().length===0||e.source_kind_prefix!==void 0&&e.source_kind_prefix.trim().length===0)throw new L("dependency_kind source provenance values must not be empty");if(e.source_kind_state!==void 0&&e.source_kind_state!=="present"&&e.source_kind_state!=="missing")throw new L("dependency_kind source source_kind_state must be present or missing")}function ME(e){if(e.sample_limit!==void 0&&(!Number.isInteger(e.sample_limit)||e.sample_limit<1))throw new L("prose_edge_gap sample_limit must be a positive integer");for(let t of e.exemptions??[]){if(typeof t.holder_id!="string"||t.holder_id.trim().length===0||typeof t.reason!="string"||t.reason.trim().length===0)throw new L("prose_edge_gap exemptions require holder_id and reason");if(t.target_id!==void 0&&t.target_id.trim().length===0||t.text_contains!==void 0&&t.text_contains.trim().length===0)throw new L("prose_edge_gap exemption selectors must not be empty")}}function yc(e){ft(e.id,"measurement.id"),e.max_cost!==void 0&&IE(e.max_cost,"measurement.max_cost");let t=e.source;if(Object.prototype.toString.call(t)!=="[object Object]")throw new L(`measurement.source.kind must be one of ${Ir.join(", ")}`);let n=Reflect.get(t,"kind");if(!Ir.includes(n))throw new L(`measurement.source.kind must be one of ${Ir.join(", ")}`);let r=t;if(r.kind==="items"&&DE(r),r.kind==="dependency_kind"&&NE(r),r.kind==="prose_edge_gap"&&ME(r),(r.kind==="graph"||r.kind==="validate"||r.kind==="health")&&(typeof r.field!="string"||r.field.trim().length===0))throw new L(`${r.kind} source requires field`);return r.kind==="provider"&&(ft(r.provider,"provider source provider"),ft(r.key,"provider source key")),e}function wc(e){if(ft(e.id,"assertion.id"),ft(e.measurement_id,"assertion.measurement_id"),typeof e.owner_item_id!="string"||e.owner_item_id.trim().length===0)throw new L("assertion.owner_item_id is required");let t=Or(e);if(typeof t.value=="number"&&!Number.isFinite(t.value))throw new L(`assertion.${t.polarity} must be a finite number`);if(e.lifetime==="retire"&&(typeof e.retire_reason!="string"||e.retire_reason.trim().length===0))throw new L("retired assertion requires retire_reason");e.scope.kind==="filter"&&ft(e.scope.measurement_id,"assertion.scope.measurement_id");let n=e.negative_control?.cases;if(!Array.isArray(n)||!n.some(r=>r.expected==="pass")||!n.some(r=>r.expected==="fail"))throw new L("assertion negative control requires pass and fail cases");if(!Sh(e))throw new L(`assertion ${e.id} negative control does not prove its bound`);return e}function $E(e){if(!Array.isArray(e.allowed_providers))throw new L("gate provider_policy.allowed_providers must be an array");for(let t of e.allowed_providers)ft(t,"gate.provider_policy.allowed_provider");if(typeof e.triggers!="object"||e.triggers===null||Array.isArray(e.triggers))throw new L("gate provider_policy.triggers must be an object");for(let[t,n]of Object.entries(e.triggers)){if(!_t.includes(t))throw new L(`gate provider policy has unknown trigger ${t}`);if(typeof n!="object"||n===null||!["low","medium","high"].includes(n.max_cost_class)||typeof n.allow_network!="boolean")throw new L(`gate provider policy trigger ${t} is invalid`)}}function Eh(e){if(ft(e.id,"gate.id"),!Array.isArray(e.assertion_ids))throw new L("gate.assertion_ids is required and must be an array");if(e.assertion_ids.length===0)throw new L("gate requires at least one assertion");for(let t of e.assertion_ids)ft(t,"gate.assertion_id");if(!Array.isArray(e.triggers))throw new L(`gate.triggers is required and must be an array of ${_t.join(", ")}`);if(e.triggers.length===0)throw new L("gate requires at least one trigger");for(let t of e.triggers)if(!_t.includes(t))throw new L(`gate trigger must be one of ${_t.join(", ")}`);return e.provider_policy&&$E(e.provider_policy),e}function Mn(e){if(e.version!==vh)throw new L(`unsupported assurance document version ${String(e.version)}`);let t=new Set;for(let r of e.measurements){if(yc(r),t.has(`measurement:${r.id}`))throw new L(`duplicate measurement ${r.id}`);t.add(`measurement:${r.id}`)}for(let r of e.assertions){if(wc(r),t.has(`assertion:${r.id}`))throw new L(`duplicate assertion ${r.id}`);t.add(`assertion:${r.id}`)}for(let r of e.gates){Eh(r);let i=r.assertion_ids.filter(s=>!e.assertions.some(o=>o.id===s));if(i.length>0)throw new L(`gate ${r.id} references missing assertions: ${i.join(", ")}`);if(t.has(`gate:${r.id}`))throw new L(`duplicate gate ${r.id}`);t.add(`gate:${r.id}`)}let n=new Set(e.measurements.map(r=>r.id));for(let[r,i]of Th(e))if(!n.has(r))throw new L(`${i.join(", ")} references missing measurement ${r}`);return e}function vc(e,t){if("measurement"in e){t.push(e.measurement);return}if("operator"in e)for(let n of e.operands)vc(n,t)}function Th(e){let t=new Map,n=(r,i)=>{let s=t.get(r)??[];s.push(i),t.set(r,s)};for(let r of e.assertions)n(r.measurement_id,`assertion ${r.id}`),r.scope.kind==="filter"&&n(r.scope.measurement_id,`assertion ${r.id} scope`);for(let r of e.measurements){if(r.source.kind!=="derived")continue;let i=[];vc(r.source.expression,i);for(let s of i)n(s,`derived measurement ${r.id}`)}return t}function PE(e,t){let n=e.assertion_ids.flatMap(s=>{let o=t.assertions.find(a=>a.id===s);return[o.measurement_id,...o.scope.kind==="filter"?[o.scope.measurement_id]:[]]}),r=new Set,i=new Set;for(;n.length>0;){let s=n.pop();if(r.has(s))continue;r.add(s);let o=t.measurements.find(a=>a.id===s);o.source.kind==="provider"?i.add(o.source.provider):o.source.kind==="derived"&&vc(o.source.expression,n)}return i}function Lr(){return{version:vh,measurements:[],assertions:[],gates:[]}}function FE(e,t){let n=t.items.filter(r=>(e.statuses===void 0||e.statuses.includes(r.status))&&(e.types===void 0||e.types.includes(r.type))&&(e.tags===void 0||e.tags.every(i=>r.tags?.includes(i)))&&(e.field===void 0||(()=>{let i=r[e.field];if(e.state!==void 0){let s=i==null||i===""||Array.isArray(i)&&i.length===0;return e.state==="missing"?s:!s}return gc(i,e.equals)})()));return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function UE(e,t){return e.source_kind!==void 0?t?.toLowerCase()===e.source_kind.trim().toLowerCase():e.source_kind_prefix!==void 0?t?.toLowerCase().startsWith(e.source_kind_prefix.trim().toLowerCase())===!0:e.source_kind_state==="present"?t!==void 0&&t.length>0:e.source_kind_state==="missing"?t===void 0||t.length===0:!0}function jE(e,t){let n=[],r=ar(e.dependency_kind)??e.dependency_kind.trim().toLowerCase();for(let i of t.items)for(let s of i.dependencies??[]){let o=ar(s.kind)??s.kind.trim().toLowerCase(),a=s.source_kind?.trim();o===r&&UE(e,a)&&n.push(`${i.id}->${s.id}${a?`@${a}`:""}`)}return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n}}function GE(e){let t=[e.description,e.body].filter(n=>typeof n=="string").map(n=>n.trim()).filter(Boolean);for(let n of["comments","notes","learnings"]){let r=e[n];if(Array.isArray(r)){for(let i of r)if(typeof i=="string")t.push(i);else if(typeof i=="object"&&i!==null){let s=Reflect.get(i,"text");typeof s=="string"&&t.push(s)}}}return t}function qE(e,t,n,r){return e.some(i=>i.holder_id.trim().toLowerCase()===t.toLowerCase()&&(i.target_id===void 0||i.target_id.trim().toLowerCase()===n.toLowerCase())&&(i.text_contains===void 0||r.toLowerCase().includes(i.text_contains.trim().toLowerCase())))}function hc(e,t){return[e.toLowerCase(),t.toLowerCase()].sort().join("\0")}function WE(e){let t=new Map,n=new Set,r=[],i=/(?<![\w-])[a-z0-9]+(?:-+[a-z0-9]+)+(?![\w-])/giu,s=0;for(let o of e){t.set(o.id.toLowerCase(),o.id);for(let a of o.dependencies??[])n.add(hc(o.id,a.id));for(let a of[o.parent,o.blocked_by])typeof a=="string"&&n.add(hc(o.id,a));for(let a of GE(o)){let c=[...a.matchAll(i)].map(d=>d[0]);s+=c.length,r.push({holder_id:o.id,segment:a,mentioned_ids:c})}}return{canonical_ids:t,linked_pairs:n,prose_mentions:r,mention_count:s}}function KE(e,t){let n=WE(t.items),r=new Map;for(let o of n.prose_mentions){let a=o.mentioned_ids.map(d=>n.canonical_ids.get(d.toLowerCase())).filter(d=>d!==void 0&&d!==o.holder_id),c=[...new Set(a)];for(let d of c){let l=hc(o.holder_id,d);if(n.linked_pairs.has(l)||qE(e.exemptions??[],o.holder_id,d,o.segment))continue;let u=c.some(_=>_!==d);r.get(l)?.explicit===!0&&!u||r.set(l,{contributor:`${o.holder_id}->${d}|subject=${u?"explicit":"implicit"}`,explicit:u})}}let i=[...r.values()],s=i.map(o=>o.contributor).sort();return{value:s.length,population_size:n.canonical_ids.size,cost:t.items.length+n.linked_pairs.size+n.mention_count,contributors:s.slice(0,e.sample_limit??25),partitions:{explicit_subject:i.filter(o=>o.explicit).length,implicit_subject:i.filter(o=>!o.explicit).length}}}function zE(e,t){return{value:t.history.filter(n=>(e.op===void 0||n.op===e.op)&&(e.author===void 0||n.author===e.author)&&(e.harness===void 0||n.agent_harness===e.harness)&&(e.model===void 0||n.agent_model===e.model)).length,population_size:t.history.length,cost:t.history.length}}function BE(e,t){let n=t.items.filter(r=>{let i=r[e.link],s=Array.isArray(i)&&i.length>0;return e.state==="present"?s:!s});return{value:n.length,population_size:t.items.length,cost:t.items.length,contributors:n.map(r=>r.id)}}function HE(e,t){let n=e.source;return n.kind==="items"?FE(n,t):n.kind==="dependency_kind"?jE(n,t):n.kind==="prose_edge_gap"?KE(n,t):n.kind==="history"?zE(n,t):n.kind==="links"?BE(n,t):null}function Ch(e,t){return e.reduce((n,r)=>({units:n.units+r.units,items_scanned:n.items_scanned+r.items_scanned,history_entries:n.history_entries+r.history_entries,provider_calls:n.provider_calls+r.provider_calls,duration_ms:t}),{units:0,items_scanned:0,history_entries:0,provider_calls:0,duration_ms:t})}function VE(e,t){if(t.length===0)throw new TypeError(`derived ${e} requires operands`);if(e==="add")return t.reduce((n,r)=>n+r,0);if(e==="subtract")return t.slice(1).reduce((n,r)=>n-r,t[0]);if(e==="multiply")return t.reduce((n,r)=>n*r,1);if(e==="divide"){if(t.slice(1).includes(0))throw new TypeError("derived divide cannot divide by zero");return t.slice(1).reduce((n,r)=>n/r,t[0])}return e==="min"?Math.min(...t):Math.max(...t)}async function Ah(e,t,n){let r=new Array(e.length),i=0,s=Array.from({length:Math.min(t,e.length)},async()=>{for(;i<e.length;){let o=i;i+=1,r[o]=await n(e[o],o)}});return await Promise.all(s),r}async function xh(e,t,n,r,i){if("literal"in e)return{value:e.literal,costs:[],population_size:0,contributors:[]};if("measurement"in e){let o=n.find(d=>d.id===e.measurement);if(!o)throw new TypeError(`derived measurement references missing ${e.measurement}`);let a=await Rh(o,t,n,r,i);if(typeof a.value!="number")throw new TypeError(`derived measurement ${o.id} is not numeric`);let c=i.charged.has(o.id)?[]:[a.cost];return i.charged.add(o.id),{value:a.value,costs:c,population_size:a.population_size,contributors:a.contributors}}let s=await Ah(e.operands,bh,o=>xh(o,t,n,r,i));return{value:VE(e.operator,s.map(o=>o.value)),costs:s.flatMap(o=>o.costs),population_size:Math.max(0,...s.map(o=>o.population_size)),contributors:[...new Set(s.flatMap(o=>o.contributors))]}}async function YE(e,t,n,r,i){yc(e);let s=Date.now(),o,a=[],c=0;if(e.source.kind==="derived"){let u=await xh(e.source.expression,t,n,[...r,e.id],i);o={value:u.value,population_size:u.population_size,cost:0,contributors:u.contributors},a=u.costs}else{let u=HE(e,t);u!==null?o=u:(o=await t.external(e.source),c=1)}let d={units:o.cost,items_scanned:e.source.kind==="items"||e.source.kind==="dependency_kind"||e.source.kind==="prose_edge_gap"||e.source.kind==="links"?t.items.length:0,history_entries:e.source.kind==="history"?t.history.length:0,provider_calls:c,duration_ms:Date.now()-s},l=Ch([...a,d],Date.now()-s);if(e.max_cost!==void 0&&l.units>e.max_cost)throw new Re(`measurement ${e.id} exceeded cost ceiling ${e.max_cost} with ${l.units}`);return{id:e.id,definition_fingerprint:`sha256:${TE("sha256").update(ne(e)).digest("hex")}`,value:o.value,population_size:o.population_size,cost:l,contributors:o.contributors??[],...o.partitions?{partitions:o.partitions}:{}}}function Rh(e,t,n,r,i){if(r.includes(e.id))throw new TypeError(`derived measurement cycle: ${[...r,e.id].join(" -> ")}`);let s=i.cache.get(e.id);if(s)return s;let o=YE(e,t,n,r,i).catch(a=>{if(a instanceof nt&&a.measurement_id===void 0){let c={measurement_id:e.id,source_kind:a.source_kind,field:a.field,...a.check?{check:a.check}:{}},d=new nt(a.message,c);throw d.cause=a,d}throw a});return i.cache.set(e.id,o),o}async function bc(e,t,n=[e]){return Rh(e,t,n,[],{cache:new Map,charged:new Set})}function JE(e,t){return typeof e!="number"||typeof t.value!="number"?null:t.polarity==="ceiling"||t.polarity==="monotone_nonincreasing"?t.value-e:(t.polarity==="floor"||t.polarity,e-t.value)}function XE(e,t,n={}){wc(e);let r=Or(e),i=e.lifetime==="retire"&&n.owner_terminal===!0;return{assertion_id:e.id,measurement_id:e.measurement_id,measurement_definition_fingerprint:t.definition_fingerprint,scope:e.scope,population_size:t.population_size,observed:t.value,bound:r,distance:JE(t.value,r),verdict:i?"retired":kh(t.value,r)?"pass":"fail",enforcement:e.enforcement,negative_control_proven:Sh(e),cost:t.cost,contributors:t.contributors,...t.partitions?{partitions:t.partitions}:{}}}function QE(e,t,n,r){let i=PE(e,t);if(i.size===0)return;let s=e.provider_policy,o=s?.triggers[r];if(!s||!o)throw new Re(`assurance gate ${e.id} refuses provider execution at trigger ${r} without an explicit provider policy`);let a=new Set(s.allowed_providers),c={low:0,medium:1,high:2};for(let d of i){if(!a.has(d))throw new Re(`assurance gate ${e.id} refuses provider ${d}`);let l=n.provider_capabilities?.[d];if(!l)throw new Re(`assurance provider ${d} has no declared capabilities`);if(c[l.cost_class]>c[o.max_cost_class])throw new Re(`assurance gate ${e.id} refuses ${l.cost_class}-cost provider ${d} at trigger ${r}`);if(l.network&&!o.allow_network)throw new Re(`assurance gate ${e.id} refuses network provider ${d} at trigger ${r}`)}}async function wh(e,t,n,r,i){try{return await bc(n,r,i)}catch(s){if(s instanceof nt){let o=s.check?` check ${s.check}`:"",a=s.measurement_id??n.id,c=new Re(`assurance gate ${e} assertion ${t} measurement ${a} source ${s.source_kind}${o} field ${s.field} could not resolve: ${s.message}`,{gate_id:e,assertion_id:t,measurement_id:a,source_kind:s.source_kind,field:s.field,...s.check?{check:s.check}:{}});throw c.cause=s,c}throw s}}async function Ih(e,t,n,r){Mn(t);let i=t.gates.find(c=>c.id===e);if(!i)throw new Re(`assurance gate ${e} not found`);if(!i.triggers.includes(r.trigger))throw new Re(`assurance gate ${e} does not declare trigger ${r.trigger}`);QE(i,t,n,r.trigger);let s=await Ah(i.assertion_ids,bh,async c=>{let d=t.assertions.find(f=>f.id===c),l=t.measurements.find(f=>f.id===d.measurement_id),u=n;if(d.scope.kind==="active"){let f=new Set(n.terminal_statuses??["closed","canceled"]);u={...n,items:n.items.filter(g=>!f.has(g.status))}}else if(d.scope.kind==="filter"){let f=d.scope.measurement_id,g=t.measurements.find(v=>v.id===f),y=await wh(i.id,d.id,g,n,t.measurements),w=new Set(y.contributors);u={...n,items:n.items.filter(v=>w.has(v.id))}}let _=n.items.find(f=>f.id===d.owner_item_id),h=_!==void 0&&new Set(n.terminal_statuses??["closed","canceled"]).has(_.status);return XE(d,await wh(i.id,d.id,l,u,t.measurements),{owner_terminal:h})}),o=s.some(c=>c.verdict==="fail"&&c.enforcement==="block"),a=s.some(c=>c.verdict==="fail"&&c.enforcement==="warn");return{gate_id:i.id,tree_id:n.tree_id,trigger:r.trigger,dry_run:r.dry_run===!0,evaluated_at:new Date().toISOString(),verdict:o?"block":a?"warn":"pass",exit_code:o?1:0,assertions:s,assertions_total:s.length,row_contract:{row_keys:["assertions"],jq_selector:".assertions[]"},cost:Ch(s.map(c=>c.cost),Math.max(0,...s.map(c=>c.cost.duration_ms)))}}function Ss(e){return CE.join(e,"assurance.json")}async function Oh(e){let t=await X(Ss(e));return t===null?Lr():Es(t)}function Es(e){try{return Mn(JSON.parse(e))}catch(t){throw new p("The assurance registry is invalid. Repair or restore .agents/pm/assurance.json and retry.",m.GENERIC_FAILURE,{code:"assurance_registry_invalid",reason:String(t),nextSteps:["Restore a valid assurance.json from version control or repair its declaration references.","Run pm assurance list measurement after the repair."]})}}function Ts(e,t){return t==="measurement"?e.measurements:t==="assertion"?e.assertions:e.gates}function ZE(e,t){e==="measurement"?yc(t):e==="assertion"?wc(t):Eh(t)}async function Dr(e,t){let n=structuredClone(Ts(await Oh(e),t));return{items:n,count:n.length,row_contract:{row_keys:["items"],jq_selector:".items[]"}}}async function Lh(e,t,n){let r=Ts(await Oh(e),t).find(i=>i.id===n);if(!r)throw new Re(`assurance ${t} ${n} not found`);return structuredClone(r)}async function Cs(e,t,n,r={}){ZE(t,n);let i=await x(e),s=j(r.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:`assurance:${t}:put`,author:s,message:r.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a),d=Ts(c,t),l=d.findIndex(_=>_.id===n.id),u=l<0?"created":"updated";if(t==="assertion"&&l>=0&&LE(d[l],n)){let _=n.authorization_decision;if(!_||!r.authorized_decision_ids?.includes(_))throw new L(`loosening assertion ${n.id} requires a verified authorization_decision`)}return l<0?d.push(structuredClone(n)):d[l]=structuredClone(n),Mn(c),{raw:`${JSON.stringify(c,null,2)}
3
3
  `,result:{changed:!0,action:u,kind:t,id:n.id}}}});return{...o.result,changed:o.changed}}async function kc(e,t,n={}){let r=Lr();r.measurements=structuredClone(t.measurements),r.assertions=structuredClone(t.assertions),r.gates=structuredClone(t.gates),Mn(r);let i=await x(e),s=j(n.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:"assurance:bundle:apply",author:s,message:n.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a),d=[],l=[],u=(_,h,f)=>{for(let g of h){let y=_.find(w=>w.id===g.id);if(!y){_.push(structuredClone(g)),d.push(`${f}:${g.id}`);continue}if(ne(y)!==ne(g))throw new L(`assurance bundle refuses to replace divergent ${f} ${g.id}`);l.push(`${f}:${g.id}`)}};return u(c.measurements,r.measurements,"measurement"),u(c.assertions,r.assertions,"assertion"),u(c.gates,r.gates,"gate"),Mn(c),{raw:`${JSON.stringify(c,null,2)}
4
4
  `,result:{changed:d.length>0,created_ids:d,unchanged_ids:l}}}});return{...o.result,changed:o.changed}}async function Dh(e,t,n,r={}){let i=await x(e),s=j(r.author,i.author_default),o=await bn({pmRoot:e,filePath:Ss(e),op:`assurance:${t}:remove`,author:s,message:r.message,lockTtlSeconds:bs,lockWaitMs:ks,mutate:a=>{let c=a===null?Lr():Es(a);if(t==="measurement"){let u=Th(c).get(n);if(u&&u.length>0)throw new L(`assurance measurement ${n} is referenced by ${u.join(", ")}`)}if(t==="assertion"&&c.gates.some(u=>u.assertion_ids.includes(n)))throw new L(`assurance assertion ${n} is referenced by gate`);let d=Ts(c,t),l=d.findIndex(u=>u.id===n);if(l<0)throw new L(`assurance ${t} ${n} not found`);return d.splice(l,1),Mn(c),{raw:`${JSON.stringify(c,null,2)}
5
5
  `,result:{changed:!0,action:"removed",kind:t,id:n}}}});return{...o.result,changed:o.changed}}async function Nh(e,t,n={}){if(t.dry_run)throw new TypeError("dry-run assurance verdicts are not persisted");let r=await x(e);await vn({pmRoot:e,op:"assurance:gate:verdict",author:j(n.author,r.author_default),context:{assurance_verdict:t},message:n.message??`Assurance gate ${t.gate_id} returned ${t.verdict}`,lockTtlSeconds:bs,lockWaitMs:ks})}async function Mh(e,t={}){let n=t.limit??RE;if(!Number.isInteger(n)||n<1||n>Nn)throw new TypeError(`assurance verdict limit must be an integer from 1 through ${Nn}`);return(await mt(mr(e),Wt)).reverse().filter(r=>r.op==="assurance:gate:verdict").map(r=>r.context?.assurance_verdict).filter(r=>typeof r=="object"&&r!==null&&"gate_id"in r).filter(r=>t.gate_id===void 0||r.gate_id===t.gate_id).slice(0,n)}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="78b20f7a-4ae7-5811-9ab7-049a07d844e5")}catch{}})();var eT=Ja("list").properties.outputSession,tT={outputInclude:{type:"string",minLength:1,description:"Comma-separated fields or sections retained by any built-in read action."},outputLimit:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal read row ceiling, or unbounded to disable the shared ceiling."},outputBudget:{anyOf:[{type:"integer",minimum:1},{const:"unbounded"}],description:"Universal estimated-token ceiling, or unbounded to return the complete read result."},outputFormat:{type:"string",enum:["json","toon"],description:"Universal read-result encoding selector."},outputSession:{...eT},outputCursor:{type:"string",minLength:1,description:"Opaque continuation cursor returned after budget compaction of a declared row collection."}},$h={definition:{anyOf:[{type:"object"},{type:"string"}],description:"Policy declaration for policy-put, or proposed metadata for policy-check; structured JSON or JSON text."},policy:{type:"string",description:"Approval policy id for policy-approve."},message:{type:"string",description:"History explanation for policy mutations and approvals."},dryRun:{type:"boolean",description:"Preview registry changes without writing; policy-approve rejects previews."}},Ph={type:"object",properties:{cwd:{type:"string",description:"Workspace directory to run the native pm operation in. Defaults to the MCP server process cwd."},path:{type:"string",description:"Optional pm data root, equivalent to PM_PATH/global --path. Leave unset for real repository tracking."},author:{type:"string",description:"Optional mutation author override. Otherwise pm uses PM_AUTHOR, project settings, or detected harness identity."},tokenAccounting:{type:"boolean",description:"Attach the same bounded per-section token-cost receipt emitted by CLI --token-accounting."}},additionalProperties:!0},me={type:"string",description:"pm item id, for example pm-abc1."},nT=`Operation name (one of): ${fa.join(", ")}. Package-owned actions are available dynamically when their provider package is installed.`,rT={status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."},offset:{type:["string","number"],description:"Alias for options.offset."}},iT={mode:{type:"string",description:"Alias for options.mode."},status:{type:"string",description:"Alias for options.status."},type:{type:"string",description:"Alias for options.type."},tag:{type:"string",description:"Alias for options.tag."},priority:{type:"string",description:"Alias for options.priority."},limit:{type:["string","number"],description:"Alias for options.limit."}};function z(e,t=[]){return{...Ph,properties:{...Ph.properties,...e},required:t}}var sT=[{name:"pm_run",description:"Run any supported pm operation natively through the pm library. Use this for commands not covered by narrower pm_* tools.",inputSchema:z({action:{type:"string",enum:[...fa],description:nT},id:me,query:{type:"string",description:"Search query for action=search."},reason:{type:"string",description:"Close reason for action=close."},force:{type:"boolean",description:"Force ownership/terminal-state override when supported."},subcommand:{type:"string",description:"Subcommand selector for actions that take one (for example telemetry, or schema \u2014 prefer the dedicated pm_schema tool for schema operations)."},options:{type:"object",description:"Underlying pm command options using camelCase keys."},fullChangedFields:{type:"boolean",description:"For mutation actions, return the full changed_fields array instead of the default changed_field_count."},idOnly:{type:"boolean",description:"For single-item mutation actions, return only id and status."},...tT},["action"])},{name:"pm_discover",description:"Discover the smallest relevant authorized pm tool catalog under an explicit token budget. Ranking is deterministic and returns public lexical, semantic, graph, permission, freshness, and usage signal explanations. Continue with next_cursor; set includeSchema=true only when complete input schemas are needed.",inputSchema:z({query:{type:"string",maxLength:4096,description:"Free-text capability intent. Empty text lists by stable policy order."},family:{type:"string",enum:["workspace","intake","context","lifecycle","evidence","graph","quality","automation","extensions","internal"],description:"Optional stable capability-family filter."},tier:{type:"string",enum:["core","standard","full"],description:"Maximum command visibility tier included in results."},limit:{type:"integer",minimum:1,maximum:100,description:"Maximum result rows; defaults to 10."},cursor:{type:"string",minLength:1,maxLength:4096,description:"Opaque next_cursor from an equivalent discovery request."},includeSchema:{type:"boolean",description:"Include complete tool input schemas; false by default."},outputBudget:{anyOf:[{type:"integer",minimum:128},{const:"unbounded"}],description:"Estimated-token ceiling; defaults to 1200."}})},{name:"pm_context",description:"Return the agent-oriented project context snapshot. Pass options.depth=brief|standard|deep|full (full = every section with no per-section row cap), options.parent='<id>' to scope the snapshot to one item's subtree (the item plus all descendants), options.fields='id,title,priority' to project focus rows to a field subset for low-token reads, or options.section=['hierarchy','progress',...] to pick sections.",inputSchema:z({options:{type:"object"}})},{name:"pm_next",description:"Recommend the next actionable work item: the single highest-priority READY item (active status, no open blockers, no open children; completed containers surface only when no concrete leaf work is ready) plus the ranked ready and blocked queues. The recommended item carries a rationale and each blocked item lists the open blockers gating it. Pass options.parent='<id>' to scope to one subtree, options.limit=N to cap ready rows, options.readyOnly=true to omit the blocked list, or filters (options.type/tag/priority/assignee/sprint/release). The most token-efficient 'what should I do now?' read for agents.",inputSchema:z({options:{type:"object"}})},{name:"pm_search",description:"Search pm items with keyword, semantic, or hybrid search. Defaults to a compact projection for token efficiency. Pass options.mode=keyword|semantic|hybrid (default follows search.default_mode: auto runs hybrid when semantic search is configured and runnable, else keyword; the result reports mode_source), options.limit=N to cap hits, options.status='all' for no lifecycle restriction, options.fields='id,title,score' for a custom projection, or options.full=true for full item bodies (can be large). The result echoes the applied filters and projection mode in query_summary.",inputSchema:z({query:{type:"string"},options:{type:"object"},...iT},["query"])},{name:"pm_list",description:"List pm items with status/type/tag/priority filters. Defaults to compact projection for token efficiency. options.status accepts CSV (all,open,in_progress). Pass options.compact=false or options.includeBody=true for full bodies/comments. Pass options.brief=true for ultra-terse (id/status/type/title only). Pass options.fields='id,title,priority' for custom projection. Pass options.limit=N to cap row count. The result echoes the applied filters and projection mode in query_summary.",inputSchema:z({options:{type:"object"},...rT})},{name:"pm_get",description:"Read one pm item with shared SDK projections. Pass options.depth='brief' or options.fields='id,title,status' for low-token inspection, options.fields='id,schedule.start_at' for schedule context, or options.at='7' / an ISO timestamp for a verified mutation-free historical read. Parent results include bounded child counts, samples, and continuation metadata.",inputSchema:z({id:me,options:{type:"object",description:"Get options such as depth=brief|standard|deep|full, fields=id,title,status, or at=<version|ISO timestamp>."}},["id"])},{name:"pm_events",description:"Read a bounded, cursor-resumable page of committed mutation events across item history streams. Batch cursors are the token-efficient default; pass cursorMode=row for per-event checkpoints.",inputSchema:z({verify:{type:"boolean",description:"Verify complete selected authoritative history chains."},since:{type:"string",description:"Durable event cursor or ISO timestamp lower bound."},type:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},author:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},item:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},limit:{type:"integer",minimum:0,maximum:1e3},full:{type:"boolean"},cursorMode:{type:"string",enum:["batch","row"],description:"Cursor framing: batch returns one terminal next_cursor (default); row also adds a cursor to every event."}})},{name:"pm_create",description:"Create a pm item natively and write pm history. Output is compact by default (changed_fields replaced with changed_field_count for token efficiency); pass fullChangedFields=true for the full changed_fields array.",inputSchema:z({fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},allowMissingParent:{type:"boolean",description:"Allow unresolved parent references and emit a validation warning."},allowDuplicate:{type:"boolean",description:"Explicitly create when strict similarity governance finds likely duplicates."},options:{type:"object",description:"Create options. title and description are required."}},["options"])},{name:"pm_mutate",description:"Apply an ordered create/update/close/release batch atomically through the public pm SDK. Create rows may declare ref and omit id; @ref forward references resolve deterministically from the stable transactionId, which is derived from the batch when omitted. Bulk creation: rows shaped as {item:{title,type,...}} are create documents using pm create field names; upsertKey updates the existing item whose field matches instead of creating a duplicate. Set dryRun=true to validate and preview without writes.",inputSchema:z({transactionId:{type:"string",description:"Stable idempotency key for this atomic mutation batch; derived from the batch content when omitted."},mutations:{type:"array",minItems:1,description:"Ordered rows shaped as {op:create|update|close|release,id?,ref?,options?,reason?} or create documents {ref?,item:{...}}.",items:{type:"object",properties:{op:{type:"string",enum:["create","update","close","release"],description:"Operation; omitted rows carrying item are creates."},id:me,ref:{type:"string",description:"Batch-local create alias; its deterministic id can be referenced as @alias by any row."},reason:{type:"string"},options:{type:"object"},item:{type:"object",description:"Create document using pm create field names (title, type, description, body, tags, parent, custom fields)."},unique:{type:"object",description:"Create-only guard {key,value} re-checked under the writer lock; keyed upsert sets it on rows that matched nothing at planning time."},match:{type:"object",description:"Update-only guard {key,value} re-read under the writer lock; keyed upsert sets it on rows it converted into updates of a matched item."}},additionalProperties:!1}},upsertKey:{type:"string",description:"Item field whose value identifies an existing item to update instead of creating a duplicate."},dryRun:{type:"boolean",description:"Validate and preview without writing."},createCompensation:{type:"string",enum:["close","delete"],description:"How a failed batch compensates created items; defaults to close."},lockTtlSeconds:{type:"number"},lockWaitMs:{type:"number"}},["mutations"])},{name:"pm_copy",description:"Copy an existing pm item into a new id while resetting lifecycle fields. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:z({id:me,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object",description:"Copy options such as title override, author, and message."}},["id"])},{name:"pm_focus",description:"Set, clear, or show the session focused item. When focused, pm_create defaults its parent to the focused item (an explicit parent still overrides). Pass id to focus an item, options.clear=true to clear, or neither to show current focus.",inputSchema:z({id:me,clear:{type:"boolean",description:"Clear the focused item (cannot be combined with id)."},options:{type:"object",description:"Focus options such as clear (boolean)."}},[])},{name:"pm_update",description:"Update pm item metadata/body/dependencies/log seeds natively. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields delta.",inputSchema:z({id:me,fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object"}},["id","options"])},{name:"pm_append",description:"Append markdown text to a pm item body and write pm history. Useful for seeding evidence/log entries before close. Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:z({id:me,body:{type:"string",description:"Markdown text to append to the item body. Required here or as options.body."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},options:{type:"object",description:"Append options such as body, author, and message."}},["id"])},{name:"pm_claim",description:"Claim a pm item.",inputSchema:z({id:me,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_release",description:"Release a pm item claim.",inputSchema:z({id:me,force:{type:"boolean"},options:{type:"object"}},["id"])},{name:"pm_close",description:"Close a pm item with optional close reason and optional close validation (reason requirement follows governance settings). Output is compact by default (changed_fields replaced with changed_field_count); pass fullChangedFields=true for the full changed_fields array.",inputSchema:z({id:me,reason:{type:"string",description:"Close reason text when provided or required by governance settings."},duplicateOf:{type:"string",description:"Canonical item id when closing this item as a duplicate."},fullChangedFields:{type:"boolean",description:"Return full changed_fields instead of changed_field_count."},idOnly:{type:"boolean",description:"Return only id and status."},options:{type:"object"}},["id"])},{name:"pm_comments",description:'List, add, edit, or delete comments on a pm item. Use options.add to append, options.edit=<1-based index> with replacement text to fix a comment, or options.delete=<1-based index> to remove one. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. List calls return the newest comments that fit the output budget, with total_count/has_more metadata and a next_cursor that pages back to older comments through outputCursor; without options.limit or outputLimit, outputBudget "unbounded" returns the complete listing at once. Pass options.limit=N for only the newest N comments (next_cursor pages within that window when the budget trims it; has_more reports older comments beyond it without a cursor) or options.limit=0 for summary-only metadata; options.full=true returns the complete history after a write. Rows carry their absolute index; pair edit/delete with options.expectAt to refuse a different entry.',inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_files",description:"List, add, remove, or validate linked files for a pm item.",inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_docs",description:"List, add, or remove linked docs for a pm item.",inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_notes",description:"List, add, edit, or delete structured notes on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing notes; rows carry their absolute index, and options.expectAt guards edit/delete.",inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_learnings",description:"List, add, edit, or delete learnings on a pm item. options.ifAbsent applies only to options.add for retry-safe author-and-text deduplication and cannot combine with options.edit or options.delete. Omit mutation options to list existing learnings; rows carry their absolute index, and options.expectAt guards edit/delete.",inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_deps",description:"Read dependency trees/graphs or one bounded explainable relationship context packet. Use options.format=context with direction, kind, depth, node, edge, token, and cursor bounds; context returns a counts-first summary, per-node roles/reasons, root evidence pointers, and enumerated missing references.",inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_graph",description:"Run bounded workspace relationship-graph queries: ancestors/descendants (hierarchy), predecessors/successors (ordering), paths, impact (blast radius), analyze (execution + knowledge analytics), audit (governance findings with change-since-baseline deltas), communities (label-propagation clusters), redundancy (transitively implied edges), dominators (structural bottlenecks), slack (critical-path method float per task), centrality (betweenness/closeness/degree with directed fan-in/out), articulation (cut points and bridges \u2014 single points of failure), plan (dry-run remediation proposals derived from the audit), and index (durable cross-process graph index status/rebuild/clear). Traversals, paths, impact, and dominators require id; paths also requires target. Options support kind, maxDepth, limit, after, direction, maxPaths, sample, exemptIsolate, exemptIsolateType, saveBaseline (audit), rebuild/clear (index), and counts-first summary.",inputSchema:z({subcommand:{type:"string",enum:[...cu]},id:me,target:me,options:{type:"object"}},["subcommand"])},{name:"pm_test",description:"List, add, remove, or run linked tests for a pm item.",inputSchema:z({id:me,options:{type:"object"}},["id"])},{name:"pm_validate",description:"Run pm validation checks.",inputSchema:z({options:{type:"object"}})},{name:"pm_health",description:"Run pm health diagnostics. Pass options.brief=true for compact low-token details, options.skipIntegrity=true, options.skipDrift=true, options.skipVectors=true for a fast status-only check, or options.full=true for the complete deep check.",inputSchema:z({options:{type:"object"}})},{name:"pm_contracts",description:"Inspect pm command, flag, schema, and availability contracts.",inputSchema:z({options:{type:"object"}})},{name:"pm_schema",description:"Inspect or modify the workspace item-type/status/field schema (pm schema). subcommand selects the operation; name carries the item type name (show/add-type/remove-type), status id (show-status/add-status/remove-status), or field key (show-field/add-field/remove-field). apply-preset adopts a domain type preset; add-type with infer=true derives types from title-prefix conventions. Policy verbs author declarations, preview changes, set enforcement, and record content-bound approvals. Registry mutations write workspace history; approvals write item history.",inputSchema:z({...$h,subcommand:{type:"string",enum:["list","show","show-status","add-type","remove-type","add-status","remove-status","add-field","remove-field","list-fields","show-field","apply-preset",...tu],description:"Schema subcommand to run."},name:{type:"string",description:"Item type name, status id, field key, policy id, or item id for the selected schema verb; policy-mode requires advise|refuse."},description:{type:"string",description:"Custom item type, status, or field description for add-type/add-status/add-field."},defaultStatus:{type:"string",description:"Default status for add-type."},folder:{type:"string",description:"Storage folder for add-type."},alias:{type:"array",items:{type:"string"},description:"Aliases for add-type/add-status, or extra CLI flag aliases for add-field."},role:{type:"array",items:{type:"string",enum:[...ga]},description:`Lifecycle roles for add-status: ${ga.join(", ")}.`},order:{type:"number",description:"Display/sort order for add-status."},fieldType:{type:"string",enum:["string","number","boolean","string_array"],description:"Value type for a custom field (add-field)."},commands:{type:"array",items:{type:"string"},description:"Commands a custom field is wired onto (add-field): create, update, update_many, list, search, calendar, context."},cliFlag:{type:"string",description:"Override the auto-derived CLI flag for a custom field (add-field)."},required:{type:"boolean",description:"Mark a custom field as always required (add-field)."},requiredOnCreate:{type:"boolean",description:"Mark a custom field as required at create time (add-field)."},allowUnset:{type:"boolean",description:"Whether a custom field may be cleared via --unset (add-field); defaults to true."},requiredTypes:{type:"array",items:{type:"string"},description:"Restrict a custom field's requirement to specific item types (add-field)."},typePreset:{type:"string",enum:["agile","ops","research"],description:"Domain type preset to adopt (apply-preset)."},infer:{type:"boolean",description:"Infer item types from title-prefix conventions (add-type); previews unless apply is true."},minCount:{type:"number",description:"Minimum items sharing a prefix for add-type inference (default 10)."},apply:{type:"boolean",description:"Register inferred types (add-type infer); without it the call previews only."},force:{type:"boolean",description:"Override removal guardrails for destructive schema changes when supported."},options:{type:"object",description:"Additional schema options using camelCase keys.",properties:$h}},["subcommand"])},{name:"pm_profile",description:"List, show, apply, or lint project profiles (pm profile) \u2014 archetype bundles that stage item types, statuses, fields, per-type workflows, config knobs, create templates, and recommended packages. subcommand selects the operation; name carries the profile name (agile, ops, research) for show/apply/lint. apply stages every dimension idempotently; dryRun previews the diff without writing; lint reports author-time consistency findings (graded error/warning) without touching the tracker. Profile staging writes workspace config/schema files, not item history.",inputSchema:z({subcommand:{type:"string",enum:["list","show","apply","lint"],description:"Profile subcommand to run."},name:{type:"string",description:"Profile name for show/apply/lint. Required for those subcommands. Built-ins are agile, ops, and research; an active extension can contribute additional archetype names that resolve here too."},dryRun:{type:"boolean",description:"Preview the apply diff without writing any files (apply)."},author:{type:"string",description:"Mutation author for apply."},force:{type:"boolean",description:"Force ownership/lock override for apply."},options:{type:"object",description:"Additional profile options using camelCase keys."}},["subcommand"])},{name:"pm_config",description:"Read or write pm workspace configuration (pm config). configAction selects get/set/list/export; key/value address a single setting for get/set. scope chooses the project (default) or global settings file.",inputSchema:z({configAction:{type:"string",enum:["get","set","list","export"],description:"Config operation to perform. get/set require key; list/export dump the resolved settings surface."},key:{type:"string",description:"Settings key for get/set, for example governance-require-close-reason, telemetry-tracking, or a nested leaf such as search_provider (dash and underscore variants accepted; configAction=get without a key lists supported keys in the error)."},value:{type:"string",description:"New value for configAction=set."},scope:{type:"string",enum:["project","global"],description:"Settings scope to read or write. Defaults to project."},options:{type:"object",description:"Additional config options such as criterion, clearCriteria, format, or policy."}},["configAction"])},{name:"pm_plan",description:"Run agent-optimized Plan workflows. options.subcommand selects: create|show|add-step|update-step|complete-step|block-step|reorder-step|remove-step|link|unlink|decision|discovery|validation|resume|approve|materialize. Provide id for all non-create subcommands; provide stepRef for step lifecycle subcommands. Plans store agent-readable steps with dependencies, decisions, discoveries, validation, and resume context.",inputSchema:z({id:{type:"string",description:"Plan id (required for all subcommands except create)."},stepRef:{type:"string",description:"Step id or order for step lifecycle subcommands."},options:{type:"object",description:"Plan options including subcommand, stepRef, stepStatus, link, depth, etc."}})}],oT={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_docs:"docs",pm_events:"events",pm_files:"files",pm_focus:"focus",pm_get:"get",pm_graph:"graph",pm_health:"health",pm_learnings:"learnings",pm_list:"list",pm_next:"next",pm_notes:"notes",pm_plan:"plan",pm_profile:"profile",pm_release:"release",pm_schema:"schema",pm_search:"search",pm_test:"test",pm_update:"update",pm_validate:"validate"},aT=sT.map(e=>{let t=oT[e.name];if(!t)return e;let n=e.inputSchema.properties,r=e.inputSchema.required.map(String);return{...e,inputSchema:Ja(t,{properties:n,required:r})}});function Fh(){return aT.map(e=>{let t=e.inputSchema.required,n=Array.isArray(t)?t.map(r=>String(r)).sort((r,i)=>r.localeCompare(i)):[];return{name:e.name,description:e.description,required:n,input_schema:e.inputSchema}}).sort((e,t)=>e.name.localeCompare(t.name))}(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]="29d30fe0-03b7-533b-a468-151d3db90ccb")}catch{}})();var Uh=new Map([["activity",["--limit","--after","--full"]],["claim",["--if-available","--next","--type","--priority","--token-budget","--explain-ranking"]],["close",["--reason","--validate-close","--resolution","--expected-result","--actual-result","--message"]],["context",["--limit","--after","--depth","--section","--token-budget","--explain-ranking"]],["contracts",["--command","--flags-only","--summary","--runtime-only","--availability-only","--full"]],["create",["--title","--type","--status","--priority","--dep","--comment"]],["get",["--full","--depth","--fields","--tree","--tree-depth","--format"]],["health",["--check-only","--summary","--brief","--check-telemetry","--strict-exit","--full"]],["list",["--status","--type","--limit","--after","--brief","--fields"]],["next",["--limit","--blocked-limit","--ready-only","--token-budget","--explain-ranking","--format"]],["search",["--mode","--status","--type","--limit","--after","--fields"]],["update",["--status","--message","--dep","--comment","--file","--test"]],["validate",["--check-resolution","--check-history-drift","--check-storage-integrity","--counts","--strict-exit","--fix-hints"]]]),cT=["--limit","--after","--offset","--token-budget","--brief","--summary","--compact","--fields","--full","--format","--since","--until"],Yh=new Set(["list","list-all","list-draft","list-open","list-in-progress","list-blocked","list-closed","list-canceled"]),xs=new Set(["calendar","guide","reindex","completion","test-runs-list","test-runs-status","test-runs-logs","test-runs-stop","test-runs-resume","templates-list","templates-save","templates-show"]),Jt=new Set(["meet","event","remind","search-advanced","dedupe-audit","dedupe-merge","comments-audit","cal","calendar","completion","completion-statuses","completion-tags","completion-types","guide","reindex","normalize","templates","templates list","templates save","templates show","test-runs","test-runs list","test-runs status","test-runs logs","test-runs stop","test-runs resume"]),Jh=new Map([["meet","calendar"],["event","calendar"],["remind","calendar"],["search-advanced","search-advanced"],["dedupe-audit","governance-audit"],["dedupe-merge","governance-audit"],["comments-audit","governance-audit"],["cal","calendar"],["calendar","calendar"],["completion","guide-shell"],["completion-statuses","guide-shell"],["completion-tags","guide-shell"],["completion-types","guide-shell"],["guide","guide-shell"],["reindex","search-advanced"],["normalize","governance-audit"],["templates","templates"],["templates list","templates"],["templates save","templates"],["templates show","templates"],["test-runs","linked-test-adapters"],["test-runs list","linked-test-adapters"],["test-runs status","linked-test-adapters"],["test-runs logs","linked-test-adapters"],["test-runs stop","linked-test-adapters"],["test-runs resume","linked-test-adapters"]]),Xh=new Map([["calendar","calendar|cal"],["guide","guide"],["reindex","reindex"],["completion","completion"],["test-runs-list","test-runs|test-runs list"],["test-runs-status","test-runs status"],["test-runs-logs","test-runs logs"],["test-runs-stop","test-runs stop"],["test-runs-resume","test-runs resume"],["templates-list","templates|templates list"],["templates-save","templates save"],["templates-show","templates show"]]),Qh=new Map([...Xh.entries()].flatMap(([e,t])=>ht(t).map(n=>[n,e]))),Zh=[{canonical:"context",aliases:["ctx"]},{canonical:"package",aliases:["extension","packages"]}],Tc=new Map(Zh.flatMap(e=>e.aliases.map(t=>[t,e.canonical]))),dT=10,lT=20,jh=new Map([["activity","Read activity."],["aggregate","Group counts."],["append","Append body."],["assurance","Evaluate assurance."],["assurance derive","Derive checks."],["assurance risk","Select checks for changes."],["assurance lineages","Measure recurrence coverage."],["beads","Manage Beads interoperability."],["cal","Manage calendar integration."],["calendar","Manage calendar integration."],["changelog","Generate changelog output."],["claim","Claim work."],["close","Close work."],["close-many","Close matching work."],["close-task","Close task work."],["command-kit","Inspect command authoring primitives."],["comments","Manage comments."],["comments-audit","Audit comment governance."],["completion","Generate shell completions."],["config","Manage settings."],["context","Build context."],["contracts","Inspect contracts."],["copy","Copy work."],["create","Create work."],["dedupe-audit","Audit duplicate work."],["dedupe-merge","Merge duplicate work."],["delete","Delete work."],["deps","Manage deps."],["duplicates","Find duplicate clusters."],["docs","Link docs."],["eval","Run evaluations."],["event","Manage events."],["events","Read events."],["files","Link files."],["focus","Manage focus."],["gc","Clean caches."],["get","Read item."],["graph","Query graph."],["guide","Show user guides."],["health","Check health."],["help","Show help."],["history","Inspect history."],["init","Initialize workspace."],["install","Install packages."],["item","Mutate items."],["learnings","Manage learnings."],["list","List work."],["list-all","List work across every status."],["list-blocked","List blocked work."],["list-canceled","List canceled work."],["list-closed","List closed work."],["list-draft","List draft work."],["list-in-progress","List in-progress work."],["list-open","List open work."],["meet","Record meeting context."],["merge","Manage tracker merges."],["next","Pick next work."],["notes","Manage notes."],["normalize","Normalize tracker data."],["ops","Run operations."],["package","Manage packages."],["packages","Manage packages."],["pause-task","Pause task work."],["plan","Manage plans."],["profile","Manage profiles."],["reindex","Refresh search index."],["release","Release claim."],["remind","Manage reminders."],["restore","Restore history."],["schema","Customize schema."],["search","Search work."],["search-advanced","Run advanced search."],["start-task","Start task work."],["stats","Show stats."],["telemetry","Manage telemetry."],["templates","Manage work templates."],["test","Run linked tests."],["test-all","Run all linked tests."],["test-runs","Inspect background test runs."],["todos","Manage source-code todos."],["twin","Manage repository twins."],["update","Update work."],["update-many","Update matching work."],["upgrade","Upgrade packages."],["validate","Validate data."],["vcs","Inspect version-control context."],["workspace","Manage workspaces."],["history-author-acknowledge","Acknowledge reviewed history authors."],["history-compact","Compact history."],["history-attest","Export or verify detached history proof."],["history-redact","Redact sensitive history values."],["history-repair","Repair history integrity."]]),eg=[["init",Wp],["install",zp],["uninstall",Bp],["explore",Hp],["manage",Zp],["describe",Vp],["reload",e_],["doctor",t_],["catalog",n_],["adopt",r_],["adopt-all",Yp],["activate",Jp],["deactivate",Xp],["migrate",Qp]],uT=[...eg.map(([e,t])=>e==="init"?[e,Kp]:[e,t]),["upgrade",Ka]],mT=[...eg.map(([e,t])=>[`extension ${e}`,t]),...uT.flatMap(([e,t])=>[[`package ${e}`,t],[`packages ${e}`,t]]),["init",jp],["config",Gp],["extension",qp],["package",Wa],["packages",Wa],["install",i_],["create",C_],["item mutate",A_],["item complete",x_],["item reopen",R_],["copy",I_],["focus",O_],["update",L_],["update-many",D_],["upgrade",Ka],["calendar",za],["cal",za],["context",Ba],["ctx",Ba],["get",$_],["search",q_],["eval",j_],["events",M_],["workspace",At],["workspace position",[]],["workspace snapshot",At],["workspace snapshot create",At],["workspace snapshot list",At],["workspace snapshot inspect",At],["workspace snapshot restore",At],["workspace snapshot delete",At],["next",G_],["aggregate",Ep],["deps",F_],["graph",U_],["guide",P_],["reindex",s_],["history",Ip],["history-compact",Mp],["history-attest",$p],["history-redact",Lp],["history-repair",Dp],["history-author-acknowledge",Np],["merge",Op],["schema",Pp],["profile",Fp],["plan",Up],["restore",l_],["delete",u_],["close",o_],["close-many",a_],["append",c_],["claim",d_],["release",m_],["start-task",p_],["pause-task",__],["close-task",f_],["comments",Tp],["notes",Cp],["learnings",Ap],["files",xp],["docs",Rp],["test",h_],["test-runs-worker",[]],["test-all",g_],["telemetry",y_],["test-runs",w_],["gc",v_],["stats",b_],["ops",[]],["duplicates",k_],["validate",E_],["health",S_],["assurance",T_],...z_,["contracts",W_],["completion",K_],["activity",N_],...[...Yh].map(e=>[e,Sp])],Nr=new Map(mT);for(let{alias:e,canonical:t}of Ye){let n=Nr.get(e);n!==void 0&&Nr.set(t,n)}function pT(e){return Qh.get(e)||(e.startsWith("test-runs ")?`test-runs-${e.slice(10)}`:e.startsWith("templates ")?`templates-${e.slice(10)}`:e)}function Gh(e){let t=Ye.find(n=>n.alias===e);return t?`${t.canonical}|${t.alias}`:Je.includes(e)?be(e):e.startsWith("extension-")?be(`extension ${e.slice(10)}`):e.startsWith("package-")?be(`package ${e.slice(8)}`):e.startsWith("item-")?be(`item ${e.slice(5)}`):e.startsWith("test-runs-")?be(`test-runs ${e.slice(10)}`):e.startsWith("templates-")?be(`templates ${e.slice(10)}`):xs.has(e)?Xh.get(e)??be(e):null}function _T(e,t){let n=W(t);return n!==t||Ye.some(r=>r.alias===t)?e.action===n:e.command_path===null?!1:ht(e.command_path).some(r=>r===t?!0:r.startsWith(`${t} `)||t.startsWith(`${r} `))}function ht(e){return e.split("|").map(t=>be(t)).filter(t=>t.length>0)}function fT(e,t){let n=new Set(t),r=new Set;for(let i of e)if(i.command_path)for(let s of ht(i.command_path)){let o=s.split(" ").filter(a=>a.length>0);if(o.length!==0)for(let a=o.length;a>0;a-=1){let c=o.slice(0,a).join(" ");if(n.has(c)){r.add(c);break}}}return[...r].sort((i,s)=>i.localeCompare(s))}function As(e){if(typeof e!="string")return;let t=e.trim().toLowerCase();return t.length>0?t:void 0}function Mr(e){let t=e.oneOf;return Array.isArray(t)?t.filter(n=>typeof n=="object"&&n!==null):[]}function hT(e,t){if(!t)return{...e};let n=Mr(e).filter(r=>{let i=r.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;return typeof s!="object"||s===null?!1:s.const===t});return{...e,oneOf:n}}function Sc(e,t){let n=Mr(e).filter(r=>{let i=r.properties;if(typeof i!="object"||i===null)return!1;let s=i.action;if(typeof s!="object"||s===null)return!1;let o=s.const;return typeof o=="string"&&t.has(o)});return{...e,oneOf:n}}function be(e){return e.trim().toLowerCase().split(/\s+/).filter(t=>t.length>0).join(" ")}function tg(e){return e.replace(/\s+/g,"-")}function Rt(e){if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null}function qh(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){let i=Rt(r);!i||n.has(i)||(n.add(i),t.push(i))}return t}function Ec(e,t,n){n&&(e[t]=!0)}function Wh(e,t){if(e==null)return null;if(typeof e!="string")throw new TypeError("Expected string for extension flag name.");let n=e.trim();return n.length===0?null:t==="long"?n.startsWith("--")&&n.length>2?gn(n):null:n.startsWith("-")&&!n.startsWith("--")&&n.length>1?n:null}function gT(e){let t=Wh(e.long,"long"),n=Wh(e.short,"short"),r=t??n;if(!r)return null;let i={flag:r};n&&t&&(i.short=n),Ec(i,"required",e.required===!0),Ec(i,"repeatable",e.repeatable===!0),Ec(i,"list",e.list===!0),e.default!==void 0&&(i.default=e.default);let s=Rt(e.description);s&&(i.description=s);let o=or(e);i.value_arity=o.value_arity;let a=Rt(e.value_name)??o.value_name;a&&(i.value_name=a);let c=o.value_type??(o.value_name?"string":null);return c&&(i.value_type=c),i}function ng(e){let t=new Map;for(let r of e){let i=be(r.target_command);if(i.length===0)continue;let s=t.get(i)??{flags:[],sources:[],dedupe:new Set,sourceDedupe:new Set},o=`${r.layer}:${r.name}`;s.sourceDedupe.has(o)||(s.sourceDedupe.add(o),s.sources.push({layer:r.layer,name:r.name}));for(let a of r.flags){let c=gT(a);if(!c)continue;let d=`${c.flag}|${c.short??""}`;s.dedupe.has(d)||(s.dedupe.add(d),s.flags.push(c))}t.set(i,s)}let n=new Map;for(let[r,i]of t.entries())n.set(r,{flags:i.flags,sources:i.sources.sort((s,o)=>{let a=s.layer.localeCompare(o.layer);return a!==0?a:(s.name??"").localeCompare(o.name??"")})});return n}function yT(e,t){return e.read_output===void 0?{flags:t}:{read_output:e.read_output,flags:[...t,...qa.filter(({flag:n})=>n.startsWith("--output-"))]}}function wT(e){let t=ng(e.flagRegistrations),n=new Map;for(let s of e.commandDefinitions){let o=be(s.command);if(o.length===0)continue;let a=Rt(s.action)??tg(o),c=Array.isArray(s.arguments)?s.arguments.map(d=>{let l=Rt(d.name);return l?{name:l,required:d.required===!0,variadic:d.variadic===!0,description:Rt(d.description)}:null}).filter(d=>d!==null):[];n.set(o,{...s.tier===void 0?{}:{tier:s.tier},...yT(s,t.get(o)?.flags??[]),command:o,action:a,source:{layer:s.layer,name:s.name},description:Rt(s.description),intent:Rt(s.intent),arguments:c,examples:qh(s.examples),failure_hints:qh(s.failure_hints)})}let r=new Set;for(let s of e.handlers)r.add(be(s));for(let s of n.keys())r.add(s);for(let s of t.keys())r.add(s);let i=[];for(let s of[...r].sort((o,a)=>o.localeCompare(a))){let o=n.get(s);i.push(vT(s,o,t.get(s)?.flags??[]))}return i}function vT(e,t,n){return t?{...t,flags:t.flags.length>0?t.flags:n}:{command:e,action:tg(e),source:null,description:null,intent:null,arguments:[],flags:n,examples:[],failure_hints:[]}}function bT(e){let t=e.flag.startsWith("--")?e.flag:void 0,n=lc({long:t,short:t===void 0?e.flag:void 0});return n!==null&&/[a-z0-9]/iu.test(n)?n:null}function kT(e,t){return e.variadic?{type:"array",items:{type:"string"},description:e.description??`Variadic argument '${e.name}' for extension action '${t}'.`}:{type:"string",description:e.description??`Argument '${e.name}' for extension action '${t}'.`}}function ST(e,t){let n=e.value_type??"boolean",r=n==="boolean"?"boolean":n==="number"?["number","string"]:"string",i=e.repeatable===!0||e.list===!0;return{type:i?"array":r,...i?{items:{type:r}}:{},...e.default!==void 0?{default:e.default}:{},description:e.description??`Extension option '${e.flag}' for action '${t}'.`}}function ET(e){let t=e.command.split("|").map(i=>i.trim()).filter(i=>i.length>0),n={action:{type:"string",const:e.action,description:e.intent??e.description??`Invoke extension command '${e.command}'.`}},r=["action"];for(let i of e.arguments)n[i.name]=kT(i,e.action),i.required&&r.push(i.name);for(let i of e.flags){let s=bT(i);!s||n[s]!==void 0||(n[s]=qa.some(o=>o.flag===i.flag&&o.flag.startsWith("--output-"))?cf[s]:ST(i,e.action),i.required===!0&&r.push(s))}return{type:"object",properties:n,required:r,additionalProperties:!0,"x-extension-source":e.source,"x-extension-command":t[0]??e.command,"x-extension-commands":t}}function TT(e,t){e.description??=t.description,e.value_name??=t.value_name,e.value_type??=t.value_type,t.required===!0&&(e.required=!0),t.repeatable===!0&&(e.repeatable=!0)}function CT(e){let t=new Map;for(let n of e){let r=t.get(n.action);if(!r){t.set(n.action,{...n,flags:[...n.flags],examples:[...n.examples],failure_hints:[...n.failure_hints]});continue}r.command=[...new Set([r.command,n.command])].sort((s,o)=>s.localeCompare(o)).join("|"),r.arguments=r.arguments.length>=n.arguments.length?r.arguments:n.arguments;let i=new Set(r.flags.map(s=>`${s.flag}|${s.short??""}`));for(let s of n.flags){let o=`${s.flag}|${s.short??""}`;if(!i.has(o))i.add(o),r.flags.push(s);else{let a=r.flags.find(c=>`${c.flag}|${c.short??""}`===o);a&&TT(a,s)}}r.examples=[...new Set([...r.examples,...n.examples])],r.failure_hints=[...new Set([...r.failure_hints,...n.failure_hints])]}return[...t.values()].sort((n,r)=>n.action.localeCompare(r.action))}async function AT(e,t=x){let n={mode:Pt.extensions.policy.mode,trust_mode:Pt.extensions.policy.trust_mode,default_sandbox_profile:Pt.extensions.policy.default_sandbox_profile};if(e.noExtensions)return{handlers:new Set,disabledReason:"extensions_disabled",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};let r=R(process.cwd(),e.path);if(!await re(Ae(r)))return{handlers:new Set,disabledReason:null,commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n};try{let i=await t(r),s=await Pi({pmRoot:r,settings:i,cwd:process.cwd(),noExtensions:!1}),o=await Fi({...s,loaded:s.loaded});return{handlers:new Set(o.commands.handlers.map(a=>be(a.command))),disabledReason:null,commandDefinitions:o.registrations.commands,flagRegistrations:o.registrations.flags,registrations:o.registrations,policyState:{mode:s.policy.mode,trust_mode:s.policy.trust_mode,default_sandbox_profile:s.policy.default_sandbox_profile}}}catch{return{handlers:new Set,disabledReason:"extension_runtime_probe_failed",commandDefinitions:[],flagRegistrations:[],registrations:null,policyState:n}}}function xT(e,t={}){let n=new Map;for(let r of du){let i=xs.has(r);if(i&&!t.includePackageOwnedActions)continue;let s=Gh(r);n.set(r,{action:r,provider:i?"extension":"core",requires_extension:i,command_path:s})}if(t.includePackageOwnedActions)for(let r of xs)n.has(r)||n.set(r,{action:r,provider:"extension",requires_extension:!0,command_path:Gh(r)});for(let r of e)n.has(r.action)||n.set(r.action,{action:r.action,provider:"extension",requires_extension:!0,command_path:Ye.find(i=>i.alias===r.command)?.canonical??be(r.command)});return[...n.values()].sort((r,i)=>(r.action??"").localeCompare(i.action??""))}function RT(e,t){if(e.provider==="core"&&!e.requires_extension)return{action:e.action,invocable:!0,available:!0,requires_extension:!1,provider:"core",disabled_reason:null,command_path:e.command_path,cli_exposed:e.command_path!==null&&(!Jt.has(e.action)||t.handlers.has(e.action))};let n=e.command_path?ht(e.command_path):[],r=n.some(o=>t.handlers.has(o)||t.handlers.has(W(o))),i=n.map(o=>Jh.get(W(o))).find(o=>typeof o=="string"),s=t.disabledReason===null&&r;return{action:e.action,invocable:s,available:s,requires_extension:!0,provider:"extension",disabled_reason:s?null:t.disabledReason??(i?`optional_package_not_installed:${i}`:"extension_command_not_registered"),command_path:e.command_path,cli_exposed:r,policy_state:{mode:t.policyState.mode,trust_mode:t.policyState.trust_mode,default_sandbox_profile:t.policyState.default_sandbox_profile}}}function rg(e){let t=Nr.get(e)??rs,n=fr(e).find(r=>r.flag==="--output-format"&&r.aliases?.includes("--format"));return n?[...t,n]:t}function IT(e){return Jt.has(W(e))?!1:Nr.has(e)}function OT(e){return Yh.has(e)?"list":e==="cal"?"calendar":e==="ctx"?"context":e==="update-many"?"update_many":e}function Kh(e){let t=e.trim();return t?t.startsWith("--")?t:t.startsWith("-")?null:`--${t}`:null}function LT(e){let t=e.trim();return!t||t.startsWith("--")?null:t.startsWith("-")?t:null}function DT(e){let t=new Map;for(let r of e.definitions){let i=Kh(r.cli_flag);if(!i)continue;let s=r.cli_aliases.map(a=>LT(a)).find(a=>a!==null),o=r.cli_aliases.map(a=>Kh(a)).filter(a=>a!==null&&a!==i);for(let a of r.commands){let c=t.get(a)??{flags:[],seen:new Set},d=s?{flag:i,short:s}:{flag:i},l=`${d.flag}|${d.short??""}`;c.seen.has(l)||(c.seen.add(l),c.flags.push(d));for(let u of o){let _=`${u}|`;c.seen.has(_)||(c.seen.add(_),c.flags.push({flag:u}))}t.set(a,c)}}let n=new Map;for(let[r,i]of t.entries())n.set(r,Ga(i.flags));return n}function zh(e,t){let n=[],r=new Set;for(let i of[...e,...t]){let s=`${i.flag}|${i.short??""}`;r.has(s)||(r.add(s),n.push(i))}return Ga(n)}function NT(e){let t=lc(e.flag.startsWith("--")?{long:e.flag}:{short:e.flag});return{...e,owner:"extension",...t===null?{}:{sdk_option:t}}}function MT(e,t,n,r){let i=(n??[]).map(NT),s=t==="extension"&&(n!==void 0||$T(e,r));return{flags:i,inherited:s?{inherited_flags:kp({readOutput:PT(e,r)})}:{}}}function ig(e,t){let n=W(e);return t.find(r=>W(r.command)===n)}function $T(e,t){return ig(e,t)!==void 0}function PT(e,t){return ig(e,t)?.read_output!==void 0}function FT(e,t,n,r,i){let s=new Map(t);for(let{alias:o,canonical:a}of Ye){let c=t.get(a)??t.get(o);c&&(s.set(o,c),s.set(a,c))}return e.map(o=>{let a=IT(o),c=a?rg(o):[],d=n.get(OT(o))??[],l=s.get(o),u=zh(c,d),_=c.length>0&&(l?.flags.length??0)>0?"mixed":a?"core":"extension",h=MT(o,_,l?.flags,i),f=zh(u,h.flags);return{command:o,flags:f,...h.inherited,...r?{canonical_command:og(o),visibility:sg(o,i),positionals:wp(o)?.slots??[],flag_invocations:jf(o,f)}:{},provider:_,extension_sources:l?.sources}}).sort((o,a)=>o.command.localeCompare(a.command))}function UT(e,t=Ft){let n=new Set(e),r=new Map;for(let i of Zh){let s=i.aliases.filter(o=>n.has(o));r.set(i.canonical,{canonical:i.canonical,aliases:s,contracts:[]})}for(let i of t){if(!n.has(i.canonical)||i.registration==="commander"&&!n.has(i.alias))continue;let s=r.get(i.canonical)??{canonical:i.canonical,aliases:[],contracts:[]};s.aliases.includes(i.alias)||s.aliases.push(i.alias),s.contracts.push(i),r.set(i.canonical,s)}return[...r.values()].map(({contracts:i,...s})=>i.length===0?s:{...s,contracts:i}).sort((i,s)=>i.canonical.localeCompare(s.canonical))}function jT(){return{create_string_options:X_,create_repeatable_options:Q_,update_string_options:Z_,update_repeatable_options:ef,list_string_options:B_,search_string_options:H_,calendar_string_options:V_,context_string_options:Y_,activity_string_options:J_}}function Bh(e,t){let n=new Set(["title","type"]);if(t==="strict"){for(let a of e.required_create_fields)n.add(a);for(let a of e.required_create_repeatables)n.add(a)}let r=fn(e,"create",n),i=[...new Set(r.required)].sort((a,c)=>a.localeCompare(c)),s=[...new Set(i.map(a=>Ce("create",a)))].sort((a,c)=>a.localeCompare(c)),o=[...new Set(e.options.filter(a=>a.required===!0).map(a=>a.key))].sort((a,c)=>a.localeCompare(c));return{required_option_keys:i,required_flags:s,required_type_options:o,policy_errors:[...new Set(r.errors)].sort((a,c)=>a.localeCompare(c))}}function GT(e){let t={},n={};for(let r of[...e.types].sort((i,s)=>i.localeCompare(s))){let i=e.by_type[r];t[r]=Bh(i,"strict"),n[r]=Bh(i,"progressive")}return{default_create_mode:"strict",by_create_mode:{strict:{by_type:t},progressive:{by_type:n}}}}function qT(e,t){let n=Mr(e);if(n.length===0)return e;let r=!1,i=n.map(s=>{let o=s.properties;if(typeof o!="object"||o===null)return s;let a=o.action;return typeof a!="object"||a===null||a.const!=="create"?s:(r=!0,{...s,"x-create-required-options":t})});return r?{...e,oneOf:i}:e}function WT(e){let t=As(e.action)!==void 0||As(e.command)!==void 0,n=e.schemaOnly===!0||e.flagsOnly===!0||e.availabilityOnly===!0,r=e.summary===!0||e.full!==!0&&e.runtimeOnly!==!0&&!t&&!n,i=e.schemaOnly===!0,s=e.flagsOnly===!0,o=e.availabilityOnly===!0,a=e.runtimeOnly===!0,c=e.full===!0,d=As(e.action),l=As(e.command),u=!r&&!c&&!i&&!s&&!o&&!d&&!l;return{selectedAction:d,selectedCommand:l,summary:r,schemaOnly:i,flagsOnly:s,availabilityOnly:o,runtimeOnly:a,fullOutput:c,omitUnfilteredSchema:u,omitUnfilteredCommandFlags:u,omitUnfilteredCommanderAliases:u||l!==void 0&&!c}}function KT(e){if([e.summary,e.schemaOnly,e.flagsOnly,e.availabilityOnly].filter(t=>t).length>1)throw new p("Choose only one projection flag: --summary, --schema-only, --flags-only, or --availability-only.",m.USAGE)}async function zT(e,t=x){try{return await t(e)}catch{return structuredClone(Pt)}}async function BT(e,t,n){let r=await zT(t),i=await AT(e),s=$(r,i.registrations??N()),o=Gt(r.schema),a=wT(i);return{settings:r,runtimeProbe:i,typeRegistry:s,statusRegistry:K(r.schema),runtimeFieldRegistry:o,runtimeFieldFlagMap:DT(o),createRequiredOptionContracts:GT(s),extensionContracts:a,mergedExtensionContracts:CT(a.filter(c=>Rs(n,c.command,a))),extensionFlagMap:ng(i.flagRegistrations)}}function Hh(e){return e.availabilityOnly&&(e.selectedAction!==void 0&&xs.has(e.selectedAction)||e.selectedCommand!==void 0&&Jt.has(W(e.selectedCommand)))}function HT(e,t){let n=xT(t,{includePackageOwnedActions:Hh(e)});if(e.selectedAction===void 0&&e.selectedCommand===void 0){let r=new Set(lu);return n.filter(i=>!r.has(i.action)&&(e.fullOutput||(t.find(s=>s.action===i.action)?.tier??mc(i.action))!=="internal"))}return Hh(e)&&e.selectedCommand!==void 0&&Jt.has(W(e.selectedCommand))&&!n.some(r=>r.command_path===e.selectedCommand)&&n.push({action:pT(W(e.selectedCommand)),provider:"extension",requires_extension:!0,command_path:e.selectedCommand}),n}function VT(e,t){let n=new Set(t.map(r=>r.action));if(e.selectedAction&&!n.has(e.selectedAction))throw new p(`Unknown action: "${e.selectedAction}".`,m.USAGE)}function YT(e,t){return[...new Set([...Je.filter(n=>!Jt.has(W(n))),...[...Nr.keys()].filter(n=>!Jt.has(W(n))),...e.flatMap(n=>n.command_path?ht(n.command_path).filter(r=>n.provider==="extension"||!Jt.has(W(r))||t.some(i=>i.action===n.action)):[]),...t.flatMap(n=>n.command.split("|").flatMap(r=>{let i=Ye.find(s=>s.alias===r||s.canonical===r);return i===void 0?[r]:[i.alias,i.canonical]}))])].map(n=>be(n)).filter(n=>n.length>0).sort((n,r)=>n.localeCompare(r))}function JT(e,t){let n=t.slice(0,dT),r=t.length-n.length,i=r>0?`${n.join(", ")}, and ${r} more`:n.join(", "),s=t.slice(0,lT),o=t.slice(0,5).map(c=>`pm contracts --command "${c}" --flags-only --json`),a=t[0];return new p(`Command "${e}" is a command namespace. Choose a concrete child command: ${i}.`,m.USAGE,{code:"command_namespace",required:"Use a concrete child command path listed under this namespace.",why:"Command groups expose help at the namespace root, but command flag contracts belong to executable child commands.",examples:o,nextSteps:[`Retry with a child command, for example: ${o[0]}`],recovery:{suggested_retry:`pm contracts --command "${a}" --flags-only --json`,fallback_candidates:s.map(c=>({source:"command_namespace",command:`pm contracts --command "${c}" --flags-only --json`,reason:`Child command under ${e}`}))}})}function XT(e,t){return new p(`Unknown command: "${e}". Command "${e}" is provided by the optional "${t}" package. Run "pm package install ${t} --project" and retry.`,m.USAGE,{code:"unknown_command",required:`Install the optional "${t}" package, or choose a command from pm contracts --flags-only --json.`,why:"Command contracts include core commands plus commands registered by active packages and extensions.",examples:[`pm package install ${t} --project`,`pm contracts --command ${e} --flags-only --json`],nextSteps:[`Install the optional package first: pm package install ${t} --project`],recovery:{suggested_retry:`pm package install ${t} --project`}})}function QT(e){return new p(`Unknown command: "${e}".`,m.USAGE,{code:"unknown_command",required:"Use a command path listed by pm contracts --flags-only --json.",why:"Command contracts are generated from the active core, package, and extension command registry.",examples:["pm contracts --flags-only --json","pm --help"],nextSteps:["Verify spelling and active packages/extensions, then rerun with a known command path."],recovery:{suggested_retry:"pm contracts --flags-only --json"}})}function ZT(e,t){if(!e.selectedCommand||new Set(t).has(e.selectedCommand))return;let n=t.filter(i=>i.startsWith(`${e.selectedCommand} `));if(n.length>0)throw JT(e.selectedCommand,n);let r=Jh.get(W(e.selectedCommand));throw r?XT(e.selectedCommand,r):QT(e.selectedCommand)}function eC(e,t){let n=HT(e,t.mergedExtensionContracts);VT(e,n);let r=YT(n,t.mergedExtensionContracts);ZT(e,r);let i=e.selectedCommand?Qh.get(W(e.selectedCommand)):void 0,s=e.selectedCommand?n.filter(d=>i?d.action===i:_T(d,e.selectedCommand)):n;if(e.selectedCommand&&e.selectedAction&&!s.some(d=>d.action===e.selectedAction))throw new p(`Action "${e.selectedAction}" is not mapped to command "${e.selectedCommand}" in contracts output.`,m.USAGE);let o=e.selectedAction?s.filter(d=>d.action===e.selectedAction):s,a=[...new Map(o.map(d=>RT(d,t.runtimeProbe)).map(d=>[i?d.action:`${d.action}|${d.command_path??""}`,d])).values()],c=e.runtimeOnly&&!e.selectedAction&&!e.availabilityOnly?a.filter(d=>d.invocable):a;return{actionDescriptors:n,commandCatalog:r,commandScopedDescriptors:s,scopedActionDescriptors:o,selectedPackageOwnedAction:i,actionAvailability:c,actions:[...new Set(c.map(d=>d.action))]}}function tC(e){return new Set(Mr(e).map(t=>{let n=t.properties;if(typeof n!="object"||n===null)return null;let r=n.action;if(typeof r!="object"||r===null)return null;let i=r.const;return typeof i=="string"?i:null}).filter(t=>t!==null))}function nC(e){let t=df,n=Mr(t),r=tC(t),i=e.filter(s=>!r.has(s.action)).map(s=>ET(s));return i.length>0?{...t,oneOf:[...n,...i]}:t}function Vh(e,t,n){let r=new Set(t.actionDescriptors.map(s=>s.action)),i=e.selectedAction?hT(n,e.selectedAction):e.selectedCommand?Sc(n,new Set(t.scopedActionDescriptors.map(s=>s.action))):Sc(n,r);return e.runtimeOnly&&!e.selectedAction?Sc(i,new Set(t.actions)):i}function rC(e,t,n){let r=nC(t.mergedExtensionContracts),i=!e.flagsOnly&&!e.availabilityOnly?qT(Vh(e,n,r),t.createRequiredOptionContracts):Vh(e,n,r);return{mergedSchema:r,filteredSchema:i}}function iC(e,t){return e.selectedCommand!==void 0?[e.selectedCommand]:e.selectedAction?fT(t.scopedActionDescriptors,t.commandCatalog):t.commandCatalog}function sg(e,t){return t.find(n=>W(n.command)===W(e))?.tier??mc(e)}function Rs(e,t,n){return e.fullOutput||e.selectedCommand!==void 0||e.selectedAction!==void 0||sg(t,n)!=="internal"}function sC(e,t,n){if(e.selectedCommand!==void 0||e.selectedAction!==void 0)return t;let r=new Set(Ft.filter(i=>i.hidden&&(i.lifecycle==="deprecated"||!e.fullOutput&&!e.availabilityOnly)).map(i=>i.alias));if(e.summary&&!e.fullOutput)for(let i of Tc.keys())r.add(i);return t.filter(i=>!r.has(i)&&Rs(e,i,n))}function og(e){let t=Ye.find(r=>r.alias===e||r.canonical===e);if(t)return t.canonical;let n=e.split(" ")[0];return n.startsWith("list-")?"list":Tc.get(n)??n}var oC=new Map([["activate","Activate"],["adopt","Adopt"],["adopt-all","Adopt all"],["catalog","Catalog"],["complete","Complete"],["create","Create"],["deactivate","Deactivate"],["delete","Delete"],["describe","Describe"],["doctor","Diagnose"],["explore","Explore"],["init","Initialize"],["inspect","Inspect"],["install","Install"],["list","List"],["manage","Manage"],["migrate","Migrate"],["mutate","Mutate"],["reload","Reload"],["restore","Restore"],["run","Run"],["snapshot","Manage snapshots for"],["uninstall","Uninstall"],["upgrade","Upgrade"]]),aC=new Map([["extension adopt-all","extensions"],["package adopt-all","packages"],["workspace snapshot list","workspace snapshots"]]);function cC(e,t){let n=jh.get(W(e))??(e.includes(" ")?void 0:jh.get(og(e)));if(n!==void 0)return{intent:n,intent_source:"command"};let r=t.find(d=>ht(d.command).some(l=>W(l)===W(e)));if(r?.intent!==null&&r?.intent!==void 0)return{intent:r.intent,intent_source:"command"};if(r?.description!==null&&r?.description!==void 0)return{intent:r.description,intent_source:"description"};let i=e.split(" "),s=i.at(-1),o=i.slice(0,-1).join(" "),a=oC.get(s),c=aC.get(e)??o;return{intent:a===void 0||o.length===0?`Run ${e}.`:`${a} ${c}.`,intent_source:"generated"}}function dC(e,t=[],n={}){let r=n.includeFormatBudgets??!0,i=n.includeIntentProvenance??!0;return[...new Set(e.map(be))].filter(s=>s.length>0).sort((s,o)=>s.localeCompare(o)).map(s=>{let o=Ia(s,{generateFallback:!0}),a=s.split(" ")[0],c=Tc.get(a)??(a.startsWith("list-")?"list":a.startsWith("history-")?"history":a),d=new Set([...rg(s).map(_=>_.flag),...t.filter(_=>ht(_.command).some(h=>W(h)===W(s))).flatMap(_=>_.flags.map(h=>h.flag))]),l=(Uh.get(W(s))??Uh.get(c)??cT).filter(_=>d.has(_)),u=cC(s,t);return{command:s,intent:u.intent,...i||u.intent_source!=="command"?{intent_source:u.intent_source}:{},...l.length>0?{flags:l}:{},default_max_estimated_tokens:o.default_max_estimated_tokens,...r?{default_max_estimated_tokens_by_format:{...o.default_max_estimated_tokens_by_format}}:{}}})}function lC(e){return e.map(t=>({budget:Ia(t,{generateFallback:!0}),envelope:_h(t)}))}function uC(e){let t=new Map;for(let n of e){let r=yh(n),i=r===void 0?[m.SUCCESS,m.GENERIC_FAILURE,m.USAGE,m.NOT_FOUND,m.CONFLICT,m.DEPENDENCY_FAILED]:r.exit_codes,s=i.join(","),o=t.get(s)??{commands:[],exit_codes:i};o.commands.push(n),t.set(s,o)}return[...t.values()]}function mC(e,t,n){if(e.selectedCommand)return t.extensionContracts.filter(r=>ht(r.command).some(i=>W(i)===W(e.selectedCommand)));if(e.selectedAction){let r=new Set(n);return t.extensionContracts.filter(i=>ht(i.command).some(s=>r.has(s)))}return t.extensionContracts.filter(r=>Rs(e,r.command,t.extensionContracts))}function pC(e,t,n,r){return{schema_version:typeof t.mergedSchema["x-schema-version"]=="string"?t.mergedSchema["x-schema-version"]:null,schema_id:typeof t.mergedSchema.$id=="string"?t.mergedSchema.$id:null,selected:{action:e.selectedAction??null,command:e.selectedCommand??null,summary:e.summary,schema_only:e.schemaOnly,flags_only:e.flagsOnly,availability_only:e.availabilityOnly,runtime_only:e.runtimeOnly,command_scoped:e.selectedCommand!==void 0},commands:e.summary?[]:r,...!e.summary&&!e.flagsOnly?{actions:n.actions,action_availability:n.actionAvailability}:{}}}function _C(e,t,n){(n.selectedCommand==="history"||n.fullOutput)&&!n.flagsOnly&&!n.schemaOnly&&!n.availabilityOnly&&(e.history_operations=cm);let r=n.selectedCommand;e.runtime_schema={statuses:t.statusRegistry.definitions.map(i=>i.id),open_status:t.statusRegistry.open_status,close_status:t.statusRegistry.close_status,canceled_status:t.statusRegistry.canceled_status,types:[...t.typeRegistry.types],fields_by_command:Object.fromEntries([...t.runtimeFieldRegistry.command_to_fields.entries()].filter(([i])=>r===void 0||i===r).map(([i,s])=>[i,[...new Set(s.map(o=>`--${o.cli_flag}`))].sort((o,a)=>o.localeCompare(a))]))},!(r!==void 0&&!n.fullOutput)&&(e.extension_contracts={capabilities:[...nu],services:[...ru],policy_modes:[...iu],policy_mode_scope:"extensions.policy.mode",policy_surfaces:[...au],trust_modes:[...su],trust_mode_scope:"extensions.policy.trust_mode",sandbox_profiles:[...ou],manifest_versions:[1,2],compatibility:{current:"v2",previous:["v1"],breaking_strategy:"versioned_breaking"}},e.governance_contracts={ownership_enforcement_modes:[...gu],create_modes:[...yu],close_validation_modes:[...wu],workflow_enforcement_modes:[...vu]},e.relationship_kind_contracts=[...Pu,...(t.runtimeProbe.registrations?.relationship_kinds??[]).flatMap(i=>i.definitions)].sort((i,s)=>i.kind.localeCompare(s.kind)).map(i=>({canonical:i.kind,aliases:[...i.aliases??[]],...i.inverse===void 0?{}:{inverse:i.inverse},ordering:i.ordering,hierarchy:i.hierarchy})))}function fC(e,t,n,r){if(!(t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredSchema){e.schema=n.filteredSchema,e.extension_commands=r;return}e.schema_omitted_reason="unfiltered_default_brief",e.extension_commands=r}}function hC(e,t,n,r,i){if(!(t.schemaOnly||t.availabilityOnly)){if(t.omitUnfilteredCommandFlags)e.command_flags_omitted_reason="unfiltered_default_brief";else{e.command_flags=FT(r,n.extensionFlagMap,n.runtimeFieldFlagMap,t.selectedCommand!==void 0,n.extensionContracts);let s=new Set(r);e.list_projections=Object.entries(yp).filter(([o])=>s.has(o)).map(([o,a])=>({command:o,default:a,brief_fields:[...gp,"priority"],compact_fields:[...hp]}))}e.command_aliases=t.fullOutput?i:i.map(({canonical:s,aliases:o})=>({canonical:s,aliases:o})),t.fullOutput||(e.command_alias_contracts_omitted_reason="compact_projection; restore with --full")}}function gC(e,t){if(!(t.schemaOnly||t.flagsOnly||t.availabilityOnly)){if(!t.omitUnfilteredCommanderAliases){e.commander_aliases=jT();return}e.commander_aliases_omitted_reason=t.selectedCommand?"command_scoped":"unfiltered_default_brief"}}function yC(e,t,n,r){e.command_summaries=dC(t,n,{includeFormatBudgets:r.includeFormatBudgets,includeIntentProvenance:r.includeIntentProvenance}),e.output_policy={token_estimate:"ceil(utf8_bytes / 4)",degradation_ladder:[...ym],allows_unbounded_opt_out:!0},e.output_projection_contracts={global_ladder_field:"output_policy.degradation_ladder",global_ladder_scope:"union_not_per_command",discovery:"pm contracts --command <command> --summary",...r.includeProjectionModeMatrix?{commands:[...new Set(t.map(be))].filter(i=>bm(i)!==void 0).sort((i,s)=>i.localeCompare(s)).map(i=>({command:i,modes:[...km(i).keys()]}))}:{}},e.grammar_contracts={nouns:Ht.nouns,shared_verbs:Ht.shared_verbs,scope_before_verb:Ht.scope_before_verb,visible_top_level_ceiling:Ht.visible_top_level_ceiling,ceiling_raise_requires_pm_item:Ht.ceiling_raise_requires_pm_item,positional_shape_budget:Ht.positional_shape_budget,positional_shape_count:new Set(ja.map(({slots:i})=>bp(i))).size,positional_action_count:Ua.length,positional_action_parents:[...new Set(Ua.map(({parent:i})=>i))].sort((i,s)=>i.localeCompare(s)),...r.includePositionalSignatures?{positional_signatures:ja}:{}}}async function pG(e,t){let n=WT(e);KT(n);let r=R(process.cwd(),t.path),i=await BT(t,r,n),s=eC(n,i),o=rC(n,i,s),a=iC(n,s),c=sC(n,a,i.extensionContracts),d=pC(n,o,s,c),l=mC(n,i,c),u=n.fullOutput||n.selectedCommand!==void 0;if((n.summary||n.fullOutput)&&yC(d,c,l,{includeFormatBudgets:u,includeIntentProvenance:u,includePositionalSignatures:u,includeProjectionModeMatrix:u}),n.summary)return d;let _=UT(s.commandCatalog.filter(h=>Rs(n,h,i.extensionContracts)));return n.flagsOnly&&!n.fullOutput||_C(d,i,n),fC(d,n,o,l),hC(d,n,i,c,_),gC(d,n),(n.selectedCommand==="assurance"||n.fullOutput)&&(d.assurance_contracts={measurement_source_kinds:[...Ir],gate_triggers:[..._t]}),n.fullOutput&&d.grammar_contracts&&(d.grammar_contracts.destinations=vp.map(h=>({...h,reason:h.reason??""}))),n.fullOutput&&!n.schemaOnly&&!n.flagsOnly&&!n.availabilityOnly&&(d.mcp_tools=Fh(),d.context_intents=Sm(),d.read_output_dimensions=vm,d.error_codes=mh,d.command_output_contracts=lC(c),d.diagnostic_output_contracts=wm,d.command_exit_contracts={vocabulary:_c,command_sets:uC(c)}),d}import{createHash as cg}from"node:crypto";import $r from"node:fs/promises";import Pr 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]="69bf315a-01aa-56d9-bd56-196d6792dea2")}catch{}})();function Ue(e,t){throw new p(e,m.USAGE,t)}var wC="2026-07-15T06:22:12.276Z",vC=Date.parse(wC),bC=[["attributed","attributed"],["legacy_unknown","actionable_unknown"]],ag=e=>typeof e=="string"?e:"",dg=e=>{let t=e??{},n=ag(t.author).trim().toLowerCase(),r=Number(["","unknown"].includes(n)),i=+(Date.parse(ag(t.ts))>=vC);return bC[r][i]};function lg(e,t,n=20,r=new Set,i=!1){let s=[],o=[],a={legacy_unknown:0,actionable_unknown:0},c=Math.max(0,n),d=0,l=0,u=0;for(let[_,h]of t.split(/\r?\n/).entries()){let f;try{f=JSON.parse(h)}catch{continue}d+=1;let g=dg(f);if(g!=="attributed"){if(l+=1,g==="actionable_unknown"&&r.has(`${e}:${_+1}`)){u+=1;continue}a[g]+=1,i&&g==="actionable_unknown"&&o.push({item_id:e,line:_+1}),s.length<c&&s.push({item_id:e,line:_+1})}}return{checked_events:d,unknown_event_count:l,legacy_unknown_event_count:a.legacy_unknown,actionable_unknown_event_count:a.actionable_unknown,acknowledged_actionable_event_count:u,samples:s,samples_truncated:a.legacy_unknown+a.actionable_unknown>s.length,actionable_events:o}}var SG=(e,t,n=20,r=new Set)=>lg(e,t,n,r);function ug(e){let t=new Set;for(let n of e.split(/\r?\n/)){let r;try{r=JSON.parse(n)}catch{continue}let i=(typeof r=="object"&&r!==null&&typeof r.context=="object"&&r.context!==null?r.context:{}).author_acknowledgment;if(!(typeof i!="object"||i===null||!Array.isArray(i.events)))for(let s of i.events)typeof s=="object"&&s!==null&&typeof s.item_id=="string"&&Number.isSafeInteger(s.line)&&t.add(`${s.item_id}:${String(s.line)}`)}return t}var Fr=async(e,t=20,n=!1)=>{let r=Pr.join(e,"history"),i;try{i=(await $r.readdir(r)).filter(w=>w.endsWith(".jsonl")).sort((w,v)=>w.localeCompare(v))}catch{i=[]}let s=new Set,o=[],a=[],c=0,d=0,l=0,u=0,_=0,h=0,f="_workspace.jsonl",g=new Set;if(i.includes(f))try{g=ug(await $r.readFile(Pr.join(r,f),"utf8"))}catch{g=new Set}for(let w of i){let v;try{v=await $r.readFile(Pr.join(r,w),"utf8")}catch{continue}let b=w.slice(0,-6),T=lg(b,v,t-o.length,g,n);c+=1,d+=T.checked_events,l+=T.unknown_event_count,u+=T.legacy_unknown_event_count,_+=T.actionable_unknown_event_count,h+=T.acknowledged_actionable_event_count,T.unknown_event_count>0&&s.add(b),o.push(...T.samples),n&&a.push(...T.actionable_events)}let y=u+_;return{checked_streams:c,checked_events:d,unknown_event_count:l,legacy_unknown_event_count:u,actionable_unknown_event_count:_,acknowledged_actionable_event_count:h,affected_item_ids:[...s].sort((w,v)=>w.localeCompare(v)),samples:o,samples_truncated:y>o.length,...n?{actionable_events:a}:{}}};function kC(e){return[...new Map(e.map(t=>[`${t.item_id}:${t.line}`,{item_id:t.item_id,line:t.line}])).values()].sort((t,n)=>t.item_id.localeCompare(n.item_id)||t.line-n.line)}async function SC(e){try{return ug(await $r.readFile(Pr.join(e,"history","_workspace.jsonl"),"utf8"))}catch{return new Set}}function EC(e){return(e.item_id===Wt||/^[a-z0-9][a-z0-9-]*$/iu.test(e.item_id))&&Number.isSafeInteger(e.line)&&e.line>=1}function TC(e,t,n){let r=n[e.line-1]??"",i;try{i=JSON.parse(r)}catch{Ue(`Unknown-author acknowledgment target ${e.item_id}:${e.line} is not readable.`,{code:"history_author_acknowledge_target_unreadable"})}return dg(i)!=="actionable_unknown"&&Ue(`Author acknowledgment target ${e.item_id}:${e.line} is not an actionable unknown-author event.`,{code:"history_author_acknowledge_target_not_actionable"}),{...e,source_event_hash:cg("sha256").update(r).digest("hex"),disposition:t.has(`${e.item_id}:${e.line}`)?"already_acknowledged":"actionable"}}async function mg(e,t,n){let r=t.events??[],i=+(t.all_actionable===!0)+ +(r.length>0);i===0&&Ue("Specify exactly one selector: events or all_actionable.",{code:"history_author_acknowledge_selector_required"}),i>1&&Ue("Author acknowledgment accepts either explicit events or all_actionable, not both.",{code:"history_author_acknowledge_selector_conflict"}),(!Number.isSafeInteger(n)||n<0)&&Ue("Author acknowledgment coordinate_limit must be a non-negative integer.",{code:"history_author_acknowledge_preview_limit_invalid"});let s=kC(t.all_actionable===!0?(await Fr(e,0,!0)).actionable_events:r),o=await SC(e),a=new Map;for(let _ of s)if(EC(_)||Ue(`Unknown-author acknowledgment target ${_.item_id}:${_.line} is not readable.`,{code:"history_author_acknowledge_target_unreadable"}),!a.has(_.item_id))try{a.set(_.item_id,(await $r.readFile(Pr.join(e,"history",`${_.item_id}.jsonl`),"utf8")).split(/\r?\n/u))}catch{Ue(`Unknown-author acknowledgment target ${_.item_id}:${_.line} is not readable.`,{code:"history_author_acknowledge_target_unreadable"})}let c=s.map(_=>TC(_,o,a.get(_.item_id))),d=t.all_actionable===!0?"all_actionable":"events",l=cg("sha256").update(JSON.stringify({version:1,selection:d,coordinates:c})).digest("hex"),u=c.filter(({disposition:_})=>_==="actionable").length;return{plan:{selection:{kind:d},selected_count:c.length,actionable_count:u,already_acknowledged_count:c.length-u,omitted_count:Math.max(0,c.length-n),coordinates:c.slice(0,n),plan_fingerprint:l},completeCoordinates:c}}async function EG(e,t,n=50){return(await mg(e,t,n)).plan}function CC(e,t){let n=e.length>0;return n&&t&&Ue("Specify exactly one selector: repeat --event or pass --all-actionable.",{code:"history_author_acknowledge_selector_conflict",required:"Exactly one of --event or --all-actionable",examples:['pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"','pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"']}),!n&&!t&&Ue("Specify exactly one selector: repeat --event or pass --all-actionable.",{code:"history_author_acknowledge_selector_required",required:"Exactly one of --event or --all-actionable",examples:['pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"','pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"']}),{events:AC(e),all_actionable:t}}function AC(e){return e.map(t=>{let n=t.lastIndexOf(":"),r=t.slice(0,n).trim(),i=Number(t.slice(n+1)),s=r===Wt||/^[a-z0-9][a-z0-9-]*$/iu.test(r);return(n<1||!s||!Number.isSafeInteger(i)||i<1)&&Ue(`history-author-acknowledge --event expects <item-id>:<one-based-line>, received "${t}".`,{code:"history_author_acknowledge_target_unreadable"}),{item_id:r,line:i}})}function TG(e,t){let n=CC(pf(t.historyEvent),t.allActionable===!0||t.all_actionable===!0);return xC(e,{events:n.events,all_actionable:n.all_actionable,dry_run:t.dryRun===!0||t.dry_run===!0,plan_fingerprint:Z(t,"planFingerprint")??Z(t,"plan_fingerprint"),coordinate_limit:typeof t.limit=="number"?t.limit:typeof t.limit=="string"?Number(t.limit):void 0,attributed_author:Z(t,"attributedAuthor")??Z(t,"attributed_author")??void 0,reviewer:Z(t,"reviewer"),reason:Z(t,"reason")})}async function xC(e,t){let n=t.reviewer?.trim()??"",r=t.attributed_author?.trim()??"",i=t.reason?.trim()??"",s=await mg(e,t,t.coordinate_limit??50);if(t.dry_run===!0)return{dry_run:!0,mutated:!1,acknowledged:0,outcome:"preview",exit_code:m.SUCCESS,plan:s.plan};if([n.length>0,n.toLowerCase()!=="unknown",r.length>0,r.toLowerCase()!=="unknown",i.length>0].includes(!1)&&Ue("Author acknowledgment requires events, reviewer, attributed_author, and reason.",{code:"history_author_acknowledge_required_values_missing"}),t.plan_fingerprint?.trim()||Ue("Author acknowledgment apply requires plan_fingerprint from a fresh dry-run preview.",{code:"history_author_acknowledge_plan_fingerprint_required",recovery:{suggested_retry:"Rerun history-author-acknowledge with --dry-run, then pass --plan-fingerprint <value>."}}),t.plan_fingerprint.trim()!==s.plan.plan_fingerprint)throw new p("Author acknowledgment selection changed after preview; no history was mutated.",m.CONFLICT,{code:"history_author_acknowledge_plan_conflict",recovery:{suggested_retry:"Rerun history-author-acknowledge with --dry-run and apply the fresh plan_fingerprint."}});let o=s.completeCoordinates.filter(({disposition:l})=>s.plan.selection.kind==="events"||l==="actionable").map(({item_id:l,line:u})=>({item_id:l,line:u}));if(o.length===0)return{dry_run:!1,mutated:!1,acknowledged:0,outcome:"no_effect",exit_code:m.NO_EFFECT,plan:s.plan};let a=await x(e),c=await vn({pmRoot:e,op:"history:author-acknowledge",author:n,context:{author_acknowledgment:{events:o,attributed_author:r}},message:i,lockTtlSeconds:a.locks.ttl_seconds,lockWaitMs:a.locks.wait_ms}),d=s.plan.actionable_count>0&&s.plan.already_acknowledged_count>0?{outcome:"partial_effect",exit_code:m.PARTIAL_EFFECT}:{outcome:"effect",exit_code:m.SUCCESS};return{dry_run:!1,mutated:!0,acknowledged:o.length,...d,plan:s.plan,history_path:c.historyPath}}import IC from"node:fs/promises";import Ie from"node:path";import{glob as OC}from"tinyglobby";(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]="6f94fb3c-3d6c-5543-a2f0-e12680459e71")}catch{}})();var RC=/^[a-z][a-z0-9+.-]+:\/\//i;function Ur(e){return RC.test(e.trim())}(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]="12655e94-6304-56cf-9f5d-387a26572db0")}catch{}})();var LC=["path","scope","note"],DC=["pattern","glob","path","scope","note"],NC=["path"],MC=["from","to"],$C=new Set(["note","scope"]);function _g(e){let t=e??"project";if(!Pe.includes(t))throw new p(`Invalid scope "${e}". Valid scopes: ${Pe.join(", ")} (default: project).`,m.USAGE);return t}function Cc(e){if(e.startsWith("```")||e.includes(`
@@ -28,4 +28,4 @@ ${t}`;for(let r of Z$)if(r.regex.test(n))return{code:r.code};return null}functio
28
28
  `)}async function er(e,t){let n=ka(e,t),r=await X(n);return r?e0(r,n):null}async function GF(e){let t=ba(e);return await re(t)?(await Qn.readdir(t,{withFileTypes:!0})).filter(n=>n.isFile()&&n.name.endsWith(".json")).map(n=>_i.join(t,n.name)).sort((n,r)=>r.localeCompare(n)):[]}function qF(e){let t=e.match(/^VmRSS:\s+(\d+)\s+kB$/m);if(t)return Number.parseInt(t[1],10)*1024}async function WF(e){if(process.platform==="linux")try{let t=await Qn.readFile(`/proc/${e}/status`,"utf8");return qF(t)}catch{return}}function KF(e){let t=e.lastIndexOf(")");if(t<0)return{};let n=e.slice(t+2).trim().split(/\s+/),r=Number.parseInt(n[11],10),i=Number.parseInt(n[12],10);return!Number.isFinite(r)||!Number.isFinite(i)?{}:{cpu_user_seconds:r/zk,cpu_system_seconds:i/zk}}async function zF(e){if(process.platform!=="linux")return{};try{let t=await Qn.readFile(`/proc/${e}/stat`,"utf8");return KF(t)}catch{return{}}}async function Ol(e){let t=e.child_pid??e.worker_pid;if(!Zn(t))return;let n=await WF(t),r=await zF(t),i=e.started_at?Date.parse(e.started_at):Number.NaN,s=Number.isFinite(i)?Math.max(0,(Qk()-i)/1e3):void 0;return{recorded_at:I(),rss_bytes:n,cpu_user_seconds:r.cpu_user_seconds,cpu_system_seconds:r.cpu_system_seconds,uptime_seconds:s}}function Il(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function BF(e,t){if(!t||typeof t!="object")return{summary:{passed:0,failed:1,skipped:0},parsedResult:null};let n=t;if(e==="test-all"){let a=n.totals??{};return{summary:{items:typeof a.items=="number"?a.items:void 0,linked_tests:typeof a.linked_tests=="number"?a.linked_tests:void 0,passed:Il(a.passed),failed:Il(a.failed),skipped:Il(a.skipped),fail_on_skipped_triggered:n.fail_on_skipped_triggered===!0?!0:void 0},parsedResult:t}}let r=Array.isArray(n.run_results)?n.run_results:[],i=0,s=0,o=0;for(let a of r){if(!a||typeof a!="object")continue;let c=a.status;if(c==="passed"){i+=1;continue}if(c==="failed"||c==="refused"){s+=1;continue}o+=1}return{summary:{passed:i,failed:s,skipped:o,fail_on_skipped_triggered:n.fail_on_skipped_triggered===!0?!0:void 0},parsedResult:t}}function HF(e){let t=e.trim();if(t.length===0)return null;let n=t.match(/\[pm test-all\]\s+item\s+(\d+)\/(\d+)\s+(start|end)\s+id=([^\s]+)/i);if(n){let d=Number.parseInt(n[1],10),l=Number.parseInt(n[2],10);return{item_index:d,item_total:l,item_id:n[4],linked_test_index:void 0,linked_test_total:void 0,current_command:void 0,elapsed_ms:void 0,heartbeat_at:I(),phase:n[3]?.toLowerCase()==="end"?"finished":"running"}}let r=t.match(/\[pm test\]\s+linked-test\s+(\d+)\/(\d+)\s+(start|running|end)(?:.*elapsed_ms=(\d+))?/i);if(!r)return null;let i=Number.parseInt(r[1],10),s=Number.parseInt(r[2],10),o=r[4]?Number.parseInt(r[4],10):void 0,a=t.match(/\scommand="((?:\\.|[^"\\])*)"/),c=a?a[1].replaceAll('\\"','"').replaceAll("\\\\","\\"):void 0;return{linked_test_index:i,linked_test_total:s,current_command:c,elapsed_ms:Number.isFinite(o)?o:void 0,heartbeat_at:I(),phase:r[3]?.toLowerCase()==="end"?"finished":"running"}}function VF(e){return e.split(/\r?\n/).map(t=>t.trimEnd()).filter(t=>t.length>0)}function Ll(e,t){if(t<=0)return[];let n=VF(e);return n.length<=t?n:n.slice(n.length-t)}async function t0(e){let t=process.env.PM_BACKGROUND_CLI_ENTRY?.trim();if(t&&t.length>0){let i=_i.resolve(e,t);if(await re(i))return i}let n=_i.resolve(e,"dist","cli.js");if(await re(n))return n;let r=process.argv[1]?.trim();if(r&&r.length>0){let i=_i.resolve(e,r);if(await re(i))return i}throw new p("Unable to resolve a CLI entrypoint for background test runs. Build the project or set PM_BACKGROUND_CLI_ENTRY.",m.GENERIC_FAILURE)}async function fi(e,t){if(!Jk.has(t.status)||Zn(t.worker_pid)||t.finished_at)return t;let n={...t,status:"failed",finished_at:I(),error:t.error??"Background test run worker exited before writing terminal status."};return await it(e,n),n}async function Nl(e){await jF(e.pmRoot);let t=Zk(e.commandArgs);if(t.length===0)throw new p("Background test run requires command arguments.",m.USAGE);let n=UF(e.kind,t,e.pmRoot),r=await $l(e.pmRoot,{});for(let l of r){let u=await fi(e.pmRoot,l);if(u.fingerprint===n&&!(!Jk.has(u.status)||!Zn(u.worker_pid)))return{started:!1,run:{...u,duplicate_of:u.id},duplicate_of:u.id}}let i=FF(),s=I(),o=Ru(e.pmRoot,i),a=Iu(e.pmRoot,i),c=Lu(e.pmRoot,i);await Qn.writeFile(o,"","utf8"),await Qn.writeFile(a,"","utf8");let d={id:i,kind:e.kind,status:"queued",created_at:s,updated_at:s,requested_by:e.requestedBy,fingerprint:n,command_args:t,command_label:PF(t),pm_root:e.pmRoot,global_pm_root:e.globalPmRoot,target_id:e.targetId,status_filter:e.statusFilter,attempt:typeof e.attempt=="number"&&Number.isFinite(e.attempt)&&e.attempt>=1?Math.floor(e.attempt):1,resumed_from:e.resumedFrom,resumed_by:e.resumedBy,stdout_path:o,stderr_path:a,result_path:c,progress:{phase:"queued",message:"Queued for background execution.",heartbeat_at:s}};return await it(e.pmRoot,d),{started:!0,run:d}}async function Ml(e){let t=await er(e.pmRoot,e.runId);if(!t)throw new p(`Background test run ${e.runId} not found`,m.NOT_FOUND);if(Dl.has(t.status))throw new p(`Background test run ${t.id} is already terminal (${t.status}).`,m.CONFLICT);let n=await t0(process.cwd()),r=[];e.noExtensions===!0&&r.push("--no-extensions"),r.push("--path",t.pm_root,"test-runs-worker",t.id);let i={...process.env,PM_PATH:t.pm_root,PM_GLOBAL_PATH:t.global_pm_root,PM_BACKGROUND_TEST_RUN_ID:t.id,PM_BACKGROUND_TEST_RUN_ATTEMPT:String(t.attempt),PM_BACKGROUND_TEST_RUN_RESUMED_FROM:t.resumed_from??"",FORCE_COLOR:"0"},s=Yk(process.execPath,[n,...r],{cwd:process.cwd(),env:i,detached:!0,stdio:"ignore",windowsHide:!0});s.unref();let o={...t,status:"queued",worker_pid:s.pid,progress:{phase:"queued",message:"Worker process started.",heartbeat_at:I()}};return await it(e.pmRoot,o),o}async function Bk(e,t,n){await e,await Qn.appendFile(t,n,"utf8")}function n0(e,t){let n=Number.parseInt(process.env[e]??"",10);return Number.isFinite(n)&&n>0?n:t}function YF(e){return{...process.env,PM_PATH:e.pm_root,PM_GLOBAL_PATH:e.global_pm_root,FORCE_COLOR:"0"}}function JF(e,t){return t?["--no-extensions",...e.command_args]:[...e.command_args]}function XF(e,t){let n=Promise.resolve();return{schedule(){n=n.then(async()=>{try{await it(e,t)}catch{}})},async flush(){await n}}}function Hk(e,t){try{e.kill(t)}catch{}}async function QF(e,t,n,r){n.stopRequested||(n.stopRequested=!0,e.stop_requested_at=I(),e.progress={...e.progress,phase:"stopping",message:"Stop requested for background run.",heartbeat_at:I()},r(),Hk(t,"SIGTERM"),setTimeout(()=>Hk(t,"SIGKILL"),n0("PM_BACKGROUND_RUN_FORCE_KILL_DELAY_MS",MF)).unref?.())}function ZF(e,t,n){return{phase:n,message:e,heartbeat_at:I(),item_index:t.item_index,item_total:t.item_total,item_id:t.item_id,linked_test_index:void 0,linked_test_total:void 0,current_command:void 0,elapsed_ms:void 0}}function eU(e,t,n,r){return{phase:r,message:e,heartbeat_at:I(),item_index:n.item_index??t.progress?.item_index,item_total:n.item_total??t.progress?.item_total,item_id:n.item_id??t.progress?.item_id,linked_test_index:n.linked_test_index,linked_test_total:n.linked_test_total,current_command:n.current_command,elapsed_ms:n.elapsed_ms}}function Vk(e,t,n){let r=HF(t);if(!r)return!1;let i=e.progress?.phase==="stopping"?"stopping":"running";return e.progress=r.item_id?ZF(t,r,i):eU(t,e,r,i),r.phase==="finished"&&!n&&(e.progress.phase="running"),!0}function tU(e){if(e.trim().length===0)return null;try{return JSON.parse(e)}catch{return null}}function nU(e,t,n){return n?"stopped":e===0&&t.failed===0&&t.fail_on_skipped_triggered!==!0?"passed":"failed"}function rU(e,t){return{phase:"finished",message:t?"Background run stopped.":`Background run finished with status=${e.status}.`,heartbeat_at:I(),item_index:e.progress?.item_index,item_total:e.progress?.item_total,item_id:e.progress?.item_id,linked_test_index:e.progress?.linked_test_index,linked_test_total:e.progress?.linked_test_total,current_command:e.progress?.current_command,elapsed_ms:e.progress?.elapsed_ms}}async function iU(e,t,n){if(t!==null){await Le(e.result_path,`${JSON.stringify(t,null,2)}
29
29
  `);return}await Le(e.result_path,`${JSON.stringify({parse_error:"Background run output was not valid JSON.",stdout_excerpt:Ll(n,Xk)},null,2)}
30
30
  `)}async function r0(e,t,n=!1){let r=await er(e,t);if(!r)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let i={...r,status:"running",started_at:r.started_at??I(),worker_pid:process.pid,progress:{phase:"running",message:"Worker started.",heartbeat_at:I()}},s=await t0(process.cwd()),o=YF(i);await it(e,i);let a=JF(i,n),c=Yk(process.execPath,[s,...a],{cwd:process.cwd(),env:o,detached:!1,stdio:["ignore","pipe","pipe"],windowsHide:!0});i.child_pid=c.pid;let d=XF(e,i),l=d.schedule,u=Promise.resolve(),_=Promise.resolve(),h="",f="",g={stopRequested:!1},y=()=>{QF(i,c,g,l)};process.on("SIGTERM",y),process.on("SIGINT",y);let w=setInterval(()=>{(async()=>(i.resource=await Ol(i),i.progress.heartbeat_at=I(),l()))()},n0("PM_BACKGROUND_RUN_RESOURCE_INTERVAL_MS",NF));w.unref?.(),c.stdout?.on("data",k=>{let C=k.toString("utf8");h+=C,u=Bk(u,i.stdout_path,C)}),c.stderr?.on("data",k=>{let C=k.toString("utf8");_=Bk(_,i.stderr_path,C),f+=C;let O=f.split(/\r?\n/);f=O.pop();let M=!1;for(let E of O){let F=E.trimEnd();F.length>0&&Vk(i,F,g.stopRequested)&&(M=!0)}M&&l()});let v=null,b=null;try{({code:v,signal:b}=await new Promise(k=>{c.on("close",(C,O)=>{k({code:C,signal:O})})}))}finally{clearInterval(w),process.off("SIGTERM",y),process.off("SIGINT",y)}await u,await _;let T=f.trimEnd();T.length>0&&Vk(i,T,g.stopRequested)&&l(),f="";let S=tU(h),A=BF(i.kind,S);return i.summary=A.summary,i.exit_code=typeof v=="number"?v:void 0,i.signal=b??void 0,i.finished_at=I(),i.status=nU(i.exit_code,A.summary,g.stopRequested),i.progress=rU(i,g.stopRequested),i.resource=await Ol(i),await iU(i,S,h),await it(e,i),await d.flush(),i}async function $l(e,t){let n=await GF(e),r=[];for(let a of n){let c=await X(a);if(!c)continue;let d=await e0(c,a);r.push(d)}let i=[];for(let a of r)i.push(await fi(e,a));let s=(t.status?i.filter(a=>a.status===t.status):i).sort((a,c)=>{let d=Date.parse(c.updated_at)-Date.parse(a.updated_at);return Number.isFinite(d)&&d!==0?d:c.id.localeCompare(a.id)}),o=typeof t.limit=="number"&&t.limit>=0?t.limit:void 0;return o===void 0?s:s.slice(0,o)}async function i0(e,t){let n=await er(e,t);if(!n)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let r=await fi(e,n),i=Zn(r.worker_pid),s=Zn(r.child_pid);r.status==="running"&&!s&&!r.finished_at&&!i&&(r.status="failed",r.finished_at=I(),r.error=r.error??"Background run process exited unexpectedly.",await it(e,r)),r.status==="running"&&(r.resource=await Ol(r),await it(e,r));let o=r.progress?.heartbeat_at,a=o?Date.parse(o):Number.NaN,c=Number.isFinite(a)?Math.max(0,Qk()-a):void 0,d=Number.parseInt(process.env.PM_BACKGROUND_RUN_HEARTBEAT_STALE_MS??"",10),l=Number.isFinite(d)&&d>0?d:$F,u=r.status==="running"?c!==void 0&&c>l?"stale":"healthy":"inactive";return{run:r,health:{state:u,last_heartbeat_at:o,heartbeat_lag_ms:c,worker_alive:i,child_alive:s}}}function sU(e,t){let n=t?"SIGKILL":"SIGTERM";if(!Zn(e.worker_pid)||!e.worker_pid)return"none";try{return process.kill(e.worker_pid,n),n}catch{return"none"}}function oU(e,t){return{phase:"stopping",message:t==="none"?"Run marked stopped.":`Stop requested via ${t}.`,heartbeat_at:I(),item_index:e.progress?.item_index,item_total:e.progress?.item_total,item_id:e.progress?.item_id,linked_test_index:e.progress?.linked_test_index,linked_test_total:e.progress?.linked_test_total,current_command:e.progress?.current_command,elapsed_ms:e.progress?.elapsed_ms}}async function s0(e,t,n=!1){let r=await er(e,t);if(!r)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let i=await fi(e,r);if(Dl.has(i.status))return{run:i,signal_sent:"none"};let s=sU(i,n);return s==="none"&&(i.status="stopped",i.finished_at=i.finished_at??I()),i.stop_requested_at=I(),i.progress=oU(i,s),await it(e,i),{run:i,signal_sent:s}}async function o0(e,t,n,r=!1){let i=await er(e,t);if(!i)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let s=await fi(e,i);if(!Dl.has(s.status))throw new p(`Background test run ${t} is not terminal and cannot be resumed.`,m.CONFLICT);let o=await Nl({pmRoot:s.pm_root,globalPmRoot:s.global_pm_root,kind:s.kind,commandArgs:s.command_args,requestedBy:n,targetId:s.target_id,statusFilter:s.status_filter,resumedFrom:s.id,resumedBy:n,attempt:s.attempt+1});if(!o.started)return o.run;let a=await Ml({pmRoot:e,runId:o.run.id,noExtensions:r}),c={...s,resumed_by:a.id};return await it(e,c),a}async function a0(e,t,n,r){let i=await er(e,t);if(!i)throw new p(`Background test run ${t} not found`,m.NOT_FOUND);let s=typeof r=="number"&&Number.isFinite(r)&&r>=0?Math.floor(r):Xk,o=n==="stdout"||n==="both"?await X(i.stdout_path)??"":"",a=n==="stderr"||n==="both"?await X(i.stderr_path)??"":"";return{run:i,stream:n,tail:s,stdout:n==="stdout"||n==="both"?Ll(o,s):[],stderr:n==="stderr"||n==="both"?Ll(a,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]="8e9a2374-d190-52e1-8afd-14e1954863f0")}catch{}})();var cU=["queued","running","passed","failed","stopped","canceled"],dU=["stdout","stderr","both"];function lU(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(cU.includes(t))return t;throw new p(`Invalid --status value "${e}"`,m.USAGE)}function uU(e){if(e===void 0||e.trim().length===0)return"stderr";let t=e.trim().toLowerCase();if(dU.includes(t))return t;throw new p(`Invalid --stream value "${e}"`,m.USAGE)}function mU(){try{let e=aU.userInfo().username.trim();if(e.length>0)return e}catch{}}function c0(e,t){let n=[e,hm(),t,process.env.USER,process.env.LOGNAME,process.env.USERNAME,mU()];for(let r of n){if(typeof r!="string")continue;let i=r.trim();if(i.length>0)return i}return"unknown"}async function un(e){await U(e)}async function x9(e,t){let n=R(process.cwd(),t.path),r=We(process.cwd());await un(n);let i=await x(n),s=c0(e.author,i.author_default),o=await Nl({pmRoot:n,globalPmRoot:r,kind:e.kind,commandArgs:e.commandArgs,requestedBy:s,targetId:e.targetId,statusFilter:e.statusFilter});return o.started?{started:!0,run:await Ml({pmRoot:n,runId:o.run.id,noExtensions:e.noExtensions===!0})}:{started:!1,duplicate_of:o.duplicate_of,run:o.run}}async function R9(e,t){let n=R(process.cwd(),t.path);await un(n);let r=lU(e.status),i=pr(e.limit,"limit"),s=await $l(n,{status:r,limit:i});return{runs:s,count:s.length,filters:{status:r,limit:i}}}async function I9(e,t){let n=R(process.cwd(),t.path);await un(n);let r=await i0(n,e);return{run:r.run,health:r.health}}async function O9(e,t,n){let r=R(process.cwd(),n.path);await un(r);let i=uU(t.stream),s=pr(t.tail,"tail"),o=await a0(r,e,i,s);return{run:o.run,stream:o.stream,tail:o.tail,stdout:o.stdout,stderr:o.stderr}}async function L9(e,t,n){let r=R(process.cwd(),n.path);await un(r);let i=await s0(r,e,t.force===!0);return{run:i.run,signal_sent:i.signal_sent}}async function D9(e,t,n){let r=R(process.cwd(),n.path);await un(r);let i=await x(r),s=c0(t.author,i.author_default),o=await o0(r,e,s,t.noExtensions===!0);return{resumed_from:e,run:o}}async function N9(e,t){let n=R(process.cwd(),t.path);await un(n);let r=await r0(n,e,t.noExtensions===!0);return{id:r.id,status:r.status,exit_code:r.exit_code}}export{iS as a,jf as b,_U as c,LU as d,aS as e,Vt as f,DU as g,cS as h,qf as i,NU as j,Cr as k,MU as l,lS as m,mS as n,$U as o,zf as p,GU as q,qU as r,OS as s,WU as t,KU as u,zU as v,lc as w,BU as x,HU as y,VU as z,eE as A,Ln as B,tE as C,QU as D,ZU as E,mc as F,ej as G,tj as H,nj as I,iE as J,rj as K,ij as L,sj as M,oj as N,pc as O,ch as P,cj as Q,ah as R,mh as S,_E as T,Rr as U,wE as V,_h as W,kE as X,bj as Y,_c as Z,gh as _,EE as $,Tj as aa,Cj as ba,yh as ca,Aj as da,xj as ea,L as fa,Re as ga,nt as ha,Dn as ia,fc as ja,vh as ka,_t as la,Ir as ma,LE as na,yc as oa,wc as pa,Eh as qa,Mn as ra,Lr as sa,bc as ta,XE as ua,Ih as va,Dr as wa,Lh as xa,Cs as ya,kc as za,Dh as Aa,Nh as Ba,Mh as Ca,pG as Da,wC as Ea,dg as Fa,SG as Ga,Fr as Ha,EG as Ia,CC as Ja,AC as Ka,TG as La,xC as Ma,_g as Na,UC as Oa,jC as Pa,GC as Qa,qC as Ra,jr as Sa,WC as Ta,gt as Ua,KC as Va,zC as Wa,BC as Xa,xc as Ya,Rc as Za,HC as _a,Is as $a,Os as ab,fg as bb,yg as cb,mq as db,iA as eb,sA as fb,kg as gb,Lc as hb,hq as ib,bq as jb,Cg as kb,xg as lb,Uq as mb,jq as nb,Gr as ob,$s as pb,Lg as qb,Dg as rb,Ng as sb,Mg as tb,Ug as ub,OA as vb,DA as wb,NA as xb,MA as yb,Kg as zb,zg as Ab,Bg as Bb,Fs as Cb,Us as Db,by as Eb,bW as Fb,ky as Gb,Ey as Hb,Ty as Ib,xy as Jb,Iy as Kb,sd as Lb,Br as Mb,Hr as Nb,IR as Ob,qn as Pb,Fy as Qb,pd as Rb,jy as Sb,Gy as Tb,iI as Ub,Sz as Vb,Pw as Wb,Jr as Xb,jw as Yb,Gw as Zb,qw as _b,Id as $b,mO as ac,oB as bc,Vw as cc,RB as dc,DB as ec,AO as fc,so as gc,Nd as hc,Jw as ic,VB as jc,VO as kc,oo as lc,ao as mc,lo as nc,av as oc,nn as pc,po as qc,tn as rc,sv as sc,Qr as tc,Zr as uc,_o as vc,fo as wc,rn as xc,sn as yc,zn as zc,ho as Ac,go as Bc,yo as Cc,ei as Dc,Ao as Ec,pL as Fc,Pd as Gc,wV as Hc,cn as Ic,FD as Jc,No as Kc,Dv as Lc,Nv as Mc,y4 as Nc,ZD as Oc,gN as Pc,wN as Qc,ii as Rc,w4 as Sc,Qd as Tc,S4 as Uc,cM as Vc,Zd as Wc,q4 as Xc,W4 as Yc,Uo as Zc,i5 as _c,s5 as $c,o5 as ad,lb as bd,k5 as cd,EM as dd,ol as ed,TM as fd,CM as gd,AM as hd,S5 as id,E5 as jd,P5 as kd,F5 as ld,U5 as md,Cb as nd,Ab as od,GM as pd,xb as qd,a3 as rd,Rb as sd,c3 as td,d3 as ud,Go as vd,i$ as wd,h3 as xd,cl as yd,g3 as zd,dl as Ad,s$ as Bd,ai as Cd,Db as Dd,Nb as Ed,j3 as Fd,Pb as Gd,e8 as Hd,t8 as Id,Qb as Jd,fl as Kd,Cl as Ld,q6 as Md,m1 as Nd,pi as Od,h1 as Pd,xl as Qd,Gk as Rd,a9 as Sd,x9 as Td,R9 as Ud,I9 as Vd,O9 as Wd,L9 as Xd,D9 as Yd,N9 as Zd};
31
- //# sourceMappingURL=chunk-JK7O7MFO.js.map
31
+ //# sourceMappingURL=chunk-WWW5WHHJ.js.map