@unbrained/pm-cli 2026.8.11 → 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 (184) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +52 -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 +80 -13
  6. package/dist/cli/main.js +34 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-list-query.js +10 -7
  9. package/dist/cli/register-operations.js +16 -6
  10. package/dist/cli-bundle/bundle-manifest.json +157 -157
  11. package/dist/cli-bundle/chunks/{chunk-2OOU2AFH.js → chunk-3PS7X6GS.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +13 -0
  13. package/dist/cli-bundle/chunks/{chunk-WMEZHCFI.js → chunk-BM5YJ2UW.js} +51 -43
  14. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +33 -0
  15. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +196 -0
  16. package/dist/cli-bundle/chunks/{chunk-ZU34C3LH.js → chunk-KOQMGCTA.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-R76342NV.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +5 -0
  19. package/dist/cli-bundle/chunks/{chunk-IUNRVDAI.js → chunk-VLUQOIDT.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-A2SJGHSI.js → chunk-WLAHPSOX.js} +2 -2
  21. package/dist/cli-bundle/chunks/register-list-query-XPCJRUUD.js +10 -0
  22. package/dist/cli-bundle/chunks/register-mutation-4RJCBKRS.js +20 -0
  23. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +2 -0
  24. package/dist/cli-bundle/chunks/{register-setup-NOCOOWQY.js → register-setup-LLHAKP2V.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +5 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +155 -0
  27. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-FPSYO5ZG.js → chunk-ECADZMVC.js} +11 -11
  29. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +16 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-BKPIY34S.js → chunk-GQW4BPUT.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-UDAZWT25.js → chunk-JAFRIWVF.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-2DL3MRTD.js → chunk-KHM2CS2C.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-J5EKAIVD.js → chunk-KPSXVBDV.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-23FTGO3W.js → chunk-KTLOKKCQ.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +8 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-KDH5OX3D.js → chunk-NBLUKITQ.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-55BIB6DV.js → chunk-NYLOUPOB.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-DPO7TEFX.js → chunk-Q4T463SD.js} +28 -28
  41. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-TL5M2PAY.js → chunk-RWPAWUOT.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +17 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-4H5IA6AV.js → chunk-YIAXMC3T.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/chunk-ZMGWAYH7.js +2 -0
  46. package/dist/cli-bundle/main.js +13 -13
  47. package/dist/cli-bundle/sdk-authoring.js +1 -1
  48. package/dist/cli-bundle/sdk-contracts.js +1 -1
  49. package/dist/cli-bundle/sdk-core.js +40 -40
  50. package/dist/cli-bundle/sdk-governance.js +1 -1
  51. package/dist/cli-bundle/sdk-graph.js +1 -1
  52. package/dist/cli-bundle/sdk-merge.js +1 -1
  53. package/dist/cli-bundle/sdk-query.js +1 -1
  54. package/dist/cli-bundle/sdk-runtime.js +1 -1
  55. package/dist/cli-bundle/sdk-testing.js +1 -1
  56. package/dist/cli-bundle/sdk.js +2 -2
  57. package/dist/core/extensions/reserved-host-flags.js +3 -2
  58. package/dist/core/history/drift-scan.js +13 -8
  59. package/dist/core/history/history.d.ts +8 -0
  60. package/dist/core/history/history.js +57 -7
  61. package/dist/core/history/replay.d.ts +9 -1
  62. package/dist/core/history/replay.js +48 -13
  63. package/dist/core/output/output.d.ts +2 -0
  64. package/dist/core/output/output.js +46 -14
  65. package/dist/core/shared/command-types.d.ts +2 -0
  66. package/dist/core/shared/command-types.js +2 -2
  67. package/dist/core/shared/errors.d.ts +5 -0
  68. package/dist/core/shared/errors.js +2 -2
  69. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  70. package/dist/core/store/item-metadata-cache.js +14 -7
  71. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  72. package/dist/sdk/cli-bootstrap.js +6 -2
  73. package/dist/sdk/cli-contracts/completeness.js +3 -2
  74. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  75. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  76. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  77. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +8 -6
  78. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +4 -3
  79. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  80. package/dist/sdk/cli-contracts/tool-parameter-tables.js +22 -2
  81. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  82. package/dist/sdk/cli-contracts/tool-schema.js +7 -4
  83. package/dist/sdk/cli-program.js +3 -2
  84. package/dist/sdk/completion.js +16 -7
  85. package/dist/sdk/context-intent-contracts.js +45 -4
  86. package/dist/sdk/core.d.ts +1 -0
  87. package/dist/sdk/core.js +3 -2
  88. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  89. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1585 -0
  90. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  91. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  92. package/dist/sdk/generated-error-code-catalog.js +6 -3140
  93. package/dist/sdk/governance/assurance-action.js +9 -7
  94. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  95. package/dist/sdk/governance/assurance-mutation-error.js +35 -0
  96. package/dist/sdk/governance/assurance-runtime.js +11 -8
  97. package/dist/sdk/governance/assurance.d.ts +12 -6
  98. package/dist/sdk/governance/assurance.js +181 -66
  99. package/dist/sdk/governance/health.d.ts +3 -1
  100. package/dist/sdk/governance/health.js +21 -4
  101. package/dist/sdk/governance/validate-item-reader.js +3 -3
  102. package/dist/sdk/governance/validate.d.ts +2 -0
  103. package/dist/sdk/governance/validate.js +13 -3
  104. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  105. package/dist/sdk/graph/durable-cache.js +98 -29
  106. package/dist/sdk/graph/governance.d.ts +14 -0
  107. package/dist/sdk/graph/governance.js +34 -9
  108. package/dist/sdk/index.d.ts +1 -1
  109. package/dist/sdk/index.js +3 -3
  110. package/dist/sdk/lifecycle/claim.js +10 -3
  111. package/dist/sdk/merge/driver.d.ts +2 -2
  112. package/dist/sdk/merge/driver.js +3 -3
  113. package/dist/sdk/merge/receipts.d.ts +6 -4
  114. package/dist/sdk/merge/receipts.js +7 -5
  115. package/dist/sdk/merge/three-way.d.ts +2 -2
  116. package/dist/sdk/merge/three-way.js +3 -3
  117. package/dist/sdk/output-projection.d.ts +9 -1
  118. package/dist/sdk/output-projection.js +45 -9
  119. package/dist/sdk/query/activity.d.ts +49 -2
  120. package/dist/sdk/query/activity.js +183 -37
  121. package/dist/sdk/query/get.js +19 -2
  122. package/dist/sdk/read-output-contracts.d.ts +5 -1
  123. package/dist/sdk/read-output-contracts.js +17 -2
  124. package/dist/sdk/read-output-session.d.ts +2 -0
  125. package/dist/sdk/read-output-session.js +12 -5
  126. package/dist/sdk/runtime-primitives.d.ts +3 -3
  127. package/dist/sdk/runtime-primitives.js +5 -5
  128. package/dist/sdk/runtime-stats-options.js +3 -2
  129. package/dist/sdk/runtime.js +5 -9
  130. package/dist/sdk/stats.d.ts +36 -3
  131. package/dist/sdk/stats.js +55 -15
  132. package/dist/sdk/test/execution.d.ts +4 -0
  133. package/dist/sdk/test/execution.js +86 -21
  134. package/dist/types.d.ts +2 -0
  135. package/dist/types.js +2 -2
  136. package/docs/ASSURANCE.md +17 -12
  137. package/docs/COMMANDS.md +29 -8
  138. package/docs/CONFIGURATION.md +7 -0
  139. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  140. package/docs/MERGE_SAFETY.md +3 -1
  141. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  142. package/docs/README.md +2 -0
  143. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  144. package/docs/SDK_AGENT_SESSION_CONTEXT.md +12 -1
  145. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  146. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  147. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  148. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  149. package/marketplace.json +2 -2
  150. package/package.json +5 -5
  151. package/packages/pm-beads/package.json +1 -1
  152. package/packages/pm-calendar/package.json +1 -1
  153. package/packages/pm-command-kit/package.json +1 -1
  154. package/packages/pm-digital-twin/package.json +1 -1
  155. package/packages/pm-governance-audit/package.json +1 -1
  156. package/packages/pm-guide-shell/package.json +1 -1
  157. package/packages/pm-kanban/package.json +1 -1
  158. package/packages/pm-lifecycle-hooks/package.json +1 -1
  159. package/packages/pm-linked-test-adapters/package.json +1 -1
  160. package/packages/pm-search-advanced/package.json +1 -1
  161. package/packages/pm-templates/package.json +1 -1
  162. package/packages/pm-todos/package.json +1 -1
  163. package/packages/pm-vcs/package.json +1 -1
  164. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  165. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  166. package/sdk/public-surface.json +203 -52
  167. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +0 -33
  168. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +0 -13
  169. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +0 -194
  170. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +0 -2
  171. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +0 -5
  172. package/dist/cli-bundle/chunks/register-list-query-HAUXVUPY.js +0 -10
  173. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +0 -20
  174. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +0 -2
  175. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +0 -2
  176. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +0 -2
  177. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +0 -16
  178. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +0 -8
  179. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +0 -2
  180. package/dist/cli-bundle/focused-chunks/chunk-E3KCL7AY.js +0 -5
  181. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +0 -153
  182. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +0 -2
  183. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +0 -2
  184. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +0 -17
@@ -9,7 +9,7 @@
9
9
  * merge never corrupts tracker storage the way raw conflict markers do.
10
10
  */
11
11
 
12
- !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]="e739a603-35c5-5df9-8d4b-3bbc0fe3e4fd")}catch(e){}}();
12
+ !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]="8d79e3a4-6104-5855-837f-69a041b87b27")}catch(e){}}();
13
13
  import { readFile, writeFile } from "node:fs/promises";
