@unbrained/pm-cli 2026.8.6 → 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 (209) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +30 -0
  3. package/dist/cli/main.js +4 -2
  4. package/dist/cli/register-operations.js +11 -2
  5. package/dist/cli/stats-analytics-json.d.ts +9 -0
  6. package/dist/cli/stats-analytics-json.js +69 -0
  7. package/dist/cli-bundle/bundle-manifest.json +397 -397
  8. package/dist/cli-bundle/chunks/append-7BXBFDGD.js +2 -0
  9. package/dist/cli-bundle/chunks/{chunk-TPKDJ5WL.js → chunk-2AXF3VSK.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-R6RKEYYW.js → chunk-2XS43CCV.js} +2 -2
  11. package/dist/cli-bundle/chunks/{chunk-T45OHXDW.js → chunk-3A6KWB72.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-3ISTDB42.js +8 -0
  13. package/dist/cli-bundle/chunks/{chunk-SXECIECW.js → chunk-4MTI7XOV.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-MCS73BKB.js → chunk-6BX5UDCN.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-A3XQ7VPU.js → chunk-6QPO7KLR.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-BP6EMEDP.js → chunk-7MXHZHSQ.js} +2 -2
  17. package/dist/cli-bundle/chunks/{chunk-GU3TSEHD.js → chunk-7ZPMJW4U.js} +2 -2
  18. package/dist/cli-bundle/chunks/{chunk-343QETLI.js → chunk-AGYNSNCI.js} +2 -2
  19. package/dist/cli-bundle/chunks/chunk-B4H7FEFH.js +5 -0
  20. package/dist/cli-bundle/chunks/{chunk-CA3BURYF.js → chunk-B4KLBBMN.js} +2 -2
  21. package/dist/cli-bundle/chunks/{chunk-3ZJRFYY2.js → chunk-CALJHNBL.js} +12 -12
  22. package/dist/cli-bundle/chunks/{chunk-M357ZCOR.js → chunk-CFIGP5LY.js} +2 -2
  23. package/dist/cli-bundle/chunks/{chunk-SVV3DQES.js → chunk-CS6MRHG7.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-DWOAOZHZ.js → chunk-CUGNQQKH.js} +2 -2
  25. package/dist/cli-bundle/chunks/chunk-D4FPS43D.js +164 -0
  26. package/dist/cli-bundle/chunks/{chunk-L6LGKJX3.js → chunk-H5Y5YE6A.js} +2 -2
  27. package/dist/cli-bundle/chunks/{chunk-5PBP2ZP3.js → chunk-H5Y6UV6E.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-QJ7C3JIW.js → chunk-H7KGWPDF.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-D7I3TUGV.js → chunk-HFSD77TQ.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-AOBDLU4T.js → chunk-HX2GTA6L.js} +2 -2
  31. package/dist/cli-bundle/chunks/{chunk-4AVFKHHC.js → chunk-J2IEKAVR.js} +2 -2
  32. package/dist/cli-bundle/chunks/{chunk-OXY3SJ3N.js → chunk-K44PYFXH.js} +2 -2
  33. package/dist/cli-bundle/chunks/{chunk-M4VEE3FK.js → chunk-K4KGEEBT.js} +2 -2
  34. package/dist/cli-bundle/chunks/chunk-KFLK5TRH.js +21 -0
  35. package/dist/cli-bundle/chunks/{chunk-FDBRXV25.js → chunk-KL6IEBV2.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-JQ4NZ5EB.js → chunk-KWQZDZSS.js} +2 -2
  37. package/dist/cli-bundle/chunks/{chunk-UVVXHGYS.js → chunk-KZ4X3DGU.js} +2 -2
  38. package/dist/cli-bundle/chunks/chunk-LD77HJMQ.js +13 -0
  39. package/dist/cli-bundle/chunks/{chunk-AYRUGRNS.js → chunk-ME2JJ4LA.js} +2 -2
  40. package/dist/cli-bundle/chunks/chunk-NFLJ3FHD.js +2 -0
  41. package/dist/cli-bundle/chunks/{chunk-MDTH7SAE.js → chunk-NG6OXIBR.js} +8 -8
  42. package/dist/cli-bundle/chunks/{chunk-R6LSRGPS.js → chunk-NYIGHWQY.js} +2 -2
  43. package/dist/cli-bundle/chunks/{chunk-3KFVGGRE.js → chunk-NZ75GNSA.js} +2 -2
  44. package/dist/cli-bundle/chunks/{chunk-Q3VOP62W.js → chunk-PCJWJNC2.js} +2 -2
  45. package/dist/cli-bundle/chunks/{chunk-C3YABSJK.js → chunk-PD3225AM.js} +2 -2
  46. package/dist/cli-bundle/chunks/{chunk-JFZIS6JF.js → chunk-PDEGKG7P.js} +2 -2
  47. package/dist/cli-bundle/chunks/chunk-PIE5HBNA.js +2 -0
  48. package/dist/cli-bundle/chunks/{chunk-SD3YXU2U.js → chunk-PW2H7YJR.js} +20 -20
  49. package/dist/cli-bundle/chunks/{chunk-PECV7L5T.js → chunk-TPKN3S7S.js} +2 -2
  50. package/dist/cli-bundle/chunks/{chunk-F4NREH3G.js → chunk-TPXAXTCO.js} +2 -2
  51. package/dist/cli-bundle/chunks/chunk-UFWUJO4V.js +2 -0
  52. package/dist/cli-bundle/chunks/{chunk-WSI5KZQJ.js → chunk-UQLZQVFW.js} +2 -2
  53. package/dist/cli-bundle/chunks/{chunk-4OVGQW22.js → chunk-VT3Z5G7D.js} +2 -2
  54. package/dist/cli-bundle/chunks/{chunk-RUAU5OSH.js → chunk-WOD3WWUN.js} +2 -2
  55. package/dist/cli-bundle/chunks/{chunk-DQGJ2RWT.js → chunk-WSJEIGJF.js} +2 -2
  56. package/dist/cli-bundle/chunks/{chunk-RAFUN7IX.js → chunk-WYNUU7ZW.js} +49 -46
  57. package/dist/cli-bundle/chunks/{chunk-5ZKQPA44.js → chunk-YGPNCCXZ.js} +2 -2
  58. package/dist/cli-bundle/chunks/close-CMY3BAUG.js +2 -0
  59. package/dist/cli-bundle/chunks/close-many-SA4XZCTK.js +2 -0
  60. package/dist/cli-bundle/chunks/comments-EZ556ZD3.js +2 -0
  61. package/dist/cli-bundle/chunks/copy-ZSGPA52X.js +2 -0
  62. package/dist/cli-bundle/chunks/{create-TG67IVFI.js → create-I5DVV4YG.js} +2 -2
  63. package/dist/cli-bundle/chunks/delete-RL3JACSW.js +2 -0
  64. package/dist/cli-bundle/chunks/{deps-AJUGP2OH.js → deps-S7UBCECS.js} +2 -2
  65. package/dist/cli-bundle/chunks/{docs-QOCLDRKJ.js → docs-ZZNVBBYO.js} +2 -2
  66. package/dist/cli-bundle/chunks/{files-3ST5TY64.js → files-27C337VT.js} +2 -2
  67. package/dist/cli-bundle/chunks/focus-5Z2SG7LU.js +2 -0
  68. package/dist/cli-bundle/chunks/{history-compact-7BJFML4S.js → history-compact-HJQK67CZ.js} +2 -2
  69. package/dist/cli-bundle/chunks/{history-redact-WJN3HYXR.js → history-redact-PWC6PDWA.js} +2 -2
  70. package/dist/cli-bundle/chunks/{history-repair-XDNZUB7F.js → history-repair-N3CY4WBF.js} +2 -2
  71. package/dist/cli-bundle/chunks/{learnings-SZMUPVNA.js → learnings-4FH23XDT.js} +2 -2
  72. package/dist/cli-bundle/chunks/{profile-KL53JIAC.js → profile-5Y5XXH5N.js} +2 -2
  73. package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-FJZCJ67O.js} +2 -2
  74. package/dist/cli-bundle/chunks/{register-mutation-OCRQNZK4.js → register-mutation-YGYPW3BL.js} +3 -3
  75. package/dist/cli-bundle/chunks/register-operations-WMDSUMQF.js +2 -0
  76. package/dist/cli-bundle/chunks/{register-setup-QWBQ6HBS.js → register-setup-DL7FFABC.js} +2 -2
  77. package/dist/cli-bundle/chunks/restore-6KYBV5BY.js +2 -0
  78. package/dist/cli-bundle/chunks/{schema-QJ27OTRV.js → schema-EQGKBYXJ.js} +2 -2
  79. package/dist/cli-bundle/chunks/update-QVTYOD6I.js +2 -0
  80. package/dist/cli-bundle/chunks/update-many-DJSBU525.js +2 -0
  81. package/dist/cli-bundle/focused-chunks/{chunk-MBBMTDD3.js → chunk-2ECLECMK.js} +3 -3
  82. package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-3K4XV2BF.js} +2 -2
  83. package/dist/cli-bundle/focused-chunks/{chunk-ME4XVOBJ.js → chunk-4EX25PXM.js} +2 -2
  84. package/dist/cli-bundle/focused-chunks/chunk-4VJQTS3P.js +2 -0
  85. package/dist/cli-bundle/focused-chunks/chunk-73JUDYXT.js +2 -0
  86. package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-CIXVQPB7.js} +2 -2
  87. package/dist/cli-bundle/focused-chunks/{chunk-7YTZ7A4E.js → chunk-DLTS3IHM.js} +2 -2
  88. package/dist/cli-bundle/focused-chunks/{chunk-YHDCGUIW.js → chunk-DQ6FKGL3.js} +10 -10
  89. package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-HNL6IFGS.js} +2 -2
  90. package/dist/cli-bundle/focused-chunks/chunk-JLG2C4EQ.js +2 -0
  91. package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-MHMTKV5V.js} +2 -2
  92. package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-MOTJFQ3F.js} +22 -22
  93. package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-NBJKQP4S.js} +2 -2
  94. package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-QHRTT7WT.js} +2 -2
  95. package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-R2LEMEV5.js} +2 -2
  96. package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-RPNYG5MO.js} +2 -2
  97. package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-RW5IYD4J.js} +2 -2
  98. package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-TIKDBG4D.js} +16 -16
  99. package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-VZFU2R4M.js} +2 -2
  100. package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YZEZAPJK.js} +2 -2
  101. package/dist/cli-bundle/focused-chunks/chunk-ZJIMJHDB.js +2 -0
  102. package/dist/cli-bundle/main.js +2 -2
  103. package/dist/cli-bundle/sdk-authoring.js +1 -1
  104. package/dist/cli-bundle/sdk-contracts.js +1 -1
  105. package/dist/cli-bundle/sdk-core.js +29 -28
  106. package/dist/cli-bundle/sdk-governance.js +1 -1
  107. package/dist/cli-bundle/sdk-graph.js +1 -1
  108. package/dist/cli-bundle/sdk-merge.js +1 -1
  109. package/dist/cli-bundle/sdk-query.js +1 -1
  110. package/dist/cli-bundle/sdk-runtime.js +1 -1
  111. package/dist/cli-bundle/sdk-testing.js +1 -1
  112. package/dist/cli-bundle/sdk.js +1 -1
  113. package/dist/core/extensions/reserved-host-flags.js +3 -2
  114. package/dist/core/history/workspace-history.d.ts +22 -2
  115. package/dist/core/history/workspace-history.js +60 -36
  116. package/dist/core/output/output.d.ts +2 -0
  117. package/dist/core/output/output.js +3 -2
  118. package/dist/core/shared/command-types.d.ts +2 -0
  119. package/dist/core/shared/command-types.js +2 -2
  120. package/dist/mcp/tool-definitions.js +6 -2
  121. package/dist/sdk/author-attribution.js +23 -7
  122. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  123. package/dist/sdk/cli-bootstrap.js +7 -2
  124. package/dist/sdk/cli-contracts/completeness.js +51 -4
  125. package/dist/sdk/cli-contracts/flag-contracts.js +3 -2
  126. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  127. package/dist/sdk/cli-contracts/runtime-contracts.js +14 -8
  128. package/dist/sdk/cli-contracts/tool-parameter-tables.js +116 -10
  129. package/dist/sdk/cli-contracts/tool-schema.js +18 -2
  130. package/dist/sdk/cli-program.js +3 -2
  131. package/dist/sdk/completion.js +5 -2
  132. package/dist/sdk/contracts.d.ts +1 -0
  133. package/dist/sdk/contracts.js +2 -2
  134. package/dist/sdk/core.d.ts +3 -1
  135. package/dist/sdk/core.js +4 -3
  136. package/dist/sdk/extension.js +9 -11
  137. package/dist/sdk/generated-error-code-catalog.js +112 -2
  138. package/dist/sdk/history-analytics.d.ts +141 -0
  139. package/dist/sdk/history-analytics.js +283 -0
  140. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  141. package/dist/sdk/improvement-ledger-validation.js +63 -0
  142. package/dist/sdk/improvement-ledger.d.ts +139 -0
  143. package/dist/sdk/improvement-ledger.js +261 -0
  144. package/dist/sdk/index.d.ts +6 -2
  145. package/dist/sdk/index.js +8 -4
  146. package/dist/sdk/lifecycle/plan.js +6 -3
  147. package/dist/sdk/merge/install.js +10 -2
  148. package/dist/sdk/read-output-budget.js +24 -22
  149. package/dist/sdk/read-output-contracts.d.ts +10 -2
  150. package/dist/sdk/read-output-contracts.js +124 -65
  151. package/dist/sdk/read-output-rows.d.ts +29 -0
  152. package/dist/sdk/read-output-rows.js +100 -0
  153. package/dist/sdk/read-output-session.d.ts +69 -0
  154. package/dist/sdk/read-output-session.js +200 -0
  155. package/dist/sdk/runtime-input.d.ts +2 -0
  156. package/dist/sdk/runtime-input.js +14 -2
  157. package/dist/sdk/runtime-primitives.d.ts +1 -1
  158. package/dist/sdk/runtime-primitives.js +3 -3
  159. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  160. package/dist/sdk/runtime-stats-options.js +38 -0
  161. package/dist/sdk/runtime.d.ts +1 -0
  162. package/dist/sdk/runtime.js +6 -27
  163. package/dist/sdk/stats.d.ts +40 -0
  164. package/dist/sdk/stats.js +112 -29
  165. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  166. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  167. package/docs/README.md +1 -0
  168. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  169. package/marketplace.json +2 -2
  170. package/package.json +3 -3
  171. package/packages/pm-beads/package.json +1 -1
  172. package/packages/pm-calendar/package.json +1 -1
  173. package/packages/pm-command-kit/package.json +1 -1
  174. package/packages/pm-digital-twin/package.json +1 -1
  175. package/packages/pm-governance-audit/package.json +1 -1
  176. package/packages/pm-guide-shell/package.json +1 -1
  177. package/packages/pm-kanban/package.json +1 -1
  178. package/packages/pm-lifecycle-hooks/package.json +1 -1
  179. package/packages/pm-linked-test-adapters/package.json +1 -1
  180. package/packages/pm-search-advanced/package.json +1 -1
  181. package/packages/pm-templates/package.json +1 -1
  182. package/packages/pm-todos/package.json +1 -1
  183. package/packages/pm-vcs/package.json +1 -1
  184. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  185. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  186. package/sdk/public-surface.json +374 -821
  187. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
  188. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
  189. package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
  190. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
  191. package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
  192. package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
  193. package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
  194. package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
  195. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
  196. package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
  197. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
  198. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
  199. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
  200. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
  201. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
  202. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
  203. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
  204. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
  205. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
  206. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
  208. package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
