@unbrained/pm-cli 2026.8.13 → 2026.8.15

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 (194) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +165 -113
  3. package/dist/cli/commander-usage.js +17 -4
  4. package/dist/cli/error-guidance.d.ts +2 -0
  5. package/dist/cli/error-guidance.js +52 -25
  6. package/dist/cli/main.js +40 -3
  7. package/dist/cli/register-mutation.js +4 -2
  8. package/dist/cli/register-operations.js +5 -5
  9. package/dist/cli-bundle/bundle-manifest.json +146 -178
  10. package/dist/cli-bundle/chunks/{chunk-F7FJYGK3.js → chunk-24GAV7XL.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-AIM6VT2N.js +13 -0
  12. package/dist/cli-bundle/chunks/chunk-DSWDLTDR.js +197 -0
  13. package/dist/cli-bundle/chunks/{chunk-Q47C67TQ.js → chunk-J42EGKDK.js} +2 -2
  14. package/dist/cli-bundle/chunks/chunk-KIEGUBYQ.js +2 -0
  15. package/dist/cli-bundle/chunks/{chunk-3ZMOWAFM.js → chunk-KLKYLSDX.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-QGTUPEU5.js → chunk-LJHOAVGI.js} +59 -59
  17. package/dist/cli-bundle/chunks/chunk-MEM2ZS3O.js +5 -0
  18. package/dist/cli-bundle/chunks/chunk-QHPCJWEJ.js +35 -0
  19. package/dist/cli-bundle/chunks/{chunk-YLBAPY22.js → chunk-WLPDLNEZ.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-list-query-4HIZ7EA3.js → register-list-query-CT3LFDDN.js} +2 -2
  21. package/dist/cli-bundle/chunks/{register-mutation-W64FZ5HN.js → register-mutation-NWEVA5YS.js} +3 -3
  22. package/dist/cli-bundle/chunks/register-operations-AHIAG5KM.js +2 -0
  23. package/dist/cli-bundle/chunks/{register-setup-634MFRXU.js → register-setup-ZJZFVAKE.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/chunk-4X57RE4U.js +2 -0
  25. package/dist/cli-bundle/focused-chunks/chunk-6XKF3PGV.js +18 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-7NJ4QYQ2.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-I75MANL7.js → chunk-EXZA4257.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-ITAUHSO6.js +50 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-OOYYKQWX.js → chunk-KLVUMNXJ.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/{chunk-2RI2FESN.js → chunk-KT5XMYSX.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/{chunk-E3AVJ655.js → chunk-KTKH4IMG.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-M67F5AIN.js +8 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-3DJSGWVB.js → chunk-NSPYTG6G.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/chunk-OKA6ELTL.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-PUISBOPP.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-QLNMCESQ.js +155 -0
  37. package/dist/cli-bundle/focused-chunks/{chunk-IIS2FRKL.js → chunk-SLKC6QLJ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-U65UC4G3.js +2 -0
  39. package/dist/cli-bundle/focused-chunks/chunk-WTSER4WJ.js +16 -0
  40. package/dist/cli-bundle/focused-chunks/{chunk-2JP7W7GO.js → chunk-ZMFXQ7VF.js} +2 -2
  41. package/dist/cli-bundle/main.js +13 -13
  42. package/dist/cli-bundle/sdk-authoring.js +1 -1
  43. package/dist/cli-bundle/sdk-contracts.js +1 -1
  44. package/dist/cli-bundle/sdk-core.js +41 -41
  45. package/dist/cli-bundle/sdk-governance.js +1 -1
  46. package/dist/cli-bundle/sdk-graph.js +1 -1
  47. package/dist/cli-bundle/sdk-merge.js +110 -1
  48. package/dist/cli-bundle/sdk-query.js +1 -1
  49. package/dist/cli-bundle/sdk-runtime.js +1 -1
  50. package/dist/cli-bundle/sdk-testing.js +1 -1
  51. package/dist/cli-bundle/sdk.js +2 -2
  52. package/dist/core/diagnostics/remediation.js +7 -2
  53. package/dist/core/extensions/reserved-host-flags.js +3 -2
  54. package/dist/core/history/drift-scan.d.ts +6 -0
  55. package/dist/core/history/drift-scan.js +74 -50
  56. package/dist/core/history/replay.d.ts +14 -1
  57. package/dist/core/history/replay.js +45 -8
  58. package/dist/core/history/workspace-history.d.ts +59 -0
  59. package/dist/core/history/workspace-history.js +197 -10
  60. package/dist/core/output/output.d.ts +2 -0
  61. package/dist/core/output/output.js +13 -4
  62. package/dist/core/shared/command-types.d.ts +2 -0
  63. package/dist/core/shared/command-types.js +2 -2
  64. package/dist/core/shared/errors.d.ts +12 -0
  65. package/dist/core/shared/errors.js +2 -2
  66. package/dist/mcp/tool-definitions.js +9 -5
  67. package/dist/sdk/agent/refusal-reachability.d.ts +61 -0
  68. package/dist/sdk/agent/refusal-reachability.js +91 -3
  69. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  70. package/dist/sdk/cli-bootstrap.js +7 -2
  71. package/dist/sdk/cli-contracts/completeness.js +3 -2
  72. package/dist/sdk/cli-contracts/flag-contracts.js +3 -2
  73. package/dist/sdk/cli-contracts/registration-helpers.js +3 -2
  74. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +11 -1
  75. package/dist/sdk/cli-contracts/runtime-contracts.js +176 -65
  76. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -5
  77. package/dist/sdk/cli-contracts/tool-schema.js +10 -3
  78. package/dist/sdk/cli-program.js +4 -3
  79. package/dist/sdk/context-relevance.js +12 -4
  80. package/dist/sdk/core.d.ts +2 -2
  81. package/dist/sdk/core.js +3 -3
  82. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +26 -2
  83. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -26
  84. package/dist/sdk/governance/assurance-action.d.ts +7 -1
  85. package/dist/sdk/governance/assurance-action.js +7 -6
  86. package/dist/sdk/governance/assurance-mutation-error.d.ts +42 -1
  87. package/dist/sdk/governance/assurance-mutation-error.js +27 -3
  88. package/dist/sdk/governance/assurance-runtime.js +12 -11
  89. package/dist/sdk/governance/assurance.d.ts +9 -0
  90. package/dist/sdk/governance/assurance.js +82 -16
  91. package/dist/sdk/governance/extension-host-version.d.ts +25 -0
  92. package/dist/sdk/governance/extension-host-version.js +105 -0
  93. package/dist/sdk/governance/health.d.ts +32 -1
  94. package/dist/sdk/governance/health.js +132 -28
  95. package/dist/sdk/governance/provenance-health.d.ts +27 -0
  96. package/dist/sdk/governance/provenance-health.js +95 -3
  97. package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
  98. package/dist/sdk/governance/validate-history-drift.js +68 -0
  99. package/dist/sdk/governance/validate.js +9 -52
  100. package/dist/sdk/governance.d.ts +6 -0
  101. package/dist/sdk/governance.js +8 -2
  102. package/dist/sdk/graph/assembly.d.ts +23 -0
  103. package/dist/sdk/graph/assembly.js +54 -2
  104. package/dist/sdk/graph/durable-cache.js +50 -20
  105. package/dist/sdk/graph/governance-contracts.d.ts +1 -1
  106. package/dist/sdk/graph/governance-contracts.js +4 -2
  107. package/dist/sdk/graph/governance.d.ts +21 -1
  108. package/dist/sdk/graph/governance.js +94 -32
  109. package/dist/sdk/graph/index.d.ts +2 -2
  110. package/dist/sdk/graph/index.js +4 -4
  111. package/dist/sdk/graph/mutation-advisory.js +15 -7
  112. package/dist/sdk/graph/remediation.js +12 -2
  113. package/dist/sdk/history-read.d.ts +8 -0
  114. package/dist/sdk/history-read.js +2 -2
  115. package/dist/sdk/history-repair.d.ts +13 -1
  116. package/dist/sdk/history-repair.js +62 -18
  117. package/dist/sdk/index.d.ts +1 -1
  118. package/dist/sdk/index.js +3 -3
  119. package/dist/sdk/linked-artifacts.js +16 -5
  120. package/dist/sdk/pagination.d.ts +15 -0
  121. package/dist/sdk/pagination.js +9 -5
  122. package/dist/sdk/query/context.d.ts +5 -1
  123. package/dist/sdk/query/context.js +14 -5
  124. package/dist/sdk/query/history.js +20 -3
  125. package/dist/sdk/read-output/continuation.d.ts +11 -0
  126. package/dist/sdk/read-output/continuation.js +132 -0
  127. package/dist/sdk/read-output-budget.d.ts +3 -1
  128. package/dist/sdk/read-output-budget.js +24 -13
  129. package/dist/sdk/read-output-contracts.d.ts +127 -7
  130. package/dist/sdk/read-output-contracts.js +381 -35
  131. package/dist/sdk/read-output-rows.d.ts +13 -0
  132. package/dist/sdk/read-output-rows.js +60 -2
  133. package/dist/sdk/runtime-input.js +4 -2
  134. package/dist/sdk/runtime-primitives.d.ts +1 -1
  135. package/dist/sdk/runtime-primitives.js +3 -3
  136. package/dist/sdk/runtime.js +5 -3
  137. package/docs/ASSURANCE.md +68 -2
  138. package/docs/COMMANDS.md +39 -4
  139. package/docs/READ_OUTPUT_CONTRACTS.md +85 -8
  140. package/docs/RELATIONSHIP_GRAPH.md +20 -5
  141. package/docs/RELEASING.md +42 -5
  142. package/docs/SDK.md +12 -5
  143. package/docs/SDK_CONTEXT_INTEGRITY.md +94 -1
  144. package/docs/TESTING.md +23 -1
  145. package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
  146. package/marketplace.json +2 -2
  147. package/package.json +7 -7
  148. package/packages/pm-beads/extensions/beads/index.ts +1 -0
  149. package/packages/pm-beads/package.json +1 -1
  150. package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
  151. package/packages/pm-calendar/package.json +1 -1
  152. package/packages/pm-command-kit/package.json +1 -1
  153. package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
  154. package/packages/pm-digital-twin/package.json +1 -1
  155. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
  156. package/packages/pm-governance-audit/package.json +1 -1
  157. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
  158. package/packages/pm-guide-shell/package.json +1 -1
  159. package/packages/pm-kanban/package.json +1 -1
  160. package/packages/pm-lifecycle-hooks/package.json +1 -1
  161. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +6 -0
  162. package/packages/pm-linked-test-adapters/package.json +1 -1
  163. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
  164. package/packages/pm-search-advanced/package.json +1 -1
  165. package/packages/pm-templates/extensions/templates/index.ts +4 -0
  166. package/packages/pm-templates/package.json +1 -1
  167. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  168. package/packages/pm-todos/package.json +1 -1
  169. package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
  170. package/packages/pm-vcs/package.json +1 -1
  171. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  172. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  173. package/scripts/bundle-cli.mjs +17 -4
  174. package/sdk/public-surface.json +1283 -157
  175. package/dist/cli-bundle/chunks/chunk-DEDU3DG7.js +0 -196
  176. package/dist/cli-bundle/chunks/chunk-DL5M5J3V.js +0 -13
  177. package/dist/cli-bundle/chunks/chunk-HIUZVCMN.js +0 -5
  178. package/dist/cli-bundle/chunks/chunk-IMGIN7R6.js +0 -2
  179. package/dist/cli-bundle/chunks/chunk-TF3TPKPR.js +0 -34
  180. package/dist/cli-bundle/chunks/register-operations-C44ET7R5.js +0 -2
  181. package/dist/cli-bundle/focused-chunks/chunk-27N23W6M.js +0 -31
  182. package/dist/cli-bundle/focused-chunks/chunk-3BNVU6LC.js +0 -8
  183. package/dist/cli-bundle/focused-chunks/chunk-6MLIRBLV.js +0 -5
  184. package/dist/cli-bundle/focused-chunks/chunk-6XYLENDV.js +0 -155
  185. package/dist/cli-bundle/focused-chunks/chunk-CP4K4WFS.js +0 -2
  186. package/dist/cli-bundle/focused-chunks/chunk-EBTNSFYE.js +0 -2
  187. package/dist/cli-bundle/focused-chunks/chunk-HC2OL2H2.js +0 -2
  188. package/dist/cli-bundle/focused-chunks/chunk-NFHFZH2Z.js +0 -2
  189. package/dist/cli-bundle/focused-chunks/chunk-OGC4XSBC.js +0 -17
  190. package/dist/cli-bundle/focused-chunks/chunk-PKPOZXLL.js +0 -2
  191. package/dist/cli-bundle/focused-chunks/chunk-QDZUABWL.js +0 -2
  192. package/dist/cli-bundle/focused-chunks/chunk-QQX5TDFT.js +0 -16
  193. package/dist/cli-bundle/focused-chunks/chunk-TEZIXMTH.js +0 -2
  194. package/dist/cli-bundle/focused-chunks/chunk-WEH6NSL6.js +0 -18
@@ -1,31 +1,7 @@
1
1
  /** Generated partition 2 of the exhaustive error-code catalog. */
2
2
 
3
- !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]="b129c0ca-3d57-551c-945c-300547b74ff5")}catch(e){}}();
3
+ !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]="5d64a86d-6ba6-5bbe-a83a-9703690a851e")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_2 = [
5
- {
6
- code: "merge_conflict_markers_detected",
7
- meaning: "Merge conflict markers detected condition.",
8
- stability: "stable",
9
- exit_code: 1,
10
- class: "generic_failure",
11
- recovery: "Inspect the structured error guidance and retry the suggested command.",
12
- sources: ["core/item/item-format.ts"],
13
- emitting_commands: ["*"],
14
- canonical_code: "merge_conflict_markers_detected",
15
- aliases: ["history_merge_conflict_markers_detected"],
16
- },
17
- {
18
- code: "merge_decisions_unreviewed",
19
- meaning: "Merge decisions unreviewed condition.",
20
- stability: "provisional",
21
- exit_code: 1,
22
- class: "generic_failure",
23
- recovery: "Inspect the structured error guidance and retry the suggested command.",
24
- sources: ["core/diagnostics/remediation.ts"],
25
- emitting_commands: ["*"],
26
- canonical_code: "merge_decisions_unreviewed",
27
- aliases: [],
28
- },
29
5
  {
30
6
  code: "merge_git_config_unwritable",
31
7
  meaning: "Merge git config unwritable condition.",
@@ -363,6 +339,54 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
363
339
  canonical_code: "project_runtime_stale_read",
364
340
  aliases: [],
365
341
  },
342
+ {
343
+ code: "provenance_value_domain_invalid",
344
+ meaning: "Provenance value domain invalid condition.",
345
+ stability: "provisional",
346
+ exit_code: 2,
347
+ class: "usage",
348
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
349
+ sources: ["core/diagnostics/remediation.ts"],
350
+ emitting_commands: ["*"],
351
+ canonical_code: "provenance_value_domain_invalid",
352
+ aliases: [],
353
+ },
354
+ {
355
+ code: "read_output_cursor_command_mismatch",
356
+ meaning: "Read output cursor command mismatch condition.",
357
+ stability: "provisional",
358
+ exit_code: 2,
359
+ class: "usage",
360
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
361
+ sources: ["sdk/read-output/continuation.ts"],
362
+ emitting_commands: ["*"],
363
+ canonical_code: "read_output_cursor_command_mismatch",
364
+ aliases: [],
365
+ },
366
+ {
367
+ code: "read_output_cursor_invalid",
368
+ meaning: "Read output cursor invalid condition.",
369
+ stability: "provisional",
370
+ exit_code: 2,
371
+ class: "usage",
372
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
373
+ sources: ["sdk/read-output/continuation.ts"],
374
+ emitting_commands: ["*"],
375
+ canonical_code: "read_output_cursor_invalid",
376
+ aliases: [],
377
+ },
378
+ {
379
+ code: "read_output_cursor_stale",
380
+ meaning: "Read output cursor stale condition.",
381
+ stability: "provisional",
382
+ exit_code: 2,
383
+ class: "usage",
384
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
385
+ sources: ["sdk/read-output/continuation.ts"],
386
+ emitting_commands: ["*"],
387
+ canonical_code: "read_output_cursor_stale",
388
+ aliases: [],
389
+ },
366
390
  {
367
391
  code: "redundant_edge",
368
392
  meaning: "Redundant edge condition.",
@@ -1605,4 +1629,4 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
1605
1629
  },
1606
1630
  ];
