@unbrained/pm-cli 2026.8.12 → 2026.8.14

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 (218) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +162 -111
  3. package/dist/cli/error-guidance.js +4 -8
  4. package/dist/cli/main.js +40 -3
  5. package/dist/cli/register-assurance.js +28 -17
  6. package/dist/cli-bundle/bundle-manifest.json +141 -173
  7. package/dist/cli-bundle/chunks/chunk-BBOFSVAK.js +197 -0
  8. package/dist/cli-bundle/chunks/chunk-BFALV3YP.js +5 -0
  9. package/dist/cli-bundle/chunks/{chunk-WLAHPSOX.js → chunk-FIW4P64F.js} +2 -2
  10. package/dist/cli-bundle/chunks/{chunk-BM5YJ2UW.js → chunk-G5JUB66K.js} +52 -52
  11. package/dist/cli-bundle/chunks/chunk-SBRKH6OR.js +2 -0
  12. package/dist/cli-bundle/chunks/chunk-TMJ7URWS.js +13 -0
  13. package/dist/cli-bundle/chunks/chunk-TXMEUUUY.js +8 -0
  14. package/dist/cli-bundle/chunks/{chunk-KOQMGCTA.js → chunk-XAVMOK6B.js} +50 -50
  15. package/dist/cli-bundle/chunks/chunk-YAMTJL6Y.js +34 -0
  16. package/dist/cli-bundle/chunks/chunk-YSVSMJ2B.js +2 -0
  17. package/dist/cli-bundle/chunks/{register-list-query-XPCJRUUD.js → register-list-query-T3EHHNNV.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-4RJCBKRS.js → register-mutation-E27WCLSZ.js} +2 -2
  19. package/dist/cli-bundle/chunks/register-operations-4R6I7CPY.js +2 -0
  20. package/dist/cli-bundle/chunks/{register-setup-LLHAKP2V.js → register-setup-3YXZ444E.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-JAFRIWVF.js → chunk-4DQ2YERC.js} +4 -4
  22. package/dist/cli-bundle/focused-chunks/chunk-F43TT2QQ.js +8 -0
  23. package/dist/cli-bundle/focused-chunks/chunk-K7RWWOAG.js +4 -0
  24. package/dist/cli-bundle/focused-chunks/chunk-KFSZ3BP6.js +16 -0
  25. package/dist/cli-bundle/focused-chunks/{chunk-KHM2CS2C.js → chunk-KSEDUWVZ.js} +2 -2
  26. package/dist/cli-bundle/focused-chunks/chunk-KYUQGTSB.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/{chunk-ZMGWAYH7.js → chunk-LZ4MV3RH.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/chunk-PGXJQLCT.js +155 -0
  29. package/dist/cli-bundle/focused-chunks/{chunk-RWPAWUOT.js → chunk-PPFGQDSI.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-Q4YY3XNF.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-QK753U3U.js +46 -0
  32. package/dist/cli-bundle/focused-chunks/chunk-QUMB2J27.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/chunk-SM7MTG27.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-GQW4BPUT.js → chunk-WCVE2NIG.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-XDNAW5OI.js +18 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-YIAXMC3T.js → chunk-YOOI3UZX.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-ZM6TZVHC.js +2 -0
  38. package/dist/cli-bundle/main.js +13 -13
  39. package/dist/cli-bundle/sdk-authoring.js +1 -1
  40. package/dist/cli-bundle/sdk-contracts.js +1 -1
  41. package/dist/cli-bundle/sdk-core.js +45 -41
  42. package/dist/cli-bundle/sdk-governance.js +1 -1
  43. package/dist/cli-bundle/sdk-graph.js +1 -1
  44. package/dist/cli-bundle/sdk-merge.js +109 -1
  45. package/dist/cli-bundle/sdk-query.js +1 -1
  46. package/dist/cli-bundle/sdk-runtime.js +1 -1
  47. package/dist/cli-bundle/sdk-testing.js +1 -1
  48. package/dist/cli-bundle/sdk.js +2 -2
  49. package/dist/core/checkpoint/checkpoint-gc.js +7 -12
  50. package/dist/core/extensions/activation-summary-markdown.js +5 -4
  51. package/dist/core/extensions/activation-summary.d.ts +2 -0
  52. package/dist/core/extensions/activation-summary.js +6 -2
  53. package/dist/core/extensions/capability-usage.d.ts +1 -1
  54. package/dist/core/extensions/capability-usage.js +4 -3
  55. package/dist/core/extensions/contribution-inventory.d.ts +1 -0
  56. package/dist/core/extensions/contribution-inventory.js +6 -2
  57. package/dist/core/extensions/extension-registries.js +3 -2
  58. package/dist/core/extensions/extension-types.d.ts +83 -1
  59. package/dist/core/extensions/extension-types.js +3 -2
  60. package/dist/core/extensions/loader.d.ts +2 -8
  61. package/dist/core/extensions/loader.js +53 -144
  62. package/dist/core/extensions/registration-values.d.ts +43 -0
  63. package/dist/core/extensions/registration-values.js +210 -0
  64. package/dist/core/extensions/runtime-registrations.d.ts +3 -1
  65. package/dist/core/extensions/runtime-registrations.js +12 -2
  66. package/dist/core/fs/fs-utils.d.ts +2 -0
  67. package/dist/core/fs/fs-utils.js +7 -3
  68. package/dist/core/history/drift-cache.js +4 -3
  69. package/dist/core/history/drift-scan.d.ts +6 -0
  70. package/dist/core/history/drift-scan.js +76 -58
  71. package/dist/core/history/workspace-history.d.ts +59 -0
  72. package/dist/core/history/workspace-history.js +197 -10
  73. package/dist/core/lock/lock-gc.js +8 -13
  74. package/dist/core/lock/lock.js +5 -4
  75. package/dist/core/output/output.js +12 -4
  76. package/dist/core/search/vector-stores.js +6 -11
  77. package/dist/core/store/item-metadata-cache.js +4 -4
  78. package/dist/core/telemetry/runtime.d.ts +6 -0
  79. package/dist/core/telemetry/runtime.js +101 -30
  80. package/dist/sdk/agent/command-recovery.d.ts +2 -0
  81. package/dist/sdk/agent/command-recovery.js +10 -2
  82. package/dist/sdk/annotations.js +4 -4
  83. package/dist/sdk/cli-contracts/completeness.js +9 -3
  84. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  85. package/dist/sdk/cli-contracts/flag-contracts.js +6 -3
  86. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +6 -1
  87. package/dist/sdk/cli-contracts/runtime-contracts.js +155 -60
  88. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +32 -0
  89. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +25 -2
  90. package/dist/sdk/cli-contracts/tool-parameter-tables.js +35 -5
  91. package/dist/sdk/cli-contracts/tool-schema.js +17 -2
  92. package/dist/sdk/cli-program.js +3 -3
  93. package/dist/sdk/comments.js +4 -3
  94. package/dist/sdk/compile-cache.js +4 -3
  95. package/dist/sdk/compose.d.ts +3 -1
  96. package/dist/sdk/compose.js +16 -2
  97. package/dist/sdk/context-relevance.js +12 -4
  98. package/dist/sdk/context-signal-store.js +4 -3
  99. package/dist/sdk/extension/install-runtime.js +4 -4
  100. package/dist/sdk/extension/managed-state.js +4 -3
  101. package/dist/sdk/extension-contracts.d.ts +1 -1
  102. package/dist/sdk/flag-invocation-contracts.js +5 -6
  103. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +14 -2
  104. package/dist/sdk/governance/assurance-action.d.ts +27 -3
  105. package/dist/sdk/governance/assurance-action.js +112 -28
  106. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  107. package/dist/sdk/governance/assurance-mutation-error.js +25 -2
  108. package/dist/sdk/governance/assurance-presets.d.ts +54 -0
  109. package/dist/sdk/governance/assurance-presets.js +136 -0
  110. package/dist/sdk/governance/assurance-runtime.d.ts +4 -0
  111. package/dist/sdk/governance/assurance-runtime.js +109 -8
  112. package/dist/sdk/governance/assurance.d.ts +39 -0
  113. package/dist/sdk/governance/assurance.js +145 -6
  114. package/dist/sdk/governance/gc.js +5 -11
  115. package/dist/sdk/governance/health.js +18 -6
  116. package/dist/sdk/governance/validate-history-drift.d.ts +7 -0
  117. package/dist/sdk/governance/validate-history-drift.js +68 -0
  118. package/dist/sdk/governance/validate.js +6 -48
  119. package/dist/sdk/graph/assembly.d.ts +23 -0
  120. package/dist/sdk/graph/assembly.js +54 -2
  121. package/dist/sdk/graph/durable-cache.js +91 -3
  122. package/dist/sdk/graph/governance-contracts.d.ts +12 -0
  123. package/dist/sdk/graph/governance-contracts.js +29 -0
  124. package/dist/sdk/graph/governance.d.ts +51 -3
  125. package/dist/sdk/graph/governance.js +216 -35
  126. package/dist/sdk/graph/index.d.ts +2 -2
  127. package/dist/sdk/graph/index.js +4 -4
  128. package/dist/sdk/graph/mutation-advisory.js +15 -7
  129. package/dist/sdk/graph/remediation.js +12 -2
  130. package/dist/sdk/guide.js +4 -4
  131. package/dist/sdk/history-read.d.ts +8 -0
  132. package/dist/sdk/history-read.js +2 -2
  133. package/dist/sdk/index.d.ts +3 -2
  134. package/dist/sdk/index.js +5 -4
  135. package/dist/sdk/linked-artifacts.d.ts +2 -0
  136. package/dist/sdk/linked-artifacts.js +29 -4
  137. package/dist/sdk/merge/install.js +5 -4
  138. package/dist/sdk/query/activity.js +4 -3
  139. package/dist/sdk/query/history.js +20 -3
  140. package/dist/sdk/read-output-budget.d.ts +2 -0
  141. package/dist/sdk/read-output-budget.js +12 -5
  142. package/dist/sdk/read-output-contracts.d.ts +61 -5
  143. package/dist/sdk/read-output-contracts.js +210 -28
  144. package/dist/sdk/read-output-rows.d.ts +11 -0
  145. package/dist/sdk/read-output-rows.js +47 -2
  146. package/dist/sdk/relationship-history.js +5 -5
  147. package/dist/sdk/runtime-primitives.d.ts +1 -1
  148. package/dist/sdk/runtime-primitives.js +3 -3
  149. package/dist/sdk/runtime.js +5 -3
  150. package/dist/sdk/schema-migration.js +4 -4
  151. package/dist/sdk/test/execution.js +4 -4
  152. package/dist/sdk/workspace-memory.js +4 -4
  153. package/dist/sdk/workspace-snapshot.js +8 -14
  154. package/dist/sdk/workspace-transaction-gc.js +4 -9
  155. package/dist/sdk/workspace-transaction.js +4 -4
  156. package/dist/sdk/workspace.js +4 -3
  157. package/docs/ASSURANCE.md +163 -3
  158. package/docs/COMMANDS.md +31 -2
  159. package/docs/CONFIGURATION.md +2 -0
  160. package/docs/EXTENSIONS.md +11 -12
  161. package/docs/READ_OUTPUT_CONTRACTS.md +44 -8
  162. package/docs/RELATIONSHIP_GRAPH.md +34 -4
  163. package/docs/SDK.md +29 -8
  164. package/docs/SDK_CONTEXT_INTEGRITY.md +32 -1
  165. package/docs/TESTING.md +47 -16
  166. package/docs/performance/sdk-entrypoint-import-costs.md +20 -13
  167. package/marketplace.json +2 -2
  168. package/package.json +6 -6
  169. package/packages/pm-beads/extensions/beads/index.ts +1 -0
  170. package/packages/pm-beads/package.json +1 -1
  171. package/packages/pm-calendar/extensions/calendar/index.ts +1 -0
  172. package/packages/pm-calendar/package.json +1 -1
  173. package/packages/pm-command-kit/package.json +1 -1
  174. package/packages/pm-digital-twin/extensions/digital-twin/index.ts +7 -0
  175. package/packages/pm-digital-twin/package.json +1 -1
  176. package/packages/pm-governance-audit/extensions/governance-audit/index.ts +4 -0
  177. package/packages/pm-governance-audit/package.json +1 -1
  178. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +5 -0
  179. package/packages/pm-guide-shell/package.json +1 -1
  180. package/packages/pm-kanban/package.json +1 -1
  181. package/packages/pm-lifecycle-hooks/package.json +1 -1
  182. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/index.ts +6 -0
  183. package/packages/pm-linked-test-adapters/package.json +1 -1
  184. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +2 -0
  185. package/packages/pm-search-advanced/package.json +1 -1
  186. package/packages/pm-templates/extensions/templates/index.ts +4 -0
  187. package/packages/pm-templates/package.json +1 -1
  188. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  189. package/packages/pm-todos/package.json +1 -1
  190. package/packages/pm-vcs/extensions/vcs/index.ts +7 -0
  191. package/packages/pm-vcs/package.json +1 -1
  192. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  193. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  194. package/scripts/bundle-cli.mjs +17 -4
  195. package/sdk/public-surface.json +390 -60
  196. package/dist/cli-bundle/chunks/chunk-3PS7X6GS.js +0 -8
  197. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +0 -13
  198. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +0 -33
  199. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +0 -196
  200. package/dist/cli-bundle/chunks/chunk-R76342NV.js +0 -2
  201. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +0 -5
  202. package/dist/cli-bundle/chunks/chunk-VLUQOIDT.js +0 -2
  203. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +0 -2
  204. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +0 -5
  205. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +0 -155
  206. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +0 -2
  207. package/dist/cli-bundle/focused-chunks/chunk-ECADZMVC.js +0 -18
  208. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +0 -2
  209. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +0 -16
  210. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +0 -2
  211. package/dist/cli-bundle/focused-chunks/chunk-KPSXVBDV.js +0 -2
  212. package/dist/cli-bundle/focused-chunks/chunk-KTLOKKCQ.js +0 -2
  213. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +0 -8
  214. package/dist/cli-bundle/focused-chunks/chunk-NBLUKITQ.js +0 -4
  215. package/dist/cli-bundle/focused-chunks/chunk-NYLOUPOB.js +0 -2
  216. package/dist/cli-bundle/focused-chunks/chunk-Q4T463SD.js +0 -31
  217. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +0 -2
  218. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +0 -17
@@ -1,5 +1,5 @@
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]="142a413a-35a6-5861-9063-0c196a176eaa")}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]="fb438c6a-1927-54c3-98dd-dd7423df6722")}catch(e){}}();
3
3
  import { normalizeKnownExtensionCapability, resolveLegacyExtensionCapabilityAlias, } from "../core/extensions/extension-capability-aliases.js";
