@unbrained/pm-cli 2026.8.11 → 2026.8.13

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 (250) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +74 -21
  3. package/dist/cli/commander-usage.js +37 -11
  4. package/dist/cli/error-guidance.d.ts +2 -0
  5. package/dist/cli/error-guidance.js +82 -19
  6. package/dist/cli/main.js +35 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-assurance.js +28 -17
  9. package/dist/cli/register-list-query.js +10 -7
  10. package/dist/cli/register-operations.js +16 -6
  11. package/dist/cli-bundle/bundle-manifest.json +163 -163
  12. package/dist/cli-bundle/chunks/chunk-3ZMOWAFM.js +2 -0
  13. package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +196 -0
  14. package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +13 -0
  15. package/dist/cli-bundle/chunks/chunk-F7FJYGK3.js +8 -0
  16. package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +5 -0
  17. package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-A2SJGHSI.js → chunk-Q47C67TQ.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-WMEZHCFI.js → chunk-QGTUPEU5.js} +62 -54
  20. package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +34 -0
  21. package/dist/cli-bundle/chunks/{chunk-ZU34C3LH.js → chunk-YLBAPY22.js} +50 -50
  22. package/dist/cli-bundle/chunks/register-list-query-4HIZ7EA3.js +10 -0
  23. package/dist/cli-bundle/chunks/register-mutation-W64FZ5HN.js +20 -0
  24. package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +2 -0
  25. package/dist/cli-bundle/chunks/{register-setup-NOCOOWQY.js → register-setup-634MFRXU.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +31 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-4H5IA6AV.js → chunk-2JP7W7GO.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-2RI2FESN.js +4 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +8 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-2DL3MRTD.js → chunk-3DJSGWVB.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +5 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +155 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-TL5M2PAY.js → chunk-E3AVJ655.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-J5EKAIVD.js → chunk-HC2OL2H2.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/{chunk-BKPIY34S.js → chunk-I75MANL7.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-IIS2FRKL.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +2 -0
  40. package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +17 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-UDAZWT25.js → chunk-OOYYKQWX.js} +4 -4
  42. package/dist/cli-bundle/focused-chunks/{chunk-23FTGO3W.js → chunk-PKPOZXLL.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +2 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +16 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-55BIB6DV.js → chunk-TEZIXMTH.js} +2 -2
  46. package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +18 -0
  47. package/dist/cli-bundle/main.js +13 -13
  48. package/dist/cli-bundle/sdk-authoring.js +1 -1
  49. package/dist/cli-bundle/sdk-contracts.js +1 -1
  50. package/dist/cli-bundle/sdk-core.js +42 -41
  51. package/dist/cli-bundle/sdk-governance.js +1 -1
  52. package/dist/cli-bundle/sdk-graph.js +1 -1
  53. package/dist/cli-bundle/sdk-merge.js +1 -1
  54. package/dist/cli-bundle/sdk-query.js +1 -1
  55. package/dist/cli-bundle/sdk-runtime.js +1 -1
  56. package/dist/cli-bundle/sdk-testing.js +1 -1
  57. package/dist/cli-bundle/sdk.js +2 -2
  58. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  59. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  60. package/dist/core/extensions/activation-summary.d.ts +2 -0
  61. package/dist/core/extensions/activation-summary.js +6 -2
  62. package/dist/core/extensions/capability-usage.d.ts +1 -1
  63. package/dist/core/extensions/capability-usage.js +4 -3
  64. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  65. package/dist/core/extensions/contribution-inventory.js +6 -2
  66. package/dist/core/extensions/extension-registries.js +3 -2
  67. package/dist/core/extensions/extension-types.d.ts +83 -1
  68. package/dist/core/extensions/extension-types.js +3 -2
  69. package/dist/core/extensions/loader.d.ts +2 -8
  70. package/dist/core/extensions/loader.js +53 -144
  71. package/dist/core/extensions/registration-values.d.ts +43 -0
  72. package/dist/core/extensions/registration-values.js +210 -0
  73. package/dist/core/extensions/reserved-host-flags.js +3 -2
  74. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  75. package/dist/core/extensions/runtime-registrations.js +12 -2
  76. package/dist/core/fs/fs-utils.d.ts +2 -0
  77. package/dist/core/fs/fs-utils.js +7 -3
  78. package/dist/core/history/drift-cache.js +4 -3
  79. package/dist/core/history/drift-scan.js +16 -17
  80. package/dist/core/history/history.d.ts +8 -0
  81. package/dist/core/history/history.js +57 -7
  82. package/dist/core/history/replay.d.ts +9 -1
  83. package/dist/core/history/replay.js +48 -13
  84. package/dist/core/lock/lock-gc.js +8 -13
  85. package/dist/core/lock/lock.js +5 -4
  86. package/dist/core/output/output.d.ts +2 -0
  87. package/dist/core/output/output.js +46 -14
  88. package/dist/core/search/vector-stores.js +6 -11
  89. package/dist/core/shared/command-types.d.ts +2 -0
  90. package/dist/core/shared/command-types.js +2 -2
  91. package/dist/core/shared/errors.d.ts +5 -0
  92. package/dist/core/shared/errors.js +2 -2
  93. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  94. package/dist/core/store/item-metadata-cache.js +16 -9
  95. package/dist/core/telemetry/runtime.d.ts +6 -0
  96. package/dist/core/telemetry/runtime.js +101 -30
  97. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  98. package/dist/sdk/agent/command-recovery.js +10 -2
  99. package/dist/sdk/annotations.js +4 -4
  100. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  101. package/dist/sdk/cli-bootstrap.js +6 -2
  102. package/dist/sdk/cli-contracts/completeness.js +10 -3
  103. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  104. package/dist/sdk/cli-contracts/flag-contracts.js +9 -3
  105. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  106. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  107. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +40 -6
  108. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +27 -3
  109. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  110. package/dist/sdk/cli-contracts/tool-parameter-tables.js +55 -5
  111. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  112. package/dist/sdk/cli-contracts/tool-schema.js +22 -4
  113. package/dist/sdk/cli-program.js +3 -2
  114. package/dist/sdk/comments.js +4 -3
  115. package/dist/sdk/compile-cache.js +4 -3
  116. package/dist/sdk/completion.js +16 -7
  117. package/dist/sdk/compose.d.ts +3 -1
  118. package/dist/sdk/compose.js +16 -2
  119. package/dist/sdk/context-intent-contracts.js +45 -4
  120. package/dist/sdk/context-signal-store.js +4 -3
  121. package/dist/sdk/core.d.ts +1 -0
  122. package/dist/sdk/core.js +3 -2
  123. package/dist/sdk/extension/install-runtime.js +4 -4
  124. package/dist/sdk/extension/managed-state.js +4 -3
  125. package/dist/sdk/extension-contracts.d.ts +1 -1
  126. package/dist/sdk/flag-invocation-contracts.js +5 -6
  127. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  128. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1597 -0
  129. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  130. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  131. package/dist/sdk/generated-error-code-catalog.js +6 -3140
  132. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  133. package/dist/sdk/governance/assurance-action.js +117 -31
  134. package/dist/sdk/governance/assurance-mutation-error.d.ts +14 -0
  135. package/dist/sdk/governance/assurance-mutation-error.js +58 -0
  136. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  137. package/dist/sdk/governance/assurance-presets.js +136 -0
  138. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  139. package/dist/sdk/governance/assurance-runtime.js +118 -14
  140. package/dist/sdk/governance/assurance.d.ts +51 -6
  141. package/dist/sdk/governance/assurance.js +321 -67
  142. package/dist/sdk/governance/gc.js +5 -11
  143. package/dist/sdk/governance/health.d.ts +3 -1
  144. package/dist/sdk/governance/health.js +24 -7
  145. package/dist/sdk/governance/validate-item-reader.js +3 -3
  146. package/dist/sdk/governance/validate.d.ts +2 -0
  147. package/dist/sdk/governance/validate.js +15 -5
  148. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  149. package/dist/sdk/graph/durable-cache.js +156 -29
  150. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  151. package/dist/sdk/graph/governance-contracts.js +27 -0
  152. package/dist/sdk/graph/governance.d.ts +44 -2
  153. package/dist/sdk/graph/governance.js +156 -12
  154. package/dist/sdk/guide.js +4 -4
  155. package/dist/sdk/index.d.ts +3 -2
  156. package/dist/sdk/index.js +5 -4
  157. package/dist/sdk/lifecycle/claim.js +10 -3
  158. package/dist/sdk/linked-artifacts.d.ts +2 -0
  159. package/dist/sdk/linked-artifacts.js +29 -4
  160. package/dist/sdk/merge/driver.d.ts +2 -2
  161. package/dist/sdk/merge/driver.js +3 -3
  162. package/dist/sdk/merge/install.js +5 -4
  163. package/dist/sdk/merge/receipts.d.ts +6 -4
  164. package/dist/sdk/merge/receipts.js +7 -5
  165. package/dist/sdk/merge/three-way.d.ts +2 -2
  166. package/dist/sdk/merge/three-way.js +3 -3
  167. package/dist/sdk/output-projection.d.ts +9 -1
  168. package/dist/sdk/output-projection.js +45 -9
  169. package/dist/sdk/query/activity.d.ts +49 -2
  170. package/dist/sdk/query/activity.js +185 -38
  171. package/dist/sdk/query/get.js +19 -2
  172. package/dist/sdk/read-output-contracts.d.ts +5 -1
  173. package/dist/sdk/read-output-contracts.js +17 -2
  174. package/dist/sdk/read-output-session.d.ts +2 -0
  175. package/dist/sdk/read-output-session.js +12 -5
  176. package/dist/sdk/relationship-history.js +5 -5
  177. package/dist/sdk/runtime-primitives.d.ts +3 -3
  178. package/dist/sdk/runtime-primitives.js +5 -5
  179. package/dist/sdk/runtime-stats-options.js +3 -2
  180. package/dist/sdk/runtime.js +5 -9
  181. package/dist/sdk/schema-migration.js +4 -4
  182. package/dist/sdk/stats.d.ts +36 -3
  183. package/dist/sdk/stats.js +55 -15
  184. package/dist/sdk/test/execution.d.ts +4 -0
  185. package/dist/sdk/test/execution.js +88 -23
  186. package/dist/sdk/workspace-memory.js +4 -4
  187. package/dist/sdk/workspace-snapshot.js +8 -14
  188. package/dist/sdk/workspace-transaction-gc.js +4 -9
  189. package/dist/sdk/workspace-transaction.js +4 -4
  190. package/dist/sdk/workspace.js +4 -3
  191. package/dist/types.d.ts +2 -0
  192. package/dist/types.js +2 -2
  193. package/docs/ASSURANCE.md +170 -14
  194. package/docs/COMMANDS.md +29 -8
  195. package/docs/CONFIGURATION.md +9 -0
  196. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  197. package/docs/EXTENSIONS.md +11 -12
  198. package/docs/MERGE_SAFETY.md +3 -1
  199. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  200. package/docs/README.md +2 -0
  201. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  202. package/docs/RELATIONSHIP_GRAPH.md +15 -0
  203. package/docs/SDK.md +17 -3
  204. package/docs/SDK_AGENT_SESSION_CONTEXT.md +12 -1
  205. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  206. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  207. package/docs/TESTING.md +24 -15
  208. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  209. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  210. package/marketplace.json +2 -2
  211. package/package.json +6 -6
  212. package/packages/pm-beads/package.json +1 -1
  213. package/packages/pm-calendar/package.json +1 -1
  214. package/packages/pm-command-kit/package.json +1 -1
  215. package/packages/pm-digital-twin/package.json +1 -1
  216. package/packages/pm-governance-audit/package.json +1 -1
  217. package/packages/pm-guide-shell/package.json +1 -1
  218. package/packages/pm-kanban/package.json +1 -1
  219. package/packages/pm-lifecycle-hooks/package.json +1 -1
  220. package/packages/pm-linked-test-adapters/package.json +1 -1
  221. package/packages/pm-search-advanced/package.json +1 -1
  222. package/packages/pm-templates/package.json +1 -1
  223. package/packages/pm-todos/package.json +1 -1
  224. package/packages/pm-vcs/package.json +1 -1
  225. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  226. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  227. package/sdk/public-surface.json +384 -83
  228. package/dist/cli-bundle/chunks/chunk-2OOU2AFH.js +0 -8
  229. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +0 -33
  230. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +0 -13
  231. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +0 -194
  232. package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +0 -2
  233. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +0 -2
  234. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +0 -5
  235. package/dist/cli-bundle/chunks/register-list-query-HAUXVUPY.js +0 -10
  236. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +0 -20
  237. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +0 -2
  239. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +0 -2
  240. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +0 -16
  241. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +0 -8
  242. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +0 -2
  243. package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +0 -31
  244. package/dist/cli-bundle/focused-chunks/chunk-E3KCL7AY.js +0 -5
  245. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +0 -153
  246. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +0 -18
  248. package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +0 -4
  249. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +0 -2
  250. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +0 -17
@@ -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
@@ -5,13 +5,13 @@
5
5
  * optimistic concurrency, deterministic replay, snapshots, and cursor pages.
6
6
  */
7
7
 
8
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c53bb1b7-12b9-5370-a85b-cdd8bef57936")}catch(e){}}();
8
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47")}catch(e){}}();
9
9
  import { createQueryFingerprint, decodeQueryCursorState, paginateQueryRows, } from "./pagination.js";
10
10
  import { constants } from "node:fs";
11
11
  import { lstat, mkdir, open } from "node:fs/promises";
12
12
  import path from "node:path";
13
13
  import { acquireLock } from "../core/lock/lock.js";
14
- import { writeFileAtomic } from "../core/fs/fs-utils.js";
14
+ import { isFileMissingError, writeFileAtomic } from "../core/fs/fs-utils.js";
15
15
  import { stableStringify } from "../core/shared/serialization.js";
16
16
  import { RelationshipGraph, createRelationshipKindRegistry, } from "./relationships.js";
17
17
  function requiredText(value, field) {
@@ -298,7 +298,7 @@ async function resolveRelationshipEventStorePath(pmRoot, relativePath = "relatio
298
298
  throw new TypeError("Relationship event path must not contain symbolic links");
299
299
  }
300
300
  catch (error) {
301
- if (error.code === "ENOENT")
301
+ if (isFileMissingError(error))
302
302
  break;
303
303
  throw error;
304
304
  }
@@ -314,7 +314,7 @@ async function loadRelationshipEventLog(target, nodes, registry) {
314
314
  raw = await handle.readFile("utf8");
315
315
  }
316
316
  catch (error) {
317
- if (error.code === "ENOENT")
317
+ if (isFileMissingError(error))
318
318
  return { log, raw: "" };
319
319
  throw error;
320
320
  }
@@ -517,4 +517,4 @@ export class RelationshipEventStore {
517
517
  }
518
518
  }
519
519
  //# sourceMappingURL=relationship-history.js.map
520
- //# debugId=c53bb1b7-12b9-5370-a85b-cdd8bef57936
520
+ //# debugId=bb5dfa6f-b60f-55f2-ae17-3dbcaaff1b47
@@ -16,10 +16,10 @@ export { resolveRegisteredSearchProvider, resolveRegisteredVectorStoreAdapter, }
16
16
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
17
17
  export { type HistoryDiffValueEntry, computeHistoryDiff, patchPathToChangedField, } from "../core/history/history-diff.js";
18
18
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
19
- 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
20
  export { readHistoryEntries } from "../core/history/read.js";
21
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";
22
- export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, } from "../core/history/replay.js";
22
+ export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
23
23
  export { resolveBodyFileContent } from "../core/io/body-file.js";
