@unbrained/pm-cli 2026.8.5 → 2026.8.7

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 (251) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +44 -0
  3. package/dist/cli/main.js +14 -37
  4. package/dist/cli/register-operations.js +11 -2
  5. package/dist/cli/register-setup.d.ts +1 -1
  6. package/dist/cli/register-setup.js +46 -20
  7. package/dist/cli/stats-analytics-json.d.ts +9 -0
  8. package/dist/cli/stats-analytics-json.js +69 -0
  9. package/dist/cli-bundle/bundle-manifest.json +403 -403
  10. package/dist/cli-bundle/chunks/append-7BXBFDGD.js +2 -0
  11. package/dist/cli-bundle/chunks/{chunk-PMXJEU3F.js → chunk-2AXF3VSK.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-MHK6LIWE.js → chunk-2XS43CCV.js} +2 -2
  13. package/dist/cli-bundle/chunks/chunk-3A6KWB72.js +8 -0
  14. package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +8 -0
  15. package/dist/cli-bundle/chunks/{chunk-45G53IU4.js → chunk-4MTI7XOV.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-7C4PTJG6.js → chunk-6BX5UDCN.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-4YUBDMQM.js → chunk-6QPO7KLR.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-HWRRMBJO.js → chunk-7MXHZHSQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-3FTILRJ2.js → chunk-7ZPMJW4U.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-2WFXWAYX.js → chunk-AGYNSNCI.js} +2 -2
  21. package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +5 -0
  22. package/dist/cli-bundle/chunks/{chunk-43HQQI6S.js → chunk-B4KLBBMN.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-VCKLFEUN.js → chunk-CALJHNBL.js} +12 -12
  24. package/dist/cli-bundle/chunks/{chunk-CSI3WS5I.js → chunk-CFIGP5LY.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-V3EUXXOF.js → chunk-CS6MRHG7.js} +2 -2
  26. package/dist/cli-bundle/chunks/{chunk-YSO3YFZ4.js → chunk-CUGNQQKH.js} +2 -2
  27. package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +164 -0
  28. package/dist/cli-bundle/chunks/{chunk-BXQLRKWF.js → chunk-H5Y5YE6A.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-54FNT7U2.js → chunk-H5Y6UV6E.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-UP7DTVMD.js → chunk-H7KGWPDF.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-E2RKBKWB.js → chunk-HFSD77TQ.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-V3774P7D.js → chunk-HX2GTA6L.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-UZBWIUYD.js → chunk-J2IEKAVR.js} +2 -2
  34. package/dist/cli-bundle/chunks/{chunk-HNFD72UK.js → chunk-K44PYFXH.js} +2 -2
  35. package/dist/cli-bundle/chunks/{chunk-5ZBOIPGP.js → chunk-K4KGEEBT.js} +2 -2
  36. package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +21 -0
  37. package/dist/cli-bundle/chunks/{chunk-OMXVBQ2N.js → chunk-KL6IEBV2.js} +2 -2
  38. package/dist/cli-bundle/chunks/{chunk-7A5OT5J2.js → chunk-KWQZDZSS.js} +2 -2
  39. package/dist/cli-bundle/chunks/{chunk-M72BKL5Q.js → chunk-KZ4X3DGU.js} +2 -2
  40. package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +13 -0
  41. package/dist/cli-bundle/chunks/{chunk-VN5VITU3.js → chunk-ME2JJ4LA.js} +2 -2
  42. package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +2 -0
  43. package/dist/cli-bundle/chunks/{chunk-A62CYISG.js → chunk-NG6OXIBR.js} +8 -8
  44. package/dist/cli-bundle/chunks/{chunk-42E7YPLG.js → chunk-NYIGHWQY.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-RKAVWO3O.js → chunk-NZ75GNSA.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-DXDREUXT.js → chunk-PCJWJNC2.js} +2 -2
  47. package/dist/cli-bundle/chunks/{chunk-ZYHOB3SN.js → chunk-PD3225AM.js} +2 -2
  48. package/dist/cli-bundle/chunks/{chunk-OTHLDSFP.js → chunk-PDEGKG7P.js} +2 -2
  49. package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +2 -0
  50. package/dist/cli-bundle/chunks/chunk-PW2H7YJR.js +56 -0
  51. package/dist/cli-bundle/chunks/{chunk-L3AZOELJ.js → chunk-TPKN3S7S.js} +2 -2
  52. package/dist/cli-bundle/chunks/{chunk-LKDGK44W.js → chunk-TPXAXTCO.js} +2 -2
  53. package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +2 -0
  54. package/dist/cli-bundle/chunks/{chunk-R546TPDE.js → chunk-UQLZQVFW.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-BPELKUQD.js → chunk-VT3Z5G7D.js} +2 -2
  56. package/dist/cli-bundle/chunks/chunk-WOD3WWUN.js +2 -0
  57. package/dist/cli-bundle/chunks/{chunk-4VN6GS4U.js → chunk-WSJEIGJF.js} +2 -2
  58. package/dist/cli-bundle/chunks/{chunk-UN66FZRO.js → chunk-WYNUU7ZW.js} +49 -46
  59. package/dist/cli-bundle/chunks/{chunk-NY4T3JWN.js → chunk-YGPNCCXZ.js} +2 -2
  60. package/dist/cli-bundle/chunks/close-CMY3BAUG.js +2 -0
  61. package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +2 -0
  62. package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +2 -0
  63. package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +2 -0
  64. package/dist/cli-bundle/chunks/{create-XLKTXTUF.js → create-I5DVV4YG.js} +2 -2
  65. package/dist/cli-bundle/chunks/delete-RL3JACSW.js +2 -0
  66. package/dist/cli-bundle/chunks/{deps-ITTY3GIC.js → deps-S7UBCECS.js} +2 -2
  67. package/dist/cli-bundle/chunks/{docs-W4OSRTYR.js → docs-ZZNVBBYO.js} +2 -2
  68. package/dist/cli-bundle/chunks/{files-EOK4AZI4.js → files-27C337VT.js} +2 -2
  69. package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +2 -0
  70. package/dist/cli-bundle/chunks/{history-compact-7UGTMLL3.js → history-compact-HJQK67CZ.js} +2 -2
  71. package/dist/cli-bundle/chunks/{history-redact-4DZRMD6Z.js → history-redact-PWC6PDWA.js} +2 -2
  72. package/dist/cli-bundle/chunks/{history-repair-UPOSZW5R.js → history-repair-N3CY4WBF.js} +2 -2
  73. package/dist/cli-bundle/chunks/{learnings-GMRNCBS3.js → learnings-4FH23XDT.js} +2 -2
  74. package/dist/cli-bundle/chunks/{profile-2MUUMHRE.js → profile-5Y5XXH5N.js} +2 -2
  75. package/dist/cli-bundle/chunks/{register-list-query-LR3SQ5ZF.js → register-list-query-FJZCJ67O.js} +2 -2
  76. package/dist/cli-bundle/chunks/{register-mutation-SUOHFVWM.js → register-mutation-YGYPW3BL.js} +3 -3
  77. package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +2 -0
  78. package/dist/cli-bundle/chunks/register-setup-DL7FFABC.js +2 -0
  79. package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +2 -0
  80. package/dist/cli-bundle/chunks/{schema-FJ4EA3XF.js → schema-EQGKBYXJ.js} +2 -2
  81. package/dist/cli-bundle/chunks/update-QVTYOD6I.js +2 -0
  82. package/dist/cli-bundle/chunks/update-many-DJSBU525.js +2 -0
  83. package/dist/cli-bundle/focused-chunks/{chunk-MJ7HWSFK.js → chunk-2ECLECMK.js} +3 -3
  84. package/dist/cli-bundle/focused-chunks/{chunk-A7BJ5SS6.js → chunk-3K4XV2BF.js} +2 -2
  85. package/dist/cli-bundle/focused-chunks/{chunk-PIMMYG7Q.js → chunk-4EX25PXM.js} +2 -2
  86. package/dist/cli-bundle/focused-chunks/chunk-4VJQTS3P.js +2 -0
  87. package/dist/cli-bundle/focused-chunks/chunk-73JUDYXT.js +2 -0
  88. package/dist/cli-bundle/focused-chunks/{chunk-WVIVUWVL.js → chunk-CIXVQPB7.js} +2 -2
  89. package/dist/cli-bundle/focused-chunks/chunk-DLTS3IHM.js +2 -0
  90. package/dist/cli-bundle/focused-chunks/{chunk-FGKY4MBE.js → chunk-DQ6FKGL3.js} +10 -10
  91. package/dist/cli-bundle/focused-chunks/{chunk-QVHKCI4T.js → chunk-HNL6IFGS.js} +2 -2
  92. package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +2 -0
  93. package/dist/cli-bundle/focused-chunks/{chunk-G6ETT4QK.js → chunk-MHMTKV5V.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-7J5TUBUJ.js → chunk-MOTJFQ3F.js} +22 -22
  95. package/dist/cli-bundle/focused-chunks/{chunk-UIL2M2NA.js → chunk-NBJKQP4S.js} +2 -2
  96. package/dist/cli-bundle/focused-chunks/{chunk-RUR5I3TK.js → chunk-QHRTT7WT.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-B7LJWAZE.js → chunk-R2LEMEV5.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-SV3O7TSH.js → chunk-RPNYG5MO.js} +2 -2
  99. package/dist/cli-bundle/focused-chunks/chunk-RW5IYD4J.js +4 -0
  100. package/dist/cli-bundle/focused-chunks/chunk-TIKDBG4D.js +29 -0
  101. package/dist/cli-bundle/focused-chunks/{chunk-IPWSFADF.js → chunk-VZFU2R4M.js} +2 -2
  102. package/dist/cli-bundle/focused-chunks/{chunk-WEM2E2PE.js → chunk-YZEZAPJK.js} +2 -2
  103. package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +2 -0
  104. package/dist/cli-bundle/main.js +13 -13
  105. package/dist/cli-bundle/sdk-authoring.js +1 -1
  106. package/dist/cli-bundle/sdk-contracts.js +1 -1
  107. package/dist/cli-bundle/sdk-core.js +29 -28
  108. package/dist/cli-bundle/sdk-governance.js +1 -1
  109. package/dist/cli-bundle/sdk-graph.js +1 -1
  110. package/dist/cli-bundle/sdk-merge.js +1 -1
  111. package/dist/cli-bundle/sdk-query.js +1 -1
  112. package/dist/cli-bundle/sdk-runtime.js +1 -1
  113. package/dist/cli-bundle/sdk-testing.js +1 -1
  114. package/dist/cli-bundle/sdk.js +1 -1
  115. package/dist/core/extensions/activation-summary.d.ts +4 -0
  116. package/dist/core/extensions/activation-summary.js +5 -2
  117. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  118. package/dist/core/extensions/contribution-inventory.js +35 -2
  119. package/dist/core/extensions/extension-hook-runtime.js +5 -3
  120. package/dist/core/extensions/extension-types.d.ts +18 -1
  121. package/dist/core/extensions/extension-types.js +2 -2
  122. package/dist/core/extensions/loader.js +5 -13
  123. package/dist/core/extensions/preflight-ownership.d.ts +5 -0
  124. package/dist/core/extensions/preflight-ownership.js +42 -0
  125. package/dist/core/extensions/reserved-host-flags.js +3 -2
  126. package/dist/core/history/workspace-history.d.ts +22 -2
  127. package/dist/core/history/workspace-history.js +60 -36
  128. package/dist/core/output/output.d.ts +2 -0
  129. package/dist/core/output/output.js +3 -2
  130. package/dist/core/shared/command-types.d.ts +2 -0
  131. package/dist/core/shared/command-types.js +2 -2
  132. package/dist/mcp/tool-definitions.js +6 -2
  133. package/dist/sdk/author-attribution.js +23 -7
  134. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  135. package/dist/sdk/cli-bootstrap.js +7 -2
  136. package/dist/sdk/cli-contracts/completeness.js +51 -4
  137. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  138. package/dist/sdk/cli-contracts/flag-contracts.js +9 -2
  139. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  140. package/dist/sdk/cli-contracts/runtime-contracts.js +16 -9
  141. package/dist/sdk/cli-contracts/tool-parameter-tables.js +116 -10
  142. package/dist/sdk/cli-contracts/tool-schema.js +18 -2
  143. package/dist/sdk/cli-contracts.d.ts +1 -1
  144. package/dist/sdk/cli-contracts.js +3 -3
  145. package/dist/sdk/cli-program.js +3 -2
  146. package/dist/sdk/completion.js +5 -2
  147. package/dist/sdk/compose.d.ts +2 -2
  148. package/dist/sdk/compose.js +7 -2
  149. package/dist/sdk/contracts.d.ts +1 -0
  150. package/dist/sdk/contracts.js +2 -2
  151. package/dist/sdk/core.d.ts +3 -1
  152. package/dist/sdk/core.js +4 -3
  153. package/dist/sdk/define.d.ts +3 -1
  154. package/dist/sdk/define.js +3 -8
  155. package/dist/sdk/extension/install-sources.d.ts +43 -5
  156. package/dist/sdk/extension/install-sources.js +36 -2
  157. package/dist/sdk/extension/migrations.d.ts +114 -0
  158. package/dist/sdk/extension/migrations.js +175 -0
  159. package/dist/sdk/extension/scaffold.js +14 -9
  160. package/dist/sdk/extension/source-resolution.d.ts +50 -0
  161. package/dist/sdk/extension/source-resolution.js +66 -0
  162. package/dist/sdk/extension.d.ts +5 -1
  163. package/dist/sdk/extension.js +31 -35
  164. package/dist/sdk/generated-error-code-catalog.js +112 -2
  165. package/dist/sdk/governance/health.js +11 -2
  166. package/dist/sdk/history-analytics.d.ts +141 -0
  167. package/dist/sdk/history-analytics.js +283 -0
  168. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  169. package/dist/sdk/improvement-ledger-validation.js +63 -0
  170. package/dist/sdk/improvement-ledger.d.ts +139 -0
  171. package/dist/sdk/improvement-ledger.js +261 -0
  172. package/dist/sdk/index.d.ts +11 -3
  173. package/dist/sdk/index.js +12 -4
  174. package/dist/sdk/lifecycle/plan.js +6 -3
  175. package/dist/sdk/merge/install.js +10 -2
  176. package/dist/sdk/package-migrations.d.ts +10 -0
  177. package/dist/sdk/package-migrations.js +21 -0
  178. package/dist/sdk/read-output-budget.js +24 -22
  179. package/dist/sdk/read-output-contracts.d.ts +10 -2
  180. package/dist/sdk/read-output-contracts.js +124 -65
  181. package/dist/sdk/read-output-rows.d.ts +29 -0
  182. package/dist/sdk/read-output-rows.js +100 -0
  183. package/dist/sdk/read-output-session.d.ts +69 -0
  184. package/dist/sdk/read-output-session.js +200 -0
  185. package/dist/sdk/runtime-input.d.ts +2 -0
  186. package/dist/sdk/runtime-input.js +14 -2
  187. package/dist/sdk/runtime-primitives.d.ts +1 -1
  188. package/dist/sdk/runtime-primitives.js +3 -3
  189. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  190. package/dist/sdk/runtime-stats-options.js +38 -0
  191. package/dist/sdk/runtime.d.ts +3 -0
  192. package/dist/sdk/runtime.js +10 -27
  193. package/dist/sdk/stats.d.ts +40 -0
  194. package/dist/sdk/stats.js +112 -29
  195. package/docs/COMMANDS.md +9 -0
  196. package/docs/EXTENSIONS.md +2 -2
  197. package/docs/EXTENSION_LIFECYCLE.md +46 -0
  198. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  199. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  200. package/docs/README.md +2 -0
  201. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  202. package/docs/RELEASING.md +33 -20
  203. package/docs/SDK.md +31 -3
  204. package/marketplace.json +2 -2
  205. package/package.json +5 -5
  206. package/packages/pm-beads/package.json +1 -1
  207. package/packages/pm-calendar/package.json +1 -1
  208. package/packages/pm-command-kit/package.json +1 -1
  209. package/packages/pm-digital-twin/package.json +1 -1
  210. package/packages/pm-governance-audit/package.json +1 -1
  211. package/packages/pm-guide-shell/package.json +1 -1
  212. package/packages/pm-kanban/package.json +1 -1
  213. package/packages/pm-lifecycle-hooks/package.json +1 -1
  214. package/packages/pm-linked-test-adapters/package.json +1 -1
  215. package/packages/pm-search-advanced/package.json +1 -1
  216. package/packages/pm-templates/package.json +1 -1
  217. package/packages/pm-todos/package.json +1 -1
  218. package/packages/pm-vcs/package.json +1 -1
  219. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  220. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  221. package/sdk/public-surface.json +566 -815
  222. package/dist/cli-bundle/chunks/append-VXXGOXSG.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-6MSQJOTG.js +0 -13
  224. package/dist/cli-bundle/chunks/chunk-EGJ4JTUG.js +0 -55
  225. package/dist/cli-bundle/chunks/chunk-FPBQHMFT.js +0 -8
  226. package/dist/cli-bundle/chunks/chunk-GE4KCSZP.js +0 -164
  227. package/dist/cli-bundle/chunks/chunk-LN2WFEU4.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-OPVH7SKD.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-Q35VBGOQ.js +0 -5
  230. package/dist/cli-bundle/chunks/chunk-SSF4PIUR.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-WRL4KNDL.js +0 -20
  232. package/dist/cli-bundle/chunks/chunk-XCEZYMNI.js +0 -2
  233. package/dist/cli-bundle/chunks/chunk-YEWNL576.js +0 -2
  234. package/dist/cli-bundle/chunks/close-VZ3OQPN5.js +0 -2
  235. package/dist/cli-bundle/chunks/close-many-SB4TI27P.js +0 -2
  236. package/dist/cli-bundle/chunks/comments-BIF3Q4KY.js +0 -2
  237. package/dist/cli-bundle/chunks/copy-6AI5Z57X.js +0 -2
  238. package/dist/cli-bundle/chunks/delete-ZY2VHQTP.js +0 -2
  239. package/dist/cli-bundle/chunks/focus-DLBNWL7L.js +0 -2
  240. package/dist/cli-bundle/chunks/register-operations-ARRRKOVN.js +0 -2
  241. package/dist/cli-bundle/chunks/register-setup-O6AYP6NP.js +0 -2
  242. package/dist/cli-bundle/chunks/restore-ZVCVHTB5.js +0 -2
  243. package/dist/cli-bundle/chunks/update-YHV52CSS.js +0 -2
  244. package/dist/cli-bundle/chunks/update-many-M6YHVNXM.js +0 -2
  245. package/dist/cli-bundle/focused-chunks/chunk-BIMTMOS7.js +0 -4
  246. package/dist/cli-bundle/focused-chunks/chunk-GJ2TG2CW.js +0 -28
  247. package/dist/cli-bundle/focused-chunks/chunk-N5XU5UVK.js +0 -2
  248. package/dist/cli-bundle/focused-chunks/chunk-PG2RIZBX.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-VLYOEYML.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-W7BJEWHX.js +0 -2
  251. package/dist/cli-bundle/focused-chunks/chunk-Y4LDYLLT.js +0 -2