@@ -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
@@ -29,6 +29,8 @@ export interface BootstrapGlobalOptions {
29
29
  outputBudget?: string;
30
30
  /** Canonical renderer encoding for read output. */
31
31
  outputFormat?: "toon" | "json";
32
+ /** Caller-carried cross-call budget and served-item state. */
33
+ outputSession?: string;
32
34
  /** Invocation-wide mutation author override. */
33
35
  author?: string;
34
36
  /** Whether `--author` was present without its required value. */
@@ -4,7 +4,7 @@
4
4
  * Provides public bootstrap argument normalization for embedded CLI hosts.
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]="212ba734-6a06-576f-8ad8-de759727cd75")}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]="1c2ee12c-9a3e-57bc-8336-f6c558458802")}catch(e){}}();
8
8
  import { EXECUTABLE_COMMAND_ALIASES, resolveSubcommandFlagContractsForCommand, } from "./cli-contracts.js";
9
9
  export { EXECUTABLE_COMMAND_ALIASES };
10
10
  import { levenshteinDistanceWithinLimit } from "../core/shared/levenshtein.js";
@@ -16,12 +16,14 @@ const GLOBAL_VALUE_CONSUMING_FLAGS = new Set([
16
16
  "--output-limit",
17
17
  "--output-budget",
18
18
  "--output-format",
19
+ "--output-session",
19
20
  ]);
