create-principles-disciple 1.112.2 → 1.113.0

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 (347) hide show
  1. package/console/dist/server/routes/update.js +43 -0
  2. package/core/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.d.ts +2 -0
  3. package/core/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.d.ts.map +1 -0
  4. package/core/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.js +148 -0
  5. package/core/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.js.map +1 -0
  6. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +13 -3
  7. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  8. package/core/dist/runtime-v2/__tests__/evaluator-repair-loop.test.js +14 -6
  9. package/core/dist/runtime-v2/__tests__/evaluator-repair-loop.test.js.map +1 -1
  10. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +1 -0
  11. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -1
  12. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.js +5 -0
  13. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.js.map +1 -1
  14. package/core/dist/runtime-v2/__tests__/golden-trace.test.js +2 -2
  15. package/core/dist/runtime-v2/__tests__/golden-trace.test.js.map +1 -1
  16. package/core/dist/runtime-v2/__tests__/internalization-contracts.test.js +4 -6
  17. package/core/dist/runtime-v2/__tests__/internalization-contracts.test.js.map +1 -1
  18. package/core/dist/runtime-v2/__tests__/internalization-orchestrator.test.js +4 -1
  19. package/core/dist/runtime-v2/__tests__/internalization-orchestrator.test.js.map +1 -1
  20. package/core/dist/runtime-v2/__tests__/internalization-state-machine.test.js +3 -2
  21. package/core/dist/runtime-v2/__tests__/internalization-state-machine.test.js.map +1 -1
  22. package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +47 -0
  23. package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -1
  24. package/core/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.js +66 -1
  25. package/core/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.js.map +1 -1
  26. package/core/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.d.ts +2 -0
  27. package/core/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.d.ts.map +1 -0
  28. package/core/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.js +234 -0
  29. package/core/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.js.map +1 -0
  30. package/core/dist/runtime-v2/__tests__/rule-host-evaluator.test.js +4 -4
  31. package/core/dist/runtime-v2/__tests__/rule-host-evaluator.test.js.map +1 -1
  32. package/core/dist/runtime-v2/__tests__/story-a-demo.test.js +8 -8
  33. package/core/dist/runtime-v2/__tests__/story-a-demo.test.js.map +1 -1
  34. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js +23 -1
  35. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js.map +1 -1
  36. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts +11 -0
  37. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.d.ts.map +1 -1
  38. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +11 -4
  39. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -1
  40. package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +31 -0
  41. package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -1
  42. package/core/dist/runtime-v2/activation-compatibility-read-model.d.ts +24 -0
  43. package/core/dist/runtime-v2/activation-compatibility-read-model.d.ts.map +1 -0
  44. package/core/dist/runtime-v2/activation-compatibility-read-model.js +132 -0
  45. package/core/dist/runtime-v2/activation-compatibility-read-model.js.map +1 -0
  46. package/core/dist/runtime-v2/adapter/output-schema-registry.d.ts.map +1 -1
  47. package/core/dist/runtime-v2/adapter/output-schema-registry.js +2 -0
  48. package/core/dist/runtime-v2/adapter/output-schema-registry.js.map +1 -1
  49. package/core/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.d.ts +13 -0
  50. package/core/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.d.ts.map +1 -0
  51. package/core/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.js +73 -0
  52. package/core/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.js.map +1 -0
  53. package/core/dist/runtime-v2/config/pd-config-types.d.ts +0 -23
  54. package/core/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
  55. package/core/dist/runtime-v2/config/pd-config-types.js.map +1 -1
  56. package/core/dist/runtime-v2/config/pd-profile-constants.d.ts +11 -5
  57. package/core/dist/runtime-v2/config/pd-profile-constants.d.ts.map +1 -1
  58. package/core/dist/runtime-v2/config/pd-profile-constants.js +10 -45
  59. package/core/dist/runtime-v2/config/pd-profile-constants.js.map +1 -1
  60. package/core/dist/runtime-v2/config/pd-validate-profile.d.ts.map +1 -1
  61. package/core/dist/runtime-v2/config/pd-validate-profile.js +27 -135
  62. package/core/dist/runtime-v2/config/pd-validate-profile.js.map +1 -1
  63. package/core/dist/runtime-v2/core-principles/core-principle-registry.d.ts +4 -4
  64. package/core/dist/runtime-v2/core-principles/core-principle-registry.d.ts.map +1 -1
  65. package/core/dist/runtime-v2/core-principles/core-principle-registry.js +2 -2
  66. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +7 -2
  67. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
  68. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  69. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +9 -5
  70. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  71. package/core/dist/runtime-v2/golden-trace-replay-validator.d.ts.map +1 -1
  72. package/core/dist/runtime-v2/golden-trace-replay-validator.js +0 -2
  73. package/core/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -1
  74. package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
  75. package/core/dist/runtime-v2/golden-trace.js +0 -3
  76. package/core/dist/runtime-v2/golden-trace.js.map +1 -1
  77. package/core/dist/runtime-v2/index.d.ts +16 -10
  78. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  79. package/core/dist/runtime-v2/index.js +10 -7
  80. package/core/dist/runtime-v2/index.js.map +1 -1
  81. package/core/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.d.ts +2 -0
  82. package/core/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.d.ts.map +1 -0
  83. package/core/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.js +157 -0
  84. package/core/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.js.map +1 -0
  85. package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js +29 -0
  86. package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js.map +1 -1
  87. package/core/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.d.ts +2 -0
  88. package/core/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.d.ts.map +1 -0
  89. package/core/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.js +311 -0
  90. package/core/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.js.map +1 -0
  91. package/core/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.d.ts +2 -0
  92. package/core/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.d.ts.map +1 -0
  93. package/core/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.js +171 -0
  94. package/core/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.js.map +1 -0
  95. package/core/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.js +11 -2
  96. package/core/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.js.map +1 -1
  97. package/core/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.d.ts +2 -0
  98. package/core/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.d.ts.map +1 -0
  99. package/core/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.js +335 -0
  100. package/core/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.js.map +1 -0
  101. package/core/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.d.ts +2 -0
  102. package/core/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.d.ts.map +1 -0
  103. package/core/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.js +101 -0
  104. package/core/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.js.map +1 -0
  105. package/core/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.d.ts +2 -0
  106. package/core/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.d.ts.map +1 -0
  107. package/core/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.js +515 -0
  108. package/core/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.js.map +1 -0
  109. package/core/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.d.ts +2 -0
  110. package/core/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.d.ts.map +1 -0
  111. package/core/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.js +167 -0
  112. package/core/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.js.map +1 -0
  113. package/core/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.d.ts +2 -0
  114. package/core/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.d.ts.map +1 -0
  115. package/core/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.js +601 -0
  116. package/core/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.js.map +1 -0
  117. package/core/dist/runtime-v2/internalization/artificer-runner.d.ts +7 -0
  118. package/core/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
  119. package/core/dist/runtime-v2/internalization/artificer-runner.js +18 -2
  120. package/core/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
  121. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +49 -0
  122. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
  123. package/core/dist/runtime-v2/internalization/evaluator-runner.js +390 -98
  124. package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
  125. package/core/dist/runtime-v2/internalization/index.d.ts +2 -0
  126. package/core/dist/runtime-v2/internalization/index.d.ts.map +1 -1
  127. package/core/dist/runtime-v2/internalization/index.js +1 -0
  128. package/core/dist/runtime-v2/internalization/index.js.map +1 -1
  129. package/core/dist/runtime-v2/internalization/internalization-orchestrator.d.ts +127 -0
  130. package/core/dist/runtime-v2/internalization/internalization-orchestrator.d.ts.map +1 -1
  131. package/core/dist/runtime-v2/internalization/internalization-orchestrator.js +345 -1
  132. package/core/dist/runtime-v2/internalization/internalization-orchestrator.js.map +1 -1
  133. package/core/dist/runtime-v2/internalization/internalization-task-guards.d.ts +9 -2
  134. package/core/dist/runtime-v2/internalization/internalization-task-guards.d.ts.map +1 -1
  135. package/core/dist/runtime-v2/internalization/internalization-task-guards.js +14 -3
  136. package/core/dist/runtime-v2/internalization/internalization-task-guards.js.map +1 -1
  137. package/core/dist/runtime-v2/internalization/internalization-transition-decision.d.ts +61 -0
  138. package/core/dist/runtime-v2/internalization/internalization-transition-decision.d.ts.map +1 -0
  139. package/core/dist/runtime-v2/internalization/internalization-transition-decision.js +84 -0
  140. package/core/dist/runtime-v2/internalization/internalization-transition-decision.js.map +1 -0
  141. package/core/dist/runtime-v2/internalization/legacy-rule-contract-scanner.d.ts +51 -0
  142. package/core/dist/runtime-v2/internalization/legacy-rule-contract-scanner.d.ts.map +1 -0
  143. package/core/dist/runtime-v2/internalization/legacy-rule-contract-scanner.js +81 -0
  144. package/core/dist/runtime-v2/internalization/legacy-rule-contract-scanner.js.map +1 -0
  145. package/core/dist/runtime-v2/internalization/peer-runner-contracts.d.ts +17 -1
  146. package/core/dist/runtime-v2/internalization/peer-runner-contracts.d.ts.map +1 -1
  147. package/core/dist/runtime-v2/internalization/peer-runner-contracts.js.map +1 -1
  148. package/core/dist/runtime-v2/internalization/pitask-metadata.d.ts +99 -2
  149. package/core/dist/runtime-v2/internalization/pitask-metadata.d.ts.map +1 -1
  150. package/core/dist/runtime-v2/internalization/pitask-metadata.js +148 -0
  151. package/core/dist/runtime-v2/internalization/pitask-metadata.js.map +1 -1
  152. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
  153. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +0 -2
  154. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
  155. package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts +147 -0
  156. package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.d.ts.map +1 -1
  157. package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.js +672 -1
  158. package/core/dist/runtime-v2/internalization/rollout-reviewer-runner.js.map +1 -1
  159. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +0 -3
  160. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
  161. package/core/dist/runtime-v2/internalization/rule-host-helpers.d.ts +4 -2
  162. package/core/dist/runtime-v2/internalization/rule-host-helpers.d.ts.map +1 -1
  163. package/core/dist/runtime-v2/internalization/rule-host-helpers.js +4 -2
  164. package/core/dist/runtime-v2/internalization/rule-host-helpers.js.map +1 -1
  165. package/core/dist/runtime-v2/internalization/scribe-runner.d.ts +2 -0
  166. package/core/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -1
  167. package/core/dist/runtime-v2/internalization/scribe-runner.js +21 -1
  168. package/core/dist/runtime-v2/internalization/scribe-runner.js.map +1 -1
  169. package/core/dist/runtime-v2/pain-signal-observability.js +3 -3
  170. package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
  171. package/core/dist/runtime-v2/runner/base-peer-runner.d.ts +9 -0
  172. package/core/dist/runtime-v2/runner/base-peer-runner.d.ts.map +1 -1
  173. package/core/dist/runtime-v2/runner/base-peer-runner.js +22 -0
  174. package/core/dist/runtime-v2/runner/base-peer-runner.js.map +1 -1
  175. package/core/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.d.ts +2 -0
  176. package/core/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.d.ts.map +1 -0
  177. package/core/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.js +130 -0
  178. package/core/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.js.map +1 -0
  179. package/core/dist/runtime-v2/signal-collector/index.d.ts +1 -1
  180. package/core/dist/runtime-v2/signal-collector/index.d.ts.map +1 -1
  181. package/core/dist/runtime-v2/signal-collector/index.js +1 -1
  182. package/core/dist/runtime-v2/signal-collector/index.js.map +1 -1
  183. package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts +15 -0
  184. package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts.map +1 -1
  185. package/core/dist/runtime-v2/signal-collector/llm-stage.js +28 -0
  186. package/core/dist/runtime-v2/signal-collector/llm-stage.js.map +1 -1
  187. package/core/dist/runtime-v2/signal-collector/types.d.ts +9 -1
  188. package/core/dist/runtime-v2/signal-collector/types.d.ts.map +1 -1
  189. package/core/dist/runtime-v2/signal-collector/types.js +13 -1
  190. package/core/dist/runtime-v2/signal-collector/types.js.map +1 -1
  191. package/core/dist/runtime-v2/store/reconciliation-cursor-store.d.ts +23 -0
  192. package/core/dist/runtime-v2/store/reconciliation-cursor-store.d.ts.map +1 -0
  193. package/core/dist/runtime-v2/store/reconciliation-cursor-store.js +34 -0
  194. package/core/dist/runtime-v2/store/reconciliation-cursor-store.js.map +1 -0
  195. package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
  196. package/core/dist/runtime-v2/store/sqlite-connection.js +7 -0
  197. package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
  198. package/core/dist/runtime-v2/store/task/memory-task-store.d.ts.map +1 -1
  199. package/core/dist/runtime-v2/store/task/memory-task-store.js +22 -0
  200. package/core/dist/runtime-v2/store/task/memory-task-store.js.map +1 -1
  201. package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
  202. package/core/dist/runtime-v2/store/task/sqlite-task-store.js +20 -0
  203. package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
  204. package/core/dist/runtime-v2/store/task/task-store.d.ts +14 -0
  205. package/core/dist/runtime-v2/store/task/task-store.d.ts.map +1 -1
  206. package/core/dist/runtime-v2/story-a-demo.d.ts.map +1 -1
  207. package/core/dist/runtime-v2/story-a-demo.js +2 -0
  208. package/core/dist/runtime-v2/story-a-demo.js.map +1 -1
  209. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
  210. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js +0 -4
  211. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
  212. package/core/dist/runtime-v2/types/event-payload.d.ts +1 -20
  213. package/core/dist/runtime-v2/types/event-payload.d.ts.map +1 -1
  214. package/core/dist/runtime-v2/types/event-payload.js +0 -12
  215. package/core/dist/runtime-v2/types/event-payload.js.map +1 -1
  216. package/core/dist/runtime-v2/types/event-types.d.ts +3 -18
  217. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  218. package/core/dist/runtime-v2/types/event-types.js +0 -8
  219. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  220. package/core/dist/runtime-v2/types/index.d.ts +3 -3
  221. package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
  222. package/core/dist/runtime-v2/types/index.js +2 -2
  223. package/core/dist/runtime-v2/types/index.js.map +1 -1
  224. package/dist/installer.d.ts +49 -0
  225. package/dist/installer.d.ts.map +1 -1
  226. package/dist/installer.js +215 -3
  227. package/dist/installer.js.map +1 -1
  228. package/host-runtime/dist/legacy-rule-contract-symbols.d.ts +20 -0
  229. package/host-runtime/dist/legacy-rule-contract-symbols.js +37 -0
  230. package/host-runtime/dist/production-rulehost-gate.d.ts +0 -1
  231. package/host-runtime/dist/production-rulehost-gate.js +29 -5
  232. package/host-runtime/dist/rule-implementation-runtime.js +0 -2
  233. package/package.json +2 -2
  234. package/pd-cli/dist/commands/demo-story-a.d.ts +2 -0
  235. package/pd-cli/dist/commands/demo-story-a.d.ts.map +1 -1
  236. package/pd-cli/dist/commands/demo-story-a.js +41 -0
  237. package/pd-cli/dist/commands/demo-story-a.js.map +1 -1
  238. package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
  239. package/pd-cli/dist/commands/runtime-activation.js +36 -7
  240. package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
  241. package/pd-cli/dist/commands/runtime-compatibility-scan.d.ts +32 -0
  242. package/pd-cli/dist/commands/runtime-compatibility-scan.d.ts.map +1 -0
  243. package/pd-cli/dist/commands/runtime-compatibility-scan.js +94 -0
  244. package/pd-cli/dist/commands/runtime-compatibility-scan.js.map +1 -0
  245. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
  246. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +48 -0
  247. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
  248. package/pd-cli/dist/commands/runtime-internalization-retry.d.ts +38 -0
  249. package/pd-cli/dist/commands/runtime-internalization-retry.d.ts.map +1 -0
  250. package/pd-cli/dist/commands/runtime-internalization-retry.js +143 -0
  251. package/pd-cli/dist/commands/runtime-internalization-retry.js.map +1 -0
  252. package/pd-cli/dist/index.js +15 -0
  253. package/pd-cli/dist/index.js.map +1 -1
  254. package/pd-cli/dist/services/__tests__/evaluator-runner-deps.test.js +19 -7
  255. package/pd-cli/dist/services/__tests__/evaluator-runner-deps.test.js.map +1 -1
  256. package/pd-cli/dist/services/rulehost-pipeline-runner.d.ts.map +1 -1
  257. package/pd-cli/dist/services/rulehost-pipeline-runner.js +6 -2
  258. package/pd-cli/dist/services/rulehost-pipeline-runner.js.map +1 -1
  259. package/plugin/dist/bundle.js +517 -707
  260. package/plugin/dist/core/event-log.d.ts +1 -2
  261. package/plugin/dist/core/paths.d.ts +0 -2
  262. package/plugin/dist/core/profile.d.ts +0 -19
  263. package/plugin/dist/core/rule-host.d.ts +25 -0
  264. package/plugin/dist/core/runtime-v2-prompt-activation-reader.d.ts +8 -0
  265. package/plugin/dist/core/session-tracker.d.ts +0 -13
  266. package/plugin/dist/core/signal-collector-host.d.ts +7 -1
  267. package/plugin/dist/core/signal-keyword-store.d.ts +41 -0
  268. package/plugin/dist/core/thinking-os-parser.d.ts +0 -5
  269. package/plugin/dist/core/trajectory-types.d.ts +0 -1
  270. package/plugin/dist/core/trajectory.d.ts +0 -12
  271. package/plugin/dist/hooks/gate.d.ts +0 -1
  272. package/plugin/dist/service/auto-consumer-governance-wiring.d.ts +34 -0
  273. package/plugin/dist/templates/langs/en/skills/pd-mentor/SKILL.md +3 -4
  274. package/plugin/dist/templates/langs/zh/skills/pd-mentor/SKILL.md +3 -4
  275. package/plugin/dist/templates/workspace/.principles/PROFILE.json +0 -29
  276. package/plugin/dist/templates/workspace/.principles/PROFILE.schema.json +16 -25
  277. package/plugin/dist/templates/workspace/okr/CURRENT_FOCUS.md +0 -1
  278. package/plugin/dist/types/event-types.d.ts +1 -1
  279. package/plugin/openclaw.plugin.json +1 -1
  280. package/plugin/package.json +1 -1
  281. package/plugin/templates/langs/en/skills/pd-mentor/SKILL.md +3 -4
  282. package/plugin/templates/langs/zh/skills/pd-mentor/SKILL.md +3 -4
  283. package/plugin/templates/workspace/.principles/PROFILE.json +0 -29
  284. package/plugin/templates/workspace/.principles/PROFILE.schema.json +16 -25
  285. package/plugin/templates/workspace/okr/CURRENT_FOCUS.md +0 -1
  286. package/templates/workspace/okr/CURRENT_FOCUS.md +0 -1
  287. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts +0 -2
  288. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts.map +0 -1
  289. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js +0 -149
  290. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js.map +0 -1
  291. package/core/dist/runtime-v2/thinking-models/index.d.ts +0 -3
  292. package/core/dist/runtime-v2/thinking-models/index.d.ts.map +0 -1
  293. package/core/dist/runtime-v2/thinking-models/index.js +0 -3
  294. package/core/dist/runtime-v2/thinking-models/index.js.map +0 -1
  295. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts +0 -73
  296. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts.map +0 -1
  297. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js +0 -227
  298. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js.map +0 -1
  299. package/plugin/dist/commands/thinking-os.d.ts +0 -2
  300. package/plugin/dist/core/control-ui-db.d.ts +0 -117
  301. package/plugin/dist/core/thinking-models.d.ts +0 -25
  302. package/plugin/dist/templates/workspace/.principles/THINKING_OS_CANDIDATES.md +0 -9
  303. package/plugin/templates/workspace/.principles/THINKING_OS_CANDIDATES.md +0 -9
  304. package/templates/langs/en/skills/admin/SKILL.md +0 -39
  305. package/templates/langs/en/skills/bootstrap-tools/SKILL.md +0 -53
  306. package/templates/langs/en/skills/deductive-audit/SKILL.md +0 -36
  307. package/templates/langs/en/skills/evolution-framework-update/SKILL.md +0 -31
  308. package/templates/langs/en/skills/evolve-system/SKILL.md +0 -46
  309. package/templates/langs/en/skills/evolve-task/SKILL.md +0 -83
  310. package/templates/langs/en/skills/feedback/SKILL.md +0 -51
  311. package/templates/langs/en/skills/init-strategy/SKILL.md +0 -54
  312. package/templates/langs/en/skills/inject-rule/SKILL.md +0 -19
  313. package/templates/langs/en/skills/manage-okr/SKILL.md +0 -96
  314. package/templates/langs/en/skills/pain/SKILL.md +0 -19
  315. package/templates/langs/en/skills/pd-mentor/SKILL.md +0 -211
  316. package/templates/langs/en/skills/profile/SKILL.md +0 -24
  317. package/templates/langs/en/skills/reflection/SKILL.md +0 -40
  318. package/templates/langs/en/skills/reflection-log/SKILL.md +0 -37
  319. package/templates/langs/en/skills/report/SKILL.md +0 -13
  320. package/templates/langs/en/skills/root-cause/SKILL.md +0 -33
  321. package/templates/langs/en/skills/triage/SKILL.md +0 -29
  322. package/templates/langs/en/skills/watch-evolution/SKILL.md +0 -33
  323. package/templates/langs/zh/skills/admin/SKILL.md +0 -41
  324. package/templates/langs/zh/skills/bootstrap-tools/SKILL.md +0 -52
  325. package/templates/langs/zh/skills/deductive-audit/SKILL.md +0 -36
  326. package/templates/langs/zh/skills/evolution-framework-update/SKILL.md +0 -31
  327. package/templates/langs/zh/skills/evolve-system/SKILL.md +0 -46
  328. package/templates/langs/zh/skills/evolve-task/SKILL.md +0 -83
  329. package/templates/langs/zh/skills/feedback/SKILL.md +0 -53
  330. package/templates/langs/zh/skills/init-strategy/SKILL.md +0 -54
  331. package/templates/langs/zh/skills/inject-rule/SKILL.md +0 -19
  332. package/templates/langs/zh/skills/manage-okr/SKILL.md +0 -109
  333. package/templates/langs/zh/skills/pain/SKILL.md +0 -30
  334. package/templates/langs/zh/skills/pd-auditor/SKILL.md +0 -61
  335. package/templates/langs/zh/skills/pd-explorer/SKILL.md +0 -65
  336. package/templates/langs/zh/skills/pd-implementer/SKILL.md +0 -68
  337. package/templates/langs/zh/skills/pd-mentor/SKILL.md +0 -211
  338. package/templates/langs/zh/skills/pd-planner/SKILL.md +0 -65
  339. package/templates/langs/zh/skills/pd-reporter/SKILL.md +0 -78
  340. package/templates/langs/zh/skills/pd-reviewer/SKILL.md +0 -66
  341. package/templates/langs/zh/skills/profile/SKILL.md +0 -24
  342. package/templates/langs/zh/skills/reflection/SKILL.md +0 -40
  343. package/templates/langs/zh/skills/reflection-log/SKILL.md +0 -37
  344. package/templates/langs/zh/skills/report/SKILL.md +0 -13
  345. package/templates/langs/zh/skills/root-cause/SKILL.md +0 -33
  346. package/templates/langs/zh/skills/triage/SKILL.md +0 -29
  347. package/templates/langs/zh/skills/watch-evolution/SKILL.md +0 -33
