@unbrained/pm-cli 2026.8.9 → 2026.8.11

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 (249) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +142 -80
  3. package/dist/cli/commander-usage.js +94 -17
  4. package/dist/cli/error-guidance.d.ts +10 -0
  5. package/dist/cli/error-guidance.js +76 -25
  6. package/dist/cli/help-json-payload.js +51 -16
  7. package/dist/cli/main.js +11 -6
  8. package/dist/cli/register-assurance.d.ts +8 -0
  9. package/dist/cli/register-assurance.js +52 -0
  10. package/dist/cli/register-files-lookup.js +14 -3
  11. package/dist/cli/register-mutation.js +30 -9
  12. package/dist/cli/register-operations.js +16 -11
  13. package/dist/cli-bundle/bundle-manifest.json +163 -163
  14. package/dist/cli-bundle/chunks/{chunk-RJC7TPF4.js → chunk-2OOU2AFH.js} +2 -2
  15. package/dist/cli-bundle/chunks/chunk-2RA2YTHJ.js +33 -0
  16. package/dist/cli-bundle/chunks/chunk-A2SJGHSI.js +3 -0
  17. package/dist/cli-bundle/chunks/chunk-DSKYD4LG.js +13 -0
  18. package/dist/cli-bundle/chunks/chunk-HC3GM6YY.js +194 -0
  19. package/dist/cli-bundle/chunks/chunk-IUNRVDAI.js +2 -0
  20. package/dist/cli-bundle/chunks/chunk-W7CPZGSB.js +2 -0
  21. package/dist/cli-bundle/chunks/{chunk-YC3UF2IO.js → chunk-WMEZHCFI.js} +66 -60
  22. package/dist/cli-bundle/chunks/{chunk-GMX5YOI3.js → chunk-ZU34C3LH.js} +48 -48
  23. package/dist/cli-bundle/chunks/chunk-ZXOC6HG5.js +5 -0
  24. package/dist/cli-bundle/chunks/{register-list-query-BUE7PTCU.js → register-list-query-HAUXVUPY.js} +8 -8
  25. package/dist/cli-bundle/chunks/register-mutation-7Y5U7ABT.js +20 -0
  26. package/dist/cli-bundle/chunks/register-operations-EQX3DLAZ.js +2 -0
  27. package/dist/cli-bundle/chunks/{register-setup-UQDTNTLJ.js → register-setup-NOCOOWQY.js} +2 -2
  28. package/dist/cli-bundle/focused-chunks/{chunk-KNEHLPBF.js → chunk-23FTGO3W.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/{chunk-6DO4YQWZ.js → chunk-2DL3MRTD.js} +2 -2
  30. package/dist/cli-bundle/focused-chunks/chunk-3AYKXMYX.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/chunk-4AHEC74N.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-MRWVJ3ZG.js → chunk-4H5IA6AV.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-4SV3ZKG3.js +16 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-55BIB6DV.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-6JW6Z2P5.js +8 -0
  36. package/dist/cli-bundle/focused-chunks/chunk-BKPIY34S.js +2 -0
  37. package/dist/cli-bundle/focused-chunks/chunk-D4PIWE6D.js +2 -0
  38. package/dist/cli-bundle/focused-chunks/chunk-DPO7TEFX.js +31 -0
  39. package/dist/cli-bundle/focused-chunks/{chunk-3WVHTUAW.js → chunk-E3KCL7AY.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/chunk-ERAAFLPS.js +153 -0
  41. package/dist/cli-bundle/focused-chunks/chunk-F6E4JZKG.js +2 -0
  42. package/dist/cli-bundle/focused-chunks/chunk-FPSYO5ZG.js +18 -0
  43. package/dist/cli-bundle/focused-chunks/{chunk-73FIJONU.js → chunk-J5EKAIVD.js} +2 -2
  44. package/dist/cli-bundle/focused-chunks/chunk-KDH5OX3D.js +4 -0
  45. package/dist/cli-bundle/focused-chunks/chunk-OJ3LVVIS.js +2 -0
  46. package/dist/cli-bundle/focused-chunks/chunk-TL5M2PAY.js +3 -0
  47. package/dist/cli-bundle/focused-chunks/chunk-UDAZWT25.js +6 -0
  48. package/dist/cli-bundle/focused-chunks/chunk-VABB4L5Y.js +17 -0
  49. package/dist/cli-bundle/main.js +13 -13
  50. package/dist/cli-bundle/sdk-authoring.js +1 -1
  51. package/dist/cli-bundle/sdk-contracts.js +1 -1
  52. package/dist/cli-bundle/sdk-core.js +41 -39
  53. package/dist/cli-bundle/sdk-governance.js +1 -1
  54. package/dist/cli-bundle/sdk-graph.js +1 -1
  55. package/dist/cli-bundle/sdk-merge.js +1 -1
  56. package/dist/cli-bundle/sdk-query.js +1 -1
  57. package/dist/cli-bundle/sdk-runtime.js +1 -1
  58. package/dist/cli-bundle/sdk-testing.js +1 -1
  59. package/dist/cli-bundle/sdk.js +2 -2
  60. package/dist/core/diagnostics/remediation.js +9 -9
  61. package/dist/core/fs/fs-utils.d.ts +10 -0
  62. package/dist/core/fs/fs-utils.js +16 -4
  63. package/dist/core/item/item-format.js +3 -32
  64. package/dist/core/schema/fields-file.d.ts +1 -2
  65. package/dist/core/schema/fields-file.js +4 -11
  66. package/dist/core/schema/runtime-schema.js +3 -10
  67. package/dist/core/schema/status-defs-file.d.ts +1 -2
  68. package/dist/core/schema/status-defs-file.js +4 -32
  69. package/dist/core/schema/status-token.d.ts +2 -0
  70. package/dist/core/schema/status-token.js +32 -0
  71. package/dist/core/schema/type-workflows.d.ts +1 -2
  72. package/dist/core/schema/type-workflows.js +4 -11
  73. package/dist/core/session/session-state.d.ts +47 -0
  74. package/dist/core/session/session-state.js +207 -6
  75. package/dist/core/shared/author.d.ts +8 -2
  76. package/dist/core/shared/author.js +85 -52
  77. package/dist/core/shared/errors.d.ts +12 -0
  78. package/dist/core/shared/errors.js +2 -2
  79. package/dist/core/shared/text-normalization.d.ts +1 -1
  80. package/dist/core/shared/text-normalization.js +2 -2
  81. package/dist/sdk/agent/command-recovery.d.ts +4 -0
  82. package/dist/sdk/agent/command-recovery.js +52 -0
  83. package/dist/sdk/agent/command-suggestions.d.ts +4 -0
  84. package/dist/sdk/agent/command-suggestions.js +67 -0
  85. package/dist/sdk/agent/create-option-policy.d.ts +12 -0
  86. package/dist/sdk/agent/create-option-policy.js +32 -0
  87. package/dist/sdk/agent/item-addressing.d.ts +19 -0
  88. package/dist/sdk/agent/item-addressing.js +208 -0
  89. package/dist/sdk/agent/refusal-reachability.d.ts +40 -0
  90. package/dist/sdk/agent/refusal-reachability.js +72 -0
  91. package/dist/sdk/agent/subcommand-recovery.d.ts +40 -0
  92. package/dist/sdk/agent/subcommand-recovery.js +84 -0
  93. package/dist/sdk/cli-bootstrap.d.ts +9 -1
  94. package/dist/sdk/cli-bootstrap.js +25 -10
  95. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -4
  96. package/dist/sdk/cli-contracts/completeness.js +13 -3
  97. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  98. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  99. package/dist/sdk/cli-contracts/flag-contracts.d.ts +2 -0
  100. package/dist/sdk/cli-contracts/flag-contracts.js +77 -21
  101. package/dist/sdk/cli-contracts/registration-helpers.js +10 -2
  102. package/dist/sdk/cli-contracts/runtime-contracts.js +6 -3
  103. package/dist/sdk/cli-contracts/schemas/assurance-definition.d.ts +513 -0
  104. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +251 -0
  105. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +6 -0
  106. package/dist/sdk/cli-contracts/tool-option-contracts.js +4 -2
  107. package/dist/sdk/cli-contracts/tool-parameter-tables.js +96 -4
  108. package/dist/sdk/cli-contracts/tool-schema.d.ts +2 -2
  109. package/dist/sdk/cli-contracts/tool-schema.js +49 -6
  110. package/dist/sdk/cli-contracts.d.ts +1 -1
  111. package/dist/sdk/cli-contracts.js +3 -3
  112. package/dist/sdk/completion.js +9 -3
  113. package/dist/sdk/config.js +9 -3
  114. package/dist/sdk/context/semantic-session-attribution.d.ts +32 -0
  115. package/dist/sdk/context/semantic-session-attribution.js +83 -0
  116. package/dist/sdk/context-intent-runtime.js +8 -5
  117. package/dist/sdk/context-signal-store.d.ts +34 -0
  118. package/dist/sdk/context-signal-store.js +24 -2
  119. package/dist/sdk/core-governance.d.ts +3 -1
  120. package/dist/sdk/core-governance.js +5 -3
  121. package/dist/sdk/core.d.ts +1 -1
  122. package/dist/sdk/core.js +2 -2
  123. package/dist/sdk/dependency-flag-validation.d.ts +15 -1
  124. package/dist/sdk/dependency-flag-validation.js +54 -2
  125. package/dist/sdk/error-code-catalog.d.ts +13 -0
  126. package/dist/sdk/error-code-catalog.js +35 -2
  127. package/dist/sdk/extension.js +18 -17
  128. package/dist/sdk/files.d.ts +11 -0
  129. package/dist/sdk/files.js +82 -24
  130. package/dist/sdk/generated-error-code-catalog.js +104 -13
  131. package/dist/sdk/governance/assurance-action-contracts.d.ts +7 -0
  132. package/dist/sdk/governance/assurance-action-contracts.js +5 -0
  133. package/dist/sdk/governance/assurance-action.d.ts +70 -0
  134. package/dist/sdk/governance/assurance-action.js +198 -0
  135. package/dist/sdk/governance/assurance-limits.d.ts +7 -0
  136. package/dist/sdk/governance/assurance-limits.js +11 -0
  137. package/dist/sdk/governance/assurance-runtime.d.ts +20 -0
  138. package/dist/sdk/governance/assurance-runtime.js +131 -0
  139. package/dist/sdk/governance/assurance.d.ts +432 -0
  140. package/dist/sdk/governance/assurance.js +689 -0
  141. package/dist/sdk/governance/health.js +14 -7
  142. package/dist/sdk/governance/provenance-health.d.ts +13 -0
  143. package/dist/sdk/governance/provenance-health.js +63 -17
  144. package/dist/sdk/governance/validate-item-reader.d.ts +13 -0
  145. package/dist/sdk/governance/validate-item-reader.js +18 -0
  146. package/dist/sdk/governance/validate.d.ts +2 -2
  147. package/dist/sdk/governance/validate.js +15 -6
  148. package/dist/sdk/graph/run.js +8 -3
  149. package/dist/sdk/index.d.ts +10 -1
  150. package/dist/sdk/index.js +12 -3
  151. package/dist/sdk/lifecycle/claim.js +18 -3
  152. package/dist/sdk/lifecycle/close.js +17 -14
  153. package/dist/sdk/lifecycle/create.d.ts +2 -0
  154. package/dist/sdk/lifecycle/create.js +62 -9
  155. package/dist/sdk/lifecycle/focus.js +13 -3
  156. package/dist/sdk/lifecycle/plan.js +8 -3
  157. package/dist/sdk/lifecycle/update-many.js +39 -27
  158. package/dist/sdk/lifecycle/update.d.ts +6 -1
  159. package/dist/sdk/lifecycle/update.js +47 -10
  160. package/dist/sdk/merge/index.d.ts +1 -1
  161. package/dist/sdk/merge/index.js +3 -3
  162. package/dist/sdk/merge/install.d.ts +4 -0
  163. package/dist/sdk/merge/install.js +28 -16
  164. package/dist/sdk/merge/receipts.d.ts +3 -0
  165. package/dist/sdk/merge/receipts.js +81 -17
  166. package/dist/sdk/output-projection.js +24 -4
  167. package/dist/sdk/provenance.d.ts +38 -0
  168. package/dist/sdk/provenance.js +64 -2
  169. package/dist/sdk/query/context.d.ts +2 -0
  170. package/dist/sdk/query/context.js +24 -10
  171. package/dist/sdk/query/light-metadata.d.ts +3 -0
  172. package/dist/sdk/query/light-metadata.js +19 -0
  173. package/dist/sdk/runtime-extended-actions.js +22 -5
  174. package/dist/sdk/runtime-primitives.d.ts +2 -0
  175. package/dist/sdk/runtime-primitives.js +4 -2
  176. package/dist/sdk/runtime.d.ts +8 -1
  177. package/dist/sdk/runtime.js +37 -28
  178. package/dist/sdk/schema-migration.js +7 -9
  179. package/dist/sdk/similarity-scoring.d.ts +1 -2
  180. package/dist/sdk/similarity-scoring.js +4 -16
  181. package/dist/sdk/telemetry.js +7 -4
  182. package/dist/sdk/traceability/runtime-files-lookup.d.ts +8 -0
  183. package/dist/sdk/traceability/runtime-files-lookup.js +33 -0
  184. package/dist/sdk/traceability/source-traceability.d.ts +102 -0
  185. package/dist/sdk/traceability/source-traceability.js +293 -0
  186. package/dist/sdk/workspace-snapshot.d.ts +4 -0
  187. package/dist/sdk/workspace-snapshot.js +24 -11
  188. package/dist/types.d.ts +8 -2
  189. package/dist/types.js +2 -2
  190. package/docs/AGENT_GUIDE.md +3 -1
  191. package/docs/ASSURANCE.md +132 -0
  192. package/docs/COMMANDS.md +8 -5
  193. package/docs/MERGE_SAFETY.md +7 -5
  194. package/docs/README.md +3 -5
  195. package/docs/READ_OUTPUT_CONTRACTS.md +2 -2
  196. package/docs/RELEASING.md +9 -5
  197. package/docs/SDK.md +44 -8
  198. package/docs/SDK_AGENT_SESSION_CONTEXT.md +43 -6
  199. package/docs/SDK_CONTEXT.md +97 -0
  200. package/docs/SDK_CONTEXT_INTEGRITY.md +18 -3
  201. package/docs/SDK_EVIDENCE_TRACEABILITY.md +39 -1
  202. package/docs/SDK_RUNTIME_BOUNDARIES.md +36 -1
  203. package/docs/TESTING.md +12 -9
  204. package/docs/agent-task-token-baseline.json +2 -2
  205. package/docs/generated/AGENT_COMMAND_SURFACE.md +1 -0
  206. package/marketplace.json +2 -2
  207. package/package.json +7 -6
  208. package/packages/pm-beads/package.json +1 -1
  209. package/packages/pm-calendar/package.json +1 -1
  210. package/packages/pm-command-kit/package.json +1 -1
  211. package/packages/pm-digital-twin/package.json +1 -1
  212. package/packages/pm-governance-audit/package.json +1 -1
  213. package/packages/pm-guide-shell/package.json +1 -1
  214. package/packages/pm-kanban/package.json +1 -1
  215. package/packages/pm-lifecycle-hooks/package.json +1 -1
  216. package/packages/pm-linked-test-adapters/package.json +1 -1
  217. package/packages/pm-search-advanced/package.json +1 -1
  218. package/packages/pm-templates/extensions/templates/index.ts +9 -3
  219. package/packages/pm-templates/package.json +1 -1
  220. package/packages/pm-todos/package.json +1 -1
  221. package/packages/pm-vcs/package.json +1 -1
  222. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  223. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  224. package/sdk/public-surface.json +1028 -48
  225. package/dist/cli-bundle/chunks/chunk-2DTCZXSD.js +0 -13
  226. package/dist/cli-bundle/chunks/chunk-5JO6R4BS.js +0 -3
  227. package/dist/cli-bundle/chunks/chunk-5KN4DZYV.js +0 -194
  228. package/dist/cli-bundle/chunks/chunk-EF43KODO.js +0 -2
  229. package/dist/cli-bundle/chunks/chunk-HUV2Z7IS.js +0 -28
  230. package/dist/cli-bundle/chunks/chunk-MHBVCUF2.js +0 -2
  231. package/dist/cli-bundle/chunks/chunk-PYO5GZU6.js +0 -5
  232. package/dist/cli-bundle/chunks/register-mutation-FC3XLVIK.js +0 -20
  233. package/dist/cli-bundle/chunks/register-operations-YH2WAOXU.js +0 -2
  234. package/dist/cli-bundle/focused-chunks/chunk-2VVP5RAA.js +0 -153
  235. package/dist/cli-bundle/focused-chunks/chunk-3GSFUDAI.js +0 -2
  236. package/dist/cli-bundle/focused-chunks/chunk-4H6MVCK3.js +0 -16
  237. package/dist/cli-bundle/focused-chunks/chunk-54TZJ4BM.js +0 -2
  238. package/dist/cli-bundle/focused-chunks/chunk-5NK5TJ5D.js +0 -2
  239. package/dist/cli-bundle/focused-chunks/chunk-C3GCHDSQ.js +0 -31
  240. package/dist/cli-bundle/focused-chunks/chunk-JGRSQZJT.js +0 -18
  241. package/dist/cli-bundle/focused-chunks/chunk-NL57J7BZ.js +0 -4
  242. package/dist/cli-bundle/focused-chunks/chunk-P6BBIQRG.js +0 -6
  243. package/dist/cli-bundle/focused-chunks/chunk-PZAGVQNN.js +0 -3
  244. package/dist/cli-bundle/focused-chunks/chunk-QDAO3XEK.js +0 -14
  245. package/dist/cli-bundle/focused-chunks/chunk-T4IGQCSY.js +0 -2
  246. package/dist/cli-bundle/focused-chunks/chunk-U46GQJNY.js +0 -2
  247. package/dist/cli-bundle/focused-chunks/chunk-VRXJSGIT.js +0 -8
  248. package/dist/cli-bundle/focused-chunks/chunk-XC2ZW3CJ.js +0 -2
  249. package/dist/cli-bundle/focused-chunks/chunk-ZG54B4XG.js +0 -2
@@ -4,9 +4,11 @@
4
4
  * Resolves configurable schema, fields, statuses, and workflows for Fields File.
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]="79b35844-ab8e-5b6f-9975-4dd85b210bcb")}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]="575b0c3a-9ce1-504f-a24e-d8854e898f17")}catch(e){}}();
8
8
  import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, } from "../../types/index.js";
