@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
@@ -37,6 +37,14 @@ export interface HistoryVerificationResult {
37
37
  current_item_hash?: string;
38
38
  /** Whether the supplied document matches the newest history hash. */
39
39
  current_matches_latest?: boolean;
40
+ /** Whether every governed workspace singleton matches the latest replayed state. */
41
+ workspace_state_matches_latest?: boolean;
42
+ /** Governed singleton paths whose JSON differs from the replayed value. */
43
+ workspace_state_mismatches?: string[];
44
+ /** Governed singleton paths absent from disk. */
45
+ workspace_state_missing?: string[];
46
+ /** Governed singleton paths unreadable as safe workspace-local JSON. */
47
+ workspace_state_unreadable?: string[];
40
48
  }
41
49
  /**
42
50
  * Verify a history chain and optionally compare it with a current document.
@@ -7,7 +7,7 @@
7
7
  * systems without acquiring locks or appending history.
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]="bccbd81b-988f-569d-8dbf-c0998d813953")}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]="04f5d4d2-4021-5ce2-b35a-2134d98d2ad7")}catch(e){}}();
11
11
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
12
12
  import { pathExists } from "../core/fs/fs-utils.js";
13
13
  import { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, replayHistoryToTarget, resolveHistoryTarget, } from "../core/history/projection.js";
@@ -85,4 +85,4 @@ export async function getItemAt(id, target, options = {}) {
85
85
  }
86
86
  export { applyHistoryPatch, ensureMaterializedHistoryTarget, extractPatchFailureContext, readHistoryEntries, replayHistoryToTarget, resolveHistoryTarget, };
87
87
  //# sourceMappingURL=history-read.js.map
88
- //# debugId=bccbd81b-988f-569d-8dbf-c0998d813953
88
+ //# debugId=04f5d4d2-4021-5ce2-b35a-2134d98d2ad7
@@ -58,6 +58,7 @@ export * from "./compose.js";
58
58
  export * from "./governance/assurance.js";
59
59
  export * from "./governance/assurance-action.js";
60
60
  export * from "./governance/assurance-runtime.js";
61
+ export * from "./governance/assurance-presets.js";
61
62
  export * from "./compile-cache.js";
62
63
  export * from "./environment/project-runtime-compatibility.js";
63
64
  export * from "./environment/source-context.js";
@@ -83,7 +84,7 @@ export * from "./history-compact.js";
83
84
  export * from "./history-read.js";
84
85
  export * from "./history-provenance.js";
85
86
  export * from "./mutation-events.js";
86
- 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";
87
+ 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";
87
88
  export * from "./history-redact.js";
88
89
  export { _testOnly } from "./history-redact.js";
89
90
  export * from "./history-repair.js";
@@ -94,7 +95,7 @@ export { runDeps, type DepsCollapseMode, type DepsFormat, type DepsGraphEdge, ty
94
95
  export * from "./graph/index.js";
95
96
  export { runDocs } from "./docs.js";
96
97
  export { runFiles, runFilesDiscover, runFilesLookup, type FilesDiscoveryCandidate, type FilesLookupItem, type FilesLookupMatch, } from "./files.js";
97
- export { applyPathMigrations, applyStandaloneNote, artifactKey, dedupeLinkedArtifacts, ensureScope, expandAddGlobEntries, normalizeLinkedPath, parseAddEntries, parseAddGlobEntries, parseMigrateEntries, parseRemoveEntries, renameArtifactsResultKey, runLinkedArtifacts, sortLinkedArtifacts, validateLinkedPaths, type AddGlobEntry, type LinkedArtifact, type LinkedArtifactCommandOptions, type LinkedArtifactKindConfig, type LinkedArtifactResult, type LinkedPathValidation, type PathMigration, } from "./linked-artifacts.js";
98
+ export { applyPathMigrations, applyStandaloneNote, artifactKey, assertLinkedArtifactMutationIsUnambiguous, dedupeLinkedArtifacts, ensureScope, expandAddGlobEntries, normalizeLinkedPath, parseAddEntries, parseAddGlobEntries, parseMigrateEntries, parseRemoveEntries, renameArtifactsResultKey, runLinkedArtifacts, sortLinkedArtifacts, validateLinkedPaths, type AddGlobEntry, type LinkedArtifact, type LinkedArtifactCommandOptions, type LinkedArtifactKindConfig, type LinkedArtifactResult, type LinkedPathValidation, type PathMigration, } from "./linked-artifacts.js";
98
99
  export * from "./pagination.js";
99
100
  export * from "./query/item-filter-options.js";
100
101
  export * from "./query/parsers.js";
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Index.
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]="14672b89-6a87-59a0-8164-6b01a9c91ee1")}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]="a05170b2-a48d-5275-ac04-aafc9f8315b2")}catch(e){}}();
8
8
  export { PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
9
9
  export * from "./agent-session-context.js";
10
10
  export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
@@ -56,6 +56,7 @@ export * from "./compose.js";
56
56
  export * from "./governance/assurance.js";
57
57
  export * from "./governance/assurance-action.js";
58
58
  export * from "./governance/assurance-runtime.js";
59
+ export * from "./governance/assurance-presets.js";
59
60
  export * from "./compile-cache.js";
60
61
  export * from "./environment/project-runtime-compatibility.js";
61
62
  export * from "./environment/source-context.js";
@@ -81,7 +82,7 @@ export * from "./history-compact.js";
81
82
  export * from "./history-read.js";
82
83
  export * from "./history-provenance.js";
83
84
  export * from "./mutation-events.js";
84
- export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
85
+ export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, mutateWorkspaceJsonWithHistory, reconcileWorkspaceJsonHistory, restoreWorkspaceJsonFromHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
85
86
  export * from "./history-redact.js";
86
87
  export { _testOnly } from "./history-redact.js";
87
88
  export * from "./history-repair.js";
@@ -92,7 +93,7 @@ export { runDeps, } from "./dependencies.js";
92
93
  export * from "./graph/index.js";
93
94
  export { runDocs } from "./docs.js";
94
95
  export { runFiles, runFilesDiscover, runFilesLookup, } from "./files.js";
95
- export { applyPathMigrations, applyStandaloneNote, artifactKey, dedupeLinkedArtifacts, ensureScope, expandAddGlobEntries, normalizeLinkedPath, parseAddEntries, parseAddGlobEntries, parseMigrateEntries, parseRemoveEntries, renameArtifactsResultKey, runLinkedArtifacts, sortLinkedArtifacts, validateLinkedPaths, } from "./linked-artifacts.js";
96
+ export { applyPathMigrations, applyStandaloneNote, artifactKey, assertLinkedArtifactMutationIsUnambiguous, dedupeLinkedArtifacts, ensureScope, expandAddGlobEntries, normalizeLinkedPath, parseAddEntries, parseAddGlobEntries, parseMigrateEntries, parseRemoveEntries, renameArtifactsResultKey, runLinkedArtifacts, sortLinkedArtifacts, validateLinkedPaths, } from "./linked-artifacts.js";
96
97
  export * from "./pagination.js";
97
98
  export * from "./query/item-filter-options.js";
98
99
  export * from "./query/parsers.js";
@@ -150,4 +151,4 @@ export * from "./governance.js";
150
151
  export * from "./query.js";
151
152
  export * from "./testing.js";
152
153
  //# sourceMappingURL=index.js.map
153
- //# debugId=14672b89-6a87-59a0-8164-6b01a9c91ee1
154
+ //# debugId=a05170b2-a48d-5275-ac04-aafc9f8315b2
@@ -115,6 +115,8 @@ export declare function parseRemoveEntries(raw: string[] | undefined): string[];
115
115
  export declare function parseMigrateEntries(raw: string[] | undefined): PathMigration[];
116
116
  /** Implements apply path migrations for the public runtime surface of this module. */
