@unbrained/pm-cli 2026.8.6 → 2026.8.8

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 (269) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +65 -0
  3. package/dist/cli/main.js +6 -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/register-operations.js +11 -2
  9. package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
  10. package/dist/cli/runtime-compatibility-boundary.js +43 -0
  11. package/dist/cli/stats-analytics-json.d.ts +9 -0
  12. package/dist/cli/stats-analytics-json.js +69 -0
  13. package/dist/cli-bundle/bundle-manifest.json +156 -692
  14. package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
  15. package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
  18. package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
  20. package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
  21. package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
  22. package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
  23. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
  26. package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
  28. package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
  42. package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
  44. package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
  50. package/dist/cli-bundle/main.js +13 -13
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +38 -37
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +1 -1
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +2 -1
  61. package/dist/cli.js +14 -4
  62. package/dist/core/extensions/reserved-host-flags.js +3 -2
  63. package/dist/core/history/workspace-history.d.ts +22 -2
  64. package/dist/core/history/workspace-history.js +60 -36
  65. package/dist/core/output/output.d.ts +2 -0
  66. package/dist/core/output/output.js +10 -2
  67. package/dist/core/sentry/helpers.d.ts +10 -0
  68. package/dist/core/sentry/helpers.js +59 -4
  69. package/dist/core/shared/command-types.d.ts +2 -0
  70. package/dist/core/shared/command-types.js +2 -2
  71. package/dist/core/shared/constants.d.ts +2 -0
  72. package/dist/core/shared/constants.js +4 -2
  73. package/dist/mcp/tool-definitions.js +6 -2
  74. package/dist/sdk/annotations.d.ts +40 -0
  75. package/dist/sdk/annotations.js +61 -9
  76. package/dist/sdk/author-attribution.d.ts +12 -0
  77. package/dist/sdk/author-attribution.js +87 -9
  78. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  79. package/dist/sdk/cli-bootstrap.js +7 -2
  80. package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
  81. package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
  82. package/dist/sdk/cli-contracts/completeness.js +54 -5
  83. package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
  84. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  85. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
  86. package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
  87. package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
  88. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  89. package/dist/sdk/cli-contracts/tool-schema.js +22 -3
  90. package/dist/sdk/cli-program.js +3 -2
  91. package/dist/sdk/comments.d.ts +7 -0
  92. package/dist/sdk/comments.js +2 -2
  93. package/dist/sdk/completion.js +12 -5
  94. package/dist/sdk/contracts.d.ts +2 -0
  95. package/dist/sdk/contracts.js +3 -2
  96. package/dist/sdk/core.d.ts +3 -1
  97. package/dist/sdk/core.js +4 -3
  98. package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
  99. package/dist/sdk/environment/host-environment-errors.js +124 -0
  100. package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
  101. package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
  102. package/dist/sdk/environment/source-context.d.ts +23 -0
  103. package/dist/sdk/environment/source-context.js +29 -0
  104. package/dist/sdk/error-code-catalog.d.ts +6 -0
  105. package/dist/sdk/error-code-catalog.js +62 -8
  106. package/dist/sdk/extension.js +9 -11
  107. package/dist/sdk/generated-error-code-catalog.js +739 -3
  108. package/dist/sdk/governance/health.d.ts +11 -3
  109. package/dist/sdk/governance/health.js +5 -5
  110. package/dist/sdk/history-analytics.d.ts +141 -0
  111. package/dist/sdk/history-analytics.js +283 -0
  112. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  113. package/dist/sdk/improvement-ledger-validation.js +63 -0
  114. package/dist/sdk/improvement-ledger.d.ts +139 -0
  115. package/dist/sdk/improvement-ledger.js +261 -0
  116. package/dist/sdk/index.d.ts +13 -5
  117. package/dist/sdk/index.js +15 -7
  118. package/dist/sdk/learnings.d.ts +15 -0
  119. package/dist/sdk/learnings.js +2 -2
  120. package/dist/sdk/lifecycle/close-many.d.ts +6 -1
  121. package/dist/sdk/lifecycle/close-many.js +43 -5
  122. package/dist/sdk/lifecycle/plan.js +6 -3
  123. package/dist/sdk/lifecycle/update-many.d.ts +2 -1
  124. package/dist/sdk/lifecycle/update-many.js +29 -5
  125. package/dist/sdk/merge/index.d.ts +1 -1
  126. package/dist/sdk/merge/index.js +3 -3
  127. package/dist/sdk/merge/install.d.ts +21 -0
  128. package/dist/sdk/merge/install.js +58 -20
  129. package/dist/sdk/notes.d.ts +7 -0
  130. package/dist/sdk/notes.js +2 -2
  131. package/dist/sdk/read-output-budget.js +24 -22
  132. package/dist/sdk/read-output-contracts.d.ts +10 -2
  133. package/dist/sdk/read-output-contracts.js +204 -66
  134. package/dist/sdk/read-output-rows.d.ts +29 -0
  135. package/dist/sdk/read-output-rows.js +100 -0
  136. package/dist/sdk/read-output-session.d.ts +69 -0
  137. package/dist/sdk/read-output-session.js +200 -0
  138. package/dist/sdk/runtime-input.d.ts +2 -0
  139. package/dist/sdk/runtime-input.js +14 -2
  140. package/dist/sdk/runtime-primitives.d.ts +1 -1
  141. package/dist/sdk/runtime-primitives.js +3 -3
  142. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  143. package/dist/sdk/runtime-stats-options.js +38 -0
  144. package/dist/sdk/runtime.d.ts +1 -0
  145. package/dist/sdk/runtime.js +13 -50
  146. package/dist/sdk/stats.d.ts +40 -0
  147. package/dist/sdk/stats.js +112 -29
  148. package/dist/sdk/test/execution.js +4 -2
  149. package/dist/sdk/test/parsers.js +5 -2
  150. package/dist/sdk/workspace-snapshot.d.ts +9 -0
  151. package/dist/sdk/workspace-snapshot.js +48 -16
  152. package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
  153. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  154. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  155. package/docs/README.md +2 -0
  156. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  157. package/docs/RELEASING.md +27 -2
  158. package/docs/SCRIPTING.md +27 -1
  159. package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
  160. package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
  161. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  162. package/docs/TESTING.md +17 -0
  163. package/marketplace.json +2 -2
  164. package/package.json +6 -4
  165. package/packages/pm-beads/package.json +1 -1
  166. package/packages/pm-calendar/package.json +1 -1
  167. package/packages/pm-command-kit/package.json +1 -1
  168. package/packages/pm-digital-twin/package.json +1 -1
  169. package/packages/pm-governance-audit/package.json +1 -1
  170. package/packages/pm-guide-shell/package.json +1 -1
  171. package/packages/pm-kanban/package.json +1 -1
  172. package/packages/pm-lifecycle-hooks/package.json +1 -1
  173. package/packages/pm-linked-test-adapters/package.json +1 -1
  174. package/packages/pm-search-advanced/package.json +1 -1
  175. package/packages/pm-templates/package.json +1 -1
  176. package/packages/pm-todos/package.json +1 -1
  177. package/packages/pm-vcs/package.json +1 -1
  178. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  179. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  180. package/sdk/public-surface.json +875 -827
  181. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
  182. package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
  183. package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
  184. package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
  185. package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
  186. package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
  187. package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
  188. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
  189. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
  191. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
  192. package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
  194. package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
  195. package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
  196. package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
  197. package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
  198. package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
  200. package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
  201. package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
  202. package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
  203. package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
  204. package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
  205. package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
  206. package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
  207. package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
  209. package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
  210. package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
  211. package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
  212. package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
  213. package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
  214. package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
  215. package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
  217. package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
  218. package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
  219. package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
  220. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
  222. package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
  224. package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
  226. package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
  229. package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
  230. package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
  232. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
  233. package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
  235. package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
  236. package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
  237. package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
  238. package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
  239. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
  240. package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
  241. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
  242. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
  243. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
  244. package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
  245. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
  246. package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
  247. package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
  248. package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
  249. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
  250. package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
  251. package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
  252. package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
  253. package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
  254. package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
  255. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
  256. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
  257. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
  258. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
  259. package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
  260. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
  261. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
  262. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
  263. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
  264. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
  265. package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
  266. package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
  267. package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
  268. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
  269. package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