9
9
  import { ITEM_METADATA_KEY_ORDER } from "../shared/constants.js";
10
+ import { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
11
+ export { normalizeStatusToken as normalizeFieldKey } from "./status-token.js";
10
12
  /**
11
13
  * Pure logic for the `pm schema add-field` / `pm schema remove-field` commands
12
14
  * and the `list-fields` / `show-field` inspectors. The CLI command file
@@ -52,15 +54,6 @@ export const BUILTIN_FIELD_KEYS = new Set([
52
54
  ]);
53
55
  /** The default commands a field is wired onto when `--commands` is omitted, matching the runtime default in runtime-schema.ts (normalizeRuntimeFieldDefinition). */
54
56
  const DEFAULT_FIELD_COMMANDS = ["create", "update"];
55
- /** Normalizes a field key using the same rule as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
56
- export function normalizeFieldKey(value) {
57
- return typeof value === "string"
58
- ? value
59
- .trim()
60
- .toLowerCase()
61
- .replaceAll(/[\s-]+/g, "_")
62
- : "";
63
- }
64
57
  /** Normalizes a CLI flag token: strip a leading `--`, lowercase, and collapse whitespace/underscore runs to a single hyphen (matches normalizeCliToken in runtime-schema.ts). */
65
58
  function normalizeCliToken(value) {
66
59
  if (typeof value !== "string") {
@@ -293,4 +286,4 @@ function applyBooleanFlag(definition, key, value) {
293
286
  }
294
287
  }
295
288
  //# sourceMappingURL=fields-file.js.map
296
- //# debugId=79b35844-ab8e-5b6f-9975-4dd85b210bcb
289
+ //# debugId=575b0c3a-9ce1-504f-a24e-d8854e898f17
@@ -4,11 +4,12 @@
4
4
  * Resolves configurable schema, fields, statuses, and workflows for Runtime Schema.
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]="febba42b-dfd0-549a-a6d9-c30edb321d9d")}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]="a9ff482a-f9f9-5e35-88d0-240db815ec08")}catch(e){}}();
8
8
  import path from "node:path";
