@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
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1f6a4ff8-fc1e-5aac-8117-bae8f325b275")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6162845d-f4b4-5d1f-a210-ddef1a5c38f6")}catch(e){}}();
3
3
  import { AGENT_PROVENANCE_DIMENSIONS, BUILTIN_HARNESS_SIGNAL_DESCRIPTORS, } from "../core/shared/author.js";
4
4
  /** Resolve the declared or deterministic legacy identity for one history event. */
5
5
  export function resolveHistoryEpisodeGroupIdentity(entry) {
@@ -144,6 +144,68 @@ export function summarizeAgentProvenance(entries, dimensions = AGENT_PROVENANCE_
144
144
  .sort((left, right) => left.harness.localeCompare(right.harness) ||
145
145
  left.dimension.localeCompare(right.dimension));
146
146
  }
147
+ /**
148
+ * Measure role/topic availability by harness and precedence source, then apply
149
+ * an explicit ratchet. Empty or synthetic corpora therefore remain useful
150
+ * negative controls instead of silently passing a production coverage gate.
151
+ */
152
+ export function evaluateSemanticAttributionCoverage(entries, options = {}) {
153
+ const minimumCoverage = options.minimumCoverage ?? 0.8;
154
+ const minimumEntries = options.minimumEntries ?? 5;
155
+ if (![
156
+ Number.isFinite(minimumCoverage),
157
+ minimumCoverage >= 0,
158
+ minimumCoverage <= 1,
159
+ ].every(Boolean)) {
160
+ throw new RangeError("Semantic attribution minimum coverage must be from 0 to 1.");
161
+ }
162
+ if (![Number.isSafeInteger(minimumEntries), minimumEntries >= 1].every(Boolean)) {
163
+ throw new RangeError("Semantic attribution minimum entries must be a positive integer.");
164
+ }
165
+ const rows = new Map();
166
+ for (const entry of entries) {
167
+ if (!entry.agent_harness)
168
+ continue;
169
+ for (const dimension of ["role", "topic"]) {
170
+ const key = `${entry.agent_harness}\0${dimension}`;
171
+ const row = rows.get(key) ?? {
172
+ harness: entry.agent_harness,
173
+ dimension,
174
+ entries: 0,
175
+ observed: 0,
176
+ by_source: {},
177
+ coverage: 0,
178
+ };
179
+ row.entries += 1;
180
+ const observation = entry.agent_provenance?.[dimension];
181
+ if (observation?.value) {
182
+ row.observed += 1;
183
+ row.by_source[observation.source] =
184
+ (row.by_source[observation.source] ?? 0) + 1;
185
+ }
186
+ rows.set(key, row);
187
+ }
188
+ }
189
+ const ordered = [...rows.values()]
190
+ .map((row) => ({
191
+ ...row,
192
+ coverage: row.observed / row.entries,
193
+ by_source: Object.fromEntries(Object.entries(row.by_source).sort(([left], [right]) => left.localeCompare(right))),
194
+ }))
195
+ .sort((left, right) => left.harness.localeCompare(right.harness) ||
196
+ left.dimension.localeCompare(right.dimension));
197
+ const eligible = ordered.filter((row) => row.entries >= minimumEntries);
198
+ const failures = eligible
199
+ .filter((row) => row.coverage < minimumCoverage)
200
+ .map((row) => `${row.harness}:${row.dimension}`);
201
+ return {
202
+ passed: eligible.length > 0 && failures.length === 0,
203
+ minimum_coverage: minimumCoverage,
204
+ minimum_entries: minimumEntries,
205
+ rows: ordered,
206
+ failures,
207
+ };
208
+ }
147
209
  /**
148
210
  * Group immutable history by declared episode keys. Legacy entries fall back
149
211
  * to their privacy-safe agent instance, or to a deterministic author cohort.
@@ -194,4 +256,4 @@ export function groupHistoryByEpisode(entries) {
194
256
  return roots;
195
257
  }
196
258
  //# sourceMappingURL=provenance.js.map
197
- //# debugId=1f6a4ff8-fc1e-5aac-8117-bae8f325b275
259
+ //# debugId=6162845d-f4b4-5d1f-a210-ddef1a5c38f6
@@ -362,6 +362,8 @@ export interface ContextResult {
362
362
  focus_fields?: string[];
363
363
  /** Value that configures or reports warnings for this contract. */
364
364
  warnings?: string[];
365
+ /** Actionable recovery contracts for context signal-store warnings. */
366
+ warning_details?: ContextSignalStoreReadResult["warning_details"];
365
367
  /** Value that configures or reports ranking for this contract. */
366
368
  ranking?: ContextRankingSummary;
367
369
  /** Token-budget selection and projection accounting for ranked focus rows. */
@@ -4,7 +4,7 @@
4
4
  * Implements the pm context 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]="dbcd4e0e-3fa0-5ce9-8bbc-6de05779d729")}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]="757a0349-9fb6-579d-ab29-fabaad790ce4")}catch(e){}}();
8
8
  import { SETTINGS_DEFAULTS, EXIT_CODE, PmCliError, compareTimestampStrings, nowIso, isTerminalStatus, normalizeStatusForRegistry, normalizeStatusInput, resolveRuntimeStatusRegistry, resolvePmRoot, readSettings, resolveAuthor, discoverExtensions, } from "../runtime-primitives.js";
9
9
  import { collectDependencyBlockedIds, resolveItemBlockers, } from "../actionability.js";
10
10
  import { CONTEXT_DEPTH_VALUES, CONTEXT_SECTION_VALUES, } from "../../types/index.js";
@@ -20,6 +20,9 @@ import { packContextCandidates, } from "../context-packing.js";
20
20
  import { readContextUsageAffinity, recordContextUsageServing, } from "../context-usage.js";
21
21
  import { readWorkspaceContextSignals, } from "../context-signal-store.js";
