@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
@@ -4,8 +4,9 @@
4
4
  * Defines SDK command-contract metadata for Tool Parameter Tables.
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]="4dd6e565-011f-5411-9fcb-37e94ee4cdb2")}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]="57065b65-6582-5405-bf16-698023e204bf")}catch(e){}}();
8
8
  import { PLAN_HARNESS_VALUES, PLAN_MODE_VALUES, PLAN_STEP_LINK_KIND_VALUES, PLAN_STEP_STATUS_VALUES, } from "../../types/index.js";
9
+ import { PM_READ_OUTPUT_SESSION_MAX_SEEN_ITEM_IDS } from "../read-output-session.js";
9
10
  /** Public contract for pm tool parameter properties, shared by SDK and presentation-layer consumers. */
10
11
  export const PM_TOOL_PARAMETER_PROPERTIES = {
11
12
  json: { type: "boolean", default: true },
@@ -20,6 +21,39 @@ export const PM_TOOL_PARAMETER_PROPERTIES = {
20
21
  },
21
22
  outputBudget: { type: "integer", minimum: 1 },
22
23
  outputFormat: { type: "string", enum: ["json", "toon"] },
24
+ outputSession: {
25
+ anyOf: [
26
+ { type: "string", minLength: 1 },
27
+ {
28
+ type: "object",
29
+ additionalProperties: false,
30
+ required: [
31
+ "version",
32
+ "id",
33
+ "token_budget",
34
+ "spent_tokens",
35
+ "seen_item_ids",
36
+ ],
37
+ properties: {
38
+ version: { const: 1 },
39
+ id: {
40
+ type: "string",
41
+ pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$",
42
+ },
43
+ token_budget: { type: "integer", minimum: 256 },
44
+ spent_tokens: { type: "integer", minimum: 0 },
45
+ seen_item_ids: {
46
+ type: "array",
47
+ maxItems: PM_READ_OUTPUT_SESSION_MAX_SEEN_ITEM_IDS,
48
+ items: {
49
+ type: "string",
50
+ pattern: "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
51
+ },
52
+ },
53
+ },
54
+ },
55
+ ],
56
+ },
23
57
  path: { type: "string" },
24
58
  pmExecutable: { type: "string" },
25
59
  timeoutMs: { type: "number" },
@@ -365,6 +399,21 @@ export const PM_TOOL_PARAMETER_PROPERTIES = {
365
399
  byTag: { type: "boolean" },
366
400
  byPriority: { type: "boolean" },
367
401
  tagPrefix: { type: "string" },
402
+ measurements: { type: "boolean" },
403
+ metric: { type: "string" },
404
+ measurementLimit: { type: "integer", minimum: 0, maximum: 1000 },
405
+ observe: { type: "array", items: { type: "string" } },
406
+ improvementDirection: {
407
+ type: "string",
408
+ enum: ["higher", "lower", "target"],
409
+ },
410
+ measurementSource: { type: "string" },
411
+ measurementItem: { type: "string" },
412
+ measurementRevision: { type: "string" },
413
+ provenanceCoverage: { type: "boolean" },
414
+ fleetAttribution: { type: "boolean" },
415
+ eventLimit: { type: "integer", minimum: 1, maximum: 100000 },
416
+ minimumSample: { type: "integer", minimum: 1, maximum: 10000 },
368
417
  verify: { type: "boolean" },
369
418
  literal: { type: "array", items: { type: "string" } },
370
419
  regex: { type: "array", items: { type: "string" } },
@@ -562,10 +611,7 @@ export const PM_TOOL_PARAMETER_PROPERTIES = {
562
611
  export const PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES = {
563
612
  activity: {
564
613
  harness: {
565
- anyOf: [
566
- { type: "string" },
567
- { type: "array", items: { type: "string" } },
568
- ],
614
+ anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
569
615
  },
570
616
  },
571
617
  events: {
@@ -586,10 +632,7 @@ export const PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES = {
586
632
  },
587
633
  history: {
588
634
  harness: {
589
- anyOf: [
590
- { type: "string" },
591
- { type: "array", items: { type: "string" } },
592
- ],
635
+ anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
593
636
  },
594
637
  },
595
638
  remind: {
@@ -845,6 +888,18 @@ export const PM_TOOL_PARAMETER_METADATA = {
845
888
  description: "Universal read-result encoding selector.",
846
889
  examples: ["toon", "json"],
847
890
  },
891
+ outputSession: {
892
+ description: "Caller-carried JSON session state that enforces a token ceiling across read calls and replaces repeated item facts with resolvable context references.",
893
+ examples: [
894
+ {
895
+ version: 1,
896
+ id: "orientation",
897
+ token_budget: 4000,
898
+ spent_tokens: 0,
899
+ seen_item_ids: [],
900
+ },
901
+ ],
902
+ },
848
903
  profile: {
849
904
  description: "Emit deterministic timing diagnostics to stderr.",
850
905
  },
@@ -1255,6 +1310,51 @@ export const PM_TOOL_PARAMETER_METADATA = {
1255
1310
  fieldUtilization: {
1256
1311
  description: "For stats action: include a field_utilization block reporting present/total/percent for content fields (notes, learnings, files, docs, tests, comments, deps, body, linked_command) across all items so under-documented dimensions are visible at a glance.",
1257
1312
  },
1313
+ measurements: {
1314
+ description: "For stats action: include the audited append-only improvement ledger and baseline-to-latest trends.",
1315
+ },
1316
+ metric: {
1317
+ description: "Exact improvement metric name used to filter ledger reads.",
1318
+ examples: ["quality.coverage.lines"],
1319
+ },
1320
+ measurementLimit: {
1321
+ description: "Maximum newest improvement observations returned by stats.",
1322
+ examples: [50],
1323
+ },
1324
+ observe: {
1325
+ description: "Repeatable audited observation in name=value[,unit=...][,threshold=...] form.",
1326
+ examples: [["quality.coverage.lines=100,unit=percent,threshold=100"]],
1327
+ },
1328
+ improvementDirection: {
1329
+ description: "Improvement direction for newly recorded observations.",
1330
+ examples: ["higher", "lower", "target"],
1331
+ },
1332
+ measurementSource: {
1333
+ description: "Producing gate or instrument for a new observation.",
1334
+ examples: ["pnpm coverage"],
1335
+ },
1336
+ measurementItem: {
1337
+ description: "Tracked item that owns an improvement observation.",
1338
+ examples: ["pm-123abc"],
1339
+ },
1340
+ measurementRevision: {
1341
+ description: "Explicit source revision for a new observation.",
1342
+ examples: ["0123456789abcdef"],
1343
+ },
1344
+ provenanceCoverage: {
1345
+ description: "For stats action: compare configured provenance descriptors with bounded immutable-history observations.",
1346
+ },
1347
+ fleetAttribution: {
1348
+ description: "For stats action: derive observational throughput, rework, and defect-escape rates by harness, model, and author source.",
1349
+ },
1350
+ eventLimit: {
1351
+ description: "Maximum immutable history events consumed by an analytics projection.",
1352
+ examples: [10000],
1353
+ },
1354
+ minimumSample: {
1355
+ description: "Minimum denominator before analytics rates are reported.",
1356
+ examples: [5],
1357
+ },
1258
1358
  offset: {
1259
1359
  description: "Number of matching rows to skip before limit is applied.",
1260
1360
  examples: [0, 50, "100"],
@@ -1664,6 +1764,12 @@ export const PM_TOOL_PARAMETER_METADATA = {
1664
1764
  * because its single `name` property must cover every action at once.
1665
1765
  */
1666
1766
  export const PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA = {
1767
+ stats: {
1768
+ since: {
1769
+ description: "Inclusive ISO 8601 timestamp or negative duration lower bound for provenance and fleet analytics.",
1770
+ examples: ["2026-08-01T00:00:00.000Z", "-30d"],
1771
+ },
1772
+ },
1667
1773
  events: {
1668
1774
  since: {
1669
1775
  description: "Durable event cursor returned as next_cursor, or an inclusive event timestamp.",
@@ -1788,4 +1894,4 @@ export const PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA = {
1788
1894
  },
1789
1895
  };
1790
1896
  //# sourceMappingURL=tool-parameter-tables.js.map
1791
- //# debugId=4dd6e565-011f-5411-9fcb-37e94ee4cdb2
1897
+ //# debugId=57065b65-6582-5405-bf16-698023e204bf
@@ -7,7 +7,7 @@
7
7
  * consumers from a single source of truth.
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]="b26c9bc3-e1bf-5174-a0af-296c947678da")}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]="7fd02be1-d45b-5c2c-892a-4fbf8c1d5b9a")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
13
13
  import { TOOL_CREATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, } from "./tool-option-contracts.js";
@@ -30,6 +30,7 @@ const PM_TOOL_READ_OUTPUT_PARAMETER_KEYS = [
30
30
  "outputLimit",
31
31
  "outputBudget",
32
32
  "outputFormat",
33
+ "outputSession",
33
34
  ];
34
35
  /** Canonical top-level MCP properties that take precedence over runtime custom fields. */
35
36
  export const PM_TOOL_RESERVED_CUSTOM_FIELD_PROPERTIES = new Set([
@@ -1013,6 +1014,21 @@ const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
1013
1014
  "byTag",
1014
1015
  "byPriority",
1015
1016
  "tagPrefix",
1017
+ "measurements",
1018
+ "metric",
1019
+ "measurementLimit",
1020
+ "observe",
1021
+ "improvementDirection",
1022
+ "measurementSource",
1023
+ "measurementItem",
1024
+ "measurementRevision",
1025
+ "author",
1026
+ "message",
1027
+ "provenanceCoverage",
1028
+ "fleetAttribution",
1029
+ "since",
1030
+ "eventLimit",
1031
+ "minimumSample",
1016
1032
  ],
1017
1033
  },
1018
1034
  duplicates: {
@@ -1493,4 +1509,4 @@ export const _testOnlyCliContracts = {
1493
1509
  withFlagAliasMetadata,
1494
1510
  };
1495
1511
  //# sourceMappingURL=tool-schema.js.map
1496
- //# debugId=b26c9bc3-e1bf-5174-a0af-296c947678da
1512
+ //# debugId=7fd02be1-d45b-5c2c-892a-4fbf8c1d5b9a
@@ -4,7 +4,7 @@
4
4
  * Builds the reusable Commander root that embeds pm's universal global contracts.
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]="26c939a0-e02d-5998-95e3-a4c26c3b47bd")}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]="a410d336-c332-56fc-9a5d-7841a2b3dfa5")}catch(e){}}();
8
8
  import { Command } from "commander";