14
14
  import path from "node:path";
15
15
  import { getActiveExtensionRegistrations } from "../../core/extensions/index.js";
@@ -179,7 +179,7 @@ export async function runMergeDriver(options, global) {
179
179
  ok: conflicts.length === 0,
180
180
  artifact,
181
181
  output_path: outputPath,
182
- preferred,
182
+ requested_preference: preferred,
183
183
  conflicts,
184
184
  ...result,
185
185
  guidance,
@@ -187,4 +187,4 @@ export async function runMergeDriver(options, global) {
187
187
  };
188
188
  }
189
189
  //# sourceMappingURL=driver.js.map
190
- //# debugId=e739a603-35c5-5df9-8d4b-3bbc0fe3e4fd
190
+ //# debugId=8d79e3a4-6104-5855-837f-69a041b87b27
@@ -9,8 +9,10 @@ export interface MergeDecisionReceipt {
9
9
  item_path: string;
10
10
  /** Item id derived from the merged document path. */
11
11
  item_id: string;
12
- /** Preferred side used for scalar conflicts. */
13
- preferred: MergePreferredSide;
12
+ /** Side requested by the caller; stable-value decisions can retain either side. */
13
+ requested_preference?: MergePreferredSide;
14
+ /** Legacy schema-v1 key accepted while reading older clone-local receipts. */
15
+ preferred?: MergePreferredSide;
14
16
  /** Scalar-conflict selection contract used by the item driver. */
15
17
  conflict_resolution: "preferred_side" | "stable_value_order";
16
18
  /** Fields selected cleanly from the other branch. */
@@ -42,8 +44,8 @@ export interface MergeDecisionReceiptSummary {
42
44
  fields_from_theirs: string[];
43
45
  /** Collections combined from both branches. */
44
46
  union_fields: string[];
45
- /** Preferred side used for scalar conflicts. */
46
- preferred: MergePreferredSide;
47
+ /** Side requested by the caller; decision hashes prove the actual retained values. */
48
+ requested_preference: MergePreferredSide;
47
49
  /** Scalar-conflict selection contract used by the item driver. */
48
50
  conflict_resolution: "preferred_side" | "stable_value_order";
49
51
  /** Hashes proving the retained and discarded values without publishing them. */
@@ -7,7 +7,7 @@
7
7
  * value for the coordinator that performed the merge.
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]="59863597-bf57-5d96-9cba-983443e5b209")}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]="7b87b458-164a-5332-8803-6b0695481644")}catch(e){}}();
11
11
  import { execFile } from "node:child_process";