24
24
  export { generateItemId, normalizeItemId, normalizeRawItemId, } from "../core/item/id.js";
25
25
  export { canonicalDocument, normalizeItemMetadata, parseItemDocument, serializeItemDocument, } from "../core/item/item-format.js";
@@ -72,7 +72,7 @@ export { splitCommaList } from "../core/shared/split-comma-list.js";
72
72
  export { compareTimestampStrings, nowIso, resolveIsoOrRelative, } from "../core/shared/time.js";
73
73
  export { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
74
74
  export { type CachedDocumentCandidate, listAllDocumentCandidatesCached, } from "../core/store/item-metadata-cache.js";
75
- 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";
76
76
  export { isTerminalPlanMode, shouldCompletePlanOnClose, } from "../core/item/plan-lifecycle.js";
77
77
  export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
78
78
  export { persistSelectedItemFormat, readSettings, readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
@@ -7,7 +7,7 @@
7
7
  * prefer the typed operations exported by the main SDK barrel.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="16d4bbae-03b7-5316-8e26-77f33affdcf6")}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
13
  export { createUnknownSubcommandError, } from "./agent/subcommand-recovery.js";
@@ -18,10 +18,10 @@ export { resolveRegisteredSearchProvider, resolveRegisteredVectorStoreAdapter, }
18
18
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
19
19
  export { computeHistoryDiff, patchPathToChangedField, } from "../core/history/history-diff.js";