package/dist/cli.js CHANGED
@@ -5,13 +5,14 @@
5
5
  * Bootstraps the executable pm CLI entrypoint and startup optimizations.
6
6
  */
7
7
 
8
- !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]="46833198-bc44-5ed4-b685-51434f93d8df")}catch(e){}}();
8
+ !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]="81ec2fa2-c616-5978-999d-b76d5f45bafe")}catch(e){}}();
9
9
  import fs from "node:fs";
10
10
  import * as nodeModule from "node:module";
11
11
  import os from "node:os";
12
12
  import path from "node:path";
13
13
  import { fileURLToPath } from "node:url";
14
- import { runCliWithBundleIntegrity, } from "./cli/bundle-integrity.js";
14
+ import { runCliWithBundleIntegrity } from "./cli/bundle-integrity.js";
15
+ import { runRuntimeCompatibleCli } from "./cli/runtime-compatibility-boundary.js";
15
16
  import { pruneCompileCacheGenerations, resolveCompileCacheGeneration, } from "./sdk/compile-cache.js";
16
17
  function enableNodeCompileCache() {
17
18
  const { enableCompileCache } = nodeModule;
@@ -90,7 +91,16 @@ export const _testOnly = {
90
91
  if (!printFastVersionIfRequested()) {
91
92
  enableNodeCompileCache();
92
93
  const cliEntrypointPath = fileURLToPath(import.meta.url);
93
- await runCliWithBundleIntegrity(process.argv.slice(2), cliEntrypointPath, () => import("./cli-bundle/main.js"), process.stderr.write.bind(process.stderr));
94
+ const executingVersion = readPackageVersionForPath(cliEntrypointPath);
95
+ const invocationArgv = process.argv.slice(2);
96
+ await runRuntimeCompatibleCli({
97
+ executingVersion,
98
+ projectRoot: process.cwd(),
99
+ argv: invocationArgv,
100
+ allowStale: process.env.PM_ALLOW_STALE_CLI === "1",
101
+ run: () => runCliWithBundleIntegrity(invocationArgv, cliEntrypointPath, () => import("./cli-bundle/main.js"), process.stderr.write.bind(process.stderr)),
102
+ writeError: process.stderr.write.bind(process.stderr),
103
+ });
94
104
  }
95
105
  //# sourceMappingURL=cli.js.map
96
- //# debugId=46833198-bc44-5ed4-b685-51434f93d8df
106
+ //# debugId=81ec2fa2-c616-5978-999d-b76d5f45bafe
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /** Host-owned flags inherited by every subcommand, including extension commands. */
7
7
 
8
- !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]="875ac35b-c6ce-5690-a05a-8e4d279a49bf")}catch(e){}}();
8
+ !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]="47bfb287-bdd9-5984-9db4-cb996845d98c")}catch(e){}}();
9
9
  export const RESERVED_EXTENSION_HOST_FLAGS = Object.freeze([
10
10
  { flag: "--json" },
11
11
  { flag: "--lean" },
@@ -14,6 +14,7 @@ export const RESERVED_EXTENSION_HOST_FLAGS = Object.freeze([
14
14
  { flag: "--output-limit", value_name: "count" },
15
15
  { flag: "--output-budget", value_name: "tokens" },
16
16
  { flag: "--output-format", value_name: "toon|json" },
17
+ { flag: "--output-session", value_name: "state" },
17
18
  { flag: "--quiet" },
18
19
  { flag: "--no-changed-fields" },
19
20
  { flag: "--full-changed-fields" },
@@ -31,4 +32,4 @@ export const RESERVED_EXTENSION_HOST_FLAG_NAMES = new Set(RESERVED_EXTENSION_HOS
31
32
  ...(definition.aliases ?? []),
32
33
  ]));
33
34
  //# sourceMappingURL=reserved-host-flags.js.map
34
- //# debugId=875ac35b-c6ce-5690-a05a-8e4d279a49bf
35
+ //# debugId=47bfb287-bdd9-5984-9db4-cb996845d98c
@@ -47,6 +47,18 @@ export interface WorkspaceJsonWriteOptions {
47
47
  /** Whether creating a previously absent singleton produces a history entry. */
48
48
  recordCreation?: boolean;
49
49
  }
50
+ /** Result of deriving one audited singleton snapshot while its lock is held. */
51
+ export interface WorkspaceJsonMutation<Result> {
52
+ /** Fully serialized JSON value to persist. */
53
+ raw: string;
54
+ /** Caller-defined result derived from the same locked before-state. */
55
+ result: Result;
56
+ }
57
+ /** Options for deriving and writing one audited singleton under one lock. */
58
+ export interface WorkspaceJsonMutationOptions<Result> extends Omit<WorkspaceJsonWriteOptions, "raw"> {
59
+ /** Derive the next snapshot and receipt from the locked serialized state. */
60
+ mutate: (beforeRaw: string | null) => WorkspaceJsonMutation<Result> | Promise<WorkspaceJsonMutation<Result>>;
61
+ }
50
62
  /** Options for one append-only workspace audit event that leaves state unchanged. */
51
63
  export interface WorkspaceAuditEventOptions {
52
64
  /** Tracker root containing the workspace history stream. */
@@ -79,7 +91,15 @@ export declare function appendWorkspaceAuditEvent(options: WorkspaceAuditEventOp
79
91
  historyPath: string;
80
92
  }>;
81
93
  /**
82
- * Atomically serialize a JSON singleton snapshot, write, history append, and
83
- * compensation under the workspace-history lock.
94
+ * Derive and persist an audited singleton mutation from one lock-protected
95
+ * before-state, preventing read-modify-write callers from losing updates.
96
+ */
97
+ export declare function mutateWorkspaceJsonWithHistory<Result>(params: WorkspaceJsonMutationOptions<Result>): Promise<{
98
+ changed: boolean;
99
+ result: Result;
100
+ }>;
101
+ /**
102
+ * Atomically persist one caller-serialized JSON singleton and its audit entry
103
+ * under the workspace-history lock, with compensation if history append fails.
84
104
  */
85
105
  export declare function writeWorkspaceJsonWithHistory(params: WorkspaceJsonWriteOptions): Promise<boolean>;
@@ -5,12 +5,12 @@
5
5
  * HistoryEntry format used by item mutations.
6
6
  */
7
7
 
8
- !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]="8a15177d-4090-5e58-aac7-20b2ed7684a2")}catch(e){}}();
8
+ !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]="86b45d6b-2192-5d31-8f73-94d6e6b17dfc")}catch(e){}}();
9
9
  import fs from "node:fs/promises";