9
9
  import { writeStdout } from "../core/output/output.js";
10
10
  /** Create a fresh pm root program suitable for one-shot CLI or embedded hosts. */
@@ -29,6 +29,7 @@ export function createPmCliProgram(version) {
29
29
  .option("--output-limit <count>", "Bound rows in read output")
30
30
  .option("--output-budget <tokens>", "Bound estimated tokens in read output")
31
31
  .option("--output-format <toon|json>", "Select the read-output encoding")
32
+ .option("--output-session <state>", "Carry a JSON session budget and served-item ledger across read calls")
32
33
  .option("--quiet", "Suppress stdout output")
33
34
  .option("--no-changed-fields", "Omit the changed_fields array from mutation output (keeps changed_field_count)")
34
35
  .option("--full-changed-fields", "Restore the legacy full mutation envelope and changed_fields array")
@@ -43,4 +44,4 @@ export function createPmCliProgram(version) {
43
44
  .exitOverride();
44
45
  }
45
46
  //# sourceMappingURL=cli-program.js.map
46
- //# debugId=26c939a0-e02d-5998-95e3-a4c26c3b47bd
47
+ //# debugId=a410d336-c332-56fc-9a5d-7841a2b3dfa5
@@ -4,7 +4,7 @@
4
4
  * Implements the pm completion 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]="bba460dd-91d7-5444-b754-58c684a425fd")}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]="8acb405a-140e-532c-81c0-e8153ea30dc0")}catch(e){}}();
