@unbrained/pm-cli 2026.8.15 → 2026.8.17

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 (176) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +56 -12
  3. package/README.md +13 -13
  4. package/dist/cli/error-guidance.d.ts +5 -0
  5. package/dist/cli/error-guidance.js +15 -2
  6. package/dist/cli/public.d.ts +2 -0
  7. package/dist/cli/public.js +21 -0
  8. package/dist/cli/register-history-author.js +16 -11
  9. package/dist/cli/register-mutation.js +4 -4
  10. package/dist/cli-bundle/bundle-manifest.json +143 -143
  11. package/dist/cli-bundle/chunks/{chunk-J42EGKDK.js → chunk-2QLOXC3V.js} +2 -2
  12. package/dist/cli-bundle/chunks/{chunk-LJHOAVGI.js → chunk-3UEGXBMR.js} +49 -43
  13. package/dist/cli-bundle/chunks/chunk-4JPYF536.js +35 -0
  14. package/dist/cli-bundle/chunks/chunk-6VDLG2FC.js +13 -0
  15. package/dist/cli-bundle/chunks/chunk-7IBRGCHX.js +2 -0
  16. package/dist/cli-bundle/chunks/chunk-HBJAS566.js +8 -0
  17. package/dist/cli-bundle/chunks/chunk-ION3E43Q.js +197 -0
  18. package/dist/cli-bundle/chunks/{chunk-WLPDLNEZ.js → chunk-JOKATURE.js} +4 -4
  19. package/dist/cli-bundle/chunks/{chunk-MEM2ZS3O.js → chunk-TPXZIBIV.js} +5 -5
  20. package/dist/cli-bundle/chunks/chunk-YM2YAMF7.js +2 -0
  21. package/dist/cli-bundle/chunks/{register-list-query-CT3LFDDN.js → register-list-query-Q7KII4G5.js} +2 -2
  22. package/dist/cli-bundle/chunks/{register-mutation-NWEVA5YS.js → register-mutation-4WBRPXLV.js} +3 -3
  23. package/dist/cli-bundle/chunks/{register-operations-AHIAG5KM.js → register-operations-SSENDH5B.js} +2 -2
  24. package/dist/cli-bundle/chunks/{register-setup-ZJZFVAKE.js → register-setup-DOSFBGKE.js} +2 -2
  25. package/dist/cli-bundle/focused-chunks/{chunk-WTSER4WJ.js → chunk-267MUUS6.js} +11 -11
  26. package/dist/cli-bundle/focused-chunks/chunk-2NNFLLNG.js +2 -0
  27. package/dist/cli-bundle/focused-chunks/chunk-2QSAKMIH.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/{chunk-ZMFXQ7VF.js → chunk-ATEY76SX.js} +2 -2
  29. package/dist/cli-bundle/focused-chunks/chunk-BUCG4ZI2.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/{chunk-M67F5AIN.js → chunk-CYFK5UPB.js} +2 -2
  31. package/dist/cli-bundle/focused-chunks/chunk-EHXIKD6K.js +2 -0
  32. package/dist/cli-bundle/focused-chunks/{chunk-EXZA4257.js → chunk-KGEXTMPG.js} +2 -2
  33. package/dist/cli-bundle/focused-chunks/chunk-KP2VQQVQ.js +2 -0
  34. package/dist/cli-bundle/focused-chunks/chunk-MHPIL773.js +2 -0
  35. package/dist/cli-bundle/focused-chunks/chunk-POEEAD2V.js +4 -0
  36. package/dist/cli-bundle/focused-chunks/{chunk-ITAUHSO6.js → chunk-SALH6B6K.js} +47 -47
  37. package/dist/cli-bundle/focused-chunks/{chunk-KLVUMNXJ.js → chunk-SYZENPIT.js} +3 -3
  38. package/dist/cli-bundle/focused-chunks/{chunk-KTKH4IMG.js → chunk-XKAMP5OU.js} +2 -2
  39. package/dist/cli-bundle/focused-chunks/{chunk-NSPYTG6G.js → chunk-XPIC53VA.js} +2 -2
  40. package/dist/cli-bundle/focused-chunks/{chunk-6XKF3PGV.js → chunk-ZQPGZZWQ.js} +2 -2
  41. package/dist/cli-bundle/focused-chunks/chunk-ZT2DJS27.js +155 -0
  42. package/dist/cli-bundle/main.js +10 -10
  43. package/dist/cli-bundle/sdk-authoring.js +1 -1
  44. package/dist/cli-bundle/sdk-contracts.js +1 -1
  45. package/dist/cli-bundle/sdk-core.js +31 -31
  46. package/dist/cli-bundle/sdk-governance.js +1 -1
  47. package/dist/cli-bundle/sdk-graph.js +1 -1
  48. package/dist/cli-bundle/sdk-merge.js +32 -32
  49. package/dist/cli-bundle/sdk-query.js +1 -1
  50. package/dist/cli-bundle/sdk-runtime.js +1 -1
  51. package/dist/cli-bundle/sdk-testing.js +1 -1
  52. package/dist/cli-bundle/sdk.js +4 -2
  53. package/dist/core/extensions/loader.js +10 -6
  54. package/dist/core/extensions/manifest-schema.d.ts +20 -0
  55. package/dist/core/extensions/manifest-schema.js +52 -0
  56. package/dist/core/history/replay.js +32 -14
  57. package/dist/core/history/workspace-history.js +32 -10
  58. package/dist/core/output/output.js +6 -3
  59. package/dist/core/schema/fields-file.d.ts +1 -1
  60. package/dist/core/schema/fields-file.js +2 -2
  61. package/dist/core/schema/runtime-field-values.js +115 -9
  62. package/dist/core/schema/runtime-schema.d.ts +3 -1
  63. package/dist/core/schema/runtime-schema.js +124 -3
  64. package/dist/core/shared/errors.d.ts +12 -0
  65. package/dist/core/shared/errors.js +2 -2
  66. package/dist/core/shared/time.d.ts +2 -0
  67. package/dist/core/shared/time.js +27 -2
  68. package/dist/core/store/item-store.js +28 -2
  69. package/dist/sdk/agent/refusal-reachability.d.ts +56 -8
  70. package/dist/sdk/agent/refusal-reachability.js +414 -4
  71. package/dist/sdk/author-attribution.d.ts +56 -11
  72. package/dist/sdk/author-attribution.js +174 -50
  73. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  74. package/dist/sdk/cli-contracts/tool-parameter-tables.js +12 -4
  75. package/dist/sdk/cli-contracts/tool-schema.js +12 -4
  76. package/dist/sdk/completion.js +11 -4
  77. package/dist/sdk/compose.d.ts +6 -2
  78. package/dist/sdk/compose.js +33 -3
  79. package/dist/sdk/context-intent-contracts.d.ts +8 -4
  80. package/dist/sdk/context-intent-contracts.js +76 -31
  81. package/dist/sdk/dependency-flag-validation.d.ts +9 -2
  82. package/dist/sdk/dependency-flag-validation.js +101 -35
  83. package/dist/sdk/environment/host-environment-errors.js +25 -7
  84. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +62 -14
  85. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +50 -2
  86. package/dist/sdk/governance/assurance-action.d.ts +3 -7
  87. package/dist/sdk/governance/assurance-action.js +97 -2
  88. package/dist/sdk/governance/boundary-fixtures.d.ts +86 -0
  89. package/dist/sdk/governance/boundary-fixtures.js +201 -0
  90. package/dist/sdk/governance/coverage-assurance.d.ts +24 -0
  91. package/dist/sdk/governance/coverage-assurance.js +61 -0
  92. package/dist/sdk/governance/defect-recurrence-signals.d.ts +10 -0
  93. package/dist/sdk/governance/defect-recurrence-signals.js +25 -0
  94. package/dist/sdk/governance/defect-recurrence.d.ts +242 -0
  95. package/dist/sdk/governance/defect-recurrence.js +523 -0
  96. package/dist/sdk/governance/extension-host-version.js +20 -9
  97. package/dist/sdk/governance.d.ts +2 -0
  98. package/dist/sdk/governance.js +4 -2
  99. package/dist/sdk/graph/governance.js +3 -2
  100. package/dist/sdk/guide-topics.js +191 -2
  101. package/dist/sdk/index.d.ts +5 -1
  102. package/dist/sdk/index.js +6 -3
  103. package/dist/sdk/lifecycle/create.js +4 -2
  104. package/dist/sdk/lifecycle/update-many.js +15 -2
  105. package/dist/sdk/lifecycle/update.js +5 -2
  106. package/dist/sdk/linked-artifacts.js +63 -14
  107. package/dist/sdk/query/get.d.ts +2 -0
  108. package/dist/sdk/query/get.js +32 -7
  109. package/dist/sdk/read-output-contracts.js +5 -3
  110. package/dist/sdk/relationship-analytics.js +90 -14
  111. package/dist/sdk/relationship-kinds/contract.d.ts +4 -0
  112. package/dist/sdk/relationship-kinds/contract.js +3 -2
  113. package/dist/sdk/relationships.d.ts +1 -1
  114. package/dist/sdk/relationships.js +11 -2
  115. package/dist/sdk/runtime.d.ts +2 -5
  116. package/dist/sdk/runtime.js +3 -2
  117. package/dist/sdk/schema.d.ts +1 -0
  118. package/dist/sdk/schema.js +2 -2
  119. package/dist/sdk/test/execution.d.ts +6 -2
  120. package/dist/sdk/test/execution.js +39 -13
  121. package/dist/types.d.ts +29 -2
  122. package/dist/types.js +4 -2
  123. package/docs/CONFIGURATION.md +58 -1
  124. package/docs/CONTEXT_INTEGRITY_CONTRACTS.md +58 -0
  125. package/docs/DEFECT_RECURRENCE.md +134 -0
  126. package/docs/DEPENDENCY_KIND_CONTRACT.md +12 -2
  127. package/docs/README.md +2 -0
  128. package/docs/READ_OUTPUT_CONTRACTS.md +7 -1
  129. package/docs/RELATIONSHIP_GRAPH.md +16 -2
  130. package/docs/RELEASING.md +13 -7
  131. package/docs/SDK.md +38 -5
  132. package/docs/SDK_CONTEXT_INTEGRITY.md +33 -5
  133. package/docs/SDK_CONTEXT_TRUTH_CONTRACTS.md +13 -5
  134. package/docs/SDK_RUNTIME_BOUNDARIES.md +9 -1
  135. package/docs/TESTING.md +18 -1
  136. package/docs/TRUSTWORTHY_CONTEXT_EVIDENCE.md +1 -1
  137. package/marketplace.json +2 -2
  138. package/package.json +6 -4
  139. package/packages/pm-beads/package.json +1 -1
  140. package/packages/pm-calendar/package.json +1 -1
  141. package/packages/pm-command-kit/package.json +1 -1
  142. package/packages/pm-digital-twin/package.json +1 -1
  143. package/packages/pm-governance-audit/package.json +1 -1
  144. package/packages/pm-guide-shell/package.json +1 -1
  145. package/packages/pm-kanban/package.json +1 -1
  146. package/packages/pm-lifecycle-hooks/package.json +1 -1
  147. package/packages/pm-linked-test-adapters/package.json +1 -1
  148. package/packages/pm-search-advanced/package.json +1 -1
  149. package/packages/pm-templates/package.json +1 -1
  150. package/packages/pm-todos/package.json +1 -1
  151. package/packages/pm-vcs/package.json +1 -1
  152. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  153. package/plugins/pm-claude/skills/pm-audit/SKILL.md +26 -0
  154. package/plugins/pm-claude/skills/pm-developer/SKILL.md +26 -0
  155. package/plugins/pm-claude/skills/pm-planner/SKILL.md +26 -0
  156. package/plugins/pm-claude/skills/pm-release/SKILL.md +26 -0
  157. package/plugins/pm-claude/skills/pm-workflow/SKILL.md +26 -0
  158. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  159. package/plugins/pm-codex/skills/pm-auditor/SKILL.md +26 -0
  160. package/plugins/pm-codex/skills/pm-native/SKILL.md +26 -0
  161. package/plugins/pm-codex/skills/pm-release/SKILL.md +26 -0
  162. package/sdk/public-surface.json +716 -33
  163. package/dist/cli-bundle/chunks/chunk-24GAV7XL.js +0 -8
  164. package/dist/cli-bundle/chunks/chunk-AIM6VT2N.js +0 -13
  165. package/dist/cli-bundle/chunks/chunk-DSWDLTDR.js +0 -197
  166. package/dist/cli-bundle/chunks/chunk-KIEGUBYQ.js +0 -2
  167. package/dist/cli-bundle/chunks/chunk-KLKYLSDX.js +0 -2
  168. package/dist/cli-bundle/chunks/chunk-QHPCJWEJ.js +0 -35
  169. package/dist/cli-bundle/focused-chunks/chunk-4X57RE4U.js +0 -2
  170. package/dist/cli-bundle/focused-chunks/chunk-7NJ4QYQ2.js +0 -2
  171. package/dist/cli-bundle/focused-chunks/chunk-KT5XMYSX.js +0 -4
  172. package/dist/cli-bundle/focused-chunks/chunk-OKA6ELTL.js +0 -2
  173. package/dist/cli-bundle/focused-chunks/chunk-PUISBOPP.js +0 -2
  174. package/dist/cli-bundle/focused-chunks/chunk-QLNMCESQ.js +0 -155
  175. package/dist/cli-bundle/focused-chunks/chunk-SLKC6QLJ.js +0 -2
  176. package/dist/cli-bundle/focused-chunks/chunk-U65UC4G3.js +0 -2
@@ -4,7 +4,8 @@
4
4
  * Provides reusable diagnostics for mutation-author provenance in tracker history.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4fd16197-979e-5269-bed7-f2fb0e2038c2")}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]="b389e521-f689-5895-a5f4-08c3866b3ea3")}catch(e){}}();
8
+ import { createHash } from "node:crypto";
8
9
  import fs from "node:fs/promises";
9
10
  import path from "node:path";
10
11
  import { appendWorkspaceAuditEvent, WORKSPACE_HISTORY_ID, } from "../core/history/workspace-history.js";
@@ -204,6 +205,111 @@ export const scanHistoryAuthorAttribution = async (pmRoot, sampleLimit = 20, inc
204
205
  ...(includeActionableEvents ? { actionable_events: actionableEvents } : {}),
205
206
  };
206
207
  };
208
+ /** Deduplicate and deterministically order history coordinates. */
209
+ function normalizeUnknownAuthorHistoryEvents(events) {
210
+ return [
211
+ ...new Map(events.map((event) => [
212
+ `${event.item_id}:${event.line}`,
213
+ { item_id: event.item_id, line: event.line },
214
+ ])).values(),
215
+ ].sort((left, right) => left.item_id.localeCompare(right.item_id) || left.line - right.line);
216
+ }
217
+ /** Read the append-only set of previously dispositioned coordinates. */
218
+ async function readAcknowledgedUnknownEvents(pmRoot) {
219
+ try {
220
+ return collectAcknowledgedUnknownEvents(await fs.readFile(path.join(pmRoot, "history", "_workspace.jsonl"), "utf8"));
221
+ }
222
+ catch {
223
+ return new Set();
224
+ }
225
+ }
226
+ /** Check whether a coordinate can safely name one immutable history line. */
227
+ function isValidUnknownAuthorHistoryEvent(event) {
228
+ return ((event.item_id === WORKSPACE_HISTORY_ID ||
229
+ /^[a-z0-9][a-z0-9-]*$/iu.test(event.item_id)) &&
230
+ Number.isSafeInteger(event.line) &&
231
+ event.line >= 1);
232
+ }
233
+ /** Resolve one coordinate against its preloaded immutable source stream. */
234
+ function resolveAcknowledgmentPlanCoordinate(event, acknowledgedEvents, sourceLines) {
235
+ const sourceLine = sourceLines[event.line - 1] ?? "";
236
+ let parsed;
237
+ try {
238
+ parsed = JSON.parse(sourceLine);
239
+ }
240
+ catch {
241
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
242
+ }
243
+ if (classifyHistoryAuthorEvent(parsed) !== "actionable_unknown") {
244
+ refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, { code: "history_author_acknowledge_target_not_actionable" });
245
+ }
246
+ return {
247
+ ...event,
248
+ source_event_hash: createHash("sha256").update(sourceLine).digest("hex"),
249
+ disposition: acknowledgedEvents.has(`${event.item_id}:${event.line}`)
250
+ ? "already_acknowledged"
251
+ : "actionable",
252
+ };
253
+ }
254
+ async function resolveUnknownAuthorAcknowledgmentPlan(pmRoot, selector, coordinateLimit) {
255
+ const explicitEvents = selector.events ?? [];
256
+ const selectorCount = Number(selector.all_actionable === true) +
257
+ Number(explicitEvents.length > 0);
258
+ if (selectorCount === 0) {
259
+ refuseAuthorAcknowledgmentArgument("Specify exactly one selector: events or all_actionable.", { code: "history_author_acknowledge_selector_required" });
260
+ }
261
+ if (selectorCount > 1) {
262
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", { code: "history_author_acknowledge_selector_conflict" });
263
+ }
264
+ if (!Number.isSafeInteger(coordinateLimit) || coordinateLimit < 0) {
265
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment coordinate_limit must be a non-negative integer.", { code: "history_author_acknowledge_preview_limit_invalid" });
266
+ }
267
+ const selectedEvents = normalizeUnknownAuthorHistoryEvents(selector.all_actionable === true
268
+ ? (await scanHistoryAuthorAttribution(pmRoot, 0, true))
269
+ .actionable_events
270
+ : explicitEvents);
271
+ const acknowledgedEvents = await readAcknowledgedUnknownEvents(pmRoot);
272
+ const sourceLinesByItem = new Map();
273
+ for (const event of selectedEvents) {
274
+ if (!isValidUnknownAuthorHistoryEvent(event)) {
275
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
276
+ }
277
+ if (sourceLinesByItem.has(event.item_id))
278
+ continue;
279
+ try {
280
+ sourceLinesByItem.set(event.item_id, (await fs.readFile(path.join(pmRoot, "history", `${event.item_id}.jsonl`), "utf8")).split(/\r?\n/u));
281
+ }
282
+ catch {
283
+ refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
284
+ }
285
+ }
286
+ const completeCoordinates = selectedEvents.map((event) => resolveAcknowledgmentPlanCoordinate(event, acknowledgedEvents, sourceLinesByItem.get(event.item_id)));
287
+ const kind = selector.all_actionable === true ? "all_actionable" : "events";
288
+ const planFingerprint = createHash("sha256")
289
+ .update(JSON.stringify({
290
+ version: 1,
291
+ selection: kind,
292
+ coordinates: completeCoordinates,
293
+ }))
294
+ .digest("hex");
295
+ const actionableCount = completeCoordinates.filter(({ disposition }) => disposition === "actionable").length;
296
+ return {
297
+ plan: {
298
+ selection: { kind },
299
+ selected_count: completeCoordinates.length,
300
+ actionable_count: actionableCount,
301
+ already_acknowledged_count: completeCoordinates.length - actionableCount,
302
+ omitted_count: Math.max(0, completeCoordinates.length - coordinateLimit),
303
+ coordinates: completeCoordinates.slice(0, coordinateLimit),
304
+ plan_fingerprint: planFingerprint,
305
+ },
306
+ completeCoordinates,
307
+ };
308
+ }
309
+ /** Resolve a deterministic, source-bound author-acknowledgement preview. */
310
+ export async function planUnknownAuthorHistoryAcknowledgment(pmRoot, selector, coordinateLimit = 50) {
311
+ return (await resolveUnknownAuthorAcknowledgmentPlan(pmRoot, selector, coordinateLimit)).plan;
312
+ }
207
313
  /** Resolve the mutually exclusive CLI and SDK acknowledgment selectors. */
208
314
  export function resolveUnknownAuthorAcknowledgmentSelector(rawEvents, allActionable) {
209
315
  const hasExplicitEvents = rawEvents.length > 0;
@@ -254,11 +360,19 @@ export function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot, input
254
360
  return acknowledgeUnknownAuthorHistoryEvents(pmRoot, {
255
361
  events: selector.events,
256
362
  all_actionable: selector.all_actionable,
363
+ dry_run: input.dryRun === true || input.dry_run === true,
364
+ plan_fingerprint: readRuntimeString(input, "planFingerprint") ??
365
+ readRuntimeString(input, "plan_fingerprint"),
366
+ coordinate_limit: typeof input.limit === "number"
367
+ ? input.limit
368
+ : typeof input.limit === "string"
369
+ ? Number(input.limit)
370
+ : undefined,
257
371
  attributed_author: readRuntimeString(input, "attributedAuthor") ??
258
372
  readRuntimeString(input, "attributed_author") ??
259
- "",
260
- reviewer: readRuntimeString(input, "reviewer") ?? "",
261
- reason: readRuntimeString(input, "reason") ?? "",
373
+ undefined,
374
+ reviewer: readRuntimeString(input, "reviewer"),
375
+ reason: readRuntimeString(input, "reason"),
262
376
  });
263
377
  }
264
378
  /**
@@ -266,23 +380,21 @@ export function acknowledgeUnknownAuthorHistoryEventsFromTransport(pmRoot, input
266
380
  * rewriting their original streams.
267
381
  */
268
382
  export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
269
- const reviewer = options.reviewer.trim();
270
- const attributedAuthor = options.attributed_author.trim();
271
- const reason = options.reason.trim();
272
- const explicitEvents = options.events ?? [];
273
- const selectorCount = Number(options.all_actionable === true) + Number(explicitEvents.length > 0);
274
- if (selectorCount === 0) {
275
- refuseAuthorAcknowledgmentArgument("Specify exactly one selector: events or all_actionable.", { code: "history_author_acknowledge_selector_required" });
383
+ const reviewer = options.reviewer?.trim() ?? "";
384
+ const attributedAuthor = options.attributed_author?.trim() ?? "";
385
+ const reason = options.reason?.trim() ?? "";
386
+ const resolved = await resolveUnknownAuthorAcknowledgmentPlan(pmRoot, options, options.coordinate_limit ?? 50);
387
+ if (options.dry_run === true) {
388
+ return {
389
+ dry_run: true,
390
+ mutated: false,
391
+ acknowledged: 0,
392
+ outcome: "preview",
393
+ exit_code: EXIT_CODE.SUCCESS,
394
+ plan: resolved.plan,
395
+ };
276
396
  }
277
- if (selectorCount > 1) {
278
- refuseAuthorAcknowledgmentArgument("Author acknowledgment accepts either explicit events or all_actionable, not both.", { code: "history_author_acknowledge_selector_conflict" });
279
- }
280
- const selectedEvents = options.all_actionable === true
281
- ? (await scanHistoryAuthorAttribution(pmRoot, 0, true))
282
- .actionable_events
283
- : explicitEvents;
284
397
  const requiredValuesMissing = [
285
- selectedEvents.length > 0,
286
398
  reviewer.length > 0,
287
399
  reviewer.toLowerCase() !== "unknown",
288
400
  attributedAuthor.length > 0,
@@ -292,34 +404,35 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
292
404
  if (requiredValuesMissing) {
293
405
  refuseAuthorAcknowledgmentArgument("Author acknowledgment requires events, reviewer, attributed_author, and reason.", { code: "history_author_acknowledge_required_values_missing" });
294
406
  }
295
- const uniqueEvents = [
296
- ...new Map(selectedEvents.map((event) => [
297
- `${event.item_id}:${event.line}`,
298
- { item_id: event.item_id, line: event.line },
299
- ])).values(),
300
- ].sort((left, right) => left.item_id.localeCompare(right.item_id) || left.line - right.line);
301
- for (const event of uniqueEvents) {
302
- const invalidCoordinate = [
303
- event.item_id === WORKSPACE_HISTORY_ID ||
304
- /^[a-z0-9][a-z0-9-]*$/i.test(event.item_id),
305
- Number.isSafeInteger(event.line),
306
- event.line >= 1,
307
- ].includes(false);
308
- if (invalidCoordinate) {
309
- refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
310
- }
311
- let parsed;
312
- try {
313
- const raw = await fs.readFile(path.join(pmRoot, "history", `${event.item_id}.jsonl`), "utf8");
314
- const line = raw.split(/\r?\n/)[event.line - 1];
315
- parsed = JSON.parse(line ?? "");
316
- }
317
- catch {
318
- refuseAuthorAcknowledgmentArgument(`Unknown-author acknowledgment target ${event.item_id}:${event.line} is not readable.`, { code: "history_author_acknowledge_target_unreadable" });
319
- }
320
- if (classifyHistoryAuthorEvent(parsed) !== "actionable_unknown") {
321
- refuseAuthorAcknowledgmentArgument(`Author acknowledgment target ${event.item_id}:${event.line} is not an actionable unknown-author event.`, { code: "history_author_acknowledge_target_not_actionable" });
322
- }
407
+ if (!options.plan_fingerprint?.trim()) {
408
+ refuseAuthorAcknowledgmentArgument("Author acknowledgment apply requires plan_fingerprint from a fresh dry-run preview.", {
409
+ code: "history_author_acknowledge_plan_fingerprint_required",
410
+ recovery: {
411
+ suggested_retry: "Rerun history-author-acknowledge with --dry-run, then pass --plan-fingerprint <value>.",
412
+ },
413
+ });
414
+ }
415
+ if (options.plan_fingerprint.trim() !== resolved.plan.plan_fingerprint) {
416
+ throw new PmCliError("Author acknowledgment selection changed after preview; no history was mutated.", EXIT_CODE.CONFLICT, {
417
+ code: "history_author_acknowledge_plan_conflict",
418
+ recovery: {
419
+ suggested_retry: "Rerun history-author-acknowledge with --dry-run and apply the fresh plan_fingerprint.",
420
+ },
421
+ });
422
+ }
423
+ const eventsToAcknowledge = resolved.completeCoordinates
424
+ .filter(({ disposition }) => resolved.plan.selection.kind === "events" ||
425
+ disposition === "actionable")
426
+ .map(({ item_id, line }) => ({ item_id, line }));
427
+ if (eventsToAcknowledge.length === 0) {
428
+ return {
429
+ dry_run: false,
430
+ mutated: false,
431
+ acknowledged: 0,
432
+ outcome: "no_effect",
433
+ exit_code: EXIT_CODE.NO_EFFECT,
434
+ plan: resolved.plan,
435
+ };
323
436
  }
324
437
  const settings = await readSettings(pmRoot);
325
438
  const appended = await appendWorkspaceAuditEvent({
@@ -328,7 +441,7 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
328
441
  author: reviewer,
329
442
  context: {
330
443
  author_acknowledgment: {
331
- events: uniqueEvents,
444
+ events: eventsToAcknowledge,
332
445
  attributed_author: attributedAuthor,
333
446
  },
334
447
  },
@@ -336,10 +449,21 @@ export async function acknowledgeUnknownAuthorHistoryEvents(pmRoot, options) {
336
449
  lockTtlSeconds: settings.locks.ttl_seconds,
337
450
  lockWaitMs: settings.locks.wait_ms,
338
451
  });
452
+ const effectResult = resolved.plan.actionable_count > 0 &&
453
+ resolved.plan.already_acknowledged_count > 0
454
+ ? {
455
+ outcome: "partial_effect",
456
+ exit_code: EXIT_CODE.PARTIAL_EFFECT,
457
+ }
458
+ : { outcome: "effect", exit_code: EXIT_CODE.SUCCESS };
339
459
  return {
340
- acknowledged: uniqueEvents.length,
460
+ dry_run: false,
461
+ mutated: true,
462
+ acknowledged: eventsToAcknowledge.length,
463
+ ...effectResult,
464
+ plan: resolved.plan,
341
465
  history_path: appended.historyPath,
342
466
  };
343
467
  }
344
468
  //# sourceMappingURL=author-attribution.js.map
345
- //# debugId=4fd16197-979e-5269-bed7-f2fb0e2038c2
469
+ //# debugId=b389e521-f689-5895-a5f4-08c3866b3ea3
@@ -7,7 +7,7 @@
7
7
  * flag surface stays single-sourced across the CLI, SDK, and MCP boundaries.
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]="512c41c1-624f-517c-abc3-4448b49cd9e6")}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]="c82d9b50-274f-585d-be0e-9a0c5067b9e9")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { RESERVED_EXTENSION_HOST_FLAGS } from "../../core/extensions/reserved-host-flags.js";
13
13
  function normalizeFlagAliasKey(flag) {
@@ -351,6 +351,9 @@ export const HISTORY_REPAIR_FLAG_CONTRACTS = [
351
351
  export const HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS = [
352
352
  { flag: "--event", repeatable: true },
353
353
  { flag: "--all-actionable" },
354
+ { flag: "--dry-run" },
355
+ { flag: "--plan-fingerprint" },
356
+ { flag: "--limit", value_type: "number" },
354
357
  { flag: "--attributed-author", aliases: ["--attributed_author"] },
355
358
  { flag: "--reviewer" },
356
359
  { flag: "--reason" },
@@ -1818,4 +1821,4 @@ export function toCompletionFlagString(flagContracts, includeGlobal = true) {
1818
1821
  return normalizeUniqueStringList(all).join(" ");
1819
1822
  }
1820
1823
  //# sourceMappingURL=flag-contracts.js.map
1821
- //# debugId=512c41c1-624f-517c-abc3-4448b49cd9e6
1824
+ //# debugId=c82d9b50-274f-585d-be0e-9a0c5067b9e9
@@ -4,7 +4,7 @@
4
4
  * Defines SDK command-contract metadata for Tool Parameter Tables.
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]="ddb90f7e-f3ca-56d8-be75-13e238da306c")}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]="4749819e-f2af-5a17-9d32-2e2770c497c3")}catch(e){}}();
8
8
  import { PLAN_HARNESS_VALUES, PLAN_MODE_VALUES, PLAN_STEP_LINK_KIND_VALUES, PLAN_STEP_STATUS_VALUES, } from "../../types/index.js";
9
9
  import { PM_READ_OUTPUT_SESSION_MAX_SEEN_ITEM_IDS } from "../read-output-session.js";
10
10
  import { ASSURANCE_DEFINITION_SCHEMA } from "./schemas/assurance-definition.js";
@@ -229,6 +229,7 @@ export const PM_TOOL_PARAMETER_PROPERTIES = {
229
229
  parent: { type: "string" },
230
230
  reviewer: { type: "string" },
231
231
  attributedAuthor: { type: "string" },
232
+ planFingerprint: { type: "string", pattern: "^[a-f0-9]{64}$" },
232
233
  historyEvent: { type: "array", items: { type: "string" } },
233
234
  risk: { type: "string" },
234
235
  confidence: { anyOf: [{ type: "string" }, { type: "number" }] },
@@ -663,6 +664,7 @@ export const PM_TOOL_ACTION_SCOPED_PARAMETER_PROPERTIES = {
663
664
  "apply",
664
665
  "derive",
665
666
  "promote",
667
+ "risk",
666
668
  ],
667
669
  },
668
670
  preset: {
@@ -1197,6 +1199,12 @@ export const PM_TOOL_PARAMETER_METADATA = {
1197
1199
  description: "Unknown-author history target in <item-id>:<one-based-line> form.",
1198
1200
  examples: [["pm-example:4", "pm-example:5"]],
1199
1201
  },
1202
+ planFingerprint: {
1203
+ description: "Exact SHA-256 returned by a history-author-acknowledge dry-run preview; apply refuses stale or changed source coordinates.",
1204
+ examples: [
1205
+ "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
1206
+ ],
1207
+ },
1200
1208
  estimate: {
1201
1209
  description: "Estimated effort in minutes.",
1202
1210
  examples: [60, "120"],
@@ -1886,8 +1894,8 @@ export const PM_TOOL_PARAMETER_METADATA = {
1886
1894
  export const PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA = {
1887
1895
  assurance: {
1888
1896
  subcommand: {
1889
- description: "Assurance operation: list, show, put, remove, run, verdicts, presets, apply, derive, or promote.",
1890
- examples: ["list", "run", "derive", "promote"],
1897
+ description: "Assurance operation: list, show, put, remove, run, verdicts, presets, apply, derive, promote, or risk.",
1898
+ examples: ["list", "run", "derive", "promote", "risk"],
1891
1899
  },
1892
1900
  kind: {
1893
1901
  description: "Assurance declaration kind for registry operations: measurement, assertion, or gate.",
@@ -2059,4 +2067,4 @@ export const PM_TOOL_ACTION_SCOPED_PARAMETER_METADATA = {
2059
2067
  },
2060
2068
  };
2061
2069
  //# sourceMappingURL=tool-parameter-tables.js.map
2062
- //# debugId=ddb90f7e-f3ca-56d8-be75-13e238da306c
2070
+ //# debugId=4749819e-f2af-5a17-9d32-2e2770c497c3
@@ -7,7 +7,7 @@
7
7
  * consumers from a single source of truth.
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]="aa58e280-0a39-5285-a451-811e60481661")}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]="1d6089b2-ab59-59ad-a475-9a6ef1356b40")}catch(e){}}();
11
11
  import { normalizeUniqueStringList } from "./string-lists.js";
12
12
  import { PM_TOOL_ACTIONS } from "./enum-contracts.js";
13
13
  import { TOOL_CREATE_OPTION_CONTRACTS, TOOL_SHARED_CREATE_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_OPTION_CONTRACTS, TOOL_UPDATE_MANY_FILTER_OPTION_CONTRACTS, TOOL_CONTEXT_OPTION_CONTRACTS, TOOL_ACTIVITY_OPTION_CONTRACTS, TOOL_LIST_FILTER_OPTION_CONTRACTS, TOOL_AGGREGATE_OPTION_CONTRACTS, TOOL_SEARCH_FILTER_OPTION_CONTRACTS, TOOL_CLOSE_MANY_FILTER_OPTION_CONTRACTS, } from "./tool-option-contracts.js";
@@ -632,8 +632,16 @@ const PM_TOOL_ACTION_SCHEMA_CONTRACTS = {
632
632
  oneOfRequired: [["id"], ["all"]],
633
633
  },
634
634
  "history-author-acknowledge": {
635
- required: ["attributedAuthor", "reviewer", "reason"],
636
- optional: ["historyEvent", "allActionable"],
635
+ optional: [
636
+ "historyEvent",
637
+ "allActionable",
638
+ "dryRun",
639
+ "planFingerprint",
640
+ "limit",
641
+ "attributedAuthor",
642
+ "reviewer",
643
+ "reason",
644
+ ],
637
645
  oneOfRequired: [["historyEvent"], ["allActionable"]],
638
646
  },
639
647
  "history-compact": {
@@ -1580,4 +1588,4 @@ export const _testOnlyCliContracts = {
1580
1588
  withFlagAliasMetadata,
1581
1589
  };
1582
1590
  //# sourceMappingURL=tool-schema.js.map
1583
- //# debugId=aa58e280-0a39-5285-a451-811e60481661
1591
+ //# debugId=1d6089b2-ab59-59ad-a475-9a6ef1356b40
@@ -4,11 +4,11 @@
4
4
  * Implements the pm completion 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]="fca471b1-155a-5fc4-9aa9-d45e5f1315dd")}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]="c337a436-ac3e-5447-9c76-de9aeebb2a1c")}catch(e){}}();
8
8
  import { EXIT_CODE, PmCliError } from "./runtime-primitives.js";
9
9
  import { listPmCommandsForTier } from "./agent-capability-contracts.js";
10
10
  import { SCAFFOLD_CAPABILITIES } from "./extension/scaffold.js";
11
- import { AGGREGATE_FLAG_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, CREATE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PLAN_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, toCompletionFlagString, } from "./cli-contracts.js";
11
+ import { AGGREGATE_FLAG_CONTRACTS, ACTIVITY_FLAG_CONTRACTS, APPEND_FLAG_CONTRACTS, CALENDAR_FLAG_CONTRACTS, CLOSE_MANY_FLAG_CONTRACTS, COMPLETION_FLAG_CONTRACTS, CONTRACTS_FLAG_CONTRACTS, CONTEXT_FLAG_CONTRACTS, COPY_FLAG_CONTRACTS, FOCUS_FLAG_CONTRACTS, MEET_FLAG_CONTRACTS, REMIND_FLAG_CONTRACTS, CREATE_FLAG_CONTRACTS, DEPS_FLAG_CONTRACTS, DUPLICATES_FLAG_CONTRACTS, EXTENSION_FLAG_CONTRACTS, GRAPH_FLAG_CONTRACTS, GET_FLAG_CONTRACTS, GUIDE_FLAG_CONTRACTS, GLOBAL_FLAG_CONTRACTS, HEALTH_FLAG_CONTRACTS, HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, HISTORY_FLAG_CONTRACTS, INIT_FLAG_CONTRACTS, LIST_FILTER_FLAG_CONTRACTS, NEXT_FLAG_CONTRACTS, PACKAGE_FLAG_CONTRACTS, PLAN_FLAG_CONTRACTS, SEARCH_FLAG_CONTRACTS, STATS_FLAG_CONTRACTS, EVENTS_FLAG_CONTRACTS, UPDATE_FLAG_CONTRACTS, UPDATE_MANY_FLAG_CONTRACTS, toCompletionFlagString, } from "./cli-contracts.js";
12
12
  import { BUILTIN_ITEM_TYPE_VALUES, STATUS_VALUES } from "../types/index.js";
13
13
  import { listGuideTopicIds } from "./guide-topics.js";
14
14
  const VALID_SHELLS = ["bash", "zsh", "fish"];
@@ -29,6 +29,7 @@ const UPDATE_MANY_FLAGS = toCompletionFlagString(UPDATE_MANY_FLAG_CONTRACTS);
29
29
  const CLOSE_MANY_FLAGS = toCompletionFlagString(CLOSE_MANY_FLAG_CONTRACTS);
30
30
  const ACTIVITY_FLAGS = toCompletionFlagString(ACTIVITY_FLAG_CONTRACTS);
31
31
  const HISTORY_FLAGS = toCompletionFlagString(HISTORY_FLAG_CONTRACTS);
32
+ const HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS = toCompletionFlagString(HISTORY_AUTHOR_ACKNOWLEDGE_FLAG_CONTRACTS, false);
32
33
  const EVENTS_FLAGS = toCompletionFlagString(EVENTS_FLAG_CONTRACTS);
33
34
  const CALENDAR_FLAGS = toCompletionFlagString(CALENDAR_FLAG_CONTRACTS);
34
35
  const CONTEXT_FLAGS = toCompletionFlagString(CONTEXT_FLAG_CONTRACTS);
@@ -648,7 +649,7 @@ export function generateBashScript(itemTypes = [], tags = [], eagerTagExpansion
648
649
  ` COMPREPLY=(${compgen("--before --ids --all-over --closed --all-streams --min-entries --dry-run --author --message --force --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
649
650
  " ;;",
650
651
  " history-author-acknowledge)",
651
- ` COMPREPLY=(${compgen("--event --all-actionable --attributed-author --reviewer --reason --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help")})`,
652
+ ` COMPREPLY=(${compgen(`${HISTORY_AUTHOR_ACKNOWLEDGE_FLAGS} --json --quiet --no-changed-fields --pm-path --path --no-extensions --no-pager --profile --help`)})`,
652
653
  " ;;",
653
654
  " get)",
654
655
  ` COMPREPLY=(${compgen(GET_FLAGS)})`,
@@ -1199,6 +1200,9 @@ ${zshSearchRuntimeFieldFlags} '--json[Output JSON]' \\
1199
1200
  _arguments \\
1200
1201
  '*--event[Actionable unknown-author event]:item_and_line' \\
1201
1202
  '--all-actionable[Select every currently actionable event]' \\
1203
+ '--dry-run[Preview a deterministic source-bound plan]' \\
1204
+ '--plan-fingerprint[Apply the exact dry-run plan]:sha256' \\
1205
+ '--limit[Maximum coordinate rows returned in the plan]:number' \\
1202
1206
  '--attributed-author[Principal attributed by maintainer review]:author' \\
1203
1207
  '--reviewer[Reviewer recording the disposition]:reviewer' \\
1204
1208
  '--reason[Evidence-backed review rationale]:reason' \\
@@ -2308,6 +2312,9 @@ complete -c pm -n '__fish_seen_subcommand_from history-compact' -l message -d 'A
2308
2312
  complete -c pm -n '__fish_seen_subcommand_from history-compact' -l force -d 'Force ownership/lock override'
2309
2313
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l event -d 'Actionable unknown-author event' -r
2310
2314
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l all-actionable -d 'Select every currently actionable event'
2315
+ complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l dry-run -d 'Preview a deterministic source-bound plan'
2316
+ complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l plan-fingerprint -d 'Apply the exact dry-run plan' -r
2317
+ complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l limit -d 'Maximum coordinate rows returned in the plan' -r
2311
2318
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l attributed-author -d 'Principal attributed by maintainer review' -r
2312
2319
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l reviewer -d 'Reviewer recording the disposition' -r
2313
2320
  complete -c pm -n '__fish_seen_subcommand_from history-author-acknowledge' -l reason -d 'Evidence-backed review rationale' -r
@@ -2762,4 +2769,4 @@ export function runCompletion(shell, itemTypes = [], tags = [], eagerTagExpansio
2762
2769
  };
2763
2770
  }
2764
2771
  //# sourceMappingURL=completion.js.map
2765
- //# debugId=fca471b1-155a-5fc4-9aa9-d45e5f1315dd
2772
+ //# debugId=c337a436-ac3e-5447-9c76-de9aeebb2a1c
@@ -460,7 +460,7 @@ export interface ExtensionManifestCompatibilityManifest {
460
460
  * load, while `*_unchecked`/`*_exceeded_warn` are advisory (the extension still
461
461
  * loads).
462
462
  */
463
- export type ExtensionManifestCompatibilityCode = "pm_min_version_invalid" | "pm_min_version_unchecked" | "pm_min_version_unmet" | "pm_max_version_invalid" | "pm_max_version_unchecked" | "pm_max_version_exceeded" | "pm_max_version_exceeded_warn";
463
+ export type ExtensionManifestCompatibilityCode = "pm_min_version_invalid" | "pm_min_version_unchecked" | "pm_min_version_unmet" | "pm_max_version_invalid" | "pm_max_version_unchecked" | "pm_max_version_exceeded" | "pm_max_version_exceeded_warn" | "manifest_unknown_key" | "no_version_bounds_declared";
464
464
  /**
465
465
  * A single version-bound issue {@link checkExtensionManifestCompatibility} found
466
466
  * when evaluating a manifest against a target pm version.
@@ -471,13 +471,17 @@ export interface ExtensionManifestCompatibilityFinding {
471
471
  /** `error` when the bound blocks the load against the target version, `warning` when it is advisory. */
472
472
  severity: "error" | "warning";
473
473
  /** Which manifest bound produced the finding. */
474
- constraint: PmVersionBoundKind;
474
+ constraint: PmVersionBoundKind | "manifest";
475
475
  /** The declared bound value, verbatim. */
476
476
  required: string;
477
477
  /** The target pm version the bound was evaluated against. */
478
478
  current: string;
479
479
  /** Human-readable explanation of the outcome and its effect on loading. */
480
480
  message: string;
481
+ /** JSON-style manifest location responsible for a schema-level finding. */
482
+ path?: string;
483
+ /** Canonical manifest key that replaces a recognized legacy or mistaken spelling. */
484
+ suggested_key?: "pm_min_version" | "pm_max_version";
481
485
  }
482
486
  /**
483
487
  * The structured result of {@link checkExtensionManifestCompatibility}.
@@ -1,10 +1,11 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="fb438c6a-1927-54c3-98dd-dd7423df6722")}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]="705476d3-74b8-540d-b646-956e24f703d4")}catch(e){}}();
3
3
  import { normalizeKnownExtensionCapability, resolveLegacyExtensionCapabilityAlias, } from "../core/extensions/extension-capability-aliases.js";
4
4
  import { normalizeCommandName } from "../core/extensions/extension-runtime-helpers.js";
5
5
  import { RESERVED_ITEM_FIELD_NAMES } from "../core/extensions/item-fields.js";
6
6
  import { describeExtensionLongFlagFailure, findExtensionFlagTokenFailure, } from "../core/extensions/flag-definition-validation.js";
7
7
  import { evaluatePmMaxVersionBound, evaluatePmMinVersionBound, } from "../core/extensions/version-compat.js";
8
+ import { inspectExtensionManifestSchema } from "../core/extensions/manifest-schema.js";
8
9
  /**
9
10
  * Typed identity helper for extension module exports.
10
11
  *
@@ -903,7 +904,7 @@ function toCompatibilityFinding(evaluation, pmVersion) {
903
904
  return null;
904
905
  }
905
906
  const code = `${evaluation.kind}_${evaluation.status}`;
906
- let message;
907
+ let message = "";
907
908
  switch (code) {
908
909
  case "pm_min_version_invalid":
909
910
  message = `pm_min_version "${evaluation.required}" is not a valid version; the extension is treated as incompatible and the loader skips it.`;
@@ -962,6 +963,35 @@ export function checkExtensionManifestCompatibility(manifest, target) {
962
963
  const minEvaluation = evaluatePmMinVersionBound(manifest.pm_min_version, target.pmVersion);
963
964
  const maxEvaluation = evaluatePmMaxVersionBound(manifest.pm_max_version, target.pmVersion, target.pmMaxVersionExceededMode ?? "block");
964
965
  const findings = [];
966
+ const schema = inspectExtensionManifestSchema(manifest);
967
+ for (const key of schema.unknownKeys) {
968
+ findings.push({
969
+ code: "manifest_unknown_key",
970
+ severity: "warning",
971
+ constraint: "manifest",
972
+ required: key,
973
+ current: target.pmVersion,
974
+ path: key,
975
+ ...(key === "compatibility"
976
+ ? { suggested_key: "pm_min_version" }
977
+ : {}),
978
+ message: key === "compatibility"
979
+ ? 'Manifest key "compatibility" is ignored; declare the canonical pm_min_version and optional pm_max_version fields instead.'
980
+ : `Manifest key "${key}" is not part of the extension manifest contract and will be ignored.`,
981
+ });
982
+ }
983
+ if (schema.missingVersionBounds) {
984
+ findings.push({
985
+ code: "no_version_bounds_declared",
986
+ severity: "warning",
987
+ constraint: "manifest",
988
+ required: "pm_min_version",
989
+ current: target.pmVersion,
990
+ path: "$",
991
+ suggested_key: "pm_min_version",
992
+ message: "No canonical pm version bounds are declared; add pm_min_version so compatibility intent is explicit.",
993
+ });
994
+ }
965
995
  const minFinding = toCompatibilityFinding(minEvaluation, target.pmVersion);
966
996
  if (minFinding !== null) {
967
997
  findings.push(minFinding);
@@ -1071,4 +1101,4 @@ export function preflightExtension(blueprint, options = {}) {
1071
1101
  };
1072
1102
  }
1073
1103
  //# sourceMappingURL=compose.js.map
1074
- //# debugId=fb438c6a-1927-54c3-98dd-dd7423df6722
1104
+ //# debugId=705476d3-74b8-540d-b646-956e24f703d4
@@ -29,15 +29,19 @@ export interface PmContextIntentReceipt {
29
29
  included_field_groups: string[];
30
30
  /** Effective token ceiling after an explicit caller override is applied. */
31
31
  token_budget: number;
32
- /** Deterministic JSON-size estimate for the result including this receipt. */
32
+ /** Ceiling declared by the selected intent before caller overrides. */
33
+ declared_token_budget: number;
34
+ /** Signed difference between the effective and declared ceilings. */
35
+ token_budget_override: number;
36
+ /** Deterministic JSON-size estimate for the useful result before any receipt-only omission. */
33
37
  estimated_tokens: number;
34
- /** Whether the measured result fits the declared ceiling. */
38
+ /** Whether the measured result fits the effective ceiling after caller overrides. */
35
39
  within_budget: boolean;
36
40
  /** Projection strategy applied before the result was measured. */
37
41
  degradation: "bounded_fields_and_rows" | "bounded_ranked_rows" | "bounded_sections" | "budget_row_compaction" | "recursive_budget_compaction" | "budget_receipt_only" | "standard_item" | "none";
38
- /** Whether the declared ceiling can carry at least one useful result row. */
42
+ /** Whether the declared ceiling can carry the measured useful projection, independent of an override. */
39
43
  declaration_feasible: boolean;
40
- /** True only when no useful result survived the declared ceiling. */
44
+ /** True only when no useful result survived the effective ceiling. */
41
45
  result_omitted: boolean;
42
46
  /** Row ceiling calculated from the selected intent's effective token budget. */
43
47
  budget_derived_limit?: number;