22
22
  import { readWorkspaceMemory, selectWorkspaceMemory, } from "../workspace-memory.js";
23
+ import { detectAgentIdentity } from "../../core/shared/author.js";
24
+ import { readSessionState, semanticAttributionKey, } from "../../core/session/session-state.js";
25
+ import { semanticAttributionAffinity } from "../context/semantic-session-attribution.js";
23
26
  // ---------------------------------------------------------------------------
24
27
  // Output format
25
28
  // ---------------------------------------------------------------------------
@@ -1223,7 +1226,7 @@ function resolveContextSubtreeIds(parentScope, fullCorpus) {
1223
1226
  }
1224
1227
  return subtree.ids;
1225
1228
  }
1226
- async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpus, blockedIds, statusRegistry, sectionsIncluded, limit, now, author, cursor, cursorFingerprint, useBoundedPage, pmRoot, tokenBudget) {
1229
+ async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpus, blockedIds, statusRegistry, sectionsIncluded, limit, now, author, cursor, cursorFingerprint, useBoundedPage, pmRoot, tokenBudget, claimFocus) {
1227
1230
  const structural = [...listedItemMetadata].sort((left, right) => compareCriticalItems(left, right, statusRegistry));
1228
1231
  const usage = await readContextUsageAffinity({
1229
1232
  pmRoot,
@@ -1237,6 +1240,7 @@ async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpu
1237
1240
  now,
1238
1241
  author,
1239
1242
  usageAffinity: usage.affinity,
1243
+ claimFocus,
1240
1244
  });
1241
1245
  const ranking = await scoreContextCandidatesWithActiveExtensions("context", featureStore.candidates);
1242
1246
  const ranked = ranking.ranked.map((entry) => entry.item);
@@ -1262,7 +1266,9 @@ async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpu
1262
1266
  const packing = packRankedContextItems({
1263
1267
  ...ranking,
1264
1268
  ranked: ranking.ranked.filter((entry) => packingIds.has(entry.id)),
1265
- }, tokenBudget);
1269
+ }, tokenBudget, new Set(Object.entries(claimFocus ?? {})
1270
+ .filter(([, affinity]) => affinity >= 1)
1271
+ .map(([id]) => id)));
1266
1272
  const packedItems = packing.included.map((entry) => entry.item);
1267
1273
  const activeItems = packedItems.filter((item) => activeStatuses.has(normalizeStatusForRegistry(item.status, statusRegistry)));
1268
1274
  const blockedItems = packedItems.filter((item) => blockedIds.has(item.id.trim().toLowerCase()));
@@ -1297,9 +1303,7 @@ async function resolveContextFocusGroups(listedItemMetadata, allItems, fullCorpu
1297
1303
  highLevel,
1298
1304
  lowLevel,
1299
1305
  blockedFallback: blockedFallbackUsed
1300
- ? blockedItems
1301
- .slice(0, limit)
1302
- .map(projectFocusItem)
1306
+ ? blockedItems.slice(0, limit).map(projectFocusItem)
1303
1307
  : [],
1304
1308
  blockedFallbackUsed,
1305
1309
  ranking,
@@ -1412,7 +1416,7 @@ function buildContextSummaryExtras(needsAllItems, allItems, statusRegistry) {
1412
1416
  canceledStatus).length,
1413
1417
  };
1414
1418
  }