117
117
  export declare function applyPathMigrations(artifactPath: string, migrations: PathMigration[]): string;
118
+ /** Reject a transaction that resolves the same linked path into both add and remove sets. */
119
+ export declare function assertLinkedArtifactMutationIsUnambiguous(adds: LinkedArtifact[], removes: string[], migrations?: PathMigration[]): void;
118
120
  /** Implements normalize linked path for the public runtime surface of this module. */
119
121
  export declare function normalizeLinkedPath(value: string): string;
120
122
  /** Anchor a local linked path to the project workspace while preserving remote references and absolute paths. */
@@ -4,11 +4,11 @@
4
4
  * Implements the pm linked artifacts command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3fe80124-596b-591c-9f0d-fbbc129c6bb4")}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]="585364aa-e5ff-56b6-8276-8f741fbd6be4")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import fg from "fast-glob";
11
- import { pathExists } from "../core/fs/fs-utils.js";
11
+ import { isFileAbsentError, pathExists } from "../core/fs/fs-utils.js";
12
12
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
13
13
  import { assertNoUnknownCsvKeys, createStdinTokenResolver, looksLikeGenericKeyValueEntry, parseCsvKv, } from "../core/item/parse.js";
14
14
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
@@ -179,6 +179,30 @@ export function applyPathMigrations(artifactPath, migrations) {
179
179
  }