10
10
  import path from "node:path";
11
11
  import { readFileIfExists, writeFileAtomic } from "../fs/fs-utils.js";
12
12
  import { acquireLock } from "../lock/lock.js";
13
- import { EMPTY_CANONICAL_DOCUMENT, EXIT_CODE, } from "../shared/constants.js";
13
+ import { EMPTY_CANONICAL_DOCUMENT, EXIT_CODE } from "../shared/constants.js";
14
14
  import { PmCliError } from "../shared/errors.js";
15
15
  import { stableStringify } from "../shared/serialization.js";
16
16
  import { appendHistoryEntry, createHistoryEntry } from "./history.js";
@@ -155,46 +155,70 @@ export async function appendWorkspaceAuditEvent(options) {
155
155
  * Atomically serialize a JSON singleton snapshot, write, history append, and
156
156
  * compensation under the workspace-history lock.
157
157
  */
158
- export async function writeWorkspaceJsonWithHistory(params) {
159
- const release = await acquireLock(params.pmRoot, "workspace-history", params.lockTtlSeconds, params.author, false, false, params.lockWaitMs);
158
+ async function writeWorkspaceJsonWithHistoryLocked(params, beforeRaw) {
159
+ if (beforeRaw === params.raw)
160
+ return false;
161
+ const before = beforeRaw === null ? null : JSON.parse(beforeRaw);
162
+ const after = JSON.parse(params.raw);
163
+ await writeFileAtomic(params.filePath, params.raw);
160
164
  try {
161
- const beforeRaw = await readFileIfExists(params.filePath);
162
- if (beforeRaw === params.raw)
163
- return false;
164
- const before = beforeRaw === null ? null : JSON.parse(beforeRaw);
165
- const after = JSON.parse(params.raw);
166
- await writeFileAtomic(params.filePath, params.raw);
167
- try {
168
- if (beforeRaw !== null || params.recordCreation !== false) {
169
- await appendWorkspaceHistoryChangeLocked({
170
- pmRoot: params.pmRoot,
171
- documentPath: path
172
- .relative(params.pmRoot, params.filePath)
173
- .replaceAll("\\", "/"),
174
- before,
175
- after,
176
- op: params.op,
177
- author: params.author,
178
- lockTtlSeconds: params.lockTtlSeconds,
179
- lockWaitMs: params.lockWaitMs,
180
- message: params.message,
181
- });
182
- }
165
+ if (beforeRaw !== null || params.recordCreation !== false) {
166
+ await appendWorkspaceHistoryChangeLocked({
167
+ pmRoot: params.pmRoot,
168
+ documentPath: path
169
+ .relative(params.pmRoot, params.filePath)
170
+ .replaceAll("\\", "/"),
171
+ before,
172
+ after,
173
+ op: params.op,
174
+ author: params.author,
175
+ lockTtlSeconds: params.lockTtlSeconds,
176
+ lockWaitMs: params.lockWaitMs,
177
+ message: params.message,
178
+ });
183
179
  }
184
- catch (error) {
185
- if (beforeRaw === null) {
186
- await fs.rm(params.filePath, { force: true });
187
- }
188
- else {
189
- await writeFileAtomic(params.filePath, beforeRaw);
190
- }
191
- throw error;
180
+ }
181
+ catch (error) {
182
+ if (beforeRaw === null) {
183
+ await fs.rm(params.filePath, { force: true });
184
+ }
185
+ else {
186
+ await writeFileAtomic(params.filePath, beforeRaw);
192
187
  }
193
- return true;
188
+ throw error;
189
+ }
190
+ return true;
191
+ }
192
+ /**
193
+ * Derive and persist an audited singleton mutation from one lock-protected
194
+ * before-state, preventing read-modify-write callers from losing updates.
195
+ */
196
+ export async function mutateWorkspaceJsonWithHistory(params) {
197
+ const release = await acquireLock(params.pmRoot, "workspace-history", params.lockTtlSeconds, params.author, false, false, params.lockWaitMs);
198
+ try {
199
+ const beforeRaw = await readFileIfExists(params.filePath);
200
+ const mutation = await params.mutate(beforeRaw);
201
+ return {
202
+ changed: await writeWorkspaceJsonWithHistoryLocked({ ...params, raw: mutation.raw }, beforeRaw),
203
+ result: mutation.result,
204
+ };
205
+ }
206
+ finally {
207
+ await release();
208
+ }
209
+ }
210
+ /**
211
+ * Atomically persist one caller-serialized JSON singleton and its audit entry
212
+ * under the workspace-history lock, with compensation if history append fails.
213
+ */
214
+ export async function writeWorkspaceJsonWithHistory(params) {
215
+ const release = await acquireLock(params.pmRoot, "workspace-history", params.lockTtlSeconds, params.author, false, false, params.lockWaitMs);
216
+ try {
217
+ return await writeWorkspaceJsonWithHistoryLocked(params, await readFileIfExists(params.filePath));
194
218
  }
195
219
  finally {
196
220
  await release();
197
221
  }
198
222
  }
199
223
  //# sourceMappingURL=workspace-history.js.map
200
- //# debugId=8a15177d-4090-5e58-aac7-20b2ed7684a2
224
+ //# debugId=86b45d6b-2192-5d31-8f73-94d6e6b17dfc
@@ -22,6 +22,8 @@ export interface OutputOptions {
22
22
  outputBudget?: string;
23
23
  /** Canonical renderer encoding for read output. */
24
24
  outputFormat?: "toon" | "json";
25
+ /** Caller-carried cross-call budget and served-item state. */
26
+ outputSession?: string;
25
27
  /** Fallback output format used when callers do not provide an override. */
26
28
  defaultOutputFormat?: "toon" | "json";
27
29
  /** Value that configures or reports command for this contract. */
@@ -4,7 +4,7 @@
4
4
  * Formats compact human and machine output for Output.
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]="816ae182-02ba-56a9-8204-7474e30322bc")}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]="b52d2756-f640-5f53-981f-05fa23fa1718")}catch(e){}}();
8
8
  import { getActiveCommandContext, runActiveCommandOverride, runActiveRendererOverride, runActiveServiceOverrideSync, setActiveCommandResult, } from "../extensions/index.js";