@@ -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]="8d5e0d6f-5ffa-5302-87da-3e741b80b716")}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]="1d184acd-e639-5b28-a294-98d22de2ebc7")}catch(e){}}();
3
3
  import { collectUsedExtensionCapabilities, normalizeExtensionName, } from "./capability-usage.js";
4
4
  /**
5
5
  * Canonical lifecycle hook kinds paired with their {@link ExtensionHookRegistry}
@@ -77,10 +77,13 @@ export function describeExtensionActivation(activation, options = {}) {
77
77
  ? { renderer_ownership: rendererOwnership }
78
78
  : {}),
79
79
  preflight_overrides: preflight.overrides.filter((entry) => matches(entry.name)).length,
80
+ preflight_ownership: preflight.overrides
81
+ .filter((entry) => matches(entry.name))
82
+ .map((entry) => ({ commands: [...(entry.commands ?? [])] })),
80
83
  };
81
84
  }
82
85
  function sortUnique(values) {
83
86
  return [...new Set(values)].sort((left, right) => left.localeCompare(right));
84
87
  }
85
88
  //# sourceMappingURL=activation-summary.js.map
86
- //# debugId=8d5e0d6f-5ffa-5302-87da-3e741b80b716
89
+ //# debugId=1d184acd-e639-5b28-a294-98d22de2ebc7
@@ -22,4 +22,5 @@ export declare function createExtensionContributionInventory(summary: {
22
22
  renderer_overrides: string[];
23
23
  renderer_ownership?: ExtensionContributionInventory["renderer_ownership"];
24
24
  preflight_overrides: number;
25
+ preflight_ownership?: ExtensionContributionInventory["preflight_ownership"];
25
26
  }): ExtensionContributionInventory;
@@ -4,7 +4,7 @@
4
4
  * Validates and canonicalizes the serializable extension surface inventory.
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]="8ba4e82a-ab38-5527-84cf-ec553f434a22")}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]="2c4e3831-6644-5db3-a28b-1c6a131da2e1")}catch(e){}}();
8
8
  import { normalizeCommandName } from "./extension-runtime-helpers.js";
9
9
  const COMMAND_PATH_FIELDS = new Set([
10
10
  "commands",
@@ -75,6 +75,29 @@ function normalizeRendererOwnership(value) {
75
75
  }
76
76
  return ownership.sort((left, right) => left.format.localeCompare(right.format));
77
77
  }
78
+ /** Validate preflight command ownership without importing extension code. */
79
+ function normalizePreflightOwnership(value) {
80
+ if (!Array.isArray(value))
81
+ return null;
82
+ const ownership = [];
83
+ for (const rawEntry of value) {
84
+ if (typeof rawEntry !== "object" || rawEntry === null)
85
+ return null;
86
+ const commands = rawEntry.commands;
87
+ if (!Array.isArray(commands) ||
88
+ commands.some((command) => typeof command !== "string")) {
89
+ return null;
90
+ }
91
+ ownership.push({
92
+ commands: [
93
+ ...new Set(commands.map((command) => normalizeCommandName(command))),
94
+ ]
95
+ .filter((command) => command.length > 0)
96
+ .sort((left, right) => left.localeCompare(right)),
97
+ });
98
+ }
99
+ return ownership;
100
+ }
78
101
  /** Normalize an optional contribution inventory, returning null for malformed data. */
