@unbrained/pm-cli 2026.8.6 → 2026.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +65 -0
  3. package/dist/cli/main.js +6 -3
  4. package/dist/cli/register-annotations.d.ts +11 -0
  5. package/dist/cli/register-annotations.js +195 -0
  6. package/dist/cli/register-history-author.js +7 -30
  7. package/dist/cli/register-mutation.js +25 -206
  8. package/dist/cli/register-operations.js +11 -2
  9. package/dist/cli/runtime-compatibility-boundary.d.ts +17 -0
  10. package/dist/cli/runtime-compatibility-boundary.js +43 -0
  11. package/dist/cli/stats-analytics-json.d.ts +9 -0
  12. package/dist/cli/stats-analytics-json.js +69 -0
  13. package/dist/cli-bundle/bundle-manifest.json +156 -692
  14. package/dist/cli-bundle/chunks/chunk-2ZMXX3Q6.js +2068 -0
  15. package/dist/cli-bundle/chunks/chunk-ALDHXLPS.js +3 -0
  16. package/dist/cli-bundle/chunks/chunk-CBLA33YK.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +5 -0
  18. package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +2 -0
  19. package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +26 -0
  20. package/dist/cli-bundle/chunks/chunk-NUXRRNAB.js +77 -0
  21. package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +13 -0
  22. package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +194 -0
  23. package/dist/cli-bundle/chunks/chunk-QWRRFYK3.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-SQ7QZFQ6.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-list-query-QH7ONPKU.js → register-list-query-WFZAMJHZ.js} +8 -8
  26. package/dist/cli-bundle/chunks/register-mutation-SOKKOTHQ.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-5XQETS6E.js +2 -0
  28. package/dist/cli-bundle/chunks/register-setup-2HL5ZHMK.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-N7QN3NE6.js → chunk-5FLBTZJQ.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-YLPZHWX7.js → chunk-ANTMGYLI.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +14 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-EYO4F74Z.js → chunk-DMKOMTTY.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-GSW2Y7VZ.js → chunk-F5B3HBEZ.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-27DK4A5O.js → chunk-FI6DWU2M.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-CL3NB7VW.js → chunk-FNOKJG6N.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-EAXXF2HW.js → chunk-FPDYXZBK.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-XNVXIQ4B.js → chunk-GWI6YIKJ.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-6KDHXURF.js → chunk-HCUC62AB.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/{chunk-GEYU23YS.js → chunk-HGNKPSCB.js} +22 -22
  42. package/dist/cli-bundle/focused-chunks/chunk-IAS7PMLG.js +2 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-TQMFQYXR.js → chunk-PL2EYDJK.js} +29 -29
  44. package/dist/cli-bundle/focused-chunks/chunk-SM2PJGP3.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-4JC3AOGS.js → chunk-TCSAPH33.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-U646T7Z6.js +18 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-YKPE4PPY.js +2 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-GIERI4YU.js → chunk-YSAHYUXX.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-ZOLDTUU7.js +2 -0
  50. package/dist/cli-bundle/main.js +13 -13
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +38 -37
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +1 -1
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +2 -1
  61. package/dist/cli.js +14 -4
  62. package/dist/core/extensions/reserved-host-flags.js +3 -2
  63. package/dist/core/history/workspace-history.d.ts +22 -2
  64. package/dist/core/history/workspace-history.js +60 -36
  65. package/dist/core/output/output.d.ts +2 -0
  66. package/dist/core/output/output.js +10 -2
  67. package/dist/core/sentry/helpers.d.ts +10 -0
  68. package/dist/core/sentry/helpers.js +59 -4
  69. package/dist/core/shared/command-types.d.ts +2 -0
  70. package/dist/core/shared/command-types.js +2 -2
  71. package/dist/core/shared/constants.d.ts +2 -0
  72. package/dist/core/shared/constants.js +4 -2
  73. package/dist/mcp/tool-definitions.js +6 -2
  74. package/dist/sdk/annotations.d.ts +40 -0
  75. package/dist/sdk/annotations.js +61 -9
  76. package/dist/sdk/author-attribution.d.ts +12 -0
  77. package/dist/sdk/author-attribution.js +87 -9
  78. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  79. package/dist/sdk/cli-bootstrap.js +7 -2
  80. package/dist/sdk/cli-contracts/command-exit-contracts.d.ts +118 -0
  81. package/dist/sdk/cli-contracts/command-exit-contracts.js +152 -0
  82. package/dist/sdk/cli-contracts/completeness.js +54 -5
  83. package/dist/sdk/cli-contracts/flag-contracts.js +6 -2
  84. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  85. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -0
  86. package/dist/sdk/cli-contracts/runtime-contracts.js +41 -8
  87. package/dist/sdk/cli-contracts/tool-parameter-tables.js +129 -10
  88. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  89. package/dist/sdk/cli-contracts/tool-schema.js +22 -3
  90. package/dist/sdk/cli-program.js +3 -2
  91. package/dist/sdk/comments.d.ts +7 -0
  92. package/dist/sdk/comments.js +2 -2
  93. package/dist/sdk/completion.js +12 -5
  94. package/dist/sdk/contracts.d.ts +2 -0
  95. package/dist/sdk/contracts.js +3 -2
  96. package/dist/sdk/core.d.ts +3 -1
  97. package/dist/sdk/core.js +4 -3
  98. package/dist/sdk/environment/host-environment-errors.d.ts +27 -0
  99. package/dist/sdk/environment/host-environment-errors.js +124 -0
  100. package/dist/sdk/environment/project-runtime-compatibility.d.ts +65 -0
  101. package/dist/sdk/environment/project-runtime-compatibility.js +385 -0
  102. package/dist/sdk/environment/source-context.d.ts +23 -0
  103. package/dist/sdk/environment/source-context.js +29 -0
  104. package/dist/sdk/error-code-catalog.d.ts +6 -0
  105. package/dist/sdk/error-code-catalog.js +62 -8
  106. package/dist/sdk/extension.js +9 -11
  107. package/dist/sdk/generated-error-code-catalog.js +739 -3
  108. package/dist/sdk/governance/health.d.ts +11 -3
  109. package/dist/sdk/governance/health.js +5 -5
  110. package/dist/sdk/history-analytics.d.ts +141 -0
  111. package/dist/sdk/history-analytics.js +283 -0
  112. package/dist/sdk/improvement-ledger-validation.d.ts +3 -0
  113. package/dist/sdk/improvement-ledger-validation.js +63 -0
  114. package/dist/sdk/improvement-ledger.d.ts +139 -0
  115. package/dist/sdk/improvement-ledger.js +261 -0
  116. package/dist/sdk/index.d.ts +13 -5
  117. package/dist/sdk/index.js +15 -7
  118. package/dist/sdk/learnings.d.ts +15 -0
  119. package/dist/sdk/learnings.js +2 -2
  120. package/dist/sdk/lifecycle/close-many.d.ts +6 -1
  121. package/dist/sdk/lifecycle/close-many.js +43 -5
  122. package/dist/sdk/lifecycle/plan.js +6 -3
  123. package/dist/sdk/lifecycle/update-many.d.ts +2 -1
  124. package/dist/sdk/lifecycle/update-many.js +29 -5
  125. package/dist/sdk/merge/index.d.ts +1 -1
  126. package/dist/sdk/merge/index.js +3 -3
  127. package/dist/sdk/merge/install.d.ts +21 -0
  128. package/dist/sdk/merge/install.js +58 -20
  129. package/dist/sdk/notes.d.ts +7 -0
  130. package/dist/sdk/notes.js +2 -2
  131. package/dist/sdk/read-output-budget.js +24 -22
  132. package/dist/sdk/read-output-contracts.d.ts +10 -2
  133. package/dist/sdk/read-output-contracts.js +204 -66
  134. package/dist/sdk/read-output-rows.d.ts +29 -0
  135. package/dist/sdk/read-output-rows.js +100 -0
  136. package/dist/sdk/read-output-session.d.ts +69 -0
  137. package/dist/sdk/read-output-session.js +200 -0
  138. package/dist/sdk/runtime-input.d.ts +2 -0
  139. package/dist/sdk/runtime-input.js +14 -2
  140. package/dist/sdk/runtime-primitives.d.ts +1 -1
  141. package/dist/sdk/runtime-primitives.js +3 -3
  142. package/dist/sdk/runtime-stats-options.d.ts +9 -0
  143. package/dist/sdk/runtime-stats-options.js +38 -0
  144. package/dist/sdk/runtime.d.ts +1 -0
  145. package/dist/sdk/runtime.js +13 -50
  146. package/dist/sdk/stats.d.ts +40 -0
  147. package/dist/sdk/stats.js +112 -29
  148. package/dist/sdk/test/execution.js +4 -2
  149. package/dist/sdk/test/parsers.js +5 -2
  150. package/dist/sdk/workspace-snapshot.d.ts +9 -0
  151. package/dist/sdk/workspace-snapshot.js +48 -16
  152. package/docs/AGENT_RUNTIME_PRIMITIVES.md +11 -4
  153. package/docs/IMPROVEMENT_ANALYTICS.md +103 -0
  154. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +5 -5
  155. package/docs/README.md +2 -0
  156. package/docs/READ_OUTPUT_CONTRACTS.md +60 -1
  157. package/docs/RELEASING.md +27 -2
  158. package/docs/SCRIPTING.md +27 -1
  159. package/docs/SDK_CONTEXT_INTEGRITY.md +66 -0
  160. package/docs/SDK_RUNTIME_BOUNDARIES.md +58 -0
  161. package/docs/SELF_DESCRIBING_CONTEXT_CONTRACTS.md +13 -0
  162. package/docs/TESTING.md +17 -0
  163. package/marketplace.json +2 -2
  164. package/package.json +6 -4
  165. package/packages/pm-beads/package.json +1 -1
  166. package/packages/pm-calendar/package.json +1 -1
  167. package/packages/pm-command-kit/package.json +1 -1
  168. package/packages/pm-digital-twin/package.json +1 -1
  169. package/packages/pm-governance-audit/package.json +1 -1
  170. package/packages/pm-guide-shell/package.json +1 -1
  171. package/packages/pm-kanban/package.json +1 -1
  172. package/packages/pm-lifecycle-hooks/package.json +1 -1
  173. package/packages/pm-linked-test-adapters/package.json +1 -1
  174. package/packages/pm-search-advanced/package.json +1 -1
  175. package/packages/pm-templates/package.json +1 -1
  176. package/packages/pm-todos/package.json +1 -1
  177. package/packages/pm-vcs/package.json +1 -1
  178. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  179. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  180. package/sdk/public-surface.json +875 -827
  181. package/dist/cli-bundle/chunks/append-XAJ5Z4XS.js +0 -2
  182. package/dist/cli-bundle/chunks/chunk-343QETLI.js +0 -2
  183. package/dist/cli-bundle/chunks/chunk-3KFVGGRE.js +0 -2
  184. package/dist/cli-bundle/chunks/chunk-3ZJRFYY2.js +0 -23
  185. package/dist/cli-bundle/chunks/chunk-4AVFKHHC.js +0 -2
  186. package/dist/cli-bundle/chunks/chunk-4OVGQW22.js +0 -2
  187. package/dist/cli-bundle/chunks/chunk-5PBP2ZP3.js +0 -2
  188. package/dist/cli-bundle/chunks/chunk-5ZKQPA44.js +0 -2
  189. package/dist/cli-bundle/chunks/chunk-A3XQ7VPU.js +0 -2
  190. package/dist/cli-bundle/chunks/chunk-A6KGKEWT.js +0 -2
  191. package/dist/cli-bundle/chunks/chunk-AJE3AHPD.js +0 -8
  192. package/dist/cli-bundle/chunks/chunk-AOBDLU4T.js +0 -2
  193. package/dist/cli-bundle/chunks/chunk-AYRUGRNS.js +0 -3
  194. package/dist/cli-bundle/chunks/chunk-BP6EMEDP.js +0 -5
  195. package/dist/cli-bundle/chunks/chunk-BXCSXK4J.js +0 -2
  196. package/dist/cli-bundle/chunks/chunk-C3YABSJK.js +0 -2
  197. package/dist/cli-bundle/chunks/chunk-CA3BURYF.js +0 -2
  198. package/dist/cli-bundle/chunks/chunk-CHOQ2VAW.js +0 -2
  199. package/dist/cli-bundle/chunks/chunk-D7I3TUGV.js +0 -2
  200. package/dist/cli-bundle/chunks/chunk-DQGJ2RWT.js +0 -3
  201. package/dist/cli-bundle/chunks/chunk-DWOAOZHZ.js +0 -2
  202. package/dist/cli-bundle/chunks/chunk-E2ZSLTOP.js +0 -2
  203. package/dist/cli-bundle/chunks/chunk-E7BFPLUZ.js +0 -5
  204. package/dist/cli-bundle/chunks/chunk-F4NREH3G.js +0 -2
  205. package/dist/cli-bundle/chunks/chunk-FB7G2HY2.js +0 -2
  206. package/dist/cli-bundle/chunks/chunk-FDBRXV25.js +0 -2
  207. package/dist/cli-bundle/chunks/chunk-GU3TSEHD.js +0 -2
  208. package/dist/cli-bundle/chunks/chunk-HS7OVAUN.js +0 -164
  209. package/dist/cli-bundle/chunks/chunk-JC6FKIFM.js +0 -2
  210. package/dist/cli-bundle/chunks/chunk-JFZIS6JF.js +0 -2
  211. package/dist/cli-bundle/chunks/chunk-JQ4NZ5EB.js +0 -2
  212. package/dist/cli-bundle/chunks/chunk-L6LGKJX3.js +0 -2
  213. package/dist/cli-bundle/chunks/chunk-LEPJJ6QC.js +0 -2
  214. package/dist/cli-bundle/chunks/chunk-M357ZCOR.js +0 -2
  215. package/dist/cli-bundle/chunks/chunk-M4VEE3FK.js +0 -2
  216. package/dist/cli-bundle/chunks/chunk-MCS73BKB.js +0 -3
  217. package/dist/cli-bundle/chunks/chunk-MDTH7SAE.js +0 -19
  218. package/dist/cli-bundle/chunks/chunk-NE5VRDAI.js +0 -2
  219. package/dist/cli-bundle/chunks/chunk-OXY3SJ3N.js +0 -2
  220. package/dist/cli-bundle/chunks/chunk-PECV7L5T.js +0 -2
  221. package/dist/cli-bundle/chunks/chunk-Q3VOP62W.js +0 -2
  222. package/dist/cli-bundle/chunks/chunk-QJ7C3JIW.js +0 -2
  223. package/dist/cli-bundle/chunks/chunk-R6LSRGPS.js +0 -8
  224. package/dist/cli-bundle/chunks/chunk-R6RKEYYW.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-RAFUN7IX.js +0 -2005
  226. package/dist/cli-bundle/chunks/chunk-RSIC5OPE.js +0 -2
  227. package/dist/cli-bundle/chunks/chunk-RUAU5OSH.js +0 -2
  228. package/dist/cli-bundle/chunks/chunk-SD3YXU2U.js +0 -56
  229. package/dist/cli-bundle/chunks/chunk-SV3YQ4RY.js +0 -2
  230. package/dist/cli-bundle/chunks/chunk-SVV3DQES.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-SXECIECW.js +0 -5
  232. package/dist/cli-bundle/chunks/chunk-T45OHXDW.js +0 -8
  233. package/dist/cli-bundle/chunks/chunk-TPKDJ5WL.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-UVVXHGYS.js +0 -3
  235. package/dist/cli-bundle/chunks/chunk-V663653R.js +0 -20
  236. package/dist/cli-bundle/chunks/chunk-WSI5KZQJ.js +0 -55
  237. package/dist/cli-bundle/chunks/chunk-XPOQQJTX.js +0 -13
  238. package/dist/cli-bundle/chunks/chunk-YCCDXBNU.js +0 -2
  239. package/dist/cli-bundle/chunks/chunk-ZFBWCKYF.js +0 -2
  240. package/dist/cli-bundle/chunks/close-DI66JMSB.js +0 -2
  241. package/dist/cli-bundle/chunks/close-many-VFKT6U3O.js +0 -2
  242. package/dist/cli-bundle/chunks/comments-E73HIEZJ.js +0 -2
  243. package/dist/cli-bundle/chunks/copy-WBYVLCPC.js +0 -2
  244. package/dist/cli-bundle/chunks/create-TG67IVFI.js +0 -2
  245. package/dist/cli-bundle/chunks/delete-6XKUVVQN.js +0 -2
  246. package/dist/cli-bundle/chunks/deps-AJUGP2OH.js +0 -2
  247. package/dist/cli-bundle/chunks/docs-QOCLDRKJ.js +0 -2
  248. package/dist/cli-bundle/chunks/files-3ST5TY64.js +0 -2
  249. package/dist/cli-bundle/chunks/focus-R2AWS63Y.js +0 -2
  250. package/dist/cli-bundle/chunks/history-compact-7BJFML4S.js +0 -2
  251. package/dist/cli-bundle/chunks/history-redact-WJN3HYXR.js +0 -2
  252. package/dist/cli-bundle/chunks/history-repair-XDNZUB7F.js +0 -2
  253. package/dist/cli-bundle/chunks/learnings-SZMUPVNA.js +0 -2
  254. package/dist/cli-bundle/chunks/profile-KL53JIAC.js +0 -2
  255. package/dist/cli-bundle/chunks/register-mutation-OCRQNZK4.js +0 -20
  256. package/dist/cli-bundle/chunks/register-operations-HIBJXRGB.js +0 -2
  257. package/dist/cli-bundle/chunks/register-setup-QWBQ6HBS.js +0 -2
  258. package/dist/cli-bundle/chunks/restore-FXA5QPM7.js +0 -2
  259. package/dist/cli-bundle/chunks/schema-QJ27OTRV.js +0 -2
  260. package/dist/cli-bundle/chunks/update-7GBO4SXG.js +0 -2
  261. package/dist/cli-bundle/chunks/update-many-VF6ZKQUO.js +0 -2
  262. package/dist/cli-bundle/focused-chunks/chunk-74CWP3A4.js +0 -2
  263. package/dist/cli-bundle/focused-chunks/chunk-7AZDTGPA.js +0 -2
  264. package/dist/cli-bundle/focused-chunks/chunk-7YTZ7A4E.js +0 -2
  265. package/dist/cli-bundle/focused-chunks/chunk-LKQXXO62.js +0 -2
  266. package/dist/cli-bundle/focused-chunks/chunk-MBBMTDD3.js +0 -12
  267. package/dist/cli-bundle/focused-chunks/chunk-ME4XVOBJ.js +0 -8
  268. package/dist/cli-bundle/focused-chunks/chunk-QL5H3AQH.js +0 -2
  269. package/dist/cli-bundle/focused-chunks/chunk-YHDCGUIW.js +0 -14