8
8
  import { EXIT_CODE, PmCliError } from "./runtime-primitives.js";
9
9
  import { listPmCommandsForTier } from "./agent-capability-contracts.js";
10
10
  import { SCAFFOLD_CAPABILITIES } from "./extension/scaffold.js";
@@ -787,6 +787,7 @@ _pm() {
787
787
  '--output-limit[Set the universal read row ceiling]:limit' \\
788
788
  '--output-budget[Set the universal estimated-token ceiling]:tokens' \\
789
789
  '--output-format[Select the universal read encoding]:(toon json)' \\
790
+ '--output-session[Carry cross-call read budget and served-item state]:state' \\
790
791
  '--no-changed-fields[Omit changed_fields array from mutation output]' \\
791
792
  '--pm-path[Explicit tracker storage path for this command]:path:_files -/' \\
792
793
  '--path[Compatibility alias for --pm-path]:path:_files -/' \\
@@ -1811,6 +1812,7 @@ complete -c pm -l output-include -d 'Retain comma-separated read fields or secti
1811
1812
  complete -c pm -l output-limit -d 'Set the universal read row ceiling' -r
1812
1813
  complete -c pm -l output-budget -d 'Set the universal estimated-token ceiling' -r
1813
1814
  complete -c pm -l output-format -d 'Select the universal read encoding' -r -a 'toon json'
1815
+ complete -c pm -l output-session -d 'Carry cross-call read budget and served-item state' -r
1814
1816
  complete -c pm -l no-changed-fields -d 'Omit changed_fields array from mutation output'
1815
1817
  complete -c pm -l id-only -d 'Print only id and status for single-item mutation output'
1816
1818
  complete -c pm -l pm-path -d 'Explicit tracker storage path for this command' -r
@@ -2484,6 +2486,7 @@ complete -c pm -n '__fish_seen_subcommand_from stats' -l by-assignee -d 'Lifecyc
2484
2486
  complete -c pm -n '__fish_seen_subcommand_from stats' -l by-tag -d 'Lifecycle-bucketed breakdown grouped by tag'
2485
2487
  complete -c pm -n '__fish_seen_subcommand_from stats' -l by-priority -d 'Lifecycle-bucketed breakdown grouped by priority'
2486
2488
  complete -c pm -n '__fish_seen_subcommand_from stats' -l tag-prefix -d 'With --by-tag: only count tags with this prefix' -r
2489
+ complete -c pm -n '__fish_seen_subcommand_from stats' -l analytics -d 'Improvement ledger/history analytics JSON' -r
2487
2490
 
2488
2491
  # append flags
2489
2492
  complete -c pm -n '__fish_seen_subcommand_from append' -s b -l body -d 'Item body' -r
@@ -2740,4 +2743,4 @@ export function runCompletion(shell, itemTypes = [], tags = [], eagerTagExpansio
2740
2743
  };
2741
2744
  }