79
102
  export function normalizeExtensionContributionInventory(value) {
80
103
  if (value === undefined || value === null)
@@ -102,6 +125,13 @@ export function normalizeExtensionContributionInventory(value) {
102
125
  return null;
103
126
  inventory.renderer_ownership = ownership;
104
127
  }
128
+ const rawPreflightOwnership = record.preflight_ownership;
129
+ if (rawPreflightOwnership !== undefined) {
130
+ const ownership = normalizePreflightOwnership(rawPreflightOwnership);
131
+ if (ownership === null)
132
+ return null;
133
+ inventory.preflight_ownership = ownership;
134
+ }
105
135
  return inventory;
106
136
  }
107
137
  /** Project an activation summary into the versioned static inventory contract. */
@@ -131,7 +161,10 @@ export function createExtensionContributionInventory(summary) {
131
161
  ? { renderer_ownership: summary.renderer_ownership }
132
162
  : {}),
133
163
  preflight_overrides: summary.preflight_overrides,
164
+ ...(summary.preflight_ownership
165
+ ? { preflight_ownership: summary.preflight_ownership }
166
+ : {}),
134
167
  };
135
168
  }
136
169
  //# sourceMappingURL=contribution-inventory.js.map
137
- //# debugId=8ba4e82a-ab38-5527-84cf-ec553f434a22
170
+ //# debugId=2c4e3831-6644-5db3-a28b-1c6a131da2e1
@@ -4,7 +4,7 @@
4
4
  * Implements extension runtime contracts and governance for Extension Hook Runtime.
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]="4c40667c-1e20-5813-b2f3-eb4cb966b246")}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]="ac377139-8ce2-58ad-8005-0ac907a9baed")}catch(e){}}();
8
8
  import { cloneCommandOptionsSnapshot, cloneContextSnapshot, cloneGlobalOptionsSnapshot, normalizeCommandName, } from "./extension-runtime-helpers.js";
