@unbrained/pm-cli 2026.8.11 → 2026.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +52 -21
  3. package/dist/cli/commander-usage.js +37 -11
  4. package/dist/cli/error-guidance.d.ts +2 -0
  5. package/dist/cli/error-guidance.js +80 -13
  6. package/dist/cli/main.js +34 -19
  7. package/dist/cli/register-annotations.js +56 -3
  8. package/dist/cli/register-list-query.js +10 -7
  9. package/dist/cli/register-operations.js +16 -6
  10. package/dist/cli-bundle/bundle-manifest.json +157 -157
  11. package/dist/cli-bundle/chunks/{chunk-2OOU2AFH.js → chunk-3PS7X6GS.js} +2 -2
  12. package/dist/cli-bundle/chunks/chunk-7KL6KMWF.js +13 -0
  13. package/dist/cli-bundle/chunks/{chunk-WMEZHCFI.js → chunk-BM5YJ2UW.js} +51 -43
  14. package/dist/cli-bundle/chunks/chunk-D55A5AEN.js +33 -0
  15. package/dist/cli-bundle/chunks/chunk-KIKDWECH.js +196 -0
  16. package/dist/cli-bundle/chunks/{chunk-ZU34C3LH.js → chunk-KOQMGCTA.js} +2 -2
  17. package/dist/cli-bundle/chunks/chunk-R76342NV.js +2 -0
  18. package/dist/cli-bundle/chunks/chunk-RBTK5EZV.js +5 -0
  19. package/dist/cli-bundle/chunks/{chunk-IUNRVDAI.js → chunk-VLUQOIDT.js} +2 -2
  20. package/dist/cli-bundle/chunks/{chunk-A2SJGHSI.js → chunk-WLAHPSOX.js} +2 -2
  21. package/dist/cli-bundle/chunks/register-list-query-XPCJRUUD.js +10 -0
  22. package/dist/cli-bundle/chunks/register-mutation-4RJCBKRS.js +20 -0
  23. package/dist/cli-bundle/chunks/register-operations-2OGISOVR.js +2 -0
  24. package/dist/cli-bundle/chunks/{register-setup-NOCOOWQY.js → register-setup-LLHAKP2V.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/chunk-2DALMVF7.js +5 -0
  26. package/dist/cli-bundle/focused-chunks/chunk-5OQIMELN.js +155 -0
  27. package/dist/cli-bundle/focused-chunks/chunk-5TAGTDRE.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-FPSYO5ZG.js → chunk-ECADZMVC.js} +11 -11
  29. package/dist/cli-bundle/focused-chunks/chunk-EJGXRA6B.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-FFGSZCPK.js +16 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-BKPIY34S.js → chunk-GQW4BPUT.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/chunk-ISKOBJCM.js +2 -0
  33. package/dist/cli-bundle/focused-chunks/{chunk-UDAZWT25.js → chunk-JAFRIWVF.js} +2 -2
  34. package/dist/cli-bundle/focused-chunks/{chunk-2DL3MRTD.js → chunk-KHM2CS2C.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/{chunk-J5EKAIVD.js → chunk-KPSXVBDV.js} +2 -2
  36. package/dist/cli-bundle/focused-chunks/{chunk-23FTGO3W.js → chunk-KTLOKKCQ.js} +2 -2
  37. package/dist/cli-bundle/focused-chunks/chunk-LGYK3NUF.js +8 -0
  38. package/dist/cli-bundle/focused-chunks/{chunk-KDH5OX3D.js → chunk-NBLUKITQ.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-55BIB6DV.js → chunk-NYLOUPOB.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-DPO7TEFX.js → chunk-Q4T463SD.js} +28 -28
  41. package/dist/cli-bundle/focused-chunks/chunk-QVZVY53N.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/{chunk-TL5M2PAY.js → chunk-RWPAWUOT.js} +2 -2
  43. package/dist/cli-bundle/focused-chunks/chunk-UTEWXDEQ.js +17 -0
  44. package/dist/cli-bundle/focused-chunks/{chunk-4H5IA6AV.js → chunk-YIAXMC3T.js} +2 -2
  45. package/dist/cli-bundle/focused-chunks/chunk-ZMGWAYH7.js +2 -0
  46. package/dist/cli-bundle/main.js +13 -13
  47. package/dist/cli-bundle/sdk-authoring.js +1 -1
  48. package/dist/cli-bundle/sdk-contracts.js +1 -1
  49. package/dist/cli-bundle/sdk-core.js +40 -40
  50. package/dist/cli-bundle/sdk-governance.js +1 -1
  51. package/dist/cli-bundle/sdk-graph.js +1 -1
  52. package/dist/cli-bundle/sdk-merge.js +1 -1
  53. package/dist/cli-bundle/sdk-query.js +1 -1
  54. package/dist/cli-bundle/sdk-runtime.js +1 -1
  55. package/dist/cli-bundle/sdk-testing.js +1 -1
  56. package/dist/cli-bundle/sdk.js +2 -2
  57. package/dist/core/extensions/reserved-host-flags.js +3 -2
  58. package/dist/core/history/drift-scan.js +13 -8
  59. package/dist/core/history/history.d.ts +8 -0
  60. package/dist/core/history/history.js +57 -7
  61. package/dist/core/history/replay.d.ts +9 -1
  62. package/dist/core/history/replay.js +48 -13
  63. package/dist/core/output/output.d.ts +2 -0
  64. package/dist/core/output/output.js +46 -14
  65. package/dist/core/shared/command-types.d.ts +2 -0
  66. package/dist/core/shared/command-types.js +2 -2
  67. package/dist/core/shared/errors.d.ts +5 -0
  68. package/dist/core/shared/errors.js +2 -2
  69. package/dist/core/store/item-metadata-cache.d.ts +1 -1
  70. package/dist/core/store/item-metadata-cache.js +14 -7
  71. package/dist/sdk/cli-bootstrap.d.ts +2 -0
  72. package/dist/sdk/cli-bootstrap.js +6 -2
  73. package/dist/sdk/cli-contracts/completeness.js +3 -2
  74. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  75. package/dist/sdk/cli-contracts/registration-helpers.d.ts +20 -3
  76. package/dist/sdk/cli-contracts/registration-helpers.js +18 -12
  77. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +8 -6
  78. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +4 -3
  79. package/dist/sdk/cli-contracts/tool-option-contracts.js +3 -2
  80. package/dist/sdk/cli-contracts/tool-parameter-tables.js +22 -2
  81. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  82. package/dist/sdk/cli-contracts/tool-schema.js +7 -4
  83. package/dist/sdk/cli-program.js +3 -2
  84. package/dist/sdk/completion.js +16 -7
  85. package/dist/sdk/context-intent-contracts.js +45 -4
  86. package/dist/sdk/core.d.ts +1 -0
  87. package/dist/sdk/core.js +3 -2
  88. package/dist/sdk/generated/generated-error-code-catalog-part-1.d.ts +8 -0
  89. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1585 -0
  90. package/dist/sdk/generated/generated-error-code-catalog-part-2.d.ts +8 -0
  91. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1608 -0
  92. package/dist/sdk/generated-error-code-catalog.js +6 -3140
  93. package/dist/sdk/governance/assurance-action.js +9 -7
  94. package/dist/sdk/governance/assurance-mutation-error.d.ts +7 -0
  95. package/dist/sdk/governance/assurance-mutation-error.js +35 -0
  96. package/dist/sdk/governance/assurance-runtime.js +11 -8
  97. package/dist/sdk/governance/assurance.d.ts +12 -6
  98. package/dist/sdk/governance/assurance.js +181 -66
  99. package/dist/sdk/governance/health.d.ts +3 -1
  100. package/dist/sdk/governance/health.js +21 -4
  101. package/dist/sdk/governance/validate-item-reader.js +3 -3
  102. package/dist/sdk/governance/validate.d.ts +2 -0
  103. package/dist/sdk/governance/validate.js +13 -3
  104. package/dist/sdk/graph/durable-cache.d.ts +1 -1
  105. package/dist/sdk/graph/durable-cache.js +98 -29
  106. package/dist/sdk/graph/governance.d.ts +14 -0
  107. package/dist/sdk/graph/governance.js +34 -9
  108. package/dist/sdk/index.d.ts +1 -1
  109. package/dist/sdk/index.js +3 -3
  110. package/dist/sdk/lifecycle/claim.js +10 -3
  111. package/dist/sdk/merge/driver.d.ts +2 -2
  112. package/dist/sdk/merge/driver.js +3 -3
  113. package/dist/sdk/merge/receipts.d.ts +6 -4
  114. package/dist/sdk/merge/receipts.js +7 -5
  115. package/dist/sdk/merge/three-way.d.ts +2 -2
  116. package/dist/sdk/merge/three-way.js +3 -3
  117. package/dist/sdk/output-projection.d.ts +9 -1
  118. package/dist/sdk/output-projection.js +45 -9
  119. package/dist/sdk/query/activity.d.ts +49 -2
  120. package/dist/sdk/query/activity.js +183 -37
  121. package/dist/sdk/query/get.js +19 -2
  122. package/dist/sdk/read-output-contracts.d.ts +5 -1
  123. package/dist/sdk/read-output-contracts.js +17 -2
  124. package/dist/sdk/read-output-session.d.ts +2 -0
  125. package/dist/sdk/read-output-session.js +12 -5
  126. package/dist/sdk/runtime-primitives.d.ts +3 -3
  127. package/dist/sdk/runtime-primitives.js +5 -5
  128. package/dist/sdk/runtime-stats-options.js +3 -2
  129. package/dist/sdk/runtime.js +5 -9
  130. package/dist/sdk/stats.d.ts +36 -3
  131. package/dist/sdk/stats.js +55 -15
  132. package/dist/sdk/test/execution.d.ts +4 -0
  133. package/dist/sdk/test/execution.js +86 -21
  134. package/dist/types.d.ts +2 -0
  135. package/dist/types.js +2 -2
  136. package/docs/ASSURANCE.md +17 -12
  137. package/docs/COMMANDS.md +29 -8
  138. package/docs/CONFIGURATION.md +7 -0
  139. package/docs/DEPENDENCY_KIND_CONTRACT.md +10 -8
  140. package/docs/MERGE_SAFETY.md +3 -1
  141. package/docs/OUTPUT_PROJECTION_CONTRACTS.md +26 -13
  142. package/docs/README.md +2 -0
  143. package/docs/READ_OUTPUT_CONTRACTS.md +17 -2
  144. package/docs/SDK_AGENT_SESSION_CONTEXT.md +12 -1
  145. package/docs/SDK_CONTEXT_EVIDENCE_CONTRACTS.md +53 -0
  146. package/docs/SDK_CONTEXT_INTEGRITY.md +28 -1
  147. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +106 -0
  148. package/docs/performance/sdk-entrypoint-import-costs.md +6 -2
  149. package/marketplace.json +2 -2
  150. package/package.json +5 -5
  151. package/packages/pm-beads/package.json +1 -1
  152. package/packages/pm-calendar/package.json +1 -1
  153. package/packages/pm-command-kit/package.json +1 -1
  154. package/packages/pm-digital-twin/package.json +1 -1
  155. package/packages/pm-governance-audit/package.json +1 -1
  156. package/packages/pm-guide-shell/package.json +1 -1
  157. package/packages/pm-kanban/package.json +1 -1
  158. package/packages/pm-lifecycle-hooks/package.json +1 -1
  159. package/packages/pm-linked-test-adapters/package.json +1 -1
  160. package/packages/pm-search-advanced/package.json +1 -1
  161. package/packages/pm-templates/package.json +1 -1
  162. package/packages/pm-todos/package.json +1 -1
  163. package/packages/pm-vcs/package.json +1 -1
  164. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  165. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  166. package/sdk/public-surface.json +203 -52
  167. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +0 -33
  168. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +0 -13
  169. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +0 -194
  170. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +0 -2
  171. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +0 -5
  172. package/dist/cli-bundle/chunks/register-list-query-HAUXVUPY.js +0 -10
  173. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +0 -20
  174. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +0 -2
  175. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +0 -2
  176. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +0 -2
  177. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +0 -16
  178. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +0 -8
  179. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +0 -2
  180. package/dist/cli-bundle/focused-chunks/chunk-E3KCL7AY.js +0 -5
  181. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +0 -153
  182. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +0 -2
  183. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +0 -2
  184. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +0 -17
@@ -4,7 +4,7 @@
4
4
  * Implements the pm health command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="539b0cb4-5e20-51e2-a33e-1a43ca961f05")}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]="af3d60bd-94d4-52e8-90e3-7929ce04428c")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