1607
1631
  //# sourceMappingURL=generated-error-code-catalog-part-2.js.map
1608
- //# debugId=b129c0ca-3d57-551c-945c-300547b74ff5
1632
+ //# debugId=5d64a86d-6ba6-5bbe-a83a-9703690a851e
@@ -6,6 +6,7 @@
6
6
  import type { GlobalOptions } from "../../core/shared/command-types.js";
7
7
  import { type AssuranceBundleMutationReceipt, type AssuranceDeclaration, type AssuranceGateVerdict, type AssuranceMutationReceipt } from "./assurance.js";
8
8
  import { type AssuranceDerivedProposal, type AssurancePreset, type AssurancePresetId } from "./assurance-presets.js";
9
+ import { type CreateAssuranceWorkspaceContextOptions } from "./assurance-runtime.js";
9
10
  /** Assurance registry and evaluation verbs shared by every transport. */
10
11
  export declare const ASSURANCE_ACTIONS: readonly ["list", "show", "put", "remove", "run", "verdicts", "presets", "apply", "derive", "promote"];
11
12
  /** Assurance declaration kinds shared by every transport. */
@@ -49,6 +50,11 @@ export interface AssuranceActionInput {
49
50
  /** Explicit next assertion enforcement level. */
50
51
  enforcement?: string;
51
52
  }