12
12
  import { randomUUID } from "node:crypto";
13
13
  import { readdir, readFile } from "node:fs/promises";
@@ -58,7 +58,7 @@ export function summarizeMergeReceipt(receipt) {
58
58
  conflict_fields: receipt.decisions.map((decision) => decision.field),
59
59
  fields_from_theirs: receipt.fields_from_theirs,
60
60
  union_fields: receipt.union_fields,
61
- preferred: receipt.preferred,
61
+ requested_preference: receipt.requested_preference ?? receipt.preferred ?? "ours",
62
62
  conflict_resolution: receipt.conflict_resolution,
63
63
  decisions: receipt.decisions.map((decision) => ({
64
64
  field: decision.field,
@@ -99,7 +99,7 @@ export async function writeMergeReceipt(params) {
99
99
  id: randomUUID(),
100
100
  item_path: itemPath.replaceAll("\\", "/"),
101
101
  item_id: itemId,
102
- preferred: params.preferred,
102
+ requested_preference: params.preferred,
103
103
  conflict_resolution: params.conflictResolution ?? "preferred_side",
104
104
  fields_from_theirs: [...params.fieldsFromTheirs],
105
105
  union_fields: [...params.unionFields],
@@ -147,8 +147,10 @@ async function readReceiptsFromDirectory(directory, options) {
147
147
  continue;
148
148
  try {
149
149
  const parsed = JSON.parse(await readFile(path.join(directory, name), "utf8"));
150
+ const { preferred: legacyPreference, ...receiptWithoutLegacyKey } = parsed;
150
151
  const normalizedReceipt = {
151
- ...parsed,
152
+ ...receiptWithoutLegacyKey,
153
+ requested_preference: parsed.requested_preference ?? legacyPreference ?? "ours",
152
154
  conflict_resolution: parsed.conflict_resolution ?? "preferred_side",
153
155
  };
154
156
  if (normalizedReceipt.version === 1 &&
@@ -218,4 +220,4 @@ export async function runMergeReceiptReport(options) {
218
220
  };
219
221
  }
220
222
  //# sourceMappingURL=receipts.js.map
221
- //# debugId=59863597-bf57-5d96-9cba-983443e5b209
223
+ //# debugId=7b87b458-164a-5332-8803-6b0695481644
@@ -98,8 +98,8 @@ export interface ItemDocumentMergeResult {
98
98
  union_fields: string[];
99
99
  /** Scalar conflict decisions; callers choose a privacy-appropriate persistence boundary. */
100
100
  conflict_decisions: ItemMergeConflictDecision[];
101
- /** Which side unresolvable conflicts were resolved toward. */
102
- preferred: MergePreferredSide;
101
+ /** Side requested by the caller; stable-value decisions can retain either side. */
102
+ requested_preference: MergePreferredSide;
103
103
  /** Scalar-conflict selection contract used for this merge. */
104
104
  conflict_resolution: "preferred_side" | "stable_value_order";
105
105
  }
@@ -9,7 +9,7 @@
9
9
  * definition for multi-branch agent workflows.
10
10
  */
11
11
 
12
- !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]="f6f04eec-0698-5e5b-a40e-de3a4be89f95")}catch(e){}}();
12
+ !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]="3c9d6924-ae7c-57c3-a346-1e2189c532fa")}catch(e){}}();
13
13
  import { historyEntriesToRaw, reanchorHistoryEntries, } from "../../core/history/replay.js";
