@unbrained/pm-cli 2026.8.8 → 2026.8.9

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 (144) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +19 -0
  3. package/dist/cli-bundle/bundle-manifest.json +154 -154
  4. package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +13 -0
  5. package/dist/cli-bundle/chunks/{chunk-ALDHXLPS.js → chunk-5JO6R4BS.js} +2 -2
  6. package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +194 -0
  7. package/dist/cli-bundle/chunks/chunk-EF43KODO.js +2 -0
  8. package/dist/cli-bundle/chunks/{chunk-NUXRRNAB.js → chunk-GMX5YOI3.js} +25 -25
  9. package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +28 -0
  10. package/dist/cli-bundle/chunks/{chunk-SQ7QZFQ6.js → chunk-MHBVCUF2.js} +2 -2
  11. package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +5 -0
  12. package/dist/cli-bundle/chunks/{chunk-CBLA33YK.js → chunk-RJC7TPF4.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-2ZMXX3Q6.js → chunk-YC3UF2IO.js} +64 -64
  14. package/dist/cli-bundle/chunks/{register-list-query-WFZAMJHZ.js → register-list-query-BUE7PTCU.js} +2 -2
  15. package/dist/cli-bundle/chunks/{register-mutation-SOKKOTHQ.js → register-mutation-FC3XLVIK.js} +2 -2
  16. package/dist/cli-bundle/chunks/{register-operations-5XQETS6E.js → register-operations-YH2WAOXU.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-setup-2HL5ZHMK.js → register-setup-UQDTNTLJ.js} +2 -2
  18. package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +153 -0
  19. package/dist/cli-bundle/focused-chunks/{chunk-IAS7PMLG.js → chunk-3GSFUDAI.js} +2 -2
  20. package/dist/cli-bundle/focused-chunks/chunk-3WVHTUAW.js +5 -0
  21. package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +16 -0
  22. package/dist/cli-bundle/focused-chunks/{chunk-ZOLDTUU7.js → chunk-54TZJ4BM.js} +2 -2
  23. package/dist/cli-bundle/focused-chunks/{chunk-YKPE4PPY.js → chunk-5NK5TJ5D.js} +2 -2
  24. package/dist/cli-bundle/focused-chunks/{chunk-ANTMGYLI.js → chunk-6DO4YQWZ.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/chunk-73FIJONU.js +2 -0
  26. package/dist/cli-bundle/focused-chunks/{chunk-PL2EYDJK.js → chunk-C3GCHDSQ.js} +29 -27
  27. package/dist/cli-bundle/focused-chunks/{chunk-U646T7Z6.js → chunk-JGRSQZJT.js} +3 -3
  28. package/dist/cli-bundle/focused-chunks/{chunk-YSAHYUXX.js → chunk-KNEHLPBF.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-MRWVJ3ZG.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +4 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-DMKOMTTY.js → chunk-P6BBIQRG.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-GWI6YIKJ.js → chunk-PZAGVQNN.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +14 -0
  34. package/dist/cli-bundle/focused-chunks/{chunk-SM2PJGP3.js → chunk-T4IGQCSY.js} +2 -2
  35. package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +2 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-TCSAPH33.js → chunk-VRXJSGIT.js} +6 -6
  37. package/dist/cli-bundle/focused-chunks/{chunk-FI6DWU2M.js → chunk-XC2ZW3CJ.js} +2 -2
  38. package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +2 -0
  39. package/dist/cli-bundle/main.js +2 -2
  40. package/dist/cli-bundle/sdk-authoring.js +1 -1
  41. package/dist/cli-bundle/sdk-contracts.js +1 -1
  42. package/dist/cli-bundle/sdk-core.js +29 -29
  43. package/dist/cli-bundle/sdk-governance.js +1 -1
  44. package/dist/cli-bundle/sdk-graph.js +1 -1
  45. package/dist/cli-bundle/sdk-merge.js +1 -1
  46. package/dist/cli-bundle/sdk-query.js +1 -1
  47. package/dist/cli-bundle/sdk-runtime.js +1 -1
  48. package/dist/cli-bundle/sdk-testing.js +1 -1
  49. package/dist/cli-bundle/sdk.js +2 -2
  50. package/dist/core/diagnostics/remediation.js +12 -2
  51. package/dist/core/history/history.js +13 -4
  52. package/dist/core/item/actionability.d.ts +7 -1
  53. package/dist/core/item/actionability.js +71 -15
  54. package/dist/core/shared/author.d.ts +25 -0
  55. package/dist/core/shared/author.js +114 -9
  56. package/dist/sdk/actionability.d.ts +1 -1
  57. package/dist/sdk/actionability.js +3 -3
  58. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +8 -0
  59. package/dist/sdk/cli-contracts/runtime-contracts.js +17 -2
  60. package/dist/sdk/core-governance.d.ts +1 -1
  61. package/dist/sdk/core-governance.js +3 -3
  62. package/dist/sdk/dependencies.d.ts +2 -0
  63. package/dist/sdk/dependencies.js +7 -6
  64. package/dist/sdk/extension/bundled-catalog.js +19 -6
  65. package/dist/sdk/generated-error-code-catalog.js +38 -2
  66. package/dist/sdk/governance/health.js +29 -10
  67. package/dist/sdk/governance/provenance-health.d.ts +26 -0
  68. package/dist/sdk/governance/provenance-health.js +139 -0
  69. package/dist/sdk/governance/validate.js +13 -8
  70. package/dist/sdk/governance.d.ts +1 -0
  71. package/dist/sdk/governance.js +3 -2
  72. package/dist/sdk/graph/assembly.d.ts +4 -0
  73. package/dist/sdk/graph/assembly.js +22 -2
  74. package/dist/sdk/graph/run.d.ts +2 -0
  75. package/dist/sdk/graph/run.js +3 -2
  76. package/dist/sdk/lifecycle/close.js +13 -8
  77. package/dist/sdk/lifecycle/create.js +6 -12
  78. package/dist/sdk/lifecycle/plan.js +6 -3
  79. package/dist/sdk/lifecycle/update.js +6 -20
  80. package/dist/sdk/merge/driver.d.ts +2 -1
  81. package/dist/sdk/merge/driver.js +7 -4
  82. package/dist/sdk/merge/install.js +3 -3
  83. package/dist/sdk/merge/receipts.d.ts +14 -1
  84. package/dist/sdk/merge/receipts.js +36 -8
  85. package/dist/sdk/merge/reconcile.js +21 -4
  86. package/dist/sdk/merge/three-way.d.ts +6 -2
  87. package/dist/sdk/merge/three-way.js +24 -10
  88. package/dist/sdk/query/get.d.ts +11 -0
  89. package/dist/sdk/query/get.js +37 -3
  90. package/dist/sdk/read-output-contracts.d.ts +1 -1
  91. package/dist/sdk/read-output-contracts.js +23 -4
  92. package/dist/sdk/relationship-kinds/contract.d.ts +48 -0
  93. package/dist/sdk/relationship-kinds/contract.js +22 -0
  94. package/dist/sdk/relationships.d.ts +6 -41
  95. package/dist/sdk/relationships.js +12 -126
  96. package/dist/sdk/runtime-primitives.d.ts +1 -1
  97. package/dist/sdk/runtime-primitives.js +3 -3
  98. package/dist/sdk/similarity.d.ts +5 -0
  99. package/dist/sdk/similarity.js +40 -10
  100. package/dist/sdk/structured-mutations.js +5 -2
  101. package/dist/sdk/test/linked-command-detection.d.ts +2 -7
  102. package/dist/sdk/test/linked-command-detection.js +22 -9
  103. package/docs/AGENT_GUIDE.md +2 -1
  104. package/docs/COMMANDS.md +19 -1
  105. package/docs/DEPENDENCY_KIND_CONTRACT.md +29 -0
  106. package/docs/ITEM_READ_PROJECTIONS.md +26 -0
  107. package/docs/MERGE_SAFETY.md +10 -3
  108. package/docs/RELATIONSHIP_GRAPH.md +1 -1
  109. package/docs/SDK_AGENT_SESSION_CONTEXT.md +35 -2
  110. package/docs/SDK_CONTEXT_INTEGRITY.md +16 -1
  111. package/docs/SENTRY_CONTRACT_EPOCHS.md +20 -0
  112. package/docs/agent-task-token-baseline.json +2 -2
  113. package/marketplace.json +2 -2
  114. package/package.json +1 -1
  115. package/packages/pm-beads/package.json +1 -1
  116. package/packages/pm-calendar/package.json +1 -1
  117. package/packages/pm-command-kit/package.json +1 -1
  118. package/packages/pm-digital-twin/package.json +1 -1
  119. package/packages/pm-governance-audit/package.json +1 -1
  120. package/packages/pm-guide-shell/package.json +1 -1
  121. package/packages/pm-kanban/package.json +1 -1
  122. package/packages/pm-lifecycle-hooks/package.json +1 -1
  123. package/packages/pm-linked-test-adapters/package.json +1 -1
  124. package/packages/pm-search-advanced/package.json +1 -1
  125. package/packages/pm-templates/package.json +1 -1
  126. package/packages/pm-todos/package.json +1 -1
  127. package/packages/pm-vcs/package.json +1 -1
  128. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  129. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  130. package/sdk/public-surface.json +231 -27
  131. package/dist/cli-bundle/chunks/chunk-GKA54IJM.js +0 -5
  132. package/dist/cli-bundle/chunks/chunk-KRY7SRUO.js +0 -2
  133. package/dist/cli-bundle/chunks/chunk-MNJ4NNSY.js +0 -26
  134. package/dist/cli-bundle/chunks/chunk-OJPCFDDY.js +0 -13
  135. package/dist/cli-bundle/chunks/chunk-PFSD3DAN.js +0 -194
  136. package/dist/cli-bundle/focused-chunks/chunk-54EU2UVO.js +0 -2
  137. package/dist/cli-bundle/focused-chunks/chunk-5FLBTZJQ.js +0 -2
  138. package/dist/cli-bundle/focused-chunks/chunk-5GJ57YKN.js +0 -2
  139. package/dist/cli-bundle/focused-chunks/chunk-CMDS3KYT.js +0 -14
  140. package/dist/cli-bundle/focused-chunks/chunk-F5B3HBEZ.js +0 -5
  141. package/dist/cli-bundle/focused-chunks/chunk-FNOKJG6N.js +0 -16
  142. package/dist/cli-bundle/focused-chunks/chunk-FPDYXZBK.js +0 -4
  143. package/dist/cli-bundle/focused-chunks/chunk-HCUC62AB.js +0 -2
  144. package/dist/cli-bundle/focused-chunks/chunk-HGNKPSCB.js +0 -153
@@ -19,7 +19,7 @@
19
19
  */
20
20
  /** Registry of every non-extension `pm health` / `pm validate` warning code and its remediation. Extension findings keep their richer, contextual `details.triage.remediation` produced by the extension health triage and are intentionally excluded here (see pm-0hnu: "all non-extension checks"). */
21
21
 
22
- !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]="6a350683-275b-5d4d-ae02-45798b115f89")}catch(e){}}();
22
+ !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]="8daf3070-facb-5775-a813-fb695ac9e3ce")}catch(e){}}();
23
23
  export const REMEDIATION_REGISTRY = Object.freeze([
24
24
  // --- pm health: directories ---
25
25
  {
@@ -188,6 +188,16 @@ export const REMEDIATION_REGISTRY = Object.freeze([
188
188
  command: "git rm --cached -r -- <tracked-runtime-directories>",
189
189
  summary: "Clone-local tracker runtime artifacts are committed. Run the exact tracked_runtime_cache.remediation_command from the integrity check, commit the index-only removals, and keep the managed .gitignore fence.",
190
190
  },
191
+ {
192
+ code: "merge_decisions_unreviewed",
193
+ command: "pm merge reconcile --dry-run",
194
+ summary: "Review the pending merge receipts, re-apply any intended discarded values, then run pm merge reconcile; lossy receipts require explicit --force acceptance.",
195
+ },
196
+ {
197
+ code: "validate_merge_decisions_unreviewed",
198
+ command: "pm merge reconcile --dry-run",
199
+ summary: "Review the pending merge receipts before reconciliation; history-repair alone does not settle them, and lossy receipts require explicit --force acceptance.",
200
+ },
191
201
  // --- pm health: history_drift ---
192
202
  // `pm health` rewrites these commands to `pm history-repair --all` in the
193
203
  // per-check remediation_map when more than one stream is drifted.
@@ -459,4 +469,4 @@ export function buildRemediationCommands(warnings) {
459
469
  return Object.values(buildRemediationMap(warnings));
460
470
  }
461
471
  //# sourceMappingURL=remediation.js.map
462
- //# debugId=6a350683-275b-5d4d-ae02-45798b115f89
472
+ //# debugId=8daf3070-facb-5775-a813-fb695ac9e3ce
@@ -4,7 +4,7 @@
4
4
  * Implements append-only history and replay behavior for History.
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]="5228a53a-603c-5c9f-870b-8ea8e0c5d27a")}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]="ce2dace3-7c86-5edf-8bda-083a0b3e7f2b")}catch(e){}}();
8
8
  import jsonPatch from "fast-json-patch";