53
+ /** Embedding-host capabilities used only while evaluating assurance actions. */
54
+ export interface AssuranceActionRuntimeOptions {
55
+ /** Workspace adapters and provider capabilities supplied by an SDK host. */
56
+ workspace?: Omit<CreateAssuranceWorkspaceContextOptions, "tree_id" | "trigger">;
57
+ }
52
58
  /** Result union returned by transport-neutral assurance execution. */
53
59
  export type AssuranceActionResult = AssuranceDeclaration | AssuranceMutationReceipt | AssuranceGateVerdict | AssuranceBundleMutationReceipt | AssurancePreset | {
54
60
  items: AssuranceDerivedProposal[];
@@ -89,6 +95,6 @@ export type AssuranceActionResult = AssuranceDeclaration | AssuranceMutationRece
89
95
  };
90
96
  };
91
97
  /** Execute one assurance request through the public assurance SDK primitives. */
92
- export declare function runAssuranceAction(input: AssuranceActionInput, global?: Pick<GlobalOptions, "path">): Promise<AssuranceActionResult>;
98
+ export declare function runAssuranceAction(input: AssuranceActionInput, global?: Pick<GlobalOptions, "path">, runtime?: AssuranceActionRuntimeOptions): Promise<AssuranceActionResult>;
93
99
  /** Normalize a generic SDK or MCP argument envelope into one assurance request. */
