@unbrained/pm-cli 2026.8.10 → 2026.8.12

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 (243) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +153 -100
  3. package/dist/cli/commander-usage.js +113 -15
  4. package/dist/cli/error-guidance.d.ts +12 -0
  5. package/dist/cli/error-guidance.js +147 -29
  6. package/dist/cli/main.js +38 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-assurance.d.ts +8 -0
  9. package/dist/cli/register-assurance.js +52 -0
  10. package/dist/cli/register-files-lookup.js +14 -3
  11. package/dist/cli/register-list-query.js +10 -7
  12. package/dist/cli/register-mutation.js +30 -9
  13. package/dist/cli/register-operations.js +30 -15
  14. package/dist/cli-bundle/bundle-manifest.json +155 -155
  15. package/dist/cli-bundle/chunks/{chunk-TRWXF476.js → chunk-3PS7X6GS.js} +2 -2
  16. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +13 -0
  17. package/dist/cli-bundle/chunks/{chunk-EBO7OUUE.js → chunk-BM5YJ2UW.js} +69 -55
  18. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +33 -0
  19. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +196 -0
  20. package/dist/cli-bundle/chunks/{chunk-ETML5C6H.js → chunk-KOQMGCTA.js} +47 -47
  21. package/dist/cli-bundle/chunks/chunk-R76342NV.js +2 -0
  22. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +5 -0
  23. package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +2 -0
  24. package/dist/cli-bundle/chunks/chunk-WLAHPSOX.js +3 -0
  25. package/dist/cli-bundle/chunks/register-list-query-XPCJRUUD.js +10 -0
  26. package/dist/cli-bundle/chunks/register-mutation-4RJCBKRS.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +2 -0
  28. package/dist/cli-bundle/chunks/{register-setup-S3KT2LTH.js → register-setup-LLHAKP2V.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +5 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +155 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +18 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +16 -0
  35. package/dist/cli-bundle/focused-chunks/{chunk-IW43E4XL.js → chunk-GQW4BPUT.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-75774JWP.js → chunk-JAFRIWVF.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/{chunk-2COZ67XT.js → chunk-KHM2CS2C.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-M6RPIXKC.js → chunk-KPSXVBDV.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-34SX654S.js → chunk-KTLOKKCQ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +8 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-2EXI2DKR.js → chunk-NBLUKITQ.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +31 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/{chunk-DZGAHZZV.js → chunk-RWPAWUOT.js} +2 -2
  47. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +17 -0
  48. package/dist/cli-bundle/focused-chunks/{chunk-7UN6BHHO.js → chunk-YIAXMC3T.js} +2 -2
  49. package/dist/cli-bundle/focused-chunks/chunk-ZMGWAYH7.js +2 -0
  50. package/dist/cli-bundle/main.js +13 -13
  51. package/dist/cli-bundle/sdk-authoring.js +1 -1
  52. package/dist/cli-bundle/sdk-contracts.js +1 -1
  53. package/dist/cli-bundle/sdk-core.js +41 -39
  54. package/dist/cli-bundle/sdk-governance.js +1 -1
  55. package/dist/cli-bundle/sdk-graph.js +1 -1
  56. package/dist/cli-bundle/sdk-merge.js +1 -1
  57. package/dist/cli-bundle/sdk-query.js +1 -1
  58. package/dist/cli-bundle/sdk-runtime.js +1 -1
  59. package/dist/cli-bundle/sdk-testing.js +1 -1
  60. package/dist/cli-bundle/sdk.js +2 -2
  61. package/dist/core/extensions/reserved-host-flags.js +3 -2
  62. package/dist/core/history/drift-scan.js +13 -8
  63. package/dist/core/history/history.d.ts +8 -0
  64. package/dist/core/history/history.js +57 -7
  65. package/dist/core/history/replay.d.ts +9 -1
  66. package/dist/core/history/replay.js +48 -13
  67. package/dist/core/output/output.d.ts +2 -0
  68. package/dist/core/output/output.js +46 -14
  69. package/dist/core/session/session-state.d.ts +47 -0
  70. package/dist/core/session/session-state.js +207 -6
  71. package/dist/core/shared/author.d.ts +7 -1
  72. package/dist/core/shared/author.js +66 -46
  73. package/dist/core/shared/command-types.d.ts +2 -0
  74. package/dist/core/shared/command-types.js +2 -2
  75. package/dist/core/shared/errors.d.ts +13 -0
  76. package/dist/core/shared/errors.js +2 -2
  77. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  78. package/dist/core/store/item-metadata-cache.js +14 -7
  79. package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
  80. package/dist/sdk/agent/refusal-reachability.js +72 -0
  81. package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
  82. package/dist/sdk/agent/subcommand-recovery.js +84 -0
  83. package/dist/sdk/cli-bootstrap.d.ts +10 -0
  84. package/dist/sdk/cli-bootstrap.js +11 -7
  85. package/dist/sdk/cli-contracts/completeness.js +14 -3
  86. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  87. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  88. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  89. package/dist/sdk/cli-contracts/flag-contracts.js +20 -2
  90. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  91. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  92. package/dist/sdk/cli-contracts/runtime-contracts.js +4 -3
  93. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +515 -0
  94. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +252 -0
  95. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  96. package/dist/sdk/cli-contracts/tool-parameter-tables.js +99 -2
  97. package/dist/sdk/cli-contracts/tool-schema.d.ts +3 -3
  98. package/dist/sdk/cli-contracts/tool-schema.js +38 -5
  99. package/dist/sdk/cli-contracts.d.ts +1 -1
  100. package/dist/sdk/cli-contracts.js +3 -3
  101. package/dist/sdk/cli-program.js +3 -2
  102. package/dist/sdk/completion.js +23 -8
  103. package/dist/sdk/config.js +9 -3
  104. package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
  105. package/dist/sdk/context/semantic-session-attribution.js +83 -0
  106. package/dist/sdk/context-intent-contracts.js +45 -4
  107. package/dist/sdk/core-governance.d.ts +3 -1
  108. package/dist/sdk/core-governance.js +5 -3
  109. package/dist/sdk/core.d.ts +2 -1
  110. package/dist/sdk/core.js +3 -2
  111. package/dist/sdk/error-code-catalog.d.ts +13 -0
  112. package/dist/sdk/error-code-catalog.js +35 -2
  113. package/dist/sdk/extension.js +18 -17
  114. package/dist/sdk/files.d.ts +11 -0
  115. package/dist/sdk/files.js +82 -24
  116. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  117. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1585 -0
  118. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  119. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  120. package/dist/sdk/generated-error-code-catalog.js +6 -3121
  121. package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
  122. package/dist/sdk/governance/assurance-action-contracts.js +5 -0
  123. package/dist/sdk/governance/assurance-action.d.ts +70 -0
  124. package/dist/sdk/governance/assurance-action.js +200 -0
  125. package/dist/sdk/governance/assurance-limits.d.ts +7 -0
  126. package/dist/sdk/governance/assurance-limits.js +11 -0
  127. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  128. package/dist/sdk/governance/assurance-mutation-error.js +35 -0
  129. package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
  130. package/dist/sdk/governance/assurance-runtime.js +134 -0
  131. package/dist/sdk/governance/assurance.d.ts +438 -0
  132. package/dist/sdk/governance/assurance.js +804 -0
  133. package/dist/sdk/governance/health.d.ts +3 -1
  134. package/dist/sdk/governance/health.js +21 -4
  135. package/dist/sdk/governance/validate-item-reader.js +3 -3
  136. package/dist/sdk/governance/validate.d.ts +2 -0
  137. package/dist/sdk/governance/validate.js +13 -3
  138. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  139. package/dist/sdk/graph/durable-cache.js +98 -29
  140. package/dist/sdk/graph/governance.d.ts +14 -0
  141. package/dist/sdk/graph/governance.js +34 -9
  142. package/dist/sdk/graph/run.js +8 -3
  143. package/dist/sdk/index.d.ts +7 -2
  144. package/dist/sdk/index.js +9 -4
  145. package/dist/sdk/lifecycle/claim.js +26 -4
  146. package/dist/sdk/lifecycle/focus.js +13 -3
  147. package/dist/sdk/lifecycle/plan.js +8 -3
  148. package/dist/sdk/merge/driver.d.ts +2 -2
  149. package/dist/sdk/merge/driver.js +3 -3
  150. package/dist/sdk/merge/receipts.d.ts +6 -4
  151. package/dist/sdk/merge/receipts.js +7 -5
  152. package/dist/sdk/merge/three-way.d.ts +2 -2
  153. package/dist/sdk/merge/three-way.js +3 -3
  154. package/dist/sdk/output-projection.d.ts +9 -1
  155. package/dist/sdk/output-projection.js +45 -9
  156. package/dist/sdk/provenance.d.ts +38 -0
  157. package/dist/sdk/provenance.js +64 -2
  158. package/dist/sdk/query/activity.d.ts +49 -2
  159. package/dist/sdk/query/activity.js +183 -37
  160. package/dist/sdk/query/context.js +19 -8
  161. package/dist/sdk/query/get.js +19 -2
  162. package/dist/sdk/read-output-contracts.d.ts +5 -1
  163. package/dist/sdk/read-output-contracts.js +17 -2
  164. package/dist/sdk/read-output-session.d.ts +2 -0
  165. package/dist/sdk/read-output-session.js +12 -5
  166. package/dist/sdk/runtime-extended-actions.js +22 -5
  167. package/dist/sdk/runtime-primitives.d.ts +5 -3
  168. package/dist/sdk/runtime-primitives.js +7 -5
  169. package/dist/sdk/runtime-stats-options.js +3 -2
  170. package/dist/sdk/runtime.d.ts +4 -0
  171. package/dist/sdk/runtime.js +34 -34
  172. package/dist/sdk/stats.d.ts +36 -3
  173. package/dist/sdk/stats.js +55 -15
  174. package/dist/sdk/telemetry.js +7 -4
  175. package/dist/sdk/test/execution.d.ts +4 -0
  176. package/dist/sdk/test/execution.js +86 -21
  177. package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
  178. package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
  179. package/dist/sdk/traceability/source-traceability.d.ts +102 -0
  180. package/dist/sdk/traceability/source-traceability.js +293 -0
  181. package/dist/types.d.ts +10 -2
  182. package/dist/types.js +2 -2
  183. package/docs/ASSURANCE.md +137 -0
  184. package/docs/COMMANDS.md +29 -8
  185. package/docs/CONFIGURATION.md +7 -0
  186. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  187. package/docs/MERGE_SAFETY.md +3 -1
  188. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  189. package/docs/README.md +3 -0
  190. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  191. package/docs/RELEASING.md +9 -5
  192. package/docs/SDK.md +12 -1
  193. package/docs/SDK_AGENT_SESSION_CONTEXT.md +52 -5
  194. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  195. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  196. package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
  197. package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
  198. package/docs/TESTING.md +12 -9
  199. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  200. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
  201. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  202. package/marketplace.json +2 -2
  203. package/package.json +7 -7
  204. package/packages/pm-beads/package.json +1 -1
  205. package/packages/pm-calendar/package.json +1 -1
  206. package/packages/pm-command-kit/package.json +1 -1
  207. package/packages/pm-digital-twin/package.json +1 -1
  208. package/packages/pm-governance-audit/package.json +1 -1
  209. package/packages/pm-guide-shell/package.json +1 -1
  210. package/packages/pm-kanban/package.json +1 -1
  211. package/packages/pm-lifecycle-hooks/package.json +1 -1
  212. package/packages/pm-linked-test-adapters/package.json +1 -1
  213. package/packages/pm-search-advanced/package.json +1 -1
  214. package/packages/pm-templates/extensions/templates/index.ts +9 -3
  215. package/packages/pm-templates/package.json +1 -1
  216. package/packages/pm-todos/package.json +1 -1
  217. package/packages/pm-vcs/package.json +1 -1
  218. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  219. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  220. package/sdk/public-surface.json +1030 -67
  221. package/dist/cli-bundle/chunks/chunk-2QYH4QMI.js +0 -30
  222. package/dist/cli-bundle/chunks/chunk-JUDU4RO4.js +0 -194
  223. package/dist/cli-bundle/chunks/chunk-JZSNADRR.js +0 -5
  224. package/dist/cli-bundle/chunks/chunk-MENWVGJW.js +0 -2
  225. package/dist/cli-bundle/chunks/chunk-S4EITGLA.js +0 -3
  226. package/dist/cli-bundle/chunks/chunk-TIGKWVLA.js +0 -13
  227. package/dist/cli-bundle/chunks/chunk-TSLDTJLQ.js +0 -2
  228. package/dist/cli-bundle/chunks/register-list-query-OJ6ZXKV4.js +0 -10
  229. package/dist/cli-bundle/chunks/register-mutation-DKI7QC7O.js +0 -20
  230. package/dist/cli-bundle/chunks/register-operations-P5OGMT6I.js +0 -2
  231. package/dist/cli-bundle/focused-chunks/chunk-36FTZ2NT.js +0 -2
  232. package/dist/cli-bundle/focused-chunks/chunk-3CQECMKR.js +0 -16
  233. package/dist/cli-bundle/focused-chunks/chunk-CHIBMEZR.js +0 -8
  234. package/dist/cli-bundle/focused-chunks/chunk-FF4MNAYB.js +0 -153
  235. package/dist/cli-bundle/focused-chunks/chunk-GHTN2ILR.js +0 -2
  236. package/dist/cli-bundle/focused-chunks/chunk-I4YM2I7S.js +0 -2
  237. package/dist/cli-bundle/focused-chunks/chunk-IMDTEN7K.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-JMVA4HKR.js +0 -5
  239. package/dist/cli-bundle/focused-chunks/chunk-KR5RVXLQ.js +0 -31
  240. package/dist/cli-bundle/focused-chunks/chunk-KSNJG4KI.js +0 -16
  241. package/dist/cli-bundle/focused-chunks/chunk-MXYSIQ56.js +0 -18
  242. package/dist/cli-bundle/focused-chunks/chunk-RIIN5V4N.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-RKWSCYYN.js +0 -2
@@ -4,7 +4,7 @@
4
4
  * Implements the SDK-owned item query shared by every surface.
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]="f68f4074-51ba-5065-8cca-fe16acd48927")}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]="89176e36-40ea-5ec2-b291-d1cf042c4140")}catch(e){}}();
8
8
  import { pathExists, getActiveExtensionRegistrations, toItemRecord, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, EXIT_CODE, ITEM_METADATA_KEY_ORDER, TYPE_TO_FOLDER, PmCliError, buildItemNotFoundError, listAllItemMetadataLight, locateItem, readLocatedItem, getHistoryPath, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, } from "../runtime-primitives.js";