20
21
  const OUTPUT_VALUE_FLAGS = new Set([
21
22
  "--output-include",
22
23
  "--output-limit",
23
24
  "--output-budget",
24
25
  "--output-format",
26
+ "--output-session",
25
27
  ]);
26
28
  /** Whether a global value-consuming flag uses its inline `--flag=value` form. */
27
29
  const isInlineGlobalValueToken = (token) => {
@@ -105,6 +107,9 @@ export function parseBootstrapGlobalOptions(argv) {
105
107
  outputFormat: state.outputValues.get("--output-format"),
106
108
  }
107
109
  : {}),
110
+ ...(state.outputValues.get("--output-session") === undefined
111
+ ? {}
112
+ : { outputSession: state.outputValues.get("--output-session") }),
108
113
  ...(state.author === ""
109
114
  ? { authorMissingValue: true }
110
115
  : state.author !== undefined
@@ -866,4 +871,4 @@ export const _testOnly = {
866
871
  resolveCanonicalFlag,
867
872
  };
868
873
  //# sourceMappingURL=cli-bootstrap.js.map
869
- //# debugId=212ba734-6a06-576f-8ad8-de759727cd75
874
+ //# debugId=1c2ee12c-9a3e-57bc-8336-f6c558458802
@@ -7,11 +7,11 @@
7
7
  * a hand-picked test list.
8
8
  */
9
9
 
10
- !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]="5f5b9bd3-1b92-5fb2-b649-6eb942a7a3c4")}catch(e){}}();
10
+ !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]="0c81aa87-3ffb-5837-a3fa-eae5fb70eaf1")}catch(e){}}();
11
11
  import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