9
9
  import { stableValueEquals } from "../shared/serialization.js";
10
10
  import { EXIT_CODE } from "../shared/constants.js";
@@ -337,7 +337,6 @@ export async function runParserOverride(parsers, context) {
337
337
  }
338
338
  /** Implements run preflight override for the public runtime surface of this module. */
339
339
  export async function runPreflightOverride(preflight, context) {
340
- const matched = [...preflight.overrides].reverse()[0];
341
340
  const baseContext = {
342
341
  command: normalizeCommandName(context.command),
343
342
  args: cloneContextSnapshot(context.args),
@@ -349,6 +348,9 @@ export async function runPreflightOverride(preflight, context) {
349
348
  pm_root_rel: context.pm_root_rel,
350
349
  };
351
350
  const baseDecision = cloneContextSnapshot(context.decision);
351
+ const matched = [...preflight.overrides]
352
+ .reverse()
353
+ .find((entry) => !entry.commands?.length || entry.commands.includes(baseContext.command));
352
354
  if (!matched) {
353
355
  return {
354
356
  overridden: false,
@@ -693,4 +695,4 @@ export function runRendererOverride(renderers, context) {
693
695
  }
694
696
  }
695
697
  //# sourceMappingURL=extension-hook-runtime.js.map
696
- //# debugId=4c40667c-1e20-5813-b2f3-eb4cb966b246
698
+ //# debugId=ac377139-8ce2-58ad-8005-0ac907a9baed
@@ -162,6 +162,11 @@ export interface ExtensionContributionInventory {
162
162
  }>;
163
163
  /** Number of preflight overrides in the package. */
164
164
  preflight_overrides?: number;
165
+ /** Optional command ownership for each preflight override. Empty commands mean global ownership. */
166
+ preflight_ownership?: Array<{
167
+ /** Command paths on which the override may run. */
168
+ commands: string[];
169
+ }>;
165
170
  }
166
171
  /** Documents the extension manifest payload exchanged by command, SDK, and package integrations. */
167
172
  export interface ExtensionManifest {
@@ -457,6 +462,16 @@ export type CommandHandler = (context: CommandHandlerContext) => unknown;
457
462
  export type ParserOverride = (context: ParserOverrideContext) => ParserOverrideDelta | Promise<ParserOverrideDelta>;
458
463
  /** Restricts preflight override values accepted by command, SDK, and storage contracts. */
459
464
  export type PreflightOverride = (context: PreflightOverrideContext) => PreflightOverrideDelta | Promise<PreflightOverrideDelta>;
465
+ /** Static ownership declaration used to select and diagnose preflight overrides. */
466
+ export interface PreflightOverrideOwnership {
467
+ /** Normalized command paths on which this preflight override may run. */
468
+ commands?: string[];
469
+ }
470
+ /** Declarative preflight override paired with statically inspectable ownership. */
471
+ export interface ScopedPreflightOverrideDefinition extends PreflightOverrideOwnership {
472
+ /** Preflight handler invoked only for a declared command, or globally when unscoped. */
473
+ run: PreflightOverride;
474
+ }
460
475
  /** Explicitly claims or declines one service payload without relying on object identity. */
461
476
  export type ServiceOverrideDecision = {
462
477
  handled: true;
@@ -1065,6 +1080,8 @@ export interface RegisteredExtensionPreflightOverride {
1065
1080
  name: string;
1066
1081
  /** Value that configures or reports run for this contract. */
1067
1082
  run: PreflightOverride;
1083
+ /** Normalized command paths owned by this preflight override. */
1084
+ commands?: string[];
1068
1085
  }
1069
1086
  /** Documents the registered extension service override payload exchanged by command, SDK, and package integrations. */
1070
1087
  export interface RegisteredExtensionServiceOverride {
@@ -1330,7 +1347,7 @@ export interface ExtensionApi {
1330
1347
  /** Value that configures or reports register parser for this contract. */
1331
1348
  registerParser(command: string, override: ParserOverride): void;
1332
1349
  /** Value that configures or reports register preflight for this contract. */
1333
- registerPreflight(override: PreflightOverride): void;
1350
+ registerPreflight(override: PreflightOverride | ScopedPreflightOverrideDefinition): void;
1334
1351
  /** Value that configures or reports register service for this contract. */
1335
1352
  registerService(service: ExtensionServiceName, override: ServiceOverride): void;
1336
1353
  /** Value that configures or reports register flags for this contract. */
@@ -1,6 +1,6 @@
1
1
  /** Public contract for known extension capabilities, shared by SDK and presentation-layer consumers. */
2
2
 
3
- !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]="938c39a8-6545-5d8b-b717-69138932d528")}catch(e){}}();
3
+ !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]="50ad61f1-6719-541c-b4e0-4a88468725cf")}catch(e){}}();
4
4
  export const KNOWN_EXTENSION_CAPABILITIES = [
5
5
  "commands",
6
6
  "renderers",
@@ -99,4 +99,4 @@ export function createDefaultExtensionGovernancePolicy() {
99
99
  };
100
100
  }