20
20
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
21
- 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
22
  export { readHistoryEntries } from "../core/history/read.js";
23
23
  export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
24
- export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, } from "../core/history/replay.js";
24
+ export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, verifyHistoryChainWithVersion, } from "../core/history/replay.js";
25
25
  export { resolveBodyFileContent } from "../core/io/body-file.js";
26
26
  export { generateItemId, normalizeItemId, normalizeRawItemId, } from "../core/item/id.js";
27
27
  export { canonicalDocument, normalizeItemMetadata, parseItemDocument, serializeItemDocument, } from "../core/item/item-format.js";
@@ -73,7 +73,7 @@ export { splitCommaList } from "../core/shared/split-comma-list.js";
73
73
  export { compareTimestampStrings, nowIso, resolveIsoOrRelative, } from "../core/shared/time.js";
74
74
  export { migrateItemFilesToFormat } from "../core/store/item-format-migration.js";
75
75
  export { listAllDocumentCandidatesCached, } from "../core/store/item-metadata-cache.js";
76
- 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";
77
77
  export { isTerminalPlanMode, shouldCompletePlanOnClose, } from "../core/item/plan-lifecycle.js";
78
78
  export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
79
79
  export { persistSelectedItemFormat, readSettings, readSettingsWithMetadata, writeSettings, } from "../core/store/settings.js";