@@ -5,10 +5,12 @@
5
5
  * surface without coupling package authors to command-specific option names.
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]="27431a6b-6f2e-5020-b4f1-b94cfa8a1c26")}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]="27f3a09b-9b90-5c85-9e41-21cfed5dc0ce")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
- import { compactReadOutputToBudget, updateReadOutputReceiptEstimate } from "./read-output-budget.js";
11
+ import { compactReadOutputToBudget, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
12
+ import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows, readOutputRowPaths, } from "./read-output-rows.js";
13
+ import { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
12
14
  /** Stable output dimensions shared by every read surface. */
13
15
  export const PM_READ_OUTPUT_DIMENSIONS = [
14
16
  "include",
@@ -52,6 +54,10 @@ const CANONICAL_OPTIONS = {
52
54
  };
53
55
  /** Canonical CLI flags that opt a read invocation into universal output shaping. */
54
56
  export const PM_READ_OUTPUT_OPTION_FLAGS = Object.freeze(PM_READ_OUTPUT_DIMENSIONS.map((dimension) => CANONICAL_OPTIONS[dimension]));
57
+ /** Canonical control that composes the four per-call dimensions across reads. */
58
+ export const PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS = Object.freeze([
59
+ "--output-session",
60
+ ]);
55
61
  const LEGACY_FLAGS_BY_COMMAND = {
56
62
  list: {
57
63
  include: ["--brief", "--compact", "--fields", "--full"],
@@ -166,7 +172,11 @@ function buildSurfaceContract(command) {
166
172
  }))),
167
173
  }),