101
101
  //# sourceMappingURL=extension-types.js.map
102
- //# debugId=938c39a8-6545-5d8b-b717-69138932d528
102
+ //# debugId=50ad61f1-6719-541c-b4e0-4a88468725cf
@@ -4,7 +4,7 @@
4
4
  * Implements extension runtime contracts and governance for Loader.
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]="ed58c949-c3d3-5a74-9146-05b0a04b58c4")}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]="3d5208e5-0ea5-54a5-82a8-50294b4a0655")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { pathToFileURL } from "node:url";
@@ -17,6 +17,7 @@ import { flattenFlagListValue, isFlagDefaultValueCoercible, resolveFlagValueKind
17
17
  import { KNOWN_ITEM_FIELD_TYPES, normalizeItemFieldType, suggestKnownItemFieldType, } from "./item-field-types.js";
18
18
  import { snapshotExtensionModuleGraph } from "./module-graph-snapshot.js";
19
19
  import { captureExtensionActivationRollback } from "./activation-transaction.js";
20
+ import { collectPreflightCollisionWarnings, normalizePreflightOverride, } from "./preflight-ownership.js";
20
21
  import { assertCommandDefinitionMetadataStrings } from "./command-visibility-tier.js";
21
22
  import { asRegistrationRecord, assertOptionalBooleanField, assertOptionalFlagDefaultField, assertOptionalStringArrayField, assertOptionalStringField, normalizeOptionalStringArrayField, } from "./registration-validation.js";
22
23
  import { describeExtensionLongFlagFailure, findExtensionFlagTokenFailure, } from "./flag-definition-validation.js";
@@ -1675,11 +1676,11 @@ class ExtensionApiRegistrar {
1675
1676
  if (!this.allowRegistration("preflight.override", "registerPreflight", "preflight")) {
1676
1677
  return;
1677
1678
  }
1678
- assertFunctionHandler("registerPreflight override", override);
1679
+ const normalized = normalizePreflightOverride(override);
1679
1680
  this.#preflightRegistry.overrides.push({
1680
1681
  layer: this.#loadedExtension.layer,
1681
1682
  name: this.#loadedExtension.name,
1682
- run: override,
1683
+ ...normalized,
1683
1684
  });
