@unbrained/pm-cli 2026.8.17 → 2026.8.19

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 (204) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/AGENTS.md +4 -3
  3. package/CHANGELOG.md +51 -5
  4. package/README.md +3 -3
  5. package/dist/cli/error-guidance.js +8 -4
  6. package/dist/cli/help-content.js +32 -13
  7. package/dist/cli/help-json-payload.d.ts +15 -0
  8. package/dist/cli/help-json-payload.js +101 -23
  9. package/dist/cli/main.js +6 -2
  10. package/dist/cli/register-list-query.js +138 -54
  11. package/dist/cli/register-mutation.js +8 -8
  12. package/dist/cli/register-operations.js +6 -6
  13. package/dist/cli-bundle/bundle-manifest.json +149 -149
  14. package/dist/cli-bundle/chunks/chunk-4NRRH7AM.js +2 -0
  15. package/dist/cli-bundle/chunks/chunk-4THEB6PD.js +13 -0
  16. package/dist/cli-bundle/chunks/{chunk-HBJAS566.js → chunk-BHYMXLAE.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-GWMXAQOD.js +197 -0
  18. package/dist/cli-bundle/chunks/chunk-HVFQTLYM.js +35 -0
  19. package/dist/cli-bundle/chunks/chunk-OI4XI562.js +5 -0
  20. package/dist/cli-bundle/chunks/{chunk-3UEGXBMR.js → chunk-OIOKV6NO.js} +58 -54
  21. package/dist/cli-bundle/chunks/chunk-QXSH7BLM.js +3 -0
  22. package/dist/cli-bundle/chunks/chunk-SARFF5H5.js +3 -0
  23. package/dist/cli-bundle/chunks/{chunk-7IBRGCHX.js → chunk-TOXJM4WA.js} +2 -2
  24. package/dist/cli-bundle/chunks/{chunk-JOKATURE.js → chunk-YBMRWW4E.js} +44 -44
  25. package/dist/cli-bundle/chunks/register-list-query-Y56KINDU.js +11 -0
  26. package/dist/cli-bundle/chunks/register-mutation-AUWVCW4M.js +20 -0
  27. package/dist/cli-bundle/chunks/register-operations-PZQPHXW5.js +2 -0
  28. package/dist/cli-bundle/chunks/{register-setup-DOSFBGKE.js → register-setup-I4LUHGVW.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-34QBIYZI.js +155 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-MHPIL773.js → chunk-BJRYFVSH.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-DKPLYW3L.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-SALH6B6K.js → chunk-EF6ZS5GH.js} +44 -44
  33. package/dist/cli-bundle/focused-chunks/{chunk-XKAMP5OU.js → chunk-ESISGDAY.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-SYZENPIT.js → chunk-EXBCLIBU.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-JDOMQ7VQ.js +4 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-L623ZPNK.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-MCZXYZAF.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/chunk-ODHQEECS.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-ZQPGZZWQ.js → chunk-PRHY2IMX.js} +3 -3
  40. package/dist/cli-bundle/focused-chunks/chunk-RZU5U6Q7.js +2 -0
  41. package/dist/cli-bundle/focused-chunks/{chunk-ATEY76SX.js → chunk-US7VEYZG.js} +2 -2
  42. package/dist/cli-bundle/focused-chunks/chunk-VXDSU5MC.js +26 -0
  43. package/dist/cli-bundle/focused-chunks/chunk-YBMGXBFV.js +16 -0
  44. package/dist/cli-bundle/focused-chunks/chunk-YLVBJ6GF.js +2 -0
  45. package/dist/cli-bundle/focused-chunks/{chunk-CYFK5UPB.js → chunk-ZBIQQYMI.js} +2 -2
  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 +2 -1
  49. package/dist/cli-bundle/sdk-core.js +28 -28
  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 +32 -32
  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 +5 -4
  57. package/dist/core/config/nested-settings.js +8 -2
  58. package/dist/core/extensions/exporter-output-contract.d.ts +12 -0
  59. package/dist/core/extensions/exporter-output-contract.js +67 -0
  60. package/dist/core/extensions/extension-types.d.ts +36 -1
  61. package/dist/core/extensions/extension-types.js +2 -2
  62. package/dist/core/extensions/loader.js +35 -44
  63. package/dist/core/history/event-index.d.ts +5 -0
  64. package/dist/core/history/event-index.js +133 -27
  65. package/dist/core/sentry/helpers.js +3 -3
  66. package/dist/core/shared/constants.js +5 -2
  67. package/dist/core/shared/errors.d.ts +2 -0
  68. package/dist/core/shared/errors.js +2 -2
  69. package/dist/core/store/settings-validator.d.ts +4 -0
  70. package/dist/core/store/settings-validator.js +3 -2
  71. package/dist/core/store/settings.js +8 -2
  72. package/dist/mcp/tool-definitions.js +12 -7
  73. package/dist/sdk/agent/refusal-closure.d.ts +41 -0
  74. package/dist/sdk/agent/refusal-closure.js +92 -0
  75. package/dist/sdk/agent/refusal-reachability.d.ts +1 -1
  76. package/dist/sdk/agent/refusal-reachability.js +4 -4
  77. package/dist/sdk/agent-capability-contracts.d.ts +13 -0
  78. package/dist/sdk/agent-capability-contracts.js +104 -7
  79. package/dist/sdk/authoring.d.ts +1 -1
  80. package/dist/sdk/authoring.js +2 -2
  81. package/dist/sdk/cli-bootstrap.d.ts +2 -2
  82. package/dist/sdk/cli-bootstrap.js +4 -4
  83. package/dist/sdk/cli-contracts/command-aliases.d.ts +34 -2
  84. package/dist/sdk/cli-contracts/command-aliases.js +80 -13
  85. package/dist/sdk/cli-contracts/commander-mutation-options.js +30 -6
  86. package/dist/sdk/cli-contracts/commander-types.js +5 -4
  87. package/dist/sdk/cli-contracts/enum-contracts.d.ts +4 -0
  88. package/dist/sdk/cli-contracts/enum-contracts.js +9 -2
  89. package/dist/sdk/cli-contracts/flag-contracts.d.ts +5 -0
  90. package/dist/sdk/cli-contracts/flag-contracts.js +84 -13
  91. package/dist/sdk/cli-contracts/flag-lexicon-contracts.d.ts +55 -0
  92. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +240 -0
  93. package/dist/sdk/cli-contracts/grammar-contracts.d.ts +151 -0
  94. package/dist/sdk/cli-contracts/grammar-contracts.js +958 -0
  95. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +33 -5
  96. package/dist/sdk/cli-contracts/runtime-contracts.js +100 -23
  97. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +28 -1
  98. package/dist/sdk/cli-contracts/tool-option-contracts.js +38 -3
  99. package/dist/sdk/cli-contracts/tool-parameter-tables.js +7 -2
  100. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  101. package/dist/sdk/cli-contracts/tool-schema.js +20 -11
  102. package/dist/sdk/cli-contracts.d.ts +5 -4
  103. package/dist/sdk/cli-contracts.js +7 -6
  104. package/dist/sdk/completion.js +13 -15
  105. package/dist/sdk/compose.d.ts +3 -3
  106. package/dist/sdk/compose.js +2 -2
  107. package/dist/sdk/context-intent-contracts.d.ts +2 -2
  108. package/dist/sdk/context-intent-contracts.js +22 -7
  109. package/dist/sdk/contracts.d.ts +3 -0
  110. package/dist/sdk/contracts.js +5 -2
  111. package/dist/sdk/core.d.ts +1 -1
  112. package/dist/sdk/core.js +3 -3
  113. package/dist/sdk/environment/host-environment-errors.js +3 -3
  114. package/dist/sdk/flag-invocation-contracts.d.ts +37 -0
  115. package/dist/sdk/flag-invocation-contracts.js +218 -9
  116. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +186 -14
  117. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +194 -26
  118. package/dist/sdk/guide-topics.js +5 -5
  119. package/dist/sdk/index.d.ts +10 -7
  120. package/dist/sdk/index.js +10 -7
  121. package/dist/sdk/init-agent-guidance.js +3 -3
  122. package/dist/sdk/mutation-events.d.ts +18 -2
  123. package/dist/sdk/mutation-events.js +59 -16
  124. package/dist/sdk/output-projection.d.ts +2 -0
  125. package/dist/sdk/output-projection.js +11 -5
  126. package/dist/sdk/output.d.ts +44 -0
  127. package/dist/sdk/output.js +28 -2
  128. package/dist/sdk/query/complete-list.d.ts +94 -0
  129. package/dist/sdk/query/complete-list.js +173 -0
  130. package/dist/sdk/query/get.js +25 -6
  131. package/dist/sdk/query/list.js +19 -2
  132. package/dist/sdk/query/search-contracts.d.ts +1 -1
  133. package/dist/sdk/query/search-contracts.js +23 -9
  134. package/dist/sdk/query/search.js +3 -3
  135. package/dist/sdk/query.d.ts +1 -0
  136. package/dist/sdk/query.js +3 -2
  137. package/dist/sdk/read-output/continuation.d.ts +1 -1
  138. package/dist/sdk/read-output/continuation.js +7 -24
  139. package/dist/sdk/read-output-contracts.d.ts +2 -2
  140. package/dist/sdk/read-output-contracts.js +89 -13
  141. package/dist/sdk/read-output-rows.d.ts +4 -0
  142. package/dist/sdk/read-output-rows.js +47 -18
  143. package/dist/sdk/runtime-extended-actions.js +10 -2
  144. package/dist/sdk/runtime.d.ts +8 -2
  145. package/dist/sdk/runtime.js +18 -11
  146. package/dist/sdk/workspace-snapshot.d.ts +2 -0
  147. package/dist/sdk/workspace-snapshot.js +10 -2
  148. package/dist/types.d.ts +5 -0
  149. package/dist/types.js +2 -2
  150. package/docs/AGENT_GUIDE.md +25 -9
  151. package/docs/CLI_GRAMMAR.md +106 -0
  152. package/docs/COMMANDS.md +39 -27
  153. package/docs/ONBOARDING.md +4 -4
  154. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +11 -2
  155. package/docs/QUICKSTART.md +1 -1
  156. package/docs/README.md +2 -0
  157. package/docs/READ_OUTPUT_CONTRACTS.md +10 -6
  158. package/docs/RELEASING.md +30 -6
  159. package/docs/SDK.md +42 -2
  160. package/docs/SDK_ARTIFACT_OUTPUT.md +72 -0
  161. package/docs/SDK_CONTEXT_COORDINATION.md +46 -12
  162. package/docs/TESTING.md +14 -1
  163. package/docs/agent-task-token-baseline.json +5 -5
  164. package/docs/generated/AGENT_COMMAND_SURFACE.md +78 -78
  165. package/docs/generated/FLAG_LEXICON_BUDGETS.md +76 -0
  166. package/marketplace.json +2 -2
  167. package/package.json +5 -2
  168. package/packages/pm-beads/package.json +1 -1
  169. package/packages/pm-calendar/package.json +1 -1
  170. package/packages/pm-command-kit/package.json +1 -1
  171. package/packages/pm-digital-twin/package.json +1 -1
  172. package/packages/pm-governance-audit/package.json +1 -1
  173. package/packages/pm-guide-shell/package.json +1 -1
  174. package/packages/pm-kanban/package.json +1 -1
  175. package/packages/pm-lifecycle-hooks/package.json +1 -1
  176. package/packages/pm-linked-test-adapters/package.json +1 -1
  177. package/packages/pm-search-advanced/package.json +1 -1
  178. package/packages/pm-templates/package.json +1 -1
  179. package/packages/pm-todos/package.json +1 -1
  180. package/packages/pm-vcs/package.json +1 -1
  181. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  182. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  183. package/scripts/generate-agent-capability-surfaces.mjs +20 -14
  184. package/sdk/public-surface.json +1245 -60
  185. package/dist/cli-bundle/chunks/chunk-2QLOXC3V.js +0 -3
  186. package/dist/cli-bundle/chunks/chunk-4JPYF536.js +0 -35
  187. package/dist/cli-bundle/chunks/chunk-6VDLG2FC.js +0 -13
  188. package/dist/cli-bundle/chunks/chunk-ION3E43Q.js +0 -197
  189. package/dist/cli-bundle/chunks/chunk-OAC5NIV4.js +0 -3
  190. package/dist/cli-bundle/chunks/chunk-TPXZIBIV.js +0 -5
  191. package/dist/cli-bundle/chunks/chunk-YM2YAMF7.js +0 -2
  192. package/dist/cli-bundle/chunks/register-list-query-Q7KII4G5.js +0 -10
  193. package/dist/cli-bundle/chunks/register-mutation-4WBRPXLV.js +0 -20
  194. package/dist/cli-bundle/chunks/register-operations-SSENDH5B.js +0 -2
  195. package/dist/cli-bundle/focused-chunks/chunk-267MUUS6.js +0 -16
  196. package/dist/cli-bundle/focused-chunks/chunk-2NNFLLNG.js +0 -2
  197. package/dist/cli-bundle/focused-chunks/chunk-2QSAKMIH.js +0 -2
  198. package/dist/cli-bundle/focused-chunks/chunk-BUCG4ZI2.js +0 -2
  199. package/dist/cli-bundle/focused-chunks/chunk-EHXIKD6K.js +0 -2
  200. package/dist/cli-bundle/focused-chunks/chunk-KGEXTMPG.js +0 -2
  201. package/dist/cli-bundle/focused-chunks/chunk-KP2VQQVQ.js +0 -2
  202. package/dist/cli-bundle/focused-chunks/chunk-POEEAD2V.js +0 -4
  203. package/dist/cli-bundle/focused-chunks/chunk-XPIC53VA.js +0 -26
  204. package/dist/cli-bundle/focused-chunks/chunk-ZT2DJS27.js +0 -155
@@ -4,9 +4,10 @@
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]="c35e787c-a9a1-5ffa-9dcf-62780fceed4c")}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]="1ba3eb17-c44c-5b62-8ae0-c2506fca9c62")}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
+ import { renderPmCommand } from "../command-line.js";
10
11
  import { recordContextUsageTouches } from "../context-usage.js";