@@ -81,4 +81,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
81
81
  export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
82
82
  export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
83
83
  //# sourceMappingURL=runtime-primitives.js.map
84
- //# debugId=16d4bbae-03b7-5316-8e26-77f33affdcf6
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
@@ -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]="a294f940-5bb9-55a4-bf2c-64842a3a177b")}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";
@@ -33,7 +33,7 @@ import { applyContextIntentProjection, attachReadOutputContracts, } from "./cont
33
33
  import { runWithDiscoveredContextIntentContracts, } from "./context-intent-runtime.js";
34
34
  import { validateReadOutputOptions, } from "./read-output-contracts.js";
35
35
  export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
36
- import { runActivity } from "./query/activity.js";
36
+ import { normalizeActivityProjectionOptions, runActivity, } from "./query/activity.js";
37
37
  import { runAssuranceDispatch } from "./governance/assurance-action.js";
38
38
  import { runAggregate, } from "./query/aggregate.js";
39
39
  import { runAppend } from "./lifecycle/append.js";
@@ -1456,12 +1456,8 @@ function runMcpConfigAction(ctx) {
1456
1456
  "project", configAction, readString(ctx.args, "key") ?? readString(ctx.options, "key"), ctx.options, ctx.global, readString(ctx.args, "value") ?? readString(ctx.options, "value"));