94
100
  export declare function runAssuranceDispatch(args: Record<string, unknown>, options: Record<string, unknown>, global: GlobalOptions): Promise<AssuranceActionResult>;
@@ -1,12 +1,12 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="36dfa230-06bd-5902-a0c9-94a7c34cda90")}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]="06d21369-1339-54b2-8d78-442f02e24cef")}catch(e){}}();
3
3
  import { EXIT_CODE } from "../../core/shared/constants.js";
4
4
  import { PmCliError } from "../../core/shared/errors.js";
5
5
  import { ASSURANCE_GATE_TRIGGERS, evaluateAssuranceGate, getAssuranceDeclaration, listAssuranceDeclarations, listAssuranceVerdicts, putAssuranceDeclaration, recordAssuranceVerdict, removeAssuranceDeclaration, } from "./assurance.js";
6
6
  import { ASSURANCE_PRESET_IDS, acceptAssuranceProposals, applyAssurancePreset, createAssurancePreset, deriveAssuranceProposals, promoteAssuranceAssertion, } from "./assurance-presets.js";
7
7
  import { MAX_ASSURANCE_VERDICT_LIMIT } from "./assurance-limits.js";
8
8
  import { normalizeAssuranceEvaluation, normalizeAssuranceMutation, } from "./assurance-mutation-error.js";
9
- import { createAssuranceWorkspaceContext } from "./assurance-runtime.js";
9
+ import { createAssuranceWorkspaceContext, } from "./assurance-runtime.js";
10
10
  import { resolvePmRoot } from "../runtime-primitives.js";
11
11
  import { parseRuntimeInteger, readRuntimeString } from "../runtime-input.js";
12
12
  /** Assurance registry and evaluation verbs shared by every transport. */
@@ -173,7 +173,7 @@ async function runAdoptionAction(action, input, pmRoot) {
173
173
  message: input.message,
174
174
  }));
175
175
  }
176
- async function runGateAction(input, pmRoot) {
176
+ async function runGateAction(input, pmRoot, runtime) {
177
177
  if (!input.id) {
178
178
  throw new PmCliError("assurance run requires a gate id", EXIT_CODE.USAGE);
179
179
  }
@@ -188,6 +188,7 @@ async function runGateAction(input, pmRoot) {
188
188
  const [document, workspaceContext] = await Promise.all([
189
189
  readDocument(pmRoot),
190
190
  createAssuranceWorkspaceContext(pmRoot, {
191
+ ...runtime.workspace,
191
192
  tree_id: input.tree,
192
193
  trigger,
193
194
  }),
@@ -205,7 +206,7 @@ async function runGateAction(input, pmRoot) {
205
206
  return verdict;
206
207
  }
207
208
  /** Execute one assurance request through the public assurance SDK primitives. */
208
- export async function runAssuranceAction(input, global = {}) {
209
+ export async function runAssuranceAction(input, global = {}, runtime = {}) {
209
210
  const action = parseAction(input.action);
210
211
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
211
212
  if (action === "presets" ||
@@ -218,7 +219,7 @@ export async function runAssuranceAction(input, global = {}) {
218
219
  return runVerdictsAction(input, pmRoot);
219
220
  }
220
221
  if (action === "run") {
221
- return runGateAction(input, pmRoot);
222
+ return runGateAction(input, pmRoot, runtime);
222
223
  }
223
224
  const kind = parseKind(input.kind);
224
225
  if (action === "list")
@@ -281,4 +282,4 @@ export function runAssuranceDispatch(args, options, global) {
281
282
  }, global);
282
283
  }
283
284
  //# sourceMappingURL=assurance-action.js.map
284
- //# debugId=36dfa230-06bd-5902-a0c9-94a7c34cda90
285
+ //# debugId=06d21369-1339-54b2-8d78-442f02e24cef
@@ -1,3 +1,29 @@
1
+ /** Machine-readable location of a refused assurance evaluation. */
2
+ export interface AssuranceEvaluationRefusalContext {
3
+ /** Gate being evaluated. */
4
+ gate_id?: string;
5
+ /** Assertion whose measurement failed. */
6
+ assertion_id?: string;
7
+ /** Measurement whose source failed. */
8
+ measurement_id?: string;
9
+ /** Measurement source discriminant. */
10
+ source_kind?: string;
11
+ /** Field selected from a graph, validate, or health result. */
12
+ field?: string;
13
+ /** Validate or health check selected by the source. */
14
+ check?: string;
15
+ }
16
+ /** Machine-readable location of a failed measurement source resolution. */
17
+ export interface AssuranceSourceResolutionContext {
18
+ /** Measurement that owns the failed source, once evaluation identifies it. */
19
+ measurement_id?: string;
20
+ /** Measurement source discriminant. */
21
+ source_kind: string;
22
+ /** Field selected from the source result. */
23
+ field: string;
24
+ /** Optional validate or health check selector. */
25
+ check?: string;
26
+ }
1
27
  /** Expected declaration-validation or mutation-policy refusal. */
2
28
  export declare class AssuranceMutationRefusalError extends TypeError {
3
29
  /** Create one typed refusal while retaining TypeError compatibility for SDK callers. */
@@ -5,8 +31,23 @@ export declare class AssuranceMutationRefusalError extends TypeError {
5
31
  }
6
32
  /** Expected gate-policy refusal caused by an incomplete or disallowed provider contract. */
7
33
  export declare class AssuranceEvaluationRefusalError extends TypeError {
34
+ /** Structured evaluation location retained across CLI, SDK, and MCP. */
35
+ readonly context: AssuranceEvaluationRefusalContext;
8
36
  /** Create one typed refusal while retaining TypeError compatibility for SDK callers. */
9
- constructor(message: string);
37
+ constructor(message: string, context?: AssuranceEvaluationRefusalContext);
38
+ }
39
+ /** Expected failure to resolve one declared external measurement source. */
40
+ export declare class AssuranceSourceResolutionError extends TypeError {
41
+ /** Measurement that owns the failed source, once evaluation identifies it. */
42
+ readonly measurement_id?: string;
43
+ /** Measurement source discriminant. */
44
+ readonly source_kind: string;
45
+ /** Field selected from the source result. */
46
+ readonly field: string;
47
+ /** Optional validate or health check selector. */
48
+ readonly check?: string;
49
+ /** Create one source-local refusal before gate context is attached. */
50
+ constructor(message: string, context: AssuranceSourceResolutionContext);
10
51
  }
11
52
  /** Normalize only expected assurance mutation refusals for CLI and MCP hosts. */
12
53
  export declare function normalizeAssuranceMutation<T>(operation: () => Promise<T>): Promise<T>;
@@ -5,7 +5,7 @@
5
5
  * faults before transport layers normalize them into stable usage errors.
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]="93a32771-bf95-5df4-8019-b6be45a5051b")}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]="d2d5135a-8110-527e-8530-653b25b792a4")}catch(e){}}();
9
9
  import { EXIT_CODE } from "../../core/shared/constants.js";