11
12
  import { buildItemChildrenRollup, } from "../item-children.js";
12
13
  import { buildItemSchedule, } from "../item-schedule.js";
@@ -142,7 +143,7 @@ function parseGetFields(raw) {
142
143
  function normalizeGetField(field) {
143
144
  return field.startsWith("item.") ? field.slice("item.".length) : field;
144
145
  }
145
- function validateGetFields(fields, runtimeMetadataKeys) {
146
+ function validateGetFields(fields, runtimeMetadataKeys, id) {
146
147
  if (fields === null) {
147
148
  return;
148
149
  }
@@ -179,6 +180,13 @@ function validateGetFields(fields, runtimeMetadataKeys) {
179
180
  "schedule.reminders",
180
181
  "schedule.events",
181
182
  ]);
183
+ const allowedValues = [
184
+ ...[...itemFields].flatMap((field) => [field, `item.${field}`]),
185
+ ...allowedRootFields,
186
+ ...allowedLinkedFields,
187
+ ...allowedClaimStateFields,
188
+ ...allowedScheduleFields,
189
+ ].sort();
182
190
  const unknown = fields.filter((field) => {
183
191
  const normalized = normalizeGetField(field);
184
192
  return (!itemFields.has(normalized) &&
@@ -188,6 +196,12 @@ function validateGetFields(fields, runtimeMetadataKeys) {
188
196
  !allowedScheduleFields.has(normalized));
189
197
  });
190
198
  if (unknown.length > 0) {
199
+ const suggestedRetryArguments = [
200
+ "get",
201
+ id,
202
+ "--fields",
203
+ "id,title,status",
204
+ ];
191
205
  throw new PmCliError(`Unknown get --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
192
206
  code: "unknown_field_projection",
193
207
  examples: [
@@ -195,6 +209,11 @@ function validateGetFields(fields, runtimeMetadataKeys) {
195
209
  "pm get <id> --fields id,title,claim_state",
196
210
  "pm get <id> --fields id,title,body,linked.files",
197
211
  ],
212
+ recovery: {
213
+ allowed_values: allowedValues,
214
+ suggested_retry: renderPmCommand(suggestedRetryArguments),
215
+ suggested_retry_args: suggestedRetryArguments,
216
+ },
198
217
  });
199
218
  }
200
219
  }
@@ -309,9 +328,9 @@ async function loadGetItemContext(id, global, at) {
309
328
  body: loaded.document.body,
310
329
  };
311
330
  }
312
- function validateGetProjectionFields(fields, settings, historical) {
331
+ function validateGetProjectionFields(fields, settings, historical, id) {
313
332
  const runtimeMetadataKeys = resolveRuntimeFieldRegistry(settings.schema).definitions.map((field) => field.metadata_key);
314
- validateGetFields(fields, runtimeMetadataKeys);
333
+ validateGetFields(fields, runtimeMetadataKeys, id);
315
334
  if (historical && fieldsIncludeRoot(fields ?? [], "children")) {
316
335
  throw new PmCliError("Get --at cannot project children because workspace-level historical relationships are not yet indexed.", EXIT_CODE.USAGE);
317
336
  }
@@ -397,7 +416,7 @@ async function buildGetTree(context, options, treeDepth, global) {
397
416
  export async function runGet(id, global, options = {}) {
398
417
  const projection = resolveGetProjection(options);
399
418
  const context = await loadGetItemContext(id, global, options.at);
400
- validateGetProjectionFields(projection.fields, context.settings, context.historical !== undefined);
419
+ validateGetProjectionFields(projection.fields, context.settings, context.historical !== undefined, context.locatedId);
401
420
  const includeBody = shouldIncludeGetField({ ...projection, field: "body" });
402
421
  const includeLinked = shouldIncludeGetField({
403
422
  ...projection,
@@ -463,4 +482,4 @@ export const _testOnlyGetCommand = {
463
482
  shouldAutoIncludeGetChildren,
464
483
  };
465
484
  //# sourceMappingURL=get.js.map
466
- //# debugId=c35e787c-a9a1-5ffa-9dcf-62780fceed4c
485
+ //# debugId=1ba3eb17-c44c-5b62-8ae0-c2506fca9c62
@@ -4,7 +4,7 @@
4
4
  * Implements the pm list 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]="ec0c4c57-e3c2-54b3-bcf4-b4ab3b1d964e")}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]="e2cb56ba-2f89-5589-8abf-f08cc7fa2b6b")}catch(e){}}();
8
8
  import { pathExists } from "../../core/fs/fs-utils.js";
9
9
  import { getActiveExtensionRegistrations, hasActiveOnReadHooks, } from "../../core/extensions/index.js";
10
10
  import { toItemRecord } from "../../core/item/item-record.js";
@@ -533,6 +533,9 @@ function validateListProjectionFields(projection, runtimeMetadataKeys) {
533
533
  ...TREE_METADATA_FIELDS,
534
534
  ...runtimeMetadataKeys,
535
535
  ]);
536
+ const allowedValues = [...allowed]
537
+ .flatMap((field) => [field, `item.${field}`])
538
+ .sort();
536
539
  const unknown = projection.fields.filter((field) => !allowed.has(normalizeProjectionField(field)));
537
540
  if (unknown.length > 0) {
538
541
  throw new PmCliError(`Unknown list --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
@@ -542,6 +545,17 @@ function validateListProjectionFields(projection, runtimeMetadataKeys) {
542
545
  "pm list --fields id,title,parent,priority --limit 10",
543
546
  "pm list-all --fields id,title,body --limit 5",
544
547
  ],
548
+ recovery: {
549
+ allowed_values: allowedValues,
550
+ suggested_retry: "pm list --fields id,title,status --limit 10",
551
+ suggested_retry_args: [
552
+ "list",
553
+ "--fields",
554
+ "id,title,status",
555
+ "--limit",
556
+ "10",
557
+ ],
558
+ },
545
559
  });
546
560
  }
547
561
  }
@@ -1106,6 +1120,9 @@ function buildVerboseListFilters(params) {
1106
1120
  if (noTruncate) {
1107
1121
  filters.no_truncate = true;
1108
1122
  }
1123
+ if (options.strictRead === true) {
1124
+ filters.strict_read = true;
1125
+ }
1109
1126
  if (treeEnabled) {
1110
1127
  filters.tree = true;
1111
1128
  if (treeDepth !== undefined) {
@@ -1240,4 +1257,4 @@ export const _testOnly = {
1240
1257
  withTreeMetadata,
1241
1258
  };
1242
1259
  //# sourceMappingURL=list.js.map
1243
- //# debugId=ec0c4c57-e3c2-54b3-bcf4-b4ab3b1d964e
1260
+ //# debugId=e2cb56ba-2f89-5589-8abf-f08cc7fa2b6b
@@ -62,7 +62,7 @@ export declare function parseSearchDeadline(raw: string | undefined, fieldLabel:
62
62
  /** Resolve mutually exclusive compact, full, or explicit-field projection. */
63
63
  export declare function parseSearchProjection(options: SearchOptions): SearchProjectionConfig;
64
64
  /** Validate explicit projection fields against core and runtime metadata. */
65
- export declare function validateSearchProjectionFields(projection: SearchProjectionConfig, runtimeFieldRegistry: RuntimeFieldRegistry): void;
65
+ export declare function validateSearchProjectionFields(projection: SearchProjectionConfig, runtimeFieldRegistry: RuntimeFieldRegistry, query?: string): void;
66
66
  /** Parse a non-empty normalized query into lexical tokens. */
67
67
  export declare function parseSearchTokens(query: string): string[];
68
68
  /** Documents the search tuning payload exchanged by command, SDK, and package integrations. */
@@ -4,11 +4,12 @@
4
4
  * Owns search input parsing, output projection contracts, and tuning defaults.
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]="47576eb5-4ddf-5e04-9e1d-c961da39b754")}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]="e737cdf9-734c-5010-864f-60e8052dd9c1")}catch(e){}}();
8
8
  import { coerceNumberInRange } from "../../core/shared/primitives.js";