12
12
  import { resolveSubcommandFlagContractsForCommand, } from "./flag-contracts.js";
13
13
  import { pmToolActionParameterKeys } from "./tool-schema.js";
14
- import { PM_READ_OUTPUT_OPTION_FLAGS, resolveReadOutputSurface, } from "../read-output-contracts.js";
14
+ import { PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS, PM_READ_OUTPUT_OPTION_FLAGS, resolveReadOutputSurface, } from "../read-output-contracts.js";
15
15
  const CLI_TRANSPORT_FLAGS = new Set([
16
16
  "--author",
17
17
  "--follow",
@@ -22,6 +22,7 @@ const CLI_TRANSPORT_FLAGS = new Set([
22
22
  "--output-limit",
23
23
  "--output-budget",
24
24
  "--output-format",
25
+ "--output-session",
25
26
  "--no-changed-fields",
26
27
  "--no-extensions",
27
28
  "--no-pager",
@@ -30,7 +31,10 @@ const CLI_TRANSPORT_FLAGS = new Set([
30
31
  "--quiet",
31
32
  "--interval-ms",
32
33
  ]);
33
- const READ_OUTPUT_OPTION_FLAGS = new Set(PM_READ_OUTPUT_OPTION_FLAGS);
34
+ const READ_OUTPUT_OPTION_FLAGS = new Set([
35
+ ...PM_READ_OUTPUT_OPTION_FLAGS,
36
+ ...PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS,
37
+ ]);
34
38
  const CLI_PRESENTATION_FLAGS = new Set([
35
39
  "--brief",
36
40
  "--format",
@@ -137,6 +141,27 @@ const ACTION_FLAG_PARAMETER_OVERRIDES = {
137
141
  package: { "--gh": "github", "--scaffold": "init" },
138
142
  install: { "--gh": "github" },
139
143
  };
144
+ const ACTION_STRUCTURED_FLAG_PARAMETERS = {
145
+ stats: {
146
+ "--analytics": [
147
+ "measurements",
148
+ "metric",
149
+ "measurementLimit",
150
+ "observe",
151
+ "improvementDirection",
152
+ "measurementSource",
153
+ "measurementItem",
154
+ "measurementRevision",
155
+ "author",
156
+ "message",
157
+ "provenanceCoverage",
158
+ "fleetAttribution",
159
+ "since",
160
+ "eventLimit",
161
+ "minimumSample",
162
+ ],
163
+ },
164
+ };
140
165
  function actionCommand(action) {
141
166
  if (action.startsWith("extension-")) {
142
167
  return `extension ${action.slice("extension-".length)}`;
@@ -168,6 +193,17 @@ function aliasTarget(flag, contracts) {
168
193
  return contracts.find(({ aliases }) => aliases?.includes(flag))?.flag;
169
194
  }
170
195
  function classifyCliInput(action, contract, contracts, sdkParameters) {
196
+ const structuredParameters = ACTION_STRUCTURED_FLAG_PARAMETERS[action]?.[contract.flag];
197
+ if (structuredParameters !== undefined &&
198
+ structuredParameters.every((parameter) => sdkParameters.has(parameter))) {
199
+ return {
200
+ surface: "cli",
201
+ input: contract.flag,
202
+ counterpart: structuredParameters[0],
203
+ disposition: "shared",
204
+ reason: "The validated CLI JSON object fans out across strict SDK parameters.",
205
+ };
206
+ }
171
207
  const parameter = parameterForFlag(action, contract.flag);
172
208
  if (sdkParameters.has(parameter)) {
173
209
  return {
@@ -242,6 +278,17 @@ function classifyCliInput(action, contract, contracts, sdkParameters) {
242
278
  };
243
279
  }
244
280
  function classifySdkInput(action, parameter, cliEntries) {
281
+ const structuredCounterpart = Object.entries(ACTION_STRUCTURED_FLAG_PARAMETERS[action] ?? {}).find(([flag, parameters]) => parameters.includes(parameter) &&
282
+ cliEntries.some(({ input, disposition }) => input === flag && disposition === "shared"));
283
+ if (structuredCounterpart !== undefined) {
284
+ return {
285
+ surface: "sdk",
286
+ input: parameter,
287
+ counterpart: structuredCounterpart[0],
288
+ disposition: "shared",
289
+ reason: "The strict SDK parameter is reachable through the validated CLI JSON object.",
290
+ };
291
+ }
245
292
  const cliCounterpart = cliEntries.find(({ counterpart, disposition }) => counterpart === parameter &&
246
293
  (disposition === "shared" ||
247
294
  disposition === "compatibility_alias" ||
@@ -317,4 +364,4 @@ export function analyzeSdkCliParameterCompleteness(source = {}) {
317
364
  });
318
365
  }
319
366
  //# sourceMappingURL=completeness.js.map
320
- //# debugId=5f5b9bd3-1b92-5fb2-b649-6eb942a7a3c4
367
+ //# debugId=0c81aa87-3ffb-5837-a3fa-eae5fb70eaf1
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
8
8
  */
9
9
 
10
- !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]="01e8d488-ce63-54cc-848e-e7842a9d873d")}catch(e){}}();
10
+ !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]="8de867f9-e4d7-5c05-bae5-c3845a2280b7")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
13
13
  function normalizeFlagAliasKey(flag) {
@@ -911,6 +911,7 @@ export const STATS_FLAG_CONTRACTS = [
911
911
  { flag: "--by-tag" },
912
912
  { flag: "--by-priority" },
913
913
  { flag: "--tag-prefix" },
914
+ { flag: "--analytics" },
914
915
  ];
915
916
  /** Public contract for duplicate-cluster discovery flags. */
916
917
  export const DUPLICATES_FLAG_CONTRACTS = [
@@ -1751,4 +1752,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1751
1752
  return normalizeUniqueStringList(all).join(" ");
1752
1753
  }
1753
1754
  //# sourceMappingURL=flag-contracts.js.map
1754
- //# debugId=01e8d488-ce63-54cc-848e-e7842a9d873d
1755
+ //# debugId=8de867f9-e4d7-5c05-bae5-c3845a2280b7
@@ -4,7 +4,7 @@
4
4
  * Provides CLI runtime support for Registration 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]="e520de00-0810-5356-9290-324cf1d3c133")}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]="d44229ca-8c70-5d55-a168-32bfe66711e6")}catch(e){}}();