9
9
  import { pathExists, readFileIfExists, writeFileAtomic, } from "../fs/fs-utils.js";
10
10
  import { DEFAULT_STATUS_DEFINITIONS, DEFAULT_WORKFLOW_DEFINITION, } from "../shared/constants.js";
11
11
  import { RUNTIME_FIELD_COMMAND_VALUES, RUNTIME_FIELD_TYPE_VALUES, RUNTIME_STATUS_ROLE_VALUES, RUNTIME_UNKNOWN_FIELD_POLICY_VALUES, STATUS_VALUES, } from "../../types/index.js";
12
+ import { normalizeStatusToken } from "./status-token.js";
12
13
  /** Fallback runtime schema file paths used when callers do not provide an override. */
13
14
  export const DEFAULT_RUNTIME_SCHEMA_FILE_PATHS = Object.freeze({
14
15
  types: "schema/types.json",
@@ -39,14 +40,6 @@ function normalizeStringList(values) {
39
40
  .filter((value) => value.length > 0)),
40
41
  ].sort((left, right) => left.localeCompare(right));
41
42
  }
42
- function normalizeStatusToken(value) {
43
- return typeof value === "string"
44
- ? value
45
- .trim()
46
- .toLowerCase()
47
- .replaceAll(/[\s-]+/g, "_")
48
- : "";
49
- }
50
43
  function normalizeStatusId(value) {
51
44
  if (typeof value !== "string" || value.length === 0) {
52
45
  return undefined;
@@ -698,4 +691,4 @@ export function statusIsTerminal(status, registry) {
698
691
  return registry.terminal_statuses.has(normalized);
699
692
  }
700
693
  //# sourceMappingURL=runtime-schema.js.map
701
- //# debugId=febba42b-dfd0-549a-a6d9-c30edb321d9d
694
+ //# debugId=a9ff482a-f9f9-5e35-88d0-240db815ec08
@@ -1,4 +1,5 @@
1
1
  import type { RuntimeStatusDefinition, RuntimeStatusRole } from "../../types/index.js";
2
+ export { normalizeStatusToken } from "./status-token.js";
2
3
  export type { RuntimeStatusDefinition, RuntimeStatusRole, } from "../../types/index.js";
3
4
  /** The 5 lifecycle status ids that ship as built-in defaults and may never be removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS: open/in_progress/blocked/closed/canceled). `draft` is also a default but the acceptance criteria enumerate the 5 terminal/active ids explicitly, so the guard derives the full set from the canonical defaults to stay in sync. */
4
5
  export declare const BUILTIN_STATUS_IDS: ReadonlySet<string>;
@@ -51,8 +52,6 @@ export interface RemoveStatusDefResult {
51
52
  /** The removed definition, when one matched the requested id. */
52
53
  definition?: RuntimeStatusDefinition;
53
54
  }
54
- /** Normalizes a status token using the same rules as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
55
- export declare function normalizeStatusToken(value: unknown): string;
56
55
  /**
57
56
  * Validates and normalizes raw add-status CLI input. Throws a plain Error with a
58
57
  * stable message when the id is missing/empty or a role is not one of
@@ -4,10 +4,11 @@
4
4
  * Resolves configurable schema, fields, statuses, and workflows for Status Defs File.
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]="f81297bd-06ac-5aa4-9e1b-802fb50c9cd0")}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]="3eac0218-43c9-5bd2-8eaf-589d02d2c8ad")}catch(e){}}();
8
8
  import { RUNTIME_STATUS_ROLE_VALUES } from "../../types/index.js";
9
9
  import { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from "./runtime-schema.js";
10
- import { evictOldestMemoEntries } from "../shared/memo.js";
10
+ import { normalizeStatusToken } from "./status-token.js";
11
+ export { normalizeStatusToken } from "./status-token.js";
11
12
  /**
12
13
  * Pure logic for the `pm schema add-status` / `pm schema remove-status`
13
14
  * commands. The CLI command file (schema.ts) owns IO/governance; everything
@@ -20,37 +21,8 @@ import { evictOldestMemoEntries } from "../shared/memo.js";
20
21
  * into the persisted file.
21
22
  */
22
23
  const RUNTIME_STATUS_ROLE_SET = new Set(RUNTIME_STATUS_ROLE_VALUES);
23
- /**
24
- * Memo for {@link normalizeStatusToken}. Status ranking inside sort comparators
25
- * normalizes the same handful of status strings O(n log n) times per corpus scan, and
26
- * the trim/lowercase/regex pipeline shows up in list/next/context profiles. The cap
27
- * bounds memory in long-lived hosts against unbounded arbitrary inputs; half-eviction keeps the
28
- * newest-inserted half when the cap is hit. Declared before
29
- * BUILTIN_STATUS_IDS, whose module-level initializer already normalizes tokens.
30
- */
31
- const STATUS_TOKEN_MEMO_MAX_ENTRIES = 2_000;
32
- const statusTokenMemo = new Map();
33
24
  /** The 5 lifecycle status ids that ship as built-in defaults and may never be removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS: open/in_progress/blocked/closed/canceled). `draft` is also a default but the acceptance criteria enumerate the 5 terminal/active ids explicitly, so the guard derives the full set from the canonical defaults to stay in sync. */
34
25
  export const BUILTIN_STATUS_IDS = new Set(DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition) => normalizeStatusToken(definition.id)).filter((id) => id.length > 0));