@@ -21,10 +21,10 @@ export type { PersistenceAction, HygieneStats, } from './hygiene-types.js';
21
21
  export { PersistenceActionSchema, HygieneStatsSchema, createEmptyHygieneStats, } from './hygiene-types.js';
22
22
  export type { RuntimeTruth, AnalyticsTruth, TrendMetrics, } from './runtime-summary-types.js';
23
23
  export { RuntimeTruthSchema, AnalyticsTruthSchema, TrendMetricsSchema, } from './runtime-summary-types.js';
24
- export type { EventType, EventCategory, EventLogEntry, ToolCallEventData, PainSignalEventData, RulePromotionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, PlanApprovalEventData, EvolutionTaskEventData, EmpathyRollbackEventData, HeartbeatDiagnosisEventData, DiagnosisTaskEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData, RuntimeV2PromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, ToolCallStats, ErrorStats, EmpathyEventStats, GfiStats, EventEvolutionStats, HookStats, DailyStats, } from './event-types.js';
25
- export { EventTypeSchema, EventCategorySchema, EventLogEntrySchema, ToolCallEventDataSchema, PainSignalEventDataSchema, RulePromotionEventDataSchema, HookExecutionEventDataSchema, GateBlockEventDataSchema, GateBypassEventDataSchema, PlanApprovalEventDataSchema, EvolutionTaskEventDataSchema, EmpathyRollbackEventDataSchema, HeartbeatDiagnosisEventDataSchema, DiagnosisTaskEventDataSchema, DiagnosticianReportEventDataSchema, PrincipleCandidateEventDataSchema, RuleEnforcedEventDataSchema, RuleHostEvaluatedEventDataSchema, RuleHostBlockedEventDataSchema, RuleHostRequireApprovalEventDataSchema, RuleHostAutoCorrectProposedEventDataSchema, RuleHostAutoCorrectAppliedEventDataSchema, RuntimeV2PromptActivationsInjectedEventDataSchema, RuleHostUnhealthyEventDataSchema, RuleHostSkippedEventDataSchema, ToolCallStatsSchema, ErrorStatsSchema, EmpathyEventStatsSchema, GfiStatsSchema, EventEvolutionStatsSchema, HookStatsSchema, DailyStatsSchema, createEmptyDailyStats, } from './event-types.js';
24
+ export type { EventType, EventCategory, EventLogEntry, ToolCallEventData, PainSignalEventData, RulePromotionEventData, HookExecutionEventData, GateBlockEventData, GateBypassEventData, EvolutionTaskEventData, EmpathyRollbackEventData, HeartbeatDiagnosisEventData, DiagnosisTaskEventData, DiagnosticianReportEventData, PrincipleCandidateEventData, RuleEnforcedEventData, RuleHostEvaluatedEventData, RuleHostBlockedEventData, RuleHostRequireApprovalEventData, RuleHostAutoCorrectProposedEventData, RuleHostAutoCorrectAppliedEventData, RuntimeV2PromptActivationsInjectedEventData, RuleHostUnhealthyEventData, RuleHostSkippedEventData, ToolCallStats, ErrorStats, EmpathyEventStats, GfiStats, EventEvolutionStats, HookStats, DailyStats, } from './event-types.js';
25
+ export { EventTypeSchema, EventCategorySchema, EventLogEntrySchema, ToolCallEventDataSchema, PainSignalEventDataSchema, RulePromotionEventDataSchema, HookExecutionEventDataSchema, GateBlockEventDataSchema, GateBypassEventDataSchema, EvolutionTaskEventDataSchema, EmpathyRollbackEventDataSchema, HeartbeatDiagnosisEventDataSchema, DiagnosisTaskEventDataSchema, DiagnosticianReportEventDataSchema, PrincipleCandidateEventDataSchema, RuleEnforcedEventDataSchema, RuleHostEvaluatedEventDataSchema, RuleHostBlockedEventDataSchema, RuleHostRequireApprovalEventDataSchema, RuleHostAutoCorrectProposedEventDataSchema, RuleHostAutoCorrectAppliedEventDataSchema, RuntimeV2PromptActivationsInjectedEventDataSchema, RuleHostUnhealthyEventDataSchema, RuleHostSkippedEventDataSchema, ToolCallStatsSchema, ErrorStatsSchema, EmpathyEventStatsSchema, GfiStatsSchema, EventEvolutionStatsSchema, HookStatsSchema, DailyStatsSchema, createEmptyDailyStats, } from './event-types.js';
26
26
  export type { EventLogEntry as DiscriminatedEventLogEntry, } from './event-payload.js';