9
9
  import { ITEM_METADATA_KEY_ORDER } from "../shared/constants.js";
10
10
  import { runActiveServiceOverride } from "../extensions/index.js";
@@ -13,7 +13,7 @@ import { canonicalDocument } from "../item/item-format.js";
13
13
  import { toItemRecord } from "../item/item-record.js";
14
14
  import { orderObject, sha256Hex, stableStringify, } from "../shared/serialization.js";
15
15
  import { nowIso } from "../shared/time.js";
16
- import { resolveHistoryAgentIdentity, resolveHistoryAuthorSource, } from "../shared/author.js";
16
+ import { diagnoseAgentIdentity, resolveHistoryAgentIdentity, resolveHistoryAuthorSource, } from "../shared/author.js";
17
17
  import { removeHistoryEventIndexForHistoryPath, updateHistoryEventIndexAfterAppend, } from "./event-index.js";
18
18
  import { invalidateHistoryDriftCacheForPath } from "./drift-cache.js";
19
19
  const EMPTY_LEGACY_HASH_DOCUMENT = {
@@ -128,6 +128,15 @@ export function createHistoryEntry(params) {
128
128
  const rawPatch = jsonPatch.compare(beforePatchCanonical, afterPatchCanonical);
129
129
  const patch = normalizeHistoryPatchOps(beforePatchCanonical, rawPatch);
130
130
  const agentIdentity = resolveHistoryAgentIdentity(params.author);
131
+ const provenanceOutcomes = agentIdentity.harness
132
+ ? Object.fromEntries(Object.entries(diagnoseAgentIdentity().provenance_outcomes).filter(([, outcome]) => outcome.status === "failed"))
133
+ : undefined;
134
+ const context = provenanceOutcomes === undefined || Object.keys(provenanceOutcomes).length === 0
135
+ ? params.context
136
+ : {
137
+ ...params.context,
138
+ agent_provenance_outcomes: provenanceOutcomes,
139
+ };
131
140
  return {
132
141
  ts: params.nowIso,
133
142
  author: params.author,
@@ -151,7 +160,7 @@ export function createHistoryEntry(params) {
151
160
  before_hash: sha256Hex(stableStringify(beforeHashCanonical)),
152
161
  after_hash: sha256Hex(stableStringify(afterHashCanonical)),
153
162
  message: params.message === undefined ? undefined : params.message,
154
- ...(params.context === undefined ? {} : { context: params.context }),
163
+ ...(context === undefined ? {} : { context }),
155
164
  };
156
165
  }
157
166
  function isRecord(value) {
@@ -233,4 +242,4 @@ export const _testOnly = {
233
242
  isDefinedPointerPath,
234
243
  };
235
244
  //# sourceMappingURL=history.js.map
236
- //# debugId=5228a53a-603c-5c9f-870b-8ea8e0c5d27a
245
+ //# debugId=ce2dace3-7c86-5edf-8bda-083a0b3e7f2b
@@ -1,7 +1,13 @@
1
1
  import type { RuntimeStatusRegistry } from "../schema/runtime-schema.js";
2
2
  import type { ItemMetadata, ItemStatus } from "../../types/index.js";
3
+ /** Built-in ordering kinds that must remain reachable by blocker resolution. */
4
+ export declare const ACTIONABILITY_ORDERING_KINDS: readonly string[];
3
5
  /** Collects the blocker item ids declared by an item: the legacy scalar `blocked_by` field plus every `blocked_by` dependency edge. Ids are trimmed, de-duplicated, and returned in stable lexicographic order. This is the single source of truth for "what must close before this item can proceed", shared by `pm next` readiness classification and the close-time auto-unblock sweep. */
4
6
  export declare function collectBlockedByIds(item: Pick<ItemMetadata, "blocked_by" | "dependencies">): string[];
7
+ /** Build every forward and reverse blocker set in one corpus pass. */
8
+ export declare function indexBlockedByIds(corpus: readonly ItemMetadata[]): Map<string, string[]>;
9
+ /** Collect blockers from both an item's forward declarations and corpus-level reverse `blocks` edges. */
10
+ export declare function collectBlockedByIdsFromCorpus(item: ItemMetadata, corpus: readonly ItemMetadata[]): string[];
5
11
  /** A blocker reference resolved against the corpus and annotated with its state. */
6
12
  export interface ResolvedBlocker {
7
13
  /** Stable identifier used to reference this record across commands and storage. */
@@ -13,7 +19,7 @@ export interface ResolvedBlocker {
13
19
  /** True when the blocker no longer gates work because the referenced item is terminal. */
14
20
  resolved: boolean;
15
21
  }
16
- /** Resolves an item's declared blockers against a corpus index, annotating each with the blocker's title/status and whether it still gates work. Unknown ids remain unresolved: silently treating a typo as satisfied would dispatch work whose prerequisite was never completed. Terminal referenced items alone are resolved. */
22
+ /** Resolves an item's blockers against a corpus index with reverse `blocks` support. */
17
23
  export declare function resolveItemBlockers(item: Pick<ItemMetadata, "blocked_by" | "dependencies">, itemsById: Map<string, ItemMetadata>, statusRegistry: RuntimeStatusRegistry): ResolvedBlocker[];
18
24
  /**
19
25
  * Collects the normalized (trimmed, lowercased) ids of every corpus item that is
@@ -10,10 +10,17 @@
10
10
  * `blocked_by` resolution a single source of truth.
11
11
  */
12
12
 
13
- !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]="bf429f76-9722-5e34-a5f0-6ced8d1ed667")}catch(e){}}();
13
+ !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]="de8a82e1-0b02-5d5a-9086-686529a1ccab")}catch(e){}}();
14
14
  import { isTerminalStatus, normalizeStatusForRegistry } from "./status.js";