1415
- function attachOptionalContextSections(result, sections) {
1419
+ function attachOptionalContextSections(result, sections, warningDetails) {
1416
1420
  if (sections.hierarchy)
1417
1421
  result.hierarchy = sections.hierarchy;
1418
1422
  if (sections.activity)
@@ -1433,6 +1437,9 @@ function attachOptionalContextSections(result, sections) {
1433
1437
  result.staleness = sections.staleness;
1434
1438
  if (sections.tests)
1435
1439
  result.tests = sections.tests;
1440
+ if (warningDetails !== undefined && warningDetails.length > 0) {
1441
+ result.warning_details = warningDetails;
1442
+ }
1436
1443
  }
1437
1444
  function applyContextFocusProjection(result, focusFields) {
1438
1445
  if (!focusFields) {
@@ -1551,6 +1558,12 @@ export async function resolveContextExtensionHealthProjection(omitted, pmRoot, s
1551
1558
  },
1552
1559
  };
1553
1560
  }
1561
+ async function resolveContextSemanticAffinity(pmRoot, author) {
1562
+ const identity = detectAgentIdentity();
1563
+ const semanticState = await readSessionState(pmRoot);
1564
+ const attributionKey = identity.instance || semanticAttributionKey(author);
1565
+ return semanticAttributionAffinity(semanticState.semantic_attribution?.[attributionKey]);
1566
+ }
1554
1567
  /** Implements run context for the public runtime surface of this module. */
1555
1568
  export async function runContext(options, global) {
1556
1569
  const pmRoot = resolvePmRoot(process.cwd(), global.path);
@@ -1563,11 +1576,12 @@ export async function runContext(options, global) {
1563
1576
  tokenBudget: resolveContextTokenBudget(options.tokenBudget, Math.max(256, scaledLimit * 160)),
1564
1577
  };
1565
1578
  const author = resolveAuthor(undefined, runtime.settings.author_default);
1579
+ const claimFocus = await resolveContextSemanticAffinity(pmRoot, author);
1566
1580
  const extensionHealthPromise = resolveContextExtensionHealthProjection(options.noExtensionHealth === true, pmRoot, runtime.settings);
1567
1581
  // Single shared edge-aware blocked classification (GH-578): resolved against
1568
1582
  // the full corpus so terminal blocker targets count as satisfied at every depth.
1569
1583
  const blockedIds = collectDependencyBlockedIds(corpus.fullCorpus, runtime.statusRegistry);
1570
- const focusGroups = await resolveContextFocusGroups(corpus.listedItemMetadata, corpus.allItems, corpus.fullCorpus, blockedIds, runtime.statusRegistry, runtime.sectionsIncluded, runtime.limit, nowIso(), author, options.after, buildContextCursorFingerprint(options), shouldPageContextFocus(options, corpus.fullCorpus.length), pmRoot, runtime.tokenBudget);
1584
+ const focusGroups = await resolveContextFocusGroups(corpus.listedItemMetadata, corpus.allItems, corpus.fullCorpus, blockedIds, runtime.statusRegistry, runtime.sectionsIncluded, runtime.limit, nowIso(), author, options.after, buildContextCursorFingerprint(options), shouldPageContextFocus(options, corpus.fullCorpus.length), pmRoot, runtime.tokenBudget, claimFocus);
1571
1585
  const agendaContext = await buildContextAgenda(global, runtime, corpus.subtreeIds, new Set([
1572
1586
  ...focusGroups.highLevel,
1573
1587
  ...focusGroups.lowLevel,
@@ -1642,7 +1656,7 @@ export async function runContext(options, global) {
1642
1656
  };
1643
1657
  result.workspace_memory = selectWorkspaceMemory(workspaceMemory, Math.min(800, Math.floor(runtime.tokenBudget * 0.2)));
1644
1658
  Object.assign(result, await extensionHealthPromise);
1645
- attachOptionalContextSections(result, sections);
1659
+ attachOptionalContextSections(result, sections, focusGroups.featureStore.warning_details);
1646
1660
  applyContextTagProjection(result, options.noTags === true);
1647
1661
  if (options.explainRanking === true) {
1648
1662
  result.ranking = toContextRankingSummary(focusGroups.ranking, focusGroups.featureStore);
@@ -1656,4 +1670,4 @@ export async function runContext(options, global) {
1656
1670
  return result;
1657
1671
  }
1658
1672
  //# sourceMappingURL=context.js.map
1659
- //# debugId=dbcd4e0e-3fa0-5ce9-8bbc-6de05779d729
1673
+ //# debugId=757a0349-9fb6-579d-ab29-fabaad790ce4
@@ -0,0 +1,3 @@
1
+ import type { ItemMetadata } from "../../types/index.js";
2
+ /** Read scalar-only metadata using client workspace defaults and custom type folders. */
3
+ export declare function listClientItemMetadataLight(pmRootOverride: string | undefined, cwdOverride: string | undefined): Promise<ItemMetadata[]>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @module sdk/query/light-metadata
3
+ *
4
+ * Resolves workspace settings for the host-bound lightweight metadata reader.
5
+ */
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]="6ede8efb-54ec-5b13-a1bf-216b525acc12")}catch(e){}}();
8
+ import { resolveItemTypeRegistry } from "../../core/item/type-registry.js";
9
+ import { listAllItemMetadataLight } from "../../core/store/item-store.js";
10
+ import { resolvePmRoot } from "../../core/store/paths.js";
11
+ import { readSettings } from "../../core/store/settings.js";
12
+ /** Read scalar-only metadata using client workspace defaults and custom type folders. */
13
+ export async function listClientItemMetadataLight(pmRootOverride, cwdOverride) {
14
+ const pmRoot = resolvePmRoot(cwdOverride ?? process.cwd(), pmRootOverride);
15
+ const settings = await readSettings(pmRoot);
16
+ return listAllItemMetadataLight(pmRoot, settings.item_format, resolveItemTypeRegistry(settings, null).type_to_folder, undefined, settings.schema);
17
+ }
18
+ //# sourceMappingURL=light-metadata.js.map
19
+ //# debugId=6ede8efb-54ec-5b13-a1bf-216b525acc12
@@ -1,7 +1,8 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f8cd69db-ec70-560f-a8c2-2d8d4be75459")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="37ac2a74-f150-5b9d-96d6-d9cc441215be")}catch(e){}}();
3
3
  import { EXIT_CODE } from "../core/shared/constants.js";
4
4
  import { PmCliError } from "../core/shared/errors.js";
5
+ import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
5
6
  import { resolvePmRoot } from "../core/store/paths.js";
6
7
  import { runEval } from "./eval.js";
7
8
  import { runMergeDriver } from "./merge/driver.js";
@@ -92,14 +93,24 @@ export function runRuntimeMergeAction(context) {
92
93
  prefer: readRuntimeString(input, "prefer"),
93
94
  }, context.global);
94
95
  }
95
- throw new PmCliError(`Unknown merge subcommand "${subcommand}".`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
96
+ throw createUnknownSubcommandError({
97
+ command_path: "merge",
98
+ token: subcommand,
99
+ allowed: ["install", "reconcile", "report", "driver"],
100
+ display_name: "merge",
101
+ });
96
102
  }
97
103
  /** Dispatch guarded workspace snapshot operations. */
98
104
  export function runRuntimeWorkspaceAction(context) {
99
105
  const input = mergedInput(context);
100
106
  const subcommand = requiredString(input, "subcommand");
101
107
  if (subcommand !== "snapshot") {
102
- throw new PmCliError(`Unknown workspace subcommand "${subcommand}".`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
108
+ throw createUnknownSubcommandError({
109
+ command_path: "workspace",
110
+ token: subcommand,
111
+ allowed: ["snapshot"],
112
+ display_name: "workspace",
113
+ });
103
114
  }
104
115
  const snapshotAction = readRuntimeString(input, "snapshotAction") ??
105
116
  requiredString(input, "snapshot_action");
@@ -129,7 +140,13 @@ export function runRuntimeWorkspaceAction(context) {
129
140
  lockWaitMs: parseRuntimeInteger(input.lockWaitMs, "lockWaitMs"),
130
141
  });
131
142
  }
132
- throw new PmCliError(`Unknown workspace snapshot action "${snapshotAction}".`, EXIT_CODE.USAGE, { code: "unknown_subcommand" });
143
+ throw createUnknownSubcommandError({
144
+ command_path: "workspace snapshot",
145
+ token: snapshotAction,
146
+ allowed: ["create", "list", "inspect", "restore", "delete"],
147
+ display_name: "workspace snapshot",
148
+ token_kind: "action",
149
+ });
133
150
  }