@@ -54,12 +54,13 @@ const TELEMETRY_SERVER_MAX_SCHEMA_VERSION_HEADERS = [
54
54
  "x-pm-telemetry-max-schema-version",
55
55
  "x-pm-telemetry-max-version",
56
56
  ];
57
- /** Advisory warnings are surfaced for visibility but never flip overall health to not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable telemetry endpoint or corrupt local telemetry state is not a project-health failure and must not block agents that gate on `pm health` `ok`. History over-compaction-threshold warnings are likewise advisory maintenance hints — a deep stream is healthy, just a candidate for `pm history-compact`. */
57
+ /** Advisory warnings are surfaced for visibility but never flip overall health to not-ok. Telemetry is opt-out, non-critical observability: a queued/unreachable telemetry endpoint or corrupt local telemetry state is not a project-health failure and must not block agents that gate on `pm health` `ok`. History over-compaction-threshold warnings are likewise advisory maintenance hints — a deep stream is healthy, just a candidate for `pm history-compact`. Invalid legacy provenance values remain immutable diagnostic evidence: write-time resolvers reject new invalid values, while health reports the bounded aggregate without requiring truthful history to be rewritten. */
58
58
  function isAdvisoryHealthWarning(warning, requireMergeDrivers = false) {
59
59
  return (warning.startsWith("telemetry_") ||
60
60
  warning.startsWith("history_stream_over_compact_threshold:") ||
61
61
  warning.startsWith("stale_in_progress_items:") ||
62
62
  warning.startsWith("provenance_resolver_zero_success:") ||
63
+ warning.startsWith("provenance_value_domain_invalid:") ||
63
64
  (!requireMergeDrivers &&
64
65
  warning.startsWith("merge_driver_configuration_missing:")));
65
66
  }