15
15
  /** Dependency kind that marks "this item is blocked by the referenced item". */
16
16
  const BLOCKED_BY_DEPENDENCY_KIND = "blocked_by";
17
+ /** Reverse dependency kind that marks "this item blocks the referenced item". */
18
+ const BLOCKS_DEPENDENCY_KIND = "blocks";
19
+ /** Built-in ordering kinds that must remain reachable by blocker resolution. */
20
+ export const ACTIONABILITY_ORDERING_KINDS = Object.freeze([
21
+ BLOCKED_BY_DEPENDENCY_KIND,
22
+ BLOCKS_DEPENDENCY_KIND,
23
+ ]);
17
24
  /** Retired placeholder that explicitly means an item has no active blocker. */
18
25
  const NO_ACTIVE_BLOCKER_SENTINEL = "no-active-blocker";
19
26
  /**
@@ -28,23 +35,66 @@ function normalizeItemId(id) {
28
35
  /** Collects the blocker item ids declared by an item: the legacy scalar `blocked_by` field plus every `blocked_by` dependency edge. Ids are trimmed, de-duplicated, and returned in stable lexicographic order. This is the single source of truth for "what must close before this item can proceed", shared by `pm next` readiness classification and the close-time auto-unblock sweep. */
29
36
  export function collectBlockedByIds(item) {
30
37
  const ids = new Set();
31
- const scalar = typeof item.blocked_by === "string" ? item.blocked_by.trim() : "";
32
- if (scalar.length > 0 && scalar.toLowerCase() !== NO_ACTIVE_BLOCKER_SENTINEL) {
38
+ const scalar = typeof item.blocked_by === "string" ? normalizeItemId(item.blocked_by) : "";
39
+ if (scalar.length > 0 && scalar !== NO_ACTIVE_BLOCKER_SENTINEL) {
33
40
  ids.add(scalar);
34
41
  }
35
42
  for (const dependency of item.dependencies ?? []) {
43
+ const dependencyId = typeof dependency.id === "string" ? normalizeItemId(dependency.id) : "";
36
44
  if (dependency.kind === BLOCKED_BY_DEPENDENCY_KIND &&
37
- typeof dependency.id === "string" &&
38
- dependency.id.trim().length > 0 &&
39
- dependency.id.trim().toLowerCase() !== NO_ACTIVE_BLOCKER_SENTINEL) {
40
- ids.add(dependency.id.trim());
45
+ dependencyId.length > 0 &&
46
+ dependencyId !== NO_ACTIVE_BLOCKER_SENTINEL) {
47
+ ids.add(dependencyId);
41
48
  }
42
49
  }
43
50
  return [...ids].sort((left, right) => left.localeCompare(right));
44
51
  }
52
+ /** Build every forward and reverse blocker set in one corpus pass. */
53
+ export function indexBlockedByIds(corpus) {
54
+ const idsByItem = new Map();
55
+ for (const item of corpus) {
56
+ const itemId = normalizeItemId(item.id);
57
+ if (itemId.length === 0)
58
+ continue;
59
+ idsByItem.set(itemId, new Set(collectBlockedByIds(item)));
60
+ }
61
+ for (const candidate of corpus) {
62
+ const candidateId = normalizeItemId(candidate.id);
63
+ if (candidateId.length === 0)
64
+ continue;
65
+ for (const dependency of candidate.dependencies ?? []) {
66
+ const targetId = dependency.kind === BLOCKS_DEPENDENCY_KIND &&
67
+ typeof dependency.id === "string"
68
+ ? normalizeItemId(dependency.id)
69
+ : "";
70
+ if (targetId.length === 0 || targetId === NO_ACTIVE_BLOCKER_SENTINEL) {
71
+ continue;
72
+ }
73
+ const blockerIds = idsByItem.get(targetId) ?? new Set();
74
+ blockerIds.add(candidateId);
75
+ idsByItem.set(targetId, blockerIds);
76
+ }
77
+ }
78
+ return new Map([...idsByItem].map(([itemId, blockerIds]) => [
79
+ itemId,
80
+ [...blockerIds].sort((left, right) => left.localeCompare(right)),
81
+ ]));
82
+ }
83
+ /** Collect blockers from both an item's forward declarations and corpus-level reverse `blocks` edges. */
84
+ export function collectBlockedByIdsFromCorpus(item, corpus) {
85
+ const itemId = normalizeItemId(item.id);
86
+ return itemId.length > 0
87
+ ? (indexBlockedByIds(corpus).get(itemId) ?? collectBlockedByIds(item))
88
+ : collectBlockedByIds(item);
89
+ }
45
90
  /** Resolves an item's declared blockers against a corpus index, annotating each with the blocker's title/status and whether it still gates work. Unknown ids remain unresolved: silently treating a typo as satisfied would dispatch work whose prerequisite was never completed. Terminal referenced items alone are resolved. */
46
- export function resolveItemBlockers(item, itemsById, statusRegistry) {
47
- return collectBlockedByIds(item).map((id) => {
91
+ function resolveItemBlockersWithIndex(item, itemsById, statusRegistry, blockerIdsByItem) {
92
+ const itemWithId = item;
93
+ const blockerIds = typeof itemWithId.id === "string"
94
+ ? (blockerIdsByItem?.get(normalizeItemId(itemWithId.id)) ??
95
+ collectBlockedByIdsFromCorpus(itemWithId, [...itemsById.values()]))
96
+ : collectBlockedByIds(item);
97
+ return blockerIds.map((id) => {
48
98
  const blocker = itemsById.get(normalizeItemId(id));
49
99
  if (!blocker) {
50
100
  return { id, title: null, status: null, resolved: false };
@@ -57,6 +107,10 @@ export function resolveItemBlockers(item, itemsById, statusRegistry) {
57
107
  };
58
108
  });
59
109
  }
110
+ /** Resolves an item's blockers against a corpus index with reverse `blocks` support. */
111
+ export function resolveItemBlockers(item, itemsById, statusRegistry) {
112
+ return resolveItemBlockersWithIndex(item, itemsById, statusRegistry);
113
+ }
60
114
  /**
61
115
  * Collects the normalized (trimmed, lowercased) ids of every corpus item that is
62
116
  * blocked under the single shared edge-aware definition: a non-terminal item
@@ -70,6 +124,7 @@ export function resolveItemBlockers(item, itemsById, statusRegistry) {
70
124
  */
71
125
  export function collectDependencyBlockedIds(corpus, statusRegistry) {
72
126
  const itemsById = new Map(corpus.map((item) => [normalizeItemId(item.id), item]));
127
+ const blockerIdsByItem = indexBlockedByIds(corpus);
73
128
  // Same candidate gate as computeActionabilityReport: active statuses plus
74
129
  // lifecycle-blocked statuses, so the two surfaces classify identically.
75
130
  const candidateStatuses = new Set([
@@ -83,7 +138,7 @@ export function collectDependencyBlockedIds(corpus, statusRegistry) {
83
138
  continue;
84
139
  const lifecycleBlocked = statusRegistry.blocked_statuses.has(normalizedStatus);
85
140
  if (lifecycleBlocked ||
86
- resolveItemBlockers(item, itemsById, statusRegistry).some((blocker) => !blocker.resolved)) {
141
+ resolveItemBlockersWithIndex(item, itemsById, statusRegistry, blockerIdsByItem).some((blocker) => !blocker.resolved)) {
87
142
  blocked.add(normalizeItemId(item.id));
88
143
  }
89
144
  }
@@ -122,6 +177,7 @@ function indexCorpus(corpus) {
122
177
  const itemsById = new Map();
123
178
  const childrenByParent = new Map();
124
179
  const blockedByReverse = new Map();
180
+ const blockerIdsByItem = indexBlockedByIds(corpus);
125
181
  for (const item of corpus) {
126
182
  // Index keys are normalized (lowercased) for case-insensitive resolution;
127
183
  // stored values keep the item's original-case id for display.
@@ -133,14 +189,14 @@ function indexCorpus(corpus) {
133
189
  siblings.push(item);
134
190
  childrenByParent.set(parentKey, siblings);
135
191
  }
136
- for (const blockerId of collectBlockedByIds(item)) {
192
+ for (const blockerId of blockerIdsByItem.get(normalizeItemId(item.id))) {
137
193
  const blockerKey = normalizeItemId(blockerId);
138
194
  const dependents = blockedByReverse.get(blockerKey) ?? [];
139
195
  dependents.push(item.id);
140
196
  blockedByReverse.set(blockerKey, dependents);
141
197
  }
142
198
  }
143
- return { itemsById, childrenByParent, blockedByReverse };
199
+ return { itemsById, childrenByParent, blockedByReverse, blockerIdsByItem };
144
200
  }
145
201
  /**
146
202
  * Partitions a candidate set into ready vs blocked leaf work using the corpus to
@@ -154,7 +210,7 @@ function indexCorpus(corpus) {
154
210
  * the candidate order so the caller can apply its own ranking.
155
211
  */
156
212
  export function computeActionabilityReport(candidates, corpus, statusRegistry) {
157
- const { itemsById, childrenByParent, blockedByReverse } = indexCorpus(corpus);
213
+ const { itemsById, childrenByParent, blockedByReverse, blockerIdsByItem } = indexCorpus(corpus);
158
214
  const activeStatuses = new Set([
159
215
  ...resolveActiveStatusSet(statusRegistry),
160
216
  ...statusRegistry.blocked_statuses,
@@ -176,7 +232,7 @@ export function computeActionabilityReport(candidates, corpus, statusRegistry) {
176
232
  containerCount += 1;
177
233
  continue;
178
234
  }
179
- const openBlockers = resolveItemBlockers(item, itemsById, statusRegistry).filter((blocker) => !blocker.resolved);
235
+ const openBlockers = resolveItemBlockersWithIndex(item, itemsById, statusRegistry, blockerIdsByItem).filter((blocker) => !blocker.resolved);
180
236
  const unblocks = (blockedByReverse.get(normalizeItemId(item.id)) ?? [])
181
237
  .filter((dependentId) => nonTerminalIds.has(normalizeItemId(dependentId)))
182
238
  .sort((left, right) => left.localeCompare(right));
@@ -201,4 +257,4 @@ export function computeActionabilityReport(candidates, corpus, statusRegistry) {
201
257
  };
202
258
  }
203
259
  //# sourceMappingURL=actionability.js.map
204
- //# debugId=bf429f76-9722-5e34-a5f0-6ced8d1ed667
260
+ //# debugId=de8a82e1-0b02-5d5a-9086-686529a1ccab
@@ -19,6 +19,19 @@ export interface AgentProvenanceObservation {
19
19
  * selected harness declared the dimension but exposed no value this run.
20
20
  */
21
21
  export type AgentProvenance = Readonly<Record<string, AgentProvenanceObservation | null>>;
22
+ /** Bounded reason explaining why one declared provenance dimension was absent. */
23
+ export type AgentProvenanceAbsenceReason = "harness_unavailable" | "resolver_failed" | "resolver_not_configured" | "probes_disabled" | "invalid_value";
24
+ /** Machine-readable resolution outcome for one provenance dimension. */
25
+ export interface AgentProvenanceOutcome {
26
+ /** Whether the dimension resolved without retaining private source material. */
27
+ status: "resolved" | "unavailable" | "failed";
28
+ /** Stable bounded reason for absent or rejected values. */
29
+ reason?: AgentProvenanceAbsenceReason;
30
+ /** Resolver name when a bounded local resolver was attempted. */
31
+ resolver?: AgentProvenanceResolver;
32
+ /** Stable inference contract version used by downstream analytics. */
33
+ rule_version: "v1";
34
+ }
22
35
  /** Privacy-bounded MCP client metadata that can participate in agent detection. */
23
36
  export interface AgentClientInfo {
24
37
  /** Client or harness name reported during protocol initialization. */
@@ -72,6 +85,11 @@ export interface DetectedAgentIdentity {
72
85
  /** Stable declared episode identity when the session supplied one. */
73
86
  episode?: AgentEpisodeIdentity;
74
87
  }
88
+ /** Agent identity plus explicit outcomes for every built-in provenance dimension. */
89
+ export interface DiagnosedAgentIdentity extends DetectedAgentIdentity {
90
+ /** Resolution outcomes that distinguish absence from resolver failure. */
91
+ provenance_outcomes: Readonly<Record<string, AgentProvenanceOutcome>>;
92
+ }
75
93
  /** Public, privacy-safe identity resolution result shared by CLI and SDK hosts. */
76
94
  export interface ResolvedAuthorIdentity extends DetectedAgentIdentity {
77
95
  /** Stable author value written to mutation history. */
@@ -126,6 +144,13 @@ export declare function runWithWorkspaceHarnessSignalDescriptors<T>(descriptors:
126
144
  * traversal, or network requests.
127
145
  */
128
146
  export declare function detectAgentIdentity(signals?: HarnessDetectionSignals): DetectedAgentIdentity;
147
+ /**
148
+ * Diagnose provenance without exposing environment values, paths, or probe data.
149
+ *
150
+ * This additive SDK contract keeps legacy `detectAgentIdentity` projections
151
+ * stable while giving health checks and history writers explicit absence states.
152
+ */
153
+ export declare function diagnoseAgentIdentity(signals?: HarnessDetectionSignals): DiagnosedAgentIdentity;
129
154
  /** Reads the invocation-wide author override through the canonical environment seam. */
130
155
  export declare function readAuthorEnvironment(): string | undefined;
131
156
  /** Updates or clears the invocation-wide author override through the canonical environment seam. */
@@ -4,7 +4,7 @@
4
4
  * Provides shared primitives and utilities for Author.
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]="0139d8ef-d286-571f-89f8-7de2f8422f22")}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]="a89b5501-1909-5ea8-b34b-8ca9b4bc5dd5")}catch(e){}}();
8
8
  import { AsyncLocalStorage } from "node:async_hooks";
9
9
  import { createHash } from "node:crypto";
10
10
  import fs from "node:fs";
@@ -31,13 +31,12 @@ export const BUILTIN_HARNESS_SIGNAL_DESCRIPTORS = [
31
31
  session_environment_keys: ["CLAUDE_CODE_SESSION_ID"],
32
32
  provenance_environment_keys: {
33
33
  effort: ["CLAUDE_EFFORT"],
34
- role: ["CLAUDE_CODE_CHILD_SESSION"],
35
34
  },
36
35
  provenance_resolvers: {
37
36
  model: "claude_session_file",
38
37
  version: "claude_session_file",
39
38
  },
40
- provenance_unavailable_dimensions: ["topic"],
39
+ provenance_unavailable_dimensions: ["role", "topic"],
41
40
  argv_markers: ["claude", "claude-code"],
42
41
  client_names: ["claude", "claude-code", "claude code"],
43
42
  },
@@ -192,6 +191,28 @@ function firstEnvironmentValue(env, keys) {
192
191
  return undefined;
193
192
  }
194
193
  function provenanceFromArgv(argv, dimension) {
194
+ const flaggedValue = provenanceFlagValue(argv, dimension);
195
+ if (flaggedValue !== undefined)
196
+ return flaggedValue;
197
+ if (dimension === "topic") {
198
+ return argv
199
+ .slice(0, 16)
200
+ .map((token) => token.trim())
201
+ .find((token) => /^pm-[a-z0-9][a-z0-9-]{2,63}$/u.test(token));
202
+ }
203
+ if (dimension === "role") {
204
+ const command = argv
205
+ .slice(0, 8)
206
+ .map((token) => token.trim().toLowerCase())
207
+ .find((token) => ["claim", "create", "update", "close", "release", "review"].includes(token));
208
+ if (command === "review")
209
+ return "reviewer";
210
+ if (command)
211
+ return "implementer";
212
+ }
213
+ return undefined;
214
+ }
215
+ function provenanceFlagValue(argv, dimension) {
195
216
  const acceptedFlags = dimension === "model"
196
217
  ? ["--model", "--agent-model"]
197
218
  : [`--agent-${dimension}`];
@@ -208,6 +229,21 @@ function provenanceFromArgv(argv, dimension) {
208
229
  }
209
230
  return undefined;
210
231
  }
232
+ const AGENT_ROLE_VALUES = new Set([
233
+ "implementation",
234
+ "implementer",
235
+ "investigator",
236
+ "orchestrator",
237
+ "planner",
238
+ "release-operator",
239
+ "reviewer",
240
+ ]);
241
+ function normalizeProvenanceValue(dimension, value) {
242
+ if (dimension !== "role" || value === undefined)
243
+ return value;
244
+ const normalized = value.trim().toLowerCase().replaceAll(/[_\s]+/gu, "-");
245
+ return AGENT_ROLE_VALUES.has(normalized) ? normalized : undefined;
246
+ }
211
247
  function boundedProvenanceValue(provenance, dimension) {
212
248
  return nonBlank(provenance?.[dimension])?.slice(0, 256);
213
249
  }
@@ -307,7 +343,7 @@ function resolveAgentProvenanceObservation(dimension, signals, env, descriptor,
307
343
  let overrideValue;
308
344
  let argvValue;
309
345
  if (hostResolvedDimensions.has(dimension)) {
310
- overrideValue = nonBlank(env[overrideKey])?.slice(0, 256);
346
+ overrideValue = normalizeProvenanceValue(dimension, nonBlank(env[overrideKey])?.slice(0, 256));
311
347
  argvValue = provenanceFromArgv(signals.argv ?? [], dimension);
312
348
  }
313
349
  const environmentKeysByDimension = {
@@ -321,10 +357,10 @@ function resolveAgentProvenanceObservation(dimension, signals, env, descriptor,
321
357
  const values = [
322
358
  overrideValue,
323
359
  boundedProvenanceValue(sessionContext?.provenance, dimension),
324
- firstEnvironmentValue(env, environmentKeysByDimension[dimension]),
325
- boundedProvenanceValue(clientProvenance, dimension),
326
- boundedProvenanceValue(signals.provenance, dimension),
327
- argvValue,
360
+ normalizeProvenanceValue(dimension, firstEnvironmentValue(env, environmentKeysByDimension[dimension])),
361
+ normalizeProvenanceValue(dimension, boundedProvenanceValue(clientProvenance, dimension)),
362
+ normalizeProvenanceValue(dimension, boundedProvenanceValue(signals.provenance, dimension)),
363
+ normalizeProvenanceValue(dimension, argvValue),
328
364
  resolveProvenanceProbe(dimension, signals, env, descriptor),
329
365
  ];
330
366
  const sources = [
@@ -469,6 +505,75 @@ export function detectAgentIdentity(signals) {
469
505
  ];
470
506
  return Object.fromEntries(entries.filter((entry) => entry[1] !== undefined));
471
507
  }
508
+ function resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEnabled, invalidValue) {
509
+ const resolver = descriptor?.provenance_resolvers[dimension];
510
+ if (identity.provenance?.[dimension]) {
511
+ return {
512
+ status: "resolved",
513
+ ...(resolver ? { resolver } : {}),
514
+ rule_version: "v1",
515
+ };
516
+ }
517
+ if (invalidValue) {
518
+ return {
519
+ status: "unavailable",
520
+ reason: "invalid_value",
521
+ rule_version: "v1",
522
+ };
523
+ }
524
+ if (resolver) {
525
+ const resolverHasInput = resolver === "ai_agent_version"
526
+ ? nonBlank(env.AI_AGENT) !== undefined
527
+ : nonBlank(env.CLAUDE_CODE_SESSION_ID) !== undefined;
528
+ const status = resolverHasInput && probesEnabled ? "failed" : "unavailable";
529
+ const reason = !resolverHasInput
530
+ ? "harness_unavailable"
531
+ : probesEnabled
532
+ ? "resolver_failed"
533
+ : "probes_disabled";
534
+ return { status, reason, resolver, rule_version: "v1" };
535
+ }
536
+ return {
537
+ status: "unavailable",
538
+ reason: descriptor?.provenance_unavailable_dimensions.includes(dimension)
539
+ ? "harness_unavailable"
540
+ : "resolver_not_configured",
541
+ rule_version: "v1",
542
+ };
543
+ }
544
+ /**
545
+ * Diagnose provenance without exposing environment values, paths, or probe data.
546
+ *
547
+ * This additive SDK contract keeps legacy `detectAgentIdentity` projections
548
+ * stable while giving health checks and history writers explicit absence states.
549
+ */
550
+ export function diagnoseAgentIdentity(signals) {
551
+ const effectiveSignals = effectiveHarnessDetectionSignals(signals);
552
+ const identity = detectAgentIdentity(effectiveSignals);
553
+ const descriptor = currentHarnessSignalDescriptors(effectiveSignals.descriptors).find((candidate) => candidate.harness === identity.harness);
554
+ const env = effectiveSignals.env ?? {};
555
+ const probesEnabled = effectiveSignals.probes_enabled !== false &&
556
+ workspaceHarnessSignalsStorage.getStore()?.probesEnabled !== false &&
557
+ !["0", "false", "off"].includes(nonBlank(env.PM_AGENT_PROBES)?.toLowerCase() ?? "");
558
+ const sessionContext = resolveAgentSessionContextFromSignals(effectiveSignals, env);
559
+ const invalidRoleValue = [
560
+ env.PM_AGENT_ROLE,
561
+ sessionContext.provenance?.role,
562
+ firstEnvironmentValue(env, descriptor?.provenance_environment_keys.role),
563
+ effectiveSignals.client_info?.provenance?.role,
564
+ effectiveSignals.provenance?.role,
565
+ provenanceFlagValue(effectiveSignals.argv ?? [], "role"),
566
+ ].some((candidate) => {
567
+ const value = nonBlank(candidate)?.slice(0, 256);
568
+ return (value !== undefined &&
569
+ normalizeProvenanceValue("role", value) === undefined);
570
+ });
571
+ const outcomes = Object.fromEntries(AGENT_PROVENANCE_DIMENSIONS.map((dimension) => [
572
+ dimension,
573
+ resolveProvenanceOutcome(dimension, identity, descriptor, env, probesEnabled, dimension === "role" && invalidRoleValue),
574
+ ]));
575
+ return { ...identity, provenance_outcomes: outcomes };
576
+ }
472
577
  /** Reads the invocation-wide author override through the canonical environment seam. */
473
578
  export function readAuthorEnvironment() {
474
579
  return process.env.PM_AUTHOR;
@@ -575,4 +680,4 @@ export function resolveAuthor(candidate, fallback) {
575
680
  return identity.author;
576
681
  }
577
682
  //# sourceMappingURL=author.js.map
578
- //# debugId=0139d8ef-d286-571f-89f8-7de2f8422f22
683
+ //# debugId=a89b5501-1909-5ea8-b34b-8ca9b4bc5dd5
@@ -7,4 +7,4 @@
7
7
  * blocker or ready-work classifications without storage or rendering side
8
8
  * effects.
9
9
  */
10
- export { collectBlockedByIds, collectDependencyBlockedIds, computeActionabilityReport, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
10
+ export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, type ActionabilityReport, type ActionableEntry, type ResolvedBlocker, } from "../core/item/actionability.js";
@@ -8,7 +8,7 @@
8
8
  * effects.
9
9
  */
10
10
 
11
- !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]="9184e723-8269-5e45-8c6a-52fd02da60e6")}catch(e){}}();
12
- export { collectBlockedByIds, collectDependencyBlockedIds, computeActionabilityReport, resolveItemBlockers, } from "../core/item/actionability.js";
11
+ !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]="cc271a73-9767-54bb-a142-d4d4569e3c6a")}catch(e){}}();
12
+ export { ACTIONABILITY_ORDERING_KINDS, collectBlockedByIds, collectBlockedByIdsFromCorpus, collectDependencyBlockedIds, computeActionabilityReport, indexBlockedByIds, resolveItemBlockers, } from "../core/item/actionability.js";
13
13
  //# sourceMappingURL=actionability.js.map
14
- //# debugId=9184e723-8269-5e45-8c6a-52fd02da60e6
14
+ //# debugId=cc271a73-9767-54bb-a142-d4d4569e3c6a
@@ -114,6 +114,14 @@ export interface ContractsResult {
114
114
  types: string[];
115
115
  fields_by_command: Record<string, string[]>;
116
116
  };
117
+ /** Canonical relationship ontology and accepted compatibility aliases. */
118
+ relationship_kind_contracts?: Array<{
119
+ canonical: string;
120
+ aliases: string[];
121
+ inverse?: string;
122
+ ordering: boolean;
123
+ hierarchy: boolean;
124
+ }>;
117
125
  /** Value that configures or reports extension contracts for this contract. */
118
126
  extension_contracts?: {
119
127
  capabilities: string[];
@@ -4,7 +4,7 @@
4
4
  * Implements the pm contracts 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]="adf76b7b-fc29-5b35-b33a-5ae008cbc8e7")}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]="fc28e3a8-c827-5ccc-918a-12d6bf1a1592")}catch(e){}}();