10
10
  import { PmCliError } from "../../core/shared/errors.js";
11
11
  /** Expected declaration-validation or mutation-policy refusal. */
@@ -18,10 +18,33 @@ export class AssuranceMutationRefusalError extends TypeError {
18
18
  }
19
19
  /** Expected gate-policy refusal caused by an incomplete or disallowed provider contract. */
20
20
  export class AssuranceEvaluationRefusalError extends TypeError {
21
+ /** Structured evaluation location retained across CLI, SDK, and MCP. */
22
+ context;
21
23
  /** Create one typed refusal while retaining TypeError compatibility for SDK callers. */
22
- constructor(message) {
24
+ constructor(message, context = {}) {
23
25
  super(message);
24
26
  this.name = "AssuranceEvaluationRefusalError";
27
+ this.context = context;
28
+ }
29
+ }
30
+ /** Expected failure to resolve one declared external measurement source. */
31
+ export class AssuranceSourceResolutionError extends TypeError {
32
+ /** Measurement that owns the failed source, once evaluation identifies it. */
33
+ measurement_id;
34
+ /** Measurement source discriminant. */
35
+ source_kind;
36
+ /** Field selected from the source result. */
37
+ field;
38
+ /** Optional validate or health check selector. */
39
+ check;
40
+ /** Create one source-local refusal before gate context is attached. */
41
+ constructor(message, context) {
42
+ super(message);
43
+ this.name = "AssuranceSourceResolutionError";
44
+ this.measurement_id = context.measurement_id;
45
+ this.source_kind = context.source_kind;
46
+ this.field = context.field;
47
+ this.check = context.check;
25
48
  }
26
49
  }
27
50
  /** Normalize only expected assurance mutation refusals for CLI and MCP hosts. */
@@ -49,10 +72,11 @@ export async function normalizeAssuranceEvaluation(operation) {
49
72
  throw new PmCliError(error.message, EXIT_CODE.USAGE, {
50
73
  code: "invalid_argument_value",
51
74
  reason: "assurance_evaluation_refused",
75
+ ...error.context,
52
76
  });
53
77
  }
54
78
  throw error;
55
79
  }
56
80
  }
57
81
  //# sourceMappingURL=assurance-mutation-error.js.map
58
- //# debugId=93a32771-bf95-5df4-8019-b6be45a5051b
82
+ //# debugId=d2d5135a-8110-527e-8530-653b25b792a4
@@ -5,12 +5,13 @@
5
5
  * and verdict semantics in the host-neutral assurance module.
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]="7c99dfd8-2fa4-56c4-8191-229701eab251")}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]="f9c26dab-b2fb-5ca0-b575-682b4b0bb830")}catch(e){}}();
9
9
  import { execFile } from "node:child_process";
10
10
  import { promisify } from "node:util";
11
11
  import { runGraph } from "../graph/run.js";
12
12
  import { runHealth } from "./health.js";
13
13
  import { runValidate } from "./validate.js";
14
+ import { AssuranceSourceResolutionError } from "./assurance-mutation-error.js";
14
15
  import { getActiveExtensionRegistrations, resolvePortableWorkspaceContext, } from "../../core/extensions/index.js";
15
16
  import { resolveRegisteredAssuranceMeasurementProvider } from "../../core/extensions/runtime-registrations.js";
16
17
  import { stableStringify } from "../../core/shared/serialization.js";
@@ -86,13 +87,13 @@ async function runRegisteredProvider(provider, source, pmRoot, trigger) {
86
87
  clearTimeout(timeoutHandle);
87
88
  }
88
89
  }