35
- /** Normalizes a status token using the same rules as runtime-schema.ts: lowercase and collapse any run of whitespace/hyphens into a single underscore. */
36
- export function normalizeStatusToken(value) {
37
- if (typeof value !== "string") {
38
- return "";
39
- }
40
- const memoized = statusTokenMemo.get(value);
41
- if (memoized !== undefined) {
42
- return memoized;
43
- }
44
- const normalized = value
45
- .trim()
46
- .toLowerCase()
47
- .replaceAll(/[\s-]+/g, "_");
48
- if (statusTokenMemo.size >= STATUS_TOKEN_MEMO_MAX_ENTRIES) {
49
- evictOldestMemoEntries(statusTokenMemo);
50
- }
51
- statusTokenMemo.set(value, normalized);
52
- return normalized;
53
- }
54
26
  function dedupeTokens(values) {
55
27
  const seen = new Set();
56
28
  for (const value of values) {
@@ -250,4 +222,4 @@ export function assertStatusTokensAvailable(input, resolvedAliasToId) {
250
222
  }
251
223
  }
252
224
  //# sourceMappingURL=status-defs-file.js.map
253
- //# debugId=f81297bd-06ac-5aa4-9e1b-802fb50c9cd0
225
+ //# debugId=3eac0218-43c9-5bd2-8eaf-589d02d2c8ad
@@ -0,0 +1,2 @@
1
+ /** Lowercase a status token and collapse whitespace or hyphen runs to one underscore. */
2
+ export declare function normalizeStatusToken(value: unknown): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @module core/schema/status-token
3
+ *
4
+ * Owns the canonical bounded status-token normalization primitive used by
5
+ * schema files, runtime registries, workflows, and package-facing SDK helpers.
6
+ */
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]="d6056922-237d-525a-b354-687493a4e123")}catch(e){}}();
9
+ import { evictOldestMemoEntries } from "../shared/memo.js";
10
+ const STATUS_TOKEN_MEMO_MAX_ENTRIES = 2_000;
11
+ const statusTokenMemo = new Map();
12
+ /** Lowercase a status token and collapse whitespace or hyphen runs to one underscore. */
13
+ export function normalizeStatusToken(value) {
14
+ if (typeof value !== "string") {
15
+ return "";
16
+ }
17
+ const memoized = statusTokenMemo.get(value);
18
+ if (memoized !== undefined) {
19
+ return memoized;
20
+ }
21
+ const normalized = value
22
+ .trim()
23
+ .toLowerCase()
24
+ .replaceAll(/[\s-]+/g, "_");
25
+ if (statusTokenMemo.size >= STATUS_TOKEN_MEMO_MAX_ENTRIES) {
26
+ evictOldestMemoEntries(statusTokenMemo);
27
+ }
28
+ statusTokenMemo.set(value, normalized);
29
+ return normalized;
30
+ }
31
+ //# sourceMappingURL=status-token.js.map
32
+ //# debugId=d6056922-237d-525a-b354-687493a4e123
@@ -4,6 +4,7 @@
4
4
  * Resolves configurable schema, fields, statuses, and workflows for Type Workflows.