2742
2745
  //# sourceMappingURL=completion.js.map
2743
- //# debugId=bba460dd-91d7-5444-b754-58c684a425fd
2746
+ //# debugId=8acb405a-140e-532c-81c0-e8153ea30dc0
@@ -11,3 +11,4 @@ export * from "./flag-invocation-contracts.js";
11
11
  export * from "./output-token-accounting.js";
12
12
  export * from "./output-contracts.js";
13
13
  export * from "./read-output-contracts.js";
14
+ export type { PmReadOutputSessionReceipt, PmReadOutputSessionState, } from "./read-output-session.js";
@@ -4,7 +4,7 @@
4
4
  * Exposes command and action contract data without loading SDK runtime code.
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]="2962656f-386f-59a0-8dc1-411ae382dddb")}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]="8c442738-13e6-5bf5-b60d-1439c3255f1a")}catch(e){}}();
8
8
  export * from "./cli-contracts.js";
9
9
  export * from "./context-intent-contracts.js";
10
10
  export * from "./error-code-catalog.js";
@@ -14,4 +14,4 @@ export * from "./output-token-accounting.js";
14
14
  export * from "./output-contracts.js";
15
15
  export * from "./read-output-contracts.js";
16
16
  //# sourceMappingURL=contracts.js.map
17
- //# debugId=2962656f-386f-59a0-8dc1-411ae382dddb
17
+ //# debugId=8c442738-13e6-5bf5-b60d-1439c3255f1a
@@ -6,6 +6,8 @@
6
6
  export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, canonicalDocument, classifyItemFormatVersion, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, isPmCliExpectedError, normalizeItemFormatVersion, normalizeItemId, normalizeStatusInput, nowIso, runAction, serializeItemDocument, aggregate, append, claim, claimNext, close, comments, context, copy, create, deleteItem, deps, docs, files, filesDiscover, focus, get, graph, learnings, list, next, notes, release, restore, search, update, type AggregateOptions, type AggregateResult, type AggregateRow, type AppendCommandOptions, type AppendResult, type ClaimNextOptions, type ClaimResult, type CloseResult, type CommentsCommandOptions, type CommentsResult, type ContextOptions, type ContextResult, type CopyResult, type CreateResult, type Dependency, type DeleteResult, type DepsCommandOptions, type DepsResult, type DocsCommandOptions, type DocsResult, type FilesCommandOptions, type FilesDiscoverOptions, type FilesDiscoverResult, type FilesResult, type FocusResult, type GetOptions, type GetResult, type ItemFormatVersionScanEntry, type ItemFormatVersionScanResult, type ItemFormatVersionStatus, type LearningsCommandOptions, type LearningsResult, type ListOptions, type ListResult, type NextOptions, type NextResult, type NotesCommandOptions, type NotesResult, type PmActionInput, type PmActionName, type PmActionOptions, type PmClientOptions, type ReleaseResult, type RestoreResult, type SearchOptions, type SearchResult, type UpdateResult, } from "./runtime.js";
