@unbrained/pm-cli 2026.8.7 → 2026.8.9

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 (288) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +54 -0
  3. package/dist/cli/main.js +4 -3
  4. package/dist/cli/register-annotations.d.ts +11 -0
  5. package/dist/cli/register-annotations.js +195 -0
  6. package/dist/cli/register-history-author.js +7 -30
  7. package/dist/cli/register-mutation.js +25 -206
  8. package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
  9. package/dist/cli/runtime-compatibility-boundary.js +43 -0
  10. package/dist/cli-bundle/bundle-manifest.json +158 -694
  11. package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +13 -0
  12. package/dist/cli-bundle/chunks/chunk-5JO6R4BS.js +3 -0
  13. package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +194 -0
  14. package/dist/cli-bundle/chunks/chunk-EF43KODO.js +2 -0
  15. package/dist/cli-bundle/chunks/chunk-GMX5YOI3.js +77 -0
  16. package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +28 -0
  17. package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +5 -0
  19. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
  20. package/dist/cli-bundle/chunks/chunk-RJC7TPF4.js +8 -0
  21. package/dist/cli-bundle/chunks/chunk-YC3UF2IO.js +2068 -0
  22. package/dist/cli-bundle/chunks/{register-list-query-FJZCJ67O.js → register-list-query-BUE7PTCU.js} +8 -8
  23. package/dist/cli-bundle/chunks/register-mutation-FC3XLVIK.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +2 -0
  25. package/dist/cli-bundle/chunks/register-setup-UQDTNTLJ.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +153 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-4VJQTS3P.js → chunk-3GSFUDAI.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-3WVHTUAW.js +5 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +16 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-73JUDYXT.js → chunk-54TZJ4BM.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-HNL6IFGS.js → chunk-6DO4YQWZ.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-73FIJONU.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-TIKDBG4D.js → chunk-C3GCHDSQ.js} +29 -27
  35. package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +18 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-YZEZAPJK.js → chunk-KNEHLPBF.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-MRWVJ3ZG.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +4 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-NBJKQP4S.js → chunk-P6BBIQRG.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-QHRTT7WT.js → chunk-PZAGVQNN.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +14 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-RPNYG5MO.js → chunk-VRXJSGIT.js} +6 -6
  45. package/dist/cli-bundle/focused-chunks/{chunk-R2LEMEV5.js → chunk-XC2ZW3CJ.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +2 -0
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +1 -1
  50. package/dist/cli-bundle/sdk-core.js +38 -38
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +1 -1
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +2 -1
  58. package/dist/cli.js +14 -4
  59. package/dist/core/diagnostics/remediation.js +12 -2
  60. package/dist/core/history/history.js +13 -4
  61. package/dist/core/item/actionability.d.ts +7 -1
  62. package/dist/core/item/actionability.js +71 -15
  63. package/dist/core/output/output.js +9 -2
  64. package/dist/core/sentry/helpers.d.ts +10 -0
  65. package/dist/core/sentry/helpers.js +59 -4
  66. package/dist/core/shared/author.d.ts +25 -0
  67. package/dist/core/shared/author.js +114 -9
  68. package/dist/core/shared/constants.d.ts +2 -0
  69. package/dist/core/shared/constants.js +4 -2
  70. package/dist/sdk/actionability.d.ts +1 -1
  71. package/dist/sdk/actionability.js +3 -3
  72. package/dist/sdk/annotations.d.ts +40 -0
  73. package/dist/sdk/annotations.js +61 -9
  74. package/dist/sdk/author-attribution.d.ts +12 -0
  75. package/dist/sdk/author-attribution.js +73 -11
  76. package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
  77. package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
  78. package/dist/sdk/cli-contracts/completeness.js +5 -3
  79. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  80. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +19 -0
  81. package/dist/sdk/cli-contracts/runtime-contracts.js +44 -2
  82. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
  83. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  84. package/dist/sdk/cli-contracts/tool-schema.js +6 -3
  85. package/dist/sdk/comments.d.ts +7 -0
  86. package/dist/sdk/comments.js +2 -2
  87. package/dist/sdk/completion.js +9 -5
  88. package/dist/sdk/contracts.d.ts +1 -0
  89. package/dist/sdk/contracts.js +3 -2
  90. package/dist/sdk/core-governance.d.ts +1 -1
  91. package/dist/sdk/core-governance.js +3 -3
  92. package/dist/sdk/dependencies.d.ts +2 -0
  93. package/dist/sdk/dependencies.js +7 -6
  94. package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
  95. package/dist/sdk/environment/host-environment-errors.js +124 -0
  96. package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
  97. package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
  98. package/dist/sdk/environment/source-context.d.ts +23 -0
  99. package/dist/sdk/environment/source-context.js +29 -0
  100. package/dist/sdk/error-code-catalog.d.ts +6 -0
  101. package/dist/sdk/error-code-catalog.js +62 -8
  102. package/dist/sdk/extension/bundled-catalog.js +19 -6
  103. package/dist/sdk/generated-error-code-catalog.js +665 -3
  104. package/dist/sdk/governance/health.d.ts +11 -3
  105. package/dist/sdk/governance/health.js +32 -13
  106. package/dist/sdk/governance/provenance-health.d.ts +26 -0
  107. package/dist/sdk/governance/provenance-health.js +139 -0
  108. package/dist/sdk/governance/validate.js +13 -8
  109. package/dist/sdk/governance.d.ts +1 -0
  110. package/dist/sdk/governance.js +3 -2
  111. package/dist/sdk/graph/assembly.d.ts +4 -0
  112. package/dist/sdk/graph/assembly.js +22 -2
  113. package/dist/sdk/graph/run.d.ts +2 -0
  114. package/dist/sdk/graph/run.js +3 -2
  115. package/dist/sdk/index.d.ts +7 -3
  116. package/dist/sdk/index.js +9 -5
  117. package/dist/sdk/learnings.d.ts +15 -0
  118. package/dist/sdk/learnings.js +2 -2
  119. package/dist/sdk/lifecycle/close-many.d.ts +6 -1
  120. package/dist/sdk/lifecycle/close-many.js +43 -5
  121. package/dist/sdk/lifecycle/close.js +13 -8
  122. package/dist/sdk/lifecycle/create.js +6 -12
  123. package/dist/sdk/lifecycle/plan.js +6 -3
  124. package/dist/sdk/lifecycle/update-many.d.ts +2 -1
  125. package/dist/sdk/lifecycle/update-many.js +29 -5
  126. package/dist/sdk/lifecycle/update.js +6 -20
  127. package/dist/sdk/merge/driver.d.ts +2 -1
  128. package/dist/sdk/merge/driver.js +7 -4
  129. package/dist/sdk/merge/index.d.ts +1 -1
  130. package/dist/sdk/merge/index.js +3 -3
  131. package/dist/sdk/merge/install.d.ts +21 -0
  132. package/dist/sdk/merge/install.js +51 -21
  133. package/dist/sdk/merge/receipts.d.ts +14 -1
  134. package/dist/sdk/merge/receipts.js +36 -8
  135. package/dist/sdk/merge/reconcile.js +21 -4
  136. package/dist/sdk/merge/three-way.d.ts +6 -2
  137. package/dist/sdk/merge/three-way.js +24 -10
  138. package/dist/sdk/notes.d.ts +7 -0
  139. package/dist/sdk/notes.js +2 -2
  140. package/dist/sdk/query/get.d.ts +11 -0
  141. package/dist/sdk/query/get.js +37 -3
  142. package/dist/sdk/read-output-contracts.d.ts +1 -1
  143. package/dist/sdk/read-output-contracts.js +103 -5
  144. package/dist/sdk/relationship-kinds/contract.d.ts +48 -0
  145. package/dist/sdk/relationship-kinds/contract.js +22 -0
  146. package/dist/sdk/relationships.d.ts +6 -41
  147. package/dist/sdk/relationships.js +12 -126
  148. package/dist/sdk/runtime-primitives.d.ts +1 -1
  149. package/dist/sdk/runtime-primitives.js +3 -3
  150. package/dist/sdk/runtime.d.ts +1 -1
  151. package/dist/sdk/runtime.js +9 -25
  152. package/dist/sdk/similarity.d.ts +5 -0
  153. package/dist/sdk/similarity.js +40 -10
  154. package/dist/sdk/structured-mutations.js +5 -2
  155. package/dist/sdk/test/execution.js +4 -2
  156. package/dist/sdk/test/linked-command-detection.d.ts +2 -7
  157. package/dist/sdk/test/linked-command-detection.js +22 -9
  158. package/dist/sdk/test/parsers.js +5 -2
  159. package/dist/sdk/workspace-snapshot.d.ts +9 -0
  160. package/dist/sdk/workspace-snapshot.js +48 -16
  161. package/docs/AGENT_GUIDE.md +2 -1
  162. package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
  163. package/docs/COMMANDS.md +19 -1
  164. package/docs/DEPENDENCY_KIND_CONTRACT.md +29 -0
  165. package/docs/ITEM_READ_PROJECTIONS.md +26 -0
  166. package/docs/MERGE_SAFETY.md +10 -3
  167. package/docs/README.md +1 -0
  168. package/docs/RELATIONSHIP_GRAPH.md +1 -1
  169. package/docs/RELEASING.md +27 -2
  170. package/docs/SCRIPTING.md +27 -1
  171. package/docs/SDK_AGENT_SESSION_CONTEXT.md +35 -2
  172. package/docs/SDK_CONTEXT_INTEGRITY.md +81 -0
  173. package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
  174. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  175. package/docs/SENTRY_CONTRACT_EPOCHS.md +20 -0
  176. package/docs/TESTING.md +17 -0
  177. package/docs/agent-task-token-baseline.json +2 -2
  178. package/marketplace.json +2 -2
  179. package/package.json +5 -3
  180. package/packages/pm-beads/package.json +1 -1
  181. package/packages/pm-calendar/package.json +1 -1
  182. package/packages/pm-command-kit/package.json +1 -1
  183. package/packages/pm-digital-twin/package.json +1 -1
  184. package/packages/pm-governance-audit/package.json +1 -1
  185. package/packages/pm-guide-shell/package.json +1 -1
  186. package/packages/pm-kanban/package.json +1 -1
  187. package/packages/pm-lifecycle-hooks/package.json +1 -1
  188. package/packages/pm-linked-test-adapters/package.json +1 -1
  189. package/packages/pm-search-advanced/package.json +1 -1
  190. package/packages/pm-templates/package.json +1 -1
  191. package/packages/pm-todos/package.json +1 -1
  192. package/packages/pm-vcs/package.json +1 -1
  193. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  194. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  195. package/sdk/public-surface.json +756 -57
  196. package/dist/cli-bundle/chunks/append-7BXBFDGD.js +0 -2
  197. package/dist/cli-bundle/chunks/chunk-2AXF3VSK.js +0 -2
  198. package/dist/cli-bundle/chunks/chunk-2XS43CCV.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +0 -8
  200. package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +0 -8
  201. package/dist/cli-bundle/chunks/chunk-4MTI7XOV.js +0 -5
  202. package/dist/cli-bundle/chunks/chunk-6BX5UDCN.js +0 -3
  203. package/dist/cli-bundle/chunks/chunk-6QPO7KLR.js +0 -2
  204. package/dist/cli-bundle/chunks/chunk-7MXHZHSQ.js +0 -5
  205. package/dist/cli-bundle/chunks/chunk-7ZPMJW4U.js +0 -2
  206. package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
  207. package/dist/cli-bundle/chunks/chunk-AGYNSNCI.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +0 -5
  209. package/dist/cli-bundle/chunks/chunk-B4KLBBMN.js +0 -2
  210. package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
  211. package/dist/cli-bundle/chunks/chunk-CALJHNBL.js +0 -23
  212. package/dist/cli-bundle/chunks/chunk-CFIGP5LY.js +0 -2
  213. package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
  214. package/dist/cli-bundle/chunks/chunk-CS6MRHG7.js +0 -2
  215. package/dist/cli-bundle/chunks/chunk-CUGNQQKH.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +0 -164
  217. package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
  218. package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
  219. package/dist/cli-bundle/chunks/chunk-H5Y5YE6A.js +0 -2
  220. package/dist/cli-bundle/chunks/chunk-H5Y6UV6E.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-H7KGWPDF.js +0 -2
  222. package/dist/cli-bundle/chunks/chunk-HFSD77TQ.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-HX2GTA6L.js +0 -2
  224. package/dist/cli-bundle/chunks/chunk-J2IEKAVR.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
  226. package/dist/cli-bundle/chunks/chunk-K44PYFXH.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-K4KGEEBT.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +0 -21
  229. package/dist/cli-bundle/chunks/chunk-KL6IEBV2.js +0 -2
  230. package/dist/cli-bundle/chunks/chunk-KWQZDZSS.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-KZ4X3DGU.js +0 -3
  232. package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +0 -13
  233. package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-ME2JJ4LA.js +0 -3
  235. package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
  236. package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +0 -2
  237. package/dist/cli-bundle/chunks/chunk-NG6OXIBR.js +0 -19
  238. package/dist/cli-bundle/chunks/chunk-NYIGHWQY.js +0 -8
  239. package/dist/cli-bundle/chunks/chunk-NZ75GNSA.js +0 -2
  240. package/dist/cli-bundle/chunks/chunk-PCJWJNC2.js +0 -2
  241. package/dist/cli-bundle/chunks/chunk-PD3225AM.js +0 -2
  242. package/dist/cli-bundle/chunks/chunk-PDEGKG7P.js +0 -2
  243. package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +0 -2
  244. package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +0 -56
  245. package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
  246. package/dist/cli-bundle/chunks/chunk-TPKN3S7S.js +0 -2
  247. package/dist/cli-bundle/chunks/chunk-TPXAXTCO.js +0 -2
  248. package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +0 -2
  249. package/dist/cli-bundle/chunks/chunk-UQLZQVFW.js +0 -55
  250. package/dist/cli-bundle/chunks/chunk-VT3Z5G7D.js +0 -2
  251. package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +0 -2
  252. package/dist/cli-bundle/chunks/chunk-WSJEIGJF.js +0 -3
  253. package/dist/cli-bundle/chunks/chunk-WYNUU7ZW.js +0 -2008
  254. package/dist/cli-bundle/chunks/chunk-YGPNCCXZ.js +0 -2
  255. package/dist/cli-bundle/chunks/close-CMY3BAUG.js +0 -2
  256. package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +0 -2
  257. package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +0 -2
  258. package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +0 -2
  259. package/dist/cli-bundle/chunks/create-I5DVV4YG.js +0 -2
  260. package/dist/cli-bundle/chunks/delete-RL3JACSW.js +0 -2
  261. package/dist/cli-bundle/chunks/deps-S7UBCECS.js +0 -2
  262. package/dist/cli-bundle/chunks/docs-ZZNVBBYO.js +0 -2
  263. package/dist/cli-bundle/chunks/files-27C337VT.js +0 -2
  264. package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +0 -2
  265. package/dist/cli-bundle/chunks/history-compact-HJQK67CZ.js +0 -2
  266. package/dist/cli-bundle/chunks/history-redact-PWC6PDWA.js +0 -2
  267. package/dist/cli-bundle/chunks/history-repair-N3CY4WBF.js +0 -2
  268. package/dist/cli-bundle/chunks/learnings-4FH23XDT.js +0 -2
  269. package/dist/cli-bundle/chunks/profile-5Y5XXH5N.js +0 -2
  270. package/dist/cli-bundle/chunks/register-mutation-YGYPW3BL.js +0 -20
  271. package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +0 -2
  272. package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +0 -2
  273. package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +0 -2
  274. package/dist/cli-bundle/chunks/schema-EQGKBYXJ.js +0 -2
  275. package/dist/cli-bundle/chunks/update-QVTYOD6I.js +0 -2
  276. package/dist/cli-bundle/chunks/update-many-DJSBU525.js +0 -2
  277. package/dist/cli-bundle/focused-chunks/chunk-2ECLECMK.js +0 -12
  278. package/dist/cli-bundle/focused-chunks/chunk-3K4XV2BF.js +0 -16
  279. package/dist/cli-bundle/focused-chunks/chunk-4EX25PXM.js +0 -8
  280. package/dist/cli-bundle/focused-chunks/chunk-CIXVQPB7.js +0 -5
  281. package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +0 -2
  282. package/dist/cli-bundle/focused-chunks/chunk-DQ6FKGL3.js +0 -14
  283. package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +0 -2
  284. package/dist/cli-bundle/focused-chunks/chunk-MHMTKV5V.js +0 -2
  285. package/dist/cli-bundle/focused-chunks/chunk-MOTJFQ3F.js +0 -153
  286. package/dist/cli-bundle/focused-chunks/chunk-RW5IYD4J.js +0 -4
  287. package/dist/cli-bundle/focused-chunks/chunk-VZFU2R4M.js +0 -2
  288. package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +0 -2
@@ -4,7 +4,7 @@
4
4
  * Provides shared primitives and utilities for Author.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0139d8ef-d286-571f-89f8-7de2f8422f22")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a89b5501-1909-5ea8-b34b-8ca9b4bc5dd5")}catch(e){}}();