180
180
  return next;
181
181
  }
182
+ /** Reject a transaction that resolves the same linked path into both add and remove sets. */
183
+ export function assertLinkedArtifactMutationIsUnambiguous(adds, removes, migrations = []) {
184
+ if (adds.length === 0 || removes.length === 0) {
185
+ return;
186
+ }
187
+ const addedPaths = new Set(adds.map((entry) => applyPathMigrations(entry.path, migrations)));
188
+ const conflicts = [
189
+ ...new Set(removes
190
+ .map((entry) => applyPathMigrations(entry, migrations))
191
+ .filter((entry) => addedPaths.has(entry))),
192
+ ].sort((left, right) => left.localeCompare(right));
193
+ if (conflicts.length === 0) {
194
+ return;
195
+ }
196
+ throw new PmCliError(`Linked artifact mutation cannot add and remove the same normalized path in one transaction: ${conflicts.join(", ")}. Split the replacement into separate commands so each history event has one unambiguous intent.`, EXIT_CODE.USAGE, {
197
+ code: "linked_artifact_mutation_conflict",
198
+ reason: "same_path_added_and_removed",
199
+ required: "Use distinct normalized paths for --add and --remove in one invocation.",
200
+ why: "Conflicting batch intent cannot be applied deterministically without silently discarding metadata or a removal.",
201
+ nextSteps: [
202
+ "Run the removal and addition as separate commands with a --message describing each intent.",
203
+ ],
204
+ });
205
+ }
182
206
  /** Implements normalize linked path for the public runtime surface of this module. */
183
207
  export function normalizeLinkedPath(value) {
184
208
  return value.split(path.sep).join("/");
@@ -293,7 +317,7 @@ export async function validateLinkedPaths(paths, workspaceRoot = process.cwd())
293
317
  if (typeof error === "object" &&
294
318
  error !== null &&
295
319
  "code" in error &&
296
- error.code === "ENOENT") {
320
+ isFileAbsentError(error)) {
297
321
  missingPaths.push(relativePath);
298
322
  continue;
299
323
  }
@@ -384,6 +408,7 @@ export async function runLinkedArtifacts(id, options, global, config) {
384
408
  const adds = applyStandaloneNote([...parsedAdds, ...expandedGlobAdds], options.note, parsedAdds.length > 0 || addGlobs.length > 0);
385
409
  const removes = parseRemoveEntries(resolvedRemoves).map((entry) => anchorLinkedPath(entry, workspaceRoot, invocationRoot));
386
410
  const migrations = parseMigrateEntries(resolvedMigrations);
411
+ assertLinkedArtifactMutationIsUnambiguous(adds, removes, migrations);
387
412
  const shouldMutate = adds.length > 0 || removes.length > 0 || migrations.length > 0;
388
413
  if (!shouldMutate) {
389
414
  const located = await locateItem(pmRoot, id, settings.id_prefix, settings.item_format, typeRegistry.type_to_folder);
@@ -454,4 +479,4 @@ export function renameArtifactsResultKey(result, key) {
454
479
  return out;
455
480
  }
456
481
  //# sourceMappingURL=linked-artifacts.js.map
457
- //# debugId=3fe80124-596b-591c-9f0d-fbbc129c6bb4
482
+ //# debugId=585364aa-e5ff-56b6-8276-8f741fbd6be4
@@ -8,7 +8,8 @@
8
8
  * mutations refresh the fenced block automatically once it is installed.
9
9
  */
10
10
 
11
- !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]="94d2a7a8-ce00-5689-b2f6-3d4813234b55")}catch(e){}}();
11
+ !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]="5e1810a5-04b8-5929-8eee-7a63f1684860")}catch(e){}}();
12
+ import { isFileMissingError } from "../../core/fs/fs-utils.js";
12
13
  import { readFile, realpath, writeFile } from "node:fs/promises";
