create-principles-disciple 1.148.11 → 1.150.1

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 (250) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/codex-adapter/dist/pd-hook.d.ts +22 -1
  3. package/codex-adapter/dist/pd-hook.js +81 -7
  4. package/codex-adapter/dist/worker/workspace-worker.d.ts +15 -0
  5. package/codex-adapter/dist/worker/workspace-worker.js +7 -36
  6. package/codex-adapter/package.json +1 -1
  7. package/console/dist/server/index.js +21 -0
  8. package/console/dist/server/models/ActivationsConsoleModel.d.ts +3 -17
  9. package/console/dist/server/models/ActivationsConsoleModel.js +5 -44
  10. package/console/dist/server/routes/compatibility-scan.d.ts +18 -0
  11. package/console/dist/server/routes/compatibility-scan.js +33 -0
  12. package/console/dist/server/routes/diagnostician.d.ts +50 -0
  13. package/console/dist/server/routes/diagnostician.js +388 -0
  14. package/console/dist/shared/compatibility-scan-contract.d.ts +26 -0
  15. package/console/dist/shared/compatibility-scan-contract.js +1 -0
  16. package/console/dist/web/assets/app.js +31 -31
  17. package/core/dist/host/host-installer.d.ts +7 -0
  18. package/core/dist/host/host-installer.d.ts.map +1 -1
  19. package/core/dist/host/host-installer.js.map +1 -1
  20. package/core/dist/runtime/activation/index.d.ts +3 -3
  21. package/core/dist/runtime/activation/index.d.ts.map +1 -1
  22. package/core/dist/runtime/activation/index.js +1 -1
  23. package/core/dist/runtime/activation/index.js.map +1 -1
  24. package/core/dist/runtime/activation/promotion-readiness-evaluator.d.ts +25 -1
  25. package/core/dist/runtime/activation/promotion-readiness-evaluator.d.ts.map +1 -1
  26. package/core/dist/runtime/activation/promotion-readiness-evaluator.js +58 -1
  27. package/core/dist/runtime/activation/promotion-readiness-evaluator.js.map +1 -1
  28. package/core/dist/runtime/activation/promotion-readiness-reader.d.ts.map +1 -1
  29. package/core/dist/runtime/activation/promotion-readiness-reader.js +4 -2
  30. package/core/dist/runtime/activation/promotion-readiness-reader.js.map +1 -1
  31. package/core/dist/runtime/activation/rulecode-owner-decision-service.d.ts +28 -0
  32. package/core/dist/runtime/activation/rulecode-owner-decision-service.d.ts.map +1 -1
  33. package/core/dist/runtime/activation/rulecode-owner-decision-service.js +2 -0
  34. package/core/dist/runtime/activation/rulecode-owner-decision-service.js.map +1 -1
  35. package/core/dist/runtime/activation-compatibility-read-model.d.ts +20 -5
  36. package/core/dist/runtime/activation-compatibility-read-model.d.ts.map +1 -1
  37. package/core/dist/runtime/activation-compatibility-read-model.js +15 -3
  38. package/core/dist/runtime/activation-compatibility-read-model.js.map +1 -1
  39. package/core/dist/runtime/admission-gate.d.ts +8 -1
  40. package/core/dist/runtime/admission-gate.d.ts.map +1 -1
  41. package/core/dist/runtime/admission-gate.js +2 -1
  42. package/core/dist/runtime/admission-gate.js.map +1 -1
  43. package/core/dist/runtime/config/pd-config-defaults.d.ts.map +1 -1
  44. package/core/dist/runtime/config/pd-config-defaults.js +20 -2
  45. package/core/dist/runtime/config/pd-config-defaults.js.map +1 -1
  46. package/core/dist/runtime/config/pd-config-validate.d.ts.map +1 -1
  47. package/core/dist/runtime/config/pd-config-validate.js +18 -0
  48. package/core/dist/runtime/config/pd-config-validate.js.map +1 -1
  49. package/core/dist/runtime/context-payload.d.ts +48 -3
  50. package/core/dist/runtime/context-payload.d.ts.map +1 -1
  51. package/core/dist/runtime/context-payload.js +38 -0
  52. package/core/dist/runtime/context-payload.js.map +1 -1
  53. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts +8 -2
  54. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  55. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +28 -2
  56. package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
  57. package/core/dist/runtime/diagnostician-candidate.d.ts +24 -0
  58. package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -0
  59. package/core/dist/runtime/diagnostician-candidate.js +55 -0
  60. package/core/dist/runtime/diagnostician-candidate.js.map +1 -0
  61. package/core/dist/runtime/evidence-guards.d.ts +10 -4
  62. package/core/dist/runtime/evidence-guards.d.ts.map +1 -1
  63. package/core/dist/runtime/evidence-guards.js +12 -5
  64. package/core/dist/runtime/evidence-guards.js.map +1 -1
  65. package/core/dist/runtime/evolution/evolution-types.d.ts +4 -4
  66. package/core/dist/runtime/evolution/evolution-types.d.ts.map +1 -1
  67. package/core/dist/runtime/evolution/evolution-types.js +1 -0
  68. package/core/dist/runtime/evolution/evolution-types.js.map +1 -1
  69. package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
  70. package/core/dist/runtime/feature-flags/feature-flag-contract.js +14 -0
  71. package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
  72. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
  73. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +16 -0
  74. package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
  75. package/core/dist/runtime/index.d.ts +5 -2
  76. package/core/dist/runtime/index.d.ts.map +1 -1
  77. package/core/dist/runtime/index.js +6 -1
  78. package/core/dist/runtime/index.js.map +1 -1
  79. package/core/dist/runtime/internalization/index.d.ts +1 -0
  80. package/core/dist/runtime/internalization/index.d.ts.map +1 -1
  81. package/core/dist/runtime/internalization/index.js +2 -0
  82. package/core/dist/runtime/internalization/index.js.map +1 -1
  83. package/core/dist/runtime/internalization/rule-host-contracts.d.ts +10 -0
  84. package/core/dist/runtime/internalization/rule-host-contracts.d.ts.map +1 -1
  85. package/core/dist/runtime/internalization/rule-host-evaluator.js +10 -10
  86. package/core/dist/runtime/internalization/rule-host-evaluator.js.map +1 -1
  87. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts +7 -6
  88. package/core/dist/runtime/internalization/rule-host-input-builder.d.ts.map +1 -1
  89. package/core/dist/runtime/internalization/rule-host-input-builder.js +6 -2
  90. package/core/dist/runtime/internalization/rule-host-input-builder.js.map +1 -1
  91. package/core/dist/runtime/internalization/rule-host-result-normalizer.d.ts +33 -0
  92. package/core/dist/runtime/internalization/rule-host-result-normalizer.d.ts.map +1 -0
  93. package/core/dist/runtime/internalization/rule-host-result-normalizer.js +61 -0
  94. package/core/dist/runtime/internalization/rule-host-result-normalizer.js.map +1 -0
  95. package/core/dist/runtime/internalization/rule-host-validator.d.ts.map +1 -1
  96. package/core/dist/runtime/internalization/rule-host-validator.js +17 -0
  97. package/core/dist/runtime/internalization/rule-host-validator.js.map +1 -1
  98. package/core/dist/runtime/pain-ingress-payload.d.ts +27 -2
  99. package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
  100. package/core/dist/runtime/pain-ingress-payload.js +45 -3
  101. package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
  102. package/core/dist/runtime/pain-ingress.d.ts +4 -2
  103. package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
  104. package/core/dist/runtime/pain-ingress.js +23 -3
  105. package/core/dist/runtime/pain-ingress.js.map +1 -1
  106. package/core/dist/runtime/pain-severity.d.ts +14 -0
  107. package/core/dist/runtime/pain-severity.d.ts.map +1 -0
  108. package/core/dist/runtime/pain-severity.js +14 -0
  109. package/core/dist/runtime/pain-severity.js.map +1 -0
  110. package/core/dist/runtime/pain-signal-bridge.d.ts +17 -3
  111. package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
  112. package/core/dist/runtime/pain-signal-bridge.js +6 -0
  113. package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
  114. package/core/dist/runtime/pain-signal-observability.d.ts.map +1 -1
  115. package/core/dist/runtime/pain-signal-observability.js +3 -2
  116. package/core/dist/runtime/pain-signal-observability.js.map +1 -1
  117. package/core/dist/runtime/pain-submit-capability.d.ts +164 -0
  118. package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -0
  119. package/core/dist/runtime/pain-submit-capability.js +442 -0
  120. package/core/dist/runtime/pain-submit-capability.js.map +1 -0
  121. package/core/dist/runtime/pain-to-principle-service.d.ts +4 -0
  122. package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
  123. package/core/dist/runtime/pain-to-principle-service.js +2 -0
  124. package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
  125. package/core/dist/runtime/stalled-diagnostician-task-read-model.d.ts +56 -10
  126. package/core/dist/runtime/stalled-diagnostician-task-read-model.d.ts.map +1 -1
  127. package/core/dist/runtime/stalled-diagnostician-task-read-model.js +80 -4
  128. package/core/dist/runtime/stalled-diagnostician-task-read-model.js.map +1 -1
  129. package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
  130. package/core/dist/runtime/store/context/sqlite-context-assembler.js +11 -0
  131. package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
  132. package/core/dist/runtime/store/run/memory-run-store.d.ts +10 -0
  133. package/core/dist/runtime/store/run/memory-run-store.d.ts.map +1 -1
  134. package/core/dist/runtime/store/run/memory-run-store.js +21 -0
  135. package/core/dist/runtime/store/run/memory-run-store.js.map +1 -1
  136. package/core/dist/runtime/store/run/run-store.d.ts +12 -0
  137. package/core/dist/runtime/store/run/run-store.d.ts.map +1 -1
  138. package/core/dist/runtime/store/run/sqlite-run-store.d.ts +1 -0
  139. package/core/dist/runtime/store/run/sqlite-run-store.d.ts.map +1 -1
  140. package/core/dist/runtime/store/run/sqlite-run-store.js +14 -0
  141. package/core/dist/runtime/store/run/sqlite-run-store.js.map +1 -1
  142. package/core/dist/runtime/task-status.d.ts +9 -0
  143. package/core/dist/runtime/task-status.d.ts.map +1 -1
  144. package/core/dist/runtime/task-status.js +7 -1
  145. package/core/dist/runtime/task-status.js.map +1 -1
  146. package/core/dist/runtime/types/evidence-chain-contract.d.ts +18 -0
  147. package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
  148. package/core/dist/runtime/types/evidence-chain-contract.js +37 -7
  149. package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
  150. package/core/package.json +5 -1
  151. package/dist/install-summary.d.ts +7 -0
  152. package/dist/install-summary.d.ts.map +1 -1
  153. package/dist/install-summary.js +4 -0
  154. package/dist/install-summary.js.map +1 -1
  155. package/dist/installer.d.ts +92 -8
  156. package/dist/installer.d.ts.map +1 -1
  157. package/dist/installer.js +215 -10
  158. package/dist/installer.js.map +1 -1
  159. package/dist/installers/codex-host-installer.d.ts +88 -1
  160. package/dist/installers/codex-host-installer.d.ts.map +1 -1
  161. package/dist/installers/codex-host-installer.js +350 -11
  162. package/dist/installers/codex-host-installer.js.map +1 -1
  163. package/dist/installers/index.d.ts +23 -0
  164. package/dist/installers/index.d.ts.map +1 -1
  165. package/dist/installers/index.js +38 -1
  166. package/dist/installers/index.js.map +1 -1
  167. package/dist/installers/legacy-workbuddy-skill.d.ts +59 -0
  168. package/dist/installers/legacy-workbuddy-skill.d.ts.map +1 -0
  169. package/dist/installers/legacy-workbuddy-skill.js +168 -0
  170. package/dist/installers/legacy-workbuddy-skill.js.map +1 -0
  171. package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
  172. package/dist/installers/workbuddy-host-installer.js +7 -0
  173. package/dist/installers/workbuddy-host-installer.js.map +1 -1
  174. package/host-runtime/dist/adaptive-priority-provider.d.ts +94 -0
  175. package/host-runtime/dist/adaptive-priority-provider.js +162 -0
  176. package/host-runtime/dist/adaptive-selection.d.ts +164 -0
  177. package/host-runtime/dist/adaptive-selection.js +506 -0
  178. package/host-runtime/dist/diagnostician-auto-run.d.ts +28 -0
  179. package/host-runtime/dist/diagnostician-auto-run.js +100 -0
  180. package/host-runtime/dist/host-tool-semantic-resolver.d.ts +42 -1
  181. package/host-runtime/dist/host-tool-semantic-resolver.js +80 -14
  182. package/host-runtime/dist/index.d.ts +4 -0
  183. package/host-runtime/dist/index.js +6 -0
  184. package/host-runtime/dist/production-rulehost-gate.js +17 -17
  185. package/host-runtime/dist/rulecode-event-collection.d.ts +31 -0
  186. package/host-runtime/dist/rulecode-event-collection.js +62 -0
  187. package/host-runtime/package.json +1 -1
  188. package/install-layout/dist/index.d.ts +1 -1
  189. package/install-layout/dist/index.js +1 -1
  190. package/install-layout/dist/pd-home.d.ts +9 -2
  191. package/install-layout/dist/pd-home.js +77 -14
  192. package/install-layout/package.json +1 -1
  193. package/package.json +4 -4
  194. package/pd-cli/dist/commands/diagnose.d.ts +30 -0
  195. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  196. package/pd-cli/dist/commands/diagnose.js +75 -0
  197. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  198. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  199. package/pd-cli/dist/commands/pain-record.js +5 -4
  200. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  201. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
  202. package/pd-cli/dist/commands/pain-retry.js +2 -1
  203. package/pd-cli/dist/commands/pain-retry.js.map +1 -1
  204. package/pd-cli/dist/commands/runtime-activation.d.ts +6 -17
  205. package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
  206. package/pd-cli/dist/commands/runtime-activation.js +42 -48
  207. package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
  208. package/pd-cli/dist/commands/runtime-compatibility-scan.d.ts +5 -2
  209. package/pd-cli/dist/commands/runtime-compatibility-scan.d.ts.map +1 -1
  210. package/pd-cli/dist/commands/runtime-compatibility-scan.js +22 -2
  211. package/pd-cli/dist/commands/runtime-compatibility-scan.js.map +1 -1
  212. package/pd-cli/dist/index.js +1 -0
  213. package/pd-cli/dist/index.js.map +1 -1
  214. package/pd-cli/dist/services/config-doctor.d.ts +9 -0
  215. package/pd-cli/dist/services/config-doctor.d.ts.map +1 -1
  216. package/pd-cli/dist/services/config-doctor.js +15 -0
  217. package/pd-cli/dist/services/config-doctor.js.map +1 -1
  218. package/pd-cli/dist/services/delivery-surfaces.js +1 -1
  219. package/pd-cli/dist/services/delivery-surfaces.js.map +1 -1
  220. package/pd-cli/package.json +1 -1
  221. package/pd-mcp-server/dist/budget.d.ts +1 -1
  222. package/pd-mcp-server/dist/budget.js +2 -2
  223. package/pd-mcp-server/dist/envelope.d.ts +15 -0
  224. package/pd-mcp-server/dist/envelope.js +49 -1
  225. package/pd-mcp-server/dist/index.d.ts +2 -0
  226. package/pd-mcp-server/dist/index.js +6 -0
  227. package/pd-mcp-server/dist/server.d.ts +83 -14
  228. package/pd-mcp-server/dist/server.js +251 -4
  229. package/pd-mcp-server/dist/version.d.ts +1 -1
  230. package/pd-mcp-server/dist/version.js +1 -1
  231. package/pd-mcp-server/dist/workspace.d.ts +4 -2
  232. package/pd-mcp-server/dist/workspace.js +5 -2
  233. package/pd-mcp-server/package.json +1 -1
  234. package/plugin/dist/bundle.js +443 -431
  235. package/plugin/dist/core/evolution-reducer.d.ts +2 -2
  236. package/plugin/dist/hooks/hook-tool-semantics.d.ts +25 -0
  237. package/plugin/dist/hooks/pain-ingress-adapter.d.ts +1 -1
  238. package/plugin/dist/openclaw.plugin.json +1 -1
  239. package/plugin/dist/rulehost-evidence.js +1 -1
  240. package/plugin/openclaw.plugin.json +1 -1
  241. package/plugin/package.json +1 -1
  242. package/release-manager/dist/installer.js +215 -10
  243. package/release-manager/dist/installers/codex-host-installer.js +350 -11
  244. package/release-manager/dist/installers/index.js +38 -1
  245. package/release-manager/dist/installers/legacy-workbuddy-skill.js +168 -0
  246. package/release-manager/dist/installers/workbuddy-host-installer.js +7 -0
  247. package/release-manager/package.json +1 -1
  248. package/workbuddy-adapter/dist/pd-hook.js +20 -4
  249. package/workbuddy-adapter/package.json +1 -1
  250. package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +123 -20