8
8
  import { AsyncLocalStorage } from "node:async_hooks";
9
9
  import { createHash } from "node:crypto";
10
10
  import fs from "node:fs";
@@ -31,13 +31,12 @@ export const BUILTIN_HARNESS_SIGNAL_DESCRIPTORS = [
31
31
  session_environment_keys: ["CLAUDE_CODE_SESSION_ID"],
32
32
  provenance_environment_keys: {
33
33
  effort: ["CLAUDE_EFFORT"],
34
- role: ["CLAUDE_CODE_CHILD_SESSION"],
35
34
  },
36
35
  provenance_resolvers: {
37
36
  model: "claude_session_file",
38
37
  version: "claude_session_file",
39
38
  },
40
- provenance_unavailable_dimensions: ["topic"],
39
+ provenance_unavailable_dimensions: ["role", "topic"],
41
40
  argv_markers: ["claude", "claude-code"],
42
41
  client_names: ["claude", "claude-code", "claude code"],
43
42
  },
@@ -192,6 +191,28 @@ function firstEnvironmentValue(env, keys) {
192
191
  return undefined;
193
192
  }
194
193
  function provenanceFromArgv(argv, dimension) {
194
+ const flaggedValue = provenanceFlagValue(argv, dimension);
195
+ if (flaggedValue !== undefined)
196
+ return flaggedValue;
197
+ if (dimension === "topic") {
198
+ return argv
199
+ .slice(0, 16)
200
+ .map((token) => token.trim())
201
+ .find((token) => /^pm-[a-z0-9][a-z0-9-]{2,63}$/u.test(token));
202
+ }
203
+ if (dimension === "role") {
204
+ const command = argv
205
+ .slice(0, 8)
206
+ .map((token) => token.trim().toLowerCase())
207
+ .find((token) => ["claim", "create", "update", "close", "release", "review"].includes(token));
208
+ if (command === "review")
209
+ return "reviewer";
210
+ if (command)
211
+ return "implementer";
212
+ }
213
+ return undefined;
214
+ }
215
+ function provenanceFlagValue(argv, dimension) {
195
216
  const acceptedFlags = dimension === "model"
196
217
  ? ["--model", "--agent-model"]
197
218
  : [`--agent-${dimension}`];
@@ -208,6 +229,21 @@ function provenanceFromArgv(argv, dimension) {
208
229
  }
209
230
  return undefined;
210
231
  }