14
14
  import { canonicalDocument, parseItemDocument, serializeItemDocument, } from "../../core/item/item-format.js";
15
15
  import { EXIT_CODE } from "../../core/shared/constants.js";
@@ -468,7 +468,7 @@ export function mergeItemDocuments(baseRaw, oursRaw, theirsRaw, options = {}) {
468
468
  fields_from_theirs: fieldsFromTheirs,
469
469
  union_fields: unionFields,
470
470
  conflict_decisions: conflictDecisions,
471
- preferred,
471
+ requested_preference: preferred,
472
472
  conflict_resolution: conflictResolution,
473
473
  };
474
474
  }
@@ -625,4 +625,4 @@ export function mergeJsonDocuments(baseRaw, oursRaw, theirsRaw, options = {}) {
625
625
  };
626
626
  }
627
627
  //# sourceMappingURL=three-way.js.map
628
- //# debugId=f6f04eec-0698-5e5b-a40e-de3a4be89f95
628
+ //# debugId=3c9d6924-ae7c-57c3-a346-1e2189c532fa
@@ -23,6 +23,8 @@ export interface OutputProjectionDeclaration {
23
23
  /** Names of declared groups present in this result. */
24
24
  included_field_groups: string[];
25
25
  }
26
+ /** Register non-serialized materiality evidence used to keep omission receipts token-proportional. */
27
+ export declare function registerOutputMaterialFieldGroups(result: object, fieldGroups: readonly string[]): void;
26
28
  /** Machine-readable location and field-projection support for read-result rows. */