9
9
  import { readHistoryEntries } from "../history-read.js";
10
10
  import { recordContextUsageTouches } from "../context-usage.js";
@@ -13,6 +13,7 @@ import { buildItemSchedule, } from "../item-schedule.js";
13
13
  import { getItemAt } from "../history-read.js";
14
14
  import { parseIntegerLimit } from "./parsers.js";
15
15
  import { runList } from "./list.js";
16
+ import { registerOutputMaterialFieldGroups } from "../output-projection.js";
16
17
  const GET_DEPTH_VALUES = ["brief", "standard", "deep"];
17
18
  const AUTOMATIC_CHILD_ROLLUP_TYPES = new Set([
18
19
  "epic",
@@ -38,6 +39,21 @@ function itemCollectionCounts(item) {
38
39
  ]));
39
40
  return lengths;
40
41
  }
42
+ function itemMaterialFieldGroups(item, body) {
43
+ const collectionCounts = itemCollectionCounts(item);
44
+ return [
45
+ ...(body.length > 0 ? ["body"] : []),
46
+ ...Object.entries(collectionCounts).flatMap(([name, count]) => count > 0 ? [name] : []),
47
+ ...(collectionCounts.files + collectionCounts.tests + collectionCounts.docs > 0
48
+ ? ["linked"]
49
+ : []),
50
+ "children",
51
+ ...(typeof item.assignee === "string" && item.assignee.trim().length > 0
52
+ ? ["claim_state"]
53
+ : []),
54
+ ...(buildItemSchedule(item) ? ["schedule"] : []),
55
+ ];
56
+ }
41
57
  /** Decide whether a normal read should pay for a workspace-wide child projection. */