232
+ const AGENT_ROLE_VALUES = new Set([
233
+ "implementation",
234
+ "implementer",
235
+ "investigator",
236
+ "orchestrator",
237
+ "planner",
238
+ "release-operator",
239
+ "reviewer",
240
+ ]);
241
+ function normalizeProvenanceValue(dimension, value) {
242
+ if (dimension !== "role" || value === undefined)
243
+ return value;
244
+ const normalized = value.trim().toLowerCase().replaceAll(/[_\s]+/gu, "-");
245
+ return AGENT_ROLE_VALUES.has(normalized) ? normalized : undefined;
246
+ }
211
247
  function boundedProvenanceValue(provenance, dimension) {
212
248
  return nonBlank(provenance?.[dimension])?.slice(0, 256);
213
249
  }
@@ -307,7 +343,7 @@ function resolveAgentProvenanceObservation(dimension, signals, env, descriptor,
307
343
  let overrideValue;
308
344
  let argvValue;
309
345
  if (hostResolvedDimensions.has(dimension)) {
310
- overrideValue = nonBlank(env[overrideKey])?.slice(0, 256);
346
+ overrideValue = normalizeProvenanceValue(dimension, nonBlank(env[overrideKey])?.slice(0, 256));
311
347
  argvValue = provenanceFromArgv(signals.argv ?? [], dimension);
312
348
  }
313
349
  const environmentKeysByDimension = {
@@ -321,10 +357,10 @@ function resolveAgentProvenanceObservation(dimension, signals, env, descriptor,
321
357
  const values = [
322
358
  overrideValue,
323
359
  boundedProvenanceValue(sessionContext?.provenance, dimension),
324
- firstEnvironmentValue(env, environmentKeysByDimension[dimension]),
325
- boundedProvenanceValue(clientProvenance, dimension),
326
- boundedProvenanceValue(signals.provenance, dimension),
327
- argvValue,
360
+ normalizeProvenanceValue(dimension, firstEnvironmentValue(env, environmentKeysByDimension[dimension])),
361
+ normalizeProvenanceValue(dimension, boundedProvenanceValue(clientProvenance, dimension)),
362
+ normalizeProvenanceValue(dimension, boundedProvenanceValue(signals.provenance, dimension)),
363
+ normalizeProvenanceValue(dimension, argvValue),
328
364
  resolveProvenanceProbe(dimension, signals, env, descriptor),
329
365
  ];
330
366
  const sources = [
@@ -469,6 +505,75 @@ export function detectAgentIdentity(signals) {
469
505
  ];
470
506
  return Object.fromEntries(entries.filter((entry) => entry[1] !== undefined));
471
507
  }
508
+ function resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEnabled, invalidValue) {
509
+ const resolver = descriptor?.provenance_resolvers[dimension];
510
+ if (identity.provenance?.[dimension]) {
511
+ return {
512
+ status: "resolved",
513
+ ...(resolver ? { resolver } : {}),
514
+ rule_version: "v1",
515
+ };
516
+ }
517
+ if (invalidValue) {
518
+ return {
519
+ status: "unavailable",
520
+ reason: "invalid_value",
521
+ rule_version: "v1",
522
+ };
523
+ }
524
+ if (resolver) {
525
+ const resolverHasInput = resolver === "ai_agent_version"
526
+ ? nonBlank(env.AI_AGENT) !== undefined
527
+ : nonBlank(env.CLAUDE_CODE_SESSION_ID) !== undefined;
528
+ const status = resolverHasInput && probesEnabled ? "failed" : "unavailable";
529
+ const reason = !resolverHasInput
530
+ ? "harness_unavailable"
531
+ : probesEnabled
532
+ ? "resolver_failed"
533
+ : "probes_disabled";
534
+ return { status, reason, resolver, rule_version: "v1" };
535
+ }
536
+ return {
537
+ status: "unavailable",
538
+ reason: descriptor?.provenance_unavailable_dimensions.includes(dimension)
539
+ ? "harness_unavailable"
540
+ : "resolver_not_configured",
541
+ rule_version: "v1",
542
+ };
543
+ }
544
+ /**
545
+ * Diagnose provenance without exposing environment values, paths, or probe data.
546
+ *
547
+ * This additive SDK contract keeps legacy `detectAgentIdentity` projections
548
+ * stable while giving health checks and history writers explicit absence states.
549
+ */
550
+ export function diagnoseAgentIdentity(signals) {
551
+ const effectiveSignals = effectiveHarnessDetectionSignals(signals);
552
+ const identity = detectAgentIdentity(effectiveSignals);
553
+ const descriptor = currentHarnessSignalDescriptors(effectiveSignals.descriptors).find((candidate) => candidate.harness === identity.harness);
554
+ const env = effectiveSignals.env ?? {};
555
+ const probesEnabled = effectiveSignals.probes_enabled !== false &&
556
+ workspaceHarnessSignalsStorage.getStore()?.probesEnabled !== false &&
557
+ !["0", "false", "off"].includes(nonBlank(env.PM_AGENT_PROBES)?.toLowerCase() ?? "");
558
+ const sessionContext = resolveAgentSessionContextFromSignals(effectiveSignals, env);
559
+ const invalidRoleValue = [
560
+ env.PM_AGENT_ROLE,
561
+ sessionContext.provenance?.role,
562
+ firstEnvironmentValue(env, descriptor?.provenance_environment_keys.role),
563
+ effectiveSignals.client_info?.provenance?.role,
564
+ effectiveSignals.provenance?.role,
565
+ provenanceFlagValue(effectiveSignals.argv ?? [], "role"),
566
+ ].some((candidate) => {
567
+ const value = nonBlank(candidate)?.slice(0, 256);
568
+ return (value !== undefined &&
569
+ normalizeProvenanceValue("role", value) === undefined);
570
+ });
571
+ const outcomes = Object.fromEntries(AGENT_PROVENANCE_DIMENSIONS.map((dimension) => [
572
+ dimension,
573
+ resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEnabled, dimension === "role" && invalidRoleValue),
574
+ ]));
575
+ return { ...identity, provenance_outcomes: outcomes };
576
+ }
472
577
  /** Reads the invocation-wide author override through the canonical environment seam. */
473
578
  export function readAuthorEnvironment() {
474
579
  return process.env.PM_AUTHOR;
@@ -575,4 +680,4 @@ export function resolveAuthor(candidate, fallback) {
575
680
  return identity.author;
576
681
  }
577
682
  //# sourceMappingURL=author.js.map
578
- //# debugId=0139d8ef-d286-571f-89f8-7de2f8422f22
683
+ //# debugId=a89b5501-1909-5ea8-b34b-8ca9b4bc5dd5
@@ -58,6 +58,8 @@ export declare const EXIT_CODE: {
58
58
  readonly NOT_FOUND: 3;
59
59
  readonly CONFLICT: 4;
60
60
  readonly DEPENDENCY_FAILED: 5;
61
+ readonly NO_EFFECT: 6;
62
+ readonly PARTIAL_EFFECT: 7;
61
63
  };
62
64
  /** Restricts telemetry error category values accepted by command, SDK, and storage contracts. */
63
65
  export type TelemetryErrorCategory = "usage" | "validation" | "conflict" | "runtime" | "unknown";
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="46d7e58b-d1b6-5f9d-86cb-76ca671ed127")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="36b908f0-ea19-5adc-8ccd-320ad3c3b1fe")}catch(e){}}();
3
3
  import { createDefaultExtensionGovernancePolicy } from "../extensions/extension-types.js";