134
151
  /** Dispatch meeting, event, and reminder shortcuts through SDK-owned creation. */
135
152
  export function runRuntimeSchedulingAction(context) {
@@ -144,4 +161,4 @@ export function runRuntimeSchedulingAction(context) {
144
161
  return runRemind(title, input, context.global);
145
162
  }
146
163
  //# sourceMappingURL=runtime-extended-actions.js.map
147
- //# debugId=f8cd69db-ec70-560f-a8c2-2d8d4be75459
164
+ //# debugId=37ac2a74-f150-5b9d-96d6-d9cc441215be
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export { type MutationCheckpointItem, createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
10
10
  export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
11
+ export { createUnknownSubcommandError, type UnknownSubcommandErrorOptions, } from "./agent/subcommand-recovery.js";
11
12
  export { type ActiveExtensionHookContext, type ExtensionCommandRegistry, type ExtensionDiscoveryResult, type ExtensionHookRegistry, type ExtensionParserRegistry, type ExtensionPreflightRegistry, type ExtensionRegistrationRegistry, type ExtensionRendererRegistry, type ExtensionServiceRegistry, type FlagDefinition, type PreflightRuntimeDecision, type RegisteredExtensionCommandDefinition, type RegisteredExtensionFlagDefinitions, type RegisteredExtensionSchemaMigrationDefinition, activateExtensions, clearActiveExtensionHooks, consumeAfterCommandAffectedItems, createCoreCommandHookContext, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, resetActiveExtensionRuntimeState, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnIndexHooks, runActiveOnReadHooks, runActiveOnWriteHooks, runActiveParserOverride, runActivePreflightOverride, runActiveServiceOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandContext, setActiveCommandResult, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, } from "../core/extensions/index.js";
12
13
  export { applyRegisteredItemFieldDefaultsAndValidation, collectRegisteredItemFieldNames, parseRegisteredItemFieldAssignments, } from "../core/extensions/item-fields.js";
13
14
  export { resolveExtensionRoots } from "../core/extensions/loader.js";
@@ -16,6 +17,7 @@ export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } fr
16
17
  export { type HistoryDiffValueEntry, computeHistoryDiff, patchPathToChangedField, } from "../core/history/history-diff.js";
17
18
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
18
19
  export { appendHistoryEntry, createHistoryEntry, hashDocument, hashEmptyDocument, } from "../core/history/history.js";
20
+ export { readHistoryEntries } from "../core/history/read.js";
19
21
  export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, type WorkspaceAuditEventOptions, type WorkspaceHistoryChange, type WorkspaceJsonMutation, type WorkspaceJsonMutationOptions, type WorkspaceJsonWriteOptions, } from "../core/history/workspace-history.js";
20
22
  export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, } from "../core/history/replay.js";
21
23
  export { resolveBodyFileContent } from "../core/io/body-file.js";
@@ -7,9 +7,10 @@
7
7
  * prefer the typed operations exported by the main SDK barrel.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="17358714-bb54-58e5-bba0-61bfd1323ec2")}catch(e){}}();
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="16d4bbae-03b7-5316-8e26-77f33affdcf6")}catch(e){}}();
11
11
  export { createCheckpointId, loadMutationCheckpoint, restoreCheckpointItems, writeMutationCheckpoint, } from "../core/checkpoint/mutation-checkpoint.js";
12
12
  export { flattenFlagListValue, resolveFlagValueKind, } from "../core/extensions/flag-value-types.js";
13
+ export { createUnknownSubcommandError, } from "./agent/subcommand-recovery.js";
13
14
  export { activateExtensions, clearActiveExtensionHooks, consumeAfterCommandAffectedItems, createCoreCommandHookContext, createEmptyExtensionRegistrationRegistry, discoverExtensions, getActiveCommandResult, getActiveExtensionRegistrations, loadExtensions, projectAfterCommandItemSnapshot, recordAfterCommandAffectedItem, resetActiveExtensionRuntimeState, runActiveCommandHandler, runActiveBeforeMutationHooks, runActiveOnIndexHooks, runActiveOnReadHooks, runActiveOnWriteHooks, runActiveParserOverride, runActivePreflightOverride, runActiveServiceOverride, runAfterCommandHooks, runBeforeCommandHooks, setActiveCommandContext, setActiveCommandResult, setActiveExtensionCommands, setActiveExtensionHooks, setActiveExtensionParsers, setActiveExtensionPreflight, setActiveExtensionRegistrations, setActiveExtensionRenderers, setActiveExtensionServices, } from "../core/extensions/index.js";
14
15
  export { applyRegisteredItemFieldDefaultsAndValidation, collectRegisteredItemFieldNames, parseRegisteredItemFieldAssignments, } from "../core/extensions/item-fields.js";
15
16
  export { resolveExtensionRoots } from "../core/extensions/loader.js";
@@ -18,6 +19,7 @@ export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } fr
18
19
  export { computeHistoryDiff, patchPathToChangedField, } from "../core/history/history-diff.js";
19
20
  export { enforceHistoryStreamPolicyForItem, enforceHistoryStreamPolicyForItems, } from "../core/history/history-stream-policy.js";
20
21
  export { appendHistoryEntry, createHistoryEntry, hashDocument, hashEmptyDocument, } from "../core/history/history.js";
22
+ export { readHistoryEntries } from "../core/history/read.js";
21
23
  export { appendWorkspaceAuditEvent, appendWorkspaceHistoryChange, getWorkspaceHistoryPath, mutateWorkspaceJsonWithHistory, WORKSPACE_HISTORY_ID, writeWorkspaceJsonWithHistory, } from "../core/history/workspace-history.js";