4
4
  import { normalizeCommandName } from "../core/extensions/extension-runtime-helpers.js";
5
5
  import { RESERVED_ITEM_FIELD_NAMES } from "../core/extensions/item-fields.js";
@@ -100,6 +100,9 @@ function registerBlueprintRetrievalSurfaces(api, blueprint) {
100
100
  for (const adapter of blueprint.vectorStoreAdapters ?? []) {
101
101
  api.registerVectorStoreAdapter(adapter);
102
102
  }
103
+ for (const provider of blueprint.assuranceProviders ?? []) {
104
+ api.registerAssuranceMeasurementProvider(provider);
105
+ }
103
106
  for (const entry of blueprint.importers ?? []) {
104
107
  api.registerImporter(entry.name, entry.importer, entry.options);
105
108
  }
@@ -281,6 +284,7 @@ export function mergeExtensionBlueprints(...blueprints) {
281
284
  assign("profiles", mergeArraySurface(blueprints.map((blueprint) => blueprint.profiles)));
282
285
  assign("searchProviders", mergeArraySurface(blueprints.map((blueprint) => blueprint.searchProviders)));
283
286
  assign("vectorStoreAdapters", mergeArraySurface(blueprints.map((blueprint) => blueprint.vectorStoreAdapters)));
287
+ assign("assuranceProviders", mergeArraySurface(blueprints.map((blueprint) => blueprint.assuranceProviders)));
284
288
  assign("importers", mergeArraySurface(blueprints.map((blueprint) => blueprint.importers)));
285
289
  assign("exporters", mergeArraySurface(blueprints.map((blueprint) => blueprint.exporters)));
286
290
  assign("hooks", mergeHookSurfaces(blueprints.map((blueprint) => blueprint.hooks)));
@@ -357,6 +361,7 @@ const BLUEPRINT_FIELD_CAPABILITIES = [
357
361
  ["preflights", "preflight"],
358
362
  ["searchProviders", "search"],
359
363
  ["vectorStoreAdapters", "search"],
364
+ ["assuranceProviders", "services"],
360
365
  ["importers", "importers"],
361
366
  ["exporters", "importers"],
362
367
  ];
@@ -509,6 +514,13 @@ function collectBlueprintRendererOwnership(renderers) {
509
514
  .sort((left, right) => left.format.localeCompare(right.format));
510
515
  return ownership.length > 0 ? { renderer_ownership: ownership } : {};
511
516
  }
517
+ function collectBlueprintAssuranceProviders(providers) {
518
+ if (!providers || providers.length === 0)
519
+ return {};
520
+ return {
521
+ assurance_providers: sortUnique(providers.map((provider) => provider.id)),
522
+ };
523
+ }
512
524
  function collectBlueprintSurfaceSummary(blueprint, importers, exporters) {
513
525
  return {
514
526
  item_types: sortUnique((blueprint.itemTypes ?? []).map((type) => type.name)),
@@ -526,6 +538,7 @@ function collectBlueprintSurfaceSummary(blueprint, importers, exporters) {
526
538
  exporters: sortUnique(exporters.map((entry) => normalizeCommandName(entry.name))),
527
539
  search_providers: sortUnique((blueprint.searchProviders ?? []).map((provider) => provider.name)),
528
540
  vector_store_adapters: sortUnique((blueprint.vectorStoreAdapters ?? []).map((adapter) => adapter.name)),
541
+ ...collectBlueprintAssuranceProviders(blueprint.assuranceProviders),
529
542
  parser_overrides: sortUnique(Object.keys(blueprint.parsers ?? {}).map((command) => normalizeCommandName(command))),
530
543
  service_overrides: sortUnique(Object.keys(blueprint.services ?? {}).map((service) => String(service).trim().toLowerCase())),
531
544
  renderer_overrides: sortUnique(Object.keys(blueprint.renderers ?? {}).map((format) => String(format).trim().toLowerCase())),
@@ -612,6 +625,7 @@ const BLUEPRINT_LINTABLE_SURFACE_FIELDS = [
612
625
  "profiles",
613
626
  "searchProviders",
614
627
  "vectorStoreAdapters",
628
+ "assuranceProviders",
615
629
  "importers",
616
630
  "exporters",
617
631
  ];
@@ -1057,4 +1071,4 @@ export function preflightExtension(blueprint, options = {}) {
1057
1071
  };
1058
1072
  }
1059
1073
  //# sourceMappingURL=compose.js.map
1060
- //# debugId=142a413a-35a6-5861-9063-0c196a176eaa
1074
+ //# debugId=fb438c6a-1927-54c3-98dd-dd7423df6722
@@ -6,7 +6,7 @@
6
6
  * with core, extension, or project-specific feature stores.
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]="1f898377-b606-5bfd-932d-6ce5f2f9c717")}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]="7eefe5f0-364d-559a-b365-0e7d539ee19e")}catch(e){}}();
10
10
  import { runActiveServiceOverride } from "../core/extensions/index.js";