package/dist/installer.js CHANGED
@@ -12,7 +12,8 @@ import { logger } from './utils/logger.js';
12
12
  import { checkOpenClawGateway, stopOpenClawGateway, restartOpenClawGateway } from './utils/env.js';
13
13
  import { t } from './i18n.js';
14
14
  import { generateConfigYamlContent, ExistingConfigVerifyInfraError, validateExistingConfigYamlForPreserve, getConfigYamlPath, readEnabledChannelsFromConfigYaml, getOpenClawDir, getPdDir, getPdRuntimeDir, getInstallManifestPath, getPdRuntimeBackupsDir, getPluginExtDir, getInstalledPluginDir, getInstalledLayoutPackageDir, getPdBackupsDir, getInstalledPdCliDir, getInstalledBinDir, getInstalledConsoleDir, getHomeDir, isWindows, } from './mvp-config.js';
15
- import { getHostInstallers } from './installers/index.js';
15
+ import { detectInstalledHosts, getHostInstallers } from './installers/index.js';
16
+ import { readCanonicalRuntimeCohort, readInstalledRuntimeCohort, resolvePluginDataRoot } from './installers/codex-host-installer.js';
16
17
  import { runWorkbuddyEarlyPreflight } from './installers/workbuddy-host-installer.js';
17
18
  import { INSTALL_LAYOUT_VERSION, getInstallLayoutPaths, getWorkbuddyWorkspaceDir, installManifestHostsForPersist, mergeInstallManifestWorkspaces, parseInstallManifest } from '@principles/install-layout';