22
24
  export { normalizeReplayPatchOps, replayToCanonicalItemDocument, replayToItemDocument, toReplayDocument, verifyHistoryChain, } from "../core/history/replay.js";
23
25
  export { resolveBodyFileContent } from "../core/io/body-file.js";
@@ -79,4 +81,4 @@ export { maybeRunFirstUseTelemetryPrompt } from "../core/telemetry/consent.js";
79
81
  export { deriveTelemetryCommandResolution, } from "../core/telemetry/observability.js";
80
82
  export { emitTelemetryErrorEvent, finishTelemetryCommand, startTelemetryCommand, } from "../core/telemetry/runtime.js";
81
83
  //# sourceMappingURL=runtime-primitives.js.map
82
- //# debugId=17358714-bb54-58e5-bba0-61bfd1323ec2
84
+ //# debugId=16d4bbae-03b7-5316-8e26-77f33affdcf6
@@ -7,6 +7,7 @@ export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignore
7
7
  export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
8
8
  export type { FlagDefinition } from "../core/extensions/loader.js";
9
9
  import { EXIT_CODE } from "../core/shared/constants.js";
10
+ import type { ItemMetadata } from "../types/index.js";
10
11
  export type { WorkspaceExtensionCommandContract, WorkspaceFieldContract, } from "./workspace-contracts.js";
11
12
  import { type PmReadOutputOptions, type PmReadOutputResultFor } from "./read-output-contracts.js";
12
13
  export type { PmReadOutputBudgetExceeded, PmReadOutputOptions, PmReadOutputResult, PmReadOutputResultFor, PmReadOutputSurfaceContract, } from "./read-output-contracts.js";
@@ -14,6 +15,8 @@ export type { PmReadOutputSessionReceipt, PmReadOutputSessionState, } from "./re
14
15
  export type { PmContextIntentContract } from "./context-intent-contracts.js";
15
16
  export type { PmErrorCodeContract } from "./error-code-catalog.js";
16
17
  export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
18
+ import { type AssuranceActionInput, type AssuranceActionResult } from "./governance/assurance-action.js";
19
+ export type * from "./governance/assurance-action-contracts.js";
17
20
  import { type AggregateOptions, type AggregateResult } from "./query/aggregate.js";
18
21
  import { type UpgradeCommandOptions, type UpgradeResult } from "./governance/upgrade.js";
19
22
  import { type CreateResult } from "./lifecycle/create.js";
@@ -74,7 +77,7 @@ export { EXIT_CODE };
74
77
  export { PmCliError } from "../core/shared/errors.js";
75
78
  export { isTimestampLiteral, nowIso } from "../core/shared/time.js";
76
79
  export { jaccardSimilarity, normalizeSimilarityText, scoreItemSimilarity, tokenizeSimilarityText, type ItemSimilarityScore, } from "./similarity-scoring.js";
77
- export { listAllItemMetadata, locateItem, readLocatedItem, } from "../core/store/item-store.js";
80
+ export { listAllItemMetadata, listAllItemMetadataLight, locateItem, readLocatedItem, } from "../core/store/item-store.js";
78
81
  export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
79
82
  export { readSettings } from "../core/store/settings.js";
80
83
  export { runAggregate, type AggregateOptions, type AggregateResult, type AggregateRow, } from "./query/aggregate.js";
@@ -131,6 +134,8 @@ export declare class PmClient {
131
134
  private runTyped;
132
135
  /** Return the same context snapshot produced by `pm context`. */
133
136
  context<Options extends ReadOptions<ContextOptions> = ContextOptions>(options?: Options): ReadPromise<ContextResult, Options>;
137
+ /** Read every item through the scalar-only metadata cache without materializing heavy collections or bodies. */
138
+ listAllItemMetadataLight(): Promise<ItemMetadata[]>;
134
139
  /** List items with the MCP/agent compact defaults. */
135
140
  list<Options extends ReadOptions<ListOptions> = ListOptions>(options?: Options): ReadPromise<ListResult, Options>;
136
141
  /** Search items with the MCP/agent compact defaults. */
@@ -232,6 +237,8 @@ export declare class PmClient {
232
237
  health<Options extends ReadOptions<RunHealthOptions> = RunHealthOptions>(options?: Options): ReadPromise<HealthResult, Options>;
233
238
  /** Run tracker cache/runtime garbage collection. */
234
239
  gc(options?: GcCommandOptions): Promise<GcResult>;
240
+ /** Declare, inspect, or evaluate a project assurance contract. */
241
+ assurance(input: AssuranceActionInput): Promise<AssuranceActionResult>;
235
242
  /** Redact sensitive values while preserving an audited, verified history chain. */
236
243
  historyRedact(id: string, options: HistoryRedactCommandOptions): Promise<HistoryRedactResult>;
237
244
  /** Repair and re-anchor one drifted history stream. */
@@ -4,7 +4,7 @@
4
4
  * Defines public SDK APIs and package-author helpers for Runtime.
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]="c8f2b88e-1883-5744-868b-3a16f3814813")}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]="a294f940-5bb9-55a4-bf2c-64842a3a177b")}catch(e){}}();
8
8
  export { PM_GITIGNORE_END, PM_GITIGNORE_START, ensurePmGitignore, getPmGitignoreBlock, } from "./workspace.js";
9
9
  export { SEARCH_EXTENSION_FLAG_DEFINITIONS } from "./extension-contracts.js";
10
10
  import { AsyncLocalStorage } from "node:async_hooks";
@@ -22,16 +22,19 @@ import { createAsyncReadWriteGate } from "../core/shared/serial-queue.js";
22
22
  import { resolveRuntimeFieldRegistry, resolveRuntimeStatusRegistry, } from "../core/schema/runtime-schema.js";
23
23
  import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