@@ -360,6 +361,7 @@ async function buildIntegrityCheck(pmRoot, typeToFolder, schema, requireMergeDri
360
361
  check: {
361
362
  name: "integrity",
362
363
  status: normalizedWarnings.length === 0 ? "ok" : "warn",
364
+ ok: normalizedWarnings.length === 0,
363
365
  details: {
364
366
  checked_item_files: itemScan.paths.length,
365
367
  checked_history_streams: historyScan.files.length,
@@ -703,6 +705,7 @@ async function buildExtensionCheck(pmRoot, settings, noExtensionsFlag) {
703
705
  check: {
704
706
  name: "extensions",
705
707
  status: extensionWarnings.length === 0 ? "ok" : "warn",
708
+ ok: extensionWarnings.length === 0,
706
709
  details: {
707
710
  ...loadResult,
708
711
  loaded: loadedSummaries,
@@ -951,6 +954,7 @@ function applyBriefHealthProjection(result) {
951
954
  checks: result.checks.map((check) => ({
952
955
  name: check.name,
953
956
  status: check.status,
957
+ ok: check.ok,
954
958
  details: summarizeHealthCheckDetails(check, BRIEF_HEALTH_DETAIL_LIMIT),
955
959
  })),
956
960
  warnings: warningsSummary.sample,
@@ -978,6 +982,7 @@ function applySummaryHealthProjection(result) {
978
982
  .map((check) => ({
979
983
  name: check.name,
980
984
  status: check.status,
985
+ ok: check.ok,
981
986
  details: {},
982
987
  })),
983
988
  warning_count: warningsSummary.count,
@@ -1261,6 +1266,7 @@ async function buildTelemetryCheck(settings, options) {
1261
1266
  check: {
1262
1267
  name: "telemetry",
1263
1268
  status: warnings.length === 0 ? "ok" : "warn",
1269
+ ok: warnings.length === 0,
1264
1270
  details: {
1265
1271
  enabled: settings.telemetry.enabled,
1266
1272
  capture_level: settings.telemetry.capture_level,
@@ -1306,6 +1312,7 @@ async function buildLocksCheck(pmRoot) {
1306
1312
  check: {
1307
1313
  name: "locks",
1308
1314
  status: "warn",
1315
+ ok: false,
1309
1316
  details: {
1310
1317
  active_lock_count: 0,
1311
1318
  stale_lock_count: 0,
@@ -1331,6 +1338,7 @@ async function buildLocksCheck(pmRoot) {
1331
1338
  check: {
1332
1339
  name: "locks",
1333
1340
  status: warnings.length === 0 ? "ok" : "warn",
1341
+ ok: warnings.length === 0,
1334
1342
  details: {
1335
1343
  active_lock_count: scan.active_lock_count,
1336
1344
  stale_lock_count: scan.stale_lock_count,
@@ -1354,6 +1362,7 @@ async function buildHistoryDriftCheck(pmRoot, items) {
1354
1362
  check: {
1355
1363
  name: "history_drift",
1356
1364
  status: warnings.length === 0 ? "ok" : "warn",
1365
+ ok: warnings.length === 0,
1357
1366
  details: {
1358
1367
  checked_items: items.length,
1359
1368
  cache_hit_verification: cacheHitVerification,
@@ -1519,6 +1528,7 @@ async function buildVectorizationCheck(pmRoot, settings, items, refreshPolicy, v
1519
1528
  check: {
1520
1529
  name: "vectorization",
1521
1530
  status: warnings.length === 0 ? "ok" : "warn",
1531
+ ok: warnings.length === 0,
1522
1532
  details: {
1523
1533
  semantic_runtime_available: snapshot.semanticRuntimeAvailable,
1524
1534
  compatibility_mode_auto_defaults: snapshot.runtimeDefaults.auto_ollama_defaults_applied,
@@ -1661,7 +1671,7 @@ async function readHealthItems(params) {
1661
1671
  }
1662
1672
  function buildSkippedHealthCheck(name) {
1663
1673
  return {
1664
- check: { name, status: "ok", details: { skipped: true } },
1674
+ check: { name, status: "ok", ok: true, details: { skipped: true } },
1665
1675
  warnings: [],
1666
1676
  };
1667
1677
  }
@@ -1670,6 +1680,7 @@ function buildSettingsHealthCheck(settingsPath, settings, normalizedSettingsRead
1670
1680
  name: "settings",
1671
1681
  /* c8 ignore next -- settings read-warning status split is covered in broader read-settings integration tests */
1672
1682
  status: normalizedSettingsReadWarnings.length === 0 ? "ok" : "warn",
1683
+ ok: normalizedSettingsReadWarnings.length === 0,
1673
1684
  details: {
1674
1685
  path: settingsPath,
1675
1686
  version: settings.version,
@@ -1683,6 +1694,7 @@ function buildDirectoriesHealthCheck(directoryState, strictDirectories) {
1683
1694
  return {
1684
1695
  name: "directories",
1685
1696
  status: directoryState.missingDirs.length === 0 ? "ok" : "warn",
1697
+ ok: directoryState.missingDirs.length === 0,
1686
1698
  details: {
1687
1699
  required: directoryState.requiredDirs,
1688
1700
  optional: directoryState.optionalDirs,
@@ -1697,6 +1709,7 @@ function buildSettingsValuesHealthCheck(settingWarnings) {
1697
1709
  return {
1698
1710
  name: "settings_values",
1699
1711
  status: settingWarnings.length === 0 ? "ok" : "warn",
1712
+ ok: settingWarnings.length === 0,
1700
1713
  details: { warnings: settingWarnings },
1701
1714
  };
1702
1715
  }
@@ -1719,6 +1732,10 @@ function buildStorageHealthCheck(items, settings, historySummary, authorAttribut
1719
1732
  !hasStaleInProgressItems
1720
1733
  ? "ok"
1721
1734
  : "warn",
1735
+ ok: historySummary.over_threshold.length === 0 &&
1736
+ historySummary.orphaned.length === 0 &&
1737
+ !hasActionableAuthorWarnings &&
1738
+ !hasStaleInProgressItems,
1722
1739
  details: {
1723
1740
  items: items.length,
1724
1741
  history_streams: historySummary.count,
@@ -1990,4 +2007,4 @@ export const _testOnlyHealthCommand = {
1990
2007
  warningCode,
1991
2008
  };
1992
2009
  //# sourceMappingURL=health.js.map
1993
- //# debugId=539b0cb4-5e20-51e2-a33e-1a43ca961f05
2010
+ //# debugId=af3d60bd-94d4-52e8-90e3-7929ce04428c
@@ -5,14 +5,14 @@
5
5
  * validation run.
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]="896ffe11-2cf1-5de0-8d07-5585d4f30c94")}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]="01f042d0-7f02-59f5-8894-cf48eb936d99")}catch(e){}}();
9
9
  import { listAllItemMetadata, listAllItemMetadataWithBody, } from "../../core/store/item-store.js";
10
10
  /** Load collections for normal checks and add bodies only when history hashes must be verified. */
11
11
  export async function readValidateItems(params) {
12
12
  if (params.includeBody) {
13
- return listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema);
13
+ return listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema, { forceSourceScan: true });
14
14
  }
15
15
  return listAllItemMetadata(params.pmRoot, params.settings.item_format, params.typeToFolder, params.warnings, params.settings.schema);
16
16
  }
17
17
  //# sourceMappingURL=validate-item-reader.js.map
18
- //# debugId=896ffe11-2cf1-5de0-8d07-5585d4f30c94
18
+ //# debugId=01f042d0-7f02-59f5-8894-cf48eb936d99
@@ -75,6 +75,8 @@ export interface ValidateCheck {
75
75
  name: ValidateCheckName;
76
76
  /** Lifecycle state reported for status. */
77
77
  status: ValidateStatus;
78
+ /** Direct machine predicate derived from whether status is ok. */
79
+ ok: boolean;
78
80
  /** Value that configures or reports details for this contract. */
79
81
  details: Record<string, unknown>;
80
82
  }
@@ -4,7 +4,7 @@
4
4
  * Implements the pm validate command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b5b7e497-f067-5504-9ffa-fd177997c518")}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]="5affc1f1-2b4f-5f04-a6cb-c3e389bcb356")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import { realpathSync } from "node:fs";
10
10
  import { execFile } from "node:child_process";
@@ -913,6 +913,7 @@ function buildMetadataCheck(items, metadataPolicy, statusRegistry, verboseDiagno
913
913
  check: {
914
914
  name: "metadata",
915
915
  status: warningTokens.length === 0 ? "ok" : "warn",
916
+ ok: warningTokens.length === 0,
916
917
  details,
917
918
  },
918
919
  warnings: warningTokens,
@@ -957,6 +958,7 @@ function buildResolutionCheck(items, statusRegistry, verboseDiagnostics) {
957
958
  check: {
958
959
  name: "resolution",
959
960
  status: warnings.length === 0 ? "ok" : "warn",
961
+ ok: warnings.length === 0,
960
962
  details: {
961
963
  checked_closed_items: closedItems.length,
962
964
  missing_resolution_items: missingResolutionRows.length,
@@ -1026,6 +1028,7 @@ function buildDependencyReferencesCheck(items, verboseDiagnostics, statusRegistr
1026
1028
  check: {
1027
1029
  name: "dependency_references",
1028
1030
  status: activeRows.length === 0 ? "ok" : "warn",
1031
+ ok: activeRows.length === 0,
1029
1032
  details: {
1030
1033
  checked_items: items.length,
1031
1034
  dangling_reference_count: activeRows.length + legacyRows.length,
@@ -1582,6 +1585,7 @@ function buildLifecycleCheck(items, includeStaleBlockers, dependencyCycleSeverit
1582
1585
  : warnings.length === 0
1583
1586
  ? "ok"
1584
1587
  : "warn",
1588
+ ok: !hasErrorSeverityCycle && warnings.length === 0,
1585
1589
  details: {
1586
1590
  checked_active_items: rows.activeItems.length,
1587
1591
  active_closure_like_metadata_items: rows.closureLikeRows.length,
@@ -1709,6 +1713,7 @@ async function buildFilesCheck(items, workspaceRoot, pmRoot, fileScanMode, inclu
1709
1713
  check: {
1710
1714
  name: "files",
1711
1715
  status: warnings.length === 0 ? "ok" : "warn",
1716
+ ok: warnings.length === 0,
1712
1717
  details: {
1713
1718
  workspace_root: workspaceRoot,
1714
1719
  scan_mode_requested: fileCandidates.requestedMode,
@@ -1786,6 +1791,7 @@ async function buildHistoryDriftCheck(pmRoot, items, verboseDiagnostics) {
1786
1791
  check: {
1787
1792
  name: "history_drift",
1788
1793
  status: warnings.length === 0 ? "ok" : "warn",
1794
+ ok: warnings.length === 0,
1789
1795
  details: {
1790
1796
  checked_items: items.length,
1791
1797
  drifted_items_count: driftedItems.length,
@@ -1859,6 +1865,7 @@ function buildCommandReferencesCheck(items, idPrefix, verboseDiagnostics) {
1859
1865
  check: {
1860
1866
  name: "command_references",
1861
1867
  status: warnings.length === 0 ? "ok" : "warn",
1868
+ ok: warnings.length === 0,
1862
1869
  details: {
1863
1870
  checked_items: items.length,
1864
1871
  linked_commands_scanned: linkedCommandsScanned,
@@ -1905,6 +1912,7 @@ function buildFormatVersionCheck(items, verboseDiagnostics) {
1905
1912
  check: {
1906
1913
  name: "format_version",
1907
1914
  status,
1915
+ ok: status === "ok",
1908
1916
  details: {
1909
1917
  checked_items: items.length,
1910
1918
  current_format_version: CURRENT_ITEM_FORMAT_VERSION,
@@ -2108,13 +2116,15 @@ async function buildStorageIntegrityCheck(pmRoot, items, typeToFolder, settings)
2108
2116
  if (pendingMergeDecisions.length > 0) {
2109
2117
  warnings.push(`validate_merge_decisions_unreviewed:${pendingMergeDecisions.length}`);
2110
2118
  }
2119
+ const status = errorCount > 0 ? "error" : warnings.length > 0 ? "warn" : "ok";
2111
2120
  return {
2112
2121
  check: {
2113
2122
  name: "storage_integrity",
2114
2123
  // Corruption findings fail the check; fence drift alone is a warning —
2115
2124
  // the workspace data is intact, but future merges of uncovered paths
2116
2125
  // would fall back to git's default text driver.
2117
- status: errorCount > 0 ? "error" : warnings.length > 0 ? "warn" : "ok",
2126
+ status,
2127
+ ok: status === "ok",
2118
2128
  details: {
2119
2129
  ...scan,
2120
2130
  merge_fence: fenceAudit,
@@ -2346,4 +2356,4 @@ export async function runValidate(options, global, services = {}) {
2346
2356
  }
2347
2357
  /* c8 ignore stop */
2348
2358
  //# sourceMappingURL=validate.js.map
2349
- //# debugId=b5b7e497-f067-5504-9ffa-fd177997c518
2359
+ //# debugId=5affc1f1-2b4f-5f04-a6cb-c3e389bcb356
@@ -1,4 +1,4 @@
1
- import type { RelationshipAuditSnapshot } from "./governance.js";
1
+ import { type RelationshipAuditSnapshot } from "./governance.js";
2
2
  /** Envelope format version; any change invalidates persisted entries. */
3
3
  export declare const GRAPH_DURABLE_CACHE_VERSION = 1;
4
4
  /** Workspaces below this item count skip implicit persistence. */
@@ -15,10 +15,11 @@
15
15
  * threshold or after an explicit `pm graph index --rebuild` opt-in.
16
16
  */
17
17
 
18
- !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]="ee260dcf-f4df-5997-a8d7-691c19c66a41")}catch(e){}}();
18
+ !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]="4cb399d6-7311-5e2d-a8d2-e0140530ec72")}catch(e){}}();
19
19
  import path from "node:path";
20
20
  import { readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../../core/fs/fs-utils.js";
21
21
  import { acquireLock } from "../../core/lock/lock.js";
22
+ import { isSemanticContextKind, } from "./governance.js";
22
23
  /** Envelope format version; any change invalidates persisted entries. */
23
24
  export const GRAPH_DURABLE_CACHE_VERSION = 1;
24
25
  /** Workspaces below this item count skip implicit persistence. */
@@ -140,19 +141,75 @@ export function shouldPersistDurableGraphCache(itemCount, envelopeExists) {
140
141
  }
141
142
  /** Return whether a decoded value is a string-keyed non-negative integer count map. */
142
143
  function isNonnegativeCountRecord(value) {
143
- return (typeof value === "object" &&
144
- value !== null &&
145
- !Array.isArray(value) &&
146
- Object.values(value).every((count) => Number.isInteger(count) && count >= 0));
144
+ return isRecord(value) && Object.values(value).every(isNonnegativeInteger);
145
+ }
146
+ /** Return whether a decoded value is a non-array record. */
147
+ function isRecord(value) {
148
+ return typeof value === "object" && value !== null && !Array.isArray(value);
149
+ }
150
+ /** Return whether a decoded value is a non-negative integer. */
151
+ function isNonnegativeInteger(value) {
152
+ return Number.isInteger(value) && Number(value) >= 0;
153
+ }
154
+ /** Return whether a decoded value is a finite share in the inclusive unit interval. */
155
+ function isUnitShare(value) {
156
+ return (typeof value === "number" &&
157
+ Number.isFinite(value) &&
158
+ value >= 0 &&
159
+ value <= 1);
160
+ }
161
+ /** Apply a validator only when an optional decoded value is present. */
162
+ function isOptionalValid(value, validate) {
163
+ return value === undefined || validate(value);
164
+ }
165
+ /** Return whether a decoded record contains finite shares in the inclusive unit interval. */
166
+ function isUnitShareRecord(value) {
167
+ return isRecord(value) && Object.values(value).every(isUnitShare);
147
168
  }
148
169
  /** Return whether every decoded item-type coverage entry contains valid counts. */
149
170
  function isNonnegativeCoverageByTypeRecord(value) {
150
- if (typeof value !== "object" || value === null || Array.isArray(value))
171
+ if (!isRecord(value))
151
172
  return false;
152
- return Object.values(value).every((entry) => typeof entry === "object" &&
153
- entry !== null &&
154
- !Array.isArray(entry) &&
155
- [entry.active, entry.isolated, entry.degree_leq_one].every((count) => Number.isInteger(count) && count >= 0));
173
+ return Object.values(value).every((entry) => isRecord(entry) &&
174
+ [entry.active, entry.isolated, entry.degree_leq_one].every(isNonnegativeInteger));
175
+ }
176
+ /** Decode and cross-check optional graph-composition fields as one coherent unit. */
177
+ function decodeGraphComposition(edges, edgesByKind, edgeShareByKind, semanticEdgesValue, semanticEdgeShareValue) {
178
+ const values = [
179
+ edgeShareByKind,
180
+ semanticEdgesValue,
181
+ semanticEdgeShareValue,
182
+ ];
183
+ const presentCount = values.filter((value) => value !== undefined).length;
184
+ if (presentCount === 0) {
185
+ return {
186
+ edge_share_by_kind: {},
187
+ semantic_edges: 0,
188
+ semantic_edge_share: 0,
189
+ };
190
+ }
191
+ if (presentCount !== values.length ||
192
+ !isUnitShareRecord(edgeShareByKind) ||
193
+ !isNonnegativeInteger(semanticEdgesValue) ||
194
+ !isUnitShare(semanticEdgeShareValue)) {
195
+ return undefined;
196
+ }
197
+ const edgeEntries = Object.entries(edgesByKind);
198
+ if (edgeEntries.reduce((sum, [, count]) => sum + count, 0) !== edges ||
199
+ Object.keys(edgeShareByKind).length !== edgeEntries.length ||
200
+ edgeEntries.some(([kind, count]) => edgeShareByKind[kind] !== (edges === 0 ? 0 : count / edges))) {
201
+ return undefined;
202
+ }
203
+ const semanticEdges = edgeEntries.reduce((sum, [kind, count]) => sum + (isSemanticContextKind(kind) ? count : 0), 0);
204
+ if (semanticEdgesValue !== semanticEdges ||
205
+ semanticEdgeShareValue !== (edges === 0 ? 0 : semanticEdges / edges)) {
206
+ return undefined;
207
+ }
208
+ return {
209
+ edge_share_by_kind: edgeShareByKind,
210
+ semantic_edges: semanticEdgesValue,
211
+ semantic_edge_share: semanticEdgeShareValue,
212
+ };
156
213
  }
157
214
  /** Decode one persisted audit census baseline, undefined on any defect. */
158
215
  function decodeBaseline(raw) {
@@ -160,32 +217,44 @@ function decodeBaseline(raw) {
160
217
  return undefined;
161
218
  try {
162
219
  const parsed = JSON.parse(raw);
163
- if (typeof parsed !== "object" || parsed === null)
220
+ if (!isRecord(parsed))
164
221
  return undefined;
165
222
  const snapshot = parsed;
166
223
  const profile = snapshot.profile;
167
- if (typeof snapshot.saved_at !== "string" ||
168
- typeof snapshot.fingerprint !== "string" ||
169
- !isNonnegativeCountRecord(snapshot.affected_subjects_by_code) ||
170
- typeof profile !== "object" ||
171
- profile === null ||
172
- ![
173
- profile.nodes,
174
- profile.edges,
175
- profile.active_nodes,
176
- profile.missing_nodes,
177
- profile.isolated_active_nodes,
178
- profile.degree_leq_one_active_nodes,
179
- ].every((value) => Number.isInteger(value) && value >= 0) ||
180
- !isNonnegativeCountRecord(profile.edges_by_kind) ||
181
- (profile.coverage_by_type !== undefined &&
182
- !isNonnegativeCoverageByTypeRecord(profile.coverage_by_type)))
224
+ if (typeof snapshot.saved_at !== "string")
225
+ return undefined;
226
+ if (typeof snapshot.fingerprint !== "string")
227
+ return undefined;
228
+ if (!isNonnegativeCountRecord(snapshot.affected_subjects_by_code)) {
229
+ return undefined;
230
+ }
231
+ if (!isRecord(profile))
232
+ return undefined;
233
+ if (![
234
+ profile.nodes,
235
+ profile.edges,
236
+ profile.active_nodes,
237
+ profile.missing_nodes,
238
+ profile.isolated_active_nodes,
239
+ profile.degree_leq_one_active_nodes,
240
+ ].every(isNonnegativeInteger)) {
241
+ return undefined;
242
+ }
243
+ if (!isNonnegativeCountRecord(profile.edges_by_kind))
244
+ return undefined;
245
+ if (!isOptionalValid(profile.coverage_by_type, isNonnegativeCoverageByTypeRecord)) {
246
+ return undefined;
247
+ }
248
+ const composition = decodeGraphComposition(profile.edges, profile.edges_by_kind, profile.edge_share_by_kind, profile.semantic_edges, profile.semantic_edge_share);
249
+ if (composition === undefined)
183
250
  return undefined;
251
+ const { coverage_by_type = {} } = profile;
184
252
  return {
185
253
  ...snapshot,
186
254
  profile: {
187
255
  ...profile,
188
- coverage_by_type: profile.coverage_by_type ?? {},
256
+ ...composition,
257
+ coverage_by_type,
189
258
  },
190
259
  };
191
260
  }
@@ -202,4 +271,4 @@ export async function saveGraphAuditBaseline(pmRoot, snapshot) {
202
271
  await writeFileAtomic(graphAuditBaselinePath(pmRoot), JSON.stringify(snapshot));
203
272
  }
204
273
  //# sourceMappingURL=durable-cache.js.map
205
- //# debugId=ee260dcf-f4df-5997-a8d7-691c19c66a41
274
+ //# debugId=4cb399d6-7311-5e2d-a8d2-e0140530ec72
@@ -56,6 +56,12 @@ export interface RelationshipCoverageProfile {
56
56
  edge_basis: "deduplicated_directed";
57
57
  /** Deterministic per-kind edge counts. */
58
58
  edges_by_kind: Record<string, number>;
59
+ /** Per-kind share of all deduplicated directed edges. */
60
+ edge_share_by_kind: Record<string, number>;
61
+ /** Edges carrying discovery, provenance, incident, or verification semantics. */
62
+ semantic_edges: number;
63
+ /** Share of all edges carrying discovery, provenance, incident, or verification semantics. */
64
+ semantic_edge_share: number;
59
65
  /** Nodes whose lifecycle status is active (non-terminal, non-missing). */
60
66
  active_nodes: number;
61
67
  /** Materialized placeholder nodes for referenced-but-absent items. */
@@ -89,6 +95,8 @@ export interface RelationshipAuditReport {
89
95
  /** Structural coverage metrics computed during the audit. */
90
96
  profile: RelationshipCoverageProfile;
91
97
  }
98
+ /** Return whether a relationship kind carries provenance or verification context. */
99
+ export declare function isSemanticContextKind(kind: string): boolean;
92
100
  /**
93
101
  * Enumerate strongly connected components with more than one member (or a
94
102
  * self-loop) over an ordering-only successor digraph using an iterative Tarjan
@@ -165,6 +173,12 @@ export interface RelationshipAuditDelta {
165
173
  degree_leq_one_active_nodes: number;
166
174
  /** Signed per-kind edge-count deltas; unchanged kinds are dropped. */
167
175
  edges_by_kind: Record<string, number>;
176
+ /** Signed per-kind edge-share deltas; unchanged kinds are dropped. */
177
+ edge_share_by_kind: Record<string, number>;
178
+ /** Change in semantic-context edge count. */
179
+ semantic_edges: number;
180
+ /** Change in semantic-context edge share. */
181
+ semantic_edge_share: number;
168
182
  /** Signed per-type coverage deltas; unchanged types are dropped. */
169
183
  coverage_by_type: Record<string, RelationshipCoverageTypeProfile>;
170
184
  };
@@ -1,8 +1,19 @@
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]="76fa19c7-a421-5026-8de8-450285987c4e")}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]="996cfe8f-1b9b-534e-9e22-ede6f76d7cac")}catch(e){}}();
3
3
  import { isTransitiveKind, orientTransitiveEdge, transitiveFamilyKey, } from "./analytics.js";
4
4
  /** Default bounded sample size applied to every finding family. */
5
5
  const DEFAULT_MAX_SAMPLE_SIZE = 25;
6
+ /** Relationship kinds that preserve why work exists or how evidence supports it. */
7
+ const SEMANTIC_CONTEXT_KINDS = new Set([
8
+ "discovered_from",
9
+ "incident_from",
10
+ "supersedes",
11
+ "verifies",
12
+ ]);
13
+ /** Return whether a relationship kind carries provenance or verification context. */
14
+ export function isSemanticContextKind(kind) {
15
+ return SEMANTIC_CONTEXT_KINDS.has(kind);
16
+ }
6
17
  /** Rank used to order findings by decreasing severity. */
7
18
  const SEVERITY_RANK = {
8
19
  error: 0,
@@ -332,13 +343,22 @@ function collectCoverageReport(assembly, nodeStates, exemptIsolates, isolateExem
332
343
  const findings = [];
333
344
  appendFinding(findings, isolates, maxSampleSize, "isolated_active_node", "warning", "Active work should be reachable from the graph unless explicitly declared a valid isolate.", (count) => `${count} active item(s) with no relationships`, "Link the item to its parent, prerequisite, or origin — or register it as an exempt isolate.");
334
345
  appendFinding(findings, sparse, maxSampleSize, "sparse_active_node", "info", "Active items with a single edge often miss an honest semantic partner; sparse is not automatically defective.", (count) => `${count} active item(s) with exactly one relationship`, "Investigate for an honest second edge (story->task, defect family, cross-epic complement); do not fabricate one.");
346
+ const edgeCount = assembly.graph.edges().length;
347
+ const sortedEdgesByKind = Object.fromEntries(Object.entries(edgesByKind).sort(([left], [right]) => left.localeCompare(right)));
348
+ const semanticEdges = Object.entries(sortedEdgesByKind).reduce((count, [kind, value]) => count + (isSemanticContextKind(kind) ? value : 0), 0);
335
349
  return {
336
350
  findings,
337
351
  profile: {
338
352
  nodes: assembly.graph.nodes().length,
339
- edges: assembly.graph.edges().length,
353
+ edges: edgeCount,
340
354
  edge_basis: "deduplicated_directed",
341
- edges_by_kind: Object.fromEntries(Object.entries(edgesByKind).sort(([left], [right]) => left.localeCompare(right))),
355
+ edges_by_kind: sortedEdgesByKind,
356
+ edge_share_by_kind: Object.fromEntries(Object.entries(sortedEdgesByKind).map(([kind, count]) => [
357
+ kind,
358
+ count / edgeCount,
359
+ ])),
360
+ semantic_edges: semanticEdges,
361
+ semantic_edge_share: edgeCount === 0 ? 0 : semanticEdges / edgeCount,
342
362
  active_nodes: tallies.active,
343
363
  missing_nodes: tallies.missing,
344
364
  isolated_active_nodes: tallies.isolated,
@@ -437,16 +457,18 @@ export function diffRelationshipAuditSnapshots(baseline, current) {
437
457
  ]),
438
458
  ].sort();
439
459
  for (const type of typeKeys) {
440
- const before = baselineCoverageByType[type];
441
- const after = currentCoverageByType[type];
460
+ const before = Object.assign({ active: 0, isolated: 0, degree_leq_one: 0 }, baselineCoverageByType[type]);
461
+ const after = Object.assign({ active: 0, isolated: 0, degree_leq_one: 0 }, currentCoverageByType[type]);
442
462
  const delta = {
443
- active: (after?.active ?? 0) - (before?.active ?? 0),
444
- isolated: (after?.isolated ?? 0) - (before?.isolated ?? 0),
445
- degree_leq_one: (after?.degree_leq_one ?? 0) - (before?.degree_leq_one ?? 0),
463
+ active: after.active - before.active,
464
+ isolated: after.isolated - before.isolated,
465
+ degree_leq_one: after.degree_leq_one - before.degree_leq_one,
446
466
  };
447
467
  if (Object.values(delta).some((value) => value !== 0))
448
468
  coverageByType[type] = delta;
449
469
  }
470
+ const { edge_share_by_kind: baselineEdgeShareByKind = {}, semantic_edges: baselineSemanticEdges = 0, semantic_edge_share: baselineSemanticEdgeShare = 0, } = baseline.profile;
471
+ const { edge_share_by_kind: currentEdgeShareByKind = {}, semantic_edges: currentSemanticEdges = 0, semantic_edge_share: currentSemanticEdgeShare = 0, } = current.profile;
450
472
  return {
451
473
  baseline_saved_at: baseline.saved_at,
452
474
  same_snapshot: baseline.fingerprint === current.fingerprint,
@@ -461,9 +483,12 @@ export function diffRelationshipAuditSnapshots(baseline, current) {
461
483
  degree_leq_one_active_nodes: current.profile.degree_leq_one_active_nodes -
462
484
  baseline.profile.degree_leq_one_active_nodes,
463
485
  edges_by_kind: diffCountRecords(baseline.profile.edges_by_kind, current.profile.edges_by_kind),
486
+ edge_share_by_kind: diffCountRecords(baselineEdgeShareByKind, currentEdgeShareByKind),
487
+ semantic_edges: currentSemanticEdges - baselineSemanticEdges,
488
+ semantic_edge_share: currentSemanticEdgeShare - baselineSemanticEdgeShare,
464
489
  coverage_by_type: coverageByType,
465
490
  },
466
491
  };
467
492
  }
468
493
  //# sourceMappingURL=governance.js.map
469
- //# debugId=76fa19c7-a421-5026-8de8-450285987c4e
494
+ //# debugId=996cfe8f-1b9b-534e-9e22-ede6f76d7cac
@@ -127,7 +127,7 @@ export type { UpdateManyOperationOptions } from "./lifecycle/update-many.js";
127
127
  export { runCreate } from "./lifecycle/create.js";
128
128
  export { runPlan } from "./lifecycle/plan.js";
129
129
  export { runAppend } from "./lifecycle/append.js";
130
- export { runClaim, runClaimNext, runRelease } from "./lifecycle/claim.js";
130
+ export { isAlreadyClaimedError, runClaim, runClaimNext, runRelease, } from "./lifecycle/claim.js";
131
131
  export { runCloseMany } from "./lifecycle/close-many.js";
132
132
  export { runUpdateMany } from "./lifecycle/update-many.js";
133
133
  export { runComments } from "./comments.js";
package/dist/sdk/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Index.
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]="8c96c6f6-f711-559a-bb35-9eeaedc720aa")}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]="14672b89-6a87-59a0-8164-6b01a9c91ee1")}catch(e){}}();
8
8
  export { PM_COMMAND_VISIBILITY_CONTRACTS, PM_MCP_PROMPT_CONTRACTS, PM_MCP_RESOURCE_CONTRACTS, PM_MCP_TOOL_COMMAND_CONTRACTS, listPmCommandsForTier, listPmMcpToolsForProfile, renderPmCommandVisibilityMarkdown, resolvePmCommandVisibilityTier, } from "./agent-capability-contracts.js";
9
9
  export * from "./agent-session-context.js";
10
10
  export { isErrnoError, limitAnnotationEntries, parseAnnotationTextInput, readAnnotationEntries, normalizeAnnotationTransportOptions, resolveAnnotationInput, resolveAnnotationIndex, runAnnotationCommand, wrapOwnershipConflict, } from "./annotations.js";
@@ -119,7 +119,7 @@ export * from "./actionability.js";
119
119
  export { runCreate } from "./lifecycle/create.js";
120
120
  export { runPlan } from "./lifecycle/plan.js";
121
121
  export { runAppend } from "./lifecycle/append.js";
122
- export { runClaim, runClaimNext, runRelease } from "./lifecycle/claim.js";
122
+ export { isAlreadyClaimedError, runClaim, runClaimNext, runRelease, } from "./lifecycle/claim.js";
123
123
  export { runCloseMany } from "./lifecycle/close-many.js";
124
124
  export { runUpdateMany } from "./lifecycle/update-many.js";
125
125
  export { runComments } from "./comments.js";
@@ -150,4 +150,4 @@ export * from "./governance.js";
150
150
  export * from "./query.js";
151
151
  export * from "./testing.js";
152
152
  //# sourceMappingURL=index.js.map
153
- //# debugId=8c96c6f6-f711-559a-bb35-9eeaedc720aa
153
+ //# debugId=14672b89-6a87-59a0-8164-6b01a9c91ee1
@@ -4,7 +4,7 @@
4
4
  * Implements the pm claim command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2e9b9321-a892-5bab-b6f8-4717fb5962df")}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]="f70f1329-4dfb-5625-ae0a-66c858d88f7b")}catch(e){}}();
8
8
  import { pathExists, resolveRuntimeStatusRegistry, statusIsTerminal, EXIT_CODE, PmCliError, toItemRecord, mutateItem, getSettingsPath, resolvePmRoot, readSettings, resolveAuthor, resolveClaimPrincipal, } from "../runtime-primitives.js";
9
9
  import { wrapOwnershipConflict } from "../annotations.js";
10
10
  import { describeItemOwnershipConflict } from "../ownership-source.js";
@@ -14,7 +14,14 @@ import { recordClaimSemanticAttribution, recordReleaseSemanticAttribution, } fro
14
14
  export const NO_AVAILABLE_NEXT_ITEM_CODE = "no_available_next_item";
15
15
  /** Returns whether a failed claim lost the atomic test-and-set race. */
16
16
  export function isAlreadyClaimedError(error) {
17
- return (error instanceof PmCliError && error.context?.code === "already_claimed_by");
17
+ if (!(error instanceof Error) || error.name !== "PmCliError") {
18
+ return false;
19
+ }
20
+ const context = error.context;
21
+ return (typeof context === "object" &&
22
+ context !== null &&
23
+ "code" in context &&
24
+ context.code === "already_claimed_by");
18
25
  }
19
26
  /** Implements run claim for the public runtime surface of this module. */
20
27
  export async function runClaim(id, force, global, options = {}) {
@@ -230,4 +237,4 @@ export async function runRelease(id, force, global, options = {}) {
230
237
  };
231
238
  }
232
239
  //# sourceMappingURL=claim.js.map
233
- //# debugId=2e9b9321-a892-5bab-b6f8-4717fb5962df
240
+ //# debugId=f70f1329-4dfb-5625-ae0a-66c858d88f7b
@@ -30,8 +30,8 @@ export interface MergeDriverResult {
30
30
  artifact: MergeDriverArtifact;
31
31
  /** Path the merged content was written to. */
32
32
  output_path: string;
33
- /** Invocation-side preference retained for non-item artifact compatibility. */
34
- preferred: MergePreferredSide;
33
+ /** Invocation-side preference; per-decision retained values remain authoritative. */
34
+ requested_preference: MergePreferredSide;
35
35
  /** Unresolvable conflict labels: metadata field names (item), dotted key paths (json). Empty for history merges. */
36
36
  conflicts: string[];
37
37
  /** History-merge strategy and entry accounting; present only for the history artifact. */