11
11
  import { normalizeStatusForRegistry, normalizeStatusInput, } from "../core/item/status.js";
12
12
  import { compareTimestampStrings, resolveIsoOrRelative } from "../core/shared/time.js";
@@ -364,8 +364,16 @@ export async function runContextEvaluationScenario(scenario, reader) {
364
364
  throw new TypeError("Context evaluation scenarios require non-empty id and rationale values");
365
365
  }
366
366
  const result = scenario.surface === "context"
367
- ? await reader.context({ ...scenario.options, explainRanking: true })
368
- : await reader.next({ ...scenario.options, explainRanking: true });
367
+ ? await reader.context({
368
+ ...scenario.options,
369
+ explainRanking: true,
370
+ outputBudget: "unbounded",
371
+ })
372
+ : await reader.next({
373
+ ...scenario.options,
374
+ explainRanking: true,
375
+ outputBudget: "unbounded",
376
+ });
369
377
  const { rankedIds, attribution } = rankingPayloadForScenario(result, scenario.surface);
370
378
  const packet = { ...result, ranking: undefined };
371
379
  const actualTokens = estimateJsonTokens(packet);
@@ -422,4 +430,4 @@ export async function runContextEvaluationCorpus(scenarios, reader, thresholds)
422
430
  return summarizeContextEvaluationReports(reports, thresholds);