13
14
  import { execFile } from "node:child_process";
14
15
  import path from "node:path";
@@ -253,7 +254,7 @@ async function reconcileGitattributesBlock(workspaceRoot, patterns, dryRun) {
253
254
  current = await readFile(gitattributesPath, "utf8");
254
255
  }
255
256
  catch (error) {
256
- if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) {
257
+ if (!(error instanceof Error && "code" in error && isFileMissingError(error))) {
257
258
  throw error;
258
259
  }
259
260
  }
@@ -414,7 +415,7 @@ export async function refreshMergeAttributeFenceIfInstalled(pmRoot) {
414
415
  catch (error) {
415
416
  if (error instanceof Error &&
416
417
  "code" in error &&
417
- error.code === "ENOENT") {
418
+ isFileMissingError(error)) {
418
419
  return { status: "not_installed", path: gitattributesPath };
419
420
  }
420
421
  throw error;
@@ -560,4 +561,4 @@ export async function installMergeFence(options) {
560
561
  };
561
562
  }
562
563
  //# sourceMappingURL=install.js.map
563
- //# debugId=94d2a7a8-ce00-5689-b2f6-3d4813234b55
564
+ //# debugId=5e1810a5-04b8-5929-8eee-7a63f1684860
@@ -4,7 +4,8 @@
4
4
  * Implements the pm activity command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="27a71d4d-f496-5d0a-9771-caa43b81e1f7")}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]="49304d18-d722-5413-8e4d-4f2c3df4a1ca")}catch(e){}}();
8
+ import { isFileMissingError } from "../../core/fs/fs-utils.js";
8
9
  import fs from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { getActiveExtensionRegistrations, runActiveOnReadHooks, pathExists, enforceHistoryStreamPolicyForItems, resolveItemTypeRegistry, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, resolveIsoOrRelative, listAllItemMetadataLight, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
@@ -107,7 +108,7 @@ async function listHistoryFiles(historyDir) {
107
108
  }
108
109
  catch (error) {
109
110
  // Activity should degrade gracefully when optional history storage is absent.
110
- if (error.code === "ENOENT") {
111
+ if (isFileMissingError(error)) {
111
112
  return [];
112
113
  }
113
114
  throw error;
@@ -399,4 +400,4 @@ export async function runActivity(options, global) {
399
400
  };
400
401
  }
401
402
  //# sourceMappingURL=activity.js.map
402
- //# debugId=27a71d4d-f496-5d0a-9771-caa43b81e1f7
403
+ //# debugId=49304d18-d722-5413-8e4d-4f2c3df4a1ca
@@ -4,8 +4,8 @@
4
4
  * Implements the pm history command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1638ef81-7558-5d51-8561-99c958de2d03")}catch(e){}}();
8
- import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, getSettingsPath, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
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]="f18d7526-01eb-593b-bf50-788c08a35e5d")}catch(e){}}();
8
+ import { pathExists, computeHistoryDiff, patchPathToChangedField, normalizeReplayPatchOps, verifyHistoryChain, enforceHistoryStreamPolicyForItem, EXIT_CODE, PmCliError, getActiveExtensionRegistrations, normalizeItemId, resolveItemTypeRegistry, locateItem, readLocatedItem, getHistoryPath, getWorkspaceHistoryPath, inspectWorkspaceHistoryState, getSettingsPath, resolvePmRoot, readSettings, WORKSPACE_HISTORY_ID, } from "../runtime-primitives.js";
9
9
  import { readHistoryEntries, verifyHistoryEntries, } from "../history-read.js";
10
10
  export { readHistoryEntries } from "../history-read.js";
11
11
  import { parseLimit } from "./parsers.js";
@@ -140,8 +140,25 @@ export async function runHistory(id, options, global) {
140
140
  })).document
141
141
  : undefined;