24
24
  import { readSettings } from "../core/store/settings.js";
25
+ import { listClientItemMetadataLight } from "./query/light-metadata.js";
25
26
  import { buildWorkspaceExtensionCommandContracts, buildWorkspaceFieldContracts, } from "./workspace-contracts.js";
26
27
  import { PM_TOOL_ACTIONS } from "./cli-contracts/enum-contracts.js";
27
28
  import { clearWorkspaceContractsCache, memoizeWorkspaceExtensionRegistrations, } from "./workspace-contracts-cache.js";
28
29
  import { SDK_ACTION_ALIASES } from "./runtime-action-aliases.js";
29
30
  import { createExtensionCommandSdk } from "./extension-command-context.js";
31
+ import { createUnknownSubcommandError } from "./agent/subcommand-recovery.js";
30
32
  import { applyContextIntentProjection, attachReadOutputContracts, } from "./context-intent-contracts.js";
31
33
  import { runWithDiscoveredContextIntentContracts, } from "./context-intent-runtime.js";
32
34
  import { validateReadOutputOptions, } from "./read-output-contracts.js";
33
35
  export { clearWorkspaceContractsCache } from "./workspace-contracts-cache.js";
34
36
  import { runActivity } from "./query/activity.js";
37
+ import { runAssuranceDispatch } from "./governance/assurance-action.js";
35
38
  import { runAggregate, } from "./query/aggregate.js";
36
39
  import { runAppend } from "./lifecycle/append.js";
37
40
  import { runClaim, runClaimNext, runRelease } from "./lifecycle/claim.js";
@@ -62,7 +65,7 @@ import { runConfig } from "./config.js";
62
65
  import { runInit } from "./init.js";
63
66
  import { runRuntimeEvalAction, runRuntimeEventsAction, runRuntimeMergeAction, runRuntimeSchedulingAction, runRuntimeWorkspaceAction, } from "./runtime-extended-actions.js";
64
67
  import { acknowledgeUnknownAuthorHistoryEventsFromTransport, } from "./author-attribution.js";
65
- import { runProfileApply, runProfileLint, runProfileList, runProfileShow, } from "./profile.js";
68
+ import { PROFILE_SUBCOMMANDS, runProfileApply, runProfileLint, runProfileList, runProfileShow, } from "./profile.js";
66
69
  import { runHistoryRedact, } from "./history-redact.js";
67
70
  import { runMcpHistoryCompactAction, runMcpHistoryRepairAction, } from "./history-mcp.js";
68
71
  import { actionGlobalOptions as globalOptions, closeManyOptionsFromFlat, extensionOptionsFromArgs, graphOptionsFromFlat, mutationListOptions, normalizeActionName, normalizeCommandPath, normalizeMcpOptionsArrays, normalizeMcpUpdateOptions, optionsWithAuthor, parseRuntimeInteger as parseMcpInteger, readRuntimeScalarString as readScalarString, readRuntimeScalarStringAllowBlank as readScalarStringAllowBlank, readRuntimeString as readString, readRuntimeStringArray as readStringArray, resolveRuntimeLimit, updateManyOptionsFromFlat, withAddNoteOption, withFilesDiscoveryOptions, withMutationCompaction, } from "./runtime-input.js";
@@ -70,6 +73,7 @@ import { runDeps } from "./dependencies.js";
70
73
  import { runDocs } from "./docs.js";
71
74
  import { runGraph, } from "./graph/run.js";
72
75
  import { runFiles, runFilesDiscover, runFilesLookup } from "./files.js";
76
+ import { runtimeFilesLookupOptions } from "./traceability/runtime-files-lookup.js";
73
77
  import { runContracts, } from "./cli-contracts/runtime-contracts.js";
74
78
  import { runList } from "./query/list.js";
75
79
  import { runSearch, } from "./query/search.js";
@@ -80,7 +84,7 @@ import { runTelemetry } from "./telemetry.js";
80
84
  import { runTest } from "./test/execution.js";
81
85
  import { runTestAll } from "./test/batch.js";
82
86
  import { resolveStartTaskInProgressStatus } from "./start-task-status.js";
83
- import { runSchemaAddField, runSchemaAddStatus, runSchemaAddType, runSchemaApplyPreset, runSchemaInferTypes, runSchemaList, runSchemaListFields, runSchemaEvolutionMigration, runSchemaRemoveField, runSchemaRemoveStatus, runSchemaRemoveType, runSchemaShow, runSchemaShowField, runSchemaShowStatus, } from "./schema.js";
87
+ import { SCHEMA_SUBCOMMANDS, runSchemaAddField, runSchemaAddStatus, runSchemaAddType, runSchemaApplyPreset, runSchemaInferTypes, runSchemaList, runSchemaListFields, runSchemaEvolutionMigration, runSchemaRemoveField, runSchemaRemoveStatus, runSchemaRemoveType, runSchemaShow, runSchemaShowField, runSchemaShowStatus, } from "./schema.js";
84
88
  export { getActiveExtensionRegistrations, runActiveOnReadHooks, runActiveOnWriteHooks, } from "../core/extensions/index.js";
85
89
  export { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic, } from "../core/fs/fs-utils.js";
86
90
  export { appendHistoryEntry, createHistoryEntry, } from "../core/history/history.js";
@@ -99,7 +103,7 @@ export { EXIT_CODE };
99
103
  export { PmCliError } from "../core/shared/errors.js";
100
104
  export { isTimestampLiteral, nowIso } from "../core/shared/time.js";
101
105
  export { jaccardSimilarity, normalizeSimilarityText, scoreItemSimilarity, tokenizeSimilarityText, } from "./similarity-scoring.js";
