@unbrained/pm-cli 2026.8.12 → 2026.8.14

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 (218) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +162 -111
  3. package/dist/cli/error-guidance.js +4 -8
  4. package/dist/cli/main.js +40 -3
  5. package/dist/cli/register-assurance.js +28 -17
  6. package/dist/cli-bundle/bundle-manifest.json +141 -173
  7. package/dist/cli-bundle/chunks/chunk-BBOFSVAK.js +197 -0
  8. package/dist/cli-bundle/chunks/chunk-BFALV3YP.js +5 -0
  9. package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-FIW4P64F.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-G5JUB66K.js} +52 -52
  11. package/dist/cli-bundle/chunks/chunk-SBRKH6OR.js +2 -0
  12. package/dist/cli-bundle/chunks/chunk-TMJ7URWS.js +13 -0
  13. package/dist/cli-bundle/chunks/chunk-TXMEUUUY.js +8 -0
  14. package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-XAVMOK6B.js} +50 -50
  15. package/dist/cli-bundle/chunks/chunk-YAMTJL6Y.js +34 -0
  16. package/dist/cli-bundle/chunks/chunk-YSVSMJ2B.js +2 -0
  17. package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-T3EHHNNV.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-E27WCLSZ.js} +2 -2
  19. package/dist/cli-bundle/chunks/register-operations-4R6I7CPY.js +2 -0
  20. package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-3YXZ444E.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-4DQ2YERC.js} +4 -4
  22. package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +8 -0
  23. package/dist/cli-bundle/focused-chunks/chunk-K7RWWOAG.js +4 -0
  24. package/dist/cli-bundle/focused-chunks/chunk-KFSZ3BP6.js +16 -0
  25. package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-KSEDUWVZ.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-KYUQGTSB.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-LZ4MV3RH.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +155 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-PPFGQDSI.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +46 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-QUMB2J27.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-WCVE2NIG.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-XDNAW5OI.js +18 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-YOOI3UZX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.js +2 -0
  38. package/dist/cli-bundle/main.js +13 -13
  39. package/dist/cli-bundle/sdk-authoring.js +1 -1
  40. package/dist/cli-bundle/sdk-contracts.js +1 -1
  41. package/dist/cli-bundle/sdk-core.js +45 -41
  42. package/dist/cli-bundle/sdk-governance.js +1 -1
  43. package/dist/cli-bundle/sdk-graph.js +1 -1
  44. package/dist/cli-bundle/sdk-merge.js +109 -1
  45. package/dist/cli-bundle/sdk-query.js +1 -1
  46. package/dist/cli-bundle/sdk-runtime.js +1 -1
  47. package/dist/cli-bundle/sdk-testing.js +1 -1
  48. package/dist/cli-bundle/sdk.js +2 -2
  49. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  50. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  51. package/dist/core/extensions/activation-summary.d.ts +2 -0
  52. package/dist/core/extensions/activation-summary.js +6 -2
  53. package/dist/core/extensions/capability-usage.d.ts +1 -1
  54. package/dist/core/extensions/capability-usage.js +4 -3
  55. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  56. package/dist/core/extensions/contribution-inventory.js +6 -2
  57. package/dist/core/extensions/extension-registries.js +3 -2
  58. package/dist/core/extensions/extension-types.d.ts +83 -1
  59. package/dist/core/extensions/extension-types.js +3 -2
  60. package/dist/core/extensions/loader.d.ts +2 -8
  61. package/dist/core/extensions/loader.js +53 -144
  62. package/dist/core/extensions/registration-values.d.ts +43 -0
  63. package/dist/core/extensions/registration-values.js +210 -0
  64. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  65. package/dist/core/extensions/runtime-registrations.js +12 -2
  66. package/dist/core/fs/fs-utils.d.ts +2 -0
  67. package/dist/core/fs/fs-utils.js +7 -3
  68. package/dist/core/history/drift-cache.js +4 -3
  69. package/dist/core/history/drift-scan.d.ts +6 -0
  70. package/dist/core/history/drift-scan.js +76 -58
  71. package/dist/core/history/workspace-history.d.ts +59 -0
  72. package/dist/core/history/workspace-history.js +197 -10
  73. package/dist/core/lock/lock-gc.js +8 -13
  74. package/dist/core/lock/lock.js +5 -4
  75. package/dist/core/output/output.js +12 -4
  76. package/dist/core/search/vector-stores.js +6 -11
  77. package/dist/core/store/item-metadata-cache.js +4 -4
  78. package/dist/core/telemetry/runtime.d.ts +6 -0
  79. package/dist/core/telemetry/runtime.js +101 -30
  80. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  81. package/dist/sdk/agent/command-recovery.js +10 -2
  82. package/dist/sdk/annotations.js +4 -4
  83. package/dist/sdk/cli-contracts/completeness.js +9 -3
  84. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  85. package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
  86. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -1
  87. package/dist/sdk/cli-contracts/runtime-contracts.js +155 -60
  88. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
  89. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
  90. package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
  91. package/dist/sdk/cli-contracts/tool-schema.js +17 -2
  92. package/dist/sdk/cli-program.js +3 -3
  93. package/dist/sdk/comments.js +4 -3
  94. package/dist/sdk/compile-cache.js +4 -3
  95. package/dist/sdk/compose.d.ts +3 -1
  96. package/dist/sdk/compose.js +16 -2
  97. package/dist/sdk/context-relevance.js +12 -4
  98. package/dist/sdk/context-signal-store.js +4 -3
  99. package/dist/sdk/extension/install-runtime.js +4 -4
  100. package/dist/sdk/extension/managed-state.js +4 -3
  101. package/dist/sdk/extension-contracts.d.ts +1 -1
  102. package/dist/sdk/flag-invocation-contracts.js +5 -6
  103. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
  104. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  105. package/dist/sdk/governance/assurance-action.js +112 -28
  106. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  107. package/dist/sdk/governance/assurance-mutation-error.js +25 -2
  108. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  109. package/dist/sdk/governance/assurance-presets.js +136 -0
  110. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  111. package/dist/sdk/governance/assurance-runtime.js +109 -8
  112. package/dist/sdk/governance/assurance.d.ts +39 -0
  113. package/dist/sdk/governance/assurance.js +145 -6
  114. package/dist/sdk/governance/gc.js +5 -11
  115. package/dist/sdk/governance/health.js +18 -6
  116. package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
  117. package/dist/sdk/governance/validate-history-drift.js +68 -0
  118. package/dist/sdk/governance/validate.js +6 -48
  119. package/dist/sdk/graph/assembly.d.ts +23 -0
  120. package/dist/sdk/graph/assembly.js +54 -2
  121. package/dist/sdk/graph/durable-cache.js +91 -3
  122. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  123. package/dist/sdk/graph/governance-contracts.js +29 -0
  124. package/dist/sdk/graph/governance.d.ts +51 -3
  125. package/dist/sdk/graph/governance.js +216 -35
  126. package/dist/sdk/graph/index.d.ts +2 -2
  127. package/dist/sdk/graph/index.js +4 -4
  128. package/dist/sdk/graph/mutation-advisory.js +15 -7
  129. package/dist/sdk/graph/remediation.js +12 -2
  130. package/dist/sdk/guide.js +4 -4
  131. package/dist/sdk/history-read.d.ts +8 -0
  132. package/dist/sdk/history-read.js +2 -2
  133. package/dist/sdk/index.d.ts +3 -2
  134. package/dist/sdk/index.js +5 -4
  135. package/dist/sdk/linked-artifacts.d.ts +2 -0
  136. package/dist/sdk/linked-artifacts.js +29 -4
  137. package/dist/sdk/merge/install.js +5 -4
  138. package/dist/sdk/query/activity.js +4 -3
  139. package/dist/sdk/query/history.js +20 -3
  140. package/dist/sdk/read-output-budget.d.ts +2 -0
  141. package/dist/sdk/read-output-budget.js +12 -5
  142. package/dist/sdk/read-output-contracts.d.ts +61 -5
  143. package/dist/sdk/read-output-contracts.js +210 -28
  144. package/dist/sdk/read-output-rows.d.ts +11 -0
  145. package/dist/sdk/read-output-rows.js +47 -2
  146. package/dist/sdk/relationship-history.js +5 -5
  147. package/dist/sdk/runtime-primitives.d.ts +1 -1
  148. package/dist/sdk/runtime-primitives.js +3 -3
  149. package/dist/sdk/runtime.js +5 -3
  150. package/dist/sdk/schema-migration.js +4 -4
  151. package/dist/sdk/test/execution.js +4 -4
  152. package/dist/sdk/workspace-memory.js +4 -4
  153. package/dist/sdk/workspace-snapshot.js +8 -14
  154. package/dist/sdk/workspace-transaction-gc.js +4 -9
  155. package/dist/sdk/workspace-transaction.js +4 -4
  156. package/dist/sdk/workspace.js +4 -3
  157. package/docs/ASSURANCE.md +163 -3
  158. package/docs/COMMANDS.md +31 -2
  159. package/docs/CONFIGURATION.md +2 -0
  160. package/docs/EXTENSIONS.md +11 -12
  161. package/docs/READ_OUTPUT_CONTRACTS.md +44 -8
  162. package/docs/RELATIONSHIP_GRAPH.md +34 -4
  163. package/docs/SDK.md +29 -8
  164. package/docs/SDK_CONTEXT_INTEGRITY.md +32 -1
  165. package/docs/TESTING.md +47 -16
  166. package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
  167. package/marketplace.json +2 -2
  168. package/package.json +6 -6
  169. package/packages/pm-beads/extensions/beads/index.ts +1 -0
  170. package/packages/pm-beads/package.json +1 -1
  171. package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
  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/extensions/digital-twin/index.ts +7 -0
  175. package/packages/pm-digital-twin/package.json +1 -1
  176. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
  177. package/packages/pm-governance-audit/package.json +1 -1
  178. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
  179. package/packages/pm-guide-shell/package.json +1 -1
  180. package/packages/pm-kanban/package.json +1 -1
  181. package/packages/pm-lifecycle-hooks/package.json +1 -1
  182. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +6 -0
  183. package/packages/pm-linked-test-adapters/package.json +1 -1
  184. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
  185. package/packages/pm-search-advanced/package.json +1 -1
  186. package/packages/pm-templates/extensions/templates/index.ts +4 -0
  187. package/packages/pm-templates/package.json +1 -1
  188. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  189. package/packages/pm-todos/package.json +1 -1
  190. package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
  191. package/packages/pm-vcs/package.json +1 -1
  192. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  193. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  194. package/scripts/bundle-cli.mjs +17 -4
  195. package/sdk/public-surface.json +390 -60
  196. package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
  197. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
  198. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
  199. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
  200. package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
  201. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +0 -5
  202. package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
  203. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
  204. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +0 -5
  205. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
  206. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
  208. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
  210. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
  211. package/dist/cli-bundle/focused-chunks/chunk-KPSXVBDV.js +0 -2
  212. package/dist/cli-bundle/focused-chunks/chunk-KTLOKKCQ.js +0 -2
  213. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
  214. package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
  215. package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +0 -2
  216. package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
  217. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
  218. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