9
9
  import { EXIT_CODE } from "../shared/constants.js";
10
10
  import { isHostOutputSuppressed } from "./output-control.js";
@@ -12,6 +12,7 @@ import { projectMutationResult } from "./mutation-projection.js";
12
12
  import { attachReadOutputContracts } from "../../sdk/context-intent-contracts.js";
13
13
  import { attachOutputTokenAccounting } from "../../sdk/output-token-accounting.js";
14
14
  import { resolveReadOutputEncoding } from "../../sdk/read-output-contracts.js";
15
+ const DECLARED_PROCESS_EXIT_CODES = new Set(Object.values(EXIT_CODE));
15
16
  const NATIVE_OUTPUT_MARKER = "__pm_native_output";
16
17
  let streamErrorHandlersInstalled = false;
17
18
  function isPlainObject(value) {
@@ -333,6 +334,7 @@ function formatEffectiveOutput(effectiveResult, nativeOutput, options) {
333
334
  ["outputLimit", options.outputLimit],
334
335
  ["outputBudget", options.outputBudget],
335
336
  ["outputFormat", options.outputFormat],
337
+ ["outputSession", options.outputSession],
336
338
  ].filter((entry) => entry[1] !== undefined)),
337
339
  };
338
340
  const format = resolveReadOutputEncoding(command ?? "", commandOptions) ??