1457
1457
  }
1458
1458
  function runMcpActivityAction(ctx) {
1459
- const activityOptions = { ...ctx.options };
1460
- if (activityOptions.compact === undefined) {
1461
- activityOptions.compact = activityOptions.full === true ? false : true;
1462
- }
1463
- delete activityOptions.full;
1464
- return runActivity(activityOptions, ctx.global);
1459
+ const options = ctx.options;
1460
+ return runActivity(normalizeActivityProjectionOptions(options), ctx.global);
1465
1461
  }
1466
1462
  function parseMcpIntegerPrefix(value, label) {
1467
1463
  if (typeof value === "number") {
@@ -1934,4 +1930,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
1934
1930
  }
1935
1931
  }
1936
1932
  //# sourceMappingURL=runtime.js.map
1937
- //# debugId=a294f940-5bb9-55a4-bf2c-64842a3a177b
1933
+ //# debugId=7c27b516-1714-5f2b-8304-98e8372280be
@@ -7,11 +7,11 @@
7
7
  * guarantees.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7d175791-016d-59b6-a44d-a70371f36751")}catch(e){}}();
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cd777de3-665f-5e01-ac98-8986f2a5a4c2")}catch(e){}}();
11
11
  import { createHash } from "node:crypto";
12
12
  import fs from "node:fs/promises";