7
7
  export * from "./core-governance.js";
8
8
  export * from "./agent-session-context.js";
9
- export { PM_READ_OUTPUT_DIMENSIONS, PM_READ_OUTPUT_OPTION_FLAGS, PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputDimensions, isReadOutputBudgetExceeded, resolveReadOutputDimensions, resolveReadOutputEncoding, resolveReadOutputSurface, validateReadOutputOptions, } from "./read-output-contracts.js";
9
+ export { PM_READ_OUTPUT_DIMENSIONS, PM_READ_OUTPUT_OPTION_FLAGS, PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS, PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputDimensions, isReadOutputBudgetExceeded, resolveReadOutputDimensions, resolveReadOutputEncoding, resolveReadOutputSurface, validateReadOutputOptions, } from "./read-output-contracts.js";
10
+ export { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
10
11
  export type { PmReadOutputBudgetExceeded, PmReadOutputDimension, PmReadOutputLegacyAlias, PmReadOutputOptions, PmReadOutputReceipt, PmReadOutputResult, PmReadOutputResultFor, PmReadOutputSurface, PmReadOutputSurfaceContract, } from "./read-output-contracts.js";
12
+ export type { PmReadOutputSessionReceipt, PmReadOutputSessionReference, PmReadOutputSessionState, } from "./read-output-session.js";
11
13
  export type { ItemDocument, ItemMetadata, ItemStatus, ItemType, PmSettings, } from "../types/index.js";
package/dist/sdk/core.js CHANGED
@@ -4,10 +4,11 @@
4
4
  * Provides the stable item lifecycle client and universal project data types.
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]="d70db3d9-b094-52fd-8f0f-47eed9f6e7f0")}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]="54d31df7-e708-585d-9fb2-3c5ddfcc6138")}catch(e){}}();
8
8
  export { BASELINE_ITEM_FORMAT_VERSION, BUILTIN_ITEM_TYPE_VALUES, CONFIDENCE_TEXT_VALUES, CURRENT_ITEM_FORMAT_VERSION, DEPENDENCY_KIND_VALUES, EXIT_CODE, ISSUE_SEVERITY_VALUES, ITEM_TYPE_VALUES, PM_CLI_EXPECTED_ERROR_NAME, PmCliError, PmClient, RISK_VALUES, STATUS_VALUES, canonicalDocument, classifyItemFormatVersion, createPmCliExpectedError, effectiveItemFormatVersion, emptyImportedDocument, isPmCliExpectedError, normalizeItemFormatVersion, normalizeItemId, normalizeStatusInput, nowIso, runAction, serializeItemDocument, aggregate, append, claim, claimNext, close, comments, context, copy, create, deleteItem, deps, docs, files, filesDiscover, focus, get, graph, learnings, list, next, notes, release, restore, search, update, } from "./runtime.js";