@@ -387,6 +389,12 @@ export function formatOutput(result, options) {
387
389
  }
388
390
  /** Implements print result for the public runtime surface of this module. */
389
391
  export function printResult(result, options) {
392
+ if (isPlainObject(result) &&
393
+ Number.isInteger(result.exit_code) &&
394
+ DECLARED_PROCESS_EXIT_CODES.has(Number(result.exit_code)) &&
395
+ (process.exitCode === undefined || process.exitCode === EXIT_CODE.SUCCESS)) {
396
+ process.exitCode = Number(result.exit_code);
397
+ }
390
398
  const projected = options.idOnly
391
399
  ? projectMutationResult(result, { idOnly: true })
392
400
  : options.fullChangedFields
@@ -416,4 +424,4 @@ export const outputTestOnly = {
416
424
  renderToonValue,
417
425
  };
418
426
  //# sourceMappingURL=output.js.map
419
- //# debugId=816ae182-02ba-56a9-8204-7474e30322bc
427
+ //# debugId=b52d2756-f640-5f53-981f-05fa23fa1718
@@ -15,6 +15,16 @@ export declare function sentryFinishCommandSpan(ok: boolean, error?: string, met
15
15
  command_resolution?: TelemetryCommandResolution;
16
16
  resolution_stage?: TelemetryResolutionStage;
17
17
  }): void;