4
4
  /**
5
5
  * Canonical default lifecycle status model and workflow role mapping.
@@ -421,6 +421,8 @@ export const EXIT_CODE = {
421
421
  NOT_FOUND: 3,
422
422
  CONFLICT: 4,
423
423
  DEPENDENCY_FAILED: 5,
424
+ NO_EFFECT: 6,
425
+ PARTIAL_EFFECT: 7,
424
426
  };
425
427
  /** Public contract for telemetry error category by code, shared by SDK and presentation-layer consumers. */
426
428
  export const TELEMETRY_ERROR_CATEGORY_BY_CODE = Object.freeze({
@@ -475,4 +477,4 @@ export function resolveTelemetryErrorCategory(errorCode) {
475
477
  return "unknown";
476
478
  }
477
479
  //# sourceMappingURL=constants.js.map
478
- //# debugId=46d7e58b-d1b6-5f9d-86cb-76ca671ed127
480
+ //# debugId=36b908f0-ea19-5adc-8ccd-320ad3c3b1fe
@@ -7,4 +7,4 @@
7
7
  * blocker or ready-work classifications without storage or rendering side
8
8
  * effects.
9
9
  */
10
- export { collectBlockedByIds, collectDependencyBlockedIds, computeActionabilityReport, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
10
+ export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
@@ -8,7 +8,7 @@
8
8
  * effects.
9
9
  */
10
10
 
11
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9184e723-8269-5e45-8c6a-52fd02da60e6")}catch(e){}}();
12
- export { collectBlockedByIds, collectDependencyBlockedIds, computeActionabilityReport, resolveItemBlockers, } from "../core/item/actionability.js";
11
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cc271a73-9767-54bb-a142-d4d4569e3c6a")}catch(e){}}();
12
+ export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, } from "../core/item/actionability.js";
13
13
  //# sourceMappingURL=actionability.js.map
14
- //# debugId=9184e723-8269-5e45-8c6a-52fd02da60e6
14
+ //# debugId=cc271a73-9767-54bb-a142-d4d4569e3c6a
@@ -23,7 +23,45 @@ export interface AnnotationCommandOptions {
23
23
  force?: boolean;
24
24
  /** Whether list results include paging metadata. */
25
25
  includeMeta?: boolean;
26
+ /** Return the complete collection after a mutation instead of the bounded mutation receipt. */
27
+ fullHistory?: boolean;
26
28
  }
29
+ /** Identifies the single annotation mutation represented by a bounded response. */
30
+ export interface AnnotationMutationReceipt {
31
+ /** Mutation applied to the annotation collection. */
32
+ action: "add" | "edit" | "delete";
33
+ /** Stable one-based collection position targeted by the mutation. */
34
+ entry_index: number;
35
+ /** Number of stored entries changed by the mutation. */
36
+ changed_count: 1;
37
+ /** Whether the response includes the complete post-mutation collection. */
38
+ full_history_included: boolean;
39
+ }
40
+ /** Transport-neutral selectors that restore a complete annotation collection. */
41
+ export interface AnnotationHistoryRestoration {
42
+ /** Stable semantic selector shared by every transport. */
43
+ selector: "full_history";
44
+ /** Equivalent CLI flag. */
45
+ cli_flag: "--full-history";
46
+ /** Equivalent direct SDK option. */
47
+ sdk_option: "fullHistory";
48
+ /** Equivalent MCP tool option. */
49
+ mcp_option: "full";
50
+ }
51
+ /** Describes annotation history withheld from a bounded mutation response. */
52
+ export interface AnnotationOmissionReceipt {
53
+ /** Whether any historical collection entries were withheld. */
54
+ has_omissions: boolean;
55
+ /** Number of independently restorable field groups withheld. */
56
+ omitted_field_group_count: number;
57
+ /** Omitted groups and the transport-neutral selectors that restore them. */
58
+ omitted_field_groups: Array<{
59
+ name: string;
60
+ restore_with: AnnotationHistoryRestoration;
61
+ }>;
62
+ }
63
+ /** Map transport-level `full` onto the SDK annotation history option. */
64
+ export declare function normalizeAnnotationTransportOptions(options: Record<string, unknown>): Record<string, unknown>;
27
65
  /** Presentation-layer inputs accepted by the shared annotation source resolver. */
28
66
  export interface AnnotationSourceOptions {
29
67
  /** Inline annotation text or the stdin token (`-`). */
@@ -93,6 +131,8 @@ export type AnnotationCommandResult<TKey extends string, TEntry extends Annotati
93
131
  returned_count?: number;
94
132
  has_more?: boolean;
95
133
  limit?: number;
134
+ mutation_receipt?: AnnotationMutationReceipt;
135
+ omission_receipt?: AnnotationOmissionReceipt;
96
136
  };
97
137
  /** Implements limit annotation entries for the public runtime surface of this module. */
98
138
  export declare function limitAnnotationEntries<TEntry>(values: TEntry[], limit: number | undefined): TEntry[];
@@ -4,7 +4,7 @@
4
4
  * Implements the pm annotation command command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="eeb7b433-094b-5c4f-bc81-d4988ac297b4")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="13cf8bd9-0aee-5838-a6eb-de9f87ddfac7")}catch(e){}}();