168
174
  ])));
169
- return Object.freeze({ command, dimensions, precedence: READ_OUTPUT_PRECEDENCE });
175
+ return Object.freeze({
176
+ command,
177
+ dimensions,
178
+ precedence: READ_OUTPUT_PRECEDENCE,
179
+ });
170
180
  }
171
181
  /** Universal output contract for every built-in read surface. */
172
182
  export const PM_READ_OUTPUT_SURFACE_CONTRACTS = Object.freeze(PM_READ_OUTPUT_SURFACES.map(buildSurfaceContract));
@@ -195,6 +205,8 @@ const CANONICAL_OPTION_KEYS = [
195
205
  "output_budget",
196
206
  "outputFormat",
197
207
  "output_format",
208
+ "outputSession",
209
+ "output_session",
198
210
  ];
199
211
  const HYBRID_READ_MUTATION_KEYS = {
200
212
  comments: ["add", "body", "stdin", "file", "edit", "delete"],
@@ -226,6 +238,14 @@ const READ_OUTPUT_VALUE_VALIDATORS = [
226
238
  valid: (value) => value === "toon" || value === "json",
227
239
  message: "--output-format must be toon or json.",
228
240
  },
241
+ {
242
+ keys: ["outputSession", "output_session"],
243
+ valid: (value) => {
244
+ parseReadOutputSession(value);
245
+ return true;
246
+ },
247
+ message: "--output-session must be a valid session-state object.",
248
+ },
229
249
  ];