8
8
  import { Option } from "commander";
9
9
  import { pathExists, refreshSearchArtifactsForMutation, shouldRunSearchRefreshInForeground, EXIT_CODE, PmCliError, printError, printResult, writeStdout, getSettingsPath, resolvePmRoot, readSettings, runActiveServiceOverride, setActiveCommandResult, } from "../runtime-primitives.js";
10
10
  import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, NEXT_COMMANDER_STRING_OPTION_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, readFirstValueFromCommanderOptions, readFirstStringFromCommanderOptions, readStringArrayFromCommanderOptions, } from "../cli-contracts.js";
@@ -111,6 +111,7 @@ export function getGlobalOptions(command) {
111
111
  outputInclude: readStringCommandOption(opts, "outputInclude"),
112
112
  outputLimit: readStringCommandOption(opts, "outputLimit"),
113
113
  outputBudget: readStringCommandOption(opts, "outputBudget"),
114
+ outputSession: readStringCommandOption(opts, "outputSession"),
114
115
  ...(opts.outputFormat === "toon" || opts.outputFormat === "json"
115
116
  ? { outputFormat: opts.outputFormat }
116
117
  : {}),
@@ -969,4 +970,4 @@ export const _testOnly = {
969
970
  collectMutationItemIds,
970
971
  };
971
972
  //# sourceMappingURL=registration-helpers.js.map
972
- //# debugId=e520de00-0810-5356-9290-324cf1d3c133
973
+ //# debugId=d44229ca-8c70-5d55-a168-32bfe66711e6
@@ -4,7 +4,7 @@
4
4
  * Implements the pm contracts 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]="e6dd81d6-95d6-51e6-a0c9-ba7bb5372457")}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]="36bb127d-7a88-5e0d-8296-3d74b9ceb813")}catch(e){}}();