9
9
  export * from "./core-governance.js";
10
10
  export * from "./agent-session-context.js";
11
- export { PM_READ_OUTPUT_DIMENSIONS, PM_READ_OUTPUT_OPTION_FLAGS, PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputDimensions, isReadOutputBudgetExceeded, resolveReadOutputDimensions, resolveReadOutputEncoding, resolveReadOutputSurface, validateReadOutputOptions, } from "./read-output-contracts.js";
11
+ export { PM_READ_OUTPUT_DIMENSIONS, PM_READ_OUTPUT_OPTION_FLAGS, PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS, PM_READ_OUTPUT_SURFACE_CONTRACTS, applyReadOutputDimensions, isReadOutputBudgetExceeded, resolveReadOutputDimensions, resolveReadOutputEncoding, resolveReadOutputSurface, validateReadOutputOptions, } from "./read-output-contracts.js";
12
+ export { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
12
13
  //# sourceMappingURL=core.js.map
13
- //# debugId=d70db3d9-b094-52fd-8f0f-47eed9f6e7f0
14
+ //# debugId=54d31df7-e708-585d-9fb2-3c5ddfcc6138
@@ -4,9 +4,8 @@
4
4
  * Implements the pm extension 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]="f4f1a871-b632-5263-aec0-cb00bcdbe1b3")}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]="f4b47053-cc05-51f2-b5cb-cc6dba3365c2")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
- import os from "node:os";
10
9
  import path from "node:path";
11
10
  import { activateExtensions, createSerialQueue, loadExtensions, nextExtensionReloadToken, } from "../core/extensions/index.js";
12
11
  import { describeExtensionActivation } from "../core/extensions/activation-summary.js";
@@ -643,10 +642,10 @@ const resolveInstallRuntimeActivationStatus = (extensionName, scope, runtimeInst
643
642
  (installActivationFailure ? "failed" : "unknown"));
644
643
  };
645
644
  /** Probe a temporary installed extension for runtime command registrations. */