18
+ /**
19
+ * Tag value recorded when a captured error declares no canonical pm error code.
20
+ *
21
+ * The release reliability gate classifies Sentry issues from the `pm.error_code`
22
+ * and `pm.exit_code` tags and fails closed when either is absent. Emitting this
23
+ * sentinel keeps the producer side of that contract total: an undeclared runtime
24
+ * fault is still classifiable (and still blocks, because it resolves to no
25
+ * catalog contract) instead of being unjudgeable for lack of a tag.
26
+ */
27
+ export declare const UNCLASSIFIED_CAPTURED_ERROR_CODE = "unclassified_runtime_error";
18
28
  /** Implements sentry capture cli error for the public runtime surface of this module. */
19
29
  export declare function sentryCaptureCliError(error: unknown): void;
20
30
  /** Implements sentry log cli usage error for the public runtime surface of this module. */
@@ -4,7 +4,7 @@
4
4
  * Integrates Sentry instrumentation and release diagnostics for Helpers.
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]="48cce5c1-5cca-53cc-8991-f97669251a72")}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]="ffe56aed-b794-5bf4-99fd-e3c5fe065163")}catch(e){}}();
8
8
  import { getSentry } from "./instrument.js";
9
9
  import { PmCliError } from "../shared/errors.js";
10
10
  import { EXIT_CODE } from "../shared/constants.js";