13
13
  import path from "node:path";
14
- import { pathExists, readFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
14
+ import { isFileMissingError, pathExists, readFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
15
15
  import { appendWorkspaceHistoryChange } from "../core/history/workspace-history.js";
16
16
  import { resolveItemTypeRegistry } from "../core/item/type-registry.js";
17
17
  import { parseFieldsFile, serializeFieldsFile, } from "../core/schema/fields-file.js";
@@ -681,7 +681,7 @@ async function collectSchemaReferenceState(params) {
681
681
  if (typeof error !== "object" ||
682
682
  error === null ||
683
683
  !("code" in error) ||
684
- error.code !== "ENOENT") {
684
+ !isFileMissingError(error)) {
685
685
  throw error;
686
686
  }
687
687
  }
@@ -855,4 +855,4 @@ export const schemaMigrationTestOnly = {
855
855
  validateAndStoreMigrationPlan,
856
856
  };
857
857
  //# sourceMappingURL=schema-migration.js.map
858
- //# debugId=7d175791-016d-59b6-a44d-a70371f36751
858
+ //# debugId=cd777de3-665f-5e01-ac98-8986f2a5a4c2
@@ -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>;
package/dist/sdk/stats.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Implements the pm stats 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]="a4de53c1-bb22-591f-a064-142c642a2443")}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]="d28c7ac7-9801-5b0c-84c9-51deede398be")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { getActiveExtensionRegistrations, runActiveOnReadHooks, } from "../core/extensions/index.js";
@@ -36,6 +36,53 @@ function zeroByStatus(statuses) {
36
36
  return acc;
37
37
  }, {});
38
38
  }