142
142
  result.verification = verifyHistoryEntries(fullHistory, currentDocument);
143
+ if (resolvedId === WORKSPACE_HISTORY_ID && result.verification.ok) {
144
+ const agreement = await inspectWorkspaceHistoryState(resolvePmRoot(process.cwd(), global.path));
145
+ result.verification = {
146
+ ...result.verification,
147
+ ok: agreement.ok,
148
+ errors: agreement.ok
149
+ ? result.verification.errors
150
+ : [
151
+ ...result.verification.errors,
152
+ "verify_failed:workspace_state_mismatch",
153
+ ],
154
+ workspace_state_matches_latest: agreement.ok,
155
+ workspace_state_mismatches: agreement.mismatched_documents,
156
+ workspace_state_missing: agreement.missing_documents,
157
+ workspace_state_unreadable: agreement.unreadable_documents,
158
+ };
159
+ }
143
160
  }
144
161
  return result;
145
162
  }
146
163
  //# sourceMappingURL=history.js.map
147
- //# debugId=1638ef81-7558-5d51-8561-99c958de2d03
164
+ //# debugId=f18d7526-01eb-593b-bf50-788c08a35e5d
@@ -5,6 +5,8 @@
5
5
  * read-output contract without expanding its public declaration module.
6
6
  */
7
7
  import type { PmReadOutputReceipt } from "./read-output-contracts.js";
8
+ /** Estimate the conservative token cost of a JSON-shaped result. */
9
+ export declare function estimateReadOutputTokens(result: unknown): number;
8
10
  /** Update a receipt to the fixed-point estimate of the result containing it. */
9
11
  export declare function updateReadOutputReceiptEstimate(result: Record<string, unknown>, receipt: PmReadOutputReceipt): void;
10
12
  /** Compact strings and rows in place, then return the final exact estimate. */
@@ -1,8 +1,12 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1726fdce-dc71-5707-ae75-b588691e813d")}catch(e){}}();
3
- import { countReadOutputRows, readOutputRowCollections, } from "./read-output-rows.js";
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cc595424-0176-5920-8f4c-d935e6a546ce")}catch(e){}}();
3
+ import { countReadOutputRows, readOutputBudgetCollections, } from "./read-output-rows.js";
4
4
  const MAX_ESTIMATE_ITERATIONS = 8;
5
5
  const MAX_COMPACTION_ITERATIONS = 64;
6
+ /** Estimate the conservative token cost of a JSON-shaped result. */
7
+ export function estimateReadOutputTokens(result) {
8
+ return Math.ceil(Buffer.byteLength(JSON.stringify(result), "utf8") / 4);
9
+ }
6
10
  /** Return whether a value is a non-array object record. */