@@ -110,6 +110,60 @@ export function sentryFinishCommandSpan(ok, error, metadata) {
110
110
  activeCommandSpan.end();
111
111
  activeCommandSpan = undefined;
112
112
  }
113
+ /**
114
+ * Tag value recorded when a captured error declares no canonical pm error code.
115
+ *
116
+ * The release reliability gate classifies Sentry issues from the `pm.error_code`
117
+ * and `pm.exit_code` tags and fails closed when either is absent. Emitting this
118
+ * sentinel keeps the producer side of that contract total: an undeclared runtime
119
+ * fault is still classifiable (and still blocks, because it resolves to no
120
+ * catalog contract) instead of being unjudgeable for lack of a tag.
121
+ */
122
+ export const UNCLASSIFIED_CAPTURED_ERROR_CODE = "unclassified_runtime_error";
123
+ /**
124
+ * Reads the declared error contract carried by a thrown value, if any.
125
+ *
126
+ * There is deliberately no `PmCliError` special case: `shouldCaptureCliError`
127
+ * rejects every `PmCliError` before capture, so such a branch would be
128
+ * unreachable — and a `PmCliError` carries a public `code` and a numeric
129
+ * `exitCode`, so the general path below would classify it identically anyway.
130
+ */
131
+ function readCapturedErrorContract(error) {
132
+ const candidate = typeof error === "object" && error !== null
133
+ ? error
134
+ : undefined;
135
+ const hasDeclaredExitCode = typeof candidate?.exitCode === "number";
136
+ const exitCode = hasDeclaredExitCode
137
+ ? Math.trunc(candidate?.exitCode)
138
+ : EXIT_CODE.GENERIC_FAILURE;
139
+ // A declared pm code always travels with a numeric exit code. Requiring both
140
+ // halves keeps a Node errno error (string `code`, no `exitCode`) from being
141
+ // reported as though it were a catalog contract.
142
+ const hasDeclaredErrorCode = typeof candidate?.code === "string" &&
143
+ candidate.code.length > 0 &&
144
+ hasDeclaredExitCode;
145
+ return {
146
+ error_code: hasDeclaredErrorCode
147
+ ? candidate?.code
148
+ : UNCLASSIFIED_CAPTURED_ERROR_CODE,
149
+ exit_code: exitCode,
150
+ };
151
+ }
152
+ /**
153
+ * Builds the contract tags every captured event carries.
154
+ *
155
+ * These are attached to the event itself rather than to the ambient scope
156
+ * because the scope writer (`sentryFinishCommandSpan`) returns early when no
157
+ * command span is active, and the unknown-error path captures before that
158
+ * writer runs.
159
+ */
160
+ function buildCapturedErrorTags(error) {
161
+ const contract = readCapturedErrorContract(error);
162
+ return {
163
+ "pm.error_code": contract.error_code,
164
+ "pm.exit_code": String(contract.exit_code),
165
+ };
166
+ }
113
167
  /** Implements sentry capture cli error for the public runtime surface of this module. */