5
5
  */
6
6
  import type { RuntimeSchemaSettings } from "../../types/index.js";
7
+ export { normalizeStatusToken } from "./status-token.js";
7
8
  /**
8
9
  * Per-type allowed-transition support (governance.workflow_enforcement).
9
10
  *
@@ -51,8 +52,6 @@ export interface EvaluateTransitionResult {
51
52
  /** Allowed [from, to] pairs for the matched type (normalized ids). Empty when the type is unrestricted. */
52
53
  allowedTransitions: [string, string][];
53
54
  }
54
- /** Normalize a status token the same way runtime-schema statuses are normalized. */
55
- export declare function normalizeStatusToken(value: unknown): string;
56
55
  /**
57
56
  * Normalize the raw type_workflows from a runtime schema into a deduped,
58
57
  * lower-cased-type list with normalized status tokens.
@@ -1,14 +1,7 @@
1
- /** Normalize a status token the same way runtime-schema statuses are normalized. */
2
1
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8370105a-2103-5425-8dd8-b621107f3bd8")}catch(e){}}();
4
- export function normalizeStatusToken(value) {
5
- return typeof value === "string"
6
- ? value
7
- .trim()
8
- .toLowerCase()
9
- .replaceAll(/[\s-]+/g, "_")
10
- : "";
11
- }
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]="c4e316a0-823d-5722-9e15-6d741ae44f1b")}catch(e){}}();
3
+ import { normalizeStatusToken } from "./status-token.js";
4
+ export { normalizeStatusToken } from "./status-token.js";
12
5
  function normalizeTypeName(value) {
13
6
  return typeof value === "string" ? value.trim().toLowerCase() : "";
14
7
  }