9
9
  import { EXIT_CODE } from "../../core/shared/constants.js";
10
10
  import { PmCliError } from "../../core/shared/errors.js";
11
11
  import { resolveIsoOrRelative } from "../../core/shared/time.js";
12
+ import { renderPmCommand } from "../command-line.js";
12
13
  const DEFAULT_COMPACT_SEARCH_FIELDS = [
13
14
  "id",
14
15
  "title",
@@ -174,23 +175,31 @@ export function parseSearchProjection(options) {
174
175
  return { mode: "full", fields: [] };
175
176
  }
176
177
  /** Validate explicit projection fields against core and runtime metadata. */
177
- export function validateSearchProjectionFields(projection, runtimeFieldRegistry) {
178
+ export function validateSearchProjectionFields(projection, runtimeFieldRegistry, query = "<query>") {
178
179
  if (projection.mode !== "fields")
179
180
  return;
180
181
  const runtimeKeys = new Set(runtimeFieldRegistry.definitions.flatMap((field) => [
181
182
  field.key,
182
183
  field.metadata_key,
183
184
  ]));
185
+ const allowedValues = new Set([
186
+ ...SEARCH_HIT_FIELD_KEYS,
187
+ ...SEARCH_ITEM_FIELD_KEYS,
188
+ ...[...SEARCH_ITEM_FIELD_KEYS].map((field) => `item.${field}`),
189
+ ...runtimeKeys,
190
+ ...[...runtimeKeys].map((field) => `item.${field}`),
191
+ ]);
184
192
  const unknown = projection.fields.filter((field) => {
185
193
  const normalized = field.trim();
186
- const itemKey = normalized.startsWith("item.")
187
- ? normalized.slice("item.".length)
188
- : normalized;
189
- return (!SEARCH_HIT_FIELD_KEYS.has(normalized) &&
190
- !SEARCH_ITEM_FIELD_KEYS.has(itemKey) &&
191
- !runtimeKeys.has(itemKey));
194
+ return !allowedValues.has(normalized);
192
195
  });
193
196
  if (unknown.length > 0) {
197
+ const suggestedRetryArguments = [
198
+ "search",
199
+ query,
200
+ "--fields",
201
+ "id,title,status,score",
202
+ ];
194
203
  throw new PmCliError(`Unknown search --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
195
204
  examples: [
196
205
  "pm search <query> --fields id,title,status,score",
@@ -199,6 +208,11 @@ export function validateSearchProjectionFields(projection, runtimeFieldRegistry)
199
208
  nextSteps: [
200
209
  "Use item.<field> for explicit item metadata fields, or run pm search --help for projection examples.",
201
210
  ],
211
+ recovery: {
212
+ allowed_values: [...allowedValues].sort(),
213
+ suggested_retry: renderPmCommand(suggestedRetryArguments),
214
+ suggested_retry_args: suggestedRetryArguments,
215
+ },
202
216
  });
203
217
  }
204
218
  }
@@ -283,4 +297,4 @@ export function resolveSearchTuning(settings) {
283
297
  };
284
298
  }
285
299
  //# sourceMappingURL=search-contracts.js.map
286
- //# debugId=47576eb5-4ddf-5e04-9e1d-c961da39b754
300
+ //# debugId=e737cdf9-734c-5010-864f-60e8052dd9c1
@@ -4,7 +4,7 @@
4
4
  * Implements the pm search 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]="1750b332-dd40-5497-b410-26c8c7436329")}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]="0582c462-43fc-563c-b209-d6e3c39948f4")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { toNonEmptyStringOrUndefined } from "../../core/shared/primitives.js";
@@ -1552,7 +1552,7 @@ async function resolveSearchRuntimeContext(prepared, global) {
1552
1552
  const settings = resolveSettingsWithSemanticRuntimeDefaults(storedSettings).settings;
1553
1553
  const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
1554
1554
  const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
1555
- validateSearchProjectionFields(prepared.projection, runtimeFieldRegistry);
1555
+ validateSearchProjectionFields(prepared.projection, runtimeFieldRegistry, prepared.query);
1556
1556
  const runtimeFieldFilters = collectRuntimeFilterValues(prepared.options, runtimeFieldRegistry, "search");
1557
1557
  const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
1558
1558
  const providerResolution = resolveEmbeddingProviders(settings);
@@ -1961,4 +1961,4 @@ export async function runSearch(rawQuery, rawOptions, global) {
1961
1961
  return withSearchWorkspaceMemory(buildSearchResultForHits(response, projectedItems, total, page.limited.length, effectiveProjection, page.pageExtras), workspaceMemoryResult);
1962
1962
  }
1963
1963
  //# sourceMappingURL=search.js.map
1964
- //# debugId=1750b332-dd40-5497-b410-26c8c7436329
1964
+ //# debugId=0582c462-43fc-563c-b209-d6e3c39948f4
@@ -4,6 +4,7 @@
4
4
  * Provides focused read, search, pagination, and context-ranking primitives.
5
5
  */
6
6
  export * from "./query/list.js";
7
+ export * from "./query/complete-list.js";
7
8
  export * from "./query/search.js";
8
9
  export { runActivity, type ActivityCommandOptions, type ActivityEntry, type ActivityResult, type CompactActivityEntry, } from "./query/activity.js";
9
10
  export * from "./query/aggregate.js";
package/dist/sdk/query.js CHANGED
@@ -4,8 +4,9 @@
4
4
  * Provides focused read, search, pagination, and context-ranking primitives.
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]="5e04dc9d-8e2d-5ef2-bf8b-6b18bd87c3bc")}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]="036baf5a-3ba9-55ea-a11b-d9e94a848b92")}catch(e){}}();
8
8
  export * from "./query/list.js";
9
+ export * from "./query/complete-list.js";
9
10
  export * from "./query/search.js";
10
11
  export { runActivity, } from "./query/activity.js";
11
12
  export * from "./query/aggregate.js";
@@ -29,4 +30,4 @@ export * from "./context-usage.js";
29
30
  export * from "./workspace-memory.js";
30
31
  export * from "./duplicates.js";
31
32
  //# sourceMappingURL=query.js.map
32
- //# debugId=5e04dc9d-8e2d-5ef2-bf8b-6b18bd87c3bc
33
+ //# debugId=036baf5a-3ba9-55ea-a11b-d9e94a848b92
@@ -1,5 +1,5 @@
1
1
  import type { PmReadOutputCursorEnvelope, PmReadOutputSurface } from "../read-output-contracts.js";
2
- /** Fingerprint stable row identities without including volatile observation fields. */
2
+ /** Fingerprint the complete canonical row snapshot so changed evidence fails closed. */
3
3
  export declare function readOutputCollectionFingerprint(path: string, value: unknown[] | Record<string, unknown>): string;
4
4
  /** Encode one stable declared-row continuation for CLI, SDK, and MCP callers. */
5
5
  export declare function encodeReadOutputContinuationCursor(cursor: Omit<PmReadOutputCursorEnvelope, "version">): string;
@@ -6,38 +6,21 @@
6
6
  * resolution and budget policy.
7
7
  */
8
8
 
9
- !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]="8e523bbc-5745-514e-a1d8-a6ad6ece001a")}catch(e){}}();
9
+ !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]="1c73c31e-6246-5730-8c8a-d3ba7c9ec112")}catch(e){}}();
10
10
  import { createHash } from "node:crypto";
11
11
  import { EXIT_CODE } from "../../core/shared/constants.js";
12
12
  import { PmCliError } from "../../core/shared/errors.js";
13
+ import { stableStringify } from "../../core/shared/serialization.js";
13
14
  import { resolveReadOutputSurface } from "../read-output-contracts.js";
14
- import { readOutputRowCollections, sliceReadOutputRowCollection, } from "../read-output-rows.js";
15
+ import { readOutputContinuationRowCollections, sliceReadOutputRowCollection, } from "../read-output-rows.js";
15
16
  const MAX_READ_OUTPUT_CURSOR_LENGTH = 4096;
16
17
  function isRecord(value) {
17
18
  return value !== null && typeof value === "object" && !Array.isArray(value);
18
19
  }
19
- /** Fingerprint stable row identities without including volatile observation fields. */
20
+ /** Fingerprint the complete canonical row snapshot so changed evidence fails closed. */
20
21
  export function readOutputCollectionFingerprint(path, value) {
21
- const identities = Array.isArray(value)
22
- ? value.map((row, index) => {
23
- if (!isRecord(row))
24
- return `index:${String(index)}`;
25
- for (const key of [
26
- "id",
27
- "assertion_id",
28
- "measurement_id",
29
- "event_id",
30
- ]) {
31
- const candidate = row[key];
32
- if (typeof candidate === "string" && candidate.length > 0) {
33
- return `${key}:${candidate}`;
34
- }
35
- }
36
- return `index:${String(index)}`;
37
- })
38
- : Object.keys(value);
39
22
  return createHash("sha256")
40
- .update(JSON.stringify({ path, identities }))
23
+ .update(stableStringify({ path, value }))
41
24
  .digest("base64url")
42
25
  .slice(0, 16);
43
26
  }
@@ -113,7 +96,7 @@ export function applyReadOutputContinuation(result, command, cursor) {
113
96
  if (cursor.command !== command) {
114
97
  throw new PmCliError(`The read-output cursor belongs to ${cursor.command}, not ${command}.`, EXIT_CODE.USAGE, { code: "read_output_cursor_command_mismatch" });
115
98
  }
116
- const collection = readOutputRowCollections(result).find((entry) => entry.path === cursor.path);
99
+ const collection = readOutputContinuationRowCollections(result).find((entry) => entry.path === cursor.path);
117
100
  const totalRows = collection
118
101
  ? Array.isArray(collection.value)
119
102
  ? collection.value.length
@@ -129,4 +112,4 @@ export function applyReadOutputContinuation(result, command, cursor) {
129
112
  return sliceReadOutputRowCollection(result, cursor.path, cursor.offset);
130
113
  }
131
114
  //# sourceMappingURL=continuation.js.map
132
- //# debugId=8e523bbc-5745-514e-a1d8-a6ad6ece001a
115
+ //# debugId=1c73c31e-6246-5730-8c8a-d3ba7c9ec112
@@ -5,7 +5,7 @@ export declare const PM_READ_OUTPUT_DIMENSIONS: readonly ["include", "amount", "
5
5
  /** One member of the universal read-output dimension set. */
6
6
  export type PmReadOutputDimension = (typeof PM_READ_OUTPUT_DIMENSIONS)[number];
7
7
  /** Built-in command roots whose primary operation is a read. */
8
- export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-manage", "comments-audit", "assurance"];
8
+ export declare const PM_READ_OUTPUT_SURFACES: readonly ["list", "context", "search", "get", "next", "health", "deps", "graph", "history", "activity", "validate", "events", "contracts", "comments", "notes", "files", "docs", "stats", "aggregate", "package-catalog", "package-manage", "comments-audit", "assurance"];
9
9
  /** Built-in read command supported by the universal output contract. */
10
10
  export type PmReadOutputSurface = (typeof PM_READ_OUTPUT_SURFACES)[number];
11
11
  /** Canonical output controls accepted by every built-in read action. */
@@ -226,7 +226,7 @@ export declare const PM_READ_OUTPUT_COMPOSITION_OPTION_FLAGS: readonly ["--outpu
226
226
  /** Universal output contract for every built-in read surface. */
227
227
  export declare const PM_READ_OUTPUT_SURFACE_CONTRACTS: readonly PmReadOutputSurfaceContract[];
228
228
  /** Resolve a command or list/context alias to its canonical read-output surface. */
229
- export declare function resolveReadOutputSurface(command: string): PmReadOutputSurface | undefined;
229
+ export declare function resolveReadOutputSurface(command: string, options?: Record<string, unknown>): PmReadOutputSurface | undefined;
230
230
  /** Reject malformed or mutation-scoped universal output controls before command execution. */
231
231
  export declare function validateReadOutputOptions(command: string, options: Record<string, unknown>): void;
232
232
  /**
@@ -5,12 +5,12 @@
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]="e9621264-0180-53cf-862f-b59640b971da")}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]="b3c001df-9891-5cf7-990b-8d9da7b51801")}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, estimateReadOutputTokens, updateReadOutputReceiptEstimate, } from "./read-output-budget.js";
12
12
  import { resolvePmCommandOutputBudget } from "./cli-contracts/agent-output-contracts.js";
13
- import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows, readOutputRowCollections, readOutputRowPaths, } from "./read-output-rows.js";
13
+ import { boundReadOutputRows, countReadOutputRows, mapReadOutputRows, readOutputBudgetCollections, readOutputContinuationRowCollections, readOutputRowPaths, } from "./read-output-rows.js";
14
14
  import { applyReadOutputContinuation, decodeReadOutputContinuationCursor, encodeReadOutputContinuationCursor, prioritizeAssuranceAssertions, readOutputCollectionFingerprint, } from "./read-output/continuation.js";
15
15
  export { decodeReadOutputContinuationCursor, encodeReadOutputContinuationCursor, } from "./read-output/continuation.js";
16
16
  import { applyReadOutputSessionReferences, attachReadOutputSessionReceipt, parseReadOutputSession, readOutputSessionRemainingTokens, } from "./read-output-session.js";
@@ -43,6 +43,7 @@ export const PM_READ_OUTPUT_SURFACES = [
43
43
  "docs",
44
44
  "stats",
45
45
  "aggregate",
46
+ "package-catalog",
46
47
  "package-manage",
47
48
  "comments-audit",
48
49
  "assurance",
@@ -135,6 +136,7 @@ const LEGACY_FLAGS_BY_COMMAND = {
135
136
  docs: {},
136
137
  stats: {},
137
138
  aggregate: {},
139
+ "package-catalog": {},
138
140
  "package-manage": {},
139
141
  "comments-audit": {},
140
142
  assurance: {},
@@ -208,15 +210,26 @@ const SURFACE_CONTRACT_BY_COMMAND = new Map(PM_READ_OUTPUT_SURFACE_CONTRACTS.map
208
210
  contract,
209
211
  ]));
210
212
  /** Resolve a command or list/context alias to its canonical read-output surface. */
211
- export function resolveReadOutputSurface(command) {
213
+ export function resolveReadOutputSurface(command, options = {}) {
212
214
  const normalizedCommand = command
213
215
  .trim()
214
216
  .toLowerCase()
215
217
  .replaceAll(/\s+/gu, " ");
216
- const root = normalizedCommand === "package manage" ||
217
- normalizedCommand === "package-manage"
218
- ? "package-manage"
219
- : normalizedCommand.split(" ")[0];
218
+ const packageMode = normalizedCommand === "package catalog" ||
219
+ normalizedCommand === "packages catalog" ||
220
+ normalizedCommand === "package-catalog" ||
221
+ ((normalizedCommand === "package" ||
222
+ normalizedCommand === "packages" ||
223
+ normalizedCommand === "extension") &&
224
+ (options.catalog === true ||
225
+ options.target === "catalog" ||
226
+ options.action === "catalog"));
227
+ const root = packageMode
228
+ ? "package-catalog"
229
+ : normalizedCommand === "package manage" ||
230
+ normalizedCommand === "package-manage"
231
+ ? "package-manage"
232
+ : normalizedCommand.split(" ")[0];
220
233
  const normalized = root.startsWith("list-")
221
234
  ? "list"
222
235
  : root === "ctx"
@@ -247,6 +260,20 @@ const HYBRID_READ_MUTATION_KEYS = {
247
260
  notes: ["add", "addJson", "stdin", "file", "edit", "delete"],
248
261
  files: ["add", "addGlob", "remove", "migrate", "apply", "note"],
249
262
  docs: ["add", "addGlob", "remove", "migrate", "note"],
263
+ "package-catalog": [
264
+ "activate",
265
+ "adopt",
266
+ "adoptAll",
267
+ "deactivate",
268
+ "doctor",
269
+ "init",
270
+ "install",
271
+ "manage",
272
+ "migrate",
273
+ "reload",
274
+ "scaffold",
275
+ "uninstall",
276
+ ],
250
277
  };
251
278
  function hasCanonicalReadOutputOptions(options) {
252
279
  return CANONICAL_OPTION_KEYS.some((key) => options[key] !== undefined);
@@ -290,7 +317,7 @@ const READ_OUTPUT_VALUE_VALIDATORS = [
290
317
  export function validateReadOutputOptions(command, options) {
291
318
  if (!hasCanonicalReadOutputOptions(options))
292
319
  return;
293
- const normalizedCommand = resolveReadOutputSurface(command);
320
+ const normalizedCommand = resolveReadOutputSurface(command, options);
294
321
  if (!normalizedCommand) {
295
322
  throw new PmCliError(`Universal output controls apply only to read commands; ${command || "this command"} is not a read surface.`, EXIT_CODE.USAGE);
296
323
  }
@@ -471,7 +498,7 @@ function resolveEncodingValue(canonical, legacy) {
471
498
  }
472
499
  /** Resolve canonical and compatibility controls into the universal dimension set. */
473
500
  export function resolveReadOutputDimensions(command, options) {
474
- const normalizedCommand = resolveReadOutputSurface(command);
501
+ const normalizedCommand = resolveReadOutputSurface(command, options);
475
502
  if (!normalizedCommand)
476
503
  return undefined;
477
504
  const contract = SURFACE_CONTRACT_BY_COMMAND.get(normalizedCommand);
@@ -736,6 +763,54 @@ export function stabilizeReadOutputReceiptEstimates(result, options) {
736
763
  }
737
764
  return attachReadOutputSessionContracts(result, session, receipt);
738
765
  }
766
+ /** Declare independently resumable validate diagnostic arrays on rich results. */
767
+ function attachValidateDiagnosticRowContract(command, result) {
768
+ if (command !== "validate")
769
+ return result;
770
+ const projection = isRecord(result.projection)
771
+ ? result.projection
772
+ : undefined;
773
+ const declaredFieldGroups = Array.isArray(projection?.declared_field_groups)
774
+ ? projection.declared_field_groups
775
+ : [];
776
+ if (!declaredFieldGroups.some((group) => isRecord(group) && group.name === "diagnostic_rows")) {
777
+ return result;
778
+ }
779
+ const diagnosticCollectionPaths = [
780
+ ...new Set(readOutputBudgetCollections(result)
781
+ .map(({ path }) => path)
782
+ .filter((path) => /^checks\.\d+\.details\./u.test(path))),
783
+ ];
784
+ const diagnosticRowKeys = diagnosticCollectionPaths.filter((path) => !diagnosticCollectionPaths.some((candidate) => candidate !== path && path.startsWith(`${candidate}.`)));
785
+ if (diagnosticRowKeys.length === 0)
786
+ return result;
787
+ const existingContract = isRecord(result.row_contract)
788
+ ? result.row_contract
789
+ : {};
790
+ const existingRowKeys = Array.isArray(existingContract.row_keys)
791
+ ? existingContract.row_keys.filter((entry) => typeof entry === "string")
792
+ : [];
793
+ const existingContinuationRowKeys = Array.isArray(existingContract.continuation_row_keys)
794
+ ? existingContract.continuation_row_keys.filter((entry) => typeof entry === "string")
795
+ : [];
796
+ const rowKeys = existingRowKeys.length > 0 ? existingRowKeys : diagnosticRowKeys;
797
+ const continuationRowKeys = [...new Set(diagnosticRowKeys)];
798
+ return JSON.stringify(rowKeys) === JSON.stringify(existingRowKeys) &&
799
+ JSON.stringify(continuationRowKeys) ===
800
+ JSON.stringify(existingContinuationRowKeys)
801
+ ? result
802
+ : {
803
+ ...result,
804
+ row_contract: {
805
+ ...existingContract,
806
+ row_keys: rowKeys,
807
+ continuation_row_keys: continuationRowKeys,
808
+ jq_selector: typeof existingContract.jq_selector === "string"
809
+ ? existingContract.jq_selector
810
+ : ".checks[].details",
811
+ },
812
+ };
813
+ }
739
814
  /** Apply field, amount, and repeat projections to every declared row path. */
740
815
  function projectReadOutputRows(result, resolved, session, cursor) {
741
816
  let projected = { ...result };
@@ -844,7 +919,7 @@ function attachReadOutputTruncationDisclosure(projected, resolved, receipt, bind
844
919
  if (!receipt.rows_compacted)
845
920
  return;
846
921
  const overridden = resolved.amount?.value === "unbounded" ? ["amount"] : [];
847
- const afterByPath = new Map(readOutputRowCollections(projected).map((collection) => [
922
+ const afterByPath = new Map(readOutputContinuationRowCollections(projected).map((collection) => [
848
923
  collection.path,
849
924
  Array.isArray(collection.value)
850
925
  ? collection.value.length
@@ -947,7 +1022,7 @@ function rebaseBudgetCompactedCursor(projected, originalItemCount, cursorSource,
947
1022
  return true;
948
1023
  }
949
1024
  function captureReadOutputContinuationState(projected, cursor, options) {
950
- const collectionsBeforeBudget = new Map(readOutputRowCollections(projected).map((collection) => {
1025
+ const collectionsBeforeBudget = new Map(readOutputContinuationRowCollections(projected).map((collection) => {
951
1026
  const rows = Array.isArray(collection.value)
952
1027
  ? collection.value.length
953
1028
  : Object.keys(collection.value).length;
@@ -1005,8 +1080,9 @@ export function applyReadOutputDimensions(command, options, result) {
1005
1080
  canReturnReadOutputUnchanged(resolved, requested, session, result)) {
1006
1081
  return result;
1007
1082
  }
1083
+ const continuationReadyResult = attachValidateDiagnosticRowContract(resolved.command, result);
1008
1084
  const bindingBudget = resolveBindingReadOutputBudget(resolved, session);
1009
- let projected = projectReadOutputRows(result, resolved, session, cursor);
1085
+ let projected = projectReadOutputRows(continuationReadyResult, resolved, session, cursor);
1010
1086
  const continuationState = captureReadOutputContinuationState(projected, cursor, options);
1011
1087
  const receipt = {
1012
1088
  contract_version: 1,
@@ -1058,4 +1134,4 @@ export function resolveReadOutputEncoding(command, options) {
1058
1134
  : undefined;
1059
1135
  }
1060
1136
  //# sourceMappingURL=read-output-contracts.js.map
1061
- //# debugId=e9621264-0180-53cf-862f-b59640b971da
1137
+ //# debugId=b3c001df-9891-5cf7-990b-8d9da7b51801
@@ -15,8 +15,12 @@ export interface PmReadOutputRowCollection {
15
15
  export declare function sliceReadOutputRowCollection(result: Record<string, unknown>, rowPath: string, offset: number): Record<string, unknown>;
16
16
  /** Resolve declared row paths, falling back to top-level array properties. */
17
17
  export declare function readOutputRowPaths(result: Record<string, unknown>): string[];
18
+ /** Resolve collections that may be resumed independently from primary result rows. */
19
+ export declare function readOutputContinuationRowPaths(result: Record<string, unknown>): string[];
18
20
  /** Resolve every declared row path that currently contains iterable rows. */
19
21
  export declare function readOutputRowCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
22
+ /** Resolve every declared continuation path that currently contains iterable rows. */
23
+ export declare function readOutputContinuationRowCollections(result: Record<string, unknown>): PmReadOutputRowCollection[];
20
24
  /**
21
25
  * Discover every collection the token-budget degradation ladder may reduce.
22
26
  *