114
168
  export function sentryCaptureCliError(error) {
115
169
  if (!shouldCaptureCliError(error))
@@ -117,6 +171,7 @@ export function sentryCaptureCliError(error) {
117
171
  const Sentry = getSentry();
118
172
  if (!Sentry)
119
173
  return;
174
+ const tags = buildCapturedErrorTags(error);
120
175
  if (error instanceof Error) {
121
176
  const extras = {};
122
177
  if ("exitCode" in error &&
@@ -127,10 +182,10 @@ export function sentryCaptureCliError(error) {
127
182
  typeof error.context === "object") {
128
183
  extras.error_context = error.context;
129
184
  }
130
- Sentry.captureException(error, { extra: extras });
185
+ Sentry.captureException(error, { extra: extras, tags });
131
186
  }
132
187
  else {
133
- Sentry.captureException(new Error(String(error)));
188
+ Sentry.captureException(new Error(String(error)), { tags });
134
189
  }
135
190
  }
136
191
  /** Implements sentry log cli usage error for the public runtime surface of this module. */
@@ -215,4 +270,4 @@ export async function sentryFlush(timeoutMs = 3000) {
215
270
  }
216
271
  }
217
272
  //# sourceMappingURL=helpers.js.map
218
- //# debugId=48cce5c1-5cca-53cc-8991-f97669251a72
273
+ //# debugId=ffe56aed-b794-5bf4-99fd-e3c5fe065163
@@ -27,6 +27,8 @@ export interface GlobalOptions {
27
27
  outputBudget?: string;
28
28
  /** Canonical renderer encoding for read output. */
29
29
  outputFormat?: "toon" | "json";
30
+ /** Caller-carried cross-call budget and served-item state. */
31
+ outputSession?: string;
30
32
  /** Filesystem path used for path resolution. */
31
33
  path?: string;
32
34
  /** Value that configures or reports no extensions for this contract. */
@@ -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]="83f9379e-d39e-55d3-9ac4-d98f854ad566")}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]="ff47df0c-93db-5e20-be4e-48a2aedfeebf")}catch(e){}}();
3
3
  export {};
4
4
  //# sourceMappingURL=command-types.js.map
5
- //# debugId=83f9379e-d39e-55d3-9ac4-d98f854ad566
5
+ //# debugId=ff47df0c-93db-5e20-be4e-48a2aedfeebf
@@ -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
@@ -4,10 +4,11 @@
4
4
  * Defines the Tool Definitions module for pm CLI source.
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]="89c1ac6d-c217-54ea-8728-5a58762f86d9")}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]="cde81c26-97fa-5236-b807-e944ba4af321")}catch(e){}}();
8
8
  import { GRAPH_SUBCOMMAND_VALUES, PM_TOOL_ACTIONS, } from "../sdk/cli-contracts/enum-contracts.js";
9
9
  import { buildPmActionToolInputSchema } from "../sdk/cli-contracts/tool-schema.js";
10
10
  import { RUNTIME_STATUS_ROLE_VALUES } from "../types.js";
11
+ const CANONICAL_OUTPUT_SESSION_TOOL_PROPERTY = buildPmActionToolInputSchema("list").properties.outputSession;
11
12
  const READ_OUTPUT_TOOL_PROPERTIES = {
12
13
  outputInclude: {
13
14
  type: "string",
@@ -28,6 +29,9 @@ const READ_OUTPUT_TOOL_PROPERTIES = {
28
29
  enum: ["json", "toon"],
29
30
  description: "Universal read-result encoding selector.",
30
31
  },
32
+ outputSession: {
33
+ ...CANONICAL_OUTPUT_SESSION_TOOL_PROPERTY,
34
+ },
31
35
  };
32
36
  /** MCP transport parameters layered over every canonical action schema. */
33
37
  export const TOOL_SCHEMA_BASE = {
@@ -735,4 +739,4 @@ export function buildMcpToolContracts() {
735
739
  }).sort((left, right) => left.name.localeCompare(right.name));
736
740
  }
737
741
  //# sourceMappingURL=tool-definitions.js.map
738
- //# debugId=89c1ac6d-c217-54ea-8728-5a58762f86d9
742
+ //# debugId=cde81c26-97fa-5236-b807-e944ba4af321
@@ -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