1684
1685
  }
1685
1686
  registerService(service, override) {
@@ -2171,15 +2172,6 @@ function collectParserCollisionWarnings(parsers) {
2171
2172
  }
2172
2173
  return warnings;
2173
2174
  }
2174
- function collectPreflightCollisionWarnings(preflight) {
2175
- if (preflight.overrides.length <= 1) {
2176
- return [];
2177
- }
2178
- const winner = preflight.overrides[preflight.overrides.length - 1];
2179
- return preflight.overrides
2180
- .slice(0, -1)
2181
- .map((displaced) => `extension_preflight_override_collision:${winner.layer}:${winner.name}:${displaced.layer}:${displaced.name}`);
2182
- }
2183
2175
  // Services whose runtime semantics are chain/fall-through (each override gets a chance);
2184
2176
  // for those, registering multiple overrides is by design, not a collision.
2185
2177
  const CHAINED_SERVICE_NAMES = new Set(["output_format"]);
@@ -2320,4 +2312,4 @@ export const _testOnlyLoader = {
2320
2312
  },
2321
2313
  };
2322
2314
  //# sourceMappingURL=loader.js.map
2323
- //# debugId=ed58c949-c3d3-5a74-9146-05b0a04b58c4
2315
+ //# debugId=3d5208e5-0ea5-54a5-82a8-50294b4a0655
@@ -0,0 +1,5 @@
1
+ import type { ExtensionPreflightRegistry, PreflightOverride, RegisteredExtensionPreflightOverride, ScopedPreflightOverrideDefinition } from "./extension-types.js";
2
+ /** Normalize one callback or scoped definition into a registered handler payload. */
3
+ export declare function normalizePreflightOverride(override: PreflightOverride | ScopedPreflightOverrideDefinition): Pick<RegisteredExtensionPreflightOverride, "run" | "commands">;
4
+ /** Report pairwise overlap while permitting disjoint scoped ownership. */
5
+ export declare function collectPreflightCollisionWarnings(preflight: ExtensionPreflightRegistry): string[];
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @module core/extensions/preflight-ownership
3
+ *
4
+ * Normalizes preflight ownership and diagnoses competing registrations.
5
+ */
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]="065f61c6-2123-5a6d-984a-569bb14d6911")}catch(e){}}();
8
+ import { normalizeCommandName } from "./extension-runtime-helpers.js";
9
+ /** Normalize one callback or scoped definition into a registered handler payload. */
10
+ export function normalizePreflightOverride(override) {
11
+ const run = typeof override === "function" ? override : override.run;
12
+ if (typeof run !== "function") {
13
+ throw new TypeError("registerPreflight override requires a function handler");
14
+ }
15
+ const commands = [
16
+ ...new Set((typeof override === "function" ? [] : (override.commands ?? [])).map((command) => {
17
+ if (typeof command !== "string" || command.trim().length === 0) {
18
+ throw new TypeError("registerPreflight ownership.commands must contain non-empty command paths");
19
+ }
20
+ return normalizeCommandName(command);
21
+ })),
22
+ ];
23
+ return { run, ...(commands.length > 0 ? { commands } : {}) };
24
+ }
25
+ /** Report pairwise overlap while permitting disjoint scoped ownership. */
26
+ export function collectPreflightCollisionWarnings(preflight) {
27
+ const warnings = [];
28
+ for (let winnerIndex = 1; winnerIndex < preflight.overrides.length; winnerIndex += 1) {
29
+ const winner = preflight.overrides[winnerIndex];
30
+ for (const displaced of preflight.overrides.slice(0, winnerIndex)) {
31
+ if (winner.commands?.length &&
32
+ displaced.commands?.length &&
33
+ !displaced.commands.some((command) => winner.commands.includes(command))) {
34
+ continue;
35
+ }
36
+ warnings.push(`extension_preflight_override_collision:${winner.layer}:${winner.name}:${displaced.layer}:${displaced.name}`);
37
+ }
38
+ }
39
+ return warnings;
40
+ }
41
+ //# sourceMappingURL=preflight-ownership.js.map
42
+ //# debugId=065f61c6-2123-5a6d-984a-569bb14d6911
@@ -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]="4a84286a-e1e3-5465-94c9-b44f8e4472d5")}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";
@@ -333,6 +333,7 @@ function formatEffectiveOutput(effectiveResult, nativeOutput, options) {
333
333
  ["outputLimit", options.outputLimit],
334
334
  ["outputBudget", options.outputBudget],
335
335
  ["outputFormat", options.outputFormat],
336
+ ["outputSession", options.outputSession],
336
337
  ].filter((entry) => entry[1] !== undefined)),