89
- function valueAtPath(input, field) {
90
+ function valueAtPath(input, field, sourceKind, check) {
90
91
  let current = input;
91
92
  for (const segment of field.split(".")) {
92
93
  if (typeof current !== "object" ||
93
94
  current === null ||
94
95
  Array.isArray(current)) {
95
- throw new TypeError(`assurance field ${field} is not present`);
96
+ throw new AssuranceSourceResolutionError(`assurance field ${field} is not present`, { source_kind: sourceKind, field, ...(check ? { check } : {}) });
96
97
  }
97
98
  current = current[segment];
98
99
  }
@@ -102,17 +103,17 @@ function valueAtPath(input, field) {
102
103
  current.every((entry) => typeof entry === "string")) {
103
104
  return current;
104
105
  }
105
- throw new TypeError(`assurance field ${field} must resolve to a finite number or string array`);
106
+ throw new AssuranceSourceResolutionError(`assurance field ${field} must resolve to a finite number or string array`, { source_kind: sourceKind, field, ...(check ? { check } : {}) });
106
107
  }
107
- function checkValue(result, checkName, field) {
108
+ function checkValue(result, checkName, field, sourceKind) {
108
109
  const check = result.checks.find((entry) => entry.name === checkName);
109
110
  if (!check)
110
- throw new TypeError(`assurance check ${checkName} is not present`);
111
+ throw new AssuranceSourceResolutionError(`assurance check ${checkName} is not present`, { source_kind: sourceKind, field, check: checkName });
111
112
  const value = field === "status" || field === "ok"
112
113
  ? check.ok
113
114
  ? 0
114
115
  : 1
115
- : valueAtPath(check.details, field);
116
+ : valueAtPath(check.details, field, sourceKind, checkName);
116
117
  return { value, population_size: 1, cost: result.checks.length };
117
118
  }
118
119
  async function resolveTreeId(pmRoot, explicit) {
@@ -205,7 +206,7 @@ export async function createAssuranceWorkspaceContext(pmRoot, options = {}) {
205
206
  }
206
207
  const result = await pending;
207
208
  return {
208
- value: valueAtPath(result, source.field),
209
+ value: valueAtPath(result, source.field, source.kind),
209
210
  population_size: items.length,
210
211
  cost: items.length,
211
212
  };
@@ -213,12 +214,12 @@ export async function createAssuranceWorkspaceContext(pmRoot, options = {}) {
213
214
  if (source.kind === "validate") {
214
215
  validateRun ??= runValidate({ counts: true }, global);
215
216
  const result = await validateRun;
216
- return checkValue(result, source.check, source.field);
217
+ return checkValue(result, source.check, source.field, source.kind);
217
218
  }
218
219
  if (source.kind === "health") {
219
220
  healthRun ??= runHealth(global, { checkOnly: true, full: true });
220
221
  const result = await healthRun;
221
- return checkValue(result, source.check, source.field);
222
+ return checkValue(result, source.check, source.field, source.kind);
222
223
  }
223
224
  const hostProvider = options.providers?.[source.provider];
224
225
  if (hostProvider)
@@ -232,4 +233,4 @@ export async function createAssuranceWorkspaceContext(pmRoot, options = {}) {
232
233
  };
233
234
  }
234
235
  //# sourceMappingURL=assurance-runtime.js.map
235
- //# debugId=7c99dfd8-2fa4-56c4-8191-229701eab251
236
+ //# debugId=f9c26dab-b2fb-5ca0-b575-682b4b0bb830
@@ -2,6 +2,8 @@
2
2
  export declare const ASSURANCE_DOCUMENT_VERSION: 1;
3
3
  /** Supported lifecycle points that can evaluate a gate. */
4
4
  export declare const ASSURANCE_GATE_TRIGGERS: readonly ["pre-commit", "pre-push", "pre-merge", "ci", "pre-release", "post-release", "scheduled", "on-claim", "on-close"];
5
+ /** Supported discriminants for built-in, delegated, and derived measurements. */
6
+ export declare const ASSURANCE_MEASUREMENT_SOURCE_KINDS: readonly ["items", "dependency_kind", "graph", "validate", "health", "history", "links", "provider", "derived"];
5
7
  /** Gate lifecycle trigger. */
6
8
  export type AssuranceGateTrigger = (typeof ASSURANCE_GATE_TRIGGERS)[number];
7
9
  /** Assertion enforcement strength. */
@@ -401,6 +403,13 @@ export interface AssuranceGateVerdict {
401
403
  exit_code: 0 | 1;
402
404
  /** Per-assertion receipts. */
403
405
  assertions: AssuranceAssertionVerdict[];
406
+ /** Total assertions evaluated before any transport projection or compaction. */
407
+ assertions_total: number;
408
+ /** Stable selector for iterating assertion evidence across transports. */
409
+ row_contract: {
410
+ row_keys: ["assertions"];
411
+ jq_selector: ".assertions[]";
412
+ };
404
413
  /** Aggregate compute receipt. */
405
414
  cost: AssuranceMeasurementCost;
406
415
  }
@@ -7,7 +7,7 @@
7
7
  * one deterministic SDK path.
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]="e491ddd9-60e7-51fd-b0c7-4f6e86ee56f9")}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]="2bf52d6d-7e4f-5ec5-86bd-3e817ef521bb")}catch(e){}}();
11
11
  import { createHash } from "node:crypto";
12
12
  import path from "node:path";
13
13
  import { EXIT_CODE } from "../../core/shared/constants.js";
@@ -15,7 +15,7 @@ import { PmCliError } from "../../core/shared/errors.js";
15
15
  import { appendWorkspaceAuditEvent, mutateWorkspaceJsonWithHistory, readFileIfExists, readHistoryEntries, readSettings, resolveAuthor, stableStringify, WORKSPACE_HISTORY_ID, getWorkspaceHistoryPath, } from "../runtime-primitives.js";
16
16
  import { resolveCanonicalRelationshipKind } from "../relationships.js";
17
17
  import { MAX_ASSURANCE_VERDICT_LIMIT } from "./assurance-limits.js";