8
8
  import { readFile } from "node:fs/promises";
9
9
  import { pathExists } from "../core/fs/fs-utils.js";
10
10
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
@@ -18,6 +18,15 @@ import { resolveAuthor } from "../core/shared/author.js";
18
18
  import { locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
19
19
  import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
20
20
  import { readSettings } from "../core/store/settings.js";
21
+ /** Map transport-level `full` onto the SDK annotation history option. */
22
+ export function normalizeAnnotationTransportOptions(options) {
23
+ const normalized = {
24
+ ...options,
25
+ ...(options.full === true ? { fullHistory: true } : {}),
26
+ };
27
+ delete normalized.full;
28
+ return normalized;
29
+ }
21
30
  /** Reject mutation of canonical structured events while allowing ordinary annotations. */
22
31
  function assertAnnotationEntryMutable(entry, operation) {
23
32
  if (typeof entry === "object" &&
@@ -249,7 +258,10 @@ export async function runAnnotationCommand(id, options, global, config) {
249
258
  wrapOwnershipConflict(error, config.conflictGuidance);
250
259
  }
251
260
  const allEntries = readAnnotationEntries(result.item, config.collectionKey);
252
- return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true);
261
+ return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true, {
262
+ action: "delete",
263
+ entryIndex: config.input.index,
264
+ }, options.fullHistory === true);
253
265
  }