8
8
  import { EXIT_CODE, SETTINGS_DEFAULTS, PmCliError, activateExtensions, getActiveExtensionRegistrations, loadExtensions, pathExists, commandOptionFlagLabel, resolveCommandOptionPolicyState, resolveItemTypeRegistry, resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, getSettingsPath, resolvePmRoot, readSettings, } from "../runtime-primitives.js";
9
9
  import { buildMcpToolContracts, } from "../../mcp/tool-definitions.js";
10
10
  import { ACTIVITY_COMMANDER_STRING_OPTION_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, AGGREGATE_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_COMMANDER_STRING_OPTION_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLAIM_FLAG_CONTRACTS, CLOSE_TASK_FLAG_CONTRACTS, COMMENTS_FLAG_CONTRACTS, CLOSE_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONFIG_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_COMMANDER_STRING_OPTION_CONTRACTS, CONTEXT_FLAG_CONTRACTS, CREATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, CREATE_COMMANDER_STRING_OPTION_CONTRACTS, CREATE_FLAG_CONTRACTS, DELETE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, DOCS_FLAG_CONTRACTS, EXTENSION_ACTIVATE_FLAG_CONTRACTS, EXTENSION_ADOPT_ALL_FLAG_CONTRACTS, EXTENSION_ADOPT_FLAG_CONTRACTS, EXTENSION_CATALOG_FLAG_CONTRACTS, EXTENSION_DEACTIVATE_FLAG_CONTRACTS, EXTENSION_DESCRIBE_FLAG_CONTRACTS, EXTENSION_DOCTOR_FLAG_CONTRACTS, EXTENSION_EXPLORE_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, EXTENSION_INIT_FLAG_CONTRACTS, EXTENSION_INSTALL_FLAG_CONTRACTS, EXTENSION_MANAGE_FLAG_CONTRACTS, EXTENSION_MIGRATE_FLAG_CONTRACTS, EXTENSION_RELOAD_FLAG_CONTRACTS, EXTENSION_UNINSTALL_FLAG_CONTRACTS, FILES_FLAG_CONTRACTS, GC_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, HISTORY_COMPACT_FLAG_CONTRACTS, HISTORY_REDACT_FLAG_CONTRACTS, HISTORY_REPAIR_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, INSTALL_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, ITEM_COMPLETE_FLAG_CONTRACTS, ITEM_MUTATE_FLAG_CONTRACTS, LEARNINGS_FLAG_CONTRACTS, LIST_COMMANDER_STRING_OPTION_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, MERGE_FLAG_CONTRACTS, NOTES_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PACKAGE_INIT_FLAG_CONTRACTS, PM_EXTENSION_CAPABILITY_CONTRACTS, PM_EXTENSION_POLICY_MODE_CONTRACTS, PM_EXTENSION_POLICY_SURFACE_CONTRACTS, PM_EXTENSION_SANDBOX_PROFILE_CONTRACTS, PM_EXTENSION_SERVICE_NAME_CONTRACTS, PM_EXTENSION_TRUST_MODE_CONTRACTS, PM_OUTPUT_DEGRADATION_STEPS, PLAN_FLAG_CONTRACTS, PM_CORE_COMMAND_NAMES, PM_TOOL_ACTIONS, PM_TOOL_PARAMETERS_SCHEMA, REINDEX_FLAG_CONTRACTS, RELEASE_FLAG_CONTRACTS, RESTORE_FLAG_CONTRACTS, SCHEMA_FLAG_CONTRACTS, PROFILE_FLAG_CONTRACTS, SEARCH_COMMANDER_STRING_OPTION_CONTRACTS, EVAL_FLAG_CONTRACTS, WORKSPACE_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, START_TASK_FLAG_CONTRACTS, PAUSE_TASK_FLAG_CONTRACTS, TELEMETRY_FLAG_CONTRACTS, TEST_ALL_FLAG_CONTRACTS, TEST_FLAG_CONTRACTS, TEST_RUNS_FLAG_CONTRACTS, UPDATE_COMMANDER_REPEATABLE_OPTION_CONTRACTS, UPDATE_COMMANDER_STRING_OPTION_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, UPGRADE_FLAG_CONTRACTS, VALIDATE_FLAG_CONTRACTS, compactFlagAliasContracts, resolvePmCommandOutputBudget, } from "../cli-contracts.js";