337
338
  };
338
339
  const format = resolveReadOutputEncoding(command ?? "", commandOptions) ??
@@ -416,4 +417,4 @@ export const outputTestOnly = {
416
417
  renderToonValue,
417
418
  };
418
419
  //# sourceMappingURL=output.js.map
419
- //# debugId=816ae182-02ba-56a9-8204-7474e30322bc
420
+ //# debugId=4a84286a-e1e3-5465-94c9-b44f8e4472d5
@@ -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
@@ -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
@@ -4,11 +4,27 @@
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]="364a8999-58e2-58c9-bfa6-acd8c42ec471")}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]="09427917-8347-59cc-9358-452671aed3c3")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { appendWorkspaceAuditEvent } from "../core/history/workspace-history.js";
11
11
  import { readSettings } from "../core/store/settings.js";
12
+ import { EXIT_CODE } from "../core/shared/constants.js";
13
+ import { PmCliError } from "../core/shared/errors.js";
14
+ /**
15
+ * Refuse an acknowledgment argument as a classified usage error.
16
+ *
17
+ * Argument validation is an expected outcome of a public mutation surface, not a
18
+ * product failure. Raising a bare `TypeError` left the refusal at exit code 1,
19
+ * which the CLI observability boundary reports as an unclassified handled error
20
+ * and the release gate then reads as a blocking production issue. Carrying
21
+ * {@link EXIT_CODE.USAGE} plus a stable code keeps the refusal teachable and
22
+ * keeps expected validation out of the error channel without masking genuine
23
+ * failures, which retain their own exit codes.
24
+ */
25
+ function refuseAuthorAcknowledgmentArgument(message, code) {
26
+ throw new PmCliError(message, EXIT_CODE.USAGE, { code });
27
+ }
12
28
  /** First release-governance anchor after which unknown authors require remediation. */