27
- export { DiscriminatedEventLogEntrySchema, isToolCallEventEntry, isPainSignalEventEntry, isRulePromotionEventEntry, isHookExecutionEventEntry, isGateBlockEventEntry, isGateBypassEventEntry, isPlanApprovalEventEntry, isEvolutionTaskEventEntry, isEmpathyRollbackEventEntry, } from './event-payload.js';
27
+ export { DiscriminatedEventLogEntrySchema, isToolCallEventEntry, isPainSignalEventEntry, isRulePromotionEventEntry, isHookExecutionEventEntry, isGateBlockEventEntry, isGateBypassEventEntry, isEvolutionTaskEventEntry, isEmpathyRollbackEventEntry, } from './event-payload.js';
28
28
  export type { PainSeverity as TypeboxPainSeverity, PainSignal, PainSignalValidationResult, } from './pain-signal.js';
29
29
  export { PainSeverity as PainSeveritySchema, PainSignalSchema, deriveSeverity, validatePainSignal, } from './pain-signal.js';
30
30
  export type { LedgerPrinciple, LedgerRule, LedgerTreeStore, LegacyPrincipleTrainingState, LegacyPrincipleTrainingStore, HybridLedgerStore, } from './ledger-store.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,4BAA4B,EAC5B,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,kCAAkC,EAClC,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,YAA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CAAC;AAG5B,YAAY,EACV,YAAY,IAAI,mBAAmB,EACnC,UAAU,EACV,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,YAAY,IAAI,kBAAkB,EAClC,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAO1B,YAAY,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,YAAY,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,IAAI,oBAAoB,EACpC,aAAa,IAAI,qBAAqB,EACtC,eAAe,IAAI,uBAAuB,EAC1C,eAAe,IAAI,uBAAuB,EAE1C,aAAa,IAAI,0BAA0B,GAC5C,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,4BAA4B,EAC5B,yBAAyB,EACzB,qBAAqB,EAErB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,4BAA4B,EAC5B,kBAAkB,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StoreSchema } from './principle-tree-store.js';