254
266
  const rawText = config.input.rawValue ?? config.input.value ?? "";
255
267
  assertAnnotationAddValueIsNotFlagLike(rawText, config);
@@ -289,7 +301,11 @@ export async function runAnnotationCommand(id, options, global, config) {
289
301
  wrapOwnershipConflict(error, config.conflictGuidance);
290
302
  }
291
303
  const allEntries = readAnnotationEntries(result.item, config.collectionKey);
292
- return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true);
304
+ return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true, {
305
+ action: "edit",
306
+ entryIndex: config.input.index,
307
+ entry: allEntries[config.input.index - 1],
308
+ }, options.fullHistory === true);
293
309
  }
294
310
  let result;
295
311
  try {
@@ -315,7 +331,11 @@ export async function runAnnotationCommand(id, options, global, config) {
315
331
  wrapOwnershipConflict(error, config.conflictGuidance);
316
332
  }
317
333
  const allEntries = readAnnotationEntries(result.item, config.collectionKey);
318
- return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true);
334
+ return renderAnnotationResult(result.item.id, config.collectionKey, allEntries, limit, options.includeMeta === true, {
335
+ action: "add",
336
+ entryIndex: allEntries.length,
337
+ entry: allEntries.at(-1),
338
+ }, options.fullHistory === true);
319
339
  }
320
340
  /** Implements resolve annotation index for the public runtime surface of this module. */