13
29
  export const HISTORY_AUTHOR_ATTRIBUTION_BASELINE = "2026-07-15T06:22:12.276Z";
14
30
  /** Parsed epoch for the immutable attribution baseline used by every stream scan. */
@@ -198,7 +214,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
198
214
  const explicitEvents = options.events ?? [];
199
215
  const selectorCount = Number(options.all_actionable === true) + Number(explicitEvents.length > 0);
200
216
  if (selectorCount > 1) {
201
- throw new TypeError("Author acknowledgment accepts either explicit events or all_actionable, not both.");
217
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", "history_author_acknowledge_selector_conflict");
202
218
  }
203
219
  const selectedEvents = options.all_actionable === true
204
220
  ? (await scanHistoryAuthorAttribution(pmRoot, 0, true))
@@ -213,7 +229,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
213
229
  reason.length > 0,
214
230
  ].includes(false);
215
231
  if (requiredValuesMissing) {
216
- throw new TypeError("Author acknowledgment requires events, reviewer, attributed_author, and reason.");
232
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", "history_author_acknowledge_required_values_missing");
217
233
  }
218
234
  const uniqueEvents = [
219
235
  ...new Map(selectedEvents.map((event) => [
@@ -228,7 +244,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
228
244
  event.line >= 1,
229
245
  ].includes(false);
230
246
  if (invalidCoordinate) {
231
- throw new TypeError(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`);
247
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, "history_author_acknowledge_target_unreadable");
232
248
  }
233
249
  let parsed;
234
250
  try {
@@ -237,10 +253,10 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
237
253
  parsed = JSON.parse(line ?? "");
238
254
  }
239
255
  catch {
240
- throw new TypeError(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`);
256
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, "history_author_acknowledge_target_unreadable");
241
257
  }
242
258
  if (classifyHistoryAuthorEvent(parsed) !== "actionable_unknown") {
243
- throw new TypeError(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`);
259
+ refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, "history_author_acknowledge_target_not_actionable");
244
260
  }
245
261
  }
246
262
  const settings = await readSettings(pmRoot);
@@ -264,4 +280,4 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
264
280
  };
265
281
  }
266
282
  //# sourceMappingURL=author-attribution.js.map
267
- //# debugId=364a8999-58e2-58c9-bfa6-acd8c42ec471
283
+ //# debugId=09427917-8347-59cc-9358-452671aed3c3