18
19
  import { resolveMcpServerDir } from './mcp-server-layout-compat.js';
@@ -209,6 +210,25 @@ export function resolveHostRefreshTargets(persistedHosts, host) {
209
210
  }
210
211
  return targets;
211
212
  }
213
+ /** Union the detected (already-installed) hosts into the manifest host list. */
214
+ function withDetectedHosts(hosts, detected) {
215
+ const merged = [...hosts];
216
+ for (const host of detected) {
217
+ if (!merged.includes(host.hostId))
218
+ merged.push(host.hostId);
219
+ }
220
+ return merged;
221
+ }
222
+ /**
223
+ * One upgrade must cover every host that already carries PD (2026-11-11).
224
+ * Pure so the coverage rule is testable without running a whole install.
225
+ */
226
+ export function planUpgradeHosts(requested, persistedHosts, detected) {
227
+ return {
228
+ refreshTargets: resolveHostRefreshTargets([...persistedHosts, ...detected.map((host) => host.hostId)], requested),
229
+ newlyCovered: detected.filter((host) => !persistedHosts.includes(host.hostId)),
230
+ };
231
+ }
212
232
  /**
213
233
  * PRI-624 Slice C: the install manifest records every Workspace this install
214
234
  * serves so the Companion can discover its per-Workspace workers (SPEC §13
@@ -1331,16 +1351,52 @@ function protocolInvalid(detail) {
1331
1351
  remediation: 'The compatibility scanner returned an unexpected result. Re-download/rebuild the installer before upgrading. The current installation has not been replaced.',
1332
1352
  };
1333
1353
  }
1354
+ const MAX_SKIP_BUCKETS = 50;
1355
+ /** Sentinel so "absent scannedActivations" stays distinguishable from 0. */
1356
+ const INVALID_COUNT = Symbol('invalid-count');
1357
+ /** rc-4: validate every bucket field, not just "is an array". */
1358
+ function parseSkippedBuckets(value) {
1359
+ if (value === undefined)
1360
+ return [];
1361
+ if (!Array.isArray(value) || value.length > MAX_SKIP_BUCKETS)
1362
+ return null;
1363
+ const buckets = [];
1364
+ for (const entry of value) {
1365
+ if (!isRecord(entry))
1366
+ return null;
1367
+ const { reason } = entry;
1368
+ const { count } = entry;
1369
+ const samples = entry.sampleActivationIds;
1370
+ if (typeof reason !== 'string' || reason.length === 0)
1371
+ return null;
1372
+ if (typeof count !== 'number' || !Number.isInteger(count) || count <= 0)
1373
+ return null;
1374
+ if (!Array.isArray(samples) || !samples.every((id) => typeof id === 'string'))
1375
+ return null;
1376
+ buckets.push({ reason, count, sampleActivationIds: [...samples] });
1377
+ }
1378
+ return buckets;
1379
+ }
1380
+ function parseScannedActivations(value) {
1381
+ if (value === undefined)
1382
+ return undefined;
1383
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < 0)
1384
+ return INVALID_COUNT;
1385
+ return value;
1386
+ }
1334
1387
  /**
1335
1388
  * Strict (ok, status) protocol parse (P2, 2026-08-20).
1336
1389
  *
1337
1390
  * Boolean `ok` alone is NOT authoritative — the (ok, status) pair is the
1338
- * contract. Only ok=true + (clean|no_state_db) is a successful scan. Every
1339
- * other combination fails closed:
1340
- * - ok=true + refusal/success-impossible status → protocol invalid
1341
- * - ok=false + clean|no_state_db/unknown → protocol invalid
1391
+ * contract. Only ok=true + (clean|no_state_db|incomplete) is a successful
1392
+ * scan. Every other combination fails closed:
1393
+ * - ok=true + refusal status → protocol invalid
1394
+ * - ok=true + clean/no_state_db + skipped rows → protocol invalid (a
1395
+ * consumer may never quietly downgrade `incomplete` to `clean`)
1396
+ * - ok=true + incomplete + empty skipped → protocol invalid
1397
+ * - ok=false + clean|no_state_db|incomplete/unknown → protocol invalid
1342
1398
  * - ok=false + legacy_dependency|scan_failed|scan_unavailable → refusal
1343
- * - non-boolean / missing ok → protocol invalid
1399
+ * - non-boolean / missing ok → protocol invalid
1344
1400
  * The payload is never trusted to self-describe a pass.
1345
1401
  */
1346
1402
  export function parseCompatibilityScanStdout(stdout) {
@@ -1360,9 +1416,34 @@ export function parseCompatibilityScanStdout(stdout) {
1360
1416
  const status = typeof parsed.status === 'string' ? parsed.status : 'unknown';
1361
1417
  const reason = typeof parsed.reason === 'string' ? parsed.reason : undefined;
1362
1418
  const remediation = typeof parsed.remediation === 'string' ? parsed.remediation : undefined;
1419
+ const skipped = parseSkippedBuckets(parsed.skipped);
1420
+ if (skipped === null) {
1421
+ return protocolInvalid('skipped is not a valid [{reason,count,sampleActivationIds}] array');
1422
+ }
1423
+ const scannedActivations = parseScannedActivations(parsed.scannedActivations);
1424
+ if (scannedActivations === INVALID_COUNT) {
1425
+ return protocolInvalid('scannedActivations is not a non-negative integer');
1426
+ }
1427
+ const skippedTotal = skipped.reduce((sum, bucket) => sum + bucket.count, 0);
1428
+ const visibility = {
1429
+ skipped,
1430
+ ...(scannedActivations !== undefined ? { scannedActivations } : {}),
1431
+ };
1363
1432
  if (parsed.ok === true) {
1364
1433
  if (status === 'clean' || status === 'no_state_db') {
1365
- return { ok: true, status };
1434
+ // Hard constraint (5B): `incomplete` must never be degraded to `clean`
1435
+ // by a consumer. A payload that admits it skipped rows while claiming
1436
+ // clean is self-contradictory, not a pass.
1437
+ if (skipped.length > 0) {
1438
+ return protocolInvalid(`ok=true with status=${status} but skipped=${skippedTotal}`);
1439
+ }
1440
+ return { ok: true, status, ...visibility };
1441
+ }
1442
+ if (status === 'incomplete') {
1443
+ if (skipped.length === 0) {
1444
+ return protocolInvalid('ok=true with status=incomplete but skipped is empty');
1445
+ }
1446
+ return { ok: true, status, ...visibility };
1366
1447
  }
1367
1448
  return protocolInvalid(`ok=true with status=${status}`);
1368
1449
  }
@@ -1374,6 +1455,52 @@ export function parseCompatibilityScanStdout(stdout) {
1374
1455
  }
1375
1456
  return protocolInvalid(`ok is not a boolean`);
1376
1457
  }
1458
+ /**
1459
+ * 5B: turn the scan's `skipped` buckets into operator-facing lines.
1460
+ *
1461
+ * INTENTIONAL CHOICE — these are warnings, never a refusal. A non-interactive
1462
+ * install that hard-failed here would strand the user: the old installation is
1463
+ * untouched, but the upgrade is blocked with no in-product repair path (they
1464
+ * would have to hand-edit the workspace DB before the installer would run).
1465
+ * Escalate to a hard failure only if a real incident is attributed to an
1466
+ * upgrade that ran with unverified ACTIVE rules; the escalation condition is
1467
+ * then `level === 'critical'` (zero rules verified) and belongs here.
1468
+ */
1469
+ export function summarizeCompatibilityVisibility(outcome, workspaceDir) {
1470
+ const skipped = outcome.skipped ?? [];
1471
+ if (skipped.length === 0)
1472
+ return { level: 'none', lines: [] };
1473
+ const total = skipped.reduce((sum, bucket) => sum + bucket.count, 0);
1474
+ const rows = skipped.map((bucket) => {
1475
+ const sample = bucket.sampleActivationIds.length > 0 ? ` (sample: ${bucket.sampleActivationIds.join(', ')})` : '';
1476
+ return `${bucket.reason}=${bucket.count}${sample}`;
1477
+ });
1478
+ const nextCommand = `pd runtime compatibility-scan --workspace "${workspaceDir}" --json`;
1479
+ if (outcome.scannedActivations === 0) {
1480
+ const border = '!'.repeat(74);
1481
+ return {
1482
+ level: 'critical',
1483
+ lines: [
1484
+ border,
1485
+ '!! WARNING: THIS UPGRADE DID NOT VERIFY ANY RULE COMPATIBILITY',
1486
+ `!! ${total} ACTIVE rule(s) could not be read and 0 ACTIVE rule(s) were scanned,`,
1487
+ '!! so no ACTIVE rule was checked for retired-contract dependencies.',
1488
+ `!! ${rows.join(' | ')}`,
1489
+ '!! The upgrade proceeds; verify now:',
1490
+ `!! ${nextCommand}`,
1491
+ border,
1492
+ ],
1493
+ };
1494
+ }
1495
+ return {
1496
+ level: 'warning',
1497
+ lines: [
1498
+ `warning: ${total} ACTIVE rule(s) could not be read during the compatibility check — their compatibility is NOT verified.`,
1499
+ ...rows.map((row) => ` ${row}`),
1500
+ `next: ${nextCommand}`,
1501
+ ],
1502
+ };
1503
+ }
1377
1504
  /**
1378
1505
  * PRI-693 / PRI-1060: materialize node_modules links for the BUNDLED (not yet
1379
1506
  * deployed) components so the pre-deployment compatibility scan can execute
@@ -3624,6 +3751,44 @@ export function partitionHostInstallResults(results) {
3624
3751
  }
3625
3752
  return { failures, manualActions };
3626
3753
  }
3754
+ /**
3755
+ * UPDATE CHAIN (2026-11-11): the Owner-visible install summary. Every host
3756
+ * this run actually touched gets one line naming the runtime it now resolves,
3757
+ * so covering an already-installed host can never happen silently.
3758
+ *
3759
+ * The two runtime layouts are different authorities, not interchangeable
3760
+ * views: the shared canonical runtime is `<dir>/<component>/package.json`,
3761
+ * while Codex's PLUGIN_DATA copy is `<dir>/node_modules/<pkg>/package.json`.
3762
+ * Reading the canonical dir with the PLUGIN_DATA reader made every
3763
+ * OpenClaw/WorkBuddy line print "runtime not verified".
3764
+ *
3765
+ * Derived from the existing host results plus the installed runtime dirs —
3766
+ * never persisted, never a second install-state authority.
3767
+ */
3768
+ export function summarizeTouchedHosts(results, deps = {}) {
3769
+ const canonical = readCanonicalRuntimeCohort(deps.canonicalRuntimeDir ?? getPdRuntimeDir());
3770
+ const codexHome = process.env.CODEX_HOME ?? path.join(getHomeDir(), '.codex');
3771
+ // `resolvePluginDataRoot` returns the PLUGIN DATA ROOT; the installed cohort
3772
+ // lives one level below it in `runtime/`. Appending `node_modules` to the
3773
+ // root read a directory that never exists, so an install that had just
3774
+ // refreshed Codex to the payload pin still printed "runtime not verified".
3775
+ const pluginDataRoot = resolvePluginDataRoot(codexHome, 'principles');
3776
+ const codexRuntimeDir = deps.codexRuntimeDir
3777
+ ?? (pluginDataRoot === undefined ? undefined : path.join(pluginDataRoot, 'runtime'));
3778
+ const codex = deps.codexRuntimeReadable === false || codexRuntimeDir === undefined
3779
+ ? undefined
3780
+ : readInstalledRuntimeCohort(codexRuntimeDir);
3781
+ return results.map((host) => {
3782
+ if (!host.success) {
3783
+ return `Host "${host.hostId}" — not updated: ${host.reason ?? 'unknown failure'}`;
3784
+ }
3785
+ const cohort = host.hostId === 'codex' ? codex : canonical;
3786
+ const version = cohort
3787
+ ? `core@${cohort.core}, codex-adapter@${cohort.codexAdapter}, host-runtime@${cohort.hostRuntime}, mcp@${cohort.mcpServer}`
3788
+ : 'runtime not verified';
3789
+ return `Host "${host.hostId}" — ${version} (${host.configAction ?? 'updated'})`;
3790
+ });
3791
+ }
3627
3792
  /**
3628
3793
  * ADR-0020 §2.3: Run host installers for the selected HostTarget.
3629
3794
  *
@@ -4034,6 +4199,11 @@ transaction) {
4034
4199
  // a refusal leaves the existing installation completely untouched. Only
4035
4200
  // meaningful when the target workspace already has PD state; fresh
4036
4201
  // workspaces scan clean (no state.db → nothing persisted to conflict).
4202
+ //
4203
+ // 5B: rows the scan could not read are surfaced as warnings, never as a
4204
+ // refusal — see summarizeCompatibilityVisibility for why, and for the
4205
+ // condition under which that choice should be revisited.
4206
+ let compatibilityVisibility = { level: 'none', lines: [] };
4037
4207
  if (existsSync(path.join(path.resolve(options.workspaceDir), '.pd', 'state.db'))) {
4038
4208
  if (spinner)
4039
4209
  updateProgress(spinner, stepIndex, 'Checking workspace rule compatibility...');
@@ -4043,6 +4213,11 @@ transaction) {
4043
4213
  logger.error(compat.reason ?? 'legacy_rule_contract_dependency');
4044
4214
  return buildCompatibilityRefusalResult(options, compat);
4045
4215
  }
4216
+ compatibilityVisibility = summarizeCompatibilityVisibility(compat, options.workspaceDir);
4217
+ if (!quiet) {
4218
+ for (const line of compatibilityVisibility.lines)
4219
+ logger.warn(line);
4220
+ }
4046
4221
  }
4047
4222
  stepIndex++;
4048
4223
  if (spinner)
@@ -4081,7 +4256,17 @@ transaction) {
4081
4256
  // host config. A malformed manifest must not be discovered only after the
4082
4257
  // old installation has already been replaced (rc-3/rc-9).
4083
4258
  const persistedHostsBeforeRun = readPersistedInstallHosts();
4084
- installManifestHosts = resolveInstallManifestHosts(options.host);
4259
+ // UPDATE CHAIN (2026-11-11): a host installed outside the manifest (e.g. a
4260
+ // Codex Marketplace plugin added by hand) used to stay on the old release
4261
+ // while the upgrade reported success. Detect every host that already
4262
+ // carries PD and include it in BOTH the manifest record and the refresh
4263
+ // set, so one upgrade brings all hosts forward without uninstall/reinstall.
4264
+ const detectedHostsBeforeRun = detectInstalledHosts();
4265
+ const hostPlan = planUpgradeHosts(options.host, persistedHostsBeforeRun, detectedHostsBeforeRun);
4266
+ installManifestHosts = withDetectedHosts(resolveInstallManifestHosts(options.host), detectedHostsBeforeRun);
4267
+ for (const detectedHost of hostPlan.newlyCovered) {
4268
+ logger.info(`Detected installed host "${detectedHost.hostId}" (${detectedHost.evidence}) — included in this upgrade.`);
4269
+ }
4085
4270
  if (installsOpenClaw(options.host))
4086
4271
  migrateLegacyPdBackups();
4087
4272
  const { backupDir: backupDirFromResult, runtimeBackupDir: runtimeBackupDirFromResult } = backupExistingInstall(options.host);
@@ -4389,14 +4574,16 @@ transaction) {
4389
4574
  // next launch (binding_version_mismatch). Refresh them through their real
4390
4575
  // host installers here — best effort only: the requested host succeeded,
4391
4576
  // and a sibling refresh failure must not roll back the working runtime.
4392
- const refreshTargets = resolveHostRefreshTargets(persistedHostsBeforeRun, options.host);
4577
+ const { refreshTargets } = hostPlan;
4578
+ const refreshedResults = [];
4393
4579
  for (const refreshTarget of refreshTargets) {
4394
4580
  if (spinner)
4395
4581
  updateProgress(spinner, stepIndex, `Refreshing ${refreshTarget} host binding...`);
4396
4582
  const refreshResults = await runHostInstallers(refreshTarget, hostInstallCtx);
4583
+ refreshedResults.push(...refreshResults);
4397
4584
  for (const hr of refreshResults) {
4398
4585
  if (hr.success) {
4399
- logger.info(`Host "${hr.hostId}" refreshed for the new runtime${hr.reason ? `: ${hr.reason}` : ''}.`);
4586
+ logger.info(`Host "${hr.hostId}" refresh: ${hr.configAction === 'updated' ? 'updated' : 'no change needed'}${hr.reason ? ` — ${hr.reason}` : ''}.`);
4400
4587
  }
4401
4588
  else {
4402
4589
  // rc-9: never silent — state the reason and the exact recovery step.
@@ -4404,6 +4591,15 @@ transaction) {
4404
4591
  }
4405
4592
  }
4406
4593
  }
4594
+ // UPDATE CHAIN (2026-11-11): one visible line per host this run touched.
4595
+ // First installs and upgrades share it, so an already-installed host being
4596
+ // brought forward can never be silent (Owner report).
4597
+ const hostSummary = summarizeTouchedHosts([...hostResults, ...refreshedResults]);
4598
+ if (hostSummary.length > 0) {
4599
+ logger.info('Install summary:');
4600
+ for (const line of hostSummary)
4601
+ logger.info(` ${line}`);
4602
+ }
4407
4603
  // Manual-action hosts (e.g. Codex awaiting the Marketplace step) STAY in
4408
4604
  // the install manifest: the manifest records the hosts PD serves on this
4409
4605
  // machine (uninstall reads it to decide shared-runtime removal), not a
@@ -4522,6 +4718,13 @@ transaction) {
4522
4718
  spinner.warn(`Install partially complete — ${hostManualActions.length} manual step(s) pending (details below)`);
4523
4719
  }
4524
4720
  }
4721
+ // 5B: the preflight warning scrolls away during a multi-minute install, so
4722
+ // the end summary repeats the zero-visibility block verbatim. This is
4723
+ // still a warning: the install completed and success is unchanged.
4724
+ if (!quiet && compatibilityVisibility.level === 'critical') {
4725
+ for (const line of compatibilityVisibility.lines)
4726
+ logger.warn(line);
4727
+ }
4525
4728
  // P0-2: terminate + join the verified child before any later step that
4526
4729
  // may touch the runtime tree (here: none destructive, but a wedged child
4527
4730
  // must not leak past the install either).
@@ -4588,6 +4791,8 @@ transaction) {
4588
4791
  nextAction: nextActions.join(' | '),
4589
4792
  consoleUrl: launchResult.consoleUrl,
4590
4793
  hostResults,
4794
+ hostSummary,
4795
+ ...(compatibilityVisibility.lines.length > 0 ? { compatibilityWarnings: compatibilityVisibility.lines } : {}),
4591
4796
  ...(manualActionReason !== undefined ? { reason: manualActionReason, manualActions: hostManualActions } : {}),
4592
4797
  journal: installerJournalRecord(journal),
4593
4798
  };