42
58
  function shouldAutoIncludeGetChildren(itemType) {
43
59
  const normalizedType = itemType.trim().toLowerCase();
@@ -414,6 +430,7 @@ export async function runGet(id, global, options = {}) {
414
430
  // Derived usage feedback must never make the source-of-truth read fail.
415
431
  }
416
432
  }
433
+ registerOutputMaterialFieldGroups(result, itemMaterialFieldGroups(context.metadata, context.body));
417
434
  return result;
418
435
  }
419
436
  /** Public contract for test-only get command policy helpers. */
@@ -421,4 +438,4 @@ export const _testOnlyGetCommand = {
421
438
  shouldAutoIncludeGetChildren,
422
439
  };
423
440
  //# sourceMappingURL=get.js.map
424
- //# debugId=f68f4074-51ba-5065-8cca-fe16acd48927
441
+ //# debugId=89176e36-40ea-5ec2-b291-d1cf042c4140
@@ -19,6 +19,8 @@ export interface PmReadOutputOptions {
19
19
  outputFormat?: "json" | "toon";
20
20
  /** Caller-carried cross-call budget and served-fact state. */
21
21
  outputSession?: string | PmReadOutputSessionState;
22
+ /** Include row selector and encoding discovery metadata. */
23
+ outputRowContract?: boolean;
22
24
  }
23
25
  /** Compatibility spelling retained for a command-specific output control. */