423
431
  }
424
432
  //# sourceMappingURL=context-relevance.js.map
425
- //# debugId=1f898377-b606-5bfd-932d-6ce5f2f9c717
433
+ //# debugId=7eefe5f0-364d-559a-b365-0e7d539ee19e
@@ -6,7 +6,8 @@
6
6
  * history, while stale, absent, or corrupt snapshots rebuild transparently.
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]="2a0f64cf-f6a4-5304-921d-c83b98d3a31f")}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]="3d0a558b-6a01-5bca-a2f7-21766be6d67c")}catch(e){}}();
10
+ import { isFileAbsentError } from "../core/fs/fs-utils.js";
10
11
  import fs from "node:fs/promises";
11
12
  import path from "node:path";
12
13
  import { createHash, randomUUID } from "node:crypto";
@@ -187,7 +188,7 @@ export class JsonFileContextSignalStoreAdapter {
187
188
  return JSON.parse(await fs.readFile(this.filePath, "utf8"));
188
189
  }
189
190
  catch (error) {
190
- if (isRecord(error) && error.code === "ENOENT") {
191
+ if (isRecord(error) && isFileAbsentError(error)) {
191
192
  return null;
192
193
  }
193
194
  throw error;
@@ -310,4 +311,4 @@ export async function readWorkspaceContextSignals(items, options) {
310
311
  return store.readOrRebuild(items, { ...options, sourceCursor, source });
311
312
  }
312
313
  //# sourceMappingURL=context-signal-store.js.map
313
- //# debugId=2a0f64cf-f6a4-5304-921d-c83b98d3a31f
314
+ //# debugId=3d0a558b-6a01-5bca-a2f7-21766be6d67c
@@ -4,12 +4,12 @@
4
4
  * Provides cross-platform extension copy safety and owner-bound install locks.
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]="9c598dc3-e766-595d-80f1-6d55e1667d6b")}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]="263602a2-c000-5df7-80d2-6f095985496f")}catch(e){}}();
8
8
  import { randomUUID } from "node:crypto";
9
9
  import fs from "node:fs/promises";
10
10
  import os from "node:os";
11
11
  import path from "node:path";
12
- import { pathExists } from "../../core/fs/fs-utils.js";
12
+ import { isFileAbsentError, pathExists } from "../../core/fs/fs-utils.js";
13
13
  import { isPathWithinDirectory } from "../../core/fs/path-utils.js";
14
14
  import { EXIT_CODE } from "../../core/shared/constants.js";
15
15
  import { PmCliError } from "../../core/shared/errors.js";
@@ -173,7 +173,7 @@ const readExtensionInstallLockOwnerToken = async (lockPath) => {
173
173
  ownerContents = await fs.readFile(path.join(lockPath, "owner.json"), "utf8");
174
174
  }
175
175
  catch (error) {
176
- if (!isErrnoCode(error, "ENOENT"))
176
+ if (!isFileAbsentError(error))
177
177
  throw error;
178
178
  return null;
179
179
  }
@@ -308,4 +308,4 @@ export const withExtensionInstallLock = async (settingsRoot, destinationDirector
308
308
  }
309
309
  };
310
310
  //# sourceMappingURL=install-runtime.js.map
311
- //# debugId=9c598dc3-e766-595d-80f1-6d55e1667d6b
311
+ //# debugId=263602a2-c000-5df7-80d2-6f095985496f
@@ -4,7 +4,8 @@
4
4
  * Implements extension package-management support for Managed State.
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]="5d60cd29-09fb-515c-acaa-b5a2b136d8ab")}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]="159d7bbd-1d2a-503d-b3ce-f32dcc6f6547")}catch(e){}}();
8
+ import { isFileMissingError } from "../../core/fs/fs-utils.js";
8
9
  import fs from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { EXIT_CODE } from "../../core/shared/constants.js";