18
- import { AssuranceEvaluationRefusalError, AssuranceMutationRefusalError, } from "./assurance-mutation-error.js";
18
+ import { AssuranceEvaluationRefusalError, AssuranceMutationRefusalError, AssuranceSourceResolutionError, } from "./assurance-mutation-error.js";
19
19
  /** Current serialized assurance registry format. */
20
20
  export const ASSURANCE_DOCUMENT_VERSION = 1;
21
21
  /** Supported lifecycle points that can evaluate a gate. */
@@ -30,6 +30,18 @@ export const ASSURANCE_GATE_TRIGGERS = [
30
30
  "on-claim",
31
31
  "on-close",
32
32
  ];
33
+ /** Supported discriminants for built-in, delegated, and derived measurements. */
34
+ export const ASSURANCE_MEASUREMENT_SOURCE_KINDS = [
35
+ "items",
36
+ "dependency_kind",
37
+ "graph",
38
+ "validate",
39
+ "health",
40
+ "history",
41
+ "links",
42
+ "provider",
43
+ "derived",
44
+ ];
33
45
  const POLARITY_KEYS = [
34
46
  "ceiling",
35
47
  "floor",
@@ -161,7 +173,15 @@ export function validateMeasurementDefinition(definition) {
161
173
  if (definition.max_cost !== undefined) {
162
174
  requireFiniteNonNegative(definition.max_cost, "measurement.max_cost");
163
175
  }
164
- const source = definition.source;
176
+ const candidateSource = definition.source;
177
+ if (Object.prototype.toString.call(candidateSource) !== "[object Object]") {
178
+ throw new AssuranceMutationRefusalError(`measurement.source.kind must be one of ${ASSURANCE_MEASUREMENT_SOURCE_KINDS.join(", ")}`);
179
+ }
180
+ const sourceKind = Reflect.get(candidateSource, "kind");
181
+ if (!ASSURANCE_MEASUREMENT_SOURCE_KINDS.includes(sourceKind)) {
182
+ throw new AssuranceMutationRefusalError(`measurement.source.kind must be one of ${ASSURANCE_MEASUREMENT_SOURCE_KINDS.join(", ")}`);
183
+ }
184
+ const source = candidateSource;
165
185
  if (source.kind === "items") {
166
186
  validateItemsMeasurementSource(source);
167
187
  }
@@ -240,14 +260,25 @@ function validateGateProviderPolicy(policy) {
240
260
  /** Validate and return one gate declaration. */
241
261
  export function validateGateDefinition(definition) {
242
262
  requireStableId(definition.id, "gate.id");
263
+ if (!Array.isArray(definition.assertion_ids)) {
264
+ throw new AssuranceMutationRefusalError("gate.assertion_ids is required and must be an array");
265
+ }
243
266
  if (definition.assertion_ids.length === 0) {
244
267
  throw new AssuranceMutationRefusalError("gate requires at least one assertion");
245
268
  }
246
269
  for (const id of definition.assertion_ids)
247
270
  requireStableId(id, "gate.assertion_id");
271
+ if (!Array.isArray(definition.triggers)) {
272
+ throw new AssuranceMutationRefusalError(`gate.triggers is required and must be an array of ${ASSURANCE_GATE_TRIGGERS.join(", ")}`);
273
+ }
248
274
  if (definition.triggers.length === 0) {
249
275
  throw new AssuranceMutationRefusalError("gate requires at least one trigger");
250
276
  }
277
+ for (const trigger of definition.triggers) {
278
+ if (!ASSURANCE_GATE_TRIGGERS.includes(trigger)) {
279
+ throw new AssuranceMutationRefusalError(`gate trigger must be one of ${ASSURANCE_GATE_TRIGGERS.join(", ")}`);
280
+ }
281
+ }
251
282
  if (definition.provider_policy) {
252
283
  validateGateProviderPolicy(definition.provider_policy);
253
284
  }
@@ -543,16 +574,10 @@ async function evaluateMeasurementInternal(definition, context, definitions, sta
543
574
  if (builtin !== null) {
544
575
  result = builtin;
545
576
  }
546
- else if (definition.source.kind === "graph" ||
547
- definition.source.kind === "validate" ||
548
- definition.source.kind === "health" ||
549
- definition.source.kind === "provider") {
577
+ else {
550
578
  result = await context.external(definition.source);
551
579
  providerCalls = 1;
552
580
  }
553
- else {
554
- throw new TypeError(`unsupported assurance source ${definition.source.kind}`);
555
- }
556
581
  }
557
582
  const ownCost = {
558
583
  units: result.cost,
@@ -587,7 +612,21 @@ function evaluateMeasurementCached(definition, context, definitions, stack, stat
587
612
  const cached = state.cache.get(definition.id);
588
613
  if (cached)
589
614
  return cached;
590
- const evaluation = evaluateMeasurementInternal(definition, context, definitions, stack, state);
615
+ const evaluation = evaluateMeasurementInternal(definition, context, definitions, stack, state).catch((error) => {
616
+ if (error instanceof AssuranceSourceResolutionError &&
617
+ error.measurement_id === undefined) {
618
+ const sourceContext = {
619
+ measurement_id: definition.id,
620
+ source_kind: error.source_kind,
621
+ field: error.field,
622
+ ...(error.check ? { check: error.check } : {}),
623
+ };
624
+ const sourceError = new AssuranceSourceResolutionError(error.message, sourceContext);
625
+ sourceError.cause = error;
626
+ throw sourceError;
627
+ }
628
+ throw error;
629
+ });
591
630
  state.cache.set(definition.id, evaluation);
592
631
  return evaluation;
593
632
  }
@@ -664,14 +703,36 @@ function enforceGateProviderPolicy(gate, document, context, trigger) {
664
703
  }
665
704
  }
666
705
  }
706
+ async function evaluateGateMeasurement(gateId, assertionId, definition, context, definitions) {
707
+ try {
708
+ return await evaluateMeasurement(definition, context, definitions);
709
+ }
710
+ catch (error) {
711
+ if (error instanceof AssuranceSourceResolutionError) {
712
+ const checkLocation = error.check ? ` check ${error.check}` : "";
713
+ const measurementId = error.measurement_id ?? definition.id;
714
+ const refusal = new AssuranceEvaluationRefusalError(`assurance gate ${gateId} assertion ${assertionId} measurement ${measurementId} source ${error.source_kind}${checkLocation} field ${error.field} could not resolve: ${error.message}`, {
715
+ gate_id: gateId,
716
+ assertion_id: assertionId,
717
+ measurement_id: measurementId,
718
+ source_kind: error.source_kind,
719
+ field: error.field,
720
+ ...(error.check ? { check: error.check } : {}),
721
+ });
722
+ refusal.cause = error;
723
+ throw refusal;
724
+ }
725
+ throw error;
726
+ }
727
+ }
667
728
  /** Evaluate a named gate into one presentation-independent verdict document. */
668
729
  export async function evaluateAssuranceGate(gateId, document, context, options) {
669
730
  validateAssuranceDocument(document);
670
731
  const gateDefinition = document.gates.find((entry) => entry.id === gateId);
671
732
  if (!gateDefinition)
672
- throw new TypeError(`assurance gate ${gateId} not found`);
733
+ throw new AssuranceEvaluationRefusalError(`assurance gate ${gateId} not found`);
673
734
  if (!gateDefinition.triggers.includes(options.trigger)) {
674
- throw new TypeError(`assurance gate ${gateId} does not declare trigger ${options.trigger}`);
735
+ throw new AssuranceEvaluationRefusalError(`assurance gate ${gateId} does not declare trigger ${options.trigger}`);
675
736
  }
676
737
  enforceGateProviderPolicy(gateDefinition, document, context, options.trigger);
677
738
  const assertions = await mapWithConcurrency(gateDefinition.assertion_ids, EVALUATION_CONCURRENCY, async (id) => {
@@ -688,7 +749,7 @@ export async function evaluateAssuranceGate(gateId, document, context, options)
688
749
  else if (assertionDefinition.scope.kind === "filter") {
689
750
  const scopeMeasurementId = assertionDefinition.scope.measurement_id;
690
751
  const scopeDefinition = document.measurements.find((entry) => entry.id === scopeMeasurementId);
691
- const scope = await evaluateMeasurement(scopeDefinition, context, document.measurements);
752
+ const scope = await evaluateGateMeasurement(gateDefinition.id, assertionDefinition.id, scopeDefinition, context, document.measurements);
692
753
  const contributorIds = new Set(scope.contributors);
693
754
  scopedContext = {
694
755
  ...context,
@@ -698,7 +759,7 @@ export async function evaluateAssuranceGate(gateId, document, context, options)
698
759
  const owner = context.items.find((item) => item.id === assertionDefinition.owner_item_id);
699
760
  const ownerTerminal = owner !== undefined &&
700
761
  new Set(context.terminal_statuses ?? ["closed", "canceled"]).has(owner.status);
701
- return evaluateAssuranceAssertion(assertionDefinition, await evaluateMeasurement(measurementDefinition, scopedContext, document.measurements), { owner_terminal: ownerTerminal });
762
+ return evaluateAssuranceAssertion(assertionDefinition, await evaluateGateMeasurement(gateDefinition.id, assertionDefinition.id, measurementDefinition, scopedContext, document.measurements), { owner_terminal: ownerTerminal });
702
763
  });
703
764
  const blocking = assertions.some((entry) => entry.verdict === "fail" && entry.enforcement === "block");
704
765
  const warning = assertions.some((entry) => entry.verdict === "fail" && entry.enforcement === "warn");
@@ -711,6 +772,11 @@ export async function evaluateAssuranceGate(gateId, document, context, options)
711
772
  verdict: blocking ? "block" : warning ? "warn" : "pass",
712
773
  exit_code: blocking ? 1 : 0,
713
774
  assertions,
775
+ assertions_total: assertions.length,
776
+ row_contract: {
777
+ row_keys: ["assertions"],
778
+ jq_selector: ".assertions[]",
779
+ },
714
780
  cost: sumCosts(assertions.map((entry) => entry.cost), Math.max(0, ...assertions.map((entry) => entry.cost.duration_ms))),
715
781
  };
716
782
  }
@@ -940,4 +1006,4 @@ export async function listAssuranceVerdicts(pmRoot, options = {}) {
940
1006
  .slice(0, limit);
941
1007
  }
942
1008
  //# sourceMappingURL=assurance.js.map
943
- //# debugId=e491ddd9-60e7-51fd-b0c7-4f6e86ee56f9
1009
+ //# debugId=2bf52d6d-7e4f-5ec5-86bd-3e817ef521bb
@@ -0,0 +1,25 @@
1
+ import type { LoadedExtension } from "../../core/extensions/loader.js";
2
+ /** One distinct resolvable pm-cli installation and its extension consumers. */
3
+ export interface ExtensionHostVersionCopy {
4
+ /** Installed pm-cli version. */
5
+ version: string;
6
+ /** Privacy-safe workspace-relative package manifest location. */
7
+ path: string;
8
+ /** Dependency layout that exposed this copy. */
9
+ layout: "host" | "npm" | "pnpm" | "other";
10
+ /** Loaded extensions resolving this copy. */
11
+ consumers: string[];
12
+ }
13
+ /** Extension/host version census returned by the health SDK. */
14
+ export interface ExtensionHostVersionCensus {
15
+ /** Version of the process-hosting pm-cli package. */
16
+ host_version: string | null;
17
+ /** Every distinct relevant copy resolved by the host or an extension. */
18
+ copies: ExtensionHostVersionCopy[];
19
+ /** Copies whose version differs from the process host. */
20
+ mismatches: ExtensionHostVersionCopy[];
21
+ /** Stable health warning tokens for mismatched copies. */
22
+ warnings: string[];
23
+ }
24
+ /** Scan the host plus the nearest pm-cli package resolvable by every loaded extension. */
25
+ export declare function scanExtensionHostVersions(loadedExtensions: readonly LoadedExtension[], workspaceRoot: string, hostPackageRoot?: string): Promise<ExtensionHostVersionCensus>;