39
+ function projectStatsDistributions(items, itemTypes, statuses, classifier, includeEmpty) {
40
+ const grouped = groupItemsByDimension(items, "type", classifier);
41
+ const presentTypes = new Set(grouped.rows.map((row) => row.key));
42
+ const missingTypes = itemTypes.filter((type) => !presentTypes.has(type));
43
+ const groupedRows = includeEmpty
44
+ ? [
45
+ ...grouped.rows,
46
+ ...missingTypes.map((type) => ({
47
+ label: type,
48
+ key: type,
49
+ total: 0,
50
+ buckets: {
51
+ open: 0,
52
+ in_progress: 0,
53
+ blocked: 0,
54
+ draft: 0,
55
+ closed: 0,
56
+ canceled: 0,
57
+ other: 0,
58
+ },
59
+ })),
60
+ ]
61
+ : grouped.rows;
62
+ const byType = groupedRows.map((row) => ({
63
+ type: row.key ?? row.label,
64
+ total: row.total,
65
+ open: row.buckets.open,
66
+ in_progress: row.buckets.in_progress,
67
+ blocked: row.buckets.blocked,
68
+ draft: row.buckets.draft,
69
+ closed: row.buckets.closed,
70
+ canceled: row.buckets.canceled,
71
+ other: row.buckets.other,
72
+ }));
73
+ const counts = zeroByStatus([...statuses]);
74
+ for (const item of items)
75
+ counts[item.status] += 1;
76
+ const byStatus = Object.fromEntries(Object.entries(counts).filter(([, count]) => includeEmpty || count > 0));
77
+ return {
78
+ byType,
79
+ byStatus,
80
+ omitted: includeEmpty
81
+ ? 0
82
+ : missingTypes.length +
83
+ Object.values(counts).filter((count) => count === 0).length,
84
+ };
85
+ }
39
86
  function countNonEmptyLines(raw) {
40
87
  if (raw.trim().length === 0) {
41
88
  return 0;
@@ -75,6 +122,7 @@ export const _testOnly = {
75
122
  zeroByStatus,
76
123
  countNonEmptyLines,
77
124
  readHistoryStreamContents,
125
+ projectStatsDistributions,
78
126
  };
79
127
  async function recordStatsObservations(global, options) {
80
128
  const recorded = [];
@@ -129,12 +177,13 @@ async function requestedHistoryAnalytics(pmRoot, items, settings, terminalStatus
129
177
  : undefined,
130
178
  };
131
179
  }
132
- function assembleStatsResult(totals, byType, byStatus, optional) {
180
+ function assembleStatsResult(totals, byType, byStatus, omittedZeroBuckets, optional) {
133
181
  const hasBreakdowns = Object.keys(optional.breakdowns).length > 0;
134
182
  return {
135
183
  totals,
136
184
  by_type: byType,
137
185
  by_status: byStatus,
186
+ omitted_zero_buckets: omittedZeroBuckets,
138
187
  ...(optional.metadataCoverage
139
188
  ? { metadata_coverage: optional.metadataCoverage }
140
189
  : {}),
@@ -180,16 +229,8 @@ export async function runStats(global, options = {}) {
180
229
  itemIds: items.map((item) => item.id),
181
230
  commandLabel: "stats",
182
231
  });
183
- const byType = zeroByType(typeRegistry.types);
184
- const byStatus = zeroByStatus(statusRegistry.definitions.map((definition) => definition.id));
185
- // zeroByType/zeroByStatus pre-seed a bucket for every registry type/status, and
186
- // the light item-metadata reader drops any item whose type/status falls outside
187
- // the active registry (parse rejects them) — so every item's bucket is already
188
- // present here and no on-the-fly initialization is reachable.
189
- for (const item of items) {
190
- byType[item.type] += 1;
191
- byStatus[item.status] += 1;
192
- }
232
+ const classifier = lifecycleClassifierFromStatusRegistry(statusRegistry);
233
+ const distributions = projectStatsDistributions(items, typeRegistry.types, statusRegistry.definitions.map((definition) => definition.id), classifier, options.includeEmpty === true);
193
234
  const streams = await readHistoryStreamContents(pmRoot);
194
235
  let historyEntries = 0;
195
236
  for (const stream of streams) {
@@ -198,7 +239,6 @@ export async function runStats(global, options = {}) {
198
239
  const storage = options.storage
199
240
  ? computeHistoryStorageStats(streams)
200
241
  : undefined;
201
- const classifier = lifecycleClassifierFromStatusRegistry(statusRegistry);
202
242
  const metadataCoverage = options.metadataCoverage
203
243
  ? computeMetadataCoverage(items, classifier)
204
244
  : undefined;
@@ -219,7 +259,7 @@ export async function runStats(global, options = {}) {
219
259
  items: items.length,
220
260
  history_streams: streams.length,
221
261
  history_entries: historyEntries,
222
- }, byType, byStatus, {
262
+ }, distributions.byType, distributions.byStatus, distributions.omitted, {
223
263
  metadataCoverage,
224
264
  breakdowns,
225
265
  storage,
@@ -231,4 +271,4 @@ export async function runStats(global, options = {}) {
231
271
  });
232
272
  }
233
273
  //# sourceMappingURL=stats.js.map
234
- //# debugId=a4de53c1-bb22-591f-a064-142c642a2443
274
+ //# debugId=d28c7ac7-9801-5b0c-84c9-51deede398be
@@ -35,6 +35,8 @@ export interface TestCommandOptions {
35
35
  addJson?: string[];
36
36
  /** Value that configures or reports remove for this contract. */
37
37
  remove?: string[];
38
+ /** Remove linked tests by their stable 1-based list position. */
39
+ removeIndex?: Array<string | number>;
38
40
  /** Value that configures or reports list for this contract. */
39
41
  list?: boolean;
40
42
  /** Value that configures or reports run for this contract. */
@@ -146,6 +148,8 @@ export interface TestResult {
146
148
  changed: boolean;
147
149
  /** Value that configures or reports count for this contract. */
148
150
  count: number;
151
+ /** Number of linked-test entries removed by this mutation. */
152
+ removed?: number;
149
153
  /** Measurements supplied for the current producing run. */
150
154
  measurements?: TestRunMeasurement[];
151
155
  /** Existing and current measurements below the selected threshold. */