24
26
  export interface PmReadOutputLegacyAlias {
@@ -130,7 +132,7 @@ export type PmReadOutputResultFor<Result, Options> = "outputBudget" extends keyo
130
132
  /** Canonical CLI flags that opt a read invocation into universal output shaping. */
131
133
  export declare const PM_READ_OUTPUT_OPTION_FLAGS: readonly string[];
132
134
  /** Canonical control that composes the four per-call dimensions across reads. */
133
- export declare const PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS: readonly ["--output-session"];
135
+ export declare const PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS: readonly ["--output-session", "--output-row-contract"];
134
136
  /** Universal output contract for every built-in read surface. */
135
137
  export declare const PM_READ_OUTPUT_SURFACE_CONTRACTS: readonly PmReadOutputSurfaceContract[];
136
138
  /** Resolve a command or list/context alias to its canonical read-output surface. */
@@ -139,6 +141,8 @@ export declare function resolveReadOutputSurface(command: string): PmReadOutputS
139
141
  export declare function validateReadOutputOptions(command: string, options: Record<string, unknown>): void;
140
142
  /** Resolve canonical and compatibility controls into the universal dimension set. */
141
143
  export declare function resolveReadOutputDimensions(command: string, options: Record<string, unknown>): PmResolvedReadOutputDimensions | undefined;
144
+ /** Recompute read and optional session receipts after a final envelope projection. */
145
+ export declare function stabilizeReadOutputReceiptEstimates(result: Record<string, unknown>, options: Record<string, unknown>): Record<string, unknown>;
142
146
  /** Apply universal field, row, and token bounds and attach an exact receipt. */
143
147
  export declare function applyReadOutputDimensions<Result extends Record<string, unknown>>(command: string, options: Record<string, unknown>, result: Result): PmReadOutputResult<Result>;
144
148
  /** Narrow a universal read result to its budget-omission branch. */
@@ -5,7 +5,7 @@
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]="819ac44d-0add-581c-90e8-ac6e8247b04b")}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]="0ab0c72c-cac0-5670-93d1-7a446f8a2301")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
11
  import { compactReadOutputToBudget, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
@@ -58,6 +58,7 @@ export const PM_READ_OUTPUT_OPTION_FLAGS = Object.freeze(PM_READ_OUTPUT_DIMENSIO
58
58
  /** Canonical control that composes the four per-call dimensions across reads. */
59
59
  export const PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS = Object.freeze([
60
60
  "--output-session",
61
+ "--output-row-contract",
61
62
  ]);
62
63
  const LEGACY_FLAGS_BY_COMMAND = {
63
64
  list: {
@@ -216,6 +217,8 @@ const CANONICAL_OPTION_KEYS = [
216
217
  "output_format",
217
218
  "outputSession",
218
219
  "output_session",
220
+ "outputRowContract",
221
+ "output_row_contract",
219
222
  ];
220
223
  const HYBRID_READ_MUTATION_KEYS = {
221
224
  comments: ["add", "body", "stdin", "file", "edit", "delete"],
@@ -580,6 +583,18 @@ function attachReadOutputSessionContracts(result, state, receipt) {
580
583
  }
581
584
  return withSession;
582
585
  }
586
+ /** Recompute read and optional session receipts after a final envelope projection. */
587
+ export function stabilizeReadOutputReceiptEstimates(result, options) {
588
+ if (!isRecord(result.read_output))
589
+ return result;
590
+ const receipt = result.read_output;
591
+ const session = parseReadOutputSession(options.outputSession ?? options.output_session);
592
+ if (session === undefined) {
593
+ updateReadOutputReceiptEstimate(result, receipt);
594
+ return result;
595
+ }
596
+ return attachReadOutputSessionContracts(result, session, receipt);
597
+ }
583
598
  /** Apply field, amount, and repeat projections to every declared row path. */
584
599
  function projectReadOutputRows(result, resolved, session) {
585
600
  let projected = { ...result };
@@ -695,4 +710,4 @@ export function resolveReadOutputEncoding(command, options) {
695
710
  : undefined;
696
711
  }
697
712
  //# sourceMappingURL=read-output-contracts.js.map
698
- //# debugId=819ac44d-0add-581c-90e8-ac6e8247b04b
713
+ //# debugId=0ab0c72c-cac0-5670-93d1-7a446f8a2301
@@ -46,6 +46,8 @@ export interface PmReadOutputSessionReceipt {
46
46
  seen_before_count: number;
47
47
  /** Number of newly delivered item facts retained in this envelope. */
48
48
  new_item_count: number;
49
+ /** Newly delivered identities omitted from next_state after its capacity filled. */
50
+ seen_item_overflow_count?: number;
49
51
  /** Number of repeated item rows replaced by references. */
50
52
  suppressed_repeat_count: number;
51
53
  /** Stable reference syntax used by suppressed rows. */
@@ -5,7 +5,7 @@
5
5
  * budgets and resolvable references to item facts served by earlier reads.
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]="04ad0d11-1fb7-5eb4-8ff0-d81a7090c4ff")}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]="642f6dec-c0b2-5377-a401-dfa4f8ef6a2a")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
10
  import { PmCliError } from "../core/shared/errors.js";
11
11
  import { mapReadOutputRows, readOutputRowCollections, } from "./read-output-rows.js";
@@ -141,9 +141,13 @@ export function applyReadOutputSessionReferences(result, state) {
141
141
  /** Attach a fixed-point session receipt and return the exact charged tokens. */
142
142
  export function attachReadOutputSessionReceipt(result, state) {
143
143
  const { deliveredIds, suppressedRepeatCount } = summarizeReadOutputSessionRows(result);
144
- const nextSeen = [
145
- ...new Set([...state.seen_item_ids, ...deliveredIds]),
146
- ].sort();
144
+ const alreadySeen = new Set(state.seen_item_ids);
145
+ const newlySeen = [...deliveredIds]
146
+ .filter((id) => !alreadySeen.has(id))
147
+ .sort();
148
+ const retainedNewIds = newlySeen.slice(0, PM_READ_OUTPUT_SESSION_MAX_SEEN_ITEM_IDS - state.seen_item_ids.length);
149
+ const nextSeen = [...state.seen_item_ids, ...retainedNewIds].sort();
150
+ const seenItemOverflowCount = newlySeen.length - retainedNewIds.length;
147
151
  const receipt = {
148
152
  contract_version: 1,
149
153
  id: state.id,
@@ -158,6 +162,9 @@ export function attachReadOutputSessionReceipt(result, state) {
158
162
  exhausted: false,
159
163
  seen_before_count: state.seen_item_ids.length,
160
164
  new_item_count: deliveredIds.size,
165
+ ...(seenItemOverflowCount === 0
166
+ ? {}
167
+ : { seen_item_overflow_count: seenItemOverflowCount }),
161
168
  suppressed_repeat_count: suppressedRepeatCount,
162
169
  reference_format: "session:<session-id>:<item-id>",
163
170
  restore_reference_with: "pm get <item-id> --brief",
@@ -197,4 +204,4 @@ export function readOutputSessionRemainingTokens(state) {
197
204
  return Math.max(0, state.token_budget - state.spent_tokens);
198
205
  }
199
206
  //# sourceMappingURL=read-output-session.js.map
200
- //# debugId=04ad0d11-1fb7-5eb4-8ff0-d81a7090c4ff
207
+ //# debugId=642f6dec-c0b2-5377-a401-dfa4f8ef6a2a
@@ -1,7 +1,8 @@
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]="f8cd69db-ec70-560f-a8c2-2d8d4be75459")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="37ac2a74-f150-5b9d-96d6-d9cc441215be")}catch(e){}}();
3
3
  import { EXIT_CODE } from "../core/shared/constants.js";
4
4
  import { PmCliError } from "../core/shared/errors.js";
5
+ import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
5
6
  import { resolvePmRoot } from "../core/store/paths.js";
6
7
  import { runEval } from "./eval.js";
7
8
  import { runMergeDriver } from "./merge/driver.js";
@@ -92,14 +93,24 @@ export function runRuntimeMergeAction(context) {
92
93
  prefer: readRuntimeString(input, "prefer"),
93
94
  }, context.global);
94
95
  }
95
- throw new PmCliError(`Unknown merge subcommand "${subcommand}".`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
96
+ throw createUnknownSubcommandError({
97
+ command_path: "merge",
98
+ token: subcommand,
99
+ allowed: ["install", "reconcile", "report", "driver"],
100
+ display_name: "merge",
101
+ });
96
102
  }
97
103
  /** Dispatch guarded workspace snapshot operations. */
98
104
  export function runRuntimeWorkspaceAction(context) {
99
105
  const input = mergedInput(context);
100
106
  const subcommand = requiredString(input, "subcommand");
101
107
  if (subcommand !== "snapshot") {
102
- throw new PmCliError(`Unknown workspace subcommand "${subcommand}".`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
108
+ throw createUnknownSubcommandError({
109
+ command_path: "workspace",
110
+ token: subcommand,
111
+ allowed: ["snapshot"],
112
+ display_name: "workspace",
113
+ });
103
114
  }
104
115
  const snapshotAction = readRuntimeString(input, "snapshotAction") ??
105
116
  requiredString(input, "snapshot_action");
@@ -129,7 +140,13 @@ export function runRuntimeWorkspaceAction(context) {
129
140
  lockWaitMs: parseRuntimeInteger(input.lockWaitMs, "lockWaitMs"),
130
141
  });
131
142
  }