@@ -109,4 +102,4 @@ export function describeAllowedTransitions(allowedTransitions) {
109
102
  .join(", ");
110
103
  }
111
104
  //# sourceMappingURL=type-workflows.js.map
112
- //# debugId=8370105a-2103-5425-8dd8-b621107f3bd8
105
+ //# debugId=c4e316a0-823d-5722-9e15-6d741ae44f1b
@@ -9,11 +9,58 @@
9
9
  export interface SessionState {
10
10
  /** Value that configures or reports focused item for this contract. */
11
11
  focused_item?: string;
12
+ /** Privacy-safe semantic work context partitioned by agent invocation. */
13
+ semantic_attribution?: Record<string, AgentSemanticAttribution>;
14
+ }
15
+ /** Bounded inferred work context consumed by mutation provenance. */
16
+ export interface AgentSemanticAttribution {
17
+ /** Controlled role inferred from the current work lifecycle. */
18
+ role: "implementer" | "planner" | "release-operator";
19
+ /** Stable item or workset identity, never prompt text. */
20
+ topic: string;
21
+ /** Confidence attached to the inferred observation. */
22
+ confidence: "high" | "medium";
23
+ /** Versioned inference rule understood by history consumers. */
24
+ rule_version: "v2";
25
+ /** Bounded item and lineage references supporting the inference. */
26
+ evidence: string[];
27
+ /** Claimed items currently contributing to the workset. */
28
+ active_item_ids: string[];
29
+ /** Explicitly focused item when focus takes precedence over claims. */
30
+ focused_item_id?: string;
12
31
  }
13
32
  /** Implements get session state path for the public runtime surface of this module. */
14
33
  export declare function getSessionStatePath(pmRoot: string): string;
15
34
  /** Implements read session state for the public runtime surface of this module. */
16
35
  export declare function readSessionState(pmRoot: string): Promise<SessionState>;
36
+ /** Derive a non-secret state key from a claim principal. */
37
+ export declare function semanticAttributionKey(principal: string): string;
38
+ /** Record a successful claim as incremental semantic session evidence. */
39
+ export declare function recordClaimedWorkAttribution(params: {
40
+ pmRoot: string;
41
+ principal: string;
42
+ itemId: string;
43
+ lineageIds?: readonly string[];
44
+ }): Promise<void>;
45
+ /** Remove a released item from incremental semantic session evidence. */
46
+ export declare function releaseClaimedWorkAttribution(params: {
47
+ pmRoot: string;
48
+ principal: string;
49
+ itemId: string;
50
+ }): Promise<void>;
51
+ /** Set or clear focus as the highest-confidence semantic topic. */
52
+ export declare function recordFocusedWorkAttribution(params: {
53
+ pmRoot: string;
54
+ principal: string;
55
+ itemId?: string;
56
+ lineageIds?: readonly string[];
57
+ }): Promise<void>;
58
+ /** Read one privacy-bounded inferred attribution without making mutations fail. */
59
+ export declare function readAgentSemanticAttributionSync(params: {
60
+ cwd: string;
61
+ env: Readonly<Record<string, string | undefined>>;
62
+ key: string | undefined;
63
+ }): AgentSemanticAttribution | undefined;
17
64
  /** Implements get focused item for the public runtime surface of this module. */
18
65
  export declare function getFocusedItem(pmRoot: string): Promise<string | undefined>;
19
66
  /** Implements set focused item for the public runtime surface of this module. */
@@ -4,12 +4,57 @@
4
4
  * Maintains lightweight agent session state for contextual workflows.
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]="611f01b6-0c72-5ea2-a44f-78877c69706c")}catch(e){}}();
8
- import { promises as fs } from "node:fs";
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]="424b9eb3-6b34-5ab0-a3f5-db61fbca12cf")}catch(e){}}();
8
+ import { createHash } from "node:crypto";
9
+ import { existsSync, promises as fs, readFileSync } from "node:fs";
9
10
  import path from "node:path";
10
11
  import { writeFileAtomic } from "../fs/fs-utils.js";
11
12
  import { getRuntimePath } from "../store/paths.js";
12
13
  const SESSION_FILENAME = "session.json";