@@ -204,7 +205,7 @@ export async function readManagedExtensionState(extensionsRoot) {
204
205
  if (typeof error === "object" &&
205
206
  error !== null &&
206
207
  "code" in error &&
207
- error.code === "ENOENT") {
208
+ isFileMissingError(error)) {
208
209
  return {
209
210
  path: statePath,
210
211
  state: fallback,
@@ -249,4 +250,4 @@ export async function persistManagedContributionInventory(extensionsRoot, state,
249
250
  return updated;
250
251
  }
251
252
  //# sourceMappingURL=managed-state.js.map
252
- //# debugId=5d60cd29-09fb-515c-acaa-b5a2b136d8ab
253
+ //# debugId=159d7bbd-1d2a-503d-b3ce-f32dcc6f6547
@@ -19,7 +19,7 @@ export type ExtensionCapability = (typeof EXTENSION_CAPABILITIES)[number];
19
19
  /** Canonical extension governance policy modes. */
20
20
  export declare const EXTENSION_POLICY_MODES: readonly ["off", "warn", "enforce"];
21
21
  /** Canonical extension registration surfaces governed by policy. */
22
- export declare const EXTENSION_POLICY_SURFACES: readonly ["commands.override", "commands.handler", "hooks.beforecommand", "hooks.beforemutation", "hooks.aftercommand", "hooks.onwrite", "hooks.onread", "hooks.onindex", "schema.flags", "schema.itemfields", "schema.itemtypes", "schema.relationshipkinds", "schema.migrations", "schema.profiles", "parser.override", "preflight.override", "services.override", "renderers.override", "importers.importer", "importers.exporter", "search.provider", "search.vectorstore"];
22
+ export declare const EXTENSION_POLICY_SURFACES: readonly ["commands.override", "commands.handler", "hooks.beforecommand", "hooks.beforemutation", "hooks.aftercommand", "hooks.onwrite", "hooks.onread", "hooks.onindex", "schema.flags", "schema.itemfields", "schema.itemtypes", "schema.relationshipkinds", "schema.migrations", "schema.profiles", "parser.override", "preflight.override", "services.override", "renderers.override", "importers.importer", "importers.exporter", "search.provider", "search.vectorstore", "services.assuranceprovider"];
23
23
  /** Canonical extension trust modes shared by authoring and runtime consumers. */
24
24
  export declare const EXTENSION_TRUST_MODES: readonly ["off", "warn", "enforce"];
25
25
  /** Canonical extension sandbox profiles shared by authoring and runtime consumers. */
@@ -1,5 +1,5 @@
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]="3b72f4a5-9e0b-5f8e-8ee9-e45cd83d6f92")}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]="0e2d29be-ff70-5e69-9bba-bef5ecd05fa1")}catch(e){}}();
3
3
  const FLAG_DESCRIPTIONS = Object.freeze({
4
4
  "--body": "Set the item body.",
5
5
  "--body-file": "Read the item body from a file.",
@@ -71,7 +71,8 @@ function flagTakesValue(contract) {
71
71
  contract.value_type === "number" ||
72
72
  contract.list === true ||
73
73
  contract.repeatable === true;
74
- const inferredBoolean = contract.flag === "--stdin" ||
74
+ const inferredBoolean = contract.value_type === "boolean" ||
75
+ contract.flag === "--stdin" ||
75
76
  contract.flag === "--stdin-json" ||
76
77
  BOOLEAN_FLAG_PREFIXES.some((prefix) => contract.flag.startsWith(prefix));
77
78
  return explicitlyValued || !inferredBoolean;
@@ -88,9 +89,7 @@ export function enrichCliFlagInvocationContract(command, contract) {
88
89
  description,
89
90
  takes_value: takesValue,
90
91
  value_required: takesValue,
91
- ...(takesValue
92
- ? { value_name: contract.value_name ?? "value" }
93
- : {}),
92
+ ...(takesValue ? { value_name: contract.value_name ?? "value" } : {}),
94
93
  value_type: takesValue ? (contract.value_type ?? "string") : "boolean",
95
94
  required: contract.required === true,
96
95
  repeatable: contract.repeatable === true || contract.list === true,
@@ -107,4 +106,4 @@ export function enrichCliFlagInvocationContracts(command, contracts) {
107
106
  return contracts.map((contract) => enrichCliFlagInvocationContract(command, contract));
108
107
  }
109
108
  //# sourceMappingURL=flag-invocation-contracts.js.map
110
- //# debugId=3b72f4a5-9e0b-5f8e-8ee9-e45cd83d6f92
109
+ //# debugId=0e2d29be-ff70-5e69-9bba-bef5ecd05fa1
@@ -1,6 +1,6 @@
1
1
  /** Generated partition 1 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]="1822a3b2-8164-56f7-96e3-d4c657f95fa6")}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]="92b7b390-4d50-5210-8209-9ade302498c2")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_1 = [
5
5
  {
6
6
  code: "acceptance_criteria_mutation_conflict",
@@ -1460,6 +1460,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1460
1460
  canonical_code: "likely_duplicate",
1461
1461
  aliases: [],
1462
1462
  },
1463
+ {
1464
+ code: "linked_artifact_mutation_conflict",
1465
+ meaning: "Linked artifact mutation conflict condition.",
1466
+ stability: "provisional",
1467
+ exit_code: 2,
1468
+ class: "usage",
1469
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1470
+ sources: ["sdk/linked-artifacts.ts"],
1471
+ emitting_commands: ["*"],
1472
+ canonical_code: "linked_artifact_mutation_conflict",
1473
+ aliases: [],
1474
+ },
1463
1475
  {
1464
1476
  code: "linked_test_remove_no_match",
1465
1477
  meaning: "Linked test remove no match condition.",
@@ -1582,4 +1594,4 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1582
1594
  },
1583
1595
  ];
1584
1596
  //# sourceMappingURL=generated-error-code-catalog-part-1.js.map
1585
- //# debugId=1822a3b2-8164-56f7-96e3-d4c657f95fa6
1597
+ //# debugId=92b7b390-4d50-5210-8209-9ade302498c2
@@ -4,9 +4,10 @@
4
4
  * Normalizes the assurance action vocabulary once for CLI, SDK, and MCP hosts.
5
5
  */
6
6
  import type { GlobalOptions } from "../../core/shared/command-types.js";
7
- import { type AssuranceDeclaration, type AssuranceGateVerdict, type AssuranceMutationReceipt } from "./assurance.js";
7
+ import { type AssuranceBundleMutationReceipt, type AssuranceDeclaration, type AssuranceGateVerdict, type AssuranceMutationReceipt } from "./assurance.js";
8
+ import { type AssuranceDerivedProposal, type AssurancePreset, type AssurancePresetId } from "./assurance-presets.js";
8
9
  /** Assurance registry and evaluation verbs shared by every transport. */
9
- export declare const ASSURANCE_ACTIONS: readonly ["list", "show", "put", "remove", "run", "verdicts"];
10
+ export declare const ASSURANCE_ACTIONS: readonly ["list", "show", "put", "remove", "run", "verdicts", "presets", "apply", "derive", "promote"];
10
11
  /** Assurance declaration kinds shared by every transport. */
11
12
  export declare const ASSURANCE_DECLARATION_KINDS: readonly ["measurement", "assertion", "gate"];
12
13
  /** Assurance action verb. */
@@ -39,9 +40,32 @@ export interface AssuranceActionInput {
39
40
  author?: string;
40
41
  /** Audited mutation rationale. */
41
42
  message?: string;
43
+ /** Built-in preset selected for preview or application. */
44
+ preset?: string;
45
+ /** pm item that owns preset or derived assertions. */
46
+ owner?: string;
47
+ /** Explicitly accept derived proposals. */
48
+ apply?: boolean;
49
+ /** Explicit next assertion enforcement level. */
50
+ enforcement?: string;
42
51
  }
43
52
  /** Result union returned by transport-neutral assurance execution. */
44
- export type AssuranceActionResult = AssuranceDeclaration | AssuranceMutationReceipt | AssuranceGateVerdict | {
53
+ export type AssuranceActionResult = AssuranceDeclaration | AssuranceMutationReceipt | AssuranceGateVerdict | AssuranceBundleMutationReceipt | AssurancePreset | {
54
+ items: AssuranceDerivedProposal[];
55
+ count: number;
56
+ applied?: AssuranceBundleMutationReceipt;
57
+ } | {
58
+ items: Array<{
59
+ id: AssurancePresetId;
60
+ title: string;
61
+ description: string;
62
+ }>;
63
+ count: number;
64
+ row_contract: {
65
+ row_keys: ["items"];
66
+ jq_selector: ".items[]";
67
+ };
68
+ } | {
45
69
  id: string;
46
70
  } | {
47
71
  /** Registry declarations. */
@@ -1,10 +1,11 @@
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]="d7b8bd03-cd67-5f3f-9ac9-74808a03c2c7")}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]="36dfa230-06bd-5902-a0c9-94a7c34cda90")}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
+ import { ASSURANCE_PRESET_IDS, acceptAssuranceProposals, applyAssurancePreset, createAssurancePreset, deriveAssuranceProposals, promoteAssuranceAssertion, } from "./assurance-presets.js";
6
7
  import { MAX_ASSURANCE_VERDICT_LIMIT } from "./assurance-limits.js";