132
- throw new PmCliError(`Unknown workspace snapshot action "${snapshotAction}".`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
143
+ throw createUnknownSubcommandError({
144
+ command_path: "workspace snapshot",
145
+ token: snapshotAction,
146
+ allowed: ["create", "list", "inspect", "restore", "delete"],
147
+ display_name: "workspace snapshot",
148
+ token_kind: "action",
149
+ });
133
150
  }
134
151
  /** Dispatch meeting, event, and reminder shortcuts through SDK-owned creation. */
135
152
  export function runRuntimeSchedulingAction(context) {
@@ -144,4 +161,4 @@ export function runRuntimeSchedulingAction(context) {
144
161
  return runRemind(title, input, context.global);
145
162
  }
146
163
  //# sourceMappingURL=runtime-extended-actions.js.map
147
- //# debugId=f8cd69db-ec70-560f-a8c2-2d8d4be75459
164
+ //# debugId=37ac2a74-f150-5b9d-96d6-d9cc441215be
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export { type MutationCheckpointItem, createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
10
10
  export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
11
+ export { createUnknownSubcommandError, type UnknownSubcommandErrorOptions, } from "./agent/subcommand-recovery.js";
11
12
  export { type ActiveExtensionHookContext, type ExtensionCommandRegistry, type ExtensionDiscoveryResult, type ExtensionHookRegistry, type ExtensionParserRegistry, type ExtensionPreflightRegistry, type ExtensionRegistrationRegistry, type ExtensionRendererRegistry, type ExtensionServiceRegistry, type FlagDefinition, type PreflightRuntimeDecision, type RegisteredExtensionCommandDefinition, type RegisteredExtensionFlagDefinitions, type RegisteredExtensionSchemaMigrationDefinition, activateExtensions, clearActiveExtensionHooks, consumeAfterCommandAffectedItems, createCoreCommandHookContext, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, resetActiveExtensionRuntimeState, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnIndexHooks, runActiveOnReadHooks, runActiveOnWriteHooks, runActiveParserOverride, runActivePreflightOverride, runActiveServiceOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandContext, setActiveCommandResult, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, } from "../core/extensions/index.js";
12
13
  export { applyRegisteredItemFieldDefaultsAndValidation, collectRegisteredItemFieldNames, parseRegisteredItemFieldAssignments, } from "../core/extensions/item-fields.js";
13
14
  export { resolveExtensionRoots } from "../core/extensions/loader.js";
@@ -15,9 +16,10 @@ export { resolveRegisteredSearchProvider, resolveRegisteredVectorStoreAdapter, }
15
16
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
16
17
  export { type HistoryDiffValueEntry, computeHistoryDiff, patchPathToChangedField, } from "../core/history/history-diff.js";
17
18
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
18
- export { appendHistoryEntry, createHistoryEntry, hashDocument, hashEmptyDocument, } from "../core/history/history.js";
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
+ export { readHistoryEntries } from "../core/history/read.js";
19
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";
20
- export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, } from "../core/history/replay.js";
22
+ export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
21
23
  export { resolveBodyFileContent } from "../core/io/body-file.js";
22
24
  export { generateItemId, normalizeItemId, normalizeRawItemId, } from "../core/item/id.js";
23
25
  export { canonicalDocument, normalizeItemMetadata, parseItemDocument, serializeItemDocument, } from "../core/item/item-format.js";
@@ -70,7 +72,7 @@ export { splitCommaList } from "../core/shared/split-comma-list.js";
70
72
  export { compareTimestampStrings, nowIso, resolveIsoOrRelative, } from "../core/shared/time.js";
71
73
  export { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
72
74
  export { type CachedDocumentCandidate, listAllDocumentCandidatesCached, } from "../core/store/item-metadata-cache.js";
73
- export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
75
+ export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadata, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
74
76
  export { isTerminalPlanMode, shouldCompletePlanOnClose, } from "../core/item/plan-lifecycle.js";
75
77
  export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
76
78
  export { persistSelectedItemFormat, readSettings, readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
@@ -7,9 +7,10 @@
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]="17358714-bb54-58e5-bba0-61bfd1323ec2")}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]="78779372-1987-54d0-9ae4-775b52641a26")}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
+ export { createUnknownSubcommandError, } from "./agent/subcommand-recovery.js";
13
14
  export { activateExtensions, clearActiveExtensionHooks, consumeAfterCommandAffectedItems, createCoreCommandHookContext, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, resetActiveExtensionRuntimeState, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnIndexHooks, runActiveOnReadHooks, runActiveOnWriteHooks, runActiveParserOverride, runActivePreflightOverride, runActiveServiceOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandContext, setActiveCommandResult, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, } from "../core/extensions/index.js";
14
15
  export { applyRegisteredItemFieldDefaultsAndValidation, collectRegisteredItemFieldNames, parseRegisteredItemFieldAssignments, } from "../core/extensions/item-fields.js";
15
16
  export { resolveExtensionRoots } from "../core/extensions/loader.js";
@@ -17,9 +18,10 @@ export { resolveRegisteredSearchProvider, resolveRegisteredVectorStoreAdapter, }
17
18
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
18
19
  export { computeHistoryDiff, patchPathToChangedField, } from "../core/history/history-diff.js";
19
20
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
20
- export { appendHistoryEntry, createHistoryEntry, hashDocument, hashEmptyDocument, } from "../core/history/history.js";
21
+ export { appendHistoryEntry, CURRENT_HISTORY_ITEM_HASH_VERSION, createHistoryEntry, hashDocument, hashDocumentForVersion, hashEmptyDocument, SUPPORTED_HISTORY_ITEM_HASH_VERSIONS, } from "../core/history/history.js";
22
+ export { readHistoryEntries } from "../core/history/read.js";
21
23
  export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
22
- export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, } from "../core/history/replay.js";
24
+ export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
23
25
  export { resolveBodyFileContent } from "../core/io/body-file.js";
24
26
  export { generateItemId, normalizeItemId, normalizeRawItemId, } from "../core/item/id.js";
25
27
  export { canonicalDocument, normalizeItemMetadata, parseItemDocument, serializeItemDocument, } from "../core/item/item-format.js";
@@ -71,7 +73,7 @@ export { splitCommaList } from "../core/shared/split-comma-list.js";
71
73
  export { compareTimestampStrings, nowIso, resolveIsoOrRelative, } from "../core/shared/time.js";