230
250
  /** Reject malformed or mutation-scoped universal output controls before command execution. */
231
251
  export function validateReadOutputOptions(command, options) {
@@ -403,29 +423,103 @@ const ENVELOPE_KEYS = new Set([
403
423
  "total",
404
424
  "truncated",
405
425
  ]);
406
- function rowKeys(result) {
407
- const contract = result.row_contract;
408
- if (isRecord(contract) && Array.isArray(contract.row_keys)) {
409
- return contract.row_keys.filter((entry) => typeof entry === "string");
410
- }
411
- return Object.entries(result)
412
- .filter(([, value]) => Array.isArray(value))
413
- .map(([key]) => key);
414
- }
415
426
  function projectRecordFields(value, selectors) {
416
427
  const selected = new Set(selectors.map((selector) => selector.split(".")[0]));
417
428
  return Object.fromEntries(Object.entries(value).filter(([key]) => selected.has(key)));
418
429
  }
419
- function applyIncludeProjection(result, selectors) {
420
- const rows = rowKeys(result);
421
- const selectedRoot = selectors.some((selector) => Object.hasOwn(result, selector.split(".")[0]));
422
- if (rows.length > 0 && !selectedRoot) {
423
- return Object.fromEntries(Object.entries(result).map(([key, value]) => [
424
- key,
425
- rows.includes(key) && Array.isArray(value)
426
- ? value.map((entry) => isRecord(entry) ? projectRecordFields(entry, selectors) : entry)
427
- : value,
428
- ]));
430
+ function getProjectionVocabulary(result) {
431
+ const item = isRecord(result.item) ? result.item : {};
432
+ const itemFields = Object.keys(item).sort((left, right) => left.localeCompare(right));
433
+ const sections = Object.keys(result)
434
+ .filter((key) => key !== "item" && key !== "read_output" && !ENVELOPE_KEYS.has(key))
435
+ .sort((left, right) => left.localeCompare(right));
436
+ return {
437
+ item,
438
+ itemFields,
439
+ sections,
440
+ valid: [
441
+ ...itemFields,
442
+ "item",
443
+ ...itemFields.map((field) => `item.${field}`),
444
+ ...sections,
445
+ ],
446
+ };
447
+ }
448
+ function applyGetIncludeProjection(result, selectors) {
449
+ const vocabulary = getProjectionVocabulary(result);
450
+ const unknown = selectors.filter((selector) => !vocabulary.valid.includes(selector));
451
+ if (unknown.length > 0) {
452
+ throw new PmCliError(`Unknown --output-include selector(s) for get: ${unknown.join(", ")}. Valid selectors: ${vocabulary.valid.join(", ")}.`, EXIT_CODE.USAGE);
453
+ }
454
+ const fullItem = selectors.includes("item");
455
+ const itemSelectors = selectors
456
+ .flatMap((selector) => selector.startsWith("item.")
457
+ ? [selector.slice("item.".length)]
458
+ : vocabulary.itemFields.includes(selector)
459
+ ? [selector]
460
+ : [])
461
+ .filter((selector, index, values) => values.indexOf(selector) === index);
462
+ if (fullItem && itemSelectors.length > 0) {
463
+ throw new PmCliError("--output-include cannot mix a full item with projected item fields; use item or item.<field>, not both.", EXIT_CODE.USAGE);
464
+ }
465
+ const selectedSections = new Set(selectors.filter((selector) => vocabulary.sections.includes(selector)));
466
+ const projected = Object.fromEntries(Object.entries(result).filter(([key]) => ENVELOPE_KEYS.has(key) || selectedSections.has(key)));
467
+ if (fullItem) {
468
+ projected.item = vocabulary.item;
469
+ }
470
+ else if (itemSelectors.length > 0) {
471
+ projected.item = projectRecordFields(vocabulary.item, itemSelectors);
472
+ }
473
+ const omittedFieldGroups = [
474
+ ...(fullItem
475
+ ? []
476
+ : itemSelectors.length > 0
477
+ ? vocabulary.itemFields
478
+ .filter((field) => !itemSelectors.includes(field))
479
+ .map((field) => ({
480
+ name: `item.${field}`,
481
+ restore_with: `--output-include item.${field}`,
482
+ }))
483
+ : [{ name: "item", restore_with: "--output-include item" }]),
484
+ ...vocabulary.sections
485
+ .filter((section) => !selectedSections.has(section))
486
+ .map((section) => ({
487
+ name: section,
488
+ restore_with: `--output-include ${section}`,
489
+ })),
490
+ ];
491
+ const inheritedOmittedFieldGroups = isRecord(projected.omission_receipt) &&
492
+ Array.isArray(projected.omission_receipt.omitted_field_groups)
493
+ ? projected.omission_receipt.omitted_field_groups
494
+ : [];
495
+ const combinedOmittedFieldGroups = [
496
+ ...inheritedOmittedFieldGroups,
497
+ ...omittedFieldGroups,
498
+ ];
499
+ projected.omission_receipt = {
500
+ has_omissions: combinedOmittedFieldGroups.length > 0,
501
+ omitted_field_group_count: combinedOmittedFieldGroups.length,
502
+ omitted_field_groups: combinedOmittedFieldGroups,
503
+ };
504
+ return projected;
505
+ }
506
+ function applyIncludeProjection(command, result, selectors) {
507
+ if (command === "get") {
508
+ return applyGetIncludeProjection(result, selectors);
509
+ }
510
+ const rows = readOutputRowPaths(result);
511
+ const qualifiedRowSelectors = selectors.flatMap((selector) => rows.flatMap((rowPath) => selector.startsWith(`${rowPath}.`)
512
+ ? [selector.slice(rowPath.length + 1)]
513
+ : []));
514
+ const selectedRoot = selectors.some((selector) => Object.hasOwn(result, selector.split(".")[0]) &&
515
+ !rows.some((rowPath) => selector.startsWith(`${rowPath}.`)));
516
+ if (rows.length > 0 && (!selectedRoot || qualifiedRowSelectors.length > 0)) {
517
+ const projected = { ...result };
518
+ return mapReadOutputRows(projected, (entry) => isRecord(entry)
519
+ ? projectRecordFields(entry, qualifiedRowSelectors.length > 0
520
+ ? qualifiedRowSelectors
521
+ : selectors)
522
+ : entry);
429
523
  }
430
524
  return Object.fromEntries(Object.entries(result).filter(([key]) => selectors.some((selector) => selector.split(".")[0] === key) ||
431
525
  ENVELOPE_KEYS.has(key)));
@@ -433,22 +527,13 @@ function applyIncludeProjection(result, selectors) {
433
527
  function applyAmountBound(result, amount) {
434
528
  if (amount === "unbounded")
435
529
  return result;
436
- let truncated = false;
437
- const rowKeyList = rowKeys(result);
438
- const rows = new Set(rowKeyList);
439
- const bounded = Object.fromEntries(Object.entries(result).map(([key, value]) => {
440
- if (!rows.has(key) || !Array.isArray(value) || value.length <= amount) {
441
- return [key, value];
442
- }
443
- truncated = true;
444
- return [key, value.slice(0, amount)];
445
- }));
530
+ const { result: bounded, truncated } = boundReadOutputRows(result, amount);
446
531
  if (!truncated)
447
532
  return bounded;
448
533
  bounded.has_more = true;
449
534
  bounded.truncated = true;
450
535
  if (typeof bounded.count === "number") {
451
- bounded.count = rowKeyList.reduce((total, key) => total + (Array.isArray(bounded[key]) ? bounded[key].length : 0), 0);
536
+ bounded.count = countReadOutputRows(bounded);
452
537
  }
453
538
  bounded.applied_bound = {
454
539
  kind: "output_limit",
@@ -460,23 +545,91 @@ function applyAmountBound(result, amount) {
460
545
  function requestedDimensions(resolved) {
461
546
  return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => resolved[dimension] !== undefined);
462
547
  }
548
+ /** Stabilize the per-call and cross-call receipts in one complete envelope. */
549
+ function attachReadOutputSessionContracts(result, state, receipt) {
550
+ let withSession = attachReadOutputSessionReceipt(result, state);
551
+ for (let iteration = 0; iteration < 8; iteration += 1) {
552
+ const previousReadEstimate = receipt.estimated_tokens;
553
+ const previousSessionEstimate = withSession.read_session.spent_this_call_tokens;
554
+ updateReadOutputReceiptEstimate(withSession, receipt);
555
+ withSession = attachReadOutputSessionReceipt(withSession, state);
556
+ const sessionEstimate = withSession.read_session.spent_this_call_tokens;
557
+ if (receipt.estimated_tokens === previousReadEstimate &&
558
+ sessionEstimate === previousSessionEstimate) {
559
+ return withSession;
560
+ }
561
+ }
562
+ return withSession;
563
+ }
564
+ /** Apply field, amount, and repeat projections to every declared row path. */
565
+ function projectReadOutputRows(result, resolved, session) {
566
+ let projected = { ...result };
567
+ if (resolved.include?.source === "canonical") {
568
+ projected = applyIncludeProjection(resolved.command, projected, resolved.include.value);
569
+ }
570
+ if (resolved.amount?.source === "canonical") {
571
+ projected = applyAmountBound(projected, resolved.amount.value);
572
+ }
573
+ return session === undefined
574
+ ? projected
575
+ : applyReadOutputSessionReferences(projected, session);
576
+ }
577
+ /** Resolve the smallest binding per-call or remaining cross-call ceiling. */
578
+ function resolveBindingReadOutputBudget(resolved, session) {
579
+ const budgets = [
580
+ ...(resolved.cost?.source === "canonical" ? [resolved.cost.value] : []),
581
+ ...(session === undefined
582
+ ? []
583
+ : [readOutputSessionRemainingTokens(session)]),
584
+ ];
585
+ return budgets.length === 0 ? undefined : Math.min(...budgets);
586
+ }
587
+ /** Build the smallest truthful omission envelope or reject an exhausted session. */
588
+ function omitReadOutputForBudget(resolved, requested, session, budget) {
589
+ const minimalReceipt = {
590
+ contract_version: 1,
591
+ command: resolved.command,
592
+ requested_dimensions: requested,
593
+ precedence: resolved.precedence,
594
+ legacy_aliases_used: [],
595
+ migration_hints: [],
596
+ estimated_tokens: 0,
597
+ within_budget: false,
598
+ strings_compacted: false,
599
+ rows_compacted: false,
600
+ result_omitted: true,
601
+ };
602
+ const omitted = {
603
+ output_budget_exceeded: {
604
+ omitted_result: true,
605
+ reason: "requested_budget_infeasible",
606
+ restore_with: "Increase --output-budget or narrow the read.",
607
+ },
608
+ read_output: minimalReceipt,
609
+ };
610
+ const boundedOmission = session === undefined
611
+ ? omitted
612
+ : attachReadOutputSessionContracts(omitted, session, minimalReceipt);
613
+ if (session === undefined) {
614
+ updateReadOutputReceiptEstimate(boundedOmission, minimalReceipt);
615
+ }
616
+ if (session !== undefined && minimalReceipt.estimated_tokens > budget) {
617
+ throw new PmCliError("The remaining output-session budget cannot fit its mandatory receipts; start a new session with a larger token_budget.", EXIT_CODE.USAGE);
618
+ }
619
+ return boundedOmission;
620
+ }
463
621
  /** Apply universal field, row, and token bounds and attach an exact receipt. */
464
622
  export function applyReadOutputDimensions(command, options, result) {
465
623
  const resolved = resolveReadOutputDimensions(command, options);
466
624
  if (!resolved)
467
625
  return result;
626
+ const session = parseReadOutputSession(options.outputSession ?? options.output_session);
468
627
  const requested = requestedDimensions(resolved);
469
628
  const canonicalRequested = requested.filter((dimension) => resolved[dimension]?.source === "canonical");
470
- if (canonicalRequested.length === 0) {
629
+ if (canonicalRequested.length === 0 && session === undefined) {
471
630
  return result;
472
631
  }
473
- let projected = { ...result };
474
- if (resolved.include?.source === "canonical") {
475
- projected = applyIncludeProjection(projected, resolved.include.value);
476
- }
477
- if (resolved.amount?.source === "canonical") {
478
- projected = applyAmountBound(projected, resolved.amount.value);
479
- }
632
+ let projected = projectReadOutputRows(result, resolved, session);
480
633
  const receipt = {
481
634
  contract_version: 1,
482
635
  command: resolved.command,
@@ -491,35 +644,20 @@ export function applyReadOutputDimensions(command, options, result) {
491
644
  result_omitted: false,
492
645
  };
493
646
  projected.read_output = receipt;
647
+ projected =
648
+ session === undefined
649
+ ? projected
650
+ : attachReadOutputSessionContracts(projected, session, receipt);
494
651
  updateReadOutputReceiptEstimate(projected, receipt);
495
- const budget = resolved.cost?.source === "canonical" ? resolved.cost.value : undefined;
652
+ const budget = resolveBindingReadOutputBudget(resolved, session);
496
653
  if (budget !== undefined && receipt.estimated_tokens > budget) {
497
654
  projected = compactReadOutputToBudget(projected, receipt, budget);
655
+ if (session !== undefined) {
656
+ projected = attachReadOutputSessionContracts(projected, session, receipt);
657
+ }
498
658
  }
499
659
  if (budget !== undefined && receipt.estimated_tokens > budget) {
500
- const minimalReceipt = {
501
- contract_version: 1,
502
- command: resolved.command,
503
- requested_dimensions: requested,
504
- precedence: resolved.precedence,
505
- legacy_aliases_used: [],
506
- migration_hints: [],
507
- estimated_tokens: 0,
508
- within_budget: false,
509
- strings_compacted: false,
510
- rows_compacted: false,
511
- result_omitted: true,
512
- };
513
- const omitted = {
514
- output_budget_exceeded: {
515
- omitted_result: true,
516
- reason: "requested_budget_infeasible",
517
- restore_with: "Increase --output-budget or narrow the read.",
518
- },
519
- read_output: minimalReceipt,
520
- };
521
- updateReadOutputReceiptEstimate(omitted, minimalReceipt);
522
- return omitted;
660
+ return omitReadOutputForBudget(resolved, requested, session, budget);
523
661
  }
524
662
  return projected;
525
663
  }
@@ -538,4 +676,4 @@ export function resolveReadOutputEncoding(command, options) {
538
676
  : undefined;
539
677
  }
540
678
  //# sourceMappingURL=read-output-contracts.js.map
541
- //# debugId=27431a6b-6f2e-5020-b4f1-b94cfa8a1c26
679
+ //# debugId=27f3a09b-9b90-5c85-9e41-21cfed5dc0ce
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @module sdk/read-output-rows
3
+ *
4
+ * Resolves and transforms the row collections declared by universal read
5
+ * envelopes, including dot-delimited nested paths used by graph projections.
6
+ */
7
+ /** One declared array or object-map row collection in a read envelope. */
8
+ export interface PmReadOutputRowCollection {
9
+ /** Dot-delimited path published by the envelope row contract. */
10
+ path: string;
11
+ /** Array rows or a keyed row map stored at {@link path}. */
12
+ value: unknown[] | Record<string, unknown>;
13
+ }
14
+ /** Resolve declared row paths, falling back to top-level array properties. */
15
+ export declare function readOutputRowPaths(result: Record<string, unknown>): string[];
16
+ /** Resolve every declared row path that currently contains iterable rows. */
17
+ export declare function readOutputRowCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
18
+ /** Count array entries and object-map values across declared row collections. */
19
+ export declare function countReadOutputRows(result: Record<string, unknown>): number;
20
+ /**
21
+ * Transform every declared row while preserving collection keys and cloning
22
+ * only the owner objects along paths that changed.
23
+ */
24
+ export declare function mapReadOutputRows(result: Record<string, unknown>, transform: (row: unknown, path: string, index: number) => unknown): Record<string, unknown>;
25
+ /** Bound every declared row collection independently and report truncation. */
26
+ export declare function boundReadOutputRows(result: Record<string, unknown>, amount: number): {
27
+ result: Record<string, unknown>;
28
+ truncated: boolean;
29
+ };
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @module sdk/read-output-rows
3
+ *
4
+ * Resolves and transforms the row collections declared by universal read
5
+ * envelopes, including dot-delimited nested paths used by graph projections.
6
+ */
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]="ae6fbd4a-6c4e-5639-93ac-f107a336e95b")}catch(e){}}();
9
+ function isRecord(value) {
10
+ return value !== null && typeof value === "object" && !Array.isArray(value);
11
+ }
12
+ /** Read one dot-delimited path without treating missing segments as rows. */
13
+ function valueAtPath(result, rowPath) {
14
+ let value = result;
15
+ for (const segment of rowPath.split(".")) {
16
+ if (!isRecord(value))
17
+ return undefined;
18
+ value = value[segment];
19
+ }
20
+ return value;
21
+ }
22
+ /** Clone the owners along one row path and replace only its terminal value. */
23
+ function replaceValueAtPath(result, rowPath, replacement) {
24
+ const segments = rowPath.split(".");
25
+ const root = { ...result };
26
+ let source = result;
27
+ let target = root;
28
+ for (const segment of segments.slice(0, -1)) {
29
+ const sourceChild = source[segment];
30
+ const targetChild = { ...sourceChild };
31
+ target[segment] = targetChild;
32
+ source = sourceChild;
33
+ target = targetChild;
34
+ }
35
+ target[segments.at(-1)] = replacement;
36
+ return root;
37
+ }
38
+ /** Resolve declared row paths, falling back to top-level array properties. */
39
+ export function readOutputRowPaths(result) {
40
+ const contract = result.row_contract;
41
+ if (isRecord(contract) && Array.isArray(contract.row_keys)) {
42
+ return contract.row_keys.filter((entry) => typeof entry === "string" && entry.trim().length > 0);
43
+ }
44
+ return Object.entries(result)
45
+ .filter(([, value]) => Array.isArray(value))
46
+ .map(([key]) => key);
47
+ }
48
+ /** Resolve every declared row path that currently contains iterable rows. */
49
+ export function readOutputRowCollections(result) {
50
+ return readOutputRowPaths(result).flatMap((rowPath) => {
51
+ const value = valueAtPath(result, rowPath);
52
+ return Array.isArray(value) || isRecord(value)
53
+ ? [{ path: rowPath, value }]
54
+ : [];
55
+ });
56
+ }
57
+ /** Count array entries and object-map values across declared row collections. */
58
+ export function countReadOutputRows(result) {
59
+ return readOutputRowCollections(result).reduce((total, collection) => total +
60
+ (Array.isArray(collection.value)
61
+ ? collection.value.length
62
+ : Object.keys(collection.value).length), 0);
63
+ }
64
+ /**
65
+ * Transform every declared row while preserving collection keys and cloning
66
+ * only the owner objects along paths that changed.
67
+ */
68
+ export function mapReadOutputRows(result, transform) {
69
+ let projected = result;
70
+ for (const collection of readOutputRowCollections(projected)) {
71
+ const replacement = Array.isArray(collection.value)
72
+ ? collection.value.map((row, index) => transform(row, collection.path, index))
73
+ : Object.fromEntries(Object.entries(collection.value).map(([key, row], index) => [
74
+ key,
75
+ transform(row, collection.path, index),
76
+ ]));
77
+ projected = replaceValueAtPath(projected, collection.path, replacement);
78
+ }
79
+ return projected;
80
+ }
81
+ /** Bound every declared row collection independently and report truncation. */
82
+ export function boundReadOutputRows(result, amount) {
83
+ let projected = result;
84
+ let truncated = false;
85
+ for (const collection of readOutputRowCollections(projected)) {
86
+ const entries = Array.isArray(collection.value)
87
+ ? collection.value
88
+ : Object.entries(collection.value);
89
+ if (entries.length <= amount)
90
+ continue;
91
+ truncated = true;
92
+ const replacement = Array.isArray(collection.value)
93
+ ? entries.slice(0, amount)
94
+ : Object.fromEntries(entries.slice(0, amount));
95
+ projected = replaceValueAtPath(projected, collection.path, replacement);
96
+ }
97
+ return { result: projected, truncated };
98
+ }
99
+ //# sourceMappingURL=read-output-rows.js.map
100
+ //# debugId=ae6fbd4a-6c4e-5639-93ac-f107a336e95b
@@ -0,0 +1,69 @@
1
+ /** Versioned state supplied to a sequence of related read invocations. */
2
+ export interface PmReadOutputSessionState {
3
+ /** Session-state schema version. */
4
+ version: 1;
5
+ /** Caller-selected request-group identity. */
6
+ id: string;
7
+ /** Binding token ceiling shared by every invocation in the group. */
8
+ token_budget: number;
9
+ /** Tokens already spent by earlier invocations. */
10
+ spent_tokens: number;
11
+ /** Item facts already serialized in full during this session. */
12
+ seen_item_ids: string[];
13
+ }
14
+ /** Lightweight row emitted instead of repeating a previously served item. */
15
+ export interface PmReadOutputSessionReference {
16
+ /** Stable item identity retained for joins and follow-up reads. */
17
+ id: string;
18
+ /** Resolvable reference to the session fact already in caller context. */
19
+ context_ref: string;
20
+ }
21
+ /** Receipt proving cross-call suppression and budget accounting. */
22
+ export interface PmReadOutputSessionReceipt {
23
+ /** Session-receipt schema version. */
24
+ contract_version: 1;
25
+ /** Caller-selected request-group identity. */
26
+ id: string;
27
+ /** Accounting scope, including this receipt and the read-output receipt. */
28
+ measurement_scope: "complete_read_envelope";
29
+ /** Canonical estimator shared with per-call output budgets. */
30
+ estimator: "ceil(utf8_bytes / 4)";
31
+ /** Group ceiling supplied in the session state. */
32
+ token_budget: number;
33
+ /** Spend carried into this invocation. */
34
+ spent_before_tokens: number;
35
+ /** Exact fixed-point estimate emitted by this invocation. */
36
+ spent_this_call_tokens: number;
37
+ /** Portion of this invocation charged before the ceiling was exhausted. */
38
+ charged_this_call_tokens: number;
39
+ /** Accumulated spend after this invocation. */
40
+ spent_total_tokens: number;
41
+ /** Unspent group capacity after this invocation. */
42
+ remaining_tokens: number;
43
+ /** Whether no further useful read envelope fits the group ceiling. */
44
+ exhausted: boolean;
45
+ /** Number of full item facts known before this invocation. */
46
+ seen_before_count: number;
47
+ /** Number of newly delivered item facts retained in this envelope. */
48
+ new_item_count: number;
49
+ /** Number of repeated item rows replaced by references. */
50
+ suppressed_repeat_count: number;
51
+ /** Stable reference syntax used by suppressed rows. */
52
+ reference_format: "session:<session-id>:<item-id>";
53
+ /** Command that restores a referenced item when prior context is unavailable. */
54
+ restore_reference_with: "pm get <item-id> --brief";
55
+ /** Caller-carried state for the next read in the same request group. */
56
+ next_state: PmReadOutputSessionState;
57
+ }
58
+ /** Smallest session ceiling that can carry a useful result and both receipts. */
59
+ export declare const PM_READ_OUTPUT_SESSION_MIN_TOKENS = 256;
60
+ /** Maximum caller-carried served-item identities accepted in one session state. */
61
+ export declare const PM_READ_OUTPUT_SESSION_MAX_SEEN_ITEM_IDS = 10000;
62
+ /** Parse and strictly validate a JSON string or typed session-state object. */
63
+ export declare function parseReadOutputSession(value: unknown): PmReadOutputSessionState | undefined;
64
+ /** Replace previously served item rows with compact, resolvable references. */
65
+ export declare function applyReadOutputSessionReferences(result: Record<string, unknown>, state: PmReadOutputSessionState): Record<string, unknown>;
66
+ /** Attach a fixed-point session receipt and return the exact charged tokens. */
67
+ export declare function attachReadOutputSessionReceipt(result: Record<string, unknown>, state: PmReadOutputSessionState): Record<string, unknown>;
68
+ /** Return the unspent group budget available to the current invocation. */
69
+ export declare function readOutputSessionRemainingTokens(state: PmReadOutputSessionState): number;