7
- import { normalizeAssuranceMutation } from "./assurance-mutation-error.js";
8
+ import { normalizeAssuranceEvaluation, normalizeAssuranceMutation, } from "./assurance-mutation-error.js";
8
9
  import { createAssuranceWorkspaceContext } from "./assurance-runtime.js";
9
10
  import { resolvePmRoot } from "../runtime-primitives.js";
10
11
  import { parseRuntimeInteger, readRuntimeString } from "../runtime-input.js";
@@ -16,6 +17,10 @@ export const ASSURANCE_ACTIONS = [
16
17
  "remove",
17
18
  "run",
18
19
  "verdicts",
20
+ "presets",
21
+ "apply",
22
+ "derive",
23
+ "promote",
19
24
  ];
20
25
  /** Assurance declaration kinds shared by every transport. */
21
26
  export const ASSURANCE_DECLARATION_KINDS = [
@@ -36,6 +41,17 @@ function parseKind(value) {
36
41
  }
37
42
  throw new PmCliError(`Assurance declaration kind is required. Expected: ${ASSURANCE_DECLARATION_KINDS.join(", ")}`, EXIT_CODE.USAGE);
38
43
  }
44
+ function parsePreset(value) {
45
+ if (value && ASSURANCE_PRESET_IDS.includes(value)) {
46
+ return value;
47
+ }
48
+ throw new PmCliError(`Assurance preset is required. Expected: ${ASSURANCE_PRESET_IDS.join(", ")}`, EXIT_CODE.USAGE);
49
+ }
50
+ function requireOwner(input) {
51
+ if (input.owner?.trim())
52
+ return input.owner.trim();
53
+ throw new PmCliError("assurance preset and derivation actions require --owner <pm-item-id>", EXIT_CODE.USAGE);
54
+ }
39
55
  function parseDefinition(kind, value) {
40
56
  let parsed = value;
41
57
  if (typeof value === "string") {
@@ -110,38 +126,99 @@ async function runVerdictsAction(input, pmRoot) {
110
126
  row_contract: { row_keys: ["items"], jq_selector: ".items[]" },
111
127
  };
112
128
  }
129
+ async function runAdoptionAction(action, input, pmRoot) {
130
+ if (action === "presets") {
131
+ if (input.preset ?? input.id) {
132
+ return createAssurancePreset(parsePreset(input.preset ?? input.id), requireOwner(input));
133
+ }
134
+ const items = ASSURANCE_PRESET_IDS.map((id) => {
135
+ const preset = createAssurancePreset(id, "pm-owner");
136
+ return { id, title: preset.title, description: preset.description };
137
+ });
138
+ return {
139
+ items,
140
+ count: items.length,
141
+ row_contract: { row_keys: ["items"], jq_selector: ".items[]" },
142
+ };
143
+ }
144
+ if (action === "apply") {
145
+ return normalizeAssuranceMutation(() => applyAssurancePreset(pmRoot, parsePreset(input.preset ?? input.id), requireOwner(input), { author: input.author, message: input.message }));
146
+ }
147
+ if (action === "derive") {
148
+ const proposals = await deriveAssuranceProposals(await createAssuranceWorkspaceContext(pmRoot, {
149
+ resolve_tree: false,
150
+ trigger: "derive",
151
+ }), requireOwner(input));
152
+ const applied = input.apply
153
+ ? await normalizeAssuranceMutation(() => acceptAssuranceProposals(pmRoot, proposals, {
154
+ author: input.author,
155
+ message: input.message ?? "Accept observation-derived assurance proposals",
156
+ }))
157
+ : undefined;
158
+ return {
159
+ items: proposals,
160
+ count: proposals.length,
161
+ ...(applied ? { applied } : {}),
162
+ };
163
+ }
164
+ if (!input.id) {
165
+ throw new PmCliError("assurance promote requires an assertion id", EXIT_CODE.USAGE);
166
+ }
167
+ if (input.enforcement !== "warn" && input.enforcement !== "block") {
168
+ throw new PmCliError("assurance promote requires --enforcement warn|block", EXIT_CODE.USAGE);
169
+ }
170
+ const definition = (await getAssuranceDeclaration(pmRoot, "assertion", input.id));
171
+ return normalizeAssuranceMutation(() => promoteAssuranceAssertion(pmRoot, definition, input.enforcement, {
172
+ author: input.author,
173
+ message: input.message,
174
+ }));
175
+ }
176
+ async function runGateAction(input, pmRoot) {
177
+ if (!input.id) {
178
+ throw new PmCliError("assurance run requires a gate id", EXIT_CODE.USAGE);
179
+ }
180
+ const gateId = input.id;
181
+ if (!input.trigger) {
182
+ throw new PmCliError("assurance run requires a trigger", EXIT_CODE.USAGE);
183
+ }
184
+ if (!ASSURANCE_GATE_TRIGGERS.includes(input.trigger)) {
185
+ throw new PmCliError(`Unknown assurance trigger ${input.trigger}. Expected: ${ASSURANCE_GATE_TRIGGERS.join(", ")}`, EXIT_CODE.USAGE);
186
+ }
187
+ const trigger = input.trigger;
188
+ const [document, workspaceContext] = await Promise.all([
189
+ readDocument(pmRoot),
190
+ createAssuranceWorkspaceContext(pmRoot, {
191
+ tree_id: input.tree,
192
+ trigger,
193
+ }),
194
+ ]);
195
+ const verdict = await normalizeAssuranceEvaluation(() => evaluateAssuranceGate(gateId, document, workspaceContext, {
196
+ trigger,
197
+ dry_run: input.dry_run === true,
198
+ }));
199
+ if (!verdict.dry_run) {
200
+ await recordAssuranceVerdict(pmRoot, verdict, {
201
+ author: input.author,
202
+ message: input.message,
203
+ });
204
+ }
205
+ return verdict;
206
+ }
113
207
  /** Execute one assurance request through the public assurance SDK primitives. */
114
208
  export async function runAssuranceAction(input, global = {}) {
115
209
  const action = parseAction(input.action);
116
210
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
211
+ if (action === "presets" ||
212
+ action === "apply" ||
213
+ action === "derive" ||
214
+ action === "promote") {
215
+ return runAdoptionAction(action, input, pmRoot);
216
+ }
117
217
  if (action === "verdicts") {
118
218
  return runVerdictsAction(input, pmRoot);
119
219
  }
120
220
  if (action === "run") {
121
- if (!input.id) {
122
- throw new PmCliError("assurance run requires a gate id", EXIT_CODE.USAGE);
123
- }
124
- if (!input.trigger) {
125
- throw new PmCliError("assurance run requires a trigger", EXIT_CODE.USAGE);
126
- }
127
- if (!ASSURANCE_GATE_TRIGGERS.includes(input.trigger)) {
128
- throw new PmCliError(`Unknown assurance trigger ${input.trigger}. Expected: ${ASSURANCE_GATE_TRIGGERS.join(", ")}`, EXIT_CODE.USAGE);
129
- }
130
- const [document, workspaceContext] = await Promise.all([
131
- readDocument(pmRoot),
132
- createAssuranceWorkspaceContext(pmRoot, { tree_id: input.tree }),
133
- ]);
134
- const verdict = await evaluateAssuranceGate(input.id, document, workspaceContext, {
135
- trigger: input.trigger,
136
- dry_run: input.dry_run === true,
137
- });
138
- if (!verdict.dry_run) {
139
- await recordAssuranceVerdict(pmRoot, verdict, {
140
- author: input.author,
141
- message: input.message,
142
- });
143
- }
144
- return verdict;
221
+ return runGateAction(input, pmRoot);
145
222
  }
146
223
  const kind = parseKind(input.kind);
147
224
  if (action === "list")
@@ -154,7 +231,10 @@ export async function runAssuranceAction(input, global = {}) {
154
231
  return getAssuranceDeclaration(pmRoot, kind, id);
155
232
  }
156
233
  if (action === "remove") {
157
- const receipt = await normalizeAssuranceMutation(() => removeAssuranceDeclaration(pmRoot, kind, id, { author: input.author, message: input.message }));
234
+ const receipt = await normalizeAssuranceMutation(() => removeAssuranceDeclaration(pmRoot, kind, id, {
235
+ author: input.author,
236
+ message: input.message,
237
+ }));
158
238
  return projectMutationReceipt(receipt, input.idOnly);
159
239
  }
160
240
  const definition = parseDefinition(kind, input.definition);
@@ -194,7 +274,11 @@ export function runAssuranceDispatch(args, options, global) {
194
274
  idOnly: merged.idOnly === true,
195
275
  author: readRuntimeString(merged, "author"),
196
276
  message: readRuntimeString(merged, "message"),
277
+ preset: readRuntimeString(merged, "preset"),
278
+ owner: readRuntimeString(merged, "owner"),
279
+ apply: merged.apply === true,
280
+ enforcement: readRuntimeString(merged, "enforcement"),
197
281
  }, global);
198
282
  }