102
- export { listAllItemMetadata, locateItem, readLocatedItem, } from "../core/store/item-store.js";
106
+ export { listAllItemMetadata, listAllItemMetadataLight, locateItem, readLocatedItem, } from "../core/store/item-store.js";
103
107
  export { getHistoryPath, getItemPath, getSettingsPath, resolveImplicitPmRoot, resolvePmRoot, } from "../core/store/paths.js";
104
108
  export { readSettings } from "../core/store/settings.js";
105
109
  export { runAggregate, } from "./query/aggregate.js";
@@ -169,6 +173,10 @@ export class PmClient {
169
173
  context(options = {}) {
170
174
  return this.runTyped("context", { options });
171
175
  }
176
+ /** Read every item through the scalar-only metadata cache without materializing heavy collections or bodies. */
177
+ listAllItemMetadataLight() {
178
+ return listClientItemMetadataLight(this.defaults.path, this.defaults.cwd);
179
+ }
172
180
  /** List items with the MCP/agent compact defaults. */
173
181
  list(options = {}) {
174
182
  return this.runTyped("list", { options });
@@ -403,6 +411,10 @@ export class PmClient {
403
411
  gc(options = {}) {
404
412
  return this.runTyped("gc", { options });
405
413
  }
414
+ /** Declare, inspect, or evaluate a project assurance contract. */
415
+ assurance(input) {
416
+ return this.runTyped("assurance", { options: { ...input, subcommand: input.action } });
417
+ }
406
418
  /** Redact sensitive values while preserving an audited, verified history chain. */
407
419
  historyRedact(id, options) {
408
420
  return this.runTyped("history-redact", { id, options });
@@ -1396,25 +1408,20 @@ function runMcpCommentsAction(ctx) {
1396
1408
  commentOptions.delete === undefined;
1397
1409
  if (isListing) {
1398
1410
  commentOptions.includeMeta = true;
1399
- if (commentOptions.limit === undefined && commentOptions.fullHistory !== true) {
1411
+ if (commentOptions.limit === undefined &&
1412
+ commentOptions.fullHistory !== true) {
1400
1413
  commentOptions.limit = "20";
1401
1414
  }
1402
1415
  }
1403
1416
  return runComments(requireMcpItemId(ctx), commentOptions, ctx.global);
1404
1417
  }
1418
+ function runMcpFilesLookupAction(ctx, paths) {
1419
+ return runFilesLookup(runtimeFilesLookupOptions(ctx.options, paths, parseMcpInteger), ctx.global);
1420
+ }
1405
1421
  function runMcpFilesAction(ctx) {
1406
1422
  const lookupPaths = readStringArray(ctx.options.lookupPath);
1407
1423
  if (lookupPaths && lookupPaths.length > 0) {
1408
- return runFilesLookup({
1409
- paths: lookupPaths,
1410
- scope: ctx.options.scope === "project" || ctx.options.scope === "global"
1411
- ? ctx.options.scope
1412
- : undefined,
1413
- limit: parseMcpInteger(ctx.options.limit, "files lookup limit"),
1414
- offset: parseMcpInteger(ctx.options.offset, "files lookup offset"),
1415
- noTruncate: ctx.options.noTruncate === true,
1416
- strictRead: ctx.options.strictRead === true,
1417
- }, ctx.global);
1424
+ return runMcpFilesLookupAction(ctx, lookupPaths);
1418
1425
  }
1419
1426
  const fileId = requireMcpItemId(ctx);
1420
1427
  return ctx.options.discover === true
@@ -1639,7 +1646,12 @@ function runMcpSchemaAction(ctx) {
1639
1646
  }
1640
1647
  return runMcpSchemaAddTypeAction(schema);
1641
1648
  }
1642
- throw new PmCliError(`Unknown pm schema subcommand "${schema.subcommand}". Allowed: add-type, remove-type, add-status, remove-status, add-field, remove-field, rename-type, rename-field, remap-status, list-fields, show-field, apply-preset, list, show, show-status`, 64);
1649
+ throw createUnknownSubcommandError({
1650
+ command_path: "schema",
1651
+ token: schema.subcommand,
1652
+ allowed: SCHEMA_SUBCOMMANDS,
1653
+ exit_code: 64,
1654
+ });
1643
1655
  }
1644
1656
  function runMcpProfileAction(ctx) {
1645
1657
  const subcommand = readString(ctx.args, "subcommand") ??
@@ -1658,7 +1670,12 @@ function runMcpProfileAction(ctx) {
1658
1670
  };
1659
1671
  const handler = getOwnHandler(handlers, normalizedSubcommand);
1660
1672
  if (!handler) {
1661
- throw new PmCliError(`Unknown pm profile subcommand "${subcommand}". Allowed: list, show, apply, lint`, 64);
1673
+ throw createUnknownSubcommandError({
1674
+ command_path: "profile",
1675
+ token: subcommand,
1676
+ allowed: PROFILE_SUBCOMMANDS,
1677
+ exit_code: 64,
1678
+ });
1662
1679
  }
1663
1680
  return handler();
1664
1681
  }
@@ -1808,6 +1825,7 @@ const SDK_ACTION_HANDLERS = {
1808
1825
  runUpdate: (id, options, global) => runUpdate(id, options, global),
1809
1826
  }),
1810
1827
  health: runMcpHealthAction,
1828
+ assurance: (ctx) => runAssuranceDispatch(ctx.args, ctx.options, ctx.global),
1811
1829
  contracts: (ctx) => runContracts(ctx.options, ctx.global),
1812
1830
  config: runMcpConfigAction,
1813
1831
  activity: runMcpActivityAction,
@@ -1820,16 +1838,7 @@ const SDK_ACTION_HANDLERS = {
1820
1838
  deps: (ctx) => runDeps(requireMcpItemId(ctx), ctx.options, ctx.global),
1821
1839
  graph: runMcpGraphAction,
1822
1840
  "files-discover": (ctx) => runFilesDiscover(requireMcpItemId(ctx), ctx.options, ctx.global),
1823
- "files-lookup": (ctx) => runFilesLookup({
1824
- paths: readStringArray(ctx.options.paths),
1825
- scope: ctx.options.scope === "project" || ctx.options.scope === "global"
1826
- ? ctx.options.scope
1827
- : undefined,
1828
- limit: parseMcpInteger(ctx.options.limit, "files lookup limit"),
1829
- offset: parseMcpInteger(ctx.options.offset, "files lookup offset"),
1830
- noTruncate: ctx.options.noTruncate === true,
1831
- strictRead: ctx.options.strictRead === true,
1832
- }, ctx.global),
1841
+ "files-lookup": (ctx) => runMcpFilesLookupAction(ctx, readStringArray(ctx.options.paths)),
1833
1842
  history: (ctx) => runHistory(requireMcpItemId(ctx), ctx.options, ctx.global),
1834
1843
  "history-redact": (ctx) => runHistoryRedact(requireMcpItemId(ctx), ctx.options, ctx.global),
1835
1844
  "history-repair": runMcpHistoryRepairAction,
@@ -1925,4 +1934,4 @@ async function loadWorkspaceExtensionRegistrations(pmRoot, settings, cwd) {
1925
1934
  }
1926
1935
  }
1927
1936
  //# sourceMappingURL=runtime.js.map
1928
- //# debugId=c8f2b88e-1883-5744-868b-3a16f3814813
1937
+ //# debugId=a294f940-5bb9-55a4-bf2c-64842a3a177b
@@ -7,7 +7,7 @@
7
7
  * guarantees.
8
8
  */
9
9
 
10
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c4b4af3b-6ce6-56f7-9665-9e6b2f3d9630")}catch(e){}}();
10
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7d175791-016d-59b6-a44d-a70371f36751")}catch(e){}}();
11
11
  import { createHash } from "node:crypto";
12
12
  import fs from "node:fs/promises";
13
13
  import path from "node:path";
@@ -18,6 +18,7 @@ import { parseFieldsFile, serializeFieldsFile, } from "../core/schema/fields-fil
18
18
  import { parseItemTypesFile, serializeItemTypesFile, } from "../core/schema/item-types-file.js";
19
19
  import { DEFAULT_RUNTIME_SCHEMA_FILE_PATHS, filePathForSchemaSection, normalizeRuntimeSchemaSettings, } from "../core/schema/runtime-schema.js";
20
20
  import { parseStatusDefsFile, serializeStatusDefsFile, } from "../core/schema/status-defs-file.js";
21
+ import { normalizeStatusToken } from "../core/schema/status-token.js";
21
22
  import { getActiveExtensionRegistrations } from "../core/extensions/index.js";
22
23
  import { listAllItemMetadataLight, locateItem, mutateItem, readLocatedItem, } from "../core/store/item-store.js";
23
24
  import { getSettingsPath, resolvePmRoot } from "../core/store/paths.js";
@@ -55,9 +56,6 @@ export function deriveSchemaEvolutionMigrationId(requestInput, migrationScope) {
55
56
  .slice(0, 20)}`;
56
57
  }
57
58
  function normalizedRequest(request) {
58
- const normalizeToken = (value) => requiredText(value, "source or target")
59
- .toLowerCase()
60
- .replaceAll(/[\s-]+/g, "_");
61
59
  const normalized = request.kind === "rename-type"
62
60
  ? {
63
61
  kind: request.kind,
@@ -67,16 +65,16 @@ function normalizedRequest(request) {
67
65
  : request.kind === "rename-field"
68
66
  ? {
69
67
  kind: request.kind,
70
- from: normalizeToken(request.from),
71
- to: normalizeToken(request.to),
68
+ from: normalizeStatusToken(requiredText(request.from, "source")),
69
+ to: normalizeStatusToken(requiredText(request.to, "target")),
72
70
  ...(request.type === undefined
73
71
  ? {}
74
72
  : { type: requiredText(request.type, "type") }),
75
73
  }
76
74
  : {
77
75
  kind: request.kind,
78
- from: normalizeToken(request.from),
79
- to: normalizeToken(request.to),
76
+ from: normalizeStatusToken(requiredText(request.from, "source")),
77
+ to: normalizeStatusToken(requiredText(request.to, "target")),
80
78
  };
81
79
  if (normalized.from.toLowerCase() === normalized.to.toLowerCase()) {
82
80
  throw new TypeError("Schema migration source and target must differ");
@@ -857,4 +855,4 @@ export const schemaMigrationTestOnly = {
857
855
  validateAndStoreMigrationPlan,
858
856
  };
859
857
  //# sourceMappingURL=schema-migration.js.map
860
- //# debugId=c4b4af3b-6ce6-56f7-9665-9e6b2f3d9630
858
+ //# debugId=7d175791-016d-59b6-a44d-a70371f36751
@@ -1,3 +1,4 @@
1
+ export { jaccardSimilarity } from "../core/shared/text-normalization.js";
1
2
  /** Precomputed title signals reused by bounded batch similarity operations. */
2
3
  export interface PreparedSimilarityText {
3
4
  /** Canonical title used for exact comparison. */
@@ -20,8 +21,6 @@ export declare function normalizeSimilarityText(value: string): string;
20
21
  export declare function tokenizeSimilarityText(value: string): string[];
21
22
  /** Precompute every deterministic title signal exactly once for repeated comparisons. */
22
23
  export declare function prepareSimilarityText(value: string): PreparedSimilarityText;
23
- /** Measure set overlap between two token collections. */
24
- export declare function jaccardSimilarity(leftTokens: readonly string[], rightTokens: readonly string[]): number;
25
24
  /** Score two titles through the canonical exact, issue-code, and token signals. */
26
25
  export declare function scoreItemSimilarity(leftTitle: string, rightTitle: string): ItemSimilarityScore;
27
26
  /** Score two precomputed title representations without repeating normalization or tokenization. */