72
74
  export { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
73
75
  export { listAllDocumentCandidatesCached, } from "../core/store/item-metadata-cache.js";
74
- export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
76
+ export { buildItemNotFoundError, createMutationGuardSdk, deleteItem, listAllItemMetadata, listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
75
77
  export { isTerminalPlanMode, shouldCompletePlanOnClose, } from "../core/item/plan-lifecycle.js";
76
78
  export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
77
79
  export { persistSelectedItemFormat, readSettings, readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
@@ -79,4 +81,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
79
81
  export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
80
82
  export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
81
83
  //# sourceMappingURL=runtime-primitives.js.map
82
- //# debugId=17358714-bb54-58e5-bba0-61bfd1323ec2
84
+ //# debugId=78779372-1987-54d0-9ae4-775b52641a26
@@ -1,9 +1,10 @@
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]="dbabff08-1bb7-539b-b1c1-c10584aa0a67")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0e63298a-d2d7-5217-af50-a206348b4cd4")}catch(e){}}();
3
3
  import { readRuntimeString, readRuntimeStringArray } from "./runtime-input.js";
4
4
  /** Convert a flat runtime option bag into the canonical typed stats payload. */
5
5
  export function statsCommandOptionsFromRuntime(options) {
6
6
  return {
7
+ includeEmpty: options.includeEmpty === true,
7
8
  storage: options.storage === true,
8
9
  metadataCoverage: options.metadataCoverage === true,
9
10
  fieldUtilization: options.fieldUtilization === true,
@@ -35,4 +36,4 @@ export function statsCommandOptionsFromRuntime(options) {
35
36
  };
36
37
  }
37
38
  //# sourceMappingURL=runtime-stats-options.js.map
38
- //# debugId=dbabff08-1bb7-539b-b1c1-c10584aa0a67
39
+ //# debugId=0e63298a-d2d7-5217-af50-a206348b4cd4
@@ -15,6 +15,8 @@ export type { PmReadOutputSessionReceipt, PmReadOutputSessionState, } from "./re
15
15
  export type { PmContextIntentContract } from "./context-intent-contracts.js";
16
16
  export type { PmErrorCodeContract } from "./error-code-catalog.js";
17
17
  export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
18
+ import { type AssuranceActionInput, type AssuranceActionResult } from "./governance/assurance-action.js";
19
+ export type * from "./governance/assurance-action-contracts.js";
18
20
  import { type AggregateOptions, type AggregateResult } from "./query/aggregate.js";
19
21
  import { type UpgradeCommandOptions, type UpgradeResult } from "./governance/upgrade.js";
20
22
  import { type CreateResult } from "./lifecycle/create.js";
@@ -235,6 +237,8 @@ export declare class PmClient {
235
237
  health<Options extends ReadOptions<RunHealthOptions> = RunHealthOptions>(options?: Options): ReadPromise<HealthResult, Options>;
236
238
  /** Run tracker cache/runtime garbage collection. */
237
239
  gc(options?: GcCommandOptions): Promise<GcResult>;
240
+ /** Declare, inspect, or evaluate a project assurance contract. */
241
+ assurance(input: AssuranceActionInput): Promise<AssuranceActionResult>;
238
242
  /** Redact sensitive values while preserving an audited, verified history chain. */
239
243
  historyRedact(id: string, options: HistoryRedactCommandOptions): Promise<HistoryRedactResult>;
240
244
  /** Repair and re-anchor one drifted history stream. */
@@ -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]="70ce3cab-35f0-508b-9348-2f8479495946")}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]="7c27b516-1714-5f2b-8304-98e8372280be")}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";
@@ -28,11 +28,13 @@ import { PM_TOOL_ACTIONS } from "./cli-contracts/enum-contracts.js";
28
28
  import { clearWorkspaceContractsCache, memoizeWorkspaceExtensionRegistrations, } from "./workspace-contracts-cache.js";
29
29
  import { SDK_ACTION_ALIASES } from "./runtime-action-aliases.js";
30
30
  import { createExtensionCommandSdk } from "./extension-command-context.js";
31
+ import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
31
32
  import { applyContextIntentProjection, attachReadOutputContracts, } from "./context-intent-contracts.js";
32
33
  import { runWithDiscoveredContextIntentContracts, } from "./context-intent-runtime.js";
33
34
  import { validateReadOutputOptions, } from "./read-output-contracts.js";
34
35
  export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
35
- import { runActivity } from "./query/activity.js";
36
+ import { normalizeActivityProjectionOptions, runActivity, } from "./query/activity.js";
37
+ import { runAssuranceDispatch } from "./governance/assurance-action.js";
36
38
  import { runAggregate, } from "./query/aggregate.js";
37
39
  import { runAppend } from "./lifecycle/append.js";
38
40
  import { runClaim, runClaimNext, runRelease } from "./lifecycle/claim.js";
@@ -63,7 +65,7 @@ import { runConfig } from "./config.js";
63
65
  import { runInit } from "./init.js";
64
66
  import { runRuntimeEvalAction, runRuntimeEventsAction, runRuntimeMergeAction, runRuntimeSchedulingAction, runRuntimeWorkspaceAction, } from "./runtime-extended-actions.js";
65
67
  import { acknowledgeUnknownAuthorHistoryEventsFromTransport, } from "./author-attribution.js";
66
- import { runProfileApply, runProfileLint, runProfileList, runProfileShow, } from "./profile.js";
68
+ import { PROFILE_SUBCOMMANDS, runProfileApply, runProfileLint, runProfileList, runProfileShow, } from "./profile.js";
67
69
  import { runHistoryRedact, } from "./history-redact.js";
68
70
  import { runMcpHistoryCompactAction, runMcpHistoryRepairAction, } from "./history-mcp.js";
69
71
  import { actionGlobalOptions as globalOptions, closeManyOptionsFromFlat, extensionOptionsFromArgs, graphOptionsFromFlat, mutationListOptions, normalizeActionName, normalizeCommandPath, normalizeMcpOptionsArrays, normalizeMcpUpdateOptions, optionsWithAuthor, parseRuntimeInteger as parseMcpInteger, readRuntimeScalarString as readScalarString, readRuntimeScalarStringAllowBlank as readScalarStringAllowBlank, readRuntimeString as readString, readRuntimeStringArray as readStringArray, resolveRuntimeLimit, updateManyOptionsFromFlat, withAddNoteOption, withFilesDiscoveryOptions, withMutationCompaction, } from "./runtime-input.js";
@@ -71,6 +73,7 @@ import { runDeps } from "./dependencies.js";
71
73
  import { runDocs } from "./docs.js";
72
74
  import { runGraph, } from "./graph/run.js";
73
75
  import { runFiles, runFilesDiscover, runFilesLookup } from "./files.js";
76
+ import { runtimeFilesLookupOptions } from "./traceability/runtime-files-lookup.js";
74
77
  import { runContracts, } from "./cli-contracts/runtime-contracts.js";
75
78
  import { runList } from "./query/list.js";
76
79
  import { runSearch, } from "./query/search.js";