14
+ function isBoundedNonEmptyString(value, maximum) {
15
+ return (typeof value === "string" && value.length > 0 && value.length <= maximum);
16
+ }
17
+ function parseSemanticAttribution(value) {
18
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
19
+ return undefined;
20
+ }
21
+ const record = value;
22
+ const validRole = ["implementer", "planner", "release-operator"].includes(String(record.role));
23
+ const validConfidence = ["high", "medium"].includes(String(record.confidence));
24
+ const validTopic = isBoundedNonEmptyString(record.topic, 256);
25
+ const validEvidence = Array.isArray(record.evidence) &&
26
+ record.evidence.length <= 32 &&
27
+ record.evidence.every((entry) => typeof entry === "string" && entry.length <= 128);
28
+ const validActiveItems = Array.isArray(record.active_item_ids) &&
29
+ record.active_item_ids.length <= 64 &&
30
+ record.active_item_ids.every((entry) => isBoundedNonEmptyString(entry, 128));
31
+ const validFocus = record.focused_item_id === undefined ||
32
+ isBoundedNonEmptyString(record.focused_item_id, 128);
33
+ if (![
34
+ validRole,
35
+ validConfidence,
36
+ validTopic,
37
+ validEvidence,
38
+ validActiveItems,
39
+ validFocus,
40
+ record.rule_version === "v2",
41
+ ].every(Boolean)) {
42
+ return undefined;
43
+ }
44
+ return record;
45
+ }
46
+ function parseSemanticAttributionMap(value) {
47
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
48
+ return undefined;
49
+ }
50
+ const entries = Object.entries(value)
51
+ .slice(0, 128)
52
+ .flatMap(([key, attribution]) => {
53
+ const parsed = parseSemanticAttribution(attribution);
54
+ return parsed && key.length <= 128 ? [[key, parsed]] : [];
55
+ });
56
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
57
+ }
13
58
  /** Implements get session state path for the public runtime surface of this module. */
14
59
  export function getSessionStatePath(pmRoot) {
15
60
  return path.join(getRuntimePath(pmRoot), SESSION_FILENAME);
@@ -24,11 +69,20 @@ export async function readSessionState(pmRoot) {
24
69
  Array.isArray(parsed)) {
25
70
  return {};
26
71
  }
27
- const focused = parsed.focused_item;
72
+ const record = parsed;
73
+ const focused = record.focused_item;
74
+ const semanticAttribution = parseSemanticAttributionMap(record.semantic_attribution);
28
75
  if (typeof focused === "string" && focused.trim().length > 0) {
29
- return { focused_item: focused };
76
+ return {
77
+ focused_item: focused,
78
+ ...(semanticAttribution
79
+ ? { semantic_attribution: semanticAttribution }
80
+ : {}),
81
+ };
30
82
  }
31
- return {};
83
+ return semanticAttribution
84
+ ? { semantic_attribution: semanticAttribution }
85
+ : {};
32
86
  }