646
- const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled, global) => {
645
+ const probeRuntimeCommandPathsForInstall = (pmRoot, parent, settings, refreshedInstalled, global) => {
647
646
  return extensionRuntimeProbeQueue.enqueue(async () => {
648
647
  const originalPackageRoot = process.env.PM_CLI_PACKAGE_ROOT;
649
- const moduleGraphSnapshotRoot = await fs.mkdtemp(path.join(os.tmpdir(), "pm-extension-module-graph-"));
648
+ const snapshotRoot = await fs.mkdtemp(path.join(parent, ".pm-module-graph-"));
650
649
  process.env.PM_CLI_PACKAGE_ROOT = resolvePmPackageRootFromModule(import.meta.url, ["../.."]);
651
650
  try {
652
651
  const loadResult = await loadExtensions({
@@ -656,11 +655,10 @@ const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled
656
655
  noExtensions: global.noExtensions === true,
657
656
  reload_token: nextExtensionReloadToken(),
658
657
  cache_bust: true,
659
- module_graph_snapshot_root: moduleGraphSnapshotRoot,
658
+ module_graph_snapshot_root: snapshotRoot,
660
659
  });
661
660
  const activationResult = await activateExtensions({
662
661
  ...loadResult,
663
- loaded: loadResult.loaded,
664
662
  });
665
663
  const runtimeFailures = [
666
664
  ...loadResult.failed.map((failure) => ({
@@ -687,7 +685,7 @@ const probeRuntimeCommandPathsForInstall = (pmRoot, settings, refreshedInstalled
687
685
  };
688
686
  }
689
687
  finally {
690
- await fs.rm(moduleGraphSnapshotRoot, { recursive: true, force: true });
688
+ await fs.rm(snapshotRoot, { recursive: true, force: true });
691
689
  if (originalPackageRoot === undefined) {
692
690
  delete process.env.PM_CLI_PACKAGE_ROOT;
693
691
  }
@@ -1275,7 +1273,7 @@ const buildInstalledExtensionActivation = (ctx, extensionName, runtimeProbe, com
1275
1273
  registered_commands: commandSummary.command_paths,
1276
1274
  registered_actions: commandSummary.action_paths,
1277
1275
  registered_item_types: installedItemTypes,
1278
- module_graph_verification: "fresh_snapshot",
1276
+ module_graph_verification: "fresh_in_topology_snapshot",
1279
1277
  health: healthByActivation[String(activated)],
1280
1278
  },
1281
1279
  };
@@ -1287,7 +1285,7 @@ const performExtensionInstallUnderLock = async (ctx, input) => {
1287
1285
  const persisted = await persistExtensionInstall(ctx, input);
1288
1286
  const refreshedInstalled = await listInstalledExtensions(resolvedRoots.selected_root, scope, persisted.settings, persisted.managedState);
1289
1287
  warnings.push(...refreshedInstalled.warnings);
1290
- const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, persisted.settings, refreshedInstalled.extensions, global);
1288
+ const runtimeProbe = await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, path.dirname(resolvedRoots.selected_root), persisted.settings, refreshedInstalled.extensions, global);
1291
1289
  warnings.push(...runtimeProbe.warnings);
1292
1290
  // Scaffold the folders for any item types the installed package contributes
1293
1291
  // so the tracker is immediately healthy — matching `pm schema add-type` and
@@ -1636,7 +1634,7 @@ const runExtensionActivateDeactivateAction = async (ctx) => {
1636
1634
  await writeSettings(resolvedRoots.settings_root, settings, "settings:write");
1637
1635
  }
1638
1636
  const activationFailure = action === "activate"
1639
- ? await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, settings, [candidate], global).then((probe) => {
1637
+ ? await probeRuntimeCommandPathsForInstall(resolvedRoots.pm_root, path.dirname(resolvedRoots.selected_root), settings, [candidate], global).then((probe) => {
1640
1638
  warnings.push(...probe.warnings);
1641
1639
  return findActivationFailureByName(candidate.name, probe.activation_failures, ctx.scope);
1642
1640
  })
@@ -2192,4 +2190,4 @@ export const _testOnly = {
2192
2190
  withExtensionInstallLock,
2193
2191
  };
2194
2192
  //# sourceMappingURL=extension.js.map
2195
- //# debugId=f4f1a871-b632-5263-aec0-cb00bcdbe1b3
2193
+ //# debugId=f4b47053-cc05-51f2-b5cb-cc6dba3365c2
@@ -4,7 +4,7 @@
4
4
  * Generated by scripts/generate-error-code-catalog.mjs. Do not edit manually.
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]="7a568064-a103-5b19-969d-6e58fc0cc5b7")}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]="93c784d2-8f0f-5bf4-875e-3d83a675c9eb")}catch(e){}}();
8
8
  import { definePmErrorCodeCatalog } from "./error-code-catalog.js";
9
9
  /** Exhaustive catalog generated from literal error guidance declarations. */
10
10
  export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
@@ -668,6 +668,26 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
668
668
  sources: ["core/diagnostics/remediation.ts"],
669
669
  emitting_commands: ["*"],
670
670
  },
671
+ {
672
+ code: "improvement_metric_contract_conflict",
673
+ meaning: "Improvement metric contract conflict condition.",
674
+ stability: "provisional",
675
+ exit_code: 4,
676
+ class: "conflict",
677
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
678
+ sources: ["sdk/improvement-ledger.ts"],
679
+ emitting_commands: ["*"],
680
+ },
681
+ {
682
+ code: "improvement_observation_conflict",
683
+ meaning: "Improvement observation conflict condition.",
684
+ stability: "provisional",
685
+ exit_code: 4,
686
+ class: "conflict",
687
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
688
+ sources: ["sdk/improvement-ledger.ts"],
689
+ emitting_commands: ["*"],
690
+ },
671
691
  {
672
692
  code: "init_existing_settings_requires_force",
673
693
  meaning: "Init existing settings requires force condition.",
@@ -853,6 +873,86 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
853
873
  sources: ["sdk/mutation-events.ts"],
854
874
  emitting_commands: ["*"],
855
875
  },