321
341
  export function resolveAnnotationIndex(oneBasedIndex, count, collectionKey) {
@@ -330,21 +350,53 @@ export function resolveAnnotationIndex(oneBasedIndex, count, collectionKey) {
330
350
  }
331
351
  return oneBasedIndex - 1;
332
352
  }
333
- function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMeta) {
334
- const entries = limitAnnotationEntries(allEntries, limit);
353
+ function renderAnnotationResult(id, collectionKey, allEntries, limit, includeMeta, mutation, fullHistory = false) {
354
+ const entries = mutation === undefined || fullHistory
355
+ ? limitAnnotationEntries(allEntries, mutation !== undefined && fullHistory ? undefined : limit)
356
+ : mutation.entry === undefined
357
+ ? []
358
+ : [mutation.entry];
359
+ const historyOmitted = mutation !== undefined && entries.length < allEntries.length;
335
360
  return {
336
361
  id,
337
362
  [collectionKey]: entries,
338
363
  count: entries.length,
339
- ...(includeMeta
364
+ ...([includeMeta, mutation !== undefined].includes(true)
340
365
  ? {
341
366
  total_count: allEntries.length,
342
367
  returned_count: entries.length,
343
- has_more: entries.length < allEntries.length,
368
+ has_more: historyOmitted || entries.length < allEntries.length,
344
369
  ...(limit !== undefined ? { limit } : {}),
345
370
  }
346
371
  : {}),
372
+ ...(mutation === undefined
373
+ ? {}
374
+ : {
375
+ mutation_receipt: {
376
+ action: mutation.action,
377
+ entry_index: mutation.entryIndex,
378
+ changed_count: 1,
379
+ full_history_included: !historyOmitted,
380
+ },
381
+ omission_receipt: {
382
+ has_omissions: historyOmitted,
383
+ omitted_field_group_count: historyOmitted ? 1 : 0,
384
+ omitted_field_groups: historyOmitted
385
+ ? [
386
+ {
387
+ name: `${collectionKey}_history`,
388
+ restore_with: {
389
+ selector: "full_history",
390
+ cli_flag: "--full-history",
391
+ sdk_option: "fullHistory",
392
+ mcp_option: "full",
393
+ },
394
+ },
395
+ ]
396
+ : [],
397
+ },
398
+ }),
347
399
  };
348
400
  }
349
401
  //# sourceMappingURL=annotations.js.map
350
- //# debugId=eeb7b433-094b-5c4f-bc81-d4988ac297b4
402
+ //# debugId=13cf8bd9-0aee-5838-a6eb-de9f87ddfac7
@@ -52,6 +52,18 @@ export interface AcknowledgeUnknownAuthorEventsOptions {
52
52
  /** Evidence-backed rationale for the attribution. */
53
53
  reason: string;
54
54
  }
55
+ /** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
56
+ export declare function resolveUnknownAuthorAcknowledgmentSelector(rawEvents: readonly string[], allActionable: boolean): {
57
+ events: UnknownAuthorHistoryEvent[];
58
+ all_actionable: boolean;
59
+ };
60
+ /** Parse user-facing item or workspace history coordinates into SDK events. */
61
+ export declare function parseUnknownAuthorHistoryEventCoordinates(values: readonly string[]): UnknownAuthorHistoryEvent[];
62
+ /** Normalize an untyped transport payload and execute author acknowledgment. */
63
+ export declare function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot: string, input: Record<string, unknown>): Promise<{
64
+ acknowledged: number;
65
+ history_path: string;
66
+ }>;
55
67
  /**
56
68
  * Append an audited disposition for immutable unknown-author events without
57
69
  * rewriting their original streams.
@@ -4,13 +4,14 @@
4
4
  * Provides reusable diagnostics for mutation-author provenance in tracker history.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="09427917-8347-59cc-9358-452671aed3c3")}catch(e){}}();
7
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4fd16197-979e-5269-bed7-f2fb0e2038c2")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
- import { appendWorkspaceAuditEvent } from "../core/history/workspace-history.js";
10
+ import { appendWorkspaceAuditEvent, WORKSPACE_HISTORY_ID, } from "../core/history/workspace-history.js";
11
11
  import { readSettings } from "../core/store/settings.js";
12
12
  import { EXIT_CODE } from "../core/shared/constants.js";
13
13
  import { PmCliError } from "../core/shared/errors.js";
14
+ import { readRuntimeString, readRuntimeStringArray } from "./runtime-input.js";
14
15
  /**
15
16
  * Refuse an acknowledgment argument as a classified usage error.
16
17
  *
@@ -22,8 +23,8 @@ import { PmCliError } from "../core/shared/errors.js";
22
23
  * keeps expected validation out of the error channel without masking genuine
23
24
  * failures, which retain their own exit codes.
24
25
  */
25
- function refuseAuthorAcknowledgmentArgument(message, code) {
26
- throw new PmCliError(message, EXIT_CODE.USAGE, { code });
26
+ function refuseAuthorAcknowledgmentArgument(message, context) {
27
+ throw new PmCliError(message, EXIT_CODE.USAGE, context);
27
28
  }
28
29
  /** First release-governance anchor after which unknown authors require remediation. */
29
30
  export const HISTORY_AUTHOR_ATTRIBUTION_BASELINE = "2026-07-15T06:22:12.276Z";
@@ -203,6 +204,63 @@ export const scanHistoryAuthorAttribution = async (pmRoot, sampleLimit = 20, inc
203
204
  ...(includeActionableEvents ? { actionable_events: actionableEvents } : {}),
204
205
  };
205
206
  };
207
+ /** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
208
+ export function resolveUnknownAuthorAcknowledgmentSelector(rawEvents, allActionable) {
209
+ const hasExplicitEvents = rawEvents.length > 0;
210
+ if (hasExplicitEvents && allActionable) {
211
+ refuseAuthorAcknowledgmentArgument("Specify exactly one selector: repeat --event or pass --all-actionable.", {
212
+ code: "history_author_acknowledge_selector_conflict",
213
+ required: "Exactly one of --event or --all-actionable",
214
+ examples: [
215
+ 'pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"',
216
+ 'pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"',
217
+ ],
218
+ });
219
+ }
220
+ if (!hasExplicitEvents && !allActionable) {
221
+ refuseAuthorAcknowledgmentArgument("Specify exactly one selector: repeat --event or pass --all-actionable.", {
222
+ code: "history_author_acknowledge_selector_required",
223
+ required: "Exactly one of --event or --all-actionable",
224
+ examples: [
225
+ 'pm history-author-acknowledge --event pm-a1b2:4 --attributed-author agent --reviewer maintainer --reason "Verified provenance"',
226
+ 'pm history-author-acknowledge --all-actionable --attributed-author import-agent --reviewer maintainer --reason "Reviewed the complete actionable set"',
227
+ ],
228
+ });
229
+ }
230
+ return {
231
+ events: parseUnknownAuthorHistoryEventCoordinates(rawEvents),
232
+ all_actionable: allActionable,
233
+ };
234
+ }
235
+ /** Parse user-facing item or workspace history coordinates into SDK events. */
236
+ export function parseUnknownAuthorHistoryEventCoordinates(values) {
237
+ return values.map((value) => {
238
+ const separator = value.lastIndexOf(":");
239
+ const itemId = value.slice(0, separator).trim();
240
+ const line = Number(value.slice(separator + 1));
241
+ const validItemId = itemId === WORKSPACE_HISTORY_ID || /^[a-z0-9][a-z0-9-]*$/iu.test(itemId);
242
+ if (separator < 1 ||
243
+ !validItemId ||
244
+ !Number.isSafeInteger(line) ||
245
+ line < 1) {
246
+ refuseAuthorAcknowledgmentArgument(`history-author-acknowledge --event expects <item-id>:<one-based-line>, received "${value}".`, { code: "history_author_acknowledge_target_unreadable" });
247
+ }
248
+ return { item_id: itemId, line };
249
+ });
250
+ }
251
+ /** Normalize an untyped transport payload and execute author acknowledgment. */
252
+ export function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot, input) {
253
+ const selector = resolveUnknownAuthorAcknowledgmentSelector(readRuntimeStringArray(input.historyEvent), input.allActionable === true || input.all_actionable === true);
254
+ return acknowledgeUnknownAuthorHistoryEvents(pmRoot, {
255
+ events: selector.events,
256
+ all_actionable: selector.all_actionable,
257
+ attributed_author: readRuntimeString(input, "attributedAuthor") ??
258
+ readRuntimeString(input, "attributed_author") ??
259
+ "",
260
+ reviewer: readRuntimeString(input, "reviewer") ?? "",
261
+ reason: readRuntimeString(input, "reason") ?? "",
262
+ });
263
+ }
206
264
  /**
207
265
  * Append an audited disposition for immutable unknown-author events without
208
266
  * rewriting their original streams.
@@ -213,8 +271,11 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
213
271
  const reason = options.reason.trim();
214
272
  const explicitEvents = options.events ?? [];
215
273
  const selectorCount = Number(options.all_actionable === true) + Number(explicitEvents.length > 0);
274
+ if (selectorCount === 0) {
275
+ refuseAuthorAcknowledgmentArgument("Specify exactly one selector: events or all_actionable.", { code: "history_author_acknowledge_selector_required" });
276
+ }
216
277
  if (selectorCount > 1) {
217
- refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", "history_author_acknowledge_selector_conflict");
278
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", { code: "history_author_acknowledge_selector_conflict" });
218
279
  }
219
280
  const selectedEvents = options.all_actionable === true
220
281
  ? (await scanHistoryAuthorAttribution(pmRoot, 0, true))
@@ -229,7 +290,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
229
290
  reason.length > 0,
230
291
  ].includes(false);
231
292
  if (requiredValuesMissing) {
232
- refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", "history_author_acknowledge_required_values_missing");
293
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", { code: "history_author_acknowledge_required_values_missing" });
233
294
  }
234
295
  const uniqueEvents = [
235
296
  ...new Map(selectedEvents.map((event) => [
@@ -239,12 +300,13 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
239
300
  ].sort((left, right) => left.item_id.localeCompare(right.item_id) || left.line - right.line);
240
301
  for (const event of uniqueEvents) {
241
302
  const invalidCoordinate = [
242
- /^[a-z0-9][a-z0-9-]*$/i.test(event.item_id),
303
+ event.item_id === WORKSPACE_HISTORY_ID ||
304
+ /^[a-z0-9][a-z0-9-]*$/i.test(event.item_id),
243
305
  Number.isSafeInteger(event.line),
244
306
  event.line >= 1,
245
307
  ].includes(false);
246
308
  if (invalidCoordinate) {
247
- refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, "history_author_acknowledge_target_unreadable");
309
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
248
310
  }
249
311
  let parsed;
250
312
  try {
@@ -253,10 +315,10 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
253
315
  parsed = JSON.parse(line ?? "");
254
316
  }
255
317
  catch {
256
- refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, "history_author_acknowledge_target_unreadable");
318
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
257
319
  }
258
320
  if (classifyHistoryAuthorEvent(parsed) !== "actionable_unknown") {
259
- refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, "history_author_acknowledge_target_not_actionable");
321
+ refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, { code: "history_author_acknowledge_target_not_actionable" });
260
322
  }
261
323
  }
262
324
  const settings = await readSettings(pmRoot);
@@ -280,4 +342,4 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
280
342
  };
281
343
  }
282
344
  //# sourceMappingURL=author-attribution.js.map
283
- //# debugId=09427917-8347-59cc-9358-452671aed3c3
345
+ //# debugId=4fd16197-979e-5269-bed7-f2fb0e2038c2