199
283
  //# sourceMappingURL=assurance-action.js.map
200
- //# debugId=d7b8bd03-cd67-5f3f-9ac9-74808a03c2c7
284
+ //# debugId=36dfa230-06bd-5902-a0c9-94a7c34cda90
@@ -3,5 +3,12 @@ export declare class AssuranceMutationRefusalError extends TypeError {
3
3
  /** Create one typed refusal while retaining TypeError compatibility for SDK callers. */
4
4
  constructor(message: string);
5
5
  }
6
+ /** Expected gate-policy refusal caused by an incomplete or disallowed provider contract. */
7
+ export declare class AssuranceEvaluationRefusalError extends TypeError {
8
+ /** Create one typed refusal while retaining TypeError compatibility for SDK callers. */
9
+ constructor(message: string);
10
+ }
6
11
  /** Normalize only expected assurance mutation refusals for CLI and MCP hosts. */
7
12
  export declare function normalizeAssuranceMutation<T>(operation: () => Promise<T>): Promise<T>;
13
+ /** Normalize only expected assurance evaluation-policy refusals for transport hosts. */
14
+ export declare function normalizeAssuranceEvaluation<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]="255eee6e-f6bb-5fd2-8a73-545e672d205d")}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]="93a32771-bf95-5df4-8019-b6be45a5051b")}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. */
@@ -16,6 +16,14 @@ export class AssuranceMutationRefusalError extends TypeError {
16
16
  this.name = "AssuranceMutationRefusalError";
17
17
  }