@@ -5,10 +5,11 @@
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]="0ab0c72c-cac0-5670-93d1-7a446f8a2301")}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]="c78ba845-78ae-5b16-b486-c279f834d601")}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, estimateReadOutputTokens, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
12
+ import { resolvePmCommandOutputBudget } from "./cli-contracts/agent-output-contracts.js";
12
13
  import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows, readOutputRowPaths, } from "./read-output-rows.js";
13
14
  import { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
14
15
  /** Stable output dimensions shared by every read surface. */
@@ -40,6 +41,8 @@ export const PM_READ_OUTPUT_SURFACES = [
40
41
  "stats",
41
42
  "aggregate",
42
43
  "package-manage",
44
+ "comments-audit",
45
+ "assurance",
43
46
  ];
44
47
  const READ_OUTPUT_PRECEDENCE = [
45
48
  "canonical",
@@ -91,7 +94,7 @@ const LEGACY_FLAGS_BY_COMMAND = {
91
94
  encoding: ["--format"],
92
95
  },
93
96
  health: {
94
- include: ["--brief", "--check-only", "--full", "--summary", "--verbose"],
97
+ include: ["--brief", "--check-only", "--full", "--summary"],
95
98
  },
96
99
  deps: {
97
100
  include: ["--collapse", "--full", "--summary"],
@@ -113,7 +116,7 @@ const LEGACY_FLAGS_BY_COMMAND = {
113
116
  amount: ["--limit", "--unbounded"],
114
117
  encoding: ["--stream"],
115
118
  },
116
- validate: { include: ["--counts", "--full", "--verbose"] },
119
+ validate: { include: ["--counts", "--full"] },
117
120
  events: {
118
121
  include: ["--full"],
119
122
  amount: ["--limit"],
@@ -129,17 +132,26 @@ const LEGACY_FLAGS_BY_COMMAND = {
129
132
  stats: {},
130
133
  aggregate: {},
131
134
  "package-manage": {},
135
+ "comments-audit": {},
136
+ assurance: {},
132
137
  };
133
- const VALUE_BEARING_INCLUDE_ALIASES = new Set(["--fields", "--section"]);
138
+ const VALUE_BEARING_INCLUDE_ALIASES = new Set([
139
+ "--collapse",
140
+ "--fields",
141
+ "--section",
142
+ ]);
134
143
  const BEHAVIOR_PRESERVING_MIGRATION_HINTS = Object.freeze({
135
144
  "--after": "--after retains cursor-position semantics; use --output-limit <n> separately to bound returned rows.",
136
145
  "--check-only": "--check-only retains health side-effect semantics; --output-include does not suppress vector refresh.",
146
+ "--collapse": "--collapse retains dependency grouping semantics; --output-include does not replace it.",
137
147
  "--depth": "--depth retains traversal or detail-depth semantics; --output-limit does not replace it.",
138
148
  "--follow": "--follow retains event-tail semantics; --output-format does not enable following.",
139
149
  "--max-depth": "--max-depth retains graph traversal-depth semantics; --output-limit does not replace it.",
140
150
  "--max-paths": "--max-paths retains graph path-search semantics; use --output-limit separately to bound returned rows.",
151
+ "--no-truncate": "--no-truncate is a compatibility alias; prefer --output-limit unbounded.",
141
152
  "--offset": "--offset retains positional pagination semantics; use --output-limit separately to bound returned rows.",
142
153
  "--stream": "--stream retains command streaming semantics; --output-format selects only static result encoding.",
154
+ "--unbounded": "--unbounded is a compatibility alias; prefer --output-limit unbounded.",
143
155
  });
144
156
  function flagSelector(flag) {
145
157
  return flag.slice(2).replaceAll("-", "_");
@@ -170,6 +182,9 @@ function buildSurfaceContract(command) {
170
182
  inapplicable_reason: null,
171
183
  legacy_aliases: Object.freeze((legacy[dimension] ?? []).map((flag) => Object.freeze({
172
184
  flag,
185
+ semantics: BEHAVIOR_PRESERVING_MIGRATION_HINTS[flag] === undefined
186
+ ? "replacement"
187
+ : "behavior_preserving",
173
188
  migration_hint: migrationHint(flag, dimension),
174
189
  visibility: "hidden_alias",
175
190
  }))),
@@ -242,8 +257,8 @@ const READ_OUTPUT_VALUE_VALIDATORS = [
242
257
  },
243
258
  {
244
259
  keys: ["outputBudget", "output_budget"],
245
- valid: (value) => positiveInteger(value) !== undefined,
246
- message: "--output-budget must be a positive integer.",
260
+ valid: (value) => value === "unbounded" || positiveInteger(value) !== undefined,
261
+ message: "--output-budget must be a positive integer or unbounded.",
247
262
  },
248
263
  {
249
264
  keys: ["outputFormat", "output_format"],
@@ -279,6 +294,68 @@ export function validateReadOutputOptions(command, options) {
279
294
  }
280
295
  }
281
296
  }
297
+ /**
298
+ * Map every canonical `--output-include` token that names a projection mode
299
+ * rather than a row field onto the command-local option that mode already owns.
300
+ *
301
+ * The include dimension folds two kinds of legacy alias into one canonical
302
+ * spelling: value-bearing selectors (`--fields`, `--section`) that name row
303
+ * fields, and mode flags (`--brief`, `--full`, `--summary`, ...) that select a
304
+ * whole declared projection. Only the first kind can be honoured by projecting
305
+ * an already-computed result, so mode tokens have to reach the command itself.
306
+ */
307
+ export function readOutputIncludeModeOptions(command) {
308
+ const surface = resolveReadOutputSurface(command);
309
+ if (!surface)
310
+ return new Map();
311
+ return new Map((LEGACY_FLAGS_BY_COMMAND[surface].include ?? [])
312
+ .filter((flag) => !VALUE_BEARING_INCLUDE_ALIASES.has(flag) &&
313
+ BEHAVIOR_PRESERVING_MIGRATION_HINTS[flag] === undefined)
314
+ .map((flag) => [flagSelector(flag), optionKey(flag)]));
315
+ }
316
+ /**
317
+ * Translate canonical projection-mode tokens into the command-local options
318
+ * they alias, so the spelling the migration hints recommend is behaviour
319
+ * identical to the legacy flag it replaces, and return the field selectors that
320
+ * remain for post-execution projection.
321
+ */
322
+ export function applyReadOutputIncludeModes(command, includeValue, commandOptions) {
323
+ const requested = stringList(includeValue) ?? [];
324
+ const modeOptions = readOutputIncludeModeOptions(command);
325
+ const selectors = [];
326
+ const modes = [];
327
+ for (const token of requested) {
328
+ const option = modeOptions.get(token);
329
+ if (option === undefined) {
330
+ selectors.push(token);
331
+ continue;
332
+ }
333
+ commandOptions[option] = true;
334
+ modes.push(token);
335
+ }
336
+ return { selectors, modes };
337
+ }
338
+ /**
339
+ * Resolve canonical include modes against one combined options bag, rewriting
340
+ * the include value in place to the selectors that remain.
341
+ *
342
+ * Used by dispatch paths that carry command options and universal output
343
+ * controls in a single record, so an action honours a mode token exactly as the
344
+ * CLI does.
345
+ */
346
+ export function normalizeReadOutputIncludeModeOptions(command, options) {
347
+ const include = options.outputInclude ?? options.output_include;
348
+ if (include === undefined)
349
+ return;
350
+ const { selectors, modes } = applyReadOutputIncludeModes(command, include, options);
351
+ if (modes.length === 0)
352
+ return;
353
+ const residual = selectors.length > 0 ? selectors.join(",") : undefined;
354
+ options.outputInclude = residual;
355
+ if (Object.hasOwn(options, "output_include")) {
356
+ options.output_include = residual;
357
+ }
358
+ }
282
359
  function optionKey(flag) {
283
360
  return flag
284
361
  .slice(2)
@@ -353,6 +430,9 @@ function resolveAmountValue(canonical, legacy) {
353
430
  : { source: "legacy", value: legacyLimit };
354
431
  }
355
432
  function resolveCostValue(canonical, legacy) {
433
+ if (canonical === "unbounded") {
434
+ return { source: "canonical", value: "unbounded" };
435
+ }
356
436
  const canonicalBudget = positiveInteger(canonical);
357
437
  if (canonicalBudget !== undefined) {
358
438
  return { source: "canonical", value: canonicalBudget };
@@ -404,12 +484,23 @@ export function resolveReadOutputDimensions(command, options) {
404
484
  const alias = contract.dimensions[dimension].legacy_aliases.find((entry) => entry.flag === resolved.flag);
405
485
  return [alias.migration_hint];
406
486
  });
487
+ const encoding = resolveEncodingValue(options.outputFormat ?? options.output_format, legacyByDimension.encoding);
488
+ const explicitCost = resolveCostValue(options.outputBudget ?? options.output_budget, legacyByDimension.cost);
489
+ const budget = resolvePmCommandOutputBudget(command, {
490
+ generateFallback: true,
491
+ });
492
+ const resolvedOutputFormat = encoding?.value === "json" || options.resolvedOutputFormat === "json"
493
+ ? "json"
494
+ : "toon";
407
495
  return {
408
496
  command: normalizedCommand,
409
497
  include: resolveIncludeValue(options.outputInclude ?? options.output_include, legacyByDimension.include),
410
498
  amount: resolveAmountValue(options.outputLimit ?? options.output_limit, legacyByDimension.amount),
411
- cost: resolveCostValue(options.outputBudget ?? options.output_budget, legacyByDimension.cost),
412
- encoding: resolveEncodingValue(options.outputFormat ?? options.output_format, legacyByDimension.encoding),
499
+ cost: explicitCost ?? {
500
+ source: "default",
501
+ value: budget.default_max_estimated_tokens_by_format[resolvedOutputFormat],
502
+ },
503
+ encoding,
413
504
  legacy_aliases_used: legacyAliasesUsed,
414
505
  migration_hints: migrationHints,
415
506
  precedence: READ_OUTPUT_PRECEDENCE,
@@ -525,6 +616,34 @@ function applyGetIncludeProjection(result, selectors) {
525
616
  };
526
617
  return projected;
527
618
  }
619
+ /** Count row objects that still carry at least one field. */
620
+ function countPopulatedRows(result) {
621
+ let populated = 0;
622
+ mapReadOutputRows({ ...result }, (entry) => {
623
+ if (isRecord(entry) && Object.keys(entry).length > 0)
624
+ populated += 1;
625
+ return entry;
626
+ });
627
+ return populated;
628
+ }
629
+ /**
630
+ * Refuse an include projection that strips every field from every row.
631
+ *
632
+ * Selectors that match no field are not a narrower answer, they are no answer:
633
+ * without this the surface returns the requested row count as empty objects and
634
+ * exits 0, so a mistyped or mode-shaped selector is indistinguishable from a
635
+ * workspace that genuinely holds nothing.
636
+ */
637
+ function rejectEmptyIncludeProjection(command, original, shaped, selectors) {
638
+ if (countPopulatedRows(original) === 0 || countPopulatedRows(shaped) > 0) {
639
+ return;
640
+ }
641
+ const modes = [...readOutputIncludeModeOptions(command).keys()];
642
+ const domain = modes.length > 0
643
+ ? ` Declared ${command} projection modes: ${modes.join(", ")}.`
644
+ : ` The ${command} surface declares no projection modes; name row fields instead.`;
645
+ throw new PmCliError(`Unknown --output-include selector(s) for ${command}: ${selectors.join(", ")}. No selector matched any returned row field.${domain}`, EXIT_CODE.USAGE);
646
+ }
528
647
  function applyIncludeProjection(command, result, selectors) {
529
648
  if (command === "get") {
530
649
  return applyGetIncludeProjection(result, selectors);
@@ -537,11 +656,10 @@ function applyIncludeProjection(command, result, selectors) {
537
656
  !rows.some((rowPath) => selector.startsWith(`${rowPath}.`)));
538
657
  if (rows.length > 0 && (!selectedRoot || qualifiedRowSelectors.length > 0)) {
539
658
  const projected = { ...result };
540
- return mapReadOutputRows(projected, (entry) => isRecord(entry)
541
- ? projectRecordFields(entry, qualifiedRowSelectors.length > 0
542
- ? qualifiedRowSelectors
543
- : selectors)
544
- : entry);
659
+ const rowSelectors = qualifiedRowSelectors.length > 0 ? qualifiedRowSelectors : selectors;
660
+ const shaped = mapReadOutputRows(projected, (entry) => isRecord(entry) ? projectRecordFields(entry, rowSelectors) : entry);
661
+ rejectEmptyIncludeProjection(command, result, shaped, rowSelectors);
662
+ return shaped;
545
663
  }
546
664
  return Object.fromEntries(Object.entries(result).filter(([key]) => selectors.some((selector) => selector.split(".")[0] === key) ||
547
665
  ENVELOPE_KEYS.has(key)));
@@ -565,7 +683,8 @@ function applyAmountBound(result, amount) {
565
683
  return bounded;
566
684
  }
567
685
  function requestedDimensions(resolved) {
568
- return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => resolved[dimension] !== undefined);
686
+ return PM_READ_OUTPUT_DIMENSIONS.filter((dimension) => resolved[dimension] !== undefined &&
687
+ resolved[dimension]?.source !== "default");
569
688
  }
570
689
  /** Stabilize the per-call and cross-call receipts in one complete envelope. */
571
690
  function attachReadOutputSessionContracts(result, state, receipt) {
@@ -611,19 +730,34 @@ function projectReadOutputRows(result, resolved, session) {
611
730
  /** Resolve the smallest binding per-call or remaining cross-call ceiling. */
612
731
  function resolveBindingReadOutputBudget(resolved, session) {
613
732
  const budgets = [
614
- ...(resolved.cost?.source === "canonical" ? [resolved.cost.value] : []),
733
+ ...(resolved.cost !== undefined &&
734
+ resolved.cost.value !== "unbounded" &&
735
+ (resolved.cost.source === "canonical" || resolved.cost.source === "default")
736
+ ? [{ source: resolved.cost.source, tokens: resolved.cost.value }]
737
+ : []),
615
738
  ...(session === undefined
616
739
  ? []
617
- : [readOutputSessionRemainingTokens(session)]),
740
+ : [
741
+ {
742
+ source: "session",
743
+ tokens: readOutputSessionRemainingTokens(session),
744
+ },
745
+ ]),
618
746
  ];
619
- return budgets.length === 0 ? undefined : Math.min(...budgets);
747
+ return budgets.sort((left, right) => left.tokens - right.tokens)[0];
620
748
  }
621
749
  /** Build the smallest truthful omission envelope or reject an exhausted session. */
622
- function omitReadOutputForBudget(resolved, requested, session, budget) {
750
+ function omitReadOutputForBudget(resolved, requested, session, bindingBudget, omittedResultEstimatedTokens) {
623
751
  const minimalReceipt = {
624
752
  contract_version: 1,
625
753
  command: resolved.command,
626
754
  requested_dimensions: requested,
755
+ ...(bindingBudget.source === "default"
756
+ ? {
757
+ budget_source: bindingBudget.source,
758
+ budget_tokens: bindingBudget.tokens,
759
+ }
760
+ : {}),
627
761
  precedence: resolved.precedence,
628
762
  legacy_aliases_used: [],
629
763
  migration_hints: [],
@@ -632,6 +766,9 @@ function omitReadOutputForBudget(resolved, requested, session, budget) {
632
766
  strings_compacted: false,
633
767
  rows_compacted: false,
634
768
  result_omitted: true,
769
+ ...(session === undefined
770
+ ? { omitted_result_estimated_tokens: omittedResultEstimatedTokens }
771
+ : {}),
635
772
  };
636
773
  const omitted = {
637
774
  output_budget_exceeded: {
@@ -647,11 +784,48 @@ function omitReadOutputForBudget(resolved, requested, session, budget) {
647
784
  if (session === undefined) {
648
785
  updateReadOutputReceiptEstimate(boundedOmission, minimalReceipt);
649
786
  }
650
- if (session !== undefined && minimalReceipt.estimated_tokens > budget) {
787
+ if (session !== undefined &&
788
+ minimalReceipt.estimated_tokens > bindingBudget.tokens) {
651
789
  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);
652
790
  }
653
791
  return boundedOmission;
654
792
  }
793
+ /** Decide whether shaping would add no value to an already-bounded result. */
794
+ function canReturnReadOutputUnchanged(resolved, requested, session, result) {
795
+ if (session !== undefined)
796
+ return false;
797
+ const canonicalRequestedCount = requested.filter((dimension) => resolved[dimension]?.source === "canonical").length;
798
+ if (resolved.cost?.value === "unbounded") {
799
+ return canonicalRequestedCount === 1;
800
+ }
801
+ if (resolved.cost?.source === "legacy" && canonicalRequestedCount === 0) {
802
+ return true;
803
+ }
804
+ return (canonicalRequestedCount === 0 &&
805
+ (resolved.cost === undefined ||
806
+ estimateReadOutputTokens(result) <= resolved.cost.value));
807
+ }
808
+ /**
809
+ * Disclose a budget-driven row drop in the envelope that carries it.
810
+ *
811
+ * `has_more` and `truncated` say that rows were withheld but not why, by what,
812
+ * or how to get them: the row-compaction path emits no continuation cursor, so
813
+ * without this an explicitly requested unbounded read is silently downgraded and
814
+ * the only working recovery is never named.
815
+ */
816
+ function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bindingBudget) {
817
+ if (!receipt.rows_compacted)
818
+ return;
819
+ const overridden = resolved.amount?.value === "unbounded" ? ["amount"] : [];
820
+ projected.output_budget_truncation = {
821
+ reason: "output_budget_reached",
822
+ budget_source: bindingBudget.source,
823
+ budget_tokens: bindingBudget.tokens,
824
+ overridden_dimensions: overridden,
825
+ compacted_row_paths: receipt.compacted_row_paths,
826
+ restore_with: "Re-run with --output-budget unbounded for the complete result.",
827
+ };
828
+ }
655
829
  /** Apply universal field, row, and token bounds and attach an exact receipt. */
656
830
  export function applyReadOutputDimensions(command, options, result) {
657
831
  const resolved = resolveReadOutputDimensions(command, options);
@@ -659,15 +833,21 @@ export function applyReadOutputDimensions(command, options, result) {
659
833
  return result;
660
834
  const session = parseReadOutputSession(options.outputSession ?? options.output_session);
661
835
  const requested = requestedDimensions(resolved);
662
- const canonicalRequested = requested.filter((dimension) => resolved[dimension]?.source === "canonical");
663
- if (canonicalRequested.length === 0 && session === undefined) {
836
+ if (canReturnReadOutputUnchanged(resolved, requested, session, result)) {
664
837
  return result;
665
838
  }
839
+ const bindingBudget = resolveBindingReadOutputBudget(resolved, session);
666
840
  let projected = projectReadOutputRows(result, resolved, session);
667
841
  const receipt = {
668
842
  contract_version: 1,
669
843
  command: resolved.command,
670
844
  requested_dimensions: requested,
845
+ ...(bindingBudget?.source === "default"
846
+ ? {
847
+ budget_source: bindingBudget.source,
848
+ budget_tokens: bindingBudget.tokens,
849
+ }
850
+ : {}),
671
851
  precedence: resolved.precedence,
672
852
  legacy_aliases_used: resolved.legacy_aliases_used,
673
853
  migration_hints: resolved.migration_hints,
@@ -683,15 +863,17 @@ export function applyReadOutputDimensions(command, options, result) {
683
863
  ? projected
684
864
  : attachReadOutputSessionContracts(projected, session, receipt);
685
865
  updateReadOutputReceiptEstimate(projected, receipt);
686
- const budget = resolveBindingReadOutputBudget(resolved, session);
687
- if (budget !== undefined && receipt.estimated_tokens > budget) {
688
- projected = compactReadOutputToBudget(projected, receipt, budget);
866
+ if (bindingBudget !== undefined &&
867
+ receipt.estimated_tokens > bindingBudget.tokens) {
868
+ projected = compactReadOutputToBudget(projected, receipt, bindingBudget.tokens);
869
+ attachReadOutputTruncationDisclosure(projected, resolved, receipt, bindingBudget);
689
870
  if (session !== undefined) {
690
871
  projected = attachReadOutputSessionContracts(projected, session, receipt);
691
872
  }
692
873
  }
693
- if (budget !== undefined && receipt.estimated_tokens > budget) {
694
- return omitReadOutputForBudget(resolved, requested, session, budget);
874
+ if (bindingBudget !== undefined &&
875
+ receipt.estimated_tokens > bindingBudget.tokens) {
876
+ return omitReadOutputForBudget(resolved, requested, session, bindingBudget, receipt.estimated_tokens);
695
877
  }
696
878
  return projected;
697
879
  }
@@ -710,4 +892,4 @@ export function resolveReadOutputEncoding(command, options) {
710
892
  : undefined;
711
893
  }
712
894
  //# sourceMappingURL=read-output-contracts.js.map
713
- //# debugId=0ab0c72c-cac0-5670-93d1-7a446f8a2301
895
+ //# debugId=c78ba845-78ae-5b16-b486-c279f834d601
@@ -15,6 +15,17 @@ export interface PmReadOutputRowCollection {
15
15
  export declare function readOutputRowPaths(result: Record<string, unknown>): string[];
16
16
  /** Resolve every declared row path that currently contains iterable rows. */
17
17
  export declare function readOutputRowCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
18
+ /**
19
+ * Discover every collection the token-budget degradation ladder may reduce.
20
+ *
21
+ * Ordinary field and amount projections stay bound to declared row paths (or
22
+ * top-level array fallbacks), because a nested tag list is not an independent
23
+ * result row. Budget degradation has a different obligation: it must exhaust
24
+ * nested content collections before omitting the whole useful result. This
25
+ * census therefore adds nested arrays while excluding receipt/envelope metadata
26
+ * whose mutation would make the disclosure itself incomplete.
27
+ */
28
+ export declare function readOutputBudgetCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
18
29
  /** Count array entries and object-map values across declared row collections. */
19
30
  export declare function countReadOutputRows(result: Record<string, unknown>): number;
20
31
  /**
@@ -5,7 +5,20 @@
5
5
  * envelopes, including dot-delimited nested paths used by graph projections.
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]="ae6fbd4a-6c4e-5639-93ac-f107a336e95b")}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]="03e25a43-f05c-5bc6-a42a-140914e522d5")}catch(e){}}();
9
+ const BUDGET_METADATA_ROOT_KEYS = new Set([
10
+ "applied_bound",
11
+ "completeness",
12
+ "continuation_contract",
13
+ "filters",
14
+ "omission_receipt",
15
+ "output_budget_truncation",
16
+ "projection",
17
+ "read_output",
18
+ "read_session",
19
+ "row_contract",
20
+ "sorting",
21
+ ]);
9
22
  function isRecord(value) {
10
23
  return value !== null && typeof value === "object" && !Array.isArray(value);
11
24
  }
@@ -54,6 +67,38 @@ export function readOutputRowCollections(result) {
54
67
  : [];
55
68
  });
56
69
  }
70
+ /**
71
+ * Discover every collection the token-budget degradation ladder may reduce.
72
+ *
73
+ * Ordinary field and amount projections stay bound to declared row paths (or
74
+ * top-level array fallbacks), because a nested tag list is not an independent
75
+ * result row. Budget degradation has a different obligation: it must exhaust
76
+ * nested content collections before omitting the whole useful result. This
77
+ * census therefore adds nested arrays while excluding receipt/envelope metadata
78
+ * whose mutation would make the disclosure itself incomplete.
79
+ */
80
+ export function readOutputBudgetCollections(result) {
81
+ const collections = readOutputRowCollections(result);
82
+ const declaredPaths = new Set(collections.map((collection) => collection.path));
83
+ const visit = (value, path) => {
84
+ if (Array.isArray(value)) {
85
+ if (!declaredPaths.has(path)) {
86
+ collections.push({ path, value });
87
+ }
88
+ value.forEach((entry, index) => visit(entry, `${path}.${index}`));
89
+ return;
90
+ }
91
+ if (!isRecord(value))
92
+ return;
93
+ for (const [key, entry] of Object.entries(value)) {
94
+ if (path.length === 0 && BUDGET_METADATA_ROOT_KEYS.has(key))
95
+ continue;
96
+ visit(entry, path.length === 0 ? key : `${path}.${key}`);
97
+ }
98
+ };
99
+ visit(result, "");
100
+ return collections;
101
+ }
57
102
  /** Count array entries and object-map values across declared row collections. */
58
103
  export function countReadOutputRows(result) {
59
104
  return readOutputRowCollections(result).reduce((total, collection) => total +
@@ -97,4 +142,4 @@ export function boundReadOutputRows(result, amount) {
97
142
  return { result: projected, truncated };
98
143
  }
99
144
  //# sourceMappingURL=read-output-rows.js.map
100
- //# debugId=ae6fbd4a-6c4e-5639-93ac-f107a336e95b
145
+ //# debugId=03e25a43-f05c-5bc6-a42a-140914e522d5
@@ -5,13 +5,13 @@
5
5
  * optimistic concurrency, deterministic replay, snapshots, and cursor pages.
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]="c53bb1b7-12b9-5370-a85b-cdd8bef57936")}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]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch(e){}}();
9
9
  import { createQueryFingerprint, decodeQueryCursorState, paginateQueryRows, } from "./pagination.js";
10
10
  import { constants } from "node:fs";
11
11
  import { lstat, mkdir, open } from "node:fs/promises";
12
12
  import path from "node:path";
13
13
  import { acquireLock } from "../core/lock/lock.js";
14
- import { writeFileAtomic } from "../core/fs/fs-utils.js";
14
+ import { isFileMissingError, writeFileAtomic } from "../core/fs/fs-utils.js";
15
15
  import { stableStringify } from "../core/shared/serialization.js";
16
16
  import { RelationshipGraph, createRelationshipKindRegistry, } from "./relationships.js";
17
17
  function requiredText(value, field) {
@@ -298,7 +298,7 @@ async function resolveRelationshipEventStorePath(pmRoot, relativePath = "relatio
298
298
  throw new TypeError("Relationship event path must not contain symbolic links");
299
299
  }
300
300
  catch (error) {
301
- if (error.code === "ENOENT")
301
+ if (isFileMissingError(error))
302
302
  break;
303
303
  throw error;
304
304
  }
@@ -314,7 +314,7 @@ async function loadRelationshipEventLog(target, nodes, registry) {
314
314
  raw = await handle.readFile("utf8");
315
315
  }
316
316
  catch (error) {
317
- if (error.code === "ENOENT")
317
+ if (isFileMissingError(error))
318
318
  return { log, raw: "" };
319
319
  throw error;
320
320
  }
@@ -517,4 +517,4 @@ export class RelationshipEventStore {
517
517
  }
518
518
  }
519
519
  //# sourceMappingURL=relationship-history.js.map
520
- //# debugId=c53bb1b7-12b9-5370-a85b-cdd8bef57936
520
+ //# debugId=bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47
@@ -18,7 +18,7 @@ export { type HistoryDiffValueEntry, computeHistoryDiff, patchPathToChangedField
18
18
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
19
19
  export { appendHistoryEntry, CURRENT_HISTORY_ITEM_HASH_VERSION, createHistoryEntry, hashDocument, hashDocumentForVersion, hashEmptyDocument, SUPPORTED_HISTORY_ITEM_HASH_VERSIONS, type HistoryItemHashVersion, } from "../core/history/history.js";
20
20
  export { readHistoryEntries } from "../core/history/read.js";
21
- export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceJsonMutation, type WorkspaceJsonMutationOptions, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
21
+ export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, mutateWorkspaceJsonWithHistory, reconcileWorkspaceJsonHistory, restoreWorkspaceJsonFromHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceHistoryStateAgreement, type WorkspaceJsonMutation, type WorkspaceJsonMutationOptions, type WorkspaceJsonReconciliationOptions, type WorkspaceJsonRestoreOptions, type WorkspaceJsonRestoreResult, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
22
22
  export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
23
23
  export { resolveBodyFileContent } from "../core/io/body-file.js";
24
24
  export { generateItemId, normalizeItemId, normalizeRawItemId, } from "../core/item/id.js";
@@ -7,7 +7,7 @@
7
7
  * prefer the typed operations exported by the main SDK barrel.
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]="78779372-1987-54d0-9ae4-775b52641a26")}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]="a678b9f8-ba36-5127-877f-96bb4acc38c5")}catch(e){}}();
11
11
  export { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
12
12
  export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
13
13
  export { createUnknownSubcommandError, } from "./agent/subcommand-recovery.js";
@@ -20,7 +20,7 @@ export { computeHistoryDiff, patchPathToChangedField, } from "../core/history/hi
20
20
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
21
21
  export { appendHistoryEntry, CURRENT_HISTORY_ITEM_HASH_VERSION, createHistoryEntry, hashDocument, hashDocumentForVersion, hashEmptyDocument, SUPPORTED_HISTORY_ITEM_HASH_VERSIONS, } from "../core/history/history.js";
22
22
  export { readHistoryEntries } from "../core/history/read.js";
23
- export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
23
+ export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, mutateWorkspaceJsonWithHistory, reconcileWorkspaceJsonHistory, restoreWorkspaceJsonFromHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
24
24
  export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
25
25
  export { resolveBodyFileContent } from "../core/io/body-file.js";
26
26
  export { generateItemId, normalizeItemId, normalizeRawItemId, } from "../core/item/id.js";
@@ -81,4 +81,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
81
81
  export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
82
82
  export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
83
83
  //# sourceMappingURL=runtime-primitives.js.map
84
- //# debugId=78779372-1987-54d0-9ae4-775b52641a26
84
+ //# debugId=a678b9f8-ba36-5127-877f-96bb4acc38c5
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Runtime.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7c27b516-1714-5f2b-8304-98e8372280be")}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]="a387cd7a-cb16-5082-80e1-9632ebd02480")}catch(e){}}();
8
8
  export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, } from "./workspace.js";
9
9
  export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
10
10
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -31,7 +31,7 @@ import { createExtensionCommandSdk } from "./extension-command-context.js";
31
31
  import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
32
32
  import { applyContextIntentProjection, attachReadOutputContracts, } from "./context-intent-contracts.js";
33
33
  import { runWithDiscoveredContextIntentContracts, } from "./context-intent-runtime.js";
34
- import { validateReadOutputOptions, } from "./read-output-contracts.js";
34
+ import { normalizeReadOutputIncludeModeOptions, validateReadOutputOptions, } from "./read-output-contracts.js";
35
35
  export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
36
36
  import { normalizeActivityProjectionOptions, runActivity, } from "./query/activity.js";
37
37
  import { runAssuranceDispatch } from "./governance/assurance-action.js";
@@ -1870,6 +1870,7 @@ export function analyzeSdkActionCoverage(actions = PM_TOOL_ACTIONS) {
1870
1870
  async function dispatchAction(action, args, global, activeExtensions) {
1871
1871
  const options = optionsWithAuthor(args, action);
1872
1872
  validateReadOutputOptions(action, options);
1873
+ normalizeReadOutputIncludeModeOptions(action, options);
1873
1874
  const ctx = {
1874
1875
  action,
1875
1876
  args,
@@ -1883,6 +1884,7 @@ async function dispatchAction(action, args, global, activeExtensions) {
1883
1884
  const result = handler
1884
1885
  ? await handler(ctx)
1885
1886
  : await dispatchActiveExtensionAction(action, args, options, global, activeExtensions);
1887
+ options.resolvedOutputFormat = "json";
1886
1888
  return attachReadOutputContracts(action, options, result);
1887
1889
  }
1888
1890
  const actionRunnerTestHooks = {
@@ -1930,4 +1932,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
1930
1932
  }
1931
1933
  }
1932
1934
  //# sourceMappingURL=runtime.js.map
1933
- //# debugId=7c27b516-1714-5f2b-8304-98e8372280be
1935
+ //# debugId=a387cd7a-cb16-5082-80e1-9632ebd02480
@@ -7,11 +7,11 @@
7
7
  * guarantees.
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]="7d175791-016d-59b6-a44d-a70371f36751")}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]="cd777de3-665f-5e01-ac98-8986f2a5a4c2")}catch(e){}}();
11
11
  import { createHash } from "node:crypto";
12
12
  import fs from "node:fs/promises";
13
13
  import path from "node:path";
14
- import { pathExists, readFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
14
+ import { isFileMissingError, pathExists, readFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
15
15
  import { appendWorkspaceHistoryChange } from "../core/history/workspace-history.js";
16
16
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
17
17
  import { parseFieldsFile, serializeFieldsFile, } from "../core/schema/fields-file.js";
@@ -681,7 +681,7 @@ async function collectSchemaReferenceState(params) {
681
681
  if (typeof error !== "object" ||
682
682
  error === null ||
683
683
  !("code" in error) ||
684
- error.code !== "ENOENT") {
684
+ !isFileMissingError(error)) {
685
685
  throw error;
686
686
  }
687
687
  }
@@ -855,4 +855,4 @@ export const schemaMigrationTestOnly = {
855
855
  validateAndStoreMigrationPlan,
856
856
  };
857
857
  //# sourceMappingURL=schema-migration.js.map
858
- //# debugId=7d175791-016d-59b6-a44d-a70371f36751
858
+ //# debugId=cd777de3-665f-5e01-ac98-8986f2a5a4c2