27
29
  export interface ReadRowContract {
28
30
  /** Canonical read command that owns the result. */
@@ -35,6 +37,8 @@ export interface ReadRowContract {
35
37
  fields: "supported" | "unsupported";
36
38
  /** Universal jq expression that iterates every declared collection path. */
37
39
  jq_selector?: string;
40
+ /** TOON row encoding selected whenever every row is a flat object with one shared key set. */
41
+ toon_encoding?: "tabular_when_uniform";
38
42
  }
39
43
  /** Universal selector for results carrying a {@link ReadRowContract}. */
40
44
  export declare const PM_READ_ROW_JQ_SELECTOR = ".row_contract.row_keys[] as $key | getpath($key | split(\".\")) | if type == \"array\" then .[] else if type == \"object\" then to_entries[] else empty end end";
@@ -61,7 +65,7 @@ export declare const PM_READ_ROW_CONTRACTS: {
61
65
  readonly fields: "supported";
62
66
  };
63
67
  readonly activity: {
64
- readonly row_keys: readonly ["compact_activity", "provenance_activity", "activity"];
68
+ readonly row_keys: readonly ["activity_digest", "compact_activity", "provenance_activity", "activity"];
65
69
  readonly fields: "unsupported";
66
70
  };
67
71
  readonly history: {
@@ -131,6 +135,10 @@ export declare const PM_MODE_PAIRED_OUTPUT_PROJECTION_CONTRACTS: readonly [{
131
135
  readonly command: "activity";
132
136
  readonly complete_mode: "full";
133
137
  readonly omissions_by_mode: {
138
+ readonly digest: readonly [{
139
+ readonly name: "event_rows";
140
+ readonly restore_with: "--raw";
141
+ }];
134
142
  readonly compact: readonly [{
135
143
  readonly name: "provenance";
136
144
  readonly restore_with: "--full";
@@ -4,9 +4,14 @@
4
4
  * Declares machine-readable field-group omissions for bounded command results.
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]="630b48a7-aa38-529c-a272-14b7c748101c")}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]="d059aa19-3822-5ff4-b4be-e2be8f537d1e")}catch(e){}}();
8
8
  import { EXIT_CODE } from "../core/shared/constants.js";
9
9
  import { PmCliError } from "../core/shared/errors.js";
10
+ const MATERIAL_FIELD_GROUPS_BY_RESULT = new WeakMap();
11
+ /** Register non-serialized materiality evidence used to keep omission receipts token-proportional. */
12
+ export function registerOutputMaterialFieldGroups(result, fieldGroups) {
13
+ MATERIAL_FIELD_GROUPS_BY_RESULT.set(result, new Set(fieldGroups));
14
+ }
10
15
  /** Universal selector for results carrying a {@link ReadRowContract}. */
11
16
  export const PM_READ_ROW_JQ_SELECTOR = '.row_contract.row_keys[] as $key | getpath($key | split(".")) | if type == "array" then .[] else if type == "object" then to_entries[] else empty end end';