@@ -81,7 +84,7 @@ import { runTelemetry } from "./telemetry.js";
81
84
  import { runTest } from "./test/execution.js";
82
85
  import { runTestAll } from "./test/batch.js";
83
86
  import { resolveStartTaskInProgressStatus } from "./start-task-status.js";
84
- import { runSchemaAddField, runSchemaAddStatus, runSchemaAddType, runSchemaApplyPreset, runSchemaInferTypes, runSchemaList, runSchemaListFields, runSchemaEvolutionMigration, runSchemaRemoveField, runSchemaRemoveStatus, runSchemaRemoveType, runSchemaShow, runSchemaShowField, runSchemaShowStatus, } from "./schema.js";
87
+ import { SCHEMA_SUBCOMMANDS, runSchemaAddField, runSchemaAddStatus, runSchemaAddType, runSchemaApplyPreset, runSchemaInferTypes, runSchemaList, runSchemaListFields, runSchemaEvolutionMigration, runSchemaRemoveField, runSchemaRemoveStatus, runSchemaRemoveType, runSchemaShow, runSchemaShowField, runSchemaShowStatus, } from "./schema.js";
85
88
  export { getActiveExtensionRegistrations, runActiveOnReadHooks, runActiveOnWriteHooks, } from "../core/extensions/index.js";
86
89
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
87
90
  export { appendHistoryEntry, createHistoryEntry, } from "../core/history/history.js";