@@ -17,6 +17,7 @@ import { resolvePmCommandVisibilityTier, } from "../agent-capability-contracts.j
17
17
  import { PM_ERROR_CODE_CATALOG } from "../generated-error-code-catalog.js";
18
18
  import { resolvePmCommandOutputEnvelope, } from "../output-contracts.js";
19
19
  import { PM_COMMAND_EXIT_OUTCOME_CONTRACTS, resolvePmCommandExitContract, } from "./command-exit-contracts.js";
20
+ import { BUILTIN_RELATIONSHIP_KINDS } from "../relationship-kinds/contract.js";
20
21
  const AGENT_BOOTSTRAP_FLAGS = new Map([
21
22
  [
22
23
  "claim",
@@ -1718,6 +1719,20 @@ function attachRuntimeContractsResult(result, runtime) {
1718
1719
  close_validation_modes: [...GOVERNANCE_CLOSE_VALIDATION_DEFAULT_VALUES],
1719
1720
  workflow_enforcement_modes: [...GOVERNANCE_WORKFLOW_ENFORCEMENT_VALUES],
1720
1721
  };
1722
+ result.relationship_kind_contracts = [
1723
+ ...BUILTIN_RELATIONSHIP_KINDS,
1724
+ ...(runtime.runtimeProbe.registrations?.relationship_kinds ?? []).flatMap((registration) => registration.definitions),
1725
+ ]
1726
+ .sort((left, right) => left.kind.localeCompare(right.kind))
1727
+ .map((definition) => ({
1728
+ canonical: definition.kind,
1729
+ aliases: [...(definition.aliases ?? [])],
1730
+ ...(definition.inverse === undefined
1731
+ ? {}
1732
+ : { inverse: definition.inverse }),
1733
+ ordering: definition.ordering,
1734
+ hierarchy: definition.hierarchy,
1735
+ }));
1721
1736
  }
1722
1737
  function attachSchemaContractsResult(result, selection, schemaContext, extensionCommandContracts) {
1723
1738
  if (selection.flagsOnly || selection.availabilityOnly) {
@@ -1854,4 +1869,4 @@ export const _testOnlyContractsCommand = {
1854
1869
  toRuntimeShortFlagToken,
1855
1870
  };
1856
1871
  //# sourceMappingURL=runtime-contracts.js.map
1857
- //# debugId=adf76b7b-fc29-5b35-b33a-5ae008cbc8e7
1872
+ //# debugId=fc28e3a8-c827-5ccc-918a-12d6bf1a1592
@@ -4,6 +4,6 @@
4
4
  * Defines the shared agent-provenance and CLI-completeness governance surface
5
5
  * exposed by both the focused core entrypoint and the complete SDK barrel.
6
6
  */
7
- export { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, detectAgentIdentity, detectHarnessIdentity, readAuthorEnvironment, registerHarnessSignalDescriptors, resolveAuthorIdentity, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, type AgentClientInfo, type AgentModelSource, type AgentProvenance, type AgentProvenanceObservation, type AuthorSource, type DetectedAgentIdentity, type HarnessDetectionSignals, type HarnessSignalDescriptor, type ResolvedAuthorIdentity, } from "../core/shared/author.js";
7
+ export { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, diagnoseAgentIdentity, detectAgentIdentity, detectHarnessIdentity, readAuthorEnvironment, registerHarnessSignalDescriptors, resolveAuthorIdentity, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, type AgentClientInfo, type AgentModelSource, type AgentProvenance, type AgentProvenanceAbsenceReason, type AgentProvenanceObservation, type AgentProvenanceOutcome, type AuthorSource, type DetectedAgentIdentity, type DiagnosedAgentIdentity, type HarnessDetectionSignals, type HarnessSignalDescriptor, type ResolvedAuthorIdentity, } from "../core/shared/author.js";
8
8
  export { analyzeAgentProvenanceDescriptorCoverage, groupHistoryByEpisode, resolveHistoryEpisodeGroupIdentity, summarizeAgentProvenance, summarizeAgentModelProvenance, type AgentEpisodeGroup, type AgentModelProvenanceCoverage, type AgentProvenanceDimensionCoverage, type AgentProvenanceDescriptorCoverage, } from "./provenance.js";
9
9
  export { analyzeSdkCliParameterCompleteness, type SdkCliActionParameterCoverage, type SdkCliCompletenessContractSource, type SdkCliParameterCoverageEntry, type SdkCliParameterDisposition, } from "./cli-contracts.js";
@@ -5,9 +5,9 @@
5
5
  * exposed by both the focused core entrypoint and the complete SDK barrel.
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]="80b8e2af-4dcf-59e8-bfbf-38124db887bf")}catch(e){}}();
9
- export { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, detectAgentIdentity, detectHarnessIdentity, readAuthorEnvironment, registerHarnessSignalDescriptors, resolveAuthorIdentity, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, } from "../core/shared/author.js";
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]="7442357d-52b9-5461-9ac4-3acd898334da")}catch(e){}}();
9
+ export { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, diagnoseAgentIdentity, detectAgentIdentity, detectHarnessIdentity, readAuthorEnvironment, registerHarnessSignalDescriptors, resolveAuthorIdentity, runWithHarnessDetectionSignals, runWithWorkspaceHarnessSignalDescriptors, writeAuthorEnvironment, } from "../core/shared/author.js";
10
10
  export { analyzeAgentProvenanceDescriptorCoverage, groupHistoryByEpisode, resolveHistoryEpisodeGroupIdentity, summarizeAgentProvenance, summarizeAgentModelProvenance, } from "./provenance.js";
11
11
  export { analyzeSdkCliParameterCompleteness, } from "./cli-contracts.js";
12
12
  //# sourceMappingURL=core-governance.js.map
13
- //# debugId=80b8e2af-4dcf-59e8-bfbf-38124db887bf
13
+ //# debugId=7442357d-52b9-5461-9ac4-3acd898334da
@@ -109,6 +109,8 @@ export interface DepsResult {
109
109
  edge_count: number;
110
110
  /** Counting convention used by edge_count. */
111
111
  edge_basis: "deduplicated_directed";
112
+ /** Stored legacy relationship aliases grouped by spelling across the workspace. */
113
+ legacy_alias_counts?: Record<string, number>;
112
114
  /**
113
115
  * Number of missing entries represented by this result.
114
116
  *