7
11
  function isRecord(value) {
8
12
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -30,7 +34,7 @@ export function updateReadOutputReceiptEstimate(result, receipt) {
30
34
  let estimate = receipt.estimated_tokens;
31
35
  for (let iteration = 0; iteration < MAX_ESTIMATE_ITERATIONS; iteration += 1) {
32
36
  receipt.estimated_tokens = estimate;
33
- const measured = Math.ceil(Buffer.byteLength(JSON.stringify(result), "utf8") / 4);
37
+ const measured = estimateReadOutputTokens(result);
34
38
  if (measured === estimate)
35
39
  return;
36
40
  estimate = measured;
@@ -43,7 +47,7 @@ function compactRowsToBudget(result, receipt, budget) {
43
47
  updateReadOutputReceiptEstimate(result, receipt);
44
48
  if (receipt.estimated_tokens <= budget)
45
49
  return;
46
- const candidate = readOutputRowCollections(result)
50
+ const candidate = readOutputBudgetCollections(result)
47
51
  .filter((collection) => (Array.isArray(collection.value)
48
52
  ? collection.value.length
49
53
  : Object.keys(collection.value).length) > 1)
@@ -67,6 +71,9 @@ function compactRowsToBudget(result, receipt, budget) {
67
71
  }
68
72
  }
69
73
  receipt.rows_compacted = true;
74
+ receipt.compacted_row_paths = [
75
+ ...new Set([...(receipt.compacted_row_paths ?? []), candidate.path]),
76
+ ].sort((left, right) => left.localeCompare(right));
70
77
  result.has_more = true;
71
78
  result.truncated = true;
72
79
  if (typeof result.count === "number") {
@@ -85,4 +92,4 @@ export function compactReadOutputToBudget(result, receipt, budget) {
85
92
  return compacted;
86
93
  }
87
94
  //# sourceMappingURL=read-output-budget.js.map
88
- //# debugId=1726fdce-dc71-5707-ae75-b588691e813d
95
+ //# debugId=cc595424-0176-5920-8f4c-d935e6a546ce
@@ -4,7 +4,7 @@ export declare const PM_READ_OUTPUT_DIMENSIONS: readonly ["include", "amount", "
4
4
  /** One member of the universal read-output dimension set. */
5
5
  export type PmReadOutputDimension = (typeof PM_READ_OUTPUT_DIMENSIONS)[number];
6
6
  /** Built-in command roots whose primary operation is a read. */
7
- export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-manage"];
7
+ export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-manage", "comments-audit", "assurance"];
8
8
  /** Built-in read command supported by the universal output contract. */
9
9
  export type PmReadOutputSurface = (typeof PM_READ_OUTPUT_SURFACES)[number];
10
10
  /** Canonical output controls accepted by every built-in read action. */
@@ -13,8 +13,8 @@ export interface PmReadOutputOptions {
13
13
  outputInclude?: string | string[];
14
14
  /** Maximum rows retained, or `unbounded` to disable the shared row ceiling. */
15
15
  outputLimit?: string | number | "unbounded";
16
- /** Maximum estimated result tokens. */
17
- outputBudget?: string | number;
16
+ /** Maximum estimated result tokens, or `unbounded` to disable the default ceiling. */
17
+ outputBudget?: string | number | "unbounded";
18
18
  /** Requested static renderer encoding; streaming remains a command behavior. */
19
19
  outputFormat?: "json" | "toon";
20
20
  /** Caller-carried cross-call budget and served-fact state. */
@@ -26,6 +26,8 @@ export interface PmReadOutputOptions {
26
26
  export interface PmReadOutputLegacyAlias {
27
27
  /** Historical CLI spelling. */
28
28
  flag: string;
29
+ /** Strength of the migration promise carried by this alias. */
30
+ semantics?: "replacement" | "behavior_preserving";
29
31
  /** One-line migration instruction for agents and help generators. */
30
32
  migration_hint: string;
31
33
  /** Compatibility aliases are accepted but omitted from the canonical vocabulary. */
@@ -70,8 +72,8 @@ export interface PmResolvedReadOutputDimensions {
70
72
  include?: PmResolvedReadOutputDimension<string[]>;
71
73
  /** Requested row ceiling. */
72
74
  amount?: PmResolvedReadOutputDimension<number | "unbounded">;
73
- /** Requested estimated-token ceiling. */
74
- cost?: PmResolvedReadOutputDimension<number>;
75
+ /** Requested estimated-token ceiling or explicit opt-out. */
76
+ cost?: PmResolvedReadOutputDimension<number | "unbounded">;
75
77
  /** Requested static encoding or a retained legacy streaming behavior. */
76
78
  encoding?: PmResolvedReadOutputDimension<"json" | "toon" | "stream">;
77
79
  /** Compatibility flags observed on the invocation. */
@@ -89,6 +91,10 @@ export interface PmReadOutputReceipt {
89
91
  command: PmReadOutputSurface;
90
92
  /** Dimensions explicitly or compatibly requested by the invocation. */
91
93
  requested_dimensions: PmReadOutputDimension[];
94
+ /** Layer that supplied an automatically applied token ceiling. */
95
+ budget_source?: "default";
96
+ /** Automatically applied token ceiling; explicit/session budgets already disclose their value. */
97
+ budget_tokens?: number;
92
98
  /** Deterministic precedence used during resolution. */
93
99
  precedence: readonly ["canonical", "legacy", "intent", "default"];
94
100
  /** Compatibility options observed on the invocation. */
@@ -103,8 +109,27 @@ export interface PmReadOutputReceipt {
103
109
  strings_compacted: boolean;
104
110
  /** Whether row collections were reduced while satisfying the cost ceiling. */
105
111
  rows_compacted: boolean;
112
+ /** Declared or nested collection paths reduced by budget degradation. */
113
+ compacted_row_paths?: string[];
106
114
  /** Whether the requested cost ceiling forced the useful result to be omitted. */
107
115
  result_omitted: boolean;
116
+ /** Estimated tokens in the useful result immediately before whole-result omission. */
117
+ omitted_result_estimated_tokens?: number;
118
+ }
119
+ /** Machine-readable explanation of budget-driven row degradation. */
120
+ export interface PmReadOutputTruncationDisclosure {
121
+ /** Stable reason for dropping rows. */
122
+ reason: "output_budget_reached";
123
+ /** Layer that supplied the binding ceiling. */
124
+ budget_source: PmReadOutputDimensionSource | "session";
125
+ /** Binding estimated-token ceiling. */
126
+ budget_tokens: number;
127
+ /** Explicit dimensions whose unbounded request was overridden by the ceiling. */
128
+ overridden_dimensions: PmReadOutputDimension[];
129
+ /** Declared or nested collection paths reduced by budget degradation. */
130
+ compacted_row_paths: string[];
131
+ /** Executable recovery instruction for retrieving the complete result. */
132
+ restore_with: string;
108
133
  }
109
134
  /** Result returned when the requested cost ceiling cannot fit useful content. */
110
135
  export interface PmReadOutputBudgetExceeded {
@@ -124,6 +149,7 @@ export interface PmReadOutputBudgetExceeded {
124
149
  export type PmReadOutputResult<Result> = (Result & {
125
150
  read_output?: PmReadOutputReceipt;
126
151
  read_session?: PmReadOutputSessionReceipt;
152
+ output_budget_truncation?: PmReadOutputTruncationDisclosure;
127
153
  }) | (PmReadOutputBudgetExceeded & {
128
154
  read_session?: PmReadOutputSessionReceipt;
129
155
  });
@@ -139,6 +165,36 @@ export declare const PM_READ_OUTPUT_SURFACE_CONTRACTS: readonly PmReadOutputSurf
139
165
  export declare function resolveReadOutputSurface(command: string): PmReadOutputSurface | undefined;
140
166
  /** Reject malformed or mutation-scoped universal output controls before command execution. */
141
167
  export declare function validateReadOutputOptions(command: string, options: Record<string, unknown>): void;
168
+ /**
169
+ * Map every canonical `--output-include` token that names a projection mode
170
+ * rather than a row field onto the command-local option that mode already owns.
171
+ *
172
+ * The include dimension folds two kinds of legacy alias into one canonical
173
+ * spelling: value-bearing selectors (`--fields`, `--section`) that name row
174
+ * fields, and mode flags (`--brief`, `--full`, `--summary`, ...) that select a
175
+ * whole declared projection. Only the first kind can be honoured by projecting
176
+ * an already-computed result, so mode tokens have to reach the command itself.
177
+ */
178
+ export declare function readOutputIncludeModeOptions(command: string): ReadonlyMap<string, string>;
179
+ /**
180
+ * Translate canonical projection-mode tokens into the command-local options
181
+ * they alias, so the spelling the migration hints recommend is behaviour
182
+ * identical to the legacy flag it replaces, and return the field selectors that
183
+ * remain for post-execution projection.
184
+ */
185
+ export declare function applyReadOutputIncludeModes(command: string, includeValue: unknown, commandOptions: Record<string, unknown>): {
186
+ selectors: string[];
187
+ modes: string[];
188
+ };
189
+ /**
190
+ * Resolve canonical include modes against one combined options bag, rewriting
191
+ * the include value in place to the selectors that remain.
192
+ *
193
+ * Used by dispatch paths that carry command options and universal output
194
+ * controls in a single record, so an action honours a mode token exactly as the
195
+ * CLI does.
196
+ */
197
+ export declare function normalizeReadOutputIncludeModeOptions(command: string, options: Record<string, unknown>): void;
142
198
  /** Resolve canonical and compatibility controls into the universal dimension set. */
143
199
  export declare function resolveReadOutputDimensions(command: string, options: Record<string, unknown>): PmResolvedReadOutputDimensions | undefined;
144
200
  /** Recompute read and optional session receipts after a final envelope projection. */