18
18
  }
19
+ /** Expected gate-policy refusal caused by an incomplete or disallowed provider contract. */
20
+ export class AssuranceEvaluationRefusalError extends TypeError {
21
+ /** Create one typed refusal while retaining TypeError compatibility for SDK callers. */
22
+ constructor(message) {
23
+ super(message);
24
+ this.name = "AssuranceEvaluationRefusalError";
25
+ }
26
+ }
19
27
  /** Normalize only expected assurance mutation refusals for CLI and MCP hosts. */
20
28
  export async function normalizeAssuranceMutation(operation) {
21
29
  try {
@@ -31,5 +39,20 @@ export async function normalizeAssuranceMutation(operation) {
31
39
  throw error;
32
40
  }
33
41
  }
42
+ /** Normalize only expected assurance evaluation-policy refusals for transport hosts. */
43
+ export async function normalizeAssuranceEvaluation(operation) {
44
+ try {
45
+ return await operation();
46
+ }
47
+ catch (error) {
48
+ if (error instanceof AssuranceEvaluationRefusalError) {
49
+ throw new PmCliError(error.message, EXIT_CODE.USAGE, {
50
+ code: "invalid_argument_value",
51
+ reason: "assurance_evaluation_refused",
52
+ });
53
+ }
54
+ throw error;
55
+ }
56
+ }
34
57
  //# sourceMappingURL=assurance-mutation-error.js.map
35
- //# debugId=255eee6e-f6bb-5fd2-8a73-545e672d205d
58
+ //# debugId=93a32771-bf95-5df4-8019-b6be45a5051b
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @module sdk/governance/assurance-presets
3
+ *
4
+ * Supplies readable assurance starter bundles and observation-derived proposals
5
+ * without introducing privileged evaluation semantics.
6
+ */
7
+ import { putAssuranceDeclaration, type AssuranceAssertionDefinition, type AssuranceBundleMutationReceipt, type AssuranceDeclarationBundle, type AssuranceEnforcement, type AssuranceEvaluationContext, type AssuranceScope } from "./assurance.js";
8
+ /** Built-in project shapes that can acquire a quality contract in one command. */
9
+ export declare const ASSURANCE_PRESET_IDS: readonly ["software-delivery", "research", "agent-evaluation", "operations"];
10
+ /** Stable built-in assurance preset id. */
11
+ export type AssurancePresetId = (typeof ASSURANCE_PRESET_IDS)[number];
12
+ /** Readable preset bundle before or after application. */
13
+ export interface AssurancePreset {
14
+ /** Stable preset id. */
15
+ id: AssurancePresetId;
16
+ /** Human-readable project shape. */
17
+ title: string;
18
+ /** Why the initial contract is useful. */
19
+ description: string;
20
+ /** Ordinary declarations that become editable workspace data. */
21
+ declarations: AssuranceDeclarationBundle;
22
+ }
23
+ /** One observe-level candidate produced from authoritative workspace state. */
24
+ export interface AssuranceDerivedProposal {
25
+ /** Stable proposal id. */
26
+ id: string;
27
+ /** Population used to calculate the proposed threshold. */
28
+ population_size: number;
29
+ /** Scope applied while measuring. */
30
+ scope: AssuranceScope;
31
+ /** Observed value proposed as the initial ceiling. */
32
+ observed: number;
33
+ /** Ordinary declarations created only after explicit acceptance. */
34
+ declarations: AssuranceDeclarationBundle;
35
+ }
36
+ /** Materialize one built-in preset as ordinary declarations owned by a pm item. */
37
+ export declare function createAssurancePreset(id: AssurancePresetId, ownerItemId: string): AssurancePreset;
38
+ /** Apply one preset atomically; a second identical application is idempotent. */
39
+ export declare function applyAssurancePreset(pmRoot: string, id: AssurancePresetId, ownerItemId: string, options?: {
40
+ author?: string;
41
+ message?: string;
42
+ }): Promise<AssuranceBundleMutationReceipt>;
43
+ /** Propose active-scope evidence ceilings from the record without persisting them. */
44
+ export declare function deriveAssuranceProposals(context: AssuranceEvaluationContext, ownerItemId: string): Promise<AssuranceDerivedProposal[]>;
45
+ /** Accept all derived proposals in one audited registry transaction. */
46
+ export declare function acceptAssuranceProposals(pmRoot: string, proposals: readonly AssuranceDerivedProposal[], options?: {
47
+ author?: string;
48
+ message?: string;
49
+ }): Promise<AssuranceBundleMutationReceipt>;
50
+ /** Promote one assertion by exactly one enforcement level and audit the transition. */
51
+ export declare function promoteAssuranceAssertion(pmRoot: string, definition: AssuranceAssertionDefinition, enforcement: Exclude<AssuranceEnforcement, "observe">, options?: {
52
+ author?: string;
53
+ message?: string;
54
+ }): Promise<Awaited<ReturnType<typeof putAssuranceDeclaration>>>;