876
+ {
877
+ code: "invalid_history_analytics_limit",
878
+ meaning: "Invalid history analytics limit condition.",
879
+ stability: "provisional",
880
+ exit_code: 2,
881
+ class: "usage",
882
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
883
+ sources: ["sdk/history-analytics.ts"],
884
+ emitting_commands: ["*"],
885
+ },
886
+ {
887
+ code: "invalid_history_analytics_minimum_sample",
888
+ meaning: "Invalid history analytics minimum sample condition.",
889
+ stability: "provisional",
890
+ exit_code: 2,
891
+ class: "usage",
892
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
893
+ sources: ["sdk/history-analytics.ts"],
894
+ emitting_commands: ["*"],
895
+ },
896
+ {
897
+ code: "invalid_history_analytics_since",
898
+ meaning: "Invalid history analytics since condition.",
899
+ stability: "provisional",
900
+ exit_code: 2,
901
+ class: "usage",
902
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
903
+ sources: ["sdk/history-analytics.ts"],
904
+ emitting_commands: ["*"],
905
+ },
906
+ {
907
+ code: "invalid_improvement_ledger",
908
+ meaning: "Invalid improvement ledger condition.",
909
+ stability: "provisional",
910
+ exit_code: 1,
911
+ class: "generic_failure",
912
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
913
+ sources: ["sdk/improvement-ledger-validation.ts"],
914
+ emitting_commands: ["*"],
915
+ },
916
+ {
917
+ code: "invalid_improvement_metric",
918
+ meaning: "Invalid improvement metric condition.",
919
+ stability: "provisional",
920
+ exit_code: 2,
921
+ class: "usage",
922
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
923
+ sources: ["sdk/improvement-ledger.ts"],
924
+ emitting_commands: ["*"],
925
+ },
926
+ {
927
+ code: "invalid_improvement_observation",
928
+ meaning: "Invalid improvement observation condition.",
929
+ stability: "provisional",
930
+ exit_code: 2,
931
+ class: "usage",
932
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
933
+ sources: ["sdk/improvement-ledger.ts"],
934
+ emitting_commands: ["*"],
935
+ },
936
+ {
937
+ code: "invalid_improvement_observation_limit",
938
+ meaning: "Invalid improvement observation limit condition.",
939
+ stability: "provisional",
940
+ exit_code: 2,
941
+ class: "usage",
942
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
943
+ sources: ["sdk/improvement-ledger.ts"],
944
+ emitting_commands: ["*"],
945
+ },
946
+ {
947
+ code: "invalid_improvement_observation_timestamp",
948
+ meaning: "Invalid improvement observation timestamp condition.",
949
+ stability: "provisional",
950
+ exit_code: 2,
951
+ class: "usage",
952
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
953
+ sources: ["sdk/improvement-ledger.ts"],
954
+ emitting_commands: ["*"],
955
+ },
856
956
  {
857
957
  code: "invalid_provenance_predicate",
858
958
  meaning: "Invalid provenance predicate condition.",
@@ -873,6 +973,16 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
873
973
  sources: ["sdk/pagination.ts"],
874
974
  emitting_commands: ["*"],
875
975
  },
976
+ {
977
+ code: "invalid_read_output_session",
978
+ meaning: "Invalid read output session condition.",
979
+ stability: "provisional",
980
+ exit_code: 2,
981
+ class: "usage",
982
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
983
+ sources: ["sdk/read-output-session.ts"],
984
+ emitting_commands: ["*"],
985
+ },
876
986
  {
877
987
  code: "invalid_workspace_snapshot_target",
878
988
  meaning: "Invalid workspace snapshot target condition.",
@@ -2285,4 +2395,4 @@ export const PM_ERROR_CODE_CATALOG = definePmErrorCodeCatalog([
2285
2395
  },
2286
2396
  ]);
2287
2397
  //# sourceMappingURL=generated-error-code-catalog.js.map
2288
- //# debugId=7a568064-a103-5b19-969d-6e58fc0cc5b7
2398
+ //# debugId=93c784d2-8f0f-5bf4-875e-3d83a675c9eb