8
8
  import { EXIT_CODE, SETTINGS_DEFAULTS, PmCliError, activateExtensions, getActiveExtensionRegistrations, loadExtensions, pathExists, commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
9
9
  import { buildMcpToolContracts, } from "../../mcp/tool-definitions.js";
10
10
  import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_OUTPUT_DEGRADATION_STEPS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, resolvePmCommandOutputBudget, } from "../cli-contracts.js";
@@ -1744,6 +1744,15 @@ function attachCommanderAliasContractsResult(result, selection) {
1744
1744
  }
1745
1745
  result.commander_aliases_omitted_reason = "unfiltered_default_brief";
1746
1746
  }
1747
+ /** Attach the compact agent-facing command semantics shared by summary and full projections. */
1748
+ function attachAgentCommandContractsResult(result, outputCommands) {
1749
+ result.command_summaries = buildCommandSummarySurface(outputCommands);
1750
+ result.output_policy = {
1751
+ token_estimate: "ceil(utf8_bytes / 4)",
1752
+ degradation_ladder: [...PM_OUTPUT_DEGRADATION_STEPS],
1753
+ allows_unbounded_opt_out: true,
1754
+ };
1755
+ }
1747
1756
  /** Implements run contracts for the public runtime surface of this module. */
1748
1757
  export async function runContracts(options, global) {
1749
1758
  const selection = resolveContractsSelection(options);
@@ -1755,13 +1764,10 @@ export async function runContracts(options, global) {
1755
1764
  const commands = resolveContractsCommands(selection, actionContext);
1756
1765
  const outputCommands = resolveOutputCommands(selection, commands);
1757
1766
  const result = createContractsResult(selection, schemaContext, actionContext, outputCommands);
1767
+ if (selection.summary || selection.fullOutput) {
1768
+ attachAgentCommandContractsResult(result, outputCommands);
1769
+ }
1758
1770
  if (selection.summary) {
1759
- result.command_summaries = buildCommandSummarySurface(outputCommands);
1760
- result.output_policy = {
1761
- token_estimate: "ceil(utf8_bytes / 4)",
1762
- degradation_ladder: [...PM_OUTPUT_DEGRADATION_STEPS],
1763
- allows_unbounded_opt_out: true,
1764
- };
1765
1771
  return result;
1766
1772
  }
1767
1773
  const commandAliases = buildCommandAliasSurface(commands);
@@ -1821,4 +1827,4 @@ export const _testOnlyContractsCommand = {
1821
1827
  toRuntimeShortFlagToken,
1822
1828
  };
1823
1829
  //# sourceMappingURL=runtime-contracts.js.map
1824
- //# debugId=e6dd81d6-95d6-51e6-a0c9-ba7bb5372457
1830
+ //# debugId=36bb127d-7a88-5e0d-8296-3d74b9ceb813