33
87
  catch {
34
88
  return {};
@@ -39,6 +93,153 @@ async function writeSessionState(pmRoot, state) {
39
93
  await fs.mkdir(path.dirname(target), { recursive: true });
40
94
  await writeFileAtomic(target, JSON.stringify(state));
41
95
  }
96
+ /** Derive a non-secret state key from a claim principal. */
97
+ export function semanticAttributionKey(principal) {
98
+ const instance = /#([a-f0-9]{24})$/u.exec(principal.trim())?.[1];
99
+ return (instance ??
100
+ `author-${createHash("sha256").update(principal).digest("hex").slice(0, 24)}`);
101
+ }
102
+ function normalizedEvidence(values) {
103
+ return [...new Set(values.map((value) => value.trim()).filter(Boolean))]
104
+ .slice(0, 32)
105
+ .map((value) => value.slice(0, 128));
106
+ }
107
+ function worksetTopic(activeItemIds) {
108
+ const ids = [...new Set(activeItemIds)].sort((left, right) => left.localeCompare(right));
109
+ if (ids.length === 1)
110
+ return ids[0];
111
+ const complete = `workset:${ids.join("+")}`;
112
+ if (complete.length <= 256)
113
+ return complete;
114
+ const visible = ids.join("+").slice(0, 230);
115
+ return `workset:${visible}+${createHash("sha256").update(ids.join("\0")).digest("hex").slice(0, 12)}`;
116
+ }
117
+ async function updateSemanticAttribution(pmRoot, key, mutate) {
118
+ const state = await readSessionState(pmRoot);
119
+ const attributions = { ...state.semantic_attribution };
120
+ const next = mutate(attributions[key]);
121
+ if (next === undefined)
122
+ delete attributions[key];
123
+ else
124
+ attributions[key] = next;
125
+ const nextState = { ...state };
126
+ if (Object.keys(attributions).length === 0) {
127
+ delete nextState.semantic_attribution;
128
+ }
129
+ else {
130
+ nextState.semantic_attribution = attributions;
131
+ }
132
+ await writeSessionState(pmRoot, nextState);
133
+ }
134
+ /** Record a successful claim as incremental semantic session evidence. */
135
+ export async function recordClaimedWorkAttribution(params) {
136
+ const key = semanticAttributionKey(params.principal);
137
+ await updateSemanticAttribution(params.pmRoot, key, (current) => {
138
+ const activeItemIds = [
139
+ ...new Set([...(current?.active_item_ids ?? []), params.itemId]),
140
+ ]
141
+ .slice(-64)
142
+ .sort((left, right) => left.localeCompare(right));
143
+ const focusedItemId = current?.focused_item_id;
144
+ return {
145
+ role: "implementer",
146
+ topic: focusedItemId ?? worksetTopic(activeItemIds),
147
+ confidence: focusedItemId ? "high" : "medium",
148
+ rule_version: "v2",
149
+ evidence: normalizedEvidence([
150
+ ...activeItemIds.map((id) => `claim:${id}`),
151
+ ...(focusedItemId ? [`focus:${focusedItemId}`] : []),
152
+ ...(params.lineageIds ?? []).map((id) => `lineage:${id}`),
153
+ ]),
154
+ active_item_ids: activeItemIds,
155
+ ...(focusedItemId ? { focused_item_id: focusedItemId } : {}),
156
+ };
157
+ });
158
+ }
159
+ /** Remove a released item from incremental semantic session evidence. */
160
+ export async function releaseClaimedWorkAttribution(params) {
161
+ const key = semanticAttributionKey(params.principal);
162
+ await updateSemanticAttribution(params.pmRoot, key, (current) => {
163
+ if (!current)
164
+ return undefined;
165
+ const activeItemIds = current.active_item_ids.filter((id) => id !== params.itemId);
166
+ if (activeItemIds.length === 0 && !current.focused_item_id)
167
+ return undefined;
168
+ const focusedItemId = current.focused_item_id;
169
+ return {
170
+ ...current,
171
+ role: "release-operator",
172
+ topic: focusedItemId ?? worksetTopic(activeItemIds),
173
+ confidence: focusedItemId ? "high" : "medium",
174
+ evidence: normalizedEvidence([
175
+ ...activeItemIds.map((id) => `claim:${id}`),
176
+ ...(focusedItemId ? [`focus:${focusedItemId}`] : []),
177
+ `release:${params.itemId}`,
178
+ ]),
179
+ active_item_ids: activeItemIds,
180
+ };
181
+ });
182
+ }
183
+ /** Set or clear focus as the highest-confidence semantic topic. */
184
+ export async function recordFocusedWorkAttribution(params) {
185
+ const key = semanticAttributionKey(params.principal);
186
+ await updateSemanticAttribution(params.pmRoot, key, (current) => {
187
+ const activeItemIds = current?.active_item_ids ?? [];
188
+ if (!params.itemId && activeItemIds.length === 0)
189
+ return undefined;
190
+ const focusedItemId = params.itemId;
191
+ return {
192
+ role: focusedItemId ? "planner" : current.role,
193
+ topic: focusedItemId ?? worksetTopic(activeItemIds),
194
+ confidence: focusedItemId ? "high" : "medium",
195
+ rule_version: "v2",
196
+ evidence: normalizedEvidence([
197
+ ...activeItemIds.map((id) => `claim:${id}`),
198
+ ...(focusedItemId ? [`focus:${focusedItemId}`] : []),
199
+ ...(params.lineageIds ?? []).map((id) => `lineage:${id}`),
200
+ ]),
201
+ active_item_ids: activeItemIds,
202
+ ...(focusedItemId ? { focused_item_id: focusedItemId } : {}),
203
+ };
204
+ });
205
+ }
206
+ function resolveAttributionRoot(cwd, env) {
207
+ const configured = env.PM_PATH?.trim();
208
+ if (configured) {
209
+ const resolved = path.resolve(cwd, configured);
210
+ if (existsSync(path.join(resolved, "settings.json")))
211
+ return resolved;
212
+ const nested = path.join(resolved, ".agents", "pm");
213
+ if (existsSync(path.join(nested, "settings.json")))
214
+ return nested;
215
+ }
216
+ let cursor = path.resolve(cwd);
217
+ for (let depth = 0; depth < 32; depth += 1) {
218
+ const candidate = path.join(cursor, ".agents", "pm");
219
+ if (existsSync(path.join(candidate, "settings.json")))
220
+ return candidate;
221
+ const parent = path.dirname(cursor);
222
+ if (parent === cursor)
223
+ break;
224
+ cursor = parent;
225
+ }
226
+ return undefined;
227
+ }
228
+ /** Read one privacy-bounded inferred attribution without making mutations fail. */
229
+ export function readAgentSemanticAttributionSync(params) {
230
+ if (!params.key)
231
+ return undefined;
232
+ const pmRoot = resolveAttributionRoot(params.cwd, params.env);
233
+ if (!pmRoot)
234
+ return undefined;
235
+ try {
236
+ const parsed = JSON.parse(readFileSync(getSessionStatePath(pmRoot), "utf8"));
237
+ return parseSemanticAttribution(parsed.semantic_attribution?.[params.key]);
238
+ }
239
+ catch {
240
+ return undefined;
241
+ }
242
+ }
42
243
  /** Implements get focused item for the public runtime surface of this module. */
43
244
  export async function getFocusedItem(pmRoot) {
44
245
  const state = await readSessionState(pmRoot);
@@ -57,4 +258,4 @@ export async function clearFocusedItem(pmRoot) {
57
258
  await writeSessionState(pmRoot, next);
58
259
  }
59
260
  //# sourceMappingURL=session-state.js.map
60
- //# debugId=611f01b6-0c72-5ea2-a44f-78877c69706c
261
+ //# debugId=424b9eb3-6b34-5ab0-a3f5-db61fbca12cf
@@ -2,7 +2,7 @@ import { type AgentEpisodeIdentity, type AgentSessionContext } from "./agent-ses
2
2
  /** Stable provenance categories recorded beside newly appended history authors. */
3
3
  export type AuthorSource = "asserted" | "configured" | "detected" | "unknown";
4
4
  /** Stable source categories for model observations recorded in mutation history. */
5
- export type AgentModelSource = "override" | "environment" | "mcp_client" | "argv" | "host" | "session" | "probe";
5
+ export type AgentModelSource = "override" | "environment" | "mcp_client" | "argv" | "host" | "session" | "probe" | "inferred";
6
6
  /** Stable built-in provenance dimensions understood by the default runtime. */
7
7
  export declare const AGENT_PROVENANCE_DIMENSIONS: readonly ["model", "effort", "role", "topic", "version"];
8
8
  /** Built-in, bounded local resolver names accepted by harness descriptors. */
@@ -13,6 +13,12 @@ export interface AgentProvenanceObservation {
13
13
  value: string;
14
14
  /** Signal class that supplied the value. */
15
15
  source: AgentModelSource;
16
+ /** Confidence attached to a semantic inference. */
17
+ confidence?: "high" | "medium" | "low";
18
+ /** Versioned inference rule when the value was derived. */
19
+ rule_version?: "v2";
20
+ /** Bounded item and lineage references supporting an inference. */
21
+ evidence?: readonly string[];
16
22
  }
17
23
  /**
18
24
  * Extensible provenance dimensions. A null value explicitly means that the
@@ -24,7 +30,7 @@ export type AgentProvenanceAbsenceReason = "harness_unavailable" | "resolver_fai
24
30
  /** Machine-readable resolution outcome for one provenance dimension. */
25
31
  export interface AgentProvenanceOutcome {
26
32
  /** Whether the dimension resolved without retaining private source material. */
27
- status: "resolved" | "unavailable" | "failed";
33
+ status: "resolved" | "unavailable" | "not_configured" | "failed";
28
34
  /** Stable bounded reason for absent or rejected values. */
29
35
  reason?: AgentProvenanceAbsenceReason;
30
36
  /** Resolver name when a bounded local resolver was attempted. */