@@ -408,6 +411,10 @@ export class PmClient {
408
411
  gc(options = {}) {
409
412
  return this.runTyped("gc", { options });
410
413
  }
414
+ /** Declare, inspect, or evaluate a project assurance contract. */
415
+ assurance(input) {
416
+ return this.runTyped("assurance", { options: { ...input, subcommand: input.action } });
417
+ }
411
418
  /** Redact sensitive values while preserving an audited, verified history chain. */
412
419
  historyRedact(id, options) {
413
420
  return this.runTyped("history-redact", { id, options });
@@ -1401,25 +1408,20 @@ function runMcpCommentsAction(ctx) {
1401
1408
  commentOptions.delete === undefined;
1402
1409
  if (isListing) {
1403
1410
  commentOptions.includeMeta = true;
1404
- if (commentOptions.limit === undefined && commentOptions.fullHistory !== true) {
1411
+ if (commentOptions.limit === undefined &&
1412
+ commentOptions.fullHistory !== true) {
1405
1413
  commentOptions.limit = "20";
1406
1414
  }
1407
1415
  }
1408
1416
  return runComments(requireMcpItemId(ctx), commentOptions, ctx.global);
1409
1417
  }
1418
+ function runMcpFilesLookupAction(ctx, paths) {
1419
+ return runFilesLookup(runtimeFilesLookupOptions(ctx.options, paths, parseMcpInteger), ctx.global);
1420
+ }
1410
1421
  function runMcpFilesAction(ctx) {
1411
1422
  const lookupPaths = readStringArray(ctx.options.lookupPath);
1412
1423
  if (lookupPaths && lookupPaths.length > 0) {
1413
- return runFilesLookup({
1414
- paths: lookupPaths,
1415
- scope: ctx.options.scope === "project" || ctx.options.scope === "global"
1416
- ? ctx.options.scope
1417
- : undefined,
1418
- limit: parseMcpInteger(ctx.options.limit, "files lookup limit"),
1419
- offset: parseMcpInteger(ctx.options.offset, "files lookup offset"),
1420
- noTruncate: ctx.options.noTruncate === true,
1421
- strictRead: ctx.options.strictRead === true,
1422
- }, ctx.global);
1424
+ return runMcpFilesLookupAction(ctx, lookupPaths);
1423
1425
  }
1424
1426
  const fileId = requireMcpItemId(ctx);
1425
1427
  return ctx.options.discover === true
@@ -1454,12 +1456,8 @@ function runMcpConfigAction(ctx) {
1454
1456
  "project", configAction, readString(ctx.args, "key") ?? readString(ctx.options, "key"), ctx.options, ctx.global, readString(ctx.args, "value") ?? readString(ctx.options, "value"));
1455
1457
  }
1456
1458
  function runMcpActivityAction(ctx) {
1457
- const activityOptions = { ...ctx.options };
1458
- if (activityOptions.compact === undefined) {
1459
- activityOptions.compact = activityOptions.full === true ? false : true;
1460
- }
1461
- delete activityOptions.full;
1462
- return runActivity(activityOptions, ctx.global);
1459
+ const options = ctx.options;
1460
+ return runActivity(normalizeActivityProjectionOptions(options), ctx.global);
1463
1461
  }
1464
1462
  function parseMcpIntegerPrefix(value, label) {
1465
1463
  if (typeof value === "number") {
@@ -1644,7 +1642,12 @@ function runMcpSchemaAction(ctx) {
1644
1642
  }
1645
1643
  return runMcpSchemaAddTypeAction(schema);
1646
1644
  }
1647
- throw new PmCliError(`Unknown pm schema subcommand "${schema.subcommand}". Allowed: add-type, remove-type, add-status, remove-status, add-field, remove-field, rename-type, rename-field, remap-status, list-fields, show-field, apply-preset, list, show, show-status`, 64);
1645
+ throw createUnknownSubcommandError({
1646
+ command_path: "schema",
1647
+ token: schema.subcommand,
1648
+ allowed: SCHEMA_SUBCOMMANDS,
1649
+ exit_code: 64,
1650
+ });
1648
1651
  }
1649
1652
  function runMcpProfileAction(ctx) {
1650
1653
  const subcommand = readString(ctx.args, "subcommand") ??
@@ -1663,7 +1666,12 @@ function runMcpProfileAction(ctx) {
1663
1666
  };
1664
1667
  const handler = getOwnHandler(handlers, normalizedSubcommand);
1665
1668
  if (!handler) {
1666
- throw new PmCliError(`Unknown pm profile subcommand "${subcommand}". Allowed: list, show, apply, lint`, 64);
1669
+ throw createUnknownSubcommandError({
1670
+ command_path: "profile",
1671
+ token: subcommand,
1672
+ allowed: PROFILE_SUBCOMMANDS,
1673
+ exit_code: 64,
1674
+ });
1667
1675
  }
1668
1676
  return handler();
1669
1677
  }
@@ -1813,6 +1821,7 @@ const SDK_ACTION_HANDLERS = {
1813
1821
  runUpdate: (id, options, global) => runUpdate(id, options, global),
1814
1822
  }),
1815
1823
  health: runMcpHealthAction,
1824
+ assurance: (ctx) => runAssuranceDispatch(ctx.args, ctx.options, ctx.global),
1816
1825
  contracts: (ctx) => runContracts(ctx.options, ctx.global),
1817
1826
  config: runMcpConfigAction,
1818
1827
  activity: runMcpActivityAction,
@@ -1825,16 +1834,7 @@ const SDK_ACTION_HANDLERS = {
1825
1834
  deps: (ctx) => runDeps(requireMcpItemId(ctx), ctx.options, ctx.global),
1826
1835
  graph: runMcpGraphAction,
1827
1836
  "files-discover": (ctx) => runFilesDiscover(requireMcpItemId(ctx), ctx.options, ctx.global),
1828
- "files-lookup": (ctx) => runFilesLookup({
1829
- paths: readStringArray(ctx.options.paths),
1830
- scope: ctx.options.scope === "project" || ctx.options.scope === "global"
1831
- ? ctx.options.scope
1832
- : undefined,
1833
- limit: parseMcpInteger(ctx.options.limit, "files lookup limit"),
1834
- offset: parseMcpInteger(ctx.options.offset, "files lookup offset"),
1835
- noTruncate: ctx.options.noTruncate === true,
1836
- strictRead: ctx.options.strictRead === true,
1837
- }, ctx.global),
1837
+ "files-lookup": (ctx) => runMcpFilesLookupAction(ctx, readStringArray(ctx.options.paths)),
1838
1838
  history: (ctx) => runHistory(requireMcpItemId(ctx), ctx.options, ctx.global),
1839
1839
  "history-redact": (ctx) => runHistoryRedact(requireMcpItemId(ctx), ctx.options, ctx.global),
1840
1840
  "history-repair": runMcpHistoryRepairAction,
@@ -1930,4 +1930,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
1930
1930
  }
1931
1931
  }
1932
1932
  //# sourceMappingURL=runtime.js.map
1933
- //# debugId=70ce3cab-35f0-508b-9348-2f8479495946
1933
+ //# debugId=7c27b516-1714-5f2b-8304-98e8372280be
@@ -1,5 +1,5 @@
1
1
  import { type ContentFieldUtilizationReport } from "../core/governance/content-fields.js";
2
- import { type GroupedBreakdown, type MetadataCoverageReport } from "../core/governance/metadata-coverage.js";
2
+ import { type CoverageItem, type GroupedBreakdown, type LifecycleClassifier, type MetadataCoverageReport } from "../core/governance/metadata-coverage.js";
3
3
  import { type HistoryStorageStats } from "../core/history/history-storage-stats.js";
4
4
  import type { GlobalOptions } from "../core/shared/command-types.js";
5
5
  import type { ItemStatus, ItemType } from "../types/index.js";
@@ -7,6 +7,8 @@ import { type ImprovementDirection, type ImprovementLedgerResult, type RecordImp
7
7
  import { type FleetAttributionAnalytics, type ProvenanceCoverageAnalytics } from "./history-analytics.js";
8
8
  /** Documents the stats command options payload exchanged by command, SDK, and package integrations. */
9
9
  export interface StatsCommandOptions {
10
+ /** Restore zero-count item-type and status buckets for schema-governance dashboards. */
11
+ includeEmpty?: boolean;
10
12
  /** Include aggregate per-stream history storage metrics (sizes, depth, oldest/newest). */
11
13
  storage?: boolean;
12
14
  /** Include metadata coverage percentages (AC, estimates, resolution, tags, parent) overall and by type. */
@@ -52,6 +54,29 @@ export interface StatsCommandOptions {
52
54
  /** Minimum close or explicit-value denominator required for rates. */
53
55
  minimumSample?: number;
54
56
  }
57
+ /** Compact, tabular lifecycle row used by the default stats type distribution. */
58
+ export interface StatsTypeLifecycleRow {
59
+ /** Item type represented by this row. */
60
+ type: string;
61
+ /** Total items of this type across every lifecycle bucket. */
62
+ total: number;
63
+ /** Items in the default open lifecycle bucket. */
64
+ open: number;
65
+ /** Items in active non-default lifecycle states. */
66
+ in_progress: number;
67
+ /** Items in blocked lifecycle states. */
68
+ blocked: number;
69
+ /** Items in draft lifecycle states. */
70
+ draft: number;
71
+ /** Items in completed lifecycle states. */
72
+ closed: number;
73
+ /** Items in canceled lifecycle states. */
74
+ canceled: number;
75
+ /** Items whose custom status is outside the recognized lifecycle buckets. */
76
+ other: number;
77
+ }
78
+ /** Screen-sized type distribution rendered as one canonical TOON table. */
79
+ export type StatsTypeBreakdown = StatsTypeLifecycleRow[];
55
80
  /** Documents the stats result payload exchanged by command, SDK, and package integrations. */
56
81
  export interface StatsResult {
57
82
  /** Value that configures or reports totals for this contract. */
@@ -61,9 +86,11 @@ export interface StatsResult {
61
86
  history_entries: number;
62
87
  };
63
88
  /** Schema type that determines the shape and validation rules for this value. */
64
- by_type: Record<ItemType, number>;
89
+ by_type: StatsTypeBreakdown;
65
90
  /** Item counts grouped by lifecycle status. */
66
- by_status: Record<ItemStatus, number>;
91
+ by_status: Partial<Record<ItemStatus, number>>;
92
+ /** Total zero-count type and status buckets omitted from the default projection. */
93
+ omitted_zero_buckets: number;
67
94
  /** Present only with --metadata-coverage: per-field coverage overall and by type. */
68
95
  metadata_coverage?: MetadataCoverageReport;
69
96
  /** Present only with --by-assignee/--by-tag/--by-priority: lifecycle-bucketed group breakdowns. */
@@ -89,6 +116,11 @@ export interface StatsResult {
89
116
  }
90
117
  declare function zeroByType(itemTypes: string[]): Record<ItemType, number>;
91
118
  declare function zeroByStatus(statuses: string[]): Record<ItemStatus, number>;
119
+ declare function projectStatsDistributions(items: readonly CoverageItem[], itemTypes: readonly string[], statuses: readonly string[], classifier: LifecycleClassifier, includeEmpty: boolean): {
120
+ byType: StatsTypeBreakdown;
121
+ byStatus: Partial<Record<ItemStatus, number>>;
122
+ omitted: number;
123
+ };
92
124
  declare function countNonEmptyLines(raw: string): number;
93
125
  declare function readHistoryStreamContents(pmRoot: string): Promise<Array<{
94
126
  id: string;
@@ -100,6 +132,7 @@ export declare const _testOnly: {
100
132
  zeroByStatus: typeof zeroByStatus;
101
133
  countNonEmptyLines: typeof countNonEmptyLines;
102
134
  readHistoryStreamContents: typeof readHistoryStreamContents;
135
+ projectStatsDistributions: typeof projectStatsDistributions;
103
136
  };
104
137
  /** Implements run stats for the public runtime surface of this module. */
105
138
  export declare function runStats(global: GlobalOptions, options?: StatsCommandOptions): Promise<StatsResult>;