10
10
  export { toQueueItemId, toWorkflowId, toSessionKey, isQueueItemId, isWorkflowId, isSessionKey, } from './queue-types.js';
11
11
  export { PersistenceActionSchema, HygieneStatsSchema, createEmptyHygieneStats, } from './hygiene-types.js';
12
12
  export { RuntimeTruthSchema, AnalyticsTruthSchema, TrendMetricsSchema, } from './runtime-summary-types.js';
13
- export { EventTypeSchema, EventCategorySchema, EventLogEntrySchema, ToolCallEventDataSchema, PainSignalEventDataSchema, RulePromotionEventDataSchema, HookExecutionEventDataSchema, GateBlockEventDataSchema, GateBypassEventDataSchema, PlanApprovalEventDataSchema, EvolutionTaskEventDataSchema, EmpathyRollbackEventDataSchema, HeartbeatDiagnosisEventDataSchema, DiagnosisTaskEventDataSchema, DiagnosticianReportEventDataSchema, PrincipleCandidateEventDataSchema, RuleEnforcedEventDataSchema, RuleHostEvaluatedEventDataSchema, RuleHostBlockedEventDataSchema, RuleHostRequireApprovalEventDataSchema, RuleHostAutoCorrectProposedEventDataSchema, RuleHostAutoCorrectAppliedEventDataSchema, RuntimeV2PromptActivationsInjectedEventDataSchema, RuleHostUnhealthyEventDataSchema, RuleHostSkippedEventDataSchema, ToolCallStatsSchema, ErrorStatsSchema,
13
+ export { EventTypeSchema, EventCategorySchema, EventLogEntrySchema, ToolCallEventDataSchema, PainSignalEventDataSchema, RulePromotionEventDataSchema, HookExecutionEventDataSchema, GateBlockEventDataSchema, GateBypassEventDataSchema, EvolutionTaskEventDataSchema, EmpathyRollbackEventDataSchema, HeartbeatDiagnosisEventDataSchema, DiagnosisTaskEventDataSchema, DiagnosticianReportEventDataSchema, PrincipleCandidateEventDataSchema, RuleEnforcedEventDataSchema, RuleHostEvaluatedEventDataSchema, RuleHostBlockedEventDataSchema, RuleHostRequireApprovalEventDataSchema, RuleHostAutoCorrectProposedEventDataSchema, RuleHostAutoCorrectAppliedEventDataSchema, RuntimeV2PromptActivationsInjectedEventDataSchema, RuleHostUnhealthyEventDataSchema, RuleHostSkippedEventDataSchema, ToolCallStatsSchema, ErrorStatsSchema,
14
14
  // PainStatsSchema re-export removed (PRI-451 Wave 1.5): no live reader.
15
15
  EmpathyEventStatsSchema, GfiStatsSchema, EventEvolutionStatsSchema, HookStatsSchema, DailyStatsSchema, createEmptyDailyStats, } from './event-types.js';
16
- export { DiscriminatedEventLogEntrySchema, isToolCallEventEntry, isPainSignalEventEntry, isRulePromotionEventEntry, isHookExecutionEventEntry, isGateBlockEventEntry, isGateBypassEventEntry, isPlanApprovalEventEntry, isEvolutionTaskEventEntry, isEmpathyRollbackEventEntry, } from './event-payload.js';
16
+ export { DiscriminatedEventLogEntrySchema, isToolCallEventEntry, isPainSignalEventEntry, isRulePromotionEventEntry, isHookExecutionEventEntry, isGateBlockEventEntry, isGateBypassEventEntry, isEvolutionTaskEventEntry, isEmpathyRollbackEventEntry, } from './event-payload.js';
17
17
  export { PainSeverity as PainSeveritySchema, PainSignalSchema, deriveSeverity, validatePainSignal, } from './pain-signal.js';
18
18
  export { TREE_NAMESPACE } from './ledger-store.js';
19
19
  export { PDTaskScheduleSchema, PDTaskExecutionSchema, PDTaskDeliverySchema, PDTaskMetaSchema, PDTaskSpecSchema, BUILTIN_PD_TASKS, } from './pd-task-types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime-v2/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,kCAAkC,EAClC,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAc/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAGtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAO3E,OAAO,E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,MAAM,mBAAmB,CAAC;AAWnD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAgB5B,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,4BAA4B,EAC5B,yBAAyB,EACzB,qBAAqB;AACrB,sEAAsE;AACtE,qBAAqB,GACtB,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime-v2/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,kCAAkC,EAClC,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,EACL,eAAe,EACf,UAAU,EACV,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAc/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAGtE,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAO3E,OAAO,EACL,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAUrE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAsCpC,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,4BAA4B,EAC5B,8BAA8B,EAC9B,iCAAiC,EACjC,4BAA4B,EAC5B,kCAAkC,EAClC,iCAAiC,EACjC,2BAA2B,EAC3B,gCAAgC,EAChC,8BAA8B,EAC9B,sCAAsC,EACtC,0CAA0C,EAC1C,yCAAyC,EACzC,iDAAiD,EACjD,gCAAgC,EAChC,8BAA8B,EAC9B,mBAAmB,EACnB,gBAAgB;AAChB,wEAAwE;AACxE,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAO1B,OAAO,EACL,gCAAgC,EAChC,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAS5B,OAAO,EACL,YAAY,IAAI,kBAAkB,EAClC,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAgB1B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAWnD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAgB5B,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,2BAA2B,EAC3B,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,4BAA4B,EAC5B,yBAAyB,EACzB,qBAAqB;AACrB,sEAAsE;AACtE,qBAAqB,GACtB,MAAM,8BAA8B,CAAC"}
@@ -44,6 +44,55 @@ export declare function migrateLegacyPdBackups(): void;
44
44
  * Exported for real-filesystem tests (tests/backup-location.test.ts).
45
45
  */
46
46
  export declare function backupExistingInstall(): BackupResult;
47
+ /**
48
+ * Legacy rule contract preflight (2026-08-19).
49
+ *
50
+ * Before replacing the current installation, run the NEW pd-cli's
51
+ * `runtime compatibility-scan` against the target workspace: if any ACTIVE
52
+ * owner-approved RuleCode still references a RuleHost contract symbol this
53
+ * version removed (recentThinking, planStatus, hasPlanFile, ...), upgrading
54
+ * would silently change that rule's behavior. Refusing here keeps the old
55
+ * installation untouched (cli-5) and tells the owner exactly which rules
56
+ * block the upgrade.
57
+ */
58
+ /**
59
+ * Compatibility preflight status taxonomy (P1-3, 2026-08-20).
60
+ *
61
+ * The scanner's status is preserved end-to-end so a refusal names the real
62
+ * cause instead of smearing every failure into "legacy RuleCode":
63
+ *
64
+ * clean → allow upgrade
65
+ * no_state_db → allow (nothing persisted to be incompatible)
66
+ * legacy_dependency → refuse → migrate/deactivate the listed rules
67
+ * scan_failed → refuse → repair DB / permissions
68
+ * scan_unavailable → refuse → repair/re-download the installer
69
+ *
70
+ * Any unrecognized status is treated as a refusal (fail closed).
71
+ */
72
+ export type CompatibilityStatus = 'clean' | 'no_state_db' | 'legacy_dependency' | 'scan_failed' | 'scan_unavailable';
73
+ export interface LegacyRulePreflightOutcome {
74
+ ok: boolean;
75
+ status?: CompatibilityStatus;
76
+ /** rc-9: structured reason + remediation whenever ok=false. */
77
+ reason?: string;
78
+ remediation?: string;
79
+ }
80
+ /** Injected runner so tests can exercise refusal without a built pd-cli. */
81
+ export type LegacyRulePreflightRunner = (pdCliEntry: string, workspaceDir: string) => Promise<LegacyRulePreflightOutcome>;
82
+ /**
83
+ * Strict (ok, status) protocol parse (P2, 2026-08-20).
84
+ *
85
+ * Boolean `ok` alone is NOT authoritative — the (ok, status) pair is the
86
+ * contract. Only ok=true + (clean|no_state_db) is a successful scan. Every
87
+ * other combination fails closed:
88
+ * - ok=true + refusal/success-impossible status → protocol invalid
89
+ * - ok=false + clean|no_state_db/unknown → protocol invalid
90
+ * - ok=false + legacy_dependency|scan_failed|scan_unavailable → refusal
91
+ * - non-boolean / missing ok → protocol invalid
92
+ * The payload is never trusted to self-describe a pass.
93
+ */
94
+ export declare function parseCompatibilityScanStdout(stdout: unknown): LegacyRulePreflightOutcome;
95
+ export declare function runLegacyRuleContractPreflight(pluginDir: string, workspaceDir: string, runScan?: LegacyRulePreflightRunner): Promise<LegacyRulePreflightOutcome>;
47
96
  export declare function checkBuiltPlugin(pluginDir: string): Promise<void>;
48
97
  export declare function installPluginToStaging(pluginDir: string, language: SkillLanguage): Promise<void>;
49
98
  export interface InstallResult {
@@ -1 +1 @@
1
- {"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAaL,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAExB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAA+B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtF,iFAAiF;AACjF,eAAO,MAAM,8BAA8B,EAAG,yBAAkC,CAAC;AAMjF;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmCjG;AAyDD;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW5F;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAW5E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAOpF;AA8CD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EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,cAAmB,GAAG,OAAO,CAAC,aAAa,CAAC,CAyX3H"}
package/dist/installer.js CHANGED
@@ -144,6 +144,7 @@ export function validateWorkspacePath(targetPath, workspaceDir) {
144
144
  }
145
145
  const INSTALL_STEPS = [
146
146
  { name: 'Checking built plugin', weight: 3 },
147
+ { name: 'Checking workspace rule compatibility', weight: 1 },
147
148
  { name: 'Backing up existing install', weight: 3 },
148
149
  { name: 'Installing bundled @principles/core', weight: 8 },
149
150
  { name: 'Installing bundled @principles/host-runtime', weight: 3 },
@@ -316,6 +317,185 @@ function buildGatewayRefusalResult(options, detail) {
316
317
  ...(detail.error !== undefined ? { error: detail.error } : {}),
317
318
  };
318
319
  }
320
+ /** Map a scanner refusal status into the preflight refusal contract (P1-3). */
321
+ function refuseForStatus(status, parsedReason, remediation) {
322
+ switch (status) {
323
+ case 'legacy_dependency':
324
+ return {
325
+ ok: false,
326
+ status: 'legacy_dependency',
327
+ reason: parsedReason ?? `legacy_rule_contract_dependency: ${status}`,
328
+ ...(remediation !== undefined ? { remediation } : {}),
329
+ };
330
+ case 'scan_failed':
331
+ return {
332
+ ok: false,
333
+ status: 'scan_failed',
334
+ reason: parsedReason ?? 'compatibility_scan_failed: workspace state could not be scanned',
335
+ ...(remediation !== undefined
336
+ ? { remediation }
337
+ : { remediation: 'Repair the workspace database or its permissions, then retry the upgrade. The current installation has not been replaced.' }),
338
+ };
339
+ case 'scan_unavailable':
340
+ return {
341
+ ok: false,
342
+ status: 'scan_unavailable',
343
+ reason: parsedReason ?? 'compatibility_scan_unavailable',
344
+ ...(remediation !== undefined
345
+ ? { remediation }
346
+ : { remediation: 'Re-download/rebuild the installer before upgrading. The current installation has not been replaced.' }),
347
+ };
348
+ }
349
+ }
350
+ /** Fail closed with the strict protocol-violation reason (P2, 2026-08-20). */
351
+ function protocolInvalid(detail) {
352
+ return {
353
+ ok: false,
354
+ status: 'scan_failed',
355
+ reason: `compatibility_scan_protocol_invalid: ${detail}`,
356
+ remediation: 'The compatibility scanner returned an unexpected result. Re-download/rebuild the installer before upgrading. The current installation has not been replaced.',
357
+ };
358
+ }
359
+ /**
360
+ * Strict (ok, status) protocol parse (P2, 2026-08-20).
361
+ *
362
+ * Boolean `ok` alone is NOT authoritative — the (ok, status) pair is the
363
+ * contract. Only ok=true + (clean|no_state_db) is a successful scan. Every
364
+ * other combination fails closed:
365
+ * - ok=true + refusal/success-impossible status → protocol invalid
366
+ * - ok=false + clean|no_state_db/unknown → protocol invalid
367
+ * - ok=false + legacy_dependency|scan_failed|scan_unavailable → refusal
368
+ * - non-boolean / missing ok → protocol invalid
369
+ * The payload is never trusted to self-describe a pass.
370
+ */
371
+ export function parseCompatibilityScanStdout(stdout) {
372
+ if (typeof stdout !== 'string' || stdout.trim().length === 0) {
373
+ return { ok: false, status: 'scan_failed', reason: 'compatibility_scan_unreadable: empty stdout' };
374
+ }
375
+ let parsed;
376
+ try {
377
+ parsed = JSON.parse(stdout);
378
+ }
379
+ catch {
380
+ return { ok: false, status: 'scan_failed', reason: 'compatibility_scan_unreadable: stdout is not JSON' };
381
+ }
382
+ if (!isRecord(parsed)) {
383
+ return { ok: false, status: 'scan_failed', reason: 'compatibility_scan_unreadable: stdout is not an object' };
384
+ }
385
+ const status = typeof parsed.status === 'string' ? parsed.status : 'unknown';
386
+ const reason = typeof parsed.reason === 'string' ? parsed.reason : undefined;
387
+ const remediation = typeof parsed.remediation === 'string' ? parsed.remediation : undefined;
388
+ if (parsed.ok === true) {
389
+ if (status === 'clean' || status === 'no_state_db') {
390
+ return { ok: true, status };
391
+ }
392
+ return protocolInvalid(`ok=true with status=${status}`);
393
+ }
394
+ if (parsed.ok === false) {
395
+ if (status === 'legacy_dependency' || status === 'scan_failed' || status === 'scan_unavailable') {
396
+ return refuseForStatus(status, reason, remediation);
397
+ }
398
+ return protocolInvalid(`ok=false with status=${status}`);
399
+ }
400
+ return protocolInvalid(`ok is not a boolean`);
401
+ }
402
+ async function defaultLegacyRulePreflightRunner(pdCliEntry, workspaceDir) {
403
+ // The entry path is boundary-checked before it is used as a subprocess
404
+ // target, and the subprocess is invoked with an argv array (no shell).
405
+ const { execFile } = await import('node:child_process');
406
+ const { promisify } = await import('node:util');
407
+ const execFileAsync = promisify(execFile);
408
+ try {
409
+ const result = await execFileAsync(process.execPath, [pdCliEntry, 'runtime', 'compatibility-scan', '--json', '--workspace', workspaceDir], { timeout: 60_000 });
410
+ return parseCompatibilityScanStdout(result.stdout);
411
+ }
412
+ catch (err) {
413
+ // The scan command exits 1 WITH valid JSON for any refusal (legacy
414
+ // dependency, DB failure, ...). Preserve that structured result instead
415
+ // of smearing scan_failed into legacy_dependency (P1-3).
416
+ const { stdout } = err;
417
+ if (typeof stdout === 'string' && stdout.trim().length > 0) {
418
+ const fromStdout = parseCompatibilityScanStdout(stdout);
419
+ if (!fromStdout.ok)
420
+ return fromStdout;
421
+ }
422
+ return {
423
+ ok: false,
424
+ status: 'scan_failed',
425
+ reason: `compatibility_scan_failed: ${err instanceof Error ? err.message : String(err)}`,
426
+ remediation: 'Repair the workspace database or its permissions, then retry the upgrade. The current installation has not been replaced.',
427
+ };
428
+ }
429
+ }
430
+ export async function runLegacyRuleContractPreflight(pluginDir, workspaceDir, runScan = defaultLegacyRulePreflightRunner) {
431
+ const resolvedWorkspace = path.resolve(workspaceDir);
432
+ // Self-contained status decision (P0/P1-2): a workspace with no persisted
433
+ // PD state has nothing a contract change could break, so the scan is
434
+ // skipped cleanly. The function must NOT rely on the caller having
435
+ // pre-checked for state.db — Console/installer callers differ.
436
+ const stateDbPath = path.join(resolvedWorkspace, '.pd', 'state.db');
437
+ if (!existsSync(stateDbPath)) {
438
+ return {
439
+ ok: true,
440
+ status: 'no_state_db',
441
+ reason: 'state.db not found — no persisted activations to scan',
442
+ };
443
+ }
444
+ const pdCliRoot = path.resolve(pluginDir, 'pd-cli');
445
+ const pdCliEntry = path.resolve(pdCliRoot, 'dist', 'index.js');
446
+ if (pdCliEntry !== pdCliRoot && !pdCliEntry.startsWith(pdCliRoot + path.sep)) {
447
+ return {
448
+ ok: false,
449
+ status: 'scan_unavailable',
450
+ reason: `compatibility_scan_unavailable: pd-cli entry escapes package dir (${pdCliEntry})`,
451
+ remediation: 'Re-download/rebuild the installer before upgrading. The current installation has not been replaced.',
452
+ };
453
+ }
454
+ if (!existsSync(pdCliEntry) || !statSync(pdCliEntry).isFile()) {
455
+ // A stateful workspace is about to be upgraded and we cannot prove its
456
+ // active RuleCode is compatible with the new runtime. This is NOT a
457
+ // "fresh layout, skip it" case — fresh workspaces were handled above by
458
+ // the no_state_db early return. Fail closed (P0/P1-2).
459
+ return {
460
+ ok: false,
461
+ status: 'scan_unavailable',
462
+ reason: 'compatibility_scan_unavailable',
463
+ remediation: 'The bundled compatibility scanner is missing. The package may be incomplete or corrupted. ' +
464
+ 'Re-download/rebuild the installer before upgrading. The current installation has not been replaced.',
465
+ };
466
+ }
467
+ try {
468
+ return await runScan(pdCliEntry, resolvedWorkspace);
469
+ }
470
+ catch (err) {
471
+ return {
472
+ ok: false,
473
+ status: 'scan_failed',
474
+ reason: `compatibility_scan_failed: ${err instanceof Error ? err.message : String(err)}`,
475
+ remediation: 'Repair the workspace database or its permissions, then retry the upgrade. The current installation has not been replaced.',
476
+ };
477
+ }
478
+ }
479
+ /**
480
+ * Structured refusal for the legacy-contract preflight: nothing has been
481
+ * mutated yet (the old installation is untouched) and the message names the
482
+ * affected rules via the scan's remediation text.
483
+ */
484
+ function buildCompatibilityRefusalResult(options, outcome) {
485
+ const nextAction = outcome.remediation ?? 'Migrate or deactivate the listed rules, then re-run the installer.';
486
+ return {
487
+ success: false,
488
+ workspaceDir: options.workspaceDir,
489
+ configYamlPath: getConfigYamlPath(options.workspaceDir),
490
+ templatesCount: 0,
491
+ components: { plugin: 'skipped', cli: 'skipped', console: 'skipped' },
492
+ verification: { features: 'skipped', storyA: 'skipped' },
493
+ enabledChannels: options.channels,
494
+ nextAction,
495
+ reason: outcome.reason ?? 'legacy_rule_contract_dependency',
496
+ ...(outcome.remediation !== undefined ? { error: outcome.remediation } : {}),
497
+ };
498
+ }
319
499
  export async function checkBuiltPlugin(pluginDir) {
320
500
  const distDir = path.join(pluginDir, 'plugin', 'dist');
321
501
  const pluginJson = path.join(pluginDir, 'plugin', 'openclaw.plugin.json');
@@ -1209,6 +1389,21 @@ export async function install(options, pluginDir, mode = {}) {
1209
1389
  await checkBuiltPlugin(pluginDir);
1210
1390
  verification.manifestActivation = 'verified';
1211
1391
  stepIndex++;
1392
+ // Legacy rule contract preflight — run BEFORE the backup/rename step so
1393
+ // a refusal leaves the existing installation completely untouched. Only
1394
+ // meaningful when the target workspace already has PD state; fresh
1395
+ // workspaces scan clean (no state.db → nothing persisted to conflict).
1396
+ if (existsSync(path.join(path.resolve(options.workspaceDir), '.pd', 'state.db'))) {
1397
+ if (spinner)
1398
+ updateProgress(spinner, stepIndex, 'Checking workspace rule compatibility...');
1399
+ const compat = await runLegacyRuleContractPreflight(pluginDir, options.workspaceDir);
1400
+ if (!compat.ok) {
1401
+ if (!quiet)
1402
+ logger.error(compat.reason ?? 'legacy_rule_contract_dependency');
1403
+ return buildCompatibilityRefusalResult(options, compat);
1404
+ }
1405
+ }
1406
+ stepIndex++;
1212
1407
  if (spinner)
1213
1408
  updateProgress(spinner, stepIndex, 'Backing up existing install...');
1214
1409
  migrateLegacyPdBackups();
@@ -1330,9 +1525,26 @@ export async function install(options, pluginDir, mode = {}) {
1330
1525
  if (spinner)
1331
1526
  updateProgress(spinner, stepIndex, 'Verifying demo...');
1332
1527
  try {
1333
- const installedPdCliEntry = path.join(getInstalledPdCliDir(), 'dist', 'index.js');
1334
- execFileSync(process.execPath, [installedPdCliEntry, 'demo', 'story-a', '--json', '--workspace', options.workspaceDir], {
1335
- stdio: 'pipe',
1528
+ // Demo isolation (2026-08-19): the install target already holds
1529
+ // initialized PD state at this point (.pd/state.db, .principles/
1530
+ // PROFILE.json), so the CLI's demo guard refuses to write demo data
1531
+ // into it. Run WITHOUT --workspace — pd-cli provisions and cleans up
1532
+ // its own throwaway temp workspace, exercising the same installed
1533
+ // pd-cli + core chain without polluting the user's workspace.
1534
+ // The entry path is boundary-checked before it is used as a
1535
+ // subprocess target (canonical-path containment + existence).
1536
+ const pdCliRoot = path.resolve(getInstalledPdCliDir());
1537
+ const pdCliEntry = path.resolve(pdCliRoot, 'dist', 'index.js');
1538
+ if (pdCliEntry !== pdCliRoot && !pdCliEntry.startsWith(pdCliRoot + path.sep)) {
1539
+ throw new Error(`pd-cli entry escapes install dir: ${pdCliEntry}`);
1540
+ }
1541
+ if (!existsSync(pdCliEntry) || !statSync(pdCliEntry).isFile()) {
1542
+ throw new Error(`pd-cli entry missing: ${pdCliEntry}`);
1543
+ }
1544
+ const { execFile } = await import('node:child_process');
1545
+ const { promisify } = await import('node:util');
1546
+ const execFileAsync = promisify(execFile);
1547
+ await execFileAsync(process.execPath, [pdCliEntry, 'demo', 'story-a', '--json'], {
1336
1548
  timeout: STORY_A_VERIFICATION_TIMEOUT_MS,
1337
1549
  });
1338
1550
  verification.storyA = 'passed';