12
17
  /** Static row declarations shared by CLI, SDK, MCP, and package consumers. */
@@ -26,7 +31,12 @@ export const PM_READ_ROW_CONTRACTS = {
26
31
  },
27
32
  search: { row_keys: ["items"], fields: "supported" },
28
33
  activity: {
29
- row_keys: ["compact_activity", "provenance_activity", "activity"],
34
+ row_keys: [
35
+ "activity_digest",
36
+ "compact_activity",
37
+ "provenance_activity",
38
+ "activity",
39
+ ],
30
40
  fields: "unsupported",
31
41
  },
32
42
  history: {
@@ -58,6 +68,12 @@ export const PM_MODE_PAIRED_OUTPUT_PROJECTION_CONTRACTS = [
58
68
  command: "activity",
59
69
  complete_mode: "full",
60
70
  omissions_by_mode: {
71
+ digest: [
72
+ {
73
+ name: "event_rows",
74
+ restore_with: "--raw",
75
+ },
76
+ ],
61
77
  compact: [
62
78
  {
63
79
  name: "provenance",
@@ -139,16 +155,23 @@ const CONTEXT_FIELD_GROUPS = [
139
155
  function isRecord(value) {
140
156
  return typeof value === "object" && value !== null && !Array.isArray(value);
141
157
  }
158
+ const READ_ROW_TOON_ENCODINGS = new Set([
159
+ undefined,
160
+ "tabular_when_uniform",
161
+ ]);
162
+ const READ_ROW_KINDS = new Set(["collection", "none"]);
163
+ const READ_ROW_FIELD_MODES = new Set(["supported", "unsupported"]);
142
164
  /** Return whether an unknown value is a structurally valid row declaration. */
143
165
  export function isReadRowContract(value) {
144
166
  return (isRecord(value) &&
145
167
  typeof value.command === "string" &&
146
168
  value.command.trim().length > 0 &&
147
- (value.row_kind === "collection" || value.row_kind === "none") &&
169
+ READ_ROW_KINDS.has(value.row_kind) &&
148
170
  Array.isArray(value.row_keys) &&
149
171
  value.row_keys.every((key) => typeof key === "string" && key.length > 0) &&
150
172
  new Set(value.row_keys).size === value.row_keys.length &&
151
- (value.fields === "supported" || value.fields === "unsupported") &&
173
+ READ_ROW_FIELD_MODES.has(value.fields) &&
174
+ READ_ROW_TOON_ENCODINGS.has(value.toon_encoding) &&
152
175
  (value.row_kind === "collection"
153
176
  ? value.row_keys.length > 0 &&
154
177
  typeof value.jq_selector === "string" &&
@@ -183,7 +206,12 @@ const READ_RESULT_SENTINEL_KEYS = {
183
206
  "held_by_others",
184
207
  ],
185
208
  search: ["items", "projection"],
186
- activity: ["compact_activity", "provenance_activity", "activity"],
209
+ activity: [
210
+ "activity_digest",
211
+ "compact_activity",
212
+ "provenance_activity",
213
+ "activity",
214
+ ],
187
215
  history: ["compact_history", "provenance_history", "history"],
188
216
  deps: ["tree", "graph", "projection"],
189
217
  health: ["checks"],
@@ -220,6 +248,7 @@ export function resolveReadRowContract(command, result) {
220
248
  ...(activeRowKeys.length > 0
221
249
  ? { jq_selector: PM_READ_ROW_JQ_SELECTOR }
222
250
  : {}),
251
+ toon_encoding: "tabular_when_uniform",
223
252
  };
224
253
  }
225
254
  const declaration = PM_READ_ROW_CONTRACTS[rootCommand];
@@ -243,6 +272,7 @@ export function resolveReadRowContract(command, result) {
243
272
  ...(rowKeys.length > 0
244
273
  ? { jq_selector: PM_READ_ROW_JQ_SELECTOR }
245
274
  : {}),
275
+ toon_encoding: "tabular_when_uniform",
246
276
  };
247
277
  })();
248
278
  }
@@ -301,11 +331,17 @@ function resolveGetReceipt(result) {
301
331
  "linked",
302
332
  "schedule",
303
333
  ];
304
- const groups = ["body", ...itemGroups, ...resultGroups.slice(1)].map((name) => ({
334
+ const materialGroups = MATERIAL_FIELD_GROUPS_BY_RESULT.get(result);
335
+ const ownerFor = (name) => itemGroups.includes(name) || name === "body" ? item : result;
336
+ const groups = ["body", ...itemGroups, ...resultGroups.slice(1)]
337
+ .filter((name) => materialGroups === undefined ||
338
+ materialGroups.has(name) ||
339
+ Object.hasOwn(ownerFor(name), name))
340
+ .map((name) => ({
305
341
  name,
306
342
  restore_with: `--fields ${name}`,
307
343
  }));
308
- return createOutputOmissionReceipt(groups, new Set(groups.flatMap(({ name }) => !Object.hasOwn(itemGroups.includes(name) ? item : result, name)
344
+ return createOutputOmissionReceipt(groups, new Set(groups.flatMap(({ name }) => !Object.hasOwn(ownerFor(name), name)
309
345
  ? []
310
346
  : [name])));
311
347
  }
@@ -361,6 +397,7 @@ export function attachOutputOmissionReceipt(command, result) {
361
397
  if (command === undefined || !isRecord(result)) {
362
398
  return result;
363
399
  }
400
+ const receipt = resolveOutputOmissionReceipt(command, result);
364
401
  const declaredRowContract = result.row_contract;
365
402
  const rowContract = isReadRowContract(declaredRowContract)
366
403
  ? declaredRowContract
@@ -372,10 +409,9 @@ export function attachOutputOmissionReceipt(command, result) {
372
409
  : result;
373
410
  if (isRecord(disclosedResult.omission_receipt))
374
411
  return disclosedResult;
375
- const receipt = resolveOutputOmissionReceipt(command, disclosedResult);
376
412
  return receipt === undefined
377
413
  ? disclosedResult
378
414
  : { ...disclosedResult, omission_receipt: receipt };
379
415
  }
380
416
  //# sourceMappingURL=output-projection.js.map
381
- //# debugId=630b48a7-aa38-529c-a272-14b7c748101c
417
+ //# debugId=d059aa19-3822-5ff4-b4be-e2be8f537d1e
@@ -18,6 +18,8 @@ export interface ActivityCommandOptions {
18
18
  limit?: string;
19
19
  /** Value that configures or reports compact for this contract. */
20
20
  compact?: boolean;
21
+ /** Return the legacy per-event stream instead of the item-centric digest. */
22
+ raw?: boolean;
21
23
  /** Explicitly disables the default activity bound. */
22
24
  unbounded?: boolean;
23
25
  /** Return patch-free provenance rows. */
@@ -31,6 +33,10 @@ export interface ActivityCommandOptions {
31
33
  /** Exact provenance dimension predicates (`dimension=value`). */
32
34
  provenanceFilter?: string | readonly string[];
33
35
  }
36
+ /** Normalize raw and full aliases into one explicit activity row projection. */
37
+ export declare function normalizeActivityProjectionOptions(options: ActivityCommandOptions & {
38
+ full?: unknown;
39
+ }): ActivityCommandOptions;
34
40
  /** Documents the activity entry payload exchanged by command, SDK, and package integrations. */
35
41
  export interface ActivityEntry extends HistoryEntry {
36
42
  /** Stable identifier used to reference this record across commands and storage. */
@@ -49,8 +55,29 @@ export interface CompactActivityEntry {
49
55
  /** Value that configures or reports msg for this contract. */
50
56
  msg?: string;
51
57
  }
58
+ /** One item-centric summary of every matching immutable event for that item. */
59
+ export interface ActivityDigestEntry {
60
+ /** Stable item identifier. */
61
+ id: string;
62
+ /** Current item type from the light metadata join. */
63
+ type: string;
64
+ /** Current lifecycle status from the light metadata join. */
65
+ status: string;
66
+ /** Current item title, bounded for predictable context cost. */
67
+ title: string;
68
+ /** Matching immutable events folded into this row. */
69
+ event_count: number;
70
+ /** Oldest matching event timestamp. */
71
+ first_ts: string;
72
+ /** Newest matching event timestamp. */
73
+ last_ts: string;
74
+ /** Bounded operation histogram encoded as comma-separated op:count pairs. */
75
+ operations: string;
76
+ }
52
77
  /** Documents the activity result payload exchanged by command, SDK, and package integrations. */
53
78
  export interface ActivityResult {
79
+ /** Default item-centric workspace activity rows. */
80
+ activity_digest?: ActivityDigestEntry[];
54
81
  /** Value that configures or reports activity for this contract. */
55
82
  activity?: ActivityEntry[];
56
83
  /** Value that configures or reports compact activity for this contract. */
@@ -62,9 +89,9 @@ export interface ActivityResult {
62
89
  /** Explicit active row projection. */
63
90
  projection: {
64
91
  /** Stable projection mode. */
65
- mode: "compact" | "provenance" | "full";
92
+ mode: "digest" | "compact" | "provenance" | "full";
66
93
  /** Active row collection key. */
67
- row_key: "compact_activity" | "provenance_activity" | "activity";
94
+ row_key: "activity_digest" | "compact_activity" | "provenance_activity" | "activity";
68
95
  };
69
96
  /** Constant-size disclosure of field groups withheld by the active mode. */
70
97
  omission_receipt: OutputOmissionReceipt;
@@ -84,9 +111,25 @@ export interface ActivityResult {
84
111
  source: "default" | "explicit";
85
112
  value: number | null;
86
113
  };
114
+ /** Constant-size description of the selected time window and matching corpus. */
115
+ activity_summary?: {
116
+ window: {
117
+ from: string | null;
118
+ to: string | null;
119
+ };
120
+ event_count: number;
121
+ item_count: number;
122
+ author_count: number;
123
+ operation_counts: Record<string, number>;
124
+ };
87
125
  /** Constant-size provenance completeness metrics. */
88
126
  provenance_summary?: HistoryProvenanceSummary;
89
127
  }
128
+ interface ActivityItemMetadata {
129
+ title: string;
130
+ type: string;
131
+ status: string;
132
+ }
90
133
  declare function parseNonEmptyFilter(raw: string | undefined, flagLabel: string): string | undefined;
91
134
  declare function parseRangeBound(raw: string | undefined, nowValue: string, fieldLabel: string): string | undefined;
92
135
  declare function includeByTimeWindow(entry: ActivityEntry, from: string | undefined, to: string | undefined): boolean;
@@ -95,6 +138,8 @@ declare function readActivityString(value: unknown, fallback?: string): string;
95
138
  declare function normalizeActivityEntry(id: string, entry: HistoryEntry): ActivityEntry;
96
139
  declare function sortActivity(entries: ActivityEntry[]): ActivityEntry[];
97
140
  declare function listHistoryFiles(historyDir: string): Promise<string[]>;
141
+ declare function buildActivityDigest(activity: readonly ActivityEntry[], itemsById: ReadonlyMap<string, ActivityItemMetadata>): ActivityDigestEntry[];
142
+ declare function activityOperationCounts(activity: readonly Pick<ActivityEntry, "op">[]): Record<string, number>;
98
143
  /** Public contract for test only, shared by SDK and presentation-layer consumers. */
99
144
  export declare const _testOnly: {
100
145
  parseNonEmptyFilter: typeof parseNonEmptyFilter;
@@ -105,6 +150,8 @@ export declare const _testOnly: {
105
150
  normalizeActivityEntry: typeof normalizeActivityEntry;
106
151
  sortActivity: typeof sortActivity;
107
152
  listHistoryFiles: typeof listHistoryFiles;
153
+ buildActivityDigest: typeof buildActivityDigest;
154
+ activityOperationCounts: typeof activityOperationCounts;
108
155
  };
109
156
  /** Implements run activity for the public runtime surface of this module. */
110
157
  export declare function runActivity(options: ActivityCommandOptions, global: GlobalOptions): Promise<ActivityResult>;