@unbrained/pm-cli 2026.8.27 → 2026.8.29

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 (148) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +49 -1
  3. package/dist/cli/error-guidance.js +61 -7
  4. package/dist/cli/register-annotations.js +58 -41
  5. package/dist/cli-bundle/bundle-manifest.json +142 -142
  6. package/dist/cli-bundle/chunks/{chunk-TNX6HC54.js → chunk-2MKLQL2E.js} +2 -2
  7. package/dist/cli-bundle/chunks/{chunk-SKXLJIEK.js → chunk-2UETTHY6.js} +49 -49
  8. package/dist/cli-bundle/chunks/{chunk-SHMDY36D.js → chunk-3TEF3HM5.js} +2 -2
  9. package/dist/cli-bundle/chunks/{chunk-SH6P7FXI.js → chunk-7SKMLSMX.js} +2 -2
  10. package/dist/cli-bundle/chunks/chunk-7X6OZEIV.js +34 -0
  11. package/dist/cli-bundle/chunks/{chunk-CVBBGWW5.js → chunk-CMIEDWAY.js} +54 -50
  12. package/dist/cli-bundle/chunks/{chunk-3OO3W6FW.js → chunk-GNWPTEBW.js} +64 -61
  13. package/dist/cli-bundle/chunks/chunk-MTTKAUBX.js +2 -0
  14. package/dist/cli-bundle/chunks/chunk-N6OR6FAR.js +13 -0
  15. package/dist/cli-bundle/chunks/{chunk-R4ETAOJC.js → chunk-TGNAA66W.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-52EKTW6V.js → chunk-WS2GJQVG.js} +2 -2
  17. package/dist/cli-bundle/chunks/{register-list-query-EUWM6VII.js → register-list-query-OMKJ5ONN.js} +2 -2
  18. package/dist/cli-bundle/chunks/{register-mutation-FD4HSAVU.js → register-mutation-QBSNCOY3.js} +4 -4
  19. package/dist/cli-bundle/chunks/{register-operations-HRMNFEC3.js → register-operations-UC77FQZC.js} +2 -2
  20. package/dist/cli-bundle/chunks/{register-setup-33GNICLX.js → register-setup-GLQ5SYV3.js} +2 -2
  21. package/dist/cli-bundle/focused-chunks/{chunk-HC7ODMH3.js → chunk-3AVAWVZA.js} +2 -2
  22. package/dist/cli-bundle/focused-chunks/chunk-3UMBF26I.js +158 -0
  23. package/dist/cli-bundle/focused-chunks/{chunk-YVVZ3LQ6.js → chunk-73EDXGYE.js} +16 -15
  24. package/dist/cli-bundle/focused-chunks/{chunk-4BR5UU52.js → chunk-AXZ5AJAF.js} +45 -45
  25. package/dist/cli-bundle/focused-chunks/{chunk-MXTYGECH.js → chunk-G6PATS5E.js} +3 -3
  26. package/dist/cli-bundle/focused-chunks/{chunk-SUBSWYW3.js → chunk-JZYPPMXF.js} +2 -2
  27. package/dist/cli-bundle/focused-chunks/chunk-LLNTHF5X.js +2 -0
  28. package/dist/cli-bundle/focused-chunks/chunk-LYFWQMVC.js +2 -0
  29. package/dist/cli-bundle/focused-chunks/chunk-RKOKG43G.js +2 -0
  30. package/dist/cli-bundle/focused-chunks/chunk-TDK3OCX3.js +2 -0
  31. package/dist/cli-bundle/focused-chunks/{chunk-EKX37ZHA.js → chunk-THEPQMLX.js} +2 -2
  32. package/dist/cli-bundle/focused-chunks/{chunk-FC2AXLB5.js → chunk-XXOWRJZ5.js} +2 -2
  33. package/dist/cli-bundle/main.js +14 -14
  34. package/dist/cli-bundle/sdk-authoring.js +1 -1
  35. package/dist/cli-bundle/sdk-contracts.js +2 -2
  36. package/dist/cli-bundle/sdk-core.js +31 -32
  37. package/dist/cli-bundle/sdk-governance.js +1 -1
  38. package/dist/cli-bundle/sdk-graph.js +1 -1
  39. package/dist/cli-bundle/sdk-merge.js +34 -32
  40. package/dist/cli-bundle/sdk-query.js +1 -1
  41. package/dist/cli-bundle/sdk-runtime.js +1 -1
  42. package/dist/cli-bundle/sdk-testing.js +1 -1
  43. package/dist/cli-bundle/sdk.js +10 -10
  44. package/dist/core/diagnostics/remediation.js +16 -6
  45. package/dist/core/history/drift-scan.d.ts +2 -0
  46. package/dist/core/history/drift-scan.js +72 -36
  47. package/dist/core/history/history.d.ts +3 -3
  48. package/dist/core/history/history.js +5 -5
  49. package/dist/core/history/replay.d.ts +1 -1
  50. package/dist/core/history/replay.js +50 -19
  51. package/dist/core/item/actionability.d.ts +7 -1
  52. package/dist/core/item/actionability.js +44 -11
  53. package/dist/core/item/dependency-reference.d.ts +10 -0
  54. package/dist/core/item/dependency-reference.js +21 -0
  55. package/dist/core/item/parse.d.ts +4 -0
  56. package/dist/core/item/parse.js +38 -16
  57. package/dist/core/shared/author.js +69 -17
  58. package/dist/mcp/tool-definitions.js +5 -5
  59. package/dist/sdk/agent/command-recovery.js +3 -3
  60. package/dist/sdk/agent/task-transcript-contracts.d.ts +52 -0
  61. package/dist/sdk/agent/task-transcript-contracts.js +198 -0
  62. package/dist/sdk/annotations.d.ts +5 -2
  63. package/dist/sdk/annotations.js +66 -36
  64. package/dist/sdk/cli-bootstrap.d.ts +2 -8
  65. package/dist/sdk/cli-bootstrap.js +7 -67
  66. package/dist/sdk/cli-contracts/bootstrap-command-scanner.d.ts +23 -0
  67. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +80 -0
  68. package/dist/sdk/cli-contracts/flag-contracts.js +5 -2
  69. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +5 -5
  70. package/dist/sdk/cli-contracts/tool-parameter-tables.js +15 -2
  71. package/dist/sdk/cli-contracts/tool-schema.d.ts +1 -1
  72. package/dist/sdk/cli-contracts/tool-schema.js +16 -3
  73. package/dist/sdk/comments.d.ts +4 -0
  74. package/dist/sdk/comments.js +2 -2
  75. package/dist/sdk/completion.js +9 -5
  76. package/dist/sdk/contracts.d.ts +1 -0
  77. package/dist/sdk/contracts.js +3 -2
  78. package/dist/sdk/dependency-provenance.d.ts +51 -2
  79. package/dist/sdk/dependency-provenance.js +91 -7
  80. package/dist/sdk/extension/install-sources.d.ts +8 -1
  81. package/dist/sdk/extension/install-sources.js +132 -39
  82. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +74 -14
  83. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +86 -38
  84. package/dist/sdk/governance/health.js +86 -22
  85. package/dist/sdk/governance/validate-history-drift.js +5 -2
  86. package/dist/sdk/graph/assembly.js +51 -22
  87. package/dist/sdk/history-repair.d.ts +1 -1
  88. package/dist/sdk/history-repair.js +20 -10
  89. package/dist/sdk/index.d.ts +1 -0
  90. package/dist/sdk/index.js +3 -2
  91. package/dist/sdk/learnings.d.ts +4 -0
  92. package/dist/sdk/learnings.js +7 -4
  93. package/dist/sdk/lifecycle/close.js +4 -3
  94. package/dist/sdk/lifecycle/create.js +43 -19
  95. package/dist/sdk/linked-artifacts.js +21 -31
  96. package/dist/sdk/merge/reconcile.js +3 -16
  97. package/dist/sdk/notes.d.ts +4 -0
  98. package/dist/sdk/notes.js +2 -2
  99. package/dist/sdk/query/next.d.ts +6 -0
  100. package/dist/sdk/query/next.js +7 -2
  101. package/dist/sdk/runtime-input.js +5 -2
  102. package/dist/sdk/runtime.d.ts +6 -6
  103. package/dist/sdk/runtime.js +8 -8
  104. package/dist/sdk/test/entry.d.ts +1 -1
  105. package/dist/sdk/test/entry.js +5 -9
  106. package/dist/sdk/test/execution.d.ts +3 -0
  107. package/dist/sdk/test/execution.js +54 -13
  108. package/docs/COMMANDS.md +4 -3
  109. package/docs/CONTEXT_RECOVERY_PRIMITIVES.md +67 -0
  110. package/docs/MERGE_SAFETY.md +23 -10
  111. package/docs/OUTPUT_TOKEN_ACCOUNTING.md +20 -7
  112. package/docs/README.md +1 -0
  113. package/docs/RELEASING.md +9 -1
  114. package/docs/SDK.md +12 -0
  115. package/docs/SDK_CONTEXT_INTEGRITY.md +12 -1
  116. package/docs/SDK_RUNTIME_BOUNDARIES.md +10 -0
  117. package/docs/TESTING.md +6 -2
  118. package/docs/agent-task-token-baseline.json +97 -11
  119. package/docs/agent-task-transcripts.json +211 -0
  120. package/docs/generated/FLAG_LEXICON_BUDGETS.md +3 -3
  121. package/docs/generated/REFUSAL_CLOSURE_CENSUS.md +13 -4
  122. package/docs/performance/cli-transport-overhead.md +10 -2
  123. package/marketplace.json +2 -2
  124. package/package.json +8 -8
  125. package/packages/pm-beads/package.json +1 -1
  126. package/packages/pm-calendar/package.json +1 -1
  127. package/packages/pm-command-kit/package.json +1 -1
  128. package/packages/pm-digital-twin/package.json +1 -1
  129. package/packages/pm-governance-audit/package.json +1 -1
  130. package/packages/pm-guide-shell/package.json +1 -1
  131. package/packages/pm-kanban/package.json +1 -1
  132. package/packages/pm-lifecycle-hooks/package.json +1 -1
  133. package/packages/pm-linked-test-adapters/package.json +1 -1
  134. package/packages/pm-search-advanced/package.json +1 -1
  135. package/packages/pm-templates/package.json +1 -1
  136. package/packages/pm-todos/package.json +1 -1
  137. package/packages/pm-vcs/package.json +1 -1
  138. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  139. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  140. package/sdk/public-surface.json +297 -36
  141. package/dist/cli-bundle/chunks/chunk-MFNTKMTI.js +0 -13
  142. package/dist/cli-bundle/chunks/chunk-OS27HHBN.js +0 -35
  143. package/dist/cli-bundle/chunks/chunk-QTO7USTH.js +0 -2
  144. package/dist/cli-bundle/focused-chunks/chunk-2AGZ5BRT.js +0 -2
  145. package/dist/cli-bundle/focused-chunks/chunk-AQ5IYEZZ.js +0 -2
  146. package/dist/cli-bundle/focused-chunks/chunk-XDPYBQCF.js +0 -156
  147. package/dist/cli-bundle/focused-chunks/chunk-Y5A7SJJ7.js +0 -2
  148. package/dist/cli-bundle/focused-chunks/chunk-YHWHX6YY.js +0 -2
@@ -1,6 +1,6 @@
1
1
  /** Generated partition 1 of the exhaustive error-code catalog. */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c51fce27-5acd-513d-83c4-5fd75bd999f9")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0823f083-1719-5ec2-9f7e-43bd86a2a3a2")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_1 = [
5
5
  {
6
6
  code: "acceptance_criteria_mutation_conflict",
@@ -122,6 +122,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
122
122
  canonical_code: "annotation_flag_like_value",
123
123
  aliases: [],
124
124
  },
125
+ {
126
+ code: "annotation_if_absent_without_append",
127
+ meaning: "Annotation if absent without append condition.",
128
+ stability: "provisional",
129
+ exit_code: 2,
130
+ class: "usage",
131
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
132
+ sources: ["sdk/annotations.ts"],
133
+ emitting_commands: ["*"],
134
+ canonical_code: "annotation_if_absent_without_append",
135
+ aliases: [],
136
+ },
125
137
  {
126
138
  code: "annotation_message_without_text",
127
139
  meaning: "Annotation message without text condition.",
@@ -170,6 +182,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
170
182
  canonical_code: "assurance_registry_invalid",
171
183
  aliases: [],
172
184
  },
185
+ {
186
+ code: "bare_comma_entry_ambiguous",
187
+ meaning: "Bare comma entry ambiguous condition.",
188
+ stability: "provisional",
189
+ exit_code: 2,
190
+ class: "usage",
191
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
192
+ sources: ["core/item/parse.ts"],
193
+ emitting_commands: ["*"],
194
+ canonical_code: "bare_comma_entry_ambiguous",
195
+ aliases: [],
196
+ },
173
197
  {
174
198
  code: "body_file_conflicts_with_body",
175
199
  meaning: "Body file conflicts with body condition.",
@@ -1199,6 +1223,18 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
1199
1223
  canonical_code: "history_drift_unreadable_stream",
1200
1224
  aliases: ["validate_history_drift_unreadable_streams"],
1201
1225
  },
1226
+ {
1227
+ code: "history_drift_version_skew",
1228
+ meaning: "History drift version skew condition.",
1229
+ stability: "stable",
1230
+ exit_code: 1,
1231
+ class: "generic_failure",
1232
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1233
+ sources: ["core/diagnostics/remediation.ts"],
1234
+ emitting_commands: ["*"],
1235
+ canonical_code: "history_drift_version_skew",
1236
+ aliases: ["validate_history_drift_version_skews"],
1237
+ },
1202
1238
  {
1203
1239
  code: "history_merge_conflict_markers_detected",
1204
1240
  meaning: "History merge conflict markers detected condition.",
@@ -2052,18 +2088,6 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
2052
2088
  canonical_code: "merge_receipts_pending",
2053
2089
  aliases: [],
2054
2090
  },
2055
- {
2056
- code: "merge_reconcile_discards_require_acceptance",
2057
- meaning: "Merge reconcile discards require acceptance condition.",
2058
- stability: "provisional",
2059
- exit_code: 4,
2060
- class: "conflict",
2061
- recovery: "Inspect the structured error guidance and retry the suggested command.",
2062
- sources: ["sdk/merge/reconcile.ts"],
2063
- emitting_commands: ["*"],
2064
- canonical_code: "merge_reconcile_discards_require_acceptance",
2065
- aliases: [],
2066
- },
2067
2091
  {
2068
2092
  code: "merge_reconcile_receipt_evidence_untrusted",
2069
2093
  meaning: "Merge reconcile receipt evidence untrusted condition.",
@@ -2088,6 +2112,42 @@ export const PM_ERROR_CODE_CATALOG_PART_1 = [
2088
2112
  canonical_code: "merge_root_not_found",
2089
2113
  aliases: [],
2090
2114
  },
2115
+ {
2116
+ code: "missing_allowed_values",
2117
+ meaning: "Missing allowed values condition.",
2118
+ stability: "provisional",
2119
+ exit_code: 1,
2120
+ class: "generic_failure",
2121
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
2122
+ sources: ["sdk/agent/refusal-closure.ts"],
2123
+ emitting_commands: ["*"],
2124
+ canonical_code: "missing_allowed_values",
2125
+ aliases: [],
2126
+ },
2127
+ {
2128
+ code: "missing_budget",
2129
+ meaning: "Missing budget condition.",
2130
+ stability: "provisional",
2131
+ exit_code: 1,
2132
+ class: "generic_failure",
2133
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
2134
+ sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
2135
+ emitting_commands: ["*"],
2136
+ canonical_code: "missing_budget",
2137
+ aliases: [],
2138
+ },
2139
+ {
2140
+ code: "missing_cli_flag",
2141
+ meaning: "Missing cli flag condition.",
2142
+ stability: "provisional",
2143
+ exit_code: 1,
2144
+ class: "generic_failure",
2145
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
2146
+ sources: ["sdk/cli-contracts/tool-option-contracts.ts"],
2147
+ emitting_commands: ["*"],
2148
+ canonical_code: "missing_cli_flag",
2149
+ aliases: [],
2150
+ },
2091
2151
  ];
2092
2152
  //# sourceMappingURL=generated-error-code-catalog-part-1.js.map
2093
- //# debugId=c51fce27-5acd-513d-83c4-5fd75bd999f9
2153
+ //# debugId=0823f083-1719-5ec2-9f7e-43bd86a2a3a2
@@ -1,43 +1,7 @@
1
1
  /** Generated partition 2 of the exhaustive error-code catalog. */
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b5722b34-7560-5460-8280-8666a27e5490")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="015f826a-6490-56d1-8e26-131e5503d8f1")}catch(e){}}();
4
4
  export const PM_ERROR_CODE_CATALOG_PART_2 = [
5
- {
6
- code: "missing_allowed_values",
7
- meaning: "Missing allowed values condition.",
8
- stability: "provisional",
9
- exit_code: 1,
10
- class: "generic_failure",
11
- recovery: "Inspect the structured error guidance and retry the suggested command.",
12
- sources: ["sdk/agent/refusal-closure.ts"],
13
- emitting_commands: ["*"],
14
- canonical_code: "missing_allowed_values",
15
- aliases: [],
16
- },
17
- {
18
- code: "missing_budget",
19
- meaning: "Missing budget condition.",
20
- stability: "provisional",
21
- exit_code: 1,
22
- class: "generic_failure",
23
- recovery: "Inspect the structured error guidance and retry the suggested command.",
24
- sources: ["sdk/cli-contracts/flag-lexicon-contracts.ts"],
25
- emitting_commands: ["*"],
26
- canonical_code: "missing_budget",
27
- aliases: [],
28
- },
29
- {
30
- code: "missing_cli_flag",
31
- meaning: "Missing cli flag condition.",
32
- stability: "provisional",
33
- exit_code: 1,
34
- class: "generic_failure",
35
- recovery: "Inspect the structured error guidance and retry the suggested command.",
36
- sources: ["sdk/cli-contracts/tool-option-contracts.ts"],
37
- emitting_commands: ["*"],
38
- canonical_code: "missing_cli_flag",
39
- aliases: [],
40
- },
41
5
  {
42
6
  code: "missing_destination",
43
7
  meaning: "Missing destination condition.",
@@ -122,6 +86,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
122
86
  canonical_code: "missing_parameter_alias",
123
87
  aliases: [],
124
88
  },
89
+ {
90
+ code: "missing_positive_execution_receipt",
91
+ meaning: "Missing positive execution receipt condition.",
92
+ stability: "provisional",
93
+ exit_code: 1,
94
+ class: "generic_failure",
95
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
96
+ sources: ["sdk/test/execution.ts"],
97
+ emitting_commands: ["*"],
98
+ canonical_code: "missing_positive_execution_receipt",
99
+ aliases: [],
100
+ },
125
101
  {
126
102
  code: "missing_probe",
127
103
  meaning: "Missing probe condition.",
@@ -331,6 +307,42 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
331
307
  canonical_code: "non_refusal_exit",
332
308
  aliases: [],
333
309
  },
310
+ {
311
+ code: "npm_pack_json_shape_unsupported",
312
+ meaning: "Npm pack json shape unsupported condition.",
313
+ stability: "provisional",
314
+ exit_code: 1,
315
+ class: "generic_failure",
316
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
317
+ sources: ["sdk/extension/install-sources.ts"],
318
+ emitting_commands: ["*"],
319
+ canonical_code: "npm_pack_json_shape_unsupported",
320
+ aliases: [],
321
+ },
322
+ {
323
+ code: "npm_package_archive_missing",
324
+ meaning: "Npm package archive missing condition.",
325
+ stability: "provisional",
326
+ exit_code: 1,
327
+ class: "generic_failure",
328
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
329
+ sources: ["sdk/extension/install-sources.ts"],
330
+ emitting_commands: ["*"],
331
+ canonical_code: "npm_package_archive_missing",
332
+ aliases: [],
333
+ },
334
+ {
335
+ code: "npm_package_archive_unsafe",
336
+ meaning: "Npm package archive unsafe condition.",
337
+ stability: "provisional",
338
+ exit_code: 1,
339
+ class: "generic_failure",
340
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
341
+ sources: ["sdk/extension/install-sources.ts"],
342
+ emitting_commands: ["*"],
343
+ canonical_code: "npm_package_archive_unsafe",
344
+ aliases: [],
345
+ },
334
346
  {
335
347
  code: "npm_package_not_found",
336
348
  meaning: "Npm package not found condition.",
@@ -727,6 +739,30 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
727
739
  canonical_code: "reopen_target_status_invalid",
728
740
  aliases: [],
729
741
  },
742
+ {
743
+ code: "reported_zero_passes",
744
+ meaning: "Reported zero passes condition.",
745
+ stability: "provisional",
746
+ exit_code: 1,
747
+ class: "generic_failure",
748
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
749
+ sources: ["sdk/test/execution.ts"],
750
+ emitting_commands: ["*"],
751
+ canonical_code: "reported_zero_passes",
752
+ aliases: [],
753
+ },
754
+ {
755
+ code: "reported_zero_tests",
756
+ meaning: "Reported zero tests condition.",
757
+ stability: "provisional",
758
+ exit_code: 1,
759
+ class: "generic_failure",
760
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
761
+ sources: ["sdk/test/execution.ts"],
762
+ emitting_commands: ["*"],
763
+ canonical_code: "reported_zero_tests",
764
+ aliases: [],
765
+ },
730
766
  {
731
767
  code: "reserved_item_field",
732
768
  meaning: "Reserved item field condition.",
@@ -1572,6 +1608,18 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
1572
1608
  canonical_code: "history_drift_unreadable_stream",
1573
1609
  aliases: [],
1574
1610
  },
1611
+ {
1612
+ code: "validate_history_drift_version_skews",
1613
+ meaning: "Validate history drift version skews condition.",
1614
+ stability: "stable",
1615
+ exit_code: 1,
1616
+ class: "generic_failure",
1617
+ recovery: "Inspect the structured error guidance and retry the suggested command.",
1618
+ sources: ["core/diagnostics/remediation.ts"],
1619
+ emitting_commands: ["*"],
1620
+ canonical_code: "history_drift_version_skew",
1621
+ aliases: [],
1622
+ },
1575
1623
  {
1576
1624
  code: "validate_history_unknown_author_events",
1577
1625
  meaning: "Validate history unknown author events condition.",
@@ -2114,4 +2162,4 @@ export const PM_ERROR_CODE_CATALOG_PART_2 = [
2114
2162
  },
2115
2163
  ];
2116
2164
  //# sourceMappingURL=generated-error-code-catalog-part-2.js.map
2117
- //# debugId=b5722b34-7560-5460-8280-8666a27e5490
2165
+ //# debugId=015f826a-6490-56d1-8e26-131e5503d8f1
@@ -4,7 +4,7 @@
4
4
  * Implements the pm health command surface and its agent-facing runtime behavior.
5
5
  */
6
6
 
7
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="652d1b49-f9d1-55a7-84b5-ff3cf57648ad")}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]="3c68e4be-fd09-560c-9654-f270e5d7ba73")}catch(e){}}();
8
8
  import fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import { assertInitializedTracker } from "../environment/tracker-preflight.js";
@@ -962,20 +962,36 @@ const HEALTH_DETAIL_SUMMARIZERS = {
962
962
  skipped: details.skipped,
963
963
  };
964
964
  },
965
- history_drift: (details, limit) => ({
966
- checked_items: details.checked_items,
967
- counts: details.counts,
968
- drifted_items: summarizeStringList(details.drifted_items, limit),
969
- merge_receipt_attributed_items: summarizeStringList(details.merge_receipt_attributed_items, limit),
970
- missing_streams: summarizeStringList(details.missing_streams, limit),
971
- unreadable_streams: summarizeStringList(details.unreadable_streams, limit),
972
- hash_mismatches: summarizeStringList(details.hash_mismatches, limit),
973
- chain_mismatches: summarizeStringList(details.chain_mismatches, limit),
974
- workspace_state_mismatches: summarizeStringList(details.workspace_state_mismatches, limit),
975
- workspace_state_missing: summarizeStringList(details.workspace_state_missing, limit),
976
- workspace_state_unreadable: summarizeStringList(details.workspace_state_unreadable, limit),
977
- skipped: details.skipped,
978
- }),
965
+ history_drift: (details, limit) => {
966
+ const cacheConfirmation = typeof details.cache_confirmation === "object" &&
967
+ details.cache_confirmation !== null
968
+ ? details.cache_confirmation
969
+ : undefined;
970
+ return {
971
+ checked_items: details.checked_items,
972
+ cache_hit_verification: details.cache_hit_verification,
973
+ cache_confirmation: cacheConfirmation === undefined
974
+ ? details.cache_confirmation
975
+ : {
976
+ ...cacheConfirmation,
977
+ candidate_items: summarizeStringList(cacheConfirmation.candidate_items, limit),
978
+ confirmed_items: summarizeStringList(cacheConfirmation.confirmed_items, limit),
979
+ resolved_false_positive_items: summarizeStringList(cacheConfirmation.resolved_false_positive_items, limit),
980
+ },
981
+ counts: details.counts,
982
+ drifted_items: summarizeStringList(details.drifted_items, limit),
983
+ merge_receipt_attributed_items: summarizeStringList(details.merge_receipt_attributed_items, limit),
984
+ missing_streams: summarizeStringList(details.missing_streams, limit),
985
+ unreadable_streams: summarizeStringList(details.unreadable_streams, limit),
986
+ hash_mismatches: summarizeStringList(details.hash_mismatches, limit),
987
+ chain_mismatches: summarizeStringList(details.chain_mismatches, limit),
988
+ version_skews: summarizeStringList(details.version_skews, limit),
989
+ workspace_state_mismatches: summarizeStringList(details.workspace_state_mismatches, limit),
990
+ workspace_state_missing: summarizeStringList(details.workspace_state_missing, limit),
991
+ workspace_state_unreadable: summarizeStringList(details.workspace_state_unreadable, limit),
992
+ skipped: details.skipped,
993
+ };
994
+ },
979
995
  vectorization: (details, limit) => ({
980
996
  semantic_runtime_available: details.semantic_runtime_available,
981
997
  compatibility_mode_auto_defaults: details.compatibility_mode_auto_defaults,
@@ -1412,14 +1428,41 @@ async function buildLocksCheck(pmRoot) {
1412
1428
  warnings,
1413
1429
  };
1414
1430
  }
1415
- async function buildHistoryDriftCheck(pmRoot, items) {
1431
+ async function buildHistoryDriftCheck(params) {
1416
1432
  const cacheHitVerification = "metadata";
1417
- const { missingStreams, unreadableStreams, hashMismatches, chainMismatches, driftedItems, workspaceStateMismatches, workspaceStateMissing, workspaceStateUnreadable, } = await scanHistoryDrift(pmRoot, items, { cacheHitVerification });
1433
+ let items = params.items;
1434
+ let drift = await scanHistoryDrift(params.pmRoot, items, {
1435
+ cacheHitVerification,
1436
+ });
1437
+ const cacheConfirmationCandidates = [
1438
+ ...new Set([
1439
+ ...drift.hashMismatches,
1440
+ ...drift.chainMismatches,
1441
+ ...drift.versionSkews,
1442
+ ]),
1443
+ ].sort((left, right) => left.localeCompare(right));
1444
+ let confirmedItems = [];
1445
+ let resolvedFalsePositiveItems = [];
1446
+ if (cacheConfirmationCandidates.length > 0) {
1447
+ items = await listAllItemMetadataWithBody(params.pmRoot, params.settings.item_format, params.typeRegistry.type_to_folder, params.itemReadWarnings, params.settings.schema, { forceSourceScan: true });
1448
+ drift = await scanHistoryDrift(params.pmRoot, items);
1449
+ confirmedItems = [
1450
+ ...new Set([
1451
+ ...drift.hashMismatches,
1452
+ ...drift.chainMismatches,
1453
+ ...drift.versionSkews,
1454
+ ]),
1455
+ ].sort((left, right) => left.localeCompare(right));
1456
+ const confirmedSet = new Set(confirmedItems);
1457
+ resolvedFalsePositiveItems = cacheConfirmationCandidates.filter((id) => !confirmedSet.has(id));
1458
+ }
1459
+ const { missingStreams, unreadableStreams, hashMismatches, chainMismatches, versionSkews, driftedItems, workspaceStateMismatches, workspaceStateMissing, workspaceStateUnreadable, } = drift;
1418
1460
  const warnings = [
1419
1461
  ...missingStreams.map((id) => `history_drift_missing_stream:${id}`),
1420
1462
  ...unreadableStreams.map((id) => `history_drift_unreadable_stream:${id}`),
1421
1463
  ...hashMismatches.map((id) => `history_drift_hash_mismatch:${id}`),
1422
1464
  ...chainMismatches.map((id) => `history_drift_chain_mismatch:${id}`),
1465
+ ...versionSkews.map((id) => `history_drift_version_skew:${id}`),
1423
1466
  ...workspaceStateMismatches.map((documentPath) => `history_drift_workspace_state_mismatch:${documentPath}`),
1424
1467
  ...workspaceStateMissing.map((documentPath) => `history_drift_workspace_state_missing:${documentPath}`),
1425
1468
  ...workspaceStateUnreadable.map((documentPath) => `history_drift_workspace_state_unreadable:${documentPath}`),
@@ -1431,7 +1474,19 @@ async function buildHistoryDriftCheck(pmRoot, items) {
1431
1474
  ok: warnings.length === 0,
1432
1475
  details: {
1433
1476
  checked_items: items.length,
1434
- cache_hit_verification: cacheHitVerification,
1477
+ cache_hit_verification: cacheConfirmationCandidates.length > 0
1478
+ ? "metadata_then_content_hash"
1479
+ : cacheHitVerification,
1480
+ cache_confirmation: {
1481
+ triggered: cacheConfirmationCandidates.length > 0,
1482
+ reason: cacheConfirmationCandidates.length > 0
1483
+ ? "cached_corruption_candidate"
1484
+ : null,
1485
+ candidate_items: cacheConfirmationCandidates,
1486
+ confirmed_items: confirmedItems,
1487
+ resolved_false_positive_items: resolvedFalsePositiveItems,
1488
+ authoritative_item_source: cacheConfirmationCandidates.length > 0,
1489
+ },
1435
1490
  drifted_items: driftedItems,
1436
1491
  counts: {
1437
1492
  drifted: driftedItems.length,
@@ -1439,6 +1494,7 @@ async function buildHistoryDriftCheck(pmRoot, items) {
1439
1494
  unreadable_streams: unreadableStreams.length,
1440
1495
  hash_mismatches: hashMismatches.length,
1441
1496
  chain_mismatches: chainMismatches.length,
1497
+ version_skews: versionSkews.length,
1442
1498
  workspace_state_mismatches: workspaceStateMismatches.length,
1443
1499
  workspace_state_missing: workspaceStateMissing.length,
1444
1500
  workspace_state_unreadable: workspaceStateUnreadable.length,
@@ -1447,6 +1503,7 @@ async function buildHistoryDriftCheck(pmRoot, items) {
1447
1503
  unreadable_streams: unreadableStreams,
1448
1504
  hash_mismatches: hashMismatches,
1449
1505
  chain_mismatches: chainMismatches,
1506
+ version_skews: versionSkews,
1450
1507
  workspace_state_mismatches: workspaceStateMismatches,
1451
1508
  workspace_state_missing: workspaceStateMissing,
1452
1509
  workspace_state_unreadable: workspaceStateUnreadable,
@@ -1940,7 +1997,8 @@ function buildHealthFindings(params) {
1940
1997
  function rewriteBulkHealthRemediation(params) {
1941
1998
  if (params.check.name === "history_drift" && params.historyDriftedCount > 1) {
1942
1999
  for (const code of Object.keys(params.remediationMap)) {
1943
- if (code !== "history_drift_merge_receipt") {
2000
+ if (code !== "history_drift_merge_receipt" &&
2001
+ code !== "history_drift_version_skew") {
1944
2002
  params.remediationMap[code] = "pm history-repair --all";
1945
2003
  }
1946
2004
  }
@@ -2086,7 +2144,6 @@ export async function runHealth(global, options = {}) {
2086
2144
  itemReadWarnings,
2087
2145
  });
2088
2146
  const itemsWithBody = items;
2089
- const normalizedItemReadWarnings = [...new Set(itemReadWarnings)];
2090
2147
  const historyPolicy = skipPolicy.skipDrift
2091
2148
  ? { warnings: [] }
2092
2149
  : await enforceHistoryStreamPolicyForItems({
@@ -2119,7 +2176,14 @@ export async function runHealth(global, options = {}) {
2119
2176
  : await buildIntegrityCheck(pmRoot, typeRegistry.type_to_folder, settings.schema, options.requireMergeDrivers === true, items);
2120
2177
  const historyDriftCheck = skipPolicy.skipDrift
2121
2178
  ? buildSkippedHealthCheck("history_drift")
2122
- : await buildHistoryDriftCheck(pmRoot, itemsWithBody);
2179
+ : await buildHistoryDriftCheck({
2180
+ pmRoot,
2181
+ items: itemsWithBody,
2182
+ settings,
2183
+ typeRegistry,
2184
+ itemReadWarnings,
2185
+ });
2186
+ const normalizedItemReadWarnings = [...new Set(itemReadWarnings)];
2123
2187
  const mergeReceiptAttributedHistoryDriftItems = await correlateMergeReceiptHistoryDriftItems({
2124
2188
  gitWorkspaceRoot: integrityCheck.gitWorkspaceRoot,
2125
2189
  pendingMergeReceipts: integrityCheck.pendingMergeReceipts,
@@ -2234,4 +2298,4 @@ export const _testOnlyHealthCommand = {
2234
2298
  warningCode,
2235
2299
  };
2236
2300
  //# sourceMappingURL=health.js.map
2237
- //# debugId=652d1b49-f9d1-55a7-84b5-ff3cf57648ad
2301
+ //# debugId=3c68e4be-fd09-560c-9654-f270e5d7ba73
@@ -6,7 +6,7 @@
6
6
  * orchestration module.
7
7
  */
8
8
 
9
- !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]="a1261d65-222c-5c6c-8634-a4413a91aba9")}catch(e){}}();
9
+ !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]="8bec3c39-b871-5c7c-907c-6da66274d9be")}catch(e){}}();
10
10
  import { scanHistoryDrift } from "../../core/history/drift-scan.js";
11
11
  const DEFAULT_DIAGNOSTIC_LIMIT = 5;
12
12
  /** Build the validation warning and bounded evidence projection for history drift. */
@@ -17,6 +17,7 @@ export async function buildValidateHistoryDriftCheck(pmRoot, items, verboseDiagn
17
17
  ["validate_history_drift_unreadable_streams", drift.unreadableStreams.length],
18
18
  ["validate_history_drift_hash_mismatches", drift.hashMismatches.length],
19
19
  ["validate_history_drift_chain_mismatches", drift.chainMismatches.length],
20
+ ["validate_history_drift_version_skews", drift.versionSkews.length],
20
21
  [
21
22
  "validate_history_drift_workspace_state_mismatches",
22
23
  drift.workspaceStateMismatches.length,
@@ -52,6 +53,7 @@ export async function buildValidateHistoryDriftCheck(pmRoot, items, verboseDiagn
52
53
  unreadable_streams: drift.unreadableStreams.length,
53
54
  hash_mismatches: drift.hashMismatches.length,
54
55
  chain_mismatches: drift.chainMismatches.length,
56
+ version_skews: drift.versionSkews.length,
55
57
  workspace_state_mismatches: drift.workspaceStateMismatches.length,
56
58
  workspace_state_missing: drift.workspaceStateMissing.length,
57
59
  workspace_state_unreadable: drift.workspaceStateUnreadable.length,
@@ -59,10 +61,11 @@ export async function buildValidateHistoryDriftCheck(pmRoot, items, verboseDiagn
59
61
  workspace_state_mismatches: drift.workspaceStateMismatches,
60
62
  workspace_state_missing: drift.workspaceStateMissing,
61
63
  workspace_state_unreadable: drift.workspaceStateUnreadable,
64
+ version_skews: drift.versionSkews.slice(0, diagnosticLimit),
62
65
  },
63
66
  },
64
67
  warnings,
65
68
  };
66
69
  }
67
70
  //# sourceMappingURL=validate-history-drift.js.map
68
- //# debugId=a1261d65-222c-5c6c-8634-a4413a91aba9
71
+ //# debugId=8bec3c39-b871-5c7c-907c-6da66274d9be