@principles/core 1.287.0 → 1.287.2

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 (1590) hide show
  1. package/dist/runtime-v2/activation/index.d.ts +2 -2
  2. package/dist/runtime-v2/activation/index.d.ts.map +1 -1
  3. package/dist/runtime-v2/activation/index.js +1 -1
  4. package/dist/runtime-v2/activation/index.js.map +1 -1
  5. package/dist/runtime-v2/activation/production-gate-deps.d.ts +9 -5
  6. package/dist/runtime-v2/activation/production-gate-deps.d.ts.map +1 -1
  7. package/dist/runtime-v2/activation/production-gate-deps.js +50 -10
  8. package/dist/runtime-v2/activation/production-gate-deps.js.map +1 -1
  9. package/dist/runtime-v2/activation/promotion-evidence-snapshot.d.ts +34 -0
  10. package/dist/runtime-v2/activation/promotion-evidence-snapshot.d.ts.map +1 -1
  11. package/dist/runtime-v2/activation/promotion-evidence-snapshot.js +57 -0
  12. package/dist/runtime-v2/activation/promotion-evidence-snapshot.js.map +1 -1
  13. package/dist/runtime-v2/{internalization/__tests__/__fixtures__/split-pipeline-mock-outputs.d.ts → adapter/split-pipeline-fixtures.d.ts} +8 -4
  14. package/dist/runtime-v2/adapter/split-pipeline-fixtures.d.ts.map +1 -0
  15. package/dist/runtime-v2/{internalization/__tests__/__fixtures__/split-pipeline-mock-outputs.js → adapter/split-pipeline-fixtures.js} +5 -1
  16. package/dist/runtime-v2/adapter/split-pipeline-fixtures.js.map +1 -0
  17. package/dist/runtime-v2/adapter/test-double-runtime-adapter.d.ts +1 -1
  18. package/dist/runtime-v2/adapter/test-double-runtime-adapter.js +2 -2
  19. package/dist/runtime-v2/adapter/test-double-runtime-adapter.js.map +1 -1
  20. package/dist/runtime-v2/index.d.ts +5 -4
  21. package/dist/runtime-v2/index.d.ts.map +1 -1
  22. package/dist/runtime-v2/index.js +3 -3
  23. package/dist/runtime-v2/index.js.map +1 -1
  24. package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts +8 -5
  25. package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
  26. package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +22 -5
  27. package/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
  28. package/dist/runtime-v2/runner/diagnostician-validator.d.ts +5 -11
  29. package/dist/runtime-v2/runner/diagnostician-validator.d.ts.map +1 -1
  30. package/dist/runtime-v2/runner/diagnostician-validator.js +1 -10
  31. package/dist/runtime-v2/runner/diagnostician-validator.js.map +1 -1
  32. package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.d.ts +22 -0
  33. package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.d.ts.map +1 -1
  34. package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js +13 -4
  35. package/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js.map +1 -1
  36. package/package.json +5 -3
  37. package/dist/evolution-store.test.d.ts +0 -2
  38. package/dist/evolution-store.test.d.ts.map +0 -1
  39. package/dist/evolution-store.test.js +0 -294
  40. package/dist/evolution-store.test.js.map +0 -1
  41. package/dist/host/__tests__/host-adapter.test.d.ts +0 -2
  42. package/dist/host/__tests__/host-adapter.test.d.ts.map +0 -1
  43. package/dist/host/__tests__/host-adapter.test.js +0 -108
  44. package/dist/host/__tests__/host-adapter.test.js.map +0 -1
  45. package/dist/principle-tree-ledger-lifecycle.test.d.ts +0 -2
  46. package/dist/principle-tree-ledger-lifecycle.test.d.ts.map +0 -1
  47. package/dist/principle-tree-ledger-lifecycle.test.js +0 -530
  48. package/dist/principle-tree-ledger-lifecycle.test.js.map +0 -1
  49. package/dist/prompt-builder/__tests__/attitude-directive.test.d.ts +0 -2
  50. package/dist/prompt-builder/__tests__/attitude-directive.test.d.ts.map +0 -1
  51. package/dist/prompt-builder/__tests__/attitude-directive.test.js +0 -49
  52. package/dist/prompt-builder/__tests__/attitude-directive.test.js.map +0 -1
  53. package/dist/prompt-builder/__tests__/correction-cue.test.d.ts +0 -2
  54. package/dist/prompt-builder/__tests__/correction-cue.test.d.ts.map +0 -1
  55. package/dist/prompt-builder/__tests__/correction-cue.test.js +0 -61
  56. package/dist/prompt-builder/__tests__/correction-cue.test.js.map +0 -1
  57. package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.d.ts +0 -2
  58. package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.d.ts.map +0 -1
  59. package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.js +0 -380
  60. package/dist/prompt-builder/__tests__/empathy-keyword-matching.test.js.map +0 -1
  61. package/dist/prompt-builder/__tests__/focus-compression.test.d.ts +0 -2
  62. package/dist/prompt-builder/__tests__/focus-compression.test.d.ts.map +0 -1
  63. package/dist/prompt-builder/__tests__/focus-compression.test.js +0 -265
  64. package/dist/prompt-builder/__tests__/focus-compression.test.js.map +0 -1
  65. package/dist/prompt-builder/__tests__/message-extraction.test.d.ts +0 -2
  66. package/dist/prompt-builder/__tests__/message-extraction.test.d.ts.map +0 -1
  67. package/dist/prompt-builder/__tests__/message-extraction.test.js +0 -90
  68. package/dist/prompt-builder/__tests__/message-extraction.test.js.map +0 -1
  69. package/dist/prompt-builder/__tests__/minimal-trigger.test.d.ts +0 -2
  70. package/dist/prompt-builder/__tests__/minimal-trigger.test.d.ts.map +0 -1
  71. package/dist/prompt-builder/__tests__/minimal-trigger.test.js +0 -45
  72. package/dist/prompt-builder/__tests__/minimal-trigger.test.js.map +0 -1
  73. package/dist/prompt-builder/__tests__/model-config.test.d.ts +0 -2
  74. package/dist/prompt-builder/__tests__/model-config.test.d.ts.map +0 -1
  75. package/dist/prompt-builder/__tests__/model-config.test.js +0 -158
  76. package/dist/prompt-builder/__tests__/model-config.test.js.map +0 -1
  77. package/dist/prompt-builder/__tests__/principle-selection.test.d.ts +0 -7
  78. package/dist/prompt-builder/__tests__/principle-selection.test.d.ts.map +0 -1
  79. package/dist/prompt-builder/__tests__/principle-selection.test.js +0 -214
  80. package/dist/prompt-builder/__tests__/principle-selection.test.js.map +0 -1
  81. package/dist/prompt-builder/__tests__/prompt-builder-core.test.d.ts +0 -7
  82. package/dist/prompt-builder/__tests__/prompt-builder-core.test.d.ts.map +0 -1
  83. package/dist/prompt-builder/__tests__/prompt-builder-core.test.js +0 -341
  84. package/dist/prompt-builder/__tests__/prompt-builder-core.test.js.map +0 -1
  85. package/dist/prompt-builder/__tests__/routing-guidance.test.d.ts +0 -10
  86. package/dist/prompt-builder/__tests__/routing-guidance.test.d.ts.map +0 -1
  87. package/dist/prompt-builder/__tests__/routing-guidance.test.js +0 -304
  88. package/dist/prompt-builder/__tests__/routing-guidance.test.js.map +0 -1
  89. package/dist/prompt-builder/__tests__/xml-escape.test.d.ts +0 -2
  90. package/dist/prompt-builder/__tests__/xml-escape.test.d.ts.map +0 -1
  91. package/dist/prompt-builder/__tests__/xml-escape.test.js +0 -42
  92. package/dist/prompt-builder/__tests__/xml-escape.test.js.map +0 -1
  93. package/dist/quality-scorecard/__tests__/quality-scorecard.test.d.ts +0 -2
  94. package/dist/quality-scorecard/__tests__/quality-scorecard.test.d.ts.map +0 -1
  95. package/dist/quality-scorecard/__tests__/quality-scorecard.test.js +0 -929
  96. package/dist/quality-scorecard/__tests__/quality-scorecard.test.js.map +0 -1
  97. package/dist/quality-scorecard/__tests__/report-generator.test.d.ts +0 -2
  98. package/dist/quality-scorecard/__tests__/report-generator.test.d.ts.map +0 -1
  99. package/dist/quality-scorecard/__tests__/report-generator.test.js +0 -627
  100. package/dist/quality-scorecard/__tests__/report-generator.test.js.map +0 -1
  101. package/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.d.ts +0 -2
  102. package/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.d.ts.map +0 -1
  103. package/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.js +0 -148
  104. package/dist/runtime-v2/__tests__/activation-compatibility-read-model.test.js.map +0 -1
  105. package/dist/runtime-v2/__tests__/activation-types-helpers.test.d.ts +0 -20
  106. package/dist/runtime-v2/__tests__/activation-types-helpers.test.d.ts.map +0 -1
  107. package/dist/runtime-v2/__tests__/activation-types-helpers.test.js +0 -215
  108. package/dist/runtime-v2/__tests__/activation-types-helpers.test.js.map +0 -1
  109. package/dist/runtime-v2/__tests__/admission-gate.test.d.ts +0 -2
  110. package/dist/runtime-v2/__tests__/admission-gate.test.d.ts.map +0 -1
  111. package/dist/runtime-v2/__tests__/admission-gate.test.js +0 -307
  112. package/dist/runtime-v2/__tests__/admission-gate.test.js.map +0 -1
  113. package/dist/runtime-v2/__tests__/adversarial-loop.test.d.ts +0 -2
  114. package/dist/runtime-v2/__tests__/adversarial-loop.test.d.ts.map +0 -1
  115. package/dist/runtime-v2/__tests__/adversarial-loop.test.js +0 -446
  116. package/dist/runtime-v2/__tests__/adversarial-loop.test.js.map +0 -1
  117. package/dist/runtime-v2/__tests__/append-event-log-line.test.d.ts +0 -2
  118. package/dist/runtime-v2/__tests__/append-event-log-line.test.d.ts.map +0 -1
  119. package/dist/runtime-v2/__tests__/append-event-log-line.test.js +0 -47
  120. package/dist/runtime-v2/__tests__/append-event-log-line.test.js.map +0 -1
  121. package/dist/runtime-v2/__tests__/architecture-regression.test.d.ts +0 -2
  122. package/dist/runtime-v2/__tests__/architecture-regression.test.d.ts.map +0 -1
  123. package/dist/runtime-v2/__tests__/architecture-regression.test.js +0 -3845
  124. package/dist/runtime-v2/__tests__/architecture-regression.test.js.map +0 -1
  125. package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.d.ts +0 -2
  126. package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.d.ts.map +0 -1
  127. package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js +0 -1923
  128. package/dist/runtime-v2/__tests__/artificer-runner-vslice.test.js.map +0 -1
  129. package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.d.ts +0 -20
  130. package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.d.ts.map +0 -1
  131. package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js +0 -578
  132. package/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js.map +0 -1
  133. package/dist/runtime-v2/__tests__/barrel-io-cleanup.test.d.ts +0 -12
  134. package/dist/runtime-v2/__tests__/barrel-io-cleanup.test.d.ts.map +0 -1
  135. package/dist/runtime-v2/__tests__/barrel-io-cleanup.test.js +0 -46
  136. package/dist/runtime-v2/__tests__/barrel-io-cleanup.test.js.map +0 -1
  137. package/dist/runtime-v2/__tests__/bridge-result-shaper.test.d.ts +0 -26
  138. package/dist/runtime-v2/__tests__/bridge-result-shaper.test.d.ts.map +0 -1
  139. package/dist/runtime-v2/__tests__/bridge-result-shaper.test.js +0 -450
  140. package/dist/runtime-v2/__tests__/bridge-result-shaper.test.js.map +0 -1
  141. package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.d.ts +0 -2
  142. package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.d.ts.map +0 -1
  143. package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.js +0 -169
  144. package/dist/runtime-v2/__tests__/build-golden-trace-from-artificer.test.js.map +0 -1
  145. package/dist/runtime-v2/__tests__/build-l2-principle-reader.test.d.ts +0 -2
  146. package/dist/runtime-v2/__tests__/build-l2-principle-reader.test.d.ts.map +0 -1
  147. package/dist/runtime-v2/__tests__/build-l2-principle-reader.test.js +0 -200
  148. package/dist/runtime-v2/__tests__/build-l2-principle-reader.test.js.map +0 -1
  149. package/dist/runtime-v2/__tests__/candidate-audit.test.d.ts +0 -2
  150. package/dist/runtime-v2/__tests__/candidate-audit.test.d.ts.map +0 -1
  151. package/dist/runtime-v2/__tests__/candidate-audit.test.js +0 -100
  152. package/dist/runtime-v2/__tests__/candidate-audit.test.js.map +0 -1
  153. package/dist/runtime-v2/__tests__/chain-integrity-attack.test.d.ts +0 -2
  154. package/dist/runtime-v2/__tests__/chain-integrity-attack.test.d.ts.map +0 -1
  155. package/dist/runtime-v2/__tests__/chain-integrity-attack.test.js +0 -293
  156. package/dist/runtime-v2/__tests__/chain-integrity-attack.test.js.map +0 -1
  157. package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.d.ts +0 -2
  158. package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.d.ts.map +0 -1
  159. package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.js +0 -590
  160. package/dist/runtime-v2/__tests__/chain-integrity-real-path.test.js.map +0 -1
  161. package/dist/runtime-v2/__tests__/context-payload-validation.test.d.ts +0 -11
  162. package/dist/runtime-v2/__tests__/context-payload-validation.test.d.ts.map +0 -1
  163. package/dist/runtime-v2/__tests__/context-payload-validation.test.js +0 -309
  164. package/dist/runtime-v2/__tests__/context-payload-validation.test.js.map +0 -1
  165. package/dist/runtime-v2/__tests__/control-plane-triage.test.d.ts +0 -2
  166. package/dist/runtime-v2/__tests__/control-plane-triage.test.d.ts.map +0 -1
  167. package/dist/runtime-v2/__tests__/control-plane-triage.test.js +0 -107
  168. package/dist/runtime-v2/__tests__/control-plane-triage.test.js.map +0 -1
  169. package/dist/runtime-v2/__tests__/correction-proposal.test.d.ts +0 -2
  170. package/dist/runtime-v2/__tests__/correction-proposal.test.d.ts.map +0 -1
  171. package/dist/runtime-v2/__tests__/correction-proposal.test.js +0 -486
  172. package/dist/runtime-v2/__tests__/correction-proposal.test.js.map +0 -1
  173. package/dist/runtime-v2/__tests__/diagnostician-output-schema.test.d.ts +0 -25
  174. package/dist/runtime-v2/__tests__/diagnostician-output-schema.test.d.ts.map +0 -1
  175. package/dist/runtime-v2/__tests__/diagnostician-output-schema.test.js +0 -405
  176. package/dist/runtime-v2/__tests__/diagnostician-output-schema.test.js.map +0 -1
  177. package/dist/runtime-v2/__tests__/dreamer-output-validator.test.d.ts +0 -2
  178. package/dist/runtime-v2/__tests__/dreamer-output-validator.test.d.ts.map +0 -1
  179. package/dist/runtime-v2/__tests__/dreamer-output-validator.test.js +0 -171
  180. package/dist/runtime-v2/__tests__/dreamer-output-validator.test.js.map +0 -1
  181. package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.d.ts +0 -2
  182. package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.d.ts.map +0 -1
  183. package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.js +0 -155
  184. package/dist/runtime-v2/__tests__/dreamer-runner-real-llm.test.js.map +0 -1
  185. package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.d.ts +0 -2
  186. package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.d.ts.map +0 -1
  187. package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.js +0 -539
  188. package/dist/runtime-v2/__tests__/dreamer-runner-vslice.test.js.map +0 -1
  189. package/dist/runtime-v2/__tests__/dreamer-runner.test.d.ts +0 -2
  190. package/dist/runtime-v2/__tests__/dreamer-runner.test.d.ts.map +0 -1
  191. package/dist/runtime-v2/__tests__/dreamer-runner.test.js +0 -366
  192. package/dist/runtime-v2/__tests__/dreamer-runner.test.js.map +0 -1
  193. package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.d.ts +0 -2
  194. package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.d.ts.map +0 -1
  195. package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.js +0 -208
  196. package/dist/runtime-v2/__tests__/dreamer-source-pain-provenance.test.js.map +0 -1
  197. package/dist/runtime-v2/__tests__/error-categories.test.d.ts +0 -2
  198. package/dist/runtime-v2/__tests__/error-categories.test.d.ts.map +0 -1
  199. package/dist/runtime-v2/__tests__/error-categories.test.js +0 -150
  200. package/dist/runtime-v2/__tests__/error-categories.test.js.map +0 -1
  201. package/dist/runtime-v2/__tests__/evaluator-repair-loop.test.d.ts +0 -2
  202. package/dist/runtime-v2/__tests__/evaluator-repair-loop.test.d.ts.map +0 -1
  203. package/dist/runtime-v2/__tests__/evaluator-repair-loop.test.js +0 -675
  204. package/dist/runtime-v2/__tests__/evaluator-repair-loop.test.js.map +0 -1
  205. package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.d.ts +0 -2
  206. package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.d.ts.map +0 -1
  207. package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +0 -1000
  208. package/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +0 -1
  209. package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.d.ts +0 -2
  210. package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.d.ts.map +0 -1
  211. package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.js +0 -1330
  212. package/dist/runtime-v2/__tests__/evaluator-runner-vslice.test.js.map +0 -1
  213. package/dist/runtime-v2/__tests__/event-types-runid.test.d.ts +0 -2
  214. package/dist/runtime-v2/__tests__/event-types-runid.test.d.ts.map +0 -1
  215. package/dist/runtime-v2/__tests__/event-types-runid.test.js +0 -28
  216. package/dist/runtime-v2/__tests__/event-types-runid.test.js.map +0 -1
  217. package/dist/runtime-v2/__tests__/evidence-chain-contract.test.d.ts +0 -2
  218. package/dist/runtime-v2/__tests__/evidence-chain-contract.test.d.ts.map +0 -1
  219. package/dist/runtime-v2/__tests__/evidence-chain-contract.test.js +0 -344
  220. package/dist/runtime-v2/__tests__/evidence-chain-contract.test.js.map +0 -1
  221. package/dist/runtime-v2/__tests__/evidence-chain-host-kind.test.d.ts +0 -2
  222. package/dist/runtime-v2/__tests__/evidence-chain-host-kind.test.d.ts.map +0 -1
  223. package/dist/runtime-v2/__tests__/evidence-chain-host-kind.test.js +0 -49
  224. package/dist/runtime-v2/__tests__/evidence-chain-host-kind.test.js.map +0 -1
  225. package/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.d.ts +0 -2
  226. package/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.d.ts.map +0 -1
  227. package/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.js +0 -284
  228. package/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.js.map +0 -1
  229. package/dist/runtime-v2/__tests__/evidence-guards.test.d.ts +0 -18
  230. package/dist/runtime-v2/__tests__/evidence-guards.test.d.ts.map +0 -1
  231. package/dist/runtime-v2/__tests__/evidence-guards.test.js +0 -155
  232. package/dist/runtime-v2/__tests__/evidence-guards.test.js.map +0 -1
  233. package/dist/runtime-v2/__tests__/evidence-sanitizer.test.d.ts +0 -21
  234. package/dist/runtime-v2/__tests__/evidence-sanitizer.test.d.ts.map +0 -1
  235. package/dist/runtime-v2/__tests__/evidence-sanitizer.test.js +0 -581
  236. package/dist/runtime-v2/__tests__/evidence-sanitizer.test.js.map +0 -1
  237. package/dist/runtime-v2/__tests__/feedback/create-report.test.d.ts +0 -2
  238. package/dist/runtime-v2/__tests__/feedback/create-report.test.d.ts.map +0 -1
  239. package/dist/runtime-v2/__tests__/feedback/create-report.test.js +0 -453
  240. package/dist/runtime-v2/__tests__/feedback/create-report.test.js.map +0 -1
  241. package/dist/runtime-v2/__tests__/feedback/privacy-preview.test.d.ts +0 -2
  242. package/dist/runtime-v2/__tests__/feedback/privacy-preview.test.d.ts.map +0 -1
  243. package/dist/runtime-v2/__tests__/feedback/privacy-preview.test.js +0 -128
  244. package/dist/runtime-v2/__tests__/feedback/privacy-preview.test.js.map +0 -1
  245. package/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.d.ts +0 -2
  246. package/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.d.ts.map +0 -1
  247. package/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.js +0 -361
  248. package/dist/runtime-v2/__tests__/feedback/redact-sensitive.test.js.map +0 -1
  249. package/dist/runtime-v2/__tests__/feedback/render-github-url.test.d.ts +0 -2
  250. package/dist/runtime-v2/__tests__/feedback/render-github-url.test.d.ts.map +0 -1
  251. package/dist/runtime-v2/__tests__/feedback/render-github-url.test.js +0 -102
  252. package/dist/runtime-v2/__tests__/feedback/render-github-url.test.js.map +0 -1
  253. package/dist/runtime-v2/__tests__/feedback/render-markdown.test.d.ts +0 -2
  254. package/dist/runtime-v2/__tests__/feedback/render-markdown.test.d.ts.map +0 -1
  255. package/dist/runtime-v2/__tests__/feedback/render-markdown.test.js +0 -130
  256. package/dist/runtime-v2/__tests__/feedback/render-markdown.test.js.map +0 -1
  257. package/dist/runtime-v2/__tests__/fixtures/index.d.ts +0 -4
  258. package/dist/runtime-v2/__tests__/fixtures/index.d.ts.map +0 -1
  259. package/dist/runtime-v2/__tests__/fixtures/index.js +0 -3
  260. package/dist/runtime-v2/__tests__/fixtures/index.js.map +0 -1
  261. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.d.ts +0 -20
  262. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.d.ts.map +0 -1
  263. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.js +0 -42
  264. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.js.map +0 -1
  265. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.d.ts +0 -2
  266. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.d.ts.map +0 -1
  267. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.js +0 -101
  268. package/dist/runtime-v2/__tests__/fixtures/llm-e2e-config.test.js.map +0 -1
  269. package/dist/runtime-v2/__tests__/fixtures/test-helpers.d.ts +0 -20
  270. package/dist/runtime-v2/__tests__/fixtures/test-helpers.d.ts.map +0 -1
  271. package/dist/runtime-v2/__tests__/fixtures/test-helpers.js +0 -37
  272. package/dist/runtime-v2/__tests__/fixtures/test-helpers.js.map +0 -1
  273. package/dist/runtime-v2/__tests__/full-chain-real-llm.test.d.ts +0 -2
  274. package/dist/runtime-v2/__tests__/full-chain-real-llm.test.d.ts.map +0 -1
  275. package/dist/runtime-v2/__tests__/full-chain-real-llm.test.js +0 -152
  276. package/dist/runtime-v2/__tests__/full-chain-real-llm.test.js.map +0 -1
  277. package/dist/runtime-v2/__tests__/full-trace-contract.test.d.ts +0 -2
  278. package/dist/runtime-v2/__tests__/full-trace-contract.test.d.ts.map +0 -1
  279. package/dist/runtime-v2/__tests__/full-trace-contract.test.js +0 -552
  280. package/dist/runtime-v2/__tests__/full-trace-contract.test.js.map +0 -1
  281. package/dist/runtime-v2/__tests__/gfi-workspace-health.test.d.ts +0 -2
  282. package/dist/runtime-v2/__tests__/gfi-workspace-health.test.d.ts.map +0 -1
  283. package/dist/runtime-v2/__tests__/gfi-workspace-health.test.js +0 -128
  284. package/dist/runtime-v2/__tests__/gfi-workspace-health.test.js.map +0 -1
  285. package/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.d.ts +0 -2
  286. package/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.d.ts.map +0 -1
  287. package/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.js +0 -372
  288. package/dist/runtime-v2/__tests__/golden-path-diagnostician-e2e.test.js.map +0 -1
  289. package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.d.ts +0 -2
  290. package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.d.ts.map +0 -1
  291. package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js +0 -301
  292. package/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js.map +0 -1
  293. package/dist/runtime-v2/__tests__/golden-trace.test.d.ts +0 -2
  294. package/dist/runtime-v2/__tests__/golden-trace.test.d.ts.map +0 -1
  295. package/dist/runtime-v2/__tests__/golden-trace.test.js +0 -470
  296. package/dist/runtime-v2/__tests__/golden-trace.test.js.map +0 -1
  297. package/dist/runtime-v2/__tests__/governance-experience.test.d.ts +0 -2
  298. package/dist/runtime-v2/__tests__/governance-experience.test.d.ts.map +0 -1
  299. package/dist/runtime-v2/__tests__/governance-experience.test.js +0 -319
  300. package/dist/runtime-v2/__tests__/governance-experience.test.js.map +0 -1
  301. package/dist/runtime-v2/__tests__/governance-projection-contract.test.d.ts +0 -2
  302. package/dist/runtime-v2/__tests__/governance-projection-contract.test.d.ts.map +0 -1
  303. package/dist/runtime-v2/__tests__/governance-projection-contract.test.js +0 -78
  304. package/dist/runtime-v2/__tests__/governance-projection-contract.test.js.map +0 -1
  305. package/dist/runtime-v2/__tests__/governance-projection.test.d.ts +0 -2
  306. package/dist/runtime-v2/__tests__/governance-projection.test.d.ts.map +0 -1
  307. package/dist/runtime-v2/__tests__/governance-projection.test.js +0 -154
  308. package/dist/runtime-v2/__tests__/governance-projection.test.js.map +0 -1
  309. package/dist/runtime-v2/__tests__/governance-timestamp-schema.test.d.ts +0 -2
  310. package/dist/runtime-v2/__tests__/governance-timestamp-schema.test.d.ts.map +0 -1
  311. package/dist/runtime-v2/__tests__/governance-timestamp-schema.test.js +0 -81
  312. package/dist/runtime-v2/__tests__/governance-timestamp-schema.test.js.map +0 -1
  313. package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.d.ts +0 -2
  314. package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.d.ts.map +0 -1
  315. package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.js +0 -540
  316. package/dist/runtime-v2/__tests__/intake-to-internalization-bridge.test.js.map +0 -1
  317. package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.d.ts +0 -2
  318. package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.d.ts.map +0 -1
  319. package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.js +0 -531
  320. package/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.js.map +0 -1
  321. package/dist/runtime-v2/__tests__/internalization-consumer-product-path.test.d.ts +0 -2
  322. package/dist/runtime-v2/__tests__/internalization-consumer-product-path.test.d.ts.map +0 -1
  323. package/dist/runtime-v2/__tests__/internalization-consumer-product-path.test.js +0 -226
  324. package/dist/runtime-v2/__tests__/internalization-consumer-product-path.test.js.map +0 -1
  325. package/dist/runtime-v2/__tests__/internalization-contracts.test.d.ts +0 -2
  326. package/dist/runtime-v2/__tests__/internalization-contracts.test.d.ts.map +0 -1
  327. package/dist/runtime-v2/__tests__/internalization-contracts.test.js +0 -76
  328. package/dist/runtime-v2/__tests__/internalization-contracts.test.js.map +0 -1
  329. package/dist/runtime-v2/__tests__/internalization-failure-persistence.test.d.ts +0 -2
  330. package/dist/runtime-v2/__tests__/internalization-failure-persistence.test.d.ts.map +0 -1
  331. package/dist/runtime-v2/__tests__/internalization-failure-persistence.test.js +0 -153
  332. package/dist/runtime-v2/__tests__/internalization-failure-persistence.test.js.map +0 -1
  333. package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.d.ts +0 -2
  334. package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.d.ts.map +0 -1
  335. package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.js +0 -738
  336. package/dist/runtime-v2/__tests__/internalization-integrity-remediation.test.js.map +0 -1
  337. package/dist/runtime-v2/__tests__/internalization-orchestrator.test.d.ts +0 -2
  338. package/dist/runtime-v2/__tests__/internalization-orchestrator.test.d.ts.map +0 -1
  339. package/dist/runtime-v2/__tests__/internalization-orchestrator.test.js +0 -651
  340. package/dist/runtime-v2/__tests__/internalization-orchestrator.test.js.map +0 -1
  341. package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.d.ts +0 -2
  342. package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.d.ts.map +0 -1
  343. package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.js +0 -419
  344. package/dist/runtime-v2/__tests__/internalization-peer-runner-contracts.test.js.map +0 -1
  345. package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.d.ts +0 -2
  346. package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.d.ts.map +0 -1
  347. package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.js +0 -414
  348. package/dist/runtime-v2/__tests__/internalization-queue-read-model.test.js.map +0 -1
  349. package/dist/runtime-v2/__tests__/internalization-route.test.d.ts +0 -2
  350. package/dist/runtime-v2/__tests__/internalization-route.test.d.ts.map +0 -1
  351. package/dist/runtime-v2/__tests__/internalization-route.test.js +0 -136
  352. package/dist/runtime-v2/__tests__/internalization-route.test.js.map +0 -1
  353. package/dist/runtime-v2/__tests__/internalization-state-machine.test.d.ts +0 -2
  354. package/dist/runtime-v2/__tests__/internalization-state-machine.test.d.ts.map +0 -1
  355. package/dist/runtime-v2/__tests__/internalization-state-machine.test.js +0 -585
  356. package/dist/runtime-v2/__tests__/internalization-state-machine.test.js.map +0 -1
  357. package/dist/runtime-v2/__tests__/io-deletion.test.d.ts +0 -12
  358. package/dist/runtime-v2/__tests__/io-deletion.test.d.ts.map +0 -1
  359. package/dist/runtime-v2/__tests__/io-deletion.test.js +0 -92
  360. package/dist/runtime-v2/__tests__/io-deletion.test.js.map +0 -1
  361. package/dist/runtime-v2/__tests__/l1-hard-cap.test.d.ts +0 -2
  362. package/dist/runtime-v2/__tests__/l1-hard-cap.test.d.ts.map +0 -1
  363. package/dist/runtime-v2/__tests__/l1-hard-cap.test.js +0 -157
  364. package/dist/runtime-v2/__tests__/l1-hard-cap.test.js.map +0 -1
  365. package/dist/runtime-v2/__tests__/language-directive.test.d.ts +0 -12
  366. package/dist/runtime-v2/__tests__/language-directive.test.d.ts.map +0 -1
  367. package/dist/runtime-v2/__tests__/language-directive.test.js +0 -162
  368. package/dist/runtime-v2/__tests__/language-directive.test.js.map +0 -1
  369. package/dist/runtime-v2/__tests__/ledger-codec.test.d.ts +0 -2
  370. package/dist/runtime-v2/__tests__/ledger-codec.test.d.ts.map +0 -1
  371. package/dist/runtime-v2/__tests__/ledger-codec.test.js +0 -429
  372. package/dist/runtime-v2/__tests__/ledger-codec.test.js.map +0 -1
  373. package/dist/runtime-v2/__tests__/ledger-store.test.d.ts +0 -2
  374. package/dist/runtime-v2/__tests__/ledger-store.test.d.ts.map +0 -1
  375. package/dist/runtime-v2/__tests__/ledger-store.test.js +0 -65
  376. package/dist/runtime-v2/__tests__/ledger-store.test.js.map +0 -1
  377. package/dist/runtime-v2/__tests__/mainline-contract.test.d.ts +0 -2
  378. package/dist/runtime-v2/__tests__/mainline-contract.test.d.ts.map +0 -1
  379. package/dist/runtime-v2/__tests__/mainline-contract.test.js +0 -194
  380. package/dist/runtime-v2/__tests__/mainline-contract.test.js.map +0 -1
  381. package/dist/runtime-v2/__tests__/mainline-product-path.test.d.ts +0 -2
  382. package/dist/runtime-v2/__tests__/mainline-product-path.test.d.ts.map +0 -1
  383. package/dist/runtime-v2/__tests__/mainline-product-path.test.js +0 -429
  384. package/dist/runtime-v2/__tests__/mainline-product-path.test.js.map +0 -1
  385. package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.d.ts +0 -2
  386. package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.d.ts.map +0 -1
  387. package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.js +0 -102
  388. package/dist/runtime-v2/__tests__/operator-health-cold-start-guard.test.js.map +0 -1
  389. package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.d.ts +0 -2
  390. package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.d.ts.map +0 -1
  391. package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.js +0 -148
  392. package/dist/runtime-v2/__tests__/operator-health-gfi-degraded.test.js.map +0 -1
  393. package/dist/runtime-v2/__tests__/operator-health-gfi.test.d.ts +0 -2
  394. package/dist/runtime-v2/__tests__/operator-health-gfi.test.d.ts.map +0 -1
  395. package/dist/runtime-v2/__tests__/operator-health-gfi.test.js +0 -113
  396. package/dist/runtime-v2/__tests__/operator-health-gfi.test.js.map +0 -1
  397. package/dist/runtime-v2/__tests__/operator-health-read-model.test.d.ts +0 -2
  398. package/dist/runtime-v2/__tests__/operator-health-read-model.test.d.ts.map +0 -1
  399. package/dist/runtime-v2/__tests__/operator-health-read-model.test.js +0 -136
  400. package/dist/runtime-v2/__tests__/operator-health-read-model.test.js.map +0 -1
  401. package/dist/runtime-v2/__tests__/owner-identity.test.d.ts +0 -2
  402. package/dist/runtime-v2/__tests__/owner-identity.test.d.ts.map +0 -1
  403. package/dist/runtime-v2/__tests__/owner-identity.test.js +0 -147
  404. package/dist/runtime-v2/__tests__/owner-identity.test.js.map +0 -1
  405. package/dist/runtime-v2/__tests__/owner-retry.test.d.ts +0 -2
  406. package/dist/runtime-v2/__tests__/owner-retry.test.d.ts.map +0 -1
  407. package/dist/runtime-v2/__tests__/owner-retry.test.js +0 -144
  408. package/dist/runtime-v2/__tests__/owner-retry.test.js.map +0 -1
  409. package/dist/runtime-v2/__tests__/pain-chain-read-model.test.d.ts +0 -2
  410. package/dist/runtime-v2/__tests__/pain-chain-read-model.test.d.ts.map +0 -1
  411. package/dist/runtime-v2/__tests__/pain-chain-read-model.test.js +0 -247
  412. package/dist/runtime-v2/__tests__/pain-chain-read-model.test.js.map +0 -1
  413. package/dist/runtime-v2/__tests__/pain-correction-evidence.test.d.ts +0 -2
  414. package/dist/runtime-v2/__tests__/pain-correction-evidence.test.d.ts.map +0 -1
  415. package/dist/runtime-v2/__tests__/pain-correction-evidence.test.js +0 -37
  416. package/dist/runtime-v2/__tests__/pain-correction-evidence.test.js.map +0 -1
  417. package/dist/runtime-v2/__tests__/pain-diagnosis-persistence.test.d.ts +0 -2
  418. package/dist/runtime-v2/__tests__/pain-diagnosis-persistence.test.d.ts.map +0 -1
  419. package/dist/runtime-v2/__tests__/pain-diagnosis-persistence.test.js +0 -293
  420. package/dist/runtime-v2/__tests__/pain-diagnosis-persistence.test.js.map +0 -1
  421. package/dist/runtime-v2/__tests__/pain-evidence-contract.test.d.ts +0 -2
  422. package/dist/runtime-v2/__tests__/pain-evidence-contract.test.d.ts.map +0 -1
  423. package/dist/runtime-v2/__tests__/pain-evidence-contract.test.js +0 -331
  424. package/dist/runtime-v2/__tests__/pain-evidence-contract.test.js.map +0 -1
  425. package/dist/runtime-v2/__tests__/pain-flood-simulation.test.d.ts +0 -2
  426. package/dist/runtime-v2/__tests__/pain-flood-simulation.test.d.ts.map +0 -1
  427. package/dist/runtime-v2/__tests__/pain-flood-simulation.test.js +0 -267
  428. package/dist/runtime-v2/__tests__/pain-flood-simulation.test.js.map +0 -1
  429. package/dist/runtime-v2/__tests__/pain-ingress-persistence.test.d.ts +0 -2
  430. package/dist/runtime-v2/__tests__/pain-ingress-persistence.test.d.ts.map +0 -1
  431. package/dist/runtime-v2/__tests__/pain-ingress-persistence.test.js +0 -276
  432. package/dist/runtime-v2/__tests__/pain-ingress-persistence.test.js.map +0 -1
  433. package/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.d.ts +0 -2
  434. package/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.d.ts.map +0 -1
  435. package/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.js +0 -131
  436. package/dist/runtime-v2/__tests__/pain-ingress-shared-semantics.test.js.map +0 -1
  437. package/dist/runtime-v2/__tests__/pain-outcome-convergence.test.d.ts +0 -2
  438. package/dist/runtime-v2/__tests__/pain-outcome-convergence.test.d.ts.map +0 -1
  439. package/dist/runtime-v2/__tests__/pain-outcome-convergence.test.js +0 -126
  440. package/dist/runtime-v2/__tests__/pain-outcome-convergence.test.js.map +0 -1
  441. package/dist/runtime-v2/__tests__/pain-signal-bridge-execute-pending.test.d.ts +0 -2
  442. package/dist/runtime-v2/__tests__/pain-signal-bridge-execute-pending.test.d.ts.map +0 -1
  443. package/dist/runtime-v2/__tests__/pain-signal-bridge-execute-pending.test.js +0 -201
  444. package/dist/runtime-v2/__tests__/pain-signal-bridge-execute-pending.test.js.map +0 -1
  445. package/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.d.ts +0 -2
  446. package/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.d.ts.map +0 -1
  447. package/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +0 -500
  448. package/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +0 -1
  449. package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.d.ts +0 -2
  450. package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.d.ts.map +0 -1
  451. package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.js +0 -151
  452. package/dist/runtime-v2/__tests__/pain-signal-bridge-retried.test.js.map +0 -1
  453. package/dist/runtime-v2/__tests__/pain-signal-bridge-short-circuit.test.d.ts +0 -2
  454. package/dist/runtime-v2/__tests__/pain-signal-bridge-short-circuit.test.d.ts.map +0 -1
  455. package/dist/runtime-v2/__tests__/pain-signal-bridge-short-circuit.test.js +0 -211
  456. package/dist/runtime-v2/__tests__/pain-signal-bridge-short-circuit.test.js.map +0 -1
  457. package/dist/runtime-v2/__tests__/pain-signal-bridge-workspace-dir.test.d.ts +0 -2
  458. package/dist/runtime-v2/__tests__/pain-signal-bridge-workspace-dir.test.d.ts.map +0 -1
  459. package/dist/runtime-v2/__tests__/pain-signal-bridge-workspace-dir.test.js +0 -182
  460. package/dist/runtime-v2/__tests__/pain-signal-bridge-workspace-dir.test.js.map +0 -1
  461. package/dist/runtime-v2/__tests__/pain-signal-observability.test.d.ts +0 -2
  462. package/dist/runtime-v2/__tests__/pain-signal-observability.test.d.ts.map +0 -1
  463. package/dist/runtime-v2/__tests__/pain-signal-observability.test.js +0 -556
  464. package/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +0 -1
  465. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-edge-cases.test.d.ts +0 -8
  466. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-edge-cases.test.d.ts.map +0 -1
  467. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-edge-cases.test.js +0 -171
  468. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-edge-cases.test.js.map +0 -1
  469. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-effectiveconfig-wiring.test.d.ts +0 -2
  470. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-effectiveconfig-wiring.test.d.ts.map +0 -1
  471. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-effectiveconfig-wiring.test.js +0 -109
  472. package/dist/runtime-v2/__tests__/pain-signal-runtime-factory-effectiveconfig-wiring.test.js.map +0 -1
  473. package/dist/runtime-v2/__tests__/pain-to-principle-service.test.d.ts +0 -2
  474. package/dist/runtime-v2/__tests__/pain-to-principle-service.test.d.ts.map +0 -1
  475. package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +0 -317
  476. package/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +0 -1
  477. package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.d.ts +0 -2
  478. package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.d.ts.map +0 -1
  479. package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.js +0 -167
  480. package/dist/runtime-v2/__tests__/philosopher-runner-real-llm.test.js.map +0 -1
  481. package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.d.ts +0 -2
  482. package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.d.ts.map +0 -1
  483. package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.js +0 -342
  484. package/dist/runtime-v2/__tests__/philosopher-runner-vslice.test.js.map +0 -1
  485. package/dist/runtime-v2/__tests__/pi-artifact-store.test.d.ts +0 -2
  486. package/dist/runtime-v2/__tests__/pi-artifact-store.test.d.ts.map +0 -1
  487. package/dist/runtime-v2/__tests__/pi-artifact-store.test.js +0 -258
  488. package/dist/runtime-v2/__tests__/pi-artifact-store.test.js.map +0 -1
  489. package/dist/runtime-v2/__tests__/pitask-metadata.test.d.ts +0 -8
  490. package/dist/runtime-v2/__tests__/pitask-metadata.test.d.ts.map +0 -1
  491. package/dist/runtime-v2/__tests__/pitask-metadata.test.js +0 -514
  492. package/dist/runtime-v2/__tests__/pitask-metadata.test.js.map +0 -1
  493. package/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.d.ts +0 -27
  494. package/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.d.ts.map +0 -1
  495. package/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.js +0 -449
  496. package/dist/runtime-v2/__tests__/pri638-diagnostician-capability-characterization.test.js.map +0 -1
  497. package/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.d.ts +0 -2
  498. package/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.d.ts.map +0 -1
  499. package/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.js +0 -116
  500. package/dist/runtime-v2/__tests__/pri638-p1d-error-classification.test.js.map +0 -1
  501. package/dist/runtime-v2/__tests__/principle-compiler-core.test.d.ts +0 -2
  502. package/dist/runtime-v2/__tests__/principle-compiler-core.test.d.ts.map +0 -1
  503. package/dist/runtime-v2/__tests__/principle-compiler-core.test.js +0 -219
  504. package/dist/runtime-v2/__tests__/principle-compiler-core.test.js.map +0 -1
  505. package/dist/runtime-v2/__tests__/product-telemetry-contract.test.d.ts +0 -18
  506. package/dist/runtime-v2/__tests__/product-telemetry-contract.test.d.ts.map +0 -1
  507. package/dist/runtime-v2/__tests__/product-telemetry-contract.test.js +0 -303
  508. package/dist/runtime-v2/__tests__/product-telemetry-contract.test.js.map +0 -1
  509. package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.d.ts +0 -2
  510. package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.d.ts.map +0 -1
  511. package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.js +0 -524
  512. package/dist/runtime-v2/__tests__/production-canary-fixture-gate.test.js.map +0 -1
  513. package/dist/runtime-v2/__tests__/proven-channel-baseline.test.d.ts +0 -2
  514. package/dist/runtime-v2/__tests__/proven-channel-baseline.test.d.ts.map +0 -1
  515. package/dist/runtime-v2/__tests__/proven-channel-baseline.test.js +0 -452
  516. package/dist/runtime-v2/__tests__/proven-channel-baseline.test.js.map +0 -1
  517. package/dist/runtime-v2/__tests__/pruning-mask.test.d.ts +0 -25
  518. package/dist/runtime-v2/__tests__/pruning-mask.test.d.ts.map +0 -1
  519. package/dist/runtime-v2/__tests__/pruning-mask.test.js +0 -281
  520. package/dist/runtime-v2/__tests__/pruning-mask.test.js.map +0 -1
  521. package/dist/runtime-v2/__tests__/pruning-read-model.test.d.ts +0 -2
  522. package/dist/runtime-v2/__tests__/pruning-read-model.test.d.ts.map +0 -1
  523. package/dist/runtime-v2/__tests__/pruning-read-model.test.js +0 -788
  524. package/dist/runtime-v2/__tests__/pruning-read-model.test.js.map +0 -1
  525. package/dist/runtime-v2/__tests__/pruning-review-log.test.d.ts +0 -2
  526. package/dist/runtime-v2/__tests__/pruning-review-log.test.d.ts.map +0 -1
  527. package/dist/runtime-v2/__tests__/pruning-review-log.test.js +0 -159
  528. package/dist/runtime-v2/__tests__/pruning-review-log.test.js.map +0 -1
  529. package/dist/runtime-v2/__tests__/recovery-actions-log.test.d.ts +0 -2
  530. package/dist/runtime-v2/__tests__/recovery-actions-log.test.d.ts.map +0 -1
  531. package/dist/runtime-v2/__tests__/recovery-actions-log.test.js +0 -152
  532. package/dist/runtime-v2/__tests__/recovery-actions-log.test.js.map +0 -1
  533. package/dist/runtime-v2/__tests__/recovery-sweep-service.test.d.ts +0 -2
  534. package/dist/runtime-v2/__tests__/recovery-sweep-service.test.d.ts.map +0 -1
  535. package/dist/runtime-v2/__tests__/recovery-sweep-service.test.js +0 -213
  536. package/dist/runtime-v2/__tests__/recovery-sweep-service.test.js.map +0 -1
  537. package/dist/runtime-v2/__tests__/remediation-contract.test.d.ts +0 -2
  538. package/dist/runtime-v2/__tests__/remediation-contract.test.d.ts.map +0 -1
  539. package/dist/runtime-v2/__tests__/remediation-contract.test.js +0 -39
  540. package/dist/runtime-v2/__tests__/remediation-contract.test.js.map +0 -1
  541. package/dist/runtime-v2/__tests__/replay-production-parity.test.d.ts +0 -13
  542. package/dist/runtime-v2/__tests__/replay-production-parity.test.d.ts.map +0 -1
  543. package/dist/runtime-v2/__tests__/replay-production-parity.test.js +0 -133
  544. package/dist/runtime-v2/__tests__/replay-production-parity.test.js.map +0 -1
  545. package/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.d.ts +0 -12
  546. package/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.d.ts.map +0 -1
  547. package/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.js +0 -298
  548. package/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.js.map +0 -1
  549. package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.d.ts +0 -2
  550. package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.d.ts.map +0 -1
  551. package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.js +0 -791
  552. package/dist/runtime-v2/__tests__/rollout-reviewer-runner-vslice.test.js.map +0 -1
  553. package/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.d.ts +0 -2
  554. package/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.d.ts.map +0 -1
  555. package/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.js +0 -255
  556. package/dist/runtime-v2/__tests__/rollout-reviewer-verdict-paths.test.js.map +0 -1
  557. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.d.ts +0 -2
  558. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.d.ts.map +0 -1
  559. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.js +0 -243
  560. package/dist/runtime-v2/__tests__/rollout-rule-candidate-contract.test.js.map +0 -1
  561. package/dist/runtime-v2/__tests__/rule-host-evaluator.test.d.ts +0 -2
  562. package/dist/runtime-v2/__tests__/rule-host-evaluator.test.d.ts.map +0 -1
  563. package/dist/runtime-v2/__tests__/rule-host-evaluator.test.js +0 -509
  564. package/dist/runtime-v2/__tests__/rule-host-evaluator.test.js.map +0 -1
  565. package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.d.ts +0 -2
  566. package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.d.ts.map +0 -1
  567. package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.js +0 -535
  568. package/dist/runtime-v2/__tests__/rulehost-oob-defense-simulation.test.js.map +0 -1
  569. package/dist/runtime-v2/__tests__/runtime-config-boundary.test.d.ts +0 -2
  570. package/dist/runtime-v2/__tests__/runtime-config-boundary.test.d.ts.map +0 -1
  571. package/dist/runtime-v2/__tests__/runtime-config-boundary.test.js +0 -258
  572. package/dist/runtime-v2/__tests__/runtime-config-boundary.test.js.map +0 -1
  573. package/dist/runtime-v2/__tests__/runtime-state-handle.test.d.ts +0 -2
  574. package/dist/runtime-v2/__tests__/runtime-state-handle.test.d.ts.map +0 -1
  575. package/dist/runtime-v2/__tests__/runtime-state-handle.test.js +0 -76
  576. package/dist/runtime-v2/__tests__/runtime-state-handle.test.js.map +0 -1
  577. package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.d.ts +0 -2
  578. package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.d.ts.map +0 -1
  579. package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.js +0 -208
  580. package/dist/runtime-v2/__tests__/schema-conformance-read-model.test.js.map +0 -1
  581. package/dist/runtime-v2/__tests__/schema-float-precision.test.d.ts +0 -2
  582. package/dist/runtime-v2/__tests__/schema-float-precision.test.d.ts.map +0 -1
  583. package/dist/runtime-v2/__tests__/schema-float-precision.test.js +0 -290
  584. package/dist/runtime-v2/__tests__/schema-float-precision.test.js.map +0 -1
  585. package/dist/runtime-v2/__tests__/schema-orphan-detection.test.d.ts +0 -2
  586. package/dist/runtime-v2/__tests__/schema-orphan-detection.test.d.ts.map +0 -1
  587. package/dist/runtime-v2/__tests__/schema-orphan-detection.test.js +0 -158
  588. package/dist/runtime-v2/__tests__/schema-orphan-detection.test.js.map +0 -1
  589. package/dist/runtime-v2/__tests__/schema-version.test.d.ts +0 -19
  590. package/dist/runtime-v2/__tests__/schema-version.test.d.ts.map +0 -1
  591. package/dist/runtime-v2/__tests__/schema-version.test.js +0 -176
  592. package/dist/runtime-v2/__tests__/schema-version.test.js.map +0 -1
  593. package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.d.ts +0 -2
  594. package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.d.ts.map +0 -1
  595. package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.js +0 -156
  596. package/dist/runtime-v2/__tests__/scribe-runner-real-llm.test.js.map +0 -1
  597. package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.d.ts +0 -2
  598. package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.d.ts.map +0 -1
  599. package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.js +0 -1086
  600. package/dist/runtime-v2/__tests__/scribe-runner-vslice.test.js.map +0 -1
  601. package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.d.ts +0 -2
  602. package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.d.ts.map +0 -1
  603. package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.js +0 -113
  604. package/dist/runtime-v2/__tests__/sqlite-connection-readonly.test.js.map +0 -1
  605. package/dist/runtime-v2/__tests__/stalled-diagnostician-task.test.d.ts +0 -2
  606. package/dist/runtime-v2/__tests__/stalled-diagnostician-task.test.d.ts.map +0 -1
  607. package/dist/runtime-v2/__tests__/stalled-diagnostician-task.test.js +0 -168
  608. package/dist/runtime-v2/__tests__/stalled-diagnostician-task.test.js.map +0 -1
  609. package/dist/runtime-v2/__tests__/status-contract.test.d.ts +0 -2
  610. package/dist/runtime-v2/__tests__/status-contract.test.d.ts.map +0 -1
  611. package/dist/runtime-v2/__tests__/status-contract.test.js +0 -78
  612. package/dist/runtime-v2/__tests__/status-contract.test.js.map +0 -1
  613. package/dist/runtime-v2/__tests__/story-a-demo.test.d.ts +0 -2
  614. package/dist/runtime-v2/__tests__/story-a-demo.test.d.ts.map +0 -1
  615. package/dist/runtime-v2/__tests__/story-a-demo.test.js +0 -274
  616. package/dist/runtime-v2/__tests__/story-a-demo.test.js.map +0 -1
  617. package/dist/runtime-v2/__tests__/synthetic-baseline.test.d.ts +0 -2
  618. package/dist/runtime-v2/__tests__/synthetic-baseline.test.d.ts.map +0 -1
  619. package/dist/runtime-v2/__tests__/synthetic-baseline.test.js +0 -155
  620. package/dist/runtime-v2/__tests__/synthetic-baseline.test.js.map +0 -1
  621. package/dist/runtime-v2/__tests__/system-prompt-merge.test.d.ts +0 -2
  622. package/dist/runtime-v2/__tests__/system-prompt-merge.test.d.ts.map +0 -1
  623. package/dist/runtime-v2/__tests__/system-prompt-merge.test.js +0 -24
  624. package/dist/runtime-v2/__tests__/system-prompt-merge.test.js.map +0 -1
  625. package/dist/runtime-v2/__tests__/task-state-semantics.test.d.ts +0 -2
  626. package/dist/runtime-v2/__tests__/task-state-semantics.test.d.ts.map +0 -1
  627. package/dist/runtime-v2/__tests__/task-state-semantics.test.js +0 -145
  628. package/dist/runtime-v2/__tests__/task-state-semantics.test.js.map +0 -1
  629. package/dist/runtime-v2/__tests__/task-three-strikes.test.d.ts +0 -2
  630. package/dist/runtime-v2/__tests__/task-three-strikes.test.d.ts.map +0 -1
  631. package/dist/runtime-v2/__tests__/task-three-strikes.test.js +0 -268
  632. package/dist/runtime-v2/__tests__/task-three-strikes.test.js.map +0 -1
  633. package/dist/runtime-v2/__tests__/telemetry-event.test.d.ts +0 -2
  634. package/dist/runtime-v2/__tests__/telemetry-event.test.d.ts.map +0 -1
  635. package/dist/runtime-v2/__tests__/telemetry-event.test.js +0 -69
  636. package/dist/runtime-v2/__tests__/telemetry-event.test.js.map +0 -1
  637. package/dist/runtime-v2/__tests__/trajectory-schema.test.d.ts +0 -2
  638. package/dist/runtime-v2/__tests__/trajectory-schema.test.d.ts.map +0 -1
  639. package/dist/runtime-v2/__tests__/trajectory-schema.test.js +0 -85
  640. package/dist/runtime-v2/__tests__/trajectory-schema.test.js.map +0 -1
  641. package/dist/runtime-v2/__tests__/trajectory-store.test.d.ts +0 -2
  642. package/dist/runtime-v2/__tests__/trajectory-store.test.d.ts.map +0 -1
  643. package/dist/runtime-v2/__tests__/trajectory-store.test.js +0 -143
  644. package/dist/runtime-v2/__tests__/trajectory-store.test.js.map +0 -1
  645. package/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts +0 -2
  646. package/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts.map +0 -1
  647. package/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js +0 -211
  648. package/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js.map +0 -1
  649. package/dist/runtime-v2/__tests__/workflow-funnel-loader.test.d.ts +0 -29
  650. package/dist/runtime-v2/__tests__/workflow-funnel-loader.test.d.ts.map +0 -1
  651. package/dist/runtime-v2/__tests__/workflow-funnel-loader.test.js +0 -432
  652. package/dist/runtime-v2/__tests__/workflow-funnel-loader.test.js.map +0 -1
  653. package/dist/runtime-v2/__tests__/workspace-leak-guard.test.d.ts +0 -2
  654. package/dist/runtime-v2/__tests__/workspace-leak-guard.test.d.ts.map +0 -1
  655. package/dist/runtime-v2/__tests__/workspace-leak-guard.test.js +0 -110
  656. package/dist/runtime-v2/__tests__/workspace-leak-guard.test.js.map +0 -1
  657. package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.d.ts +0 -2
  658. package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.d.ts.map +0 -1
  659. package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js +0 -786
  660. package/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js.map +0 -1
  661. package/dist/runtime-v2/activation/__tests__/activation-re-dispatch.test.d.ts +0 -2
  662. package/dist/runtime-v2/activation/__tests__/activation-re-dispatch.test.d.ts.map +0 -1
  663. package/dist/runtime-v2/activation/__tests__/activation-re-dispatch.test.js +0 -165
  664. package/dist/runtime-v2/activation/__tests__/activation-re-dispatch.test.js.map +0 -1
  665. package/dist/runtime-v2/activation/__tests__/approval-completion-service.test.d.ts +0 -21
  666. package/dist/runtime-v2/activation/__tests__/approval-completion-service.test.d.ts.map +0 -1
  667. package/dist/runtime-v2/activation/__tests__/approval-completion-service.test.js +0 -363
  668. package/dist/runtime-v2/activation/__tests__/approval-completion-service.test.js.map +0 -1
  669. package/dist/runtime-v2/activation/__tests__/approval-context-types.test.d.ts +0 -2
  670. package/dist/runtime-v2/activation/__tests__/approval-context-types.test.d.ts.map +0 -1
  671. package/dist/runtime-v2/activation/__tests__/approval-context-types.test.js +0 -117
  672. package/dist/runtime-v2/activation/__tests__/approval-context-types.test.js.map +0 -1
  673. package/dist/runtime-v2/activation/__tests__/approval-queue.test.d.ts +0 -17
  674. package/dist/runtime-v2/activation/__tests__/approval-queue.test.d.ts.map +0 -1
  675. package/dist/runtime-v2/activation/__tests__/approval-queue.test.js +0 -406
  676. package/dist/runtime-v2/activation/__tests__/approval-queue.test.js.map +0 -1
  677. package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.d.ts +0 -2
  678. package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.d.ts.map +0 -1
  679. package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js +0 -187
  680. package/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js.map +0 -1
  681. package/dist/runtime-v2/activation/__tests__/edit-then-approve.test.d.ts +0 -20
  682. package/dist/runtime-v2/activation/__tests__/edit-then-approve.test.d.ts.map +0 -1
  683. package/dist/runtime-v2/activation/__tests__/edit-then-approve.test.js +0 -145
  684. package/dist/runtime-v2/activation/__tests__/edit-then-approve.test.js.map +0 -1
  685. package/dist/runtime-v2/activation/__tests__/helpers.d.ts +0 -21
  686. package/dist/runtime-v2/activation/__tests__/helpers.d.ts.map +0 -1
  687. package/dist/runtime-v2/activation/__tests__/helpers.js +0 -132
  688. package/dist/runtime-v2/activation/__tests__/helpers.js.map +0 -1
  689. package/dist/runtime-v2/activation/__tests__/low-risk-writers.test.d.ts +0 -21
  690. package/dist/runtime-v2/activation/__tests__/low-risk-writers.test.d.ts.map +0 -1
  691. package/dist/runtime-v2/activation/__tests__/low-risk-writers.test.js +0 -468
  692. package/dist/runtime-v2/activation/__tests__/low-risk-writers.test.js.map +0 -1
  693. package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.d.ts +0 -2
  694. package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.d.ts.map +0 -1
  695. package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js +0 -257
  696. package/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js.map +0 -1
  697. package/dist/runtime-v2/activation/__tests__/openclaw-promotion-checks.test.d.ts +0 -2
  698. package/dist/runtime-v2/activation/__tests__/openclaw-promotion-checks.test.d.ts.map +0 -1
  699. package/dist/runtime-v2/activation/__tests__/openclaw-promotion-checks.test.js +0 -91
  700. package/dist/runtime-v2/activation/__tests__/openclaw-promotion-checks.test.js.map +0 -1
  701. package/dist/runtime-v2/activation/__tests__/production-gate-deps.test.d.ts +0 -15
  702. package/dist/runtime-v2/activation/__tests__/production-gate-deps.test.d.ts.map +0 -1
  703. package/dist/runtime-v2/activation/__tests__/production-gate-deps.test.js +0 -503
  704. package/dist/runtime-v2/activation/__tests__/production-gate-deps.test.js.map +0 -1
  705. package/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.d.ts +0 -2
  706. package/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.d.ts.map +0 -1
  707. package/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.js +0 -104
  708. package/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.js.map +0 -1
  709. package/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.d.ts +0 -2
  710. package/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.d.ts.map +0 -1
  711. package/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.js +0 -102
  712. package/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.js.map +0 -1
  713. package/dist/runtime-v2/activation/__tests__/promotion-readiness-reader.test.d.ts +0 -2
  714. package/dist/runtime-v2/activation/__tests__/promotion-readiness-reader.test.d.ts.map +0 -1
  715. package/dist/runtime-v2/activation/__tests__/promotion-readiness-reader.test.js +0 -48
  716. package/dist/runtime-v2/activation/__tests__/promotion-readiness-reader.test.js.map +0 -1
  717. package/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.d.ts +0 -2
  718. package/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.d.ts.map +0 -1
  719. package/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js +0 -407
  720. package/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js.map +0 -1
  721. package/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.d.ts +0 -2
  722. package/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.d.ts.map +0 -1
  723. package/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.js +0 -161
  724. package/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.js.map +0 -1
  725. package/dist/runtime-v2/activation/__tests__/rulecode-safety-circuit-breaker.test.d.ts +0 -2
  726. package/dist/runtime-v2/activation/__tests__/rulecode-safety-circuit-breaker.test.d.ts.map +0 -1
  727. package/dist/runtime-v2/activation/__tests__/rulecode-safety-circuit-breaker.test.js +0 -31
  728. package/dist/runtime-v2/activation/__tests__/rulecode-safety-circuit-breaker.test.js.map +0 -1
  729. package/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.d.ts +0 -2
  730. package/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.d.ts.map +0 -1
  731. package/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.js +0 -351
  732. package/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.js.map +0 -1
  733. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.d.ts +0 -2
  734. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.d.ts.map +0 -1
  735. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.js +0 -62
  736. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.js.map +0 -1
  737. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.d.ts +0 -2
  738. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.d.ts.map +0 -1
  739. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js +0 -257
  740. package/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js.map +0 -1
  741. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.d.ts +0 -2
  742. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.d.ts.map +0 -1
  743. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.js +0 -56
  744. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.js.map +0 -1
  745. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.d.ts +0 -2
  746. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.d.ts.map +0 -1
  747. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js +0 -168
  748. package/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js.map +0 -1
  749. package/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.d.ts +0 -35
  750. package/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.d.ts.map +0 -1
  751. package/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js +0 -416
  752. package/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js.map +0 -1
  753. package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.d.ts +0 -2
  754. package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.d.ts.map +0 -1
  755. package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +0 -1144
  756. package/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +0 -1
  757. package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.d.ts +0 -2
  758. package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.d.ts.map +0 -1
  759. package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.js +0 -651
  760. package/dist/runtime-v2/adapter/__tests__/artificer-l2-adapter.test.js.map +0 -1
  761. package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.d.ts +0 -2
  762. package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.d.ts.map +0 -1
  763. package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js +0 -553
  764. package/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js.map +0 -1
  765. package/dist/runtime-v2/adapter/__tests__/json-extractor.test.d.ts +0 -2
  766. package/dist/runtime-v2/adapter/__tests__/json-extractor.test.d.ts.map +0 -1
  767. package/dist/runtime-v2/adapter/__tests__/json-extractor.test.js +0 -288
  768. package/dist/runtime-v2/adapter/__tests__/json-extractor.test.js.map +0 -1
  769. package/dist/runtime-v2/adapter/__tests__/l2-agent-loop-adapter.test.d.ts +0 -2
  770. package/dist/runtime-v2/adapter/__tests__/l2-agent-loop-adapter.test.d.ts.map +0 -1
  771. package/dist/runtime-v2/adapter/__tests__/l2-agent-loop-adapter.test.js +0 -454
  772. package/dist/runtime-v2/adapter/__tests__/l2-agent-loop-adapter.test.js.map +0 -1
  773. package/dist/runtime-v2/adapter/__tests__/l2-resolve-model-compat.test.d.ts +0 -2
  774. package/dist/runtime-v2/adapter/__tests__/l2-resolve-model-compat.test.d.ts.map +0 -1
  775. package/dist/runtime-v2/adapter/__tests__/l2-resolve-model-compat.test.js +0 -147
  776. package/dist/runtime-v2/adapter/__tests__/l2-resolve-model-compat.test.js.map +0 -1
  777. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-message-file.test.d.ts +0 -19
  778. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-message-file.test.d.ts.map +0 -1
  779. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-message-file.test.js +0 -210
  780. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-message-file.test.js.map +0 -1
  781. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-systemprompt-fold.test.d.ts +0 -13
  782. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-systemprompt-fold.test.d.ts.map +0 -1
  783. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-systemprompt-fold.test.js +0 -86
  784. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter-systemprompt-fold.test.js.map +0 -1
  785. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.d.ts +0 -2
  786. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.d.ts.map +0 -1
  787. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js +0 -803
  788. package/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js.map +0 -1
  789. package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.d.ts +0 -2
  790. package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.d.ts.map +0 -1
  791. package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.js +0 -305
  792. package/dist/runtime-v2/adapter/__tests__/output-repair-contract.test.js.map +0 -1
  793. package/dist/runtime-v2/adapter/__tests__/pd-stream-simple.test.d.ts +0 -2
  794. package/dist/runtime-v2/adapter/__tests__/pd-stream-simple.test.d.ts.map +0 -1
  795. package/dist/runtime-v2/adapter/__tests__/pd-stream-simple.test.js +0 -71
  796. package/dist/runtime-v2/adapter/__tests__/pd-stream-simple.test.js.map +0 -1
  797. package/dist/runtime-v2/adapter/__tests__/pi-ai-http-transport.test.d.ts +0 -2
  798. package/dist/runtime-v2/adapter/__tests__/pi-ai-http-transport.test.d.ts.map +0 -1
  799. package/dist/runtime-v2/adapter/__tests__/pi-ai-http-transport.test.js +0 -219
  800. package/dist/runtime-v2/adapter/__tests__/pi-ai-http-transport.test.js.map +0 -1
  801. package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.d.ts +0 -2
  802. package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.d.ts.map +0 -1
  803. package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js +0 -2128
  804. package/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js.map +0 -1
  805. package/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.d.ts +0 -2
  806. package/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.d.ts.map +0 -1
  807. package/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.js +0 -159
  808. package/dist/runtime-v2/adapter/__tests__/principle-tree-ledger-adapter.test.js.map +0 -1
  809. package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.d.ts +0 -2
  810. package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.d.ts.map +0 -1
  811. package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js +0 -246
  812. package/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js.map +0 -1
  813. package/dist/runtime-v2/adapter/__tests__/schema-json-converter.test.d.ts +0 -2
  814. package/dist/runtime-v2/adapter/__tests__/schema-json-converter.test.d.ts.map +0 -1
  815. package/dist/runtime-v2/adapter/__tests__/schema-json-converter.test.js +0 -101
  816. package/dist/runtime-v2/adapter/__tests__/schema-json-converter.test.js.map +0 -1
  817. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter-semantic.test.d.ts +0 -2
  818. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter-semantic.test.d.ts.map +0 -1
  819. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter-semantic.test.js +0 -94
  820. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter-semantic.test.js.map +0 -1
  821. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.d.ts +0 -2
  822. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.d.ts.map +0 -1
  823. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.js +0 -286
  824. package/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.js.map +0 -1
  825. package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.d.ts +0 -2
  826. package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.d.ts.map +0 -1
  827. package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js +0 -544
  828. package/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js.map +0 -1
  829. package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.d.ts +0 -2
  830. package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.d.ts.map +0 -1
  831. package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.js +0 -543
  832. package/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.js.map +0 -1
  833. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.d.ts +0 -2
  834. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.d.ts.map +0 -1
  835. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.js +0 -17
  836. package/dist/runtime-v2/config/__tests__/internal-agent-names.test.js.map +0 -1
  837. package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.d.ts +0 -18
  838. package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.d.ts.map +0 -1
  839. package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +0 -678
  840. package/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +0 -1
  841. package/dist/runtime-v2/config/__tests__/pd-config-context-injection.test.d.ts +0 -2
  842. package/dist/runtime-v2/config/__tests__/pd-config-context-injection.test.d.ts.map +0 -1
  843. package/dist/runtime-v2/config/__tests__/pd-config-context-injection.test.js +0 -205
  844. package/dist/runtime-v2/config/__tests__/pd-config-context-injection.test.js.map +0 -1
  845. package/dist/runtime-v2/config/__tests__/pd-config-contract.test.d.ts +0 -15
  846. package/dist/runtime-v2/config/__tests__/pd-config-contract.test.d.ts.map +0 -1
  847. package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +0 -801
  848. package/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +0 -1
  849. package/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.d.ts +0 -2
  850. package/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.d.ts.map +0 -1
  851. package/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.js +0 -99
  852. package/dist/runtime-v2/config/__tests__/pd-config-pri638-cutover.test.js.map +0 -1
  853. package/dist/runtime-v2/config/__tests__/pd-config-principles.test.d.ts +0 -11
  854. package/dist/runtime-v2/config/__tests__/pd-config-principles.test.d.ts.map +0 -1
  855. package/dist/runtime-v2/config/__tests__/pd-config-principles.test.js +0 -92
  856. package/dist/runtime-v2/config/__tests__/pd-config-principles.test.js.map +0 -1
  857. package/dist/runtime-v2/config/__tests__/pd-config-provenance.test.d.ts +0 -24
  858. package/dist/runtime-v2/config/__tests__/pd-config-provenance.test.d.ts.map +0 -1
  859. package/dist/runtime-v2/config/__tests__/pd-config-provenance.test.js +0 -188
  860. package/dist/runtime-v2/config/__tests__/pd-config-provenance.test.js.map +0 -1
  861. package/dist/runtime-v2/config/__tests__/pd-config-reasoning.test.d.ts +0 -2
  862. package/dist/runtime-v2/config/__tests__/pd-config-reasoning.test.d.ts.map +0 -1
  863. package/dist/runtime-v2/config/__tests__/pd-config-reasoning.test.js +0 -98
  864. package/dist/runtime-v2/config/__tests__/pd-config-reasoning.test.js.map +0 -1
  865. package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.d.ts +0 -13
  866. package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.d.ts.map +0 -1
  867. package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js +0 -446
  868. package/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js.map +0 -1
  869. package/dist/runtime-v2/config/__tests__/pd-config-sparse-bootstrap.test.d.ts +0 -2
  870. package/dist/runtime-v2/config/__tests__/pd-config-sparse-bootstrap.test.d.ts.map +0 -1
  871. package/dist/runtime-v2/config/__tests__/pd-config-sparse-bootstrap.test.js +0 -143
  872. package/dist/runtime-v2/config/__tests__/pd-config-sparse-bootstrap.test.js.map +0 -1
  873. package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.d.ts +0 -12
  874. package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.d.ts.map +0 -1
  875. package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js +0 -649
  876. package/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js.map +0 -1
  877. package/dist/runtime-v2/config/__tests__/pd-config-workspace.test.d.ts +0 -2
  878. package/dist/runtime-v2/config/__tests__/pd-config-workspace.test.d.ts.map +0 -1
  879. package/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js +0 -195
  880. package/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js.map +0 -1
  881. package/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.d.ts +0 -13
  882. package/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.d.ts.map +0 -1
  883. package/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.js +0 -73
  884. package/dist/runtime-v2/config/__tests__/pd-validate-profile-legacy-keys.test.js.map +0 -1
  885. package/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.d.ts +0 -5
  886. package/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.d.ts.map +0 -1
  887. package/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.js +0 -119
  888. package/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.js.map +0 -1
  889. package/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.d.ts +0 -2
  890. package/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.d.ts.map +0 -1
  891. package/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.js +0 -95
  892. package/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.js.map +0 -1
  893. package/dist/runtime-v2/core-principles/__tests__/strip-fabricated-ids.test.d.ts +0 -2
  894. package/dist/runtime-v2/core-principles/__tests__/strip-fabricated-ids.test.d.ts.map +0 -1
  895. package/dist/runtime-v2/core-principles/__tests__/strip-fabricated-ids.test.js +0 -78
  896. package/dist/runtime-v2/core-principles/__tests__/strip-fabricated-ids.test.js.map +0 -1
  897. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts +0 -13
  898. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts.map +0 -1
  899. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js +0 -111
  900. package/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js.map +0 -1
  901. package/dist/runtime-v2/diagnostician/__tests__/diag-distiller-output.test.d.ts +0 -2
  902. package/dist/runtime-v2/diagnostician/__tests__/diag-distiller-output.test.d.ts.map +0 -1
  903. package/dist/runtime-v2/diagnostician/__tests__/diag-distiller-output.test.js +0 -91
  904. package/dist/runtime-v2/diagnostician/__tests__/diag-distiller-output.test.js.map +0 -1
  905. package/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.d.ts +0 -2
  906. package/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.d.ts.map +0 -1
  907. package/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js +0 -366
  908. package/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js.map +0 -1
  909. package/dist/runtime-v2/diagnostician/__tests__/distiller-prompt-builder.test.d.ts +0 -2
  910. package/dist/runtime-v2/diagnostician/__tests__/distiller-prompt-builder.test.d.ts.map +0 -1
  911. package/dist/runtime-v2/diagnostician/__tests__/distiller-prompt-builder.test.js +0 -39
  912. package/dist/runtime-v2/diagnostician/__tests__/distiller-prompt-builder.test.js.map +0 -1
  913. package/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.d.ts +0 -18
  914. package/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.d.ts.map +0 -1
  915. package/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.js +0 -251
  916. package/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.js.map +0 -1
  917. package/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.d.ts +0 -2
  918. package/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.d.ts.map +0 -1
  919. package/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.js +0 -235
  920. package/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.js.map +0 -1
  921. package/dist/runtime-v2/diagnostician/__tests__/router-prompt-builder.test.d.ts +0 -2
  922. package/dist/runtime-v2/diagnostician/__tests__/router-prompt-builder.test.d.ts.map +0 -1
  923. package/dist/runtime-v2/diagnostician/__tests__/router-prompt-builder.test.js +0 -57
  924. package/dist/runtime-v2/diagnostician/__tests__/router-prompt-builder.test.js.map +0 -1
  925. package/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.d.ts +0 -7
  926. package/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.d.ts.map +0 -1
  927. package/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.js +0 -170
  928. package/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.js.map +0 -1
  929. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts +0 -12
  930. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts.map +0 -1
  931. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js +0 -181
  932. package/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js.map +0 -1
  933. package/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.d.ts +0 -18
  934. package/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.d.ts.map +0 -1
  935. package/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.js +0 -277
  936. package/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.js.map +0 -1
  937. package/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.d.ts +0 -13
  938. package/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.d.ts.map +0 -1
  939. package/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js +0 -367
  940. package/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js.map +0 -1
  941. package/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.d.ts +0 -16
  942. package/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.d.ts.map +0 -1
  943. package/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.js +0 -316
  944. package/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.js.map +0 -1
  945. package/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.d.ts +0 -2
  946. package/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.d.ts.map +0 -1
  947. package/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.js +0 -48
  948. package/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.js.map +0 -1
  949. package/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.d.ts +0 -2
  950. package/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.d.ts.map +0 -1
  951. package/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.js +0 -46
  952. package/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.js.map +0 -1
  953. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.d.ts +0 -2
  954. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.d.ts.map +0 -1
  955. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +0 -691
  956. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +0 -1
  957. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.d.ts +0 -2
  958. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.d.ts.map +0 -1
  959. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.js +0 -420
  960. package/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.js.map +0 -1
  961. package/dist/runtime-v2/feature-flags/__tests__/installer-config-parity.test.d.ts +0 -2
  962. package/dist/runtime-v2/feature-flags/__tests__/installer-config-parity.test.d.ts.map +0 -1
  963. package/dist/runtime-v2/feature-flags/__tests__/installer-config-parity.test.js +0 -86
  964. package/dist/runtime-v2/feature-flags/__tests__/installer-config-parity.test.js.map +0 -1
  965. package/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.d.ts +0 -2
  966. package/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.d.ts.map +0 -1
  967. package/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.js +0 -30
  968. package/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.js.map +0 -1
  969. package/dist/runtime-v2/feature-flags/__tests__/pain-diagnosis-persistence-flag.test.d.ts +0 -2
  970. package/dist/runtime-v2/feature-flags/__tests__/pain-diagnosis-persistence-flag.test.d.ts.map +0 -1
  971. package/dist/runtime-v2/feature-flags/__tests__/pain-diagnosis-persistence-flag.test.js +0 -44
  972. package/dist/runtime-v2/feature-flags/__tests__/pain-diagnosis-persistence-flag.test.js.map +0 -1
  973. package/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.d.ts +0 -2
  974. package/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.d.ts.map +0 -1
  975. package/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js +0 -152
  976. package/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js.map +0 -1
  977. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-block-copy-flag.test.d.ts +0 -2
  978. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-block-copy-flag.test.d.ts.map +0 -1
  979. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-block-copy-flag.test.js +0 -42
  980. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-block-copy-flag.test.js.map +0 -1
  981. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-ledger-flag.test.d.ts +0 -2
  982. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-ledger-flag.test.d.ts.map +0 -1
  983. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-ledger-flag.test.js +0 -42
  984. package/dist/runtime-v2/feature-flags/__tests__/principle-receipt-ledger-flag.test.js.map +0 -1
  985. package/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts +0 -2
  986. package/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts.map +0 -1
  987. package/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js +0 -74
  988. package/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js.map +0 -1
  989. package/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts +0 -2
  990. package/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts.map +0 -1
  991. package/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js +0 -246
  992. package/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js.map +0 -1
  993. package/dist/runtime-v2/feedback/__tests__/create-report-agent-draft.test.d.ts +0 -2
  994. package/dist/runtime-v2/feedback/__tests__/create-report-agent-draft.test.d.ts.map +0 -1
  995. package/dist/runtime-v2/feedback/__tests__/create-report-agent-draft.test.js +0 -221
  996. package/dist/runtime-v2/feedback/__tests__/create-report-agent-draft.test.js.map +0 -1
  997. package/dist/runtime-v2/feedback/__tests__/fingerprint.test.d.ts +0 -2
  998. package/dist/runtime-v2/feedback/__tests__/fingerprint.test.d.ts.map +0 -1
  999. package/dist/runtime-v2/feedback/__tests__/fingerprint.test.js +0 -126
  1000. package/dist/runtime-v2/feedback/__tests__/fingerprint.test.js.map +0 -1
  1001. package/dist/runtime-v2/feedback/__tests__/mailto-url.test.d.ts +0 -11
  1002. package/dist/runtime-v2/feedback/__tests__/mailto-url.test.d.ts.map +0 -1
  1003. package/dist/runtime-v2/feedback/__tests__/mailto-url.test.js +0 -160
  1004. package/dist/runtime-v2/feedback/__tests__/mailto-url.test.js.map +0 -1
  1005. package/dist/runtime-v2/feedback/__tests__/pending-agent-draft-store.test.d.ts +0 -2
  1006. package/dist/runtime-v2/feedback/__tests__/pending-agent-draft-store.test.d.ts.map +0 -1
  1007. package/dist/runtime-v2/feedback/__tests__/pending-agent-draft-store.test.js +0 -342
  1008. package/dist/runtime-v2/feedback/__tests__/pending-agent-draft-store.test.js.map +0 -1
  1009. package/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.d.ts +0 -15
  1010. package/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.d.ts.map +0 -1
  1011. package/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.js +0 -450
  1012. package/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.js.map +0 -1
  1013. package/dist/runtime-v2/feedback/__tests__/render-github-url.test.d.ts +0 -13
  1014. package/dist/runtime-v2/feedback/__tests__/render-github-url.test.d.ts.map +0 -1
  1015. package/dist/runtime-v2/feedback/__tests__/render-github-url.test.js +0 -243
  1016. package/dist/runtime-v2/feedback/__tests__/render-github-url.test.js.map +0 -1
  1017. package/dist/runtime-v2/feedback/__tests__/safe-stringify.test.d.ts +0 -12
  1018. package/dist/runtime-v2/feedback/__tests__/safe-stringify.test.d.ts.map +0 -1
  1019. package/dist/runtime-v2/feedback/__tests__/safe-stringify.test.js +0 -172
  1020. package/dist/runtime-v2/feedback/__tests__/safe-stringify.test.js.map +0 -1
  1021. package/dist/runtime-v2/feedback/__tests__/slice1-typed-fields.test.d.ts +0 -2
  1022. package/dist/runtime-v2/feedback/__tests__/slice1-typed-fields.test.d.ts.map +0 -1
  1023. package/dist/runtime-v2/feedback/__tests__/slice1-typed-fields.test.js +0 -278
  1024. package/dist/runtime-v2/feedback/__tests__/slice1-typed-fields.test.js.map +0 -1
  1025. package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.d.ts +0 -2
  1026. package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.d.ts.map +0 -1
  1027. package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.js +0 -626
  1028. package/dist/runtime-v2/gfi/__tests__/gfi-kernel.test.js.map +0 -1
  1029. package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.d.ts +0 -2
  1030. package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.d.ts.map +0 -1
  1031. package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.js +0 -212
  1032. package/dist/runtime-v2/gfi/__tests__/gfi-read-model.test.js.map +0 -1
  1033. package/dist/runtime-v2/intent/__tests__/intent-browser.test.d.ts +0 -2
  1034. package/dist/runtime-v2/intent/__tests__/intent-browser.test.d.ts.map +0 -1
  1035. package/dist/runtime-v2/intent/__tests__/intent-browser.test.js +0 -93
  1036. package/dist/runtime-v2/intent/__tests__/intent-browser.test.js.map +0 -1
  1037. package/dist/runtime-v2/intent/__tests__/intent-decision-record.test.d.ts +0 -2
  1038. package/dist/runtime-v2/intent/__tests__/intent-decision-record.test.d.ts.map +0 -1
  1039. package/dist/runtime-v2/intent/__tests__/intent-decision-record.test.js +0 -185
  1040. package/dist/runtime-v2/intent/__tests__/intent-decision-record.test.js.map +0 -1
  1041. package/dist/runtime-v2/intent/__tests__/intent-doc-version-edge-cases.test.d.ts +0 -2
  1042. package/dist/runtime-v2/intent/__tests__/intent-doc-version-edge-cases.test.d.ts.map +0 -1
  1043. package/dist/runtime-v2/intent/__tests__/intent-doc-version-edge-cases.test.js +0 -182
  1044. package/dist/runtime-v2/intent/__tests__/intent-doc-version-edge-cases.test.js.map +0 -1
  1045. package/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts +0 -2
  1046. package/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts.map +0 -1
  1047. package/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js +0 -88
  1048. package/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js.map +0 -1
  1049. package/dist/runtime-v2/intent/__tests__/intent-doc.test.d.ts +0 -2
  1050. package/dist/runtime-v2/intent/__tests__/intent-doc.test.d.ts.map +0 -1
  1051. package/dist/runtime-v2/intent/__tests__/intent-doc.test.js +0 -181
  1052. package/dist/runtime-v2/intent/__tests__/intent-doc.test.js.map +0 -1
  1053. package/dist/runtime-v2/intent/__tests__/intent-friction-block.test.d.ts +0 -2
  1054. package/dist/runtime-v2/intent/__tests__/intent-friction-block.test.d.ts.map +0 -1
  1055. package/dist/runtime-v2/intent/__tests__/intent-friction-block.test.js +0 -168
  1056. package/dist/runtime-v2/intent/__tests__/intent-friction-block.test.js.map +0 -1
  1057. package/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.d.ts +0 -2
  1058. package/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.d.ts.map +0 -1
  1059. package/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.js +0 -121
  1060. package/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.js.map +0 -1
  1061. package/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.d.ts +0 -54
  1062. package/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.d.ts.map +0 -1
  1063. package/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.js +0 -219
  1064. package/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.js.map +0 -1
  1065. package/dist/runtime-v2/internalization/__tests__/__fixtures__/split-pipeline-mock-outputs.d.ts.map +0 -1
  1066. package/dist/runtime-v2/internalization/__tests__/__fixtures__/split-pipeline-mock-outputs.js.map +0 -1
  1067. package/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.d.ts +0 -2
  1068. package/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.d.ts.map +0 -1
  1069. package/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.js +0 -158
  1070. package/dist/runtime-v2/internalization/__tests__/a-liveness-reconciliation.test.js.map +0 -1
  1071. package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.d.ts +0 -2
  1072. package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.d.ts.map +0 -1
  1073. package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.js +0 -139
  1074. package/dist/runtime-v2/internalization/__tests__/adversarial-case.test.js.map +0 -1
  1075. package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.d.ts +0 -2
  1076. package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.d.ts.map +0 -1
  1077. package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.js +0 -71
  1078. package/dist/runtime-v2/internalization/__tests__/adversarial-feedback.test.js.map +0 -1
  1079. package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.d.ts +0 -11
  1080. package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.d.ts.map +0 -1
  1081. package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.js +0 -124
  1082. package/dist/runtime-v2/internalization/__tests__/artifact-content-hash.property.test.js.map +0 -1
  1083. package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.d.ts +0 -12
  1084. package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.d.ts.map +0 -1
  1085. package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.js +0 -253
  1086. package/dist/runtime-v2/internalization/__tests__/artifact-summary.property.test.js.map +0 -1
  1087. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.d.ts +0 -2
  1088. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.d.ts.map +0 -1
  1089. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.js +0 -114
  1090. package/dist/runtime-v2/internalization/__tests__/artificer-code-bearing.test.js.map +0 -1
  1091. package/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.d.ts +0 -2
  1092. package/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.d.ts.map +0 -1
  1093. package/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.js +0 -112
  1094. package/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.js.map +0 -1
  1095. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.d.ts +0 -2
  1096. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.d.ts.map +0 -1
  1097. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js +0 -116
  1098. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js.map +0 -1
  1099. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.d.ts +0 -2
  1100. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.d.ts.map +0 -1
  1101. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +0 -455
  1102. package/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +0 -1
  1103. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.d.ts +0 -2
  1104. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.d.ts.map +0 -1
  1105. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +0 -522
  1106. package/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +0 -1
  1107. package/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts +0 -2
  1108. package/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts.map +0 -1
  1109. package/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js +0 -228
  1110. package/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js.map +0 -1
  1111. package/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.d.ts +0 -2
  1112. package/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.d.ts.map +0 -1
  1113. package/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js +0 -450
  1114. package/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js.map +0 -1
  1115. package/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.d.ts +0 -2
  1116. package/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.d.ts.map +0 -1
  1117. package/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.js +0 -311
  1118. package/dist/runtime-v2/internalization/__tests__/crash-liveness-regressions.test.js.map +0 -1
  1119. package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.d.ts +0 -2
  1120. package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.d.ts.map +0 -1
  1121. package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +0 -862
  1122. package/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +0 -1
  1123. package/dist/runtime-v2/internalization/__tests__/diag-distiller-runner.test.d.ts +0 -2
  1124. package/dist/runtime-v2/internalization/__tests__/diag-distiller-runner.test.d.ts.map +0 -1
  1125. package/dist/runtime-v2/internalization/__tests__/diag-distiller-runner.test.js +0 -441
  1126. package/dist/runtime-v2/internalization/__tests__/diag-distiller-runner.test.js.map +0 -1
  1127. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.d.ts +0 -2
  1128. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.d.ts.map +0 -1
  1129. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js +0 -369
  1130. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js.map +0 -1
  1131. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-runner.test.d.ts +0 -2
  1132. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-runner.test.d.ts.map +0 -1
  1133. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-runner.test.js +0 -362
  1134. package/dist/runtime-v2/internalization/__tests__/diag-rootcause-runner.test.js.map +0 -1
  1135. package/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.d.ts +0 -2
  1136. package/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.d.ts.map +0 -1
  1137. package/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.js +0 -333
  1138. package/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.js.map +0 -1
  1139. package/dist/runtime-v2/internalization/__tests__/diag-router-runner.test.d.ts +0 -2
  1140. package/dist/runtime-v2/internalization/__tests__/diag-router-runner.test.d.ts.map +0 -1
  1141. package/dist/runtime-v2/internalization/__tests__/diag-router-runner.test.js +0 -484
  1142. package/dist/runtime-v2/internalization/__tests__/diag-router-runner.test.js.map +0 -1
  1143. package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.d.ts +0 -2
  1144. package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.d.ts.map +0 -1
  1145. package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.js +0 -193
  1146. package/dist/runtime-v2/internalization/__tests__/dreamer-prompt-builder.test.js.map +0 -1
  1147. package/dist/runtime-v2/internalization/__tests__/evaluator-approved-replay-failed-repair.test.d.ts +0 -2
  1148. package/dist/runtime-v2/internalization/__tests__/evaluator-approved-replay-failed-repair.test.d.ts.map +0 -1
  1149. package/dist/runtime-v2/internalization/__tests__/evaluator-approved-replay-failed-repair.test.js +0 -247
  1150. package/dist/runtime-v2/internalization/__tests__/evaluator-approved-replay-failed-repair.test.js.map +0 -1
  1151. package/dist/runtime-v2/internalization/__tests__/evaluator-artificer-repair-replay.test.d.ts +0 -2
  1152. package/dist/runtime-v2/internalization/__tests__/evaluator-artificer-repair-replay.test.d.ts.map +0 -1
  1153. package/dist/runtime-v2/internalization/__tests__/evaluator-artificer-repair-replay.test.js +0 -419
  1154. package/dist/runtime-v2/internalization/__tests__/evaluator-artificer-repair-replay.test.js.map +0 -1
  1155. package/dist/runtime-v2/internalization/__tests__/evaluator-chinese-feedback-contract.test.d.ts +0 -2
  1156. package/dist/runtime-v2/internalization/__tests__/evaluator-chinese-feedback-contract.test.d.ts.map +0 -1
  1157. package/dist/runtime-v2/internalization/__tests__/evaluator-chinese-feedback-contract.test.js +0 -311
  1158. package/dist/runtime-v2/internalization/__tests__/evaluator-chinese-feedback-contract.test.js.map +0 -1
  1159. package/dist/runtime-v2/internalization/__tests__/evaluator-formation-context.test.d.ts +0 -2
  1160. package/dist/runtime-v2/internalization/__tests__/evaluator-formation-context.test.d.ts.map +0 -1
  1161. package/dist/runtime-v2/internalization/__tests__/evaluator-formation-context.test.js +0 -531
  1162. package/dist/runtime-v2/internalization/__tests__/evaluator-formation-context.test.js.map +0 -1
  1163. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.d.ts +0 -2
  1164. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.d.ts.map +0 -1
  1165. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.js +0 -606
  1166. package/dist/runtime-v2/internalization/__tests__/evaluator-gate-authority.test.js.map +0 -1
  1167. package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.d.ts +0 -2
  1168. package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.d.ts.map +0 -1
  1169. package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.js +0 -279
  1170. package/dist/runtime-v2/internalization/__tests__/evaluator-host-alias-replay.test.js.map +0 -1
  1171. package/dist/runtime-v2/internalization/__tests__/evaluator-out-of-scope-governance.test.d.ts +0 -2
  1172. package/dist/runtime-v2/internalization/__tests__/evaluator-out-of-scope-governance.test.d.ts.map +0 -1
  1173. package/dist/runtime-v2/internalization/__tests__/evaluator-out-of-scope-governance.test.js +0 -309
  1174. package/dist/runtime-v2/internalization/__tests__/evaluator-out-of-scope-governance.test.js.map +0 -1
  1175. package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.d.ts +0 -2
  1176. package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.d.ts.map +0 -1
  1177. package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.js +0 -209
  1178. package/dist/runtime-v2/internalization/__tests__/evaluator-output-v2.test.js.map +0 -1
  1179. package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.d.ts +0 -2
  1180. package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.d.ts.map +0 -1
  1181. package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.js +0 -328
  1182. package/dist/runtime-v2/internalization/__tests__/evaluator-pain-reason-echo.test.js.map +0 -1
  1183. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.d.ts +0 -2
  1184. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.d.ts.map +0 -1
  1185. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.js +0 -125
  1186. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder-v2.test.js.map +0 -1
  1187. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.d.ts +0 -2
  1188. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.d.ts.map +0 -1
  1189. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.js +0 -114
  1190. package/dist/runtime-v2/internalization/__tests__/evaluator-prompt-builder.test.js.map +0 -1
  1191. package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.d.ts +0 -2
  1192. package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.d.ts.map +0 -1
  1193. package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.js +0 -433
  1194. package/dist/runtime-v2/internalization/__tests__/evaluator-validator-refeed.test.js.map +0 -1
  1195. package/dist/runtime-v2/internalization/__tests__/evolution-alignment-contract.test.d.ts +0 -18
  1196. package/dist/runtime-v2/internalization/__tests__/evolution-alignment-contract.test.d.ts.map +0 -1
  1197. package/dist/runtime-v2/internalization/__tests__/evolution-alignment-contract.test.js +0 -470
  1198. package/dist/runtime-v2/internalization/__tests__/evolution-alignment-contract.test.js.map +0 -1
  1199. package/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.d.ts +0 -2
  1200. package/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.d.ts.map +0 -1
  1201. package/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.js +0 -195
  1202. package/dist/runtime-v2/internalization/__tests__/external-review-p0-regressions.test.js.map +0 -1
  1203. package/dist/runtime-v2/internalization/__tests__/formation-context.test.d.ts +0 -2
  1204. package/dist/runtime-v2/internalization/__tests__/formation-context.test.d.ts.map +0 -1
  1205. package/dist/runtime-v2/internalization/__tests__/formation-context.test.js +0 -428
  1206. package/dist/runtime-v2/internalization/__tests__/formation-context.test.js.map +0 -1
  1207. package/dist/runtime-v2/internalization/__tests__/intake-bridge-channel-admission.test.d.ts +0 -2
  1208. package/dist/runtime-v2/internalization/__tests__/intake-bridge-channel-admission.test.d.ts.map +0 -1
  1209. package/dist/runtime-v2/internalization/__tests__/intake-bridge-channel-admission.test.js +0 -128
  1210. package/dist/runtime-v2/internalization/__tests__/intake-bridge-channel-admission.test.js.map +0 -1
  1211. package/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.d.ts +0 -2
  1212. package/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.d.ts.map +0 -1
  1213. package/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.js +0 -113
  1214. package/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.js.map +0 -1
  1215. package/dist/runtime-v2/internalization/__tests__/internalization-consumer-decision.test.d.ts +0 -2
  1216. package/dist/runtime-v2/internalization/__tests__/internalization-consumer-decision.test.d.ts.map +0 -1
  1217. package/dist/runtime-v2/internalization/__tests__/internalization-consumer-decision.test.js +0 -251
  1218. package/dist/runtime-v2/internalization/__tests__/internalization-consumer-decision.test.js.map +0 -1
  1219. package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.d.ts +0 -2
  1220. package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.d.ts.map +0 -1
  1221. package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.js +0 -144
  1222. package/dist/runtime-v2/internalization/__tests__/internalization-job-graph.test.js.map +0 -1
  1223. package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.d.ts +0 -2
  1224. package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.d.ts.map +0 -1
  1225. package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.js +0 -306
  1226. package/dist/runtime-v2/internalization/__tests__/internalization-task-guards.test.js.map +0 -1
  1227. package/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.d.ts +0 -2
  1228. package/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.d.ts.map +0 -1
  1229. package/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.js +0 -338
  1230. package/dist/runtime-v2/internalization/__tests__/internalization-transition-decision.test.js.map +0 -1
  1231. package/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.d.ts +0 -2
  1232. package/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.d.ts.map +0 -1
  1233. package/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.js +0 -120
  1234. package/dist/runtime-v2/internalization/__tests__/legacy-rule-contract-scanner.test.js.map +0 -1
  1235. package/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.d.ts +0 -2
  1236. package/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.d.ts.map +0 -1
  1237. package/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.js +0 -581
  1238. package/dist/runtime-v2/internalization/__tests__/mvp-core-loop-journeys.test.js.map +0 -1
  1239. package/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.d.ts +0 -2
  1240. package/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.d.ts.map +0 -1
  1241. package/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.js +0 -56
  1242. package/dist/runtime-v2/internalization/__tests__/owner-decision-architecture.test.js.map +0 -1
  1243. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.d.ts +0 -2
  1244. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.d.ts.map +0 -1
  1245. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.js +0 -518
  1246. package/dist/runtime-v2/internalization/__tests__/owner-decision-review.test.js.map +0 -1
  1247. package/dist/runtime-v2/internalization/__tests__/owner-decision.test.d.ts +0 -2
  1248. package/dist/runtime-v2/internalization/__tests__/owner-decision.test.d.ts.map +0 -1
  1249. package/dist/runtime-v2/internalization/__tests__/owner-decision.test.js +0 -1247
  1250. package/dist/runtime-v2/internalization/__tests__/owner-decision.test.js.map +0 -1
  1251. package/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.d.ts +0 -2
  1252. package/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.d.ts.map +0 -1
  1253. package/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.js +0 -410
  1254. package/dist/runtime-v2/internalization/__tests__/owner-override-resume.test.js.map +0 -1
  1255. package/dist/runtime-v2/internalization/__tests__/peer-prompt-language.test.d.ts +0 -21
  1256. package/dist/runtime-v2/internalization/__tests__/peer-prompt-language.test.d.ts.map +0 -1
  1257. package/dist/runtime-v2/internalization/__tests__/peer-prompt-language.test.js +0 -288
  1258. package/dist/runtime-v2/internalization/__tests__/peer-prompt-language.test.js.map +0 -1
  1259. package/dist/runtime-v2/internalization/__tests__/peer-runner-lineage-injection.test.d.ts +0 -2
  1260. package/dist/runtime-v2/internalization/__tests__/peer-runner-lineage-injection.test.d.ts.map +0 -1
  1261. package/dist/runtime-v2/internalization/__tests__/peer-runner-lineage-injection.test.js +0 -181
  1262. package/dist/runtime-v2/internalization/__tests__/peer-runner-lineage-injection.test.js.map +0 -1
  1263. package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.d.ts +0 -2
  1264. package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.d.ts.map +0 -1
  1265. package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.js +0 -150
  1266. package/dist/runtime-v2/internalization/__tests__/philosopher-prompt-builder.test.js.map +0 -1
  1267. package/dist/runtime-v2/internalization/__tests__/philosopher-runner-trust-boundary.test.d.ts +0 -2
  1268. package/dist/runtime-v2/internalization/__tests__/philosopher-runner-trust-boundary.test.d.ts.map +0 -1
  1269. package/dist/runtime-v2/internalization/__tests__/philosopher-runner-trust-boundary.test.js +0 -431
  1270. package/dist/runtime-v2/internalization/__tests__/philosopher-runner-trust-boundary.test.js.map +0 -1
  1271. package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.d.ts +0 -2
  1272. package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.d.ts.map +0 -1
  1273. package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.js +0 -279
  1274. package/dist/runtime-v2/internalization/__tests__/philosopher-toggle-characterization.test.js.map +0 -1
  1275. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.d.ts +0 -165
  1276. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.d.ts.map +0 -1
  1277. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.js +0 -659
  1278. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.js.map +0 -1
  1279. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.d.ts +0 -22
  1280. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.d.ts.map +0 -1
  1281. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.js +0 -229
  1282. package/dist/runtime-v2/internalization/__tests__/progressive-disclosure-spike-fixtures.test.js.map +0 -1
  1283. package/dist/runtime-v2/internalization/__tests__/prompt-serializer.test.d.ts +0 -2
  1284. package/dist/runtime-v2/internalization/__tests__/prompt-serializer.test.d.ts.map +0 -1
  1285. package/dist/runtime-v2/internalization/__tests__/prompt-serializer.test.js +0 -91
  1286. package/dist/runtime-v2/internalization/__tests__/prompt-serializer.test.js.map +0 -1
  1287. package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.d.ts +0 -2
  1288. package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.d.ts.map +0 -1
  1289. package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.js +0 -86
  1290. package/dist/runtime-v2/internalization/__tests__/queue-actionability.test.js.map +0 -1
  1291. package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.d.ts +0 -2
  1292. package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.d.ts.map +0 -1
  1293. package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.js +0 -431
  1294. package/dist/runtime-v2/internalization/__tests__/refiner-rulehost-gate.test.js.map +0 -1
  1295. package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.d.ts +0 -2
  1296. package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.d.ts.map +0 -1
  1297. package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js +0 -898
  1298. package/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js.map +0 -1
  1299. package/dist/runtime-v2/internalization/__tests__/repair-replay-resolver.test.d.ts +0 -2
  1300. package/dist/runtime-v2/internalization/__tests__/repair-replay-resolver.test.d.ts.map +0 -1
  1301. package/dist/runtime-v2/internalization/__tests__/repair-replay-resolver.test.js +0 -340
  1302. package/dist/runtime-v2/internalization/__tests__/repair-replay-resolver.test.js.map +0 -1
  1303. package/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.d.ts +0 -2
  1304. package/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.d.ts.map +0 -1
  1305. package/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.js +0 -169
  1306. package/dist/runtime-v2/internalization/__tests__/restart-safety.e2e.test.js.map +0 -1
  1307. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-principle-semantic.test.d.ts +0 -2
  1308. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-principle-semantic.test.d.ts.map +0 -1
  1309. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-principle-semantic.test.js +0 -328
  1310. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-principle-semantic.test.js.map +0 -1
  1311. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.d.ts +0 -2
  1312. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.d.ts.map +0 -1
  1313. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.js +0 -75
  1314. package/dist/runtime-v2/internalization/__tests__/rollout-reviewer-prompt-builder.test.js.map +0 -1
  1315. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.d.ts +0 -2
  1316. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.d.ts.map +0 -1
  1317. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.js +0 -187
  1318. package/dist/runtime-v2/internalization/__tests__/rule-activation-contract.test.js.map +0 -1
  1319. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.d.ts +0 -2
  1320. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.d.ts.map +0 -1
  1321. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.js +0 -320
  1322. package/dist/runtime-v2/internalization/__tests__/rule-code-dialect.test.js.map +0 -1
  1323. package/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts +0 -2
  1324. package/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts.map +0 -1
  1325. package/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js +0 -449
  1326. package/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js.map +0 -1
  1327. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.d.ts +0 -2
  1328. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.d.ts.map +0 -1
  1329. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js +0 -203
  1330. package/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js.map +0 -1
  1331. package/dist/runtime-v2/internalization/__tests__/rule-reliability-validation.test.d.ts +0 -12
  1332. package/dist/runtime-v2/internalization/__tests__/rule-reliability-validation.test.d.ts.map +0 -1
  1333. package/dist/runtime-v2/internalization/__tests__/rule-reliability-validation.test.js +0 -256
  1334. package/dist/runtime-v2/internalization/__tests__/rule-reliability-validation.test.js.map +0 -1
  1335. package/dist/runtime-v2/internalization/__tests__/runnerkind-seam.test.d.ts +0 -2
  1336. package/dist/runtime-v2/internalization/__tests__/runnerkind-seam.test.d.ts.map +0 -1
  1337. package/dist/runtime-v2/internalization/__tests__/runnerkind-seam.test.js +0 -224
  1338. package/dist/runtime-v2/internalization/__tests__/runnerkind-seam.test.js.map +0 -1
  1339. package/dist/runtime-v2/internalization/__tests__/scribe-intent-contract-normalization.test.d.ts +0 -2
  1340. package/dist/runtime-v2/internalization/__tests__/scribe-intent-contract-normalization.test.d.ts.map +0 -1
  1341. package/dist/runtime-v2/internalization/__tests__/scribe-intent-contract-normalization.test.js +0 -78
  1342. package/dist/runtime-v2/internalization/__tests__/scribe-intent-contract-normalization.test.js.map +0 -1
  1343. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.d.ts +0 -2
  1344. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.d.ts.map +0 -1
  1345. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.js +0 -180
  1346. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-builder.test.js.map +0 -1
  1347. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.d.ts +0 -12
  1348. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.d.ts.map +0 -1
  1349. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.js +0 -85
  1350. package/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.js.map +0 -1
  1351. package/dist/runtime-v2/internalization/__tests__/split-diagnostician-runner-retry.test.d.ts +0 -2
  1352. package/dist/runtime-v2/internalization/__tests__/split-diagnostician-runner-retry.test.d.ts.map +0 -1
  1353. package/dist/runtime-v2/internalization/__tests__/split-diagnostician-runner-retry.test.js +0 -752
  1354. package/dist/runtime-v2/internalization/__tests__/split-diagnostician-runner-retry.test.js.map +0 -1
  1355. package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.d.ts +0 -12
  1356. package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.d.ts.map +0 -1
  1357. package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.js +0 -176
  1358. package/dist/runtime-v2/internalization/__tests__/summary-freshness.property.test.js.map +0 -1
  1359. package/dist/runtime-v2/internalization/__tests__/tool-semantic-registry.test.d.ts +0 -11
  1360. package/dist/runtime-v2/internalization/__tests__/tool-semantic-registry.test.d.ts.map +0 -1
  1361. package/dist/runtime-v2/internalization/__tests__/tool-semantic-registry.test.js +0 -176
  1362. package/dist/runtime-v2/internalization/__tests__/tool-semantic-registry.test.js.map +0 -1
  1363. package/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.d.ts +0 -2
  1364. package/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.d.ts.map +0 -1
  1365. package/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.js +0 -602
  1366. package/dist/runtime-v2/internalization/__tests__/verdict-drift-regressions.test.js.map +0 -1
  1367. package/dist/runtime-v2/internalization/deprecated-readiness.test.d.ts +0 -2
  1368. package/dist/runtime-v2/internalization/deprecated-readiness.test.d.ts.map +0 -1
  1369. package/dist/runtime-v2/internalization/deprecated-readiness.test.js +0 -127
  1370. package/dist/runtime-v2/internalization/deprecated-readiness.test.js.map +0 -1
  1371. package/dist/runtime-v2/internalization/lifecycle-metrics.test.d.ts +0 -2
  1372. package/dist/runtime-v2/internalization/lifecycle-metrics.test.d.ts.map +0 -1
  1373. package/dist/runtime-v2/internalization/lifecycle-metrics.test.js +0 -201
  1374. package/dist/runtime-v2/internalization/lifecycle-metrics.test.js.map +0 -1
  1375. package/dist/runtime-v2/internalization/lifecycle-read-model.test.d.ts +0 -2
  1376. package/dist/runtime-v2/internalization/lifecycle-read-model.test.d.ts.map +0 -1
  1377. package/dist/runtime-v2/internalization/lifecycle-read-model.test.js +0 -408
  1378. package/dist/runtime-v2/internalization/lifecycle-read-model.test.js.map +0 -1
  1379. package/dist/runtime-v2/internalization/routing-policy.test.d.ts +0 -2
  1380. package/dist/runtime-v2/internalization/routing-policy.test.d.ts.map +0 -1
  1381. package/dist/runtime-v2/internalization/routing-policy.test.js +0 -286
  1382. package/dist/runtime-v2/internalization/routing-policy.test.js.map +0 -1
  1383. package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.d.ts +0 -2
  1384. package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.d.ts.map +0 -1
  1385. package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.js +0 -59
  1386. package/dist/runtime-v2/observer/__tests__/agent-scheduler.test.js.map +0 -1
  1387. package/dist/runtime-v2/observer/__tests__/correction-observer.test.d.ts +0 -2
  1388. package/dist/runtime-v2/observer/__tests__/correction-observer.test.d.ts.map +0 -1
  1389. package/dist/runtime-v2/observer/__tests__/correction-observer.test.js +0 -145
  1390. package/dist/runtime-v2/observer/__tests__/correction-observer.test.js.map +0 -1
  1391. package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.d.ts +0 -2
  1392. package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.d.ts.map +0 -1
  1393. package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js +0 -615
  1394. package/dist/runtime-v2/owner-decision/__tests__/owner-decision-view.test.js.map +0 -1
  1395. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts +0 -15
  1396. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts.map +0 -1
  1397. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js +0 -179
  1398. package/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js.map +0 -1
  1399. package/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts +0 -2
  1400. package/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts.map +0 -1
  1401. package/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js +0 -95
  1402. package/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js.map +0 -1
  1403. package/dist/runtime-v2/runner/__tests__/base-peer-runner-agent-draft.test.d.ts +0 -2
  1404. package/dist/runtime-v2/runner/__tests__/base-peer-runner-agent-draft.test.d.ts.map +0 -1
  1405. package/dist/runtime-v2/runner/__tests__/base-peer-runner-agent-draft.test.js +0 -493
  1406. package/dist/runtime-v2/runner/__tests__/base-peer-runner-agent-draft.test.js.map +0 -1
  1407. package/dist/runtime-v2/runner/__tests__/base-peer-runner-failure-details.test.d.ts +0 -2
  1408. package/dist/runtime-v2/runner/__tests__/base-peer-runner-failure-details.test.d.ts.map +0 -1
  1409. package/dist/runtime-v2/runner/__tests__/base-peer-runner-failure-details.test.js +0 -199
  1410. package/dist/runtime-v2/runner/__tests__/base-peer-runner-failure-details.test.js.map +0 -1
  1411. package/dist/runtime-v2/runner/__tests__/base-peer-runner-rate-limit-degradation.test.d.ts +0 -2
  1412. package/dist/runtime-v2/runner/__tests__/base-peer-runner-rate-limit-degradation.test.d.ts.map +0 -1
  1413. package/dist/runtime-v2/runner/__tests__/base-peer-runner-rate-limit-degradation.test.js +0 -319
  1414. package/dist/runtime-v2/runner/__tests__/base-peer-runner-rate-limit-degradation.test.js.map +0 -1
  1415. package/dist/runtime-v2/runner/__tests__/base-peer-runner-trust-boundary.test.d.ts +0 -2
  1416. package/dist/runtime-v2/runner/__tests__/base-peer-runner-trust-boundary.test.d.ts.map +0 -1
  1417. package/dist/runtime-v2/runner/__tests__/base-peer-runner-trust-boundary.test.js +0 -388
  1418. package/dist/runtime-v2/runner/__tests__/base-peer-runner-trust-boundary.test.js.map +0 -1
  1419. package/dist/runtime-v2/runner/__tests__/default-validator.test.d.ts +0 -2
  1420. package/dist/runtime-v2/runner/__tests__/default-validator.test.d.ts.map +0 -1
  1421. package/dist/runtime-v2/runner/__tests__/default-validator.test.js +0 -589
  1422. package/dist/runtime-v2/runner/__tests__/default-validator.test.js.map +0 -1
  1423. package/dist/runtime-v2/runner/__tests__/diagnose.test.d.ts +0 -2
  1424. package/dist/runtime-v2/runner/__tests__/diagnose.test.d.ts.map +0 -1
  1425. package/dist/runtime-v2/runner/__tests__/diagnose.test.js +0 -171
  1426. package/dist/runtime-v2/runner/__tests__/diagnose.test.js.map +0 -1
  1427. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.d.ts +0 -2
  1428. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.d.ts.map +0 -1
  1429. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js +0 -477
  1430. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge-admission.test.js.map +0 -1
  1431. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.d.ts +0 -2
  1432. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.d.ts.map +0 -1
  1433. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.js +0 -160
  1434. package/dist/runtime-v2/runner/__tests__/pain-signal-bridge.test.js.map +0 -1
  1435. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.d.ts +0 -2
  1436. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.d.ts.map +0 -1
  1437. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.js +0 -39
  1438. package/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.js.map +0 -1
  1439. package/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.d.ts +0 -2
  1440. package/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.d.ts.map +0 -1
  1441. package/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.js +0 -130
  1442. package/dist/runtime-v2/signal-collector/__tests__/llm-payload-contract.test.js.map +0 -1
  1443. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.d.ts +0 -2
  1444. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.d.ts.map +0 -1
  1445. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.js +0 -34
  1446. package/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.js.map +0 -1
  1447. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.d.ts +0 -2
  1448. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.d.ts.map +0 -1
  1449. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.js +0 -222
  1450. package/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.js.map +0 -1
  1451. package/dist/runtime-v2/signal-collector/__tests__/types.test.d.ts +0 -2
  1452. package/dist/runtime-v2/signal-collector/__tests__/types.test.d.ts.map +0 -1
  1453. package/dist/runtime-v2/signal-collector/__tests__/types.test.js +0 -35
  1454. package/dist/runtime-v2/signal-collector/__tests__/types.test.js.map +0 -1
  1455. package/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.d.ts +0 -2
  1456. package/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.d.ts.map +0 -1
  1457. package/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.js +0 -55
  1458. package/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.js.map +0 -1
  1459. package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.d.ts +0 -2
  1460. package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.d.ts.map +0 -1
  1461. package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.js +0 -34
  1462. package/dist/runtime-v2/store/candidate/__tests__/recommendation-kind-resolver.test.js.map +0 -1
  1463. package/dist/runtime-v2/store/concurrent-lease.test.d.ts +0 -2
  1464. package/dist/runtime-v2/store/concurrent-lease.test.d.ts.map +0 -1
  1465. package/dist/runtime-v2/store/concurrent-lease.test.js +0 -129
  1466. package/dist/runtime-v2/store/concurrent-lease.test.js.map +0 -1
  1467. package/dist/runtime-v2/store/context/resilient-context-assembler.test.d.ts +0 -2
  1468. package/dist/runtime-v2/store/context/resilient-context-assembler.test.d.ts.map +0 -1
  1469. package/dist/runtime-v2/store/context/resilient-context-assembler.test.js +0 -113
  1470. package/dist/runtime-v2/store/context/resilient-context-assembler.test.js.map +0 -1
  1471. package/dist/runtime-v2/store/context/sqlite-context-assembler.test.d.ts +0 -2
  1472. package/dist/runtime-v2/store/context/sqlite-context-assembler.test.d.ts.map +0 -1
  1473. package/dist/runtime-v2/store/context/sqlite-context-assembler.test.js +0 -1681
  1474. package/dist/runtime-v2/store/context/sqlite-context-assembler.test.js.map +0 -1
  1475. package/dist/runtime-v2/store/diagnostician-committer.test.d.ts +0 -2
  1476. package/dist/runtime-v2/store/diagnostician-committer.test.d.ts.map +0 -1
  1477. package/dist/runtime-v2/store/diagnostician-committer.test.js +0 -360
  1478. package/dist/runtime-v2/store/diagnostician-committer.test.js.map +0 -1
  1479. package/dist/runtime-v2/store/history/resilient-history-query.test.d.ts +0 -2
  1480. package/dist/runtime-v2/store/history/resilient-history-query.test.d.ts.map +0 -1
  1481. package/dist/runtime-v2/store/history/resilient-history-query.test.js +0 -128
  1482. package/dist/runtime-v2/store/history/resilient-history-query.test.js.map +0 -1
  1483. package/dist/runtime-v2/store/history/sqlite-history-query.test.d.ts +0 -2
  1484. package/dist/runtime-v2/store/history/sqlite-history-query.test.d.ts.map +0 -1
  1485. package/dist/runtime-v2/store/history/sqlite-history-query.test.js +0 -536
  1486. package/dist/runtime-v2/store/history/sqlite-history-query.test.js.map +0 -1
  1487. package/dist/runtime-v2/store/idempotent-transitions.test.d.ts +0 -2
  1488. package/dist/runtime-v2/store/idempotent-transitions.test.d.ts.map +0 -1
  1489. package/dist/runtime-v2/store/idempotent-transitions.test.js +0 -163
  1490. package/dist/runtime-v2/store/idempotent-transitions.test.js.map +0 -1
  1491. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.d.ts +0 -2
  1492. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.d.ts.map +0 -1
  1493. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.js +0 -272
  1494. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.js.map +0 -1
  1495. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts +0 -2
  1496. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts.map +0 -1
  1497. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js +0 -83
  1498. package/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js.map +0 -1
  1499. package/dist/runtime-v2/store/lifecycle/lease-manager.test.d.ts +0 -2
  1500. package/dist/runtime-v2/store/lifecycle/lease-manager.test.d.ts.map +0 -1
  1501. package/dist/runtime-v2/store/lifecycle/lease-manager.test.js +0 -241
  1502. package/dist/runtime-v2/store/lifecycle/lease-manager.test.js.map +0 -1
  1503. package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.d.ts +0 -2
  1504. package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.d.ts.map +0 -1
  1505. package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.js +0 -316
  1506. package/dist/runtime-v2/store/lifecycle/recovery-sweep.test.js.map +0 -1
  1507. package/dist/runtime-v2/store/lifecycle/retry-policy.test.d.ts +0 -2
  1508. package/dist/runtime-v2/store/lifecycle/retry-policy.test.d.ts.map +0 -1
  1509. package/dist/runtime-v2/store/lifecycle/retry-policy.test.js +0 -86
  1510. package/dist/runtime-v2/store/lifecycle/retry-policy.test.js.map +0 -1
  1511. package/dist/runtime-v2/store/pain/__tests__/sqlite-dead-letter-store.test.d.ts +0 -2
  1512. package/dist/runtime-v2/store/pain/__tests__/sqlite-dead-letter-store.test.d.ts.map +0 -1
  1513. package/dist/runtime-v2/store/pain/__tests__/sqlite-dead-letter-store.test.js +0 -225
  1514. package/dist/runtime-v2/store/pain/__tests__/sqlite-dead-letter-store.test.js.map +0 -1
  1515. package/dist/runtime-v2/store/runtime-state-manager-malformed-run-tolerance.test.d.ts +0 -2
  1516. package/dist/runtime-v2/store/runtime-state-manager-malformed-run-tolerance.test.d.ts.map +0 -1
  1517. package/dist/runtime-v2/store/runtime-state-manager-malformed-run-tolerance.test.js +0 -160
  1518. package/dist/runtime-v2/store/runtime-state-manager-malformed-run-tolerance.test.js.map +0 -1
  1519. package/dist/runtime-v2/store/runtime-state-manager.integration.test.d.ts +0 -2
  1520. package/dist/runtime-v2/store/runtime-state-manager.integration.test.d.ts.map +0 -1
  1521. package/dist/runtime-v2/store/runtime-state-manager.integration.test.js +0 -220
  1522. package/dist/runtime-v2/store/runtime-state-manager.integration.test.js.map +0 -1
  1523. package/dist/runtime-v2/store/schema-conformance.test.d.ts +0 -2
  1524. package/dist/runtime-v2/store/schema-conformance.test.d.ts.map +0 -1
  1525. package/dist/runtime-v2/store/schema-conformance.test.js +0 -670
  1526. package/dist/runtime-v2/store/schema-conformance.test.js.map +0 -1
  1527. package/dist/runtime-v2/store/sqlite-connection-close.test.d.ts +0 -2
  1528. package/dist/runtime-v2/store/sqlite-connection-close.test.d.ts.map +0 -1
  1529. package/dist/runtime-v2/store/sqlite-connection-close.test.js +0 -57
  1530. package/dist/runtime-v2/store/sqlite-connection-close.test.js.map +0 -1
  1531. package/dist/runtime-v2/store/sqlite-connection-pragma.test.d.ts +0 -2
  1532. package/dist/runtime-v2/store/sqlite-connection-pragma.test.d.ts.map +0 -1
  1533. package/dist/runtime-v2/store/sqlite-connection-pragma.test.js +0 -272
  1534. package/dist/runtime-v2/store/sqlite-connection-pragma.test.js.map +0 -1
  1535. package/dist/runtime-v2/store/sqlite-connection-schema-version.test.d.ts +0 -2
  1536. package/dist/runtime-v2/store/sqlite-connection-schema-version.test.d.ts.map +0 -1
  1537. package/dist/runtime-v2/store/sqlite-connection-schema-version.test.js +0 -106
  1538. package/dist/runtime-v2/store/sqlite-connection-schema-version.test.js.map +0 -1
  1539. package/dist/runtime-v2/store/sqlite-run-store.test.d.ts +0 -2
  1540. package/dist/runtime-v2/store/sqlite-run-store.test.d.ts.map +0 -1
  1541. package/dist/runtime-v2/store/sqlite-run-store.test.js +0 -322
  1542. package/dist/runtime-v2/store/sqlite-run-store.test.js.map +0 -1
  1543. package/dist/runtime-v2/store/sqlite-task-store.test.d.ts +0 -2
  1544. package/dist/runtime-v2/store/sqlite-task-store.test.d.ts.map +0 -1
  1545. package/dist/runtime-v2/store/sqlite-task-store.test.js +0 -164
  1546. package/dist/runtime-v2/store/sqlite-task-store.test.js.map +0 -1
  1547. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.d.ts +0 -2
  1548. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.d.ts.map +0 -1
  1549. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.js +0 -114
  1550. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store-cas.test.js.map +0 -1
  1551. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.d.ts +0 -2
  1552. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.d.ts.map +0 -1
  1553. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js +0 -485
  1554. package/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js.map +0 -1
  1555. package/dist/runtime-v2/store/trajectory/source-trace-locator.test.d.ts +0 -2
  1556. package/dist/runtime-v2/store/trajectory/source-trace-locator.test.d.ts.map +0 -1
  1557. package/dist/runtime-v2/store/trajectory/source-trace-locator.test.js +0 -319
  1558. package/dist/runtime-v2/store/trajectory/source-trace-locator.test.js.map +0 -1
  1559. package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.d.ts +0 -2
  1560. package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.d.ts.map +0 -1
  1561. package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.js +0 -328
  1562. package/dist/runtime-v2/store/trajectory/sqlite-trajectory-locator.test.js.map +0 -1
  1563. package/dist/runtime-v2/store/workspace-isolation.test.d.ts +0 -2
  1564. package/dist/runtime-v2/store/workspace-isolation.test.d.ts.map +0 -1
  1565. package/dist/runtime-v2/store/workspace-isolation.test.js +0 -138
  1566. package/dist/runtime-v2/store/workspace-isolation.test.js.map +0 -1
  1567. package/dist/runtime-v2/tools/__tests__/agent-tool-contract.test.d.ts +0 -2
  1568. package/dist/runtime-v2/tools/__tests__/agent-tool-contract.test.d.ts.map +0 -1
  1569. package/dist/runtime-v2/tools/__tests__/agent-tool-contract.test.js +0 -171
  1570. package/dist/runtime-v2/tools/__tests__/agent-tool-contract.test.js.map +0 -1
  1571. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.d.ts +0 -2
  1572. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.d.ts.map +0 -1
  1573. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +0 -369
  1574. package/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +0 -1
  1575. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.d.ts +0 -2
  1576. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.d.ts.map +0 -1
  1577. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.js +0 -163
  1578. package/dist/runtime-v2/tools/__tests__/artificer-output-typebox.test.js.map +0 -1
  1579. package/dist/runtime-v2/tools/__tests__/dreamer-output-typebox.test.d.ts +0 -2
  1580. package/dist/runtime-v2/tools/__tests__/dreamer-output-typebox.test.d.ts.map +0 -1
  1581. package/dist/runtime-v2/tools/__tests__/dreamer-output-typebox.test.js +0 -109
  1582. package/dist/runtime-v2/tools/__tests__/dreamer-output-typebox.test.js.map +0 -1
  1583. package/dist/runtime-v2/utils/cli-process-runner.test.d.ts +0 -2
  1584. package/dist/runtime-v2/utils/cli-process-runner.test.d.ts.map +0 -1
  1585. package/dist/runtime-v2/utils/cli-process-runner.test.js +0 -113
  1586. package/dist/runtime-v2/utils/cli-process-runner.test.js.map +0 -1
  1587. package/dist/trajectory-store.test.d.ts +0 -2
  1588. package/dist/trajectory-store.test.d.ts.map +0 -1
  1589. package/dist/trajectory-store.test.js +0 -261
  1590. package/dist/trajectory-store.test.js.map +0 -1
@@ -1,3845 +0,0 @@
1
- /**
2
- * Architecture regression guard — verifies critical PRI-12/13/14/15/16/28
3
- * module boundaries are present and exportable.
4
- *
5
- * Add entries here whenever a new service/read-model boundary is established.
6
- */
7
- import { describe, it, expect, beforeAll } from 'vitest';
8
- import * as fsSync from 'fs';
9
- import * as pathSync from 'path';
10
- // ── Source-file existence ──────────────────────────────────────────────────
11
- const REQUIRED_SOURCE_FILES = [
12
- 'pain-to-principle-service.ts',
13
- 'pain-chain-read-model.ts',
14
- 'pain-signal-bridge.ts',
15
- 'pain-signal-runtime-factory.ts',
16
- 'pain-signal-observability.ts',
17
- 'pruning-read-model.ts',
18
- 'pruning-review-log.ts',
19
- // PRI-28
20
- 'operator-health-read-model.ts',
21
- 'candidate-audit.ts',
22
- // PRI-42
23
- 'internalization/rule-host-contracts.ts',
24
- 'internalization/rule-host-helpers.ts',
25
- 'internalization/index.ts',
26
- // PRI-480 (RuleContext v2 — Phase 1 Core ABI)
27
- 'internalization/rule-context-v2.ts',
28
- // PRI-43
29
- 'internalization/internalization-route.ts',
30
- // PRI-44
31
- 'internalization/template-generator.ts',
32
- 'internalization/rule-code-validator.ts',
33
- 'internalization/compile-result.ts',
34
- // PRI-45
35
- 'internalization/rule-host-evaluator.ts',
36
- 'internalization/rule-host-adapter.ts',
37
- // PRI-51
38
- 'types/principle-enums.ts',
39
- 'types/principle-schema.ts',
40
- 'types/artifact-lineage.ts',
41
- 'types/replay-types.ts',
42
- 'types/index.ts',
43
- 'internalization/lifecycle-types.ts',
44
- // PRI-52
45
- 'internalization/lifecycle-metrics.ts',
46
- // PRI-53
47
- 'internalization/deprecated-readiness.ts',
48
- // PRI-54
49
- 'internalization/routing-policy.ts',
50
- // PRI-56
51
- 'internalization/lifecycle-datasource.ts',
52
- 'internalization/lifecycle-read-model.ts',
53
- // PRI-61
54
- 'internalization/peer-runner-contracts.ts',
55
- 'internalization/internalization-job-graph.ts',
56
- // PRI-62
57
- 'internalization/internalization-task-guards.ts',
58
- 'internalization/internalization-state-machine.ts',
59
- // PRI-65
60
- 'internalization/pitask-metadata.ts',
61
- // PRI-67
62
- 'internalization/dreamer-output.ts',
63
- 'internalization/dreamer-runner.ts',
64
- // PRI-109
65
- 'internalization/scribe-output.ts',
66
- 'internalization/scribe-runner.ts',
67
- // PRI-111
68
- 'internalization/artificer-output.ts',
69
- 'internalization/artificer-runner.ts',
70
- // PRI-EVAL
71
- 'internalization/evaluator-output.ts',
72
- 'internalization/evaluator-runner.ts',
73
- 'internalization/evaluator-prompt-builder.ts',
74
- // PRI-RR
75
- 'internalization/rollout-reviewer-output.ts',
76
- 'internalization/rollout-reviewer-runner.ts',
77
- 'internalization/rollout-reviewer-prompt-builder.ts',
78
- // PRI-74 (follow-up to PRI-75 Phase 3)
79
- '../prompt-builder/routing-guidance.ts',
80
- // PRI-81 Phase A
81
- '../prompt-builder/empathy-keyword-matching.ts',
82
- '../prompt-builder/empathy-types.ts',
83
- // PRI-81 Phase B
84
- '../prompt-builder/focus-compression.ts',
85
- // PRI-76
86
- 'gfi/gfi-types.ts',
87
- 'gfi/gfi-policy.ts',
88
- 'gfi/gfi-kernel.ts',
89
- 'gfi/index.ts',
90
- // PRI-84
91
- 'internalization/pi-artifact.ts',
92
- 'internalization/pi-artifact-store.ts',
93
- // PRI-115
94
- 'golden-trace-replay-validator.ts',
95
- // PRI-172
96
- 'internalization/refiner-sandbox-wrapper.ts',
97
- // PRI-173
98
- 'internalization/refiner-rulehost-gate.ts',
99
- // RuleHost MVP Activation (PRI-421..428, ADR-0014 Amendment 2026-06-17)
100
- 'internalization/adversarial-case.ts',
101
- 'internalization/adversarial-feedback.ts',
102
- // PRI-485 Phase 6: v2 adversarial case generator (pure logic)
103
- 'internalization/v2-adversarial-cases.ts',
104
- 'internalization/artificer-prompt-builder.ts',
105
- 'adversarial-loop.ts',
106
- // Phase 2 migration: evolution types (PRI-770 narrowed: dead Points/Tier
107
- // surface and the evolution/index.ts barrel removed; live loop types stay)
108
- 'evolution/evolution-types.ts',
109
- // Phase 2 migration: correction types
110
- 'correction/correction-types.ts',
111
- 'correction/index.ts',
112
- // Phase 2 migration: types directory (PRI-770: dead queue-types.ts removed)
113
- 'types/hygiene-types.ts',
114
- 'types/event-types.ts',
115
- 'types/event-payload.ts',
116
- 'types/pain-signal.ts',
117
- 'types/pd-task-types.ts',
118
- // Phase 2 migration: principle-tree data structures
119
- 'types/principle-dependency.ts',
120
- 'types/principle-value-metrics.ts',
121
- 'types/principle-lifecycle-event.ts',
122
- 'types/principle-tree-store.ts',
123
- // PRI-140
124
- 'store/sqlite-connection.ts',
125
- // PRI-139
126
- 'l1-hard-cap.ts',
127
- // PRI-142
128
- 'internalization/intake-to-internalization-bridge.ts',
129
- // PRI-144
130
- 'activation/activation-types.ts',
131
- 'activation/activation-dispatcher.ts',
132
- 'activation/low-risk-writers.ts',
133
- 'activation/index.ts',
134
- // PRI-145
135
- 'activation/approval-queue.ts',
136
- 'activation/memory-approval-store.ts',
137
- 'activation/sqlite-approval-store.ts',
138
- // PRI-189
139
- 'store/trajectory/source-trace-locator.ts',
140
- 'store/trajectory/sqlite-source-trace-locator.ts',
141
- // PRI-190
142
- 'full-trace-contract.ts',
143
- // PRI-191/192/193 modules removed (PRI-770): trace-refiner(.agent) and
144
- // golden-trace-candidate-builder had zero production consumers; the replay
145
- // validator above stays (principle-compiler consumes it).
146
- // PRI-149 Tier 2
147
- 'recovery-sweep-service.ts',
148
- // PRI-146
149
- 'activation/writers/rule-host-writer.ts',
150
- 'activation/writers/index.ts',
151
- // PRI-295
152
- 'activation/prompt-activation-reader-contract.ts',
153
- // PRI-215
154
- 'synthetic-baseline.ts',
155
- // PRI-239
156
- 'feature-flags/feature-flag-contract.ts',
157
- 'feature-flags/index.ts',
158
- // PRI-367
159
- 'core-principles/core-principle-registry.ts',
160
- 'core-principles/index.ts',
161
- // PRI-285: MVP seed feedback channel — privacy-preserving report contract.
162
- // Pure logic only; no I/O. Server I/O lives in pd-console under
163
- // <workspace>/.pd/feedback/drafts/. No automatic upload.
164
- 'feedback/feedback-types.ts',
165
- 'feedback/internal-guards.ts',
166
- 'feedback/redact-sensitive.ts',
167
- 'feedback/render-markdown.ts',
168
- 'feedback/render-github-url.ts',
169
- 'feedback/privacy-preview.ts',
170
- 'feedback/safe-stringify.ts',
171
- 'feedback/create-report.ts',
172
- // Slice 1 (PRI-543): deterministic fingerprint for feedback dedup/clustering.
173
- 'feedback/fingerprint.ts',
174
- 'feedback/index.ts',
175
- // Anonymous Product Telemetry v1 (PRI-595~603, ADR-0021): pure contract —
176
- // daily unlinkable identity derivation + strict snapshot schema/validator
177
- // + privacy guard. No I/O; readers/exporter live in @principles/host-runtime.
178
- 'product-telemetry/daily-identity.ts',
179
- 'product-telemetry/snapshot-contract.ts',
180
- // PRI-372 (T-G)
181
- 'diagnostician/diag-rootcause-output.ts',
182
- 'diagnostician/diag-distiller-output.ts',
183
- 'diagnostician/rootcause-prompt-builder.ts',
184
- 'diagnostician/distiller-prompt-builder.ts',
185
- 'diagnostician/router-prompt-builder.ts',
186
- 'internalization/diag-rootcause-runner.ts',
187
- 'internalization/diag-distiller-runner.ts',
188
- 'internalization/diag-router-runner.ts',
189
- // PRI-419: L2 agent loop adapter (core, pure orchestration of pi-agent-core; no node:* imports)
190
- 'adapter/l2-agent-loop-adapter.ts',
191
- // PRI-419: L2 agent loop tool contract + typebox output redeclaration (pure logic, no I/O)
192
- 'tools/agent-tool-contract.ts',
193
- 'tools/dreamer-output-typebox.ts',
194
- // PRI-439: Artificer L2 agent loop tool contract + typebox output redeclaration (pure logic, no I/O)
195
- 'tools/artificer-l2-tool-contract.ts',
196
- 'tools/artificer-output-typebox.ts',
197
- // PRI-408: Production gate deps factory — canonical vm-based rule compilation
198
- 'activation/production-gate-deps.ts',
199
- // PRI-408: Formal approval-completion production service
200
- 'activation/approval-completion-service.ts',
201
- // PRI-431: L2 principle reader (pure logic, extracted from pd-cli + plugin duplicates)
202
- 'build-l2-principle-reader.ts',
203
- // PRI-446: pure logic migrated from openclaw-plugin into core
204
- 'evidence-triage/observation-resolver.ts',
205
- 'pain-gate/pain-diagnostic-gate-policy.ts',
206
- 'pain-gate/index.ts',
207
- 'detection/detection-funnel-policy.ts',
208
- 'detection/index.ts',
209
- // PRI-470: IntentDecisionRecord durable store + types (SPEC §21.7)
210
- 'intent/intent-decision-record.ts',
211
- 'store/intent/sqlite-intent-decision-store.ts',
212
- 'store/intent/index.ts',
213
- ];
214
- // ── PRI-212: Plugin core anti-growth guard ────────────────────────────────────
215
- //
216
- // Baseline: PRI-211 inventory (docs/archive/reviews/plugin-core-inventory-2026-05.md)
217
- // Prevents silent growth of packages/openclaw-plugin/src/core/ by requiring
218
- // explicit classification for every new file.
219
- //
220
- // New pure domain logic → @principles/core
221
- // New I/O adapters → must be classified as plugin-specific
222
- // ERR-011 reference: never bypass architecture boundary facades
223
- // ERR-012 reference: stale-main PR rollback must not delete baseline entries
224
- //
225
- // To add a new plugin I/O adapter legitimately, add its relative path
226
- // (from packages/openclaw-plugin/src/core/) to the KNOWN_PLUGIN_CORE_FILES
227
- // set below with a comment explaining why it is plugin-specific.
228
- const KNOWN_PLUGIN_CORE_FILES = new Set([
229
- // ── Pure Domain Logic Candidates — exist today but new pure logic belongs in @principles/core ──
230
- 'trajectory-types.ts',
231
- 'profile.ts',
232
- 'pain-signal.ts',
233
- 'pd-task-types.ts',
234
- 'evolution-types.ts',
235
- 'telemetry-event.ts',
236
- 'empathy-types.ts',
237
- 'correction-types.ts',
238
- 'principle-injection.ts',
239
- 'principle-compiler/template-generator.ts',
240
- // ── Thin Adapter Candidates — plugin I/O boundary wrappers ──────────────
241
- 'principle-tree-migration.ts',
242
- 'principle-internalization/principle-lifecycle-service.ts',
243
- 'principle-tree-ledger-adapter.ts',
244
- 'principle-compiler/ledger-registrar.ts',
245
- 'principle-compiler/code-validator.ts',
246
- 'principle-injector.ts',
247
- 'pd-task-service.ts',
248
- 'principle-internalization/lifecycle-read-model.ts',
249
- 'principle-internalization/filesystem-lifecycle-datasource.ts',
250
- 'config-service.ts',
251
- 'config-health.ts', // PRI-346: Pure conversation access config check — plugin-specific due to OpenClaw config shape dependency
252
- 'principle-compiler/index.ts',
253
- 'principle-internalization/lifecycle-refresh.ts',
254
- // ── Do Not Move — intrinsically plugin-specific ─────────────────────────
255
- 'event-log.ts',
256
- 'schema/schema-definitions.ts',
257
- 'path-resolver.ts',
258
- 'init.ts',
259
- 'workspace-context.ts',
260
- 'reflection/reflection-context.ts',
261
- 'bootstrap-rules.ts',
262
- 'schema/migration-runner.ts',
263
- 'rule-host.ts',
264
- 'principle-training-state.ts',
265
- // PRI-446: now a thin adapter delegating pure decision logic to
266
- // runtime-v2/pain-gate/pain-diagnostic-gate-policy.ts. Kept here because it
267
- // owns the cooldown Map + SystemLogger + Date.now side effects.
268
- 'pain-diagnostic-gate.ts',
269
- 'hygiene/tracker.ts',
270
- 'schema/migrations/002-init-central.ts',
271
- 'workspace-dir-service.ts',
272
- 'paths.ts',
273
- 'schema/migrations/004-add-thinking-and-gfi.ts',
274
- 'evolution-hook.ts',
275
- 'storage-adapter.ts',
276
- 'schema/migrations/003-init-workflow.ts',
277
- 'workspace-dir-validation.ts',
278
- 'pain-signal-adapter.ts',
279
- 'rule-implementation-runtime.ts',
280
- 'detection-service.ts',
281
- 'schema/migrations/index.ts',
282
- 'dictionary-service.ts',
283
- 'schema/index.ts',
284
- 'schema/db-types.ts',
285
- 'rule-host-types.ts',
286
- 'rule-host-helpers.ts',
287
- 'schema/migrations/001-init-trajectory.ts',
288
- // ── I/O Boundary ────────────────────────────────────────────────────────
289
- 'trajectory.ts',
290
- // PRI-482: Plugin I/O boundary — converts raw TrajectoryDatabase rows into
291
- // validated RuleHistoryWindow. Pure logic (canonicalize, validate, facts)
292
- // delegated to @principles/core. Assembler stays in plugin because it
293
- // consumes DB row shapes (I/O data).
294
- 'rule-context-assembler.ts',
295
- // PRI-484: Plugin I/O boundary — assembles a BehaviorExamplePack for the
296
- // Artificer by reading pain lineage + trajectory from TrajectoryDatabase.
297
- // Pure logic (type + validator) lives in @principles/core; this module
298
- // owns the DB row → pack mapping and fail-loud validation.
299
- 'behavior-example-pack-assembler.ts',
300
- 'evolution-reducer.ts',
301
- 'focus-history.ts',
302
- 'training-program.ts',
303
- 'replay-engine.ts',
304
- 'merge-gate-audit.ts',
305
- 'pd-task-reconciler.ts',
306
- 'correction-cue-learner.ts',
307
- // MVP core-loop closure (P0-B/P0-D/E/F): live correction-cue store projection
308
- // (learn->detect feedback) and auto-consumer governance wiring (dispatcher +
309
- // repair deps). Both are plugin I/O boundary modules; core logic lives in
310
- // @principles/core.
311
- 'signal-keyword-store.ts',
312
- 'auto-consumer-governance-wiring.ts',
313
- 'principle-compiler/compiler.ts',
314
- 'pain.ts',
315
- 'pain-context-extractor.ts',
316
- 'config.ts',
317
- 'code-implementation-storage.ts',
318
- 'observability.ts',
319
- 'file-storage-adapter.ts',
320
- 'workflow-funnel-loader.ts',
321
- 'dictionary.ts',
322
- 'thinking-os-parser.ts',
323
- 'system-logger.ts',
324
- // Anonymous Product Telemetry v1 (PRI-595~603, ADR-0021): one-time-init
325
- // trigger shell — wires the host-neutral telemetry service (all logic in
326
- // @principles/host-runtime product-telemetry) into the OpenClaw plugin
327
- // lifecycle. Plugin-specific because the trigger point is plugin-owned.
328
- 'product-telemetry-trigger.ts',
329
- // PRI-446: now a thin shell wiring DetectionFunnelCore (core runtime-v2/detection)
330
- // with crypto.createHash + PainDictionary. Kept here because it owns the
331
- // crypto + dictionary I/O boundary.
332
- 'detection-funnel.ts',
333
- 'migration.ts',
334
- 'file-store.ts',
335
- 'pd-task-store.ts',
336
- 'empathy-keyword-matcher.ts',
337
- // SignalCollector: unified signal collection host (correction + empathy upstream merge).
338
- // I/O shell: reads .pd/config.yaml, constructs PiAiRuntimeAdapter, writes trajectory.
339
- // Pure detection logic lives in @principles/core/runtime-v2/signal-collector/.
340
- 'signal-collector-host.ts',
341
- // PRI-530: Plugin I/O boundary — sync readonly state.db reads resolving principle
342
- // receipt attribution (title fallback chain / approval date / source summary).
343
- 'principle-receipt-metadata.ts',
344
- // PRI-531: Plugin I/O boundary — durable receipt ledger writes (state.db
345
- // principle_applications inserts + 90-day retention sweep).
346
- 'principle-application-ledger.ts',
347
- 'pain-lifecycle.ts',
348
- 'session-tracker.ts',
349
- // PRI-459: now a thin re-export adapter over @principles/core/principle-tree-ledger.
350
- // Kept in the plugin baseline so existing relative imports (./principle-tree-ledger.js)
351
- // still resolve. No parsing/serialization/mutation logic may live here — enforced by
352
- // tests/ledger-schema-diff.test.ts.
353
- 'principle-tree-ledger.ts',
354
- // evolution-logger.ts / evolution-engine.ts removed (PRI-737 legacy
355
- // evolution worker retirement).
356
- // ── Runtime V2 ──────────────────────────────────────────────────────────
357
- 'runtime-v2-prompt-activation-reader.ts',
358
- // PRI-307: Plugin I/O boundary — reads .pd/config.yaml, delegates validation to core
359
- 'pd-config-loader.ts',
360
- // PRI-346: Pure function for checking conversation access config (extracted for circular import avoidance)
361
- 'config-health.ts',
362
- // PRI-467: Plugin I/O boundary — reads .principles/INTENT.md with TTL+mtime cache,
363
- // delegates parsing/validation/hashing to @principles/core. Never throws.
364
- 'intent-doc-reader.ts',
365
- // PRI-468: Plugin adapter implementing core IntentDocReader port — pure type
366
- // mapping from safeReadIntentDoc result to the core-owned IntentDocReadResult.
367
- // No new I/O; delegates to intent-doc-reader.ts above.
368
- 'intent-doc-reader-adapter.ts',
369
- // RuleCode safety containment I/O boundary — reads approved artifact scope and
370
- // persists circuit-breaker isolation through the core-owned SQLite safety store.
371
- // Pure threshold policy remains in principles-core.
372
- 'rulecode-safety-circuit.ts',
373
- // PRI-788 G4: Plugin I/O boundary — atomically maintains
374
- // <workspace>/.state/signal-health.json (mkdir + atomicWriteFileSync +
375
- // SystemLogger) so `pd config doctor` can surface detection-chain health.
376
- 'signal-health.ts',
377
- // ── Test Files ──────────────────────────────────────────────────────────
378
- '__tests__/focus-history.test.ts',
379
- 'principle-compiler/__tests__/compiler-replay-gate.test.ts',
380
- ]);
381
- describe('PRI-212 plugin core anti-growth guard', () => {
382
- const PLUGIN_CORE_RELPATH = '../../../../openclaw-plugin/src/core';
383
- it('every plugin-core file is in the known baseline', async () => {
384
- const { readdirSync, existsSync } = await import('node:fs');
385
- const { resolve, relative, sep } = await import('node:path');
386
- const pluginCoreDir = resolve(__dirname, PLUGIN_CORE_RELPATH);
387
- expect(existsSync(pluginCoreDir)).toBe(true);
388
- // Collect all .ts files recursively (relative to plugin-core root)
389
- const allFiles = [];
390
- function collectDir(dir) {
391
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
392
- const fullPath = resolve(dir, entry.name);
393
- if (entry.isDirectory()) {
394
- collectDir(fullPath);
395
- }
396
- else if (entry.name.endsWith('.ts')) {
397
- allFiles.push(relative(pluginCoreDir, fullPath).split(sep).join('/'));
398
- }
399
- }
400
- }
401
- collectDir(pluginCoreDir);
402
- const unknownFiles = allFiles.filter((f) => !KNOWN_PLUGIN_CORE_FILES.has(f));
403
- if (unknownFiles.length > 0) {
404
- const msg = [
405
- `Found ${unknownFiles.length} unclassified file(s) in packages/openclaw-plugin/src/core/:`,
406
- ...unknownFiles.map((f) => ` ${f}`),
407
- '',
408
- 'Each new file in plugin core must be explicitly classified:',
409
- ' 1. New pure domain logic → packages/principles-core (zero I/O, testable with no mocks)',
410
- ' 2. New plugin I/O adapter → add to KNOWN_PLUGIN_CORE_FILES with classification comment',
411
- ' 3. See docs/archive/reviews/plugin-core-inventory-2026-05.md for the PRI-211 baseline',
412
- 'ERR-011: never bypass architecture boundary facades',
413
- 'ERR-012: baseline entries must survive rebase — check diff for unintended deletions',
414
- ].join('\n');
415
- expect.fail(msg);
416
- }
417
- });
418
- it('known baseline count is self-consistent (96 files)', async () => {
419
- // Sanity check: if the baseline grows, update this number.
420
- // Prevents accidental baseline bloat from going unnoticed.
421
- // See docs/archive/reviews/plugin-core-inventory-2026-05.md §7
422
- // PRI-286: Removed confirm-first-gate.ts (95 → 94)
423
- // PRI-307: Added pd-config-loader.ts (96 → 97)
424
- // PRI-346: Added config-health.ts (97 → 98)
425
- // PRI-448: Removed local-worker-routing.ts, promotion-gate.ts,
426
- // model-training-registry.ts, model-deployment-registry.ts,
427
- // shadow-observation-registry.ts (98 → 93)
428
- // PRI-449: Removed external-training-contract.ts (93 → 92)
429
- // PRI-446: pain-diagnostic-gate.ts and detection-funnel.ts remain at 92 —
430
- // they are now thin adapters delegating pure logic to core, but still live
431
- // in plugin src/core/ and own I/O side effects, so they stay classified.
432
- // PRI-467: Added intent-doc-reader.ts (92 → 93) — plugin I/O boundary for
433
- // reading .principles/INTENT.md with TTL+mtime cache for prompt injection.
434
- // PRI-468: Added intent-doc-reader-adapter.ts (93 → 94) — plugin adapter
435
- // implementing core IntentDocReader port (pure type mapping, no new I/O).
436
- // Stage-1 cleanup: Removed evolution-migration.ts (94 → 93) — dead code,
437
- // zero production references after refactor to @principles/core.
438
- // PRI-482: Added rule-context-assembler.ts (93 → 94) — plugin I/O boundary
439
- // converting TrajectoryDatabase rows to validated RuleHistoryWindow.
440
- // Stage-3: Removed risk-calculator.ts (94 → 93) — pure logic sunk to
441
- // core runtime-v2/risk/, dead code (assessRiskLevel/getTargetFileLineCount/
442
- // calculatePercentageThreshold) removed.
443
- // Stage-3 sink: Removed surface-guard.ts (93 → 92) — pure guard logic
444
- // migrated to @principles/core/runtime-v2/feature-flags/surface-guard-policy.
445
- // SignalCollector: Added signal-collector-host.ts (92 → 93) — unified signal
446
- // collection I/O host (correction + empathy upstream merge). Reads
447
- // .pd/config.yaml, constructs PiAiRuntimeAdapter, writes trajectory. Pure
448
- // detection logic lives in @principles/core/runtime-v2/signal-collector/.
449
- // PRI-484: Added behavior-example-pack-assembler.ts (92 → 93) — plugin I/O
450
- // boundary assembling BehaviorExamplePack from pain lineage + trajectory.
451
- // SignalCollector: Added signal-collector-host.ts (93 → 94) — unified signal
452
- // collection I/O host (correction + empathy upstream merge). Reads
453
- // .pd/config.yaml, constructs PiAiRuntimeAdapter, writes trajectory. Pure
454
- // detection logic lives in @principles/core/runtime-v2/signal-collector/.
455
- // PRI-530: Added principle-receipt-metadata.ts (94 → 95) — plugin I/O boundary
456
- // for principle receipt attribution reads (readonly state.db joins).
457
- // PRI-531: Added principle-application-ledger.ts (95 → 96) — receipt ledger writer.
458
- // 2026-08-19 retirement: Removed control-ui-db.ts and thinking-models.ts
459
- // (96 → 94) — zero production consumers after the Thinking Activity
460
- // writer retirement (census in the PR description).
461
- // MVP core-loop closure (P0-B/P0-D): Added signal-keyword-store.ts +
462
- // auto-consumer-governance-wiring.ts (94 → 96) — live correction-cue store
463
- // projection + auto-consumer governance dispatcher/repair wiring (I/O boundary).
464
- // RuleCode Owner Live Decision: Added rulecode-safety-circuit.ts (96 → 97)
465
- // as the plugin I/O shell for scope reads and durable safety isolation.
466
- // PRI-737: Removed evolution-logger.ts + evolution-engine.ts (98 → 96) —
467
- // legacy evolution worker retirement (trace-id util moved to src/utils/).
468
- // PRI-788 G4: Added signal-health.ts (96 → 97) — plugin I/O boundary for
469
- // <workspace>/.state/signal-health.json (atomic write + mkdir + SYSTEM log),
470
- // consumed by `pd config doctor` for detection-chain health visibility.
471
- // PRI-776: Removed workspace-guidance-migrator.ts (97 → 96) — PLAN.md-era
472
- // guidance migration retired (ran at every startup for months; current
473
- // templates cannot produce matching text).
474
- expect(KNOWN_PLUGIN_CORE_FILES.size).toBe(96);
475
- });
476
- });
477
- const REQUIRED_TEST_FILES = [
478
- 'pain-to-principle-service.test.ts',
479
- 'pain-chain-read-model.test.ts',
480
- 'pruning-read-model.test.ts',
481
- 'pruning-review-log.test.ts',
482
- // PRI-28
483
- 'operator-health-read-model.test.ts',
484
- 'candidate-audit.test.ts',
485
- // PRI-56 (lifecycle-read-model.test.ts is at internalization/lifecycle-read-model.test.ts, not in __tests__/)
486
- // Skipping — test file lives at ../internalization/ not __tests__/internalization/
487
- // PRI-62
488
- 'internalization-state-machine.test.ts',
489
- // PRI-65
490
- 'pitask-metadata.test.ts',
491
- // PRI-67
492
- 'dreamer-runner.test.ts',
493
- // PRI-109
494
- 'scribe-runner-vslice.test.ts',
495
- // PRI-111
496
- 'artificer-runner-vslice.test.ts',
497
- // PRI-EVAL
498
- 'evaluator-runner-vslice.test.ts',
499
- // PRI-RR
500
- 'rollout-reviewer-runner-vslice.test.ts',
501
- // PRI-74 (follow-up to PRI-75 Phase 3)
502
- '../../prompt-builder/__tests__/routing-guidance.test.ts',
503
- // PRI-81 Phase A
504
- '../../prompt-builder/__tests__/empathy-keyword-matching.test.ts',
505
- // PRI-81 Phase B
506
- '../../prompt-builder/__tests__/focus-compression.test.ts',
507
- // PRI-76
508
- '../gfi/__tests__/gfi-kernel.test.ts',
509
- // PRI-115
510
- 'golden-trace-replay-validator.test.ts',
511
- // PRI-140
512
- '../store/sqlite-connection-pragma.test.ts',
513
- // PRI-141
514
- 'task-three-strikes.test.ts',
515
- // PRI-139
516
- 'l1-hard-cap.test.ts',
517
- // PRI-142
518
- 'intake-to-internalization-bridge.test.ts',
519
- // PRI-144
520
- '../activation/__tests__/activation-dispatcher.test.ts',
521
- // PRI-145
522
- '../activation/__tests__/approval-queue.test.ts',
523
- '../activation/__tests__/sqlite-approval-store.test.ts',
524
- // PRI-190
525
- 'full-trace-contract.test.ts',
526
- // PRI-191/192/193 test files removed with their modules (PRI-770)
527
- // PRI-173
528
- '../internalization/__tests__/refiner-rulehost-gate.test.ts',
529
- // PRI-146
530
- '../activation/writers/__tests__/rule-host-writer.test.ts',
531
- // PRI-215
532
- 'synthetic-baseline.test.ts',
533
- // PRI-239
534
- '../feature-flags/__tests__/feature-flag-contract.test.ts',
535
- // PRI-295
536
- '../activation/__tests__/prompt-activation-reader-contract.test.ts',
537
- // PRI-372 (T-G)
538
- '../diagnostician/__tests__/diag-rootcause-output.test.ts',
539
- '../diagnostician/__tests__/diag-distiller-output.test.ts',
540
- '../diagnostician/__tests__/rootcause-prompt-builder.test.ts',
541
- '../diagnostician/__tests__/distiller-prompt-builder.test.ts',
542
- '../diagnostician/__tests__/router-prompt-builder.test.ts',
543
- '../internalization/__tests__/diag-rootcause-runner.test.ts',
544
- '../internalization/__tests__/diag-distiller-runner.test.ts',
545
- '../internalization/__tests__/diag-router-runner.test.ts',
546
- '../internalization/__tests__/diag-chain-e2e.test.ts',
547
- // PRI-431
548
- 'build-l2-principle-reader.test.ts',
549
- // PRI-469
550
- 'evidence-chain-intent-tension.test.ts',
551
- // PRI-470: IntentDecisionRecord types + SQLite store
552
- '../intent/__tests__/intent-decision-record.test.ts',
553
- '../store/intent/__tests__/sqlite-intent-decision-store.test.ts',
554
- ];
555
- const REQUIRED_DOC_FILES = [];
556
- for (const file of REQUIRED_SOURCE_FILES) {
557
- it(`source file ${file} is present`, async () => {
558
- const { existsSync } = await import('node:fs');
559
- const { resolve } = await import('node:path');
560
- expect(existsSync(resolve(__dirname, '..', file))).toBe(true);
561
- });
562
- }
563
- for (const file of REQUIRED_TEST_FILES) {
564
- it(`test file __tests__/${file} is present`, async () => {
565
- const { existsSync } = await import('node:fs');
566
- const { resolve } = await import('node:path');
567
- expect(existsSync(resolve(__dirname, file))).toBe(true);
568
- });
569
- }
570
- for (const file of REQUIRED_DOC_FILES) {
571
- it(`doc file ${file} is present`, async () => {
572
- const { existsSync } = await import('node:fs');
573
- const { resolve } = await import('node:path');
574
- expect(existsSync(resolve(__dirname, file))).toBe(true);
575
- });
576
- }
577
- // ── Public API exports ─────────────────────────────────────────────────────
578
- describe('runtime-v2 public API (index.ts barrel)', () => {
579
- const barrel = import('../index.js');
580
- const REQUIRED_EXPORTS = [
581
- // PRI-12
582
- 'PainToPrincipleService',
583
- // PRI-14
584
- 'PainChainReadModel',
585
- // M8
586
- 'PainSignalBridge',
587
- 'createPainSignalBridge',
588
- 'recordPainSignalObservability',
589
- // PRI-15
590
- 'PruningReadModel',
591
- // PRI-13 → factory
592
- 'resolveRuntimeConfig',
593
- 'validateRuntimeConfig',
594
- // PRI-28
595
- 'OperatorHealthReadModel',
596
- 'auditCandidateLedgerConsistency',
597
- // PRI-43
598
- 'decideInternalizationRoute',
599
- // PRI-44
600
- 'generateFromTemplate',
601
- 'checkForbiddenPatterns',
602
- 'checkReturnStatementsMissingFields',
603
- // PRI-45
604
- 'mergeDecisions',
605
- // PRI-149 Tier 2
606
- 'createRecoverySweepService',
607
- // PRI-239
608
- 'validateFeatureFlagRaw',
609
- 'computeEffectiveFlags',
610
- // PRI-295
611
- 'filterPromptActivations',
612
- 'resolvePrincipleFromArtifact',
613
- 'trimToBudget',
614
- 'renderPrinciplesToDirectives',
615
- // PRI-431
616
- 'buildL2PrincipleReaderFromLedger',
617
- // LLM output hardening — shared utility
618
- 'stripFabricatedCorePrincipleIds',
619
- // PRI-470: IntentDecisionRecord durable SQLite store
620
- 'SqliteIntentDecisionStore',
621
- // Slice 1 (PRI-543): fingerprint for feedback dedup/clustering
622
- 'computeFeedbackFingerprint',
623
- ];
624
- for (const name of REQUIRED_EXPORTS) {
625
- it(`exports ${name}`, async () => {
626
- const mod = (await barrel);
627
- expect(mod).toHaveProperty(name);
628
- expect(typeof mod[name]).toBe('function');
629
- }, 15_000);
630
- }
631
- // PRI-171: TypeBox schema exports (objects, not functions)
632
- const REQUIRED_SCHEMA_EXPORTS = [
633
- 'FullTracePayloadSchema',
634
- 'ToolCallEntrySchema',
635
- 'PainContextSchema',
636
- // PRI-190
637
- 'FullTracePayloadV2Schema',
638
- 'TraceSourceRefSchema',
639
- 'TraceTimelineEntrySchema',
640
- 'TraceEventKindSchema',
641
- 'SourceRefKindSchema',
642
- ];
643
- for (const name of REQUIRED_SCHEMA_EXPORTS) {
644
- it(`exports schema ${name}`, async () => {
645
- const mod = (await barrel);
646
- expect(mod).toHaveProperty(name);
647
- expect(typeof mod[name]).toBe('object');
648
- }, 15_000);
649
- }
650
- });
651
- // ── OpenClawPlugin pain hook integration ───────────────────────────────────
652
- describe('openclaw-plugin pain hook integration', () => {
653
- it('pain.ts uses PainToPrincipleService (not createPainSignalBridge)', async () => {
654
- const { existsSync, readFileSync } = await import('node:fs');
655
- const { resolve } = await import('node:path');
656
- const painHookPath = resolve(__dirname, '../../../../openclaw-plugin/src/hooks/pain.ts');
657
- expect(existsSync(painHookPath)).toBe(true);
658
- const src = readFileSync(painHookPath, 'utf-8');
659
- expect(src).toContain('PainToPrincipleService');
660
- expect(src).not.toContain('createPainSignalBridge');
661
- });
662
- // PRI-29: emitPainDetectedEvent → PainToPrincipleService service contract
663
- it('pain.ts emitPainDetectedEvent calls PainToPrincipleService.recordPain on pain_detected', async () => {
664
- const { existsSync, readFileSync } = await import('node:fs');
665
- const { resolve } = await import('node:path');
666
- const painHookPath = resolve(__dirname, '../../../../openclaw-plugin/src/hooks/pain.ts');
667
- expect(existsSync(painHookPath)).toBe(true);
668
- const src = readFileSync(painHookPath, 'utf-8');
669
- // Must call service.recordPain() inside emitPainDetectedEvent
670
- expect(src).toMatch(/service\.recordPain\(/);
671
- // Must log PAIN_SERVICE_FAILED for failure results
672
- expect(src).toMatch(/PAIN_SERVICE_FAILED/);
673
- // Must log PAIN_SERVICE_SKIPPED for skipped results
674
- expect(src).toMatch(/PAIN_SERVICE_SKIPPED/);
675
- // Must log PAIN_SERVICE_ERROR for exceptions
676
- expect(src).toMatch(/PAIN_SERVICE_ERROR/);
677
- // Must NOT use legacy createPainSignalBridge
678
- expect(src).not.toMatch(/createPainSignalBridge/);
679
- });
680
- });
681
- // ── PRI-42: Internalization boundary guards ──────────────────────────────────
682
- describe('PRI-42 internalization boundary', () => {
683
- it('core internalization has zero openclaw-plugin imports', async () => {
684
- const { existsSync, readdirSync, readFileSync } = await import('node:fs');
685
- const { resolve, join } = await import('node:path');
686
- const intDir = resolve(__dirname, '..', 'internalization');
687
- expect(existsSync(intDir)).toBe(true);
688
- const files = readdirSync(intDir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
689
- for (const file of files) {
690
- const src = readFileSync(join(intDir, file), 'utf-8');
691
- expect(src).not.toContain('openclaw-plugin');
692
- expect(src).not.toContain('../../../openclaw-plugin');
693
- }
694
- });
695
- it('PEAT-B1: evidence-triage has zero openclaw-plugin imports', async () => {
696
- const { existsSync, readdirSync, readFileSync } = await import('node:fs');
697
- const { resolve, join } = await import('node:path');
698
- const triageDir = resolve(__dirname, '..', 'evidence-triage');
699
- expect(existsSync(triageDir)).toBe(true);
700
- const files = readdirSync(triageDir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
701
- for (const file of files) {
702
- const src = readFileSync(join(triageDir, file), 'utf-8');
703
- expect(src).not.toContain('openclaw-plugin');
704
- expect(src).not.toContain('../../../openclaw-plugin');
705
- }
706
- });
707
- it('PRI-446: pain-gate has zero openclaw-plugin imports', async () => {
708
- const { existsSync, readdirSync, readFileSync } = await import('node:fs');
709
- const { resolve, join } = await import('node:path');
710
- const dir = resolve(__dirname, '..', 'pain-gate');
711
- expect(existsSync(dir)).toBe(true);
712
- const files = readdirSync(dir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
713
- for (const file of files) {
714
- const src = readFileSync(join(dir, file), 'utf-8');
715
- expect(src).not.toContain('openclaw-plugin');
716
- expect(src).not.toContain('../../../openclaw-plugin');
717
- }
718
- });
719
- it('PRI-446: detection has zero openclaw-plugin imports', async () => {
720
- const { existsSync, readdirSync, readFileSync } = await import('node:fs');
721
- const { resolve, join } = await import('node:path');
722
- const dir = resolve(__dirname, '..', 'detection');
723
- expect(existsSync(dir)).toBe(true);
724
- const files = readdirSync(dir).filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'));
725
- for (const file of files) {
726
- const src = readFileSync(join(dir, file), 'utf-8');
727
- expect(src).not.toContain('openclaw-plugin');
728
- expect(src).not.toContain('../../../openclaw-plugin');
729
- }
730
- });
731
- it('plugin rule-host.ts imports contracts from core barrel', async () => {
732
- const { existsSync, readFileSync } = await import('node:fs');
733
- const { resolve } = await import('node:path');
734
- const ruleHostPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts');
735
- expect(existsSync(ruleHostPath)).toBe(true);
736
- const src = readFileSync(ruleHostPath, 'utf-8');
737
- // Must import from @principles/core/runtime-v2, not local rule-host-types
738
- expect(src).toContain('@principles/core/runtime-v2');
739
- expect(src).not.toContain("from './rule-host-types.js'");
740
- });
741
- it('PRI-436: plugin rule-host.ts does NOT import filesystem ledger or implementation storage', async () => {
742
- const { existsSync, readFileSync } = await import('node:fs');
743
- const { resolve } = await import('node:path');
744
- const ruleHostPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts');
745
- expect(existsSync(ruleHostPath)).toBe(true);
746
- const src = readFileSync(ruleHostPath, 'utf-8');
747
- // PRI-436: SQLite is the sole RuleHost source. No filesystem imports allowed.
748
- expect(src).not.toContain("from './principle-tree-ledger.js'");
749
- expect(src).not.toContain("from './code-implementation-storage.js'");
750
- expect(src).not.toContain('listImplementationsByLifecycleState');
751
- expect(src).not.toContain('loadEntrySource');
752
- expect(src).not.toContain("import * as fs from 'fs'");
753
- });
754
- it('plugin gate.ts imports RuleHostInput from core barrel', async () => {
755
- const { existsSync, readFileSync } = await import('node:fs');
756
- const { resolve } = await import('node:path');
757
- const gatePath = resolve(__dirname, '../../../../openclaw-plugin/src/hooks/gate.ts');
758
- expect(existsSync(gatePath)).toBe(true);
759
- const src = readFileSync(gatePath, 'utf-8');
760
- expect(src).toContain('@principles/core/runtime-v2');
761
- expect(src).not.toContain("from '../core/rule-host-types.js'");
762
- });
763
- it('plugin replay-engine.ts imports contracts from core barrel', async () => {
764
- const { existsSync, readFileSync } = await import('node:fs');
765
- const { resolve } = await import('node:path');
766
- const replayPath = resolve(__dirname, '../../../../openclaw-plugin/src/core/replay-engine.ts');
767
- expect(existsSync(replayPath)).toBe(true);
768
- const src = readFileSync(replayPath, 'utf-8');
769
- expect(src).toContain('@principles/core/runtime-v2');
770
- expect(src).not.toContain("from './rule-host-types.js'");
771
- expect(src).not.toContain("from './rule-host-helpers.js'");
772
- });
773
- });
774
- // ── PRI-44: Principle-compiler core boundary ──────────────────────────────────
775
- describe('PRI-44 principle-compiler core boundary', () => {
776
- it('core template-generator.ts has zero infrastructure imports', async () => {
777
- const { readFileSync } = await import('node:fs');
778
- const { resolve } = await import('node:path');
779
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'template-generator.ts'), 'utf-8');
780
- expect(src).not.toContain('node:vm');
781
- expect(src).not.toContain('node:fs');
782
- expect(src).not.toContain('openclaw-plugin');
783
- });
784
- it('core rule-code-validator.ts has zero infrastructure imports', async () => {
785
- const { readFileSync } = await import('node:fs');
786
- const { resolve } = await import('node:path');
787
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-code-validator.ts'), 'utf-8');
788
- expect(src).not.toContain('node:vm');
789
- expect(src).not.toContain('node:fs');
790
- expect(src).not.toContain('openclaw-plugin');
791
- });
792
- it('plugin template-generator.ts re-exports from core', async () => {
793
- const { readFileSync } = await import('node:fs');
794
- const { resolve } = await import('node:path');
795
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-compiler/template-generator.ts'), 'utf-8');
796
- expect(src).toContain('@principles/core/runtime-v2');
797
- expect(src).toContain('generateFromTemplate');
798
- });
799
- it('plugin code-validator.ts imports checkForbiddenPatterns from core', async () => {
800
- const { readFileSync } = await import('node:fs');
801
- const { resolve } = await import('node:path');
802
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-compiler/code-validator.ts'), 'utf-8');
803
- expect(src).toContain('checkForbiddenPatterns');
804
- expect(src).toContain('@principles/core/runtime-v2');
805
- });
806
- it('plugin compiler.ts imports CompileResult from core', async () => {
807
- const { readFileSync } = await import('node:fs');
808
- const { resolve } = await import('node:path');
809
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-compiler/compiler.ts'), 'utf-8');
810
- expect(src).toContain("import type { CompileResult } from '@principles/core/runtime-v2'");
811
- });
812
- });
813
- // ── PRI-47: Store layer modularization Phase 3 ──────────────────────────────
814
- describe('PRI-47 store modularization Phase 3', () => {
815
- it('store/candidate/index.ts exists and re-exports CandidateStore + SqliteCandidateStore + MemoryCandidateStore', async () => {
816
- const { existsSync, readFileSync } = await import('node:fs');
817
- const { resolve } = await import('node:path');
818
- const indexPath = resolve(__dirname, '..', 'store', 'candidate', 'index.ts');
819
- expect(existsSync(indexPath)).toBe(true);
820
- const src = readFileSync(indexPath, 'utf-8');
821
- expect(src).toContain('CandidateStore');
822
- expect(src).toContain('SqliteCandidateStore');
823
- expect(src).toContain('MemoryCandidateStore');
824
- });
825
- it('store/artifact/index.ts exists and re-exports ArtifactStore + SqliteArtifactStore + MemoryArtifactStore', async () => {
826
- const { existsSync, readFileSync } = await import('node:fs');
827
- const { resolve } = await import('node:path');
828
- const indexPath = resolve(__dirname, '..', 'store', 'artifact', 'index.ts');
829
- expect(existsSync(indexPath)).toBe(true);
830
- const src = readFileSync(indexPath, 'utf-8');
831
- expect(src).toContain('ArtifactStore');
832
- expect(src).toContain('SqliteArtifactStore');
833
- expect(src).toContain('MemoryArtifactStore');
834
- });
835
- it('store/commit/index.ts re-exports CommitStore + SqliteCommitStore + MemoryCommitStore', async () => {
836
- const { readFileSync } = await import('node:fs');
837
- const { resolve } = await import('node:path');
838
- const indexPath = resolve(__dirname, '..', 'store', 'commit', 'index.ts');
839
- const src = readFileSync(indexPath, 'utf-8');
840
- expect(src).toContain('CommitStore');
841
- expect(src).toContain('SqliteCommitStore');
842
- expect(src).toContain('MemoryCommitStore');
843
- });
844
- it('store/task/index.ts re-exports MemoryTaskStore', async () => {
845
- const { readFileSync } = await import('node:fs');
846
- const { resolve } = await import('node:path');
847
- const indexPath = resolve(__dirname, '..', 'store', 'task', 'index.ts');
848
- const src = readFileSync(indexPath, 'utf-8');
849
- expect(src).toContain('MemoryTaskStore');
850
- });
851
- it('store/run/index.ts re-exports MemoryRunStore', async () => {
852
- const { readFileSync } = await import('node:fs');
853
- const { resolve } = await import('node:path');
854
- const indexPath = resolve(__dirname, '..', 'store', 'run', 'index.ts');
855
- const src = readFileSync(indexPath, 'utf-8');
856
- expect(src).toContain('MemoryRunStore');
857
- });
858
- it('RuntimeStateManager has zero inline SQL (no db.prepare calls)', async () => {
859
- const { readFileSync } = await import('node:fs');
860
- const { resolve } = await import('node:path');
861
- const src = readFileSync(resolve(__dirname, '..', 'store', 'runtime-state-manager.ts'), 'utf-8');
862
- expect(src).not.toContain('db.prepare');
863
- });
864
- it('Memory*Store test double files exist', async () => {
865
- const { existsSync } = await import('node:fs');
866
- const { resolve } = await import('node:path');
867
- const base = resolve(__dirname, '..', 'store');
868
- expect(existsSync(resolve(base, 'task', 'memory-task-store.ts'))).toBe(true);
869
- expect(existsSync(resolve(base, 'run', 'memory-run-store.ts'))).toBe(true);
870
- expect(existsSync(resolve(base, 'commit', 'memory-commit-store.ts'))).toBe(true);
871
- expect(existsSync(resolve(base, 'candidate', 'memory-candidate-store.ts'))).toBe(true);
872
- expect(existsSync(resolve(base, 'artifact', 'memory-artifact-store.ts'))).toBe(true);
873
- });
874
- it('Phase 3 M5 types NOT defined inline in runtime-state-manager.ts', async () => {
875
- const { readFileSync } = await import('node:fs');
876
- const { resolve } = await import('node:path');
877
- const src = readFileSync(resolve(__dirname, '..', 'store', 'runtime-state-manager.ts'), 'utf-8');
878
- // CommitRecord, CandidateRecord, ArtifactRecord, ArtifactWithCandidates should be re-exported from submodules
879
- expect(src).not.toMatch(/^export interface CommitRecord/m);
880
- expect(src).not.toMatch(/^export interface CandidateRecord/m);
881
- expect(src).not.toMatch(/^export interface ArtifactRecord/m);
882
- expect(src).not.toMatch(/^export interface ArtifactWithCandidates/m);
883
- });
884
- });
885
- describe('pd-cli command boundaries', () => {
886
- it('pain-record.ts does not import createPainSignalBridge or recordPainSignalObservability', async () => {
887
- const { existsSync, readFileSync } = await import('node:fs');
888
- const { resolve } = await import('node:path');
889
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/pain-record.ts');
890
- expect(existsSync(cmdPath)).toBe(true);
891
- const src = readFileSync(cmdPath, 'utf-8');
892
- expect(src).toContain('PainToPrincipleService');
893
- expect(src).not.toContain('createPainSignalBridge');
894
- expect(src).not.toContain('recordPainSignalObservability');
895
- });
896
- it('runtime-health-snapshot.ts uses OperatorHealthReadModel (public API)', async () => {
897
- const { existsSync, readFileSync } = await import('node:fs');
898
- const { resolve } = await import('node:path');
899
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-health-snapshot.ts');
900
- expect(existsSync(cmdPath)).toBe(true);
901
- const src = readFileSync(cmdPath, 'utf-8');
902
- expect(src).toContain('OperatorHealthReadModel');
903
- expect(src).not.toContain('auditCandidateLedgerConsistency');
904
- expect(src).not.toContain('../candidate-audit');
905
- });
906
- it('trace.ts does not import RuntimeStateManager or loadLedger', async () => {
907
- const { existsSync, readFileSync } = await import('node:fs');
908
- const { resolve } = await import('node:path');
909
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/trace.ts');
910
- expect(existsSync(cmdPath)).toBe(true);
911
- const src = readFileSync(cmdPath, 'utf-8');
912
- expect(src).not.toContain('RuntimeStateManager');
913
- expect(src).not.toContain('loadLedger');
914
- expect(src).toContain('PainChainReadModel');
915
- });
916
- it('health.ts does not import loadLedger', async () => {
917
- const { existsSync, readFileSync } = await import('node:fs');
918
- const { resolve } = await import('node:path');
919
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/health.ts');
920
- expect(existsSync(cmdPath)).toBe(true);
921
- const src = readFileSync(cmdPath, 'utf-8');
922
- expect(src).not.toContain('loadLedger');
923
- expect(src).not.toContain('RuntimeStateManager');
924
- expect(src).toContain('PruningReadModel');
925
- });
926
- it('runtime-pruning.ts does not import loadLedger or saveLedger', async () => {
927
- const { existsSync, readFileSync } = await import('node:fs');
928
- const { resolve } = await import('node:path');
929
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-pruning.ts');
930
- expect(existsSync(cmdPath)).toBe(true);
931
- const src = readFileSync(cmdPath, 'utf-8');
932
- expect(src).not.toContain('loadLedger');
933
- expect(src).not.toContain('saveLedger');
934
- expect(src).not.toContain('RuntimeStateManager');
935
- expect(src).toContain('removeOrphanReferencesFromLedger');
936
- });
937
- it('runtime-internalization-queue.ts does not import RuntimeStateManager', async () => {
938
- const { existsSync, readFileSync } = await import('node:fs');
939
- const { resolve } = await import('node:path');
940
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-internalization-queue.ts');
941
- expect(existsSync(cmdPath)).toBe(true);
942
- const src = readFileSync(cmdPath, 'utf-8');
943
- expect(src).not.toContain('RuntimeStateManager');
944
- expect(src).not.toContain('loadLedger');
945
- expect(src).toContain('createInternalizationQueueReadModel');
946
- });
947
- it('runtime-canary.ts does not import RuntimeStateManager', async () => {
948
- const { existsSync, readFileSync } = await import('node:fs');
949
- const { resolve } = await import('node:path');
950
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-canary.ts');
951
- expect(existsSync(cmdPath)).toBe(true);
952
- const src = readFileSync(cmdPath, 'utf-8');
953
- expect(src).not.toContain('RuntimeStateManager');
954
- expect(src).toContain('createInternalizationQueueReadModel');
955
- });
956
- it('runtime-diagnostics-export.ts does not import RuntimeStateManager', async () => {
957
- const { existsSync, readFileSync } = await import('node:fs');
958
- const { resolve } = await import('node:path');
959
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-diagnostics-export.ts');
960
- expect(existsSync(cmdPath)).toBe(true);
961
- const src = readFileSync(cmdPath, 'utf-8');
962
- expect(src).not.toContain('RuntimeStateManager');
963
- expect(src).toContain('createInternalizationQueueReadModel');
964
- });
965
- it('runtime-recovery.ts does not import RuntimeStateManager', async () => {
966
- const { existsSync, readFileSync } = await import('node:fs');
967
- const { resolve } = await import('node:path');
968
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-recovery.ts');
969
- expect(existsSync(cmdPath)).toBe(true);
970
- const src = readFileSync(cmdPath, 'utf-8');
971
- expect(src).not.toContain('RuntimeStateManager');
972
- expect(src).toContain('createRecoverySweepService');
973
- });
974
- });
975
- // ── PRI-198: RuntimeStateHandle lifecycle facade ────────────────────────────
976
- describe('PRI-198 RuntimeStateHandle lifecycle facade', () => {
977
- it('runtime-state-handle.ts source file exists', async () => {
978
- const { existsSync } = await import('node:fs');
979
- const { resolve } = await import('node:path');
980
- const filePath = resolve(__dirname, '..', 'runtime-state-handle.ts');
981
- expect(existsSync(filePath)).toBe(true);
982
- });
983
- it('internalization-queue-read-model.ts does not import RuntimeStateManager directly', async () => {
984
- const { readFileSync } = await import('node:fs');
985
- const { resolve } = await import('node:path');
986
- const src = readFileSync(resolve(__dirname, '..', 'internalization-queue-read-model.ts'), 'utf-8');
987
- expect(src).not.toContain("from './store/runtime-state-manager.js'");
988
- expect(src).toContain("from './runtime-state-handle.js'");
989
- });
990
- it('recovery-sweep-service.ts does not import RuntimeStateManager directly', async () => {
991
- const { readFileSync } = await import('node:fs');
992
- const { resolve } = await import('node:path');
993
- const src = readFileSync(resolve(__dirname, '..', 'recovery-sweep-service.ts'), 'utf-8');
994
- expect(src).not.toContain("from './store/runtime-state-manager.js'");
995
- expect(src).toContain("from './runtime-state-handle.js'");
996
- });
997
- it('barrel exports createRuntimeStateHandle and RuntimeStateHandle', async () => {
998
- const mod = (await import('../index.js'));
999
- expect(mod).toHaveProperty('createRuntimeStateHandle');
1000
- });
1001
- });
1002
- // ── PRI-45: RuleHost adapter boundary ────────────────────────────────────────
1003
- describe('PRI-45 RuleHost adapter boundary', () => {
1004
- it('core rule-host-evaluator.ts has zero infrastructure imports', async () => {
1005
- const { readFileSync } = await import('node:fs');
1006
- const { resolve } = await import('node:path');
1007
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-evaluator.ts'), 'utf-8');
1008
- expect(src).not.toContain('node:vm');
1009
- expect(src).not.toContain('node:fs');
1010
- expect(src).not.toContain('openclaw-plugin');
1011
- });
1012
- it('core rule-host-adapter.ts has zero infrastructure imports', async () => {
1013
- const { readFileSync } = await import('node:fs');
1014
- const { resolve } = await import('node:path');
1015
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-adapter.ts'), 'utf-8');
1016
- expect(src).not.toContain('node:vm');
1017
- expect(src).not.toContain('node:fs');
1018
- expect(src).not.toContain('openclaw-plugin');
1019
- });
1020
- it('plugin rule-host.ts imports mergeDecisions from core barrel', async () => {
1021
- const { readFileSync } = await import('node:fs');
1022
- const { resolve } = await import('node:path');
1023
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts'), 'utf-8');
1024
- expect(src).toContain('mergeDecisions');
1025
- expect(src).toContain('@principles/core/runtime-v2');
1026
- });
1027
- it('plugin rule-host.ts evaluate method delegates to mergeDecisions', async () => {
1028
- const { readFileSync } = await import('node:fs');
1029
- const { resolve } = await import('node:path');
1030
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/rule-host.ts'), 'utf-8');
1031
- expect(src).toContain('const liveDecision = mergeDecisions(');
1032
- expect(src).toContain('return this.evaluateDetailed(input).liveDecision');
1033
- });
1034
- });
1035
- // ── PRI-47: Store layer modularization Phase 1 ──────────────────────────────
1036
- describe('PRI-47 store modularization', () => {
1037
- it('store/task/index.ts exists and re-exports TaskStore + SqliteTaskStore', async () => {
1038
- const { existsSync, readFileSync } = await import('node:fs');
1039
- const { resolve } = await import('node:path');
1040
- const indexPath = resolve(__dirname, '..', 'store', 'task', 'index.ts');
1041
- expect(existsSync(indexPath)).toBe(true);
1042
- const src = readFileSync(indexPath, 'utf-8');
1043
- expect(src).toContain('TaskStore');
1044
- expect(src).toContain('SqliteTaskStore');
1045
- });
1046
- it('store/run/index.ts exists and re-exports RunStore + SqliteRunStore', async () => {
1047
- const { existsSync, readFileSync } = await import('node:fs');
1048
- const { resolve } = await import('node:path');
1049
- const indexPath = resolve(__dirname, '..', 'store', 'run', 'index.ts');
1050
- expect(existsSync(indexPath)).toBe(true);
1051
- const src = readFileSync(indexPath, 'utf-8');
1052
- expect(src).toContain('RunStore');
1053
- expect(src).toContain('SqliteRunStore');
1054
- });
1055
- it('store/commit/index.ts exists and re-exports DiagnosticianCommitter', async () => {
1056
- const { existsSync, readFileSync } = await import('node:fs');
1057
- const { resolve } = await import('node:path');
1058
- const indexPath = resolve(__dirname, '..', 'store', 'commit', 'index.ts');
1059
- expect(existsSync(indexPath)).toBe(true);
1060
- const src = readFileSync(indexPath, 'utf-8');
1061
- expect(src).toContain('DiagnosticianCommitter');
1062
- expect(src).toContain('CommitInput');
1063
- expect(src).toContain('CommitResult');
1064
- });
1065
- it('Phase 1 moved files are NOT in root store/ directory', async () => {
1066
- const { existsSync } = await import('node:fs');
1067
- const { resolve } = await import('node:path');
1068
- const storeDir = resolve(__dirname, '..', 'store');
1069
- // Phase 1: These files should have been moved to subdirectories
1070
- expect(existsSync(resolve(storeDir, 'task-store.ts'))).toBe(false);
1071
- expect(existsSync(resolve(storeDir, 'sqlite-task-store.ts'))).toBe(false);
1072
- expect(existsSync(resolve(storeDir, 'run-store.ts'))).toBe(false);
1073
- expect(existsSync(resolve(storeDir, 'sqlite-run-store.ts'))).toBe(false);
1074
- expect(existsSync(resolve(storeDir, 'diagnostician-committer.ts'))).toBe(false);
1075
- });
1076
- });
1077
- // ── PRI-47: Store layer modularization Phase 2 ──────────────────────────────
1078
- describe('PRI-47 store modularization Phase 2', () => {
1079
- it('store/context/index.ts exists and re-exports ContextAssembler + implementations', async () => {
1080
- const { existsSync, readFileSync } = await import('node:fs');
1081
- const { resolve } = await import('node:path');
1082
- const indexPath = resolve(__dirname, '..', 'store', 'context', 'index.ts');
1083
- expect(existsSync(indexPath)).toBe(true);
1084
- const src = readFileSync(indexPath, 'utf-8');
1085
- expect(src).toContain('ContextAssembler');
1086
- expect(src).toContain('SqliteContextAssembler');
1087
- expect(src).toContain('ResilientContextAssembler');
1088
- });
1089
- it('store/history/index.ts exists and re-exports HistoryQuery + implementations', async () => {
1090
- const { existsSync, readFileSync } = await import('node:fs');
1091
- const { resolve } = await import('node:path');
1092
- const indexPath = resolve(__dirname, '..', 'store', 'history', 'index.ts');
1093
- expect(existsSync(indexPath)).toBe(true);
1094
- const src = readFileSync(indexPath, 'utf-8');
1095
- expect(src).toContain('HistoryQuery');
1096
- expect(src).toContain('SqliteHistoryQuery');
1097
- expect(src).toContain('ResilientHistoryQuery');
1098
- });
1099
- it('store/trajectory/index.ts exists and re-exports TrajectoryLocator + implementation', async () => {
1100
- const { existsSync, readFileSync } = await import('node:fs');
1101
- const { resolve } = await import('node:path');
1102
- const indexPath = resolve(__dirname, '..', 'store', 'trajectory', 'index.ts');
1103
- expect(existsSync(indexPath)).toBe(true);
1104
- const src = readFileSync(indexPath, 'utf-8');
1105
- expect(src).toContain('TrajectoryLocator');
1106
- expect(src).toContain('SqliteTrajectoryLocator');
1107
- });
1108
- it('store/lifecycle/index.ts exists and re-exports lease/retry/recovery', async () => {
1109
- const { existsSync, readFileSync } = await import('node:fs');
1110
- const { resolve } = await import('node:path');
1111
- const indexPath = resolve(__dirname, '..', 'store', 'lifecycle', 'index.ts');
1112
- expect(existsSync(indexPath)).toBe(true);
1113
- const src = readFileSync(indexPath, 'utf-8');
1114
- expect(src).toContain('LeaseManager');
1115
- expect(src).toContain('DefaultLeaseManager');
1116
- expect(src).toContain('DefaultRetryPolicy');
1117
- expect(src).toContain('DefaultRecoverySweep');
1118
- });
1119
- it('Phase 2 moved files are NOT in root store/ directory', async () => {
1120
- const { existsSync } = await import('node:fs');
1121
- const { resolve } = await import('node:path');
1122
- const storeDir = resolve(__dirname, '..', 'store');
1123
- // Phase 2: context
1124
- expect(existsSync(resolve(storeDir, 'context-assembler.ts'))).toBe(false);
1125
- expect(existsSync(resolve(storeDir, 'sqlite-context-assembler.ts'))).toBe(false);
1126
- expect(existsSync(resolve(storeDir, 'resilient-context-assembler.ts'))).toBe(false);
1127
- // Phase 2: history
1128
- expect(existsSync(resolve(storeDir, 'history-query.ts'))).toBe(false);
1129
- expect(existsSync(resolve(storeDir, 'sqlite-history-query.ts'))).toBe(false);
1130
- expect(existsSync(resolve(storeDir, 'resilient-history-query.ts'))).toBe(false);
1131
- // Phase 2: trajectory
1132
- expect(existsSync(resolve(storeDir, 'trajectory-locator.ts'))).toBe(false);
1133
- expect(existsSync(resolve(storeDir, 'sqlite-trajectory-locator.ts'))).toBe(false);
1134
- // Phase 2: lifecycle
1135
- expect(existsSync(resolve(storeDir, 'lease-manager.ts'))).toBe(false);
1136
- expect(existsSync(resolve(storeDir, 'retry-policy.ts'))).toBe(false);
1137
- expect(existsSync(resolve(storeDir, 'recovery-sweep.ts'))).toBe(false);
1138
- });
1139
- it('barrel still exports all store symbols', async () => {
1140
- const mod = (await import('../index.js'));
1141
- const storeSymbols = [
1142
- 'SqliteTaskStore', 'SqliteRunStore', 'SqliteConnection',
1143
- 'SqliteTrajectoryLocator', 'SqliteHistoryQuery', 'SqliteContextAssembler',
1144
- 'SqliteDiagnosticianCommitter',
1145
- 'ResilientContextAssembler', 'ResilientHistoryQuery',
1146
- 'DefaultLeaseManager', 'DefaultRetryPolicy', 'DefaultRecoverySweep',
1147
- 'StoreEventEmitter', 'storeEmitter',
1148
- 'RuntimeStateManager',
1149
- 'DEFAULT_HISTORY_PAGE_SIZE', 'MAX_HISTORY_PAGE_SIZE', 'DEFAULT_TIME_WINDOW_MS',
1150
- ];
1151
- for (const sym of storeSymbols) {
1152
- expect(mod).toHaveProperty(sym);
1153
- }
1154
- });
1155
- it('barrel exports Memory*Store test doubles', async () => {
1156
- const mod = (await import('../index.js'));
1157
- const memoryStores = [
1158
- 'MemoryTaskStore', 'MemoryRunStore', 'MemoryCommitStore',
1159
- 'MemoryCandidateStore', 'MemoryArtifactStore',
1160
- ];
1161
- for (const sym of memoryStores) {
1162
- expect(mod).toHaveProperty(sym);
1163
- }
1164
- });
1165
- });
1166
- // ── PRI-51: Lifecycle type extraction ────────────────────────────────────────
1167
- describe('PRI-51 lifecycle type extraction', () => {
1168
- const LIFECYCLE_TYPES = [
1169
- 'LifecycleClassificationTotals',
1170
- 'RuleReplayEvidence',
1171
- 'RuleLiveEvidence',
1172
- 'RuleLineageEvidence',
1173
- 'ImplementationLifecycleEvidence',
1174
- 'RuleLifecycleEvidence',
1175
- 'PrincipleLifecycleEvidence',
1176
- 'LifecycleReadModel',
1177
- ];
1178
- const ENUM_TYPES = [
1179
- 'PrinciplePriority',
1180
- 'PrincipleEvaluability',
1181
- 'RuleType',
1182
- 'RuleStatus',
1183
- 'ImplementationLifecycleState',
1184
- 'ImplementationType',
1185
- 'SampleClassification',
1186
- ];
1187
- it('core exports all lifecycle types from barrel', async () => {
1188
- const { readFileSync } = await import('node:fs');
1189
- const { resolve } = await import('node:path');
1190
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1191
- for (const name of LIFECYCLE_TYPES) {
1192
- expect(src).toContain(name);
1193
- }
1194
- });
1195
- it('core exports all enum types from barrel', async () => {
1196
- const { readFileSync } = await import('node:fs');
1197
- const { resolve } = await import('node:path');
1198
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1199
- for (const name of ENUM_TYPES) {
1200
- expect(src).toContain(name);
1201
- }
1202
- });
1203
- it('lifecycle-types.ts has zero infrastructure imports', async () => {
1204
- const { readFileSync } = await import('node:fs');
1205
- const { resolve } = await import('node:path');
1206
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-types.ts'), 'utf-8');
1207
- expect(src).not.toContain('node:fs');
1208
- expect(src).not.toContain('node:path');
1209
- expect(src).not.toContain('openclaw-plugin');
1210
- });
1211
- it('plugin lifecycle-read-model.ts re-exports types from core', async () => {
1212
- const { readFileSync } = await import('node:fs');
1213
- const { resolve } = await import('node:path');
1214
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/lifecycle-read-model.ts'), 'utf-8');
1215
- expect(src).toContain('@principles/core/runtime-v2');
1216
- expect(src).toContain('buildLifecycleReadModel');
1217
- });
1218
- it('plugin principle-tree-schema.ts re-exports enums from core', async () => {
1219
- const { readFileSync } = await import('node:fs');
1220
- const { resolve } = await import('node:path');
1221
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
1222
- expect(src).toContain("from '@principles/core/runtime-v2'");
1223
- // Should no longer define these locally
1224
- expect(src).not.toMatch(/^export type PrinciplePriority = /m);
1225
- expect(src).not.toMatch(/^export type RuleType = /m);
1226
- });
1227
- it('plugin principle-tree-schema.ts re-exports Rule and Implementation from core (no local re-definition)', async () => {
1228
- const { readFileSync } = await import('node:fs');
1229
- const { resolve } = await import('node:path');
1230
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
1231
- expect(src).toContain("Rule");
1232
- expect(src).toContain("Implementation");
1233
- expect(src).not.toMatch(/^export interface Rule \{/m);
1234
- expect(src).not.toMatch(/^export interface Implementation \{/m);
1235
- });
1236
- });
1237
- // ── PRI-52: Lifecycle metrics extraction ──────────────────────────────────────
1238
- describe('PRI-52 lifecycle metrics', () => {
1239
- it('core exports all lifecycle metrics from barrel', async () => {
1240
- const { readFileSync } = await import('node:fs');
1241
- const { resolve } = await import('node:path');
1242
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1243
- expect(src).toContain('RuleMetricResult');
1244
- expect(src).toContain('PrincipleAdherenceResult');
1245
- expect(src).toContain('computeRuleMetrics');
1246
- expect(src).toContain('computePrincipleAdherence');
1247
- });
1248
- it('lifecycle-metrics.ts has zero infrastructure imports', async () => {
1249
- const { readFileSync } = await import('node:fs');
1250
- const { resolve } = await import('node:path');
1251
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-metrics.ts'), 'utf-8');
1252
- expect(src).not.toContain('node:fs');
1253
- expect(src).not.toContain('node:path');
1254
- expect(src).not.toContain('openclaw-plugin');
1255
- });
1256
- it('plugin principle-lifecycle-service.ts imports lifecycle metrics from core barrel', async () => {
1257
- const { readFileSync } = await import('node:fs');
1258
- const { resolve } = await import('node:path');
1259
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
1260
- expect(src).toContain("from '@principles/core/runtime-v2'");
1261
- expect(src).toContain('computeRuleMetrics');
1262
- expect(src).toContain('computePrincipleAdherence');
1263
- });
1264
- });
1265
- // ── PRI-53: Deprecated readiness extraction ──────────────────────────────────
1266
- describe('PRI-53 deprecated readiness', () => {
1267
- it('core exports all readiness types/functions from barrel', async () => {
1268
- const { readFileSync } = await import('node:fs');
1269
- const { resolve } = await import('node:path');
1270
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1271
- expect(src).toContain('DeprecatedReadinessStatus');
1272
- expect(src).toContain('DeprecatedReadinessAssessment');
1273
- expect(src).toContain('assessDeprecatedReadiness');
1274
- });
1275
- it('deprecated-readiness.ts has zero infrastructure imports', async () => {
1276
- const { readFileSync } = await import('node:fs');
1277
- const { resolve } = await import('node:path');
1278
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'deprecated-readiness.ts'), 'utf-8');
1279
- expect(src).not.toContain('node:fs');
1280
- expect(src).not.toContain('node:path');
1281
- expect(src).not.toContain('openclaw-plugin');
1282
- });
1283
- it('plugin principle-lifecycle-service.ts imports deprecated readiness from core barrel', async () => {
1284
- const { readFileSync } = await import('node:fs');
1285
- const { resolve } = await import('node:path');
1286
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
1287
- expect(src).toContain("from '@principles/core/runtime-v2'");
1288
- expect(src).toContain('assessDeprecatedReadiness');
1289
- expect(src).toContain('DeprecatedReadinessAssessment');
1290
- });
1291
- });
1292
- // ── PRI-54: Routing policy extraction ──────────────────────────────────────────
1293
- describe('PRI-54 routing policy', () => {
1294
- it('core exports all routing policy types/functions from barrel', async () => {
1295
- const { readFileSync } = await import('node:fs');
1296
- const { resolve } = await import('node:path');
1297
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1298
- expect(src).toContain('LifecycleRoute');
1299
- expect(src).toContain('LifecycleRouteRecommendation');
1300
- expect(src).toContain('LifecycleRouteEvidenceSummary');
1301
- expect(src).toContain('recommendLifecycleRoute');
1302
- });
1303
- it('routing-policy.ts has zero infrastructure imports', async () => {
1304
- const { readFileSync } = await import('node:fs');
1305
- const { resolve } = await import('node:path');
1306
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'routing-policy.ts'), 'utf-8');
1307
- expect(src).not.toContain('node:fs');
1308
- expect(src).not.toContain('node:path');
1309
- expect(src).not.toContain('openclaw-plugin');
1310
- });
1311
- it('plugin principle-lifecycle-service.ts imports routing policy from core barrel', async () => {
1312
- const { readFileSync } = await import('node:fs');
1313
- const { resolve } = await import('node:path');
1314
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
1315
- expect(src).toContain("from '@principles/core/runtime-v2'");
1316
- expect(src).toContain('recommendLifecycleRoute');
1317
- expect(src).toContain('LifecycleRouteRecommendation');
1318
- });
1319
- });
1320
- // ── PRI-56: LifecycleDatasource adapter boundary ──────────────────────────────
1321
- describe('PRI-56 LifecycleDatasource adapter boundary', () => {
1322
- it('core exports LifecycleDatasource + buildLifecycleReadModel from barrel', async () => {
1323
- const { readFileSync } = await import('node:fs');
1324
- const { resolve } = await import('node:path');
1325
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1326
- expect(src).toContain('LifecycleDatasource');
1327
- expect(src).toContain('buildLifecycleReadModel');
1328
- });
1329
- it('lifecycle-datasource.ts has zero infrastructure imports', async () => {
1330
- const { readFileSync } = await import('node:fs');
1331
- const { resolve } = await import('node:path');
1332
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-datasource.ts'), 'utf-8');
1333
- expect(src).not.toContain('node:fs');
1334
- expect(src).not.toContain('node:path');
1335
- expect(src).not.toContain('openclaw-plugin');
1336
- });
1337
- it('lifecycle-read-model.ts has zero infrastructure imports', async () => {
1338
- const { readFileSync } = await import('node:fs');
1339
- const { resolve } = await import('node:path');
1340
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'lifecycle-read-model.ts'), 'utf-8');
1341
- expect(src).not.toContain('node:fs');
1342
- expect(src).not.toContain('node:path');
1343
- expect(src).not.toContain('openclaw-plugin');
1344
- });
1345
- it('plugin lifecycle-read-model.ts re-exports from core and provides FilesystemLifecycleDatasource', async () => {
1346
- const { readFileSync } = await import('node:fs');
1347
- const { resolve } = await import('node:path');
1348
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/lifecycle-read-model.ts'), 'utf-8');
1349
- expect(src).toContain("from '@principles/core/runtime-v2'");
1350
- expect(src).toContain('buildLifecycleReadModel');
1351
- expect(src).toContain('FilesystemLifecycleDatasource');
1352
- });
1353
- it('plugin principle-lifecycle-service.ts delegates buildReadModel via datasource', async () => {
1354
- const { readFileSync } = await import('node:fs');
1355
- const { resolve } = await import('node:path');
1356
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-internalization/principle-lifecycle-service.ts'), 'utf-8');
1357
- expect(src).toContain('FilesystemLifecycleDatasource');
1358
- expect(src).toContain('buildLifecycleReadModel');
1359
- });
1360
- });
1361
- // ── PRI-61: Internalization Peer Runner Contracts ─────────────────────────────
1362
- describe('PRI-61 Internalization Peer Runner Contracts', () => {
1363
- it('core barrel exports PITaskRecord and related types', async () => {
1364
- const { readFileSync } = await import('node:fs');
1365
- const { resolve } = await import('node:path');
1366
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1367
- expect(src).toContain('PITaskRecord');
1368
- expect(src).toContain('PeerRunnerKind');
1369
- expect(src).toContain('InternalizationChannel');
1370
- expect(src).toContain('PIArtifact');
1371
- });
1372
- it('core barrel exports job graph functions', async () => {
1373
- const { readFileSync } = await import('node:fs');
1374
- const { resolve } = await import('node:path');
1375
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1376
- expect(src).toContain('validateEdge');
1377
- expect(src).toContain('isAcyclic');
1378
- expect(src).toContain('getAllowedSuccessors');
1379
- expect(src).toContain('ALLOWED_EDGES');
1380
- });
1381
- it('peer-runner-contracts.ts has zero infrastructure imports', async () => {
1382
- const { readFileSync } = await import('node:fs');
1383
- const { resolve } = await import('node:path');
1384
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'peer-runner-contracts.ts'), 'utf-8');
1385
- expect(src).not.toContain('node:fs');
1386
- expect(src).not.toContain('node:path');
1387
- expect(src).not.toContain('openclaw-plugin');
1388
- expect(src).not.toContain('node:cron');
1389
- });
1390
- it('internalization-job-graph.ts has zero infrastructure imports', async () => {
1391
- const { readFileSync } = await import('node:fs');
1392
- const { resolve } = await import('node:path');
1393
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-job-graph.ts'), 'utf-8');
1394
- expect(src).not.toContain('node:fs');
1395
- expect(src).not.toContain('node:path');
1396
- expect(src).not.toContain('openclaw-plugin');
1397
- expect(src).not.toContain('node:cron');
1398
- });
1399
- it('TASK_MODEL_REUSE: PITaskRecord extends TaskRecord (type-level check)', async () => {
1400
- // PITaskRecord is an interface (type-only export). Type-level check:
1401
- // if PITaskRecord didn't extend TaskRecord, TypeScript would error in the
1402
- // peer-runner-contracts.ts definition at compile time.
1403
- // We verify the module exports the type by checking the source file.
1404
- const { readFileSync } = await import('node:fs');
1405
- const { resolve } = await import('node:path');
1406
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'peer-runner-contracts.ts'), 'utf-8');
1407
- // If PITaskRecord doesn't extend TaskRecord, this interface definition would fail
1408
- expect(src).toContain('interface PITaskRecord extends TaskRecord');
1409
- });
1410
- it('PEER_NO_DIRECT_CHAINING: job graph defines edge validation only, no execution', async () => {
1411
- const { validateEdge, ALLOWED_EDGES } = await import('../internalization/internalization-job-graph.js');
1412
- // validateEdge is a pure function — no side effects, no execution
1413
- expect(typeof validateEdge).toBe('function');
1414
- expect(Array.isArray(ALLOWED_EDGES)).toBe(true);
1415
- // Edge validation is read-only — no task creation or state mutation
1416
- const result = validateEdge('dreamer', 'philosopher');
1417
- expect(typeof result).toBe('boolean');
1418
- });
1419
- });
1420
- // ── PRI-62: Internalization State Machine Guards ─────────────────────────────
1421
- describe('PRI-62 Internalization State Machine Guards', () => {
1422
- it('core barrel exports state machine guard functions', async () => {
1423
- const { readFileSync } = await import('node:fs');
1424
- const { resolve } = await import('node:path');
1425
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1426
- expect(src).toContain('validateInternalizationTaskReady');
1427
- expect(src).toContain('validateTaskTransition');
1428
- expect(src).toContain('decideArtifactRejectionFeedback');
1429
- expect(src).toContain('createNextTaskProposal');
1430
- expect(src).toContain('validateInternalizationGraph');
1431
- });
1432
- it('core barrel exports guard utility functions', async () => {
1433
- const { readFileSync } = await import('node:fs');
1434
- const { resolve } = await import('node:path');
1435
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1436
- expect(src).toContain('canAcquireLease');
1437
- expect(src).toContain('areDependenciesMet');
1438
- expect(src).toContain('canTransitionTo');
1439
- expect(src).toContain('isResultRefImmutable');
1440
- expect(src).toContain('canUpdateLastError');
1441
- expect(src).toContain('isArtifactRejected');
1442
- });
1443
- it('internalization-task-guards.ts has zero infrastructure imports', async () => {
1444
- const { readFileSync } = await import('node:fs');
1445
- const { resolve } = await import('node:path');
1446
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-task-guards.ts'), 'utf-8');
1447
- expect(src).not.toContain('node:fs');
1448
- expect(src).not.toContain('node:path');
1449
- expect(src).not.toContain('openclaw-plugin');
1450
- expect(src).not.toContain('node:cron');
1451
- });
1452
- it('internalization-state-machine.ts has zero infrastructure imports', async () => {
1453
- const { readFileSync } = await import('node:fs');
1454
- const { resolve } = await import('node:path');
1455
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-state-machine.ts'), 'utf-8');
1456
- expect(src).not.toContain('node:fs');
1457
- expect(src).not.toContain('node:path');
1458
- expect(src).not.toContain('openclaw-plugin');
1459
- expect(src).not.toContain('node:cron');
1460
- });
1461
- it('TASK_MODEL_REUSE: guard functions work with PITaskRecord (type-level check)', async () => {
1462
- // If PITaskRecord didn't properly extend TaskRecord, TypeScript would error
1463
- // at compile time in peer-runner-contracts.ts and internalization-task-guards.ts
1464
- const { readFileSync } = await import('node:fs');
1465
- const { resolve } = await import('node:path');
1466
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-task-guards.ts'), 'utf-8');
1467
- expect(src).toContain('task: PITaskRecord');
1468
- });
1469
- it('PEER_NO_DIRECT_CHAINING: state machine returns proposals, not execute calls', async () => {
1470
- const { createNextTaskProposal } = await import('../internalization/internalization-state-machine.js');
1471
- // Pure function — returns an object, no side effects
1472
- const { createMinimalPITaskRecord } = await import('../internalization/peer-runner-contracts.js');
1473
- const task = createMinimalPITaskRecord('t1', 'dreamer', 'prompt');
1474
- task.status = 'succeeded';
1475
- task.outputArtifactRefs = [];
1476
- const result = createNextTaskProposal(task, []);
1477
- expect(result === null || typeof result === 'object').toBe(true);
1478
- });
1479
- });
1480
- describe('PRI-68 InternalizationOrchestrator', () => {
1481
- it('orchestrator source file exists in internalization directory', async () => {
1482
- const { existsSync } = await import('node:fs');
1483
- const { resolve } = await import('node:path');
1484
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'internalization-orchestrator.ts'))).toBe(true);
1485
- });
1486
- it('orchestrator test file exists', async () => {
1487
- const { existsSync } = await import('node:fs');
1488
- const { resolve } = await import('node:path');
1489
- expect(existsSync(resolve(__dirname, '..', '__tests__', 'internalization-orchestrator.test.ts'))).toBe(true);
1490
- });
1491
- it('CORE_NO_SCHEDULING: orchestrator has zero infrastructure imports', async () => {
1492
- const { readFileSync } = await import('node:fs');
1493
- const { resolve } = await import('node:path');
1494
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-orchestrator.ts'), 'utf-8');
1495
- expect(src).not.toContain('openclaw-plugin');
1496
- expect(src).not.toContain('node:cron');
1497
- expect(src).not.toContain('setInterval');
1498
- expect(src).not.toContain('setTimeout');
1499
- expect(src).not.toContain('node:fs');
1500
- expect(src).not.toContain('node:path');
1501
- });
1502
- it('CORE_NO_RUNTIME_ADAPTER: orchestrator does not import PDRuntimeAdapter or startRun', async () => {
1503
- const { readFileSync } = await import('node:fs');
1504
- const { resolve } = await import('node:path');
1505
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-orchestrator.ts'), 'utf-8');
1506
- expect(src).not.toContain('PDRuntimeAdapter');
1507
- expect(src).not.toContain('startRun');
1508
- expect(src).not.toContain('DiagnosticianRunner');
1509
- });
1510
- it('BARREL_EXPORTS: internalization/index.ts exports InternalizationOrchestrator and result types', async () => {
1511
- const { readFileSync } = await import('node:fs');
1512
- const { resolve } = await import('node:path');
1513
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
1514
- expect(src).toContain('InternalizationOrchestrator');
1515
- expect(src).toContain('WakeOnceResult');
1516
- expect(src).toContain('LeaseConflictResult');
1517
- });
1518
- });
1519
- describe('PRI-67 DreamerRunner', () => {
1520
- it('dreamer source files exist in internalization directory', async () => {
1521
- const { existsSync } = await import('node:fs');
1522
- const { resolve } = await import('node:path');
1523
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'))).toBe(true);
1524
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'dreamer-output.ts'))).toBe(true);
1525
- });
1526
- it('dreamer test file exists', async () => {
1527
- const { existsSync } = await import('node:fs');
1528
- const { resolve } = await import('node:path');
1529
- expect(existsSync(resolve(__dirname, '..', '__tests__', 'dreamer-runner.test.ts'))).toBe(true);
1530
- });
1531
- it('CORE_NO_FORBIDDEN_IMPORTS: dreamer-runner.ts has no openclaw-plugin, nocturnal-trinity, philosopher, scribe imports', async () => {
1532
- const { readFileSync } = await import('node:fs');
1533
- const { resolve } = await import('node:path');
1534
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'), 'utf-8');
1535
- expect(src).not.toContain('openclaw-plugin');
1536
- expect(src).not.toContain('nocturnal-trinity');
1537
- expect(src).not.toContain('runTrinity');
1538
- expect(src).not.toContain('philosopher');
1539
- expect(src).not.toContain('scribe');
1540
- expect(src).not.toContain('InternalizationOrchestrator');
1541
- expect(src).not.toContain('createTask');
1542
- expect(src).not.toContain('enqueueTask');
1543
- });
1544
- it('CORE_NO_SCHEDULING: dreamer-runner.ts has no node:fs, node:cron, or cron-style scheduling', async () => {
1545
- const { readFileSync } = await import('node:fs');
1546
- const { resolve } = await import('node:path');
1547
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'), 'utf-8');
1548
- expect(src).not.toContain('node:fs');
1549
- expect(src).not.toContain('node:cron');
1550
- // setTimeout for sleep() in polling loop is allowed — no cron/interval scheduling
1551
- });
1552
- it('USES_RUNTIME_ADAPTER: dreamer-runner.ts imports and uses PDRuntimeAdapter', async () => {
1553
- const { readFileSync } = await import('node:fs');
1554
- const { resolve } = await import('node:path');
1555
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-runner.ts'), 'utf-8');
1556
- expect(src).toContain('PDRuntimeAdapter');
1557
- expect(src).toContain('startRun');
1558
- });
1559
- it('BARREL_EXPORTS: internalization/index.ts exports DreamerRunner and DreamerOutput', async () => {
1560
- const { readFileSync } = await import('node:fs');
1561
- const { resolve } = await import('node:path');
1562
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
1563
- expect(src).toContain('DreamerRunner');
1564
- expect(src).toContain('DreamerOutput');
1565
- expect(src).toContain('PassThroughDreamerValidator');
1566
- expect(src).toContain('DefaultDreamerValidator');
1567
- });
1568
- });
1569
- // ── PRI-87: DefaultDreamerValidator strict validation ───────────────────────────
1570
- describe('PRI-87 DefaultDreamerValidator strict validation', () => {
1571
- it('CORE_NO_FORBIDDEN_IMPORTS: dreamer-output.ts has no openclaw-plugin, nocturnal, fs, path, process imports', async () => {
1572
- const { readFileSync } = await import('node:fs');
1573
- const { resolve } = await import('node:path');
1574
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'dreamer-output.ts'), 'utf-8');
1575
- expect(src).not.toContain('openclaw-plugin');
1576
- expect(src).not.toContain('nocturnal');
1577
- expect(src).not.toContain('node:fs');
1578
- expect(src).not.toContain('node:path');
1579
- expect(src).not.toContain('node:process');
1580
- });
1581
- it('PRODUCTION_USES_STRICT_VALIDATOR: run-once CLI uses DefaultDreamerValidator, not PassThroughDreamerValidator', async () => {
1582
- const { readFileSync } = await import('node:fs');
1583
- const { resolve } = await import('node:path');
1584
- const src = readFileSync(resolve(__dirname, '..', '..', '..', '..', 'pd-cli', 'src', 'commands', 'runtime-internalization-run-once.ts'), 'utf-8');
1585
- expect(src).toContain('DefaultDreamerValidator');
1586
- expect(src).not.toContain('new PassThroughDreamerValidator()');
1587
- });
1588
- it('BARREL_EXPORTS: DefaultDreamerValidator is exported from internalization/index.ts', async () => {
1589
- const { readFileSync } = await import('node:fs');
1590
- const { resolve } = await import('node:path');
1591
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
1592
- expect(src).toContain('DefaultDreamerValidator');
1593
- });
1594
- it('validator test file exists', async () => {
1595
- const { existsSync } = await import('node:fs');
1596
- const { resolve } = await import('node:path');
1597
- expect(existsSync(resolve(__dirname, '..', '__tests__', 'dreamer-output-validator.test.ts'))).toBe(true);
1598
- });
1599
- });
1600
- // ── PRI-75/PRI-74/PRI-81: Prompt-builder core boundary ─────────────────────────────────
1601
- describe('PRI-75/PRI-74/PRI-81 prompt-builder core boundary', () => {
1602
- const files = [
1603
- 'prompt-builder/index.ts',
1604
- 'prompt-builder/attitude-directive.ts',
1605
- 'prompt-builder/correction-cue.ts',
1606
- 'prompt-builder/message-extraction.ts',
1607
- 'prompt-builder/minimal-trigger.ts',
1608
- 'prompt-builder/size-guard.ts',
1609
- 'prompt-builder/types.ts',
1610
- 'prompt-builder/principle-selection.ts',
1611
- // PRI-74
1612
- 'prompt-builder/routing-guidance.ts',
1613
- // PRI-81 Phase A
1614
- 'prompt-builder/empathy-keyword-matching.ts',
1615
- 'prompt-builder/empathy-types.ts',
1616
- // PRI-81 Phase B
1617
- 'prompt-builder/focus-compression.ts',
1618
- ];
1619
- for (const file of files) {
1620
- it(`${file} has zero infrastructure imports`, async () => {
1621
- const { readFileSync } = await import('node:fs');
1622
- const { resolve } = await import('node:path');
1623
- const src = readFileSync(resolve(__dirname, '../..', file), 'utf-8');
1624
- expect(src).not.toContain('node:fs');
1625
- expect(src).not.toContain('node:path');
1626
- expect(src).not.toContain('node:process');
1627
- expect(src).not.toContain('openclaw-plugin');
1628
- });
1629
- }
1630
- it('prompt-builder/index.ts exports all functions', async () => {
1631
- const { readFileSync } = await import('node:fs');
1632
- const { resolve } = await import('node:path');
1633
- const src = readFileSync(resolve(__dirname, '../..', 'prompt-builder/index.ts'), 'utf-8');
1634
- // Phase 1
1635
- expect(src).toContain('buildAttitudeDirective');
1636
- expect(src).toContain('detectCorrectionCue');
1637
- expect(src).toContain('extractMessageContent');
1638
- expect(src).toContain('isMinimalTrigger');
1639
- expect(src).toContain('truncateInjectionToBudget');
1640
- // Phase 2
1641
- expect(src).toContain('formatPrinciple');
1642
- expect(src).toContain('selectPrinciplesForInjection');
1643
- expect(src).toContain('DEFAULT_PRINCIPLE_BUDGET');
1644
- // PRI-74 routing guidance
1645
- expect(src).toContain('classifyTaskKind');
1646
- expect(src).toContain('buildReason');
1647
- expect(src).toContain('buildBlockers');
1648
- expect(src).toContain('computeCombinedText');
1649
- expect(src).toContain('containsKeyword');
1650
- // PRI-81 Phase A: empathy keyword matching
1651
- expect(src).toContain('matchEmpathyKeywords');
1652
- expect(src).toContain('createDefaultKeywordStore');
1653
- expect(src).toContain('applyKeywordUpdates');
1654
- expect(src).toContain('shouldTriggerOptimization');
1655
- expect(src).toContain('getKeywordStoreSummary');
1656
- expect(src).toContain('EMPATHY_SEED_KEYWORDS');
1657
- expect(src).toContain('DEFAULT_EMPATHY_KEYWORD_CONFIG');
1658
- expect(src).toContain('scoreToSeverity');
1659
- expect(src).toContain('severityToPenalty');
1660
- expect(src).toContain('normalizeSeverity');
1661
- // PRI-81 Phase B: focus compression
1662
- expect(src).toContain('extractVersion');
1663
- expect(src).toContain('extractDate');
1664
- expect(src).toContain('extractSummary');
1665
- expect(src).toContain('parseWorkingMemorySection');
1666
- expect(src).toContain('workingMemoryToInjection');
1667
- expect(src).toContain('extractMilestones');
1668
- expect(src).toContain('validateCurrentFocus');
1669
- expect(src).toContain('mergeWorkingMemory');
1670
- expect(src).toContain('compressFocusContent');
1671
- expect(src).toContain('DEFAULT_FOCUS_COMPRESSION_OPTIONS');
1672
- });
1673
- it('principle-selection.ts does not import EvolutionReducer or WorkspaceContext', async () => {
1674
- const { readFileSync } = await import('node:fs');
1675
- const { resolve } = await import('node:path');
1676
- const src = readFileSync(resolve(__dirname, '../..', 'prompt-builder/principle-selection.ts'), 'utf-8');
1677
- expect(src).not.toContain('EvolutionReducer');
1678
- expect(src).not.toContain('WorkspaceContext');
1679
- });
1680
- it('plugin principle-injection.ts is a thin re-export of core', async () => {
1681
- const { readFileSync } = await import('node:fs');
1682
- const { resolve } = await import('node:path');
1683
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/principle-injection.ts'), 'utf-8');
1684
- // Must re-export from core
1685
- expect(src).toContain('@principles/core/prompt-builder');
1686
- // Must NOT contain inline selectPrinciplesForInjection implementation
1687
- expect(src).not.toMatch(/function selectPrinciplesForInjection/i);
1688
- // Must NOT contain priority sorting logic
1689
- expect(src).not.toMatch(/PRIORITY_ORDER/i);
1690
- });
1691
- it('plugin prompt.ts imports from @principles/core/prompt-builder', async () => {
1692
- const { readFileSync } = await import('node:fs');
1693
- const { resolve } = await import('node:path');
1694
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/hooks/prompt.ts'), 'utf-8');
1695
- expect(src).toContain('@principles/core/prompt-builder');
1696
- });
1697
- it('plugin prompt.ts uses core truncateInjectionToBudget, not inline priority stripping', async () => {
1698
- const { readFileSync } = await import('node:fs');
1699
- const { resolve } = await import('node:path');
1700
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/hooks/prompt.ts'), 'utf-8');
1701
- // Must call the core function
1702
- expect(src).toMatch(/truncateInjectionToBudget\s*\(/);
1703
- // Must NOT have inline priority stripping comment markers (old step comments)
1704
- expect(src).not.toMatch(/\/\/ Step \d+.*strip (project_context|thinking_os|evolution_principles|reflection_log)/i);
1705
- // Must NOT have inline regex-based fallback context block (the strip-by-regex pattern)
1706
- expect(src).not.toMatch(/<reflection_log>\[\\s\\S\]\*?<\/reflection_log>/);
1707
- // Must NOT have the old multi-line fallback block with attitudeDirective interpolation
1708
- expect(src).not.toMatch(/## 【CONTEXT SECTIONS】\n\n\[WARNING: Context sections stripped/);
1709
- });
1710
- it('plugin prompt-helpers.ts imports escapeXml from core, not reimplemented', async () => {
1711
- const { readFileSync } = await import('node:fs');
1712
- const { resolve } = await import('node:path');
1713
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/hooks/prompt-helpers.ts'), 'utf-8');
1714
- // Must import escapeXml from core
1715
- expect(src).toContain('@principles/core/prompt-builder');
1716
- expect(src).toMatch(/import\s*\{[^}]*escapeXml[^}]*\}\s*from\s*['"]@principles\/core\/prompt-builder['"]/);
1717
- // Must NOT reimplement escapeXml inline
1718
- expect(src).not.toMatch(/\b(function\s+escapeXml\s*\(|const\s+escapeXml\s*=\s*(?:async\s*)?(?:\([^)]*\)|[a-zA-Z_$][\w$]*)\s*=>)/);
1719
- });
1720
- it('plugin empathy-keyword-matcher.ts is a thin adapter (re-exports from core)', async () => {
1721
- const { readFileSync } = await import('node:fs');
1722
- const { resolve } = await import('node:path');
1723
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/empathy-keyword-matcher.ts'), 'utf-8');
1724
- expect(src).toContain('@principles/core/prompt-builder');
1725
- expect(src).not.toMatch(/function matchEmpathyKeywords\s*\(/);
1726
- expect(src).not.toMatch(/function createDefaultKeywordStore\s*\(/);
1727
- expect(src).not.toMatch(/function applyKeywordUpdates\s*\(/);
1728
- expect(src).not.toMatch(/function shouldTriggerOptimization\s*\(/);
1729
- expect(src).not.toMatch(/function getKeywordStoreSummary\s*\(/);
1730
- });
1731
- it('plugin empathy-types.ts is a thin re-export (no inline definitions)', async () => {
1732
- const { readFileSync } = await import('node:fs');
1733
- const { resolve } = await import('node:path');
1734
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/empathy-types.ts'), 'utf-8');
1735
- expect(src).toContain('@principles/core/prompt-builder');
1736
- expect(src).not.toMatch(/interface EmpathyKeywordStore/);
1737
- expect(src).not.toMatch(/const EMPATHY_SEED_KEYWORDS/);
1738
- expect(src).not.toMatch(/function scoreToSeverity/);
1739
- });
1740
- it('plugin focus-history.ts delegates pure functions to core', async () => {
1741
- const { readFileSync } = await import('node:fs');
1742
- const { resolve } = await import('node:path');
1743
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/focus-history.ts'), 'utf-8');
1744
- expect(src).toContain('@principles/core/prompt-builder');
1745
- expect(src).not.toMatch(/function extractSummary\s*\(/);
1746
- expect(src).not.toMatch(/function parseWorkingMemorySection\s*\(/);
1747
- expect(src).not.toMatch(/function workingMemoryToInjection\s*\(/);
1748
- expect(src).not.toMatch(/function extractMilestones\s*\(/);
1749
- expect(src).not.toMatch(/function validateCurrentFocus\s*\(/);
1750
- expect(src).not.toMatch(/function mergeWorkingMemory\s*\(/);
1751
- });
1752
- });
1753
- // ── PRI-76: GFI core kernel boundary ───────────────────────────────────────
1754
- describe('PRI-76 GFI core kernel boundary', () => {
1755
- const gfiFiles = [
1756
- 'gfi/gfi-types.ts',
1757
- 'gfi/gfi-policy.ts',
1758
- 'gfi/gfi-kernel.ts',
1759
- 'gfi/gfi-read-model.ts',
1760
- 'gfi/index.ts',
1761
- ];
1762
- for (const file of gfiFiles) {
1763
- it(`${file} has zero infrastructure imports`, async () => {
1764
- const { readFileSync } = await import('node:fs');
1765
- const { resolve } = await import('node:path');
1766
- const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
1767
- expect(src).not.toContain('node:fs');
1768
- expect(src).not.toContain('node:path');
1769
- expect(src).not.toContain('node:process');
1770
- expect(src).not.toContain('openclaw-plugin');
1771
- expect(src).not.toContain('node:crypto');
1772
- expect(src).not.toContain('node:async_hooks');
1773
- });
1774
- }
1775
- // PRI-82: gfi-kernel.ts must not call Date.now() — nowMs is injected by caller
1776
- it('gfi-kernel.ts does not call Date.now()', async () => {
1777
- const { readFileSync } = await import('node:fs');
1778
- const { resolve } = await import('node:path');
1779
- const src = readFileSync(resolve(__dirname, '..', 'gfi/gfi-kernel.ts'), 'utf-8');
1780
- expect(src).not.toContain('Date.now()');
1781
- });
1782
- it('gfi/index.ts exports all public symbols', async () => {
1783
- const { readFileSync } = await import('node:fs');
1784
- const { resolve } = await import('node:path');
1785
- const src = readFileSync(resolve(__dirname, '..', 'gfi/index.ts'), 'utf-8');
1786
- expect(src).toContain('applyFriction');
1787
- expect(src).toContain('applyDecay');
1788
- expect(src).toContain('applyRelief');
1789
- expect(src).toContain('classifyGfiStage');
1790
- expect(src).toContain('createGfiSnapshot');
1791
- expect(src).toContain('DEFAULT_GFI_POLICY');
1792
- expect(src).toContain('GfiState');
1793
- expect(src).toContain('GfiEvent');
1794
- expect(src).toContain('GfiPolicy');
1795
- expect(src).toContain('GfiStage');
1796
- expect(src).toContain('GfiSource');
1797
- expect(src).toContain('GfiSnapshot');
1798
- expect(src).toContain('buildGfiWorkspaceSnapshot');
1799
- expect(src).toContain('GfiReadModelInput');
1800
- expect(src).toContain('GfiWorkspaceSnapshot');
1801
- });
1802
- });
1803
- // ── PRI-78: GFI observability boundary ──────────────────────────────────────
1804
- describe('PRI-78 GFI observability boundary', () => {
1805
- it('gfi-read-model.ts has zero infrastructure imports', async () => {
1806
- const { readFileSync } = await import('node:fs');
1807
- const { resolve } = await import('node:path');
1808
- const src = readFileSync(resolve(__dirname, '..', 'gfi/gfi-read-model.ts'), 'utf-8');
1809
- expect(src).not.toContain('node:fs');
1810
- expect(src).not.toContain('node:path');
1811
- expect(src).not.toContain('node:process');
1812
- expect(src).not.toContain('openclaw-plugin');
1813
- });
1814
- it('pd-cli runtime-gfi-snapshot.ts imports from @principles/core/runtime-v2', async () => {
1815
- const { readFileSync } = await import('node:fs');
1816
- const { resolve } = await import('node:path');
1817
- const src = readFileSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-gfi-snapshot.ts'), 'utf-8');
1818
- expect(src).toContain("from '@principles/core/runtime-v2'");
1819
- });
1820
- });
1821
- // ── PRI-111: ArtificerRunner boundary guards ──────────────────────────────────
1822
- describe('PRI-111 ArtificerRunner boundary', () => {
1823
- it('artificer source files exist in internalization directory', async () => {
1824
- const { existsSync } = await import('node:fs');
1825
- const { resolve } = await import('node:path');
1826
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'artificer-runner.ts'))).toBe(true);
1827
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'artificer-output.ts'))).toBe(true);
1828
- });
1829
- it('artificer test file exists', async () => {
1830
- const { existsSync } = await import('node:fs');
1831
- const { resolve } = await import('node:path');
1832
- expect(existsSync(resolve(__dirname, 'artificer-runner-vslice.test.ts'))).toBe(true);
1833
- });
1834
- it('CORE_NO_FORBIDDEN_IMPORTS: artificer-runner.ts has no openclaw-plugin, evaluator, nocturnal-trinity imports', async () => {
1835
- const { readFileSync } = await import('node:fs');
1836
- const { resolve } = await import('node:path');
1837
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'artificer-runner.ts'), 'utf-8');
1838
- expect(src).not.toContain('openclaw-plugin');
1839
- expect(src).not.toContain('EvaluatorRunner');
1840
- expect(src).not.toContain('nocturnal-trinity');
1841
- expect(src).not.toContain('InternalizationOrchestrator');
1842
- expect(src).not.toContain('createTask');
1843
- expect(src).not.toContain('enqueueTask');
1844
- });
1845
- it('CORE_NO_FORBIDDEN_IMPORTS: artificer-output.ts has no openclaw-plugin, fs, path imports', async () => {
1846
- const { readFileSync } = await import('node:fs');
1847
- const { resolve } = await import('node:path');
1848
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'artificer-output.ts'), 'utf-8');
1849
- expect(src).not.toContain('openclaw-plugin');
1850
- expect(src).not.toContain('node:fs');
1851
- expect(src).not.toContain('node:path');
1852
- });
1853
- it('CORE_NO_SCHEDULING: artificer-runner.ts has no node:fs, node:cron, or cron-style scheduling', async () => {
1854
- const { readFileSync } = await import('node:fs');
1855
- const { resolve } = await import('node:path');
1856
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'artificer-runner.ts'), 'utf-8');
1857
- expect(src).not.toContain('node:fs');
1858
- expect(src).not.toContain('node:cron');
1859
- });
1860
- it('BARREL_EXPORTS: internalization/index.ts exports ArtificerRunner and ArtificerRuleOutput', async () => {
1861
- const { readFileSync } = await import('node:fs');
1862
- const { resolve } = await import('node:path');
1863
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
1864
- expect(src).toContain('ArtificerRunner');
1865
- expect(src).toContain('ArtificerRuleOutput');
1866
- expect(src).toContain('DefaultArtificerValidator');
1867
- });
1868
- it('SCHEMA_REGISTRY: shared output-schema-registry registers unified artificer-rule-output-v2 schema', async () => {
1869
- const { readFileSync } = await import('node:fs');
1870
- const { resolve } = await import('node:path');
1871
- // The registry was extracted to adapter/output-schema-registry.ts (single
1872
- // source of truth shared by pi-ai and openclaw-cli adapters). Assert there.
1873
- const src = readFileSync(resolve(__dirname, '..', 'adapter', 'output-schema-registry.ts'), 'utf-8');
1874
- expect(src).toContain('artificer-rule-output-v2');
1875
- expect(src).not.toContain('artificer-rule-output-v1');
1876
- expect(src).toContain('ArtificerRuleOutputSchema');
1877
- });
1878
- });
1879
- // ── PRI-458: PhilosopherRunner barrel boundary (MVP-Quiet) ─────────────────────
1880
- describe('PRI-458 PhilosopherRunner barrel boundary', () => {
1881
- it('BARREL_EXPORTS: internalization/index.ts does NOT export PhilosopherRunner (PRI-458 MVP-Quiet)', async () => {
1882
- // PRI-458: PhilosopherRunner is de-surfaced from the internal barrel (MVP-Quiet).
1883
- // It remains in runtime-v2/index.ts (public barrel) because rulehost-pipeline-runner.ts
1884
- // imports it from there (EP-02 exception).
1885
- const { readFileSync } = await import('node:fs');
1886
- const { resolve } = await import('node:path');
1887
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
1888
- expect(src).not.toContain("from './philosopher-runner.js'");
1889
- expect(src).not.toContain("from './philosopher-output.js'");
1890
- });
1891
- });
1892
- // ── PRI-EVAL: EvaluatorRunner boundary guards ──────────────────────────────────
1893
- describe('PRI-EVAL EvaluatorRunner boundary', () => {
1894
- it('evaluator source files exist in internalization directory', async () => {
1895
- const { existsSync } = await import('node:fs');
1896
- const { resolve } = await import('node:path');
1897
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'evaluator-runner.ts'))).toBe(true);
1898
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'evaluator-output.ts'))).toBe(true);
1899
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'evaluator-prompt-builder.ts'))).toBe(true);
1900
- });
1901
- it('evaluator test file exists', async () => {
1902
- const { existsSync } = await import('node:fs');
1903
- const { resolve } = await import('node:path');
1904
- expect(existsSync(resolve(__dirname, 'evaluator-runner-vslice.test.ts'))).toBe(true);
1905
- });
1906
- it('CORE_NO_FORBIDDEN_IMPORTS: evaluator-output.ts has no openclaw-plugin, fs, path imports', async () => {
1907
- const { readFileSync } = await import('node:fs');
1908
- const { resolve } = await import('node:path');
1909
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'evaluator-output.ts'), 'utf-8');
1910
- expect(src).not.toContain('openclaw-plugin');
1911
- expect(src).not.toContain('node:fs');
1912
- expect(src).not.toContain('node:path');
1913
- });
1914
- it('CORE_NO_FORBIDDEN_IMPORTS: evaluator-runner.ts has no openclaw-plugin, RolloutReviewerRunner, nocturnal-trinity imports', async () => {
1915
- const { readFileSync } = await import('node:fs');
1916
- const { resolve } = await import('node:path');
1917
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'evaluator-runner.ts'), 'utf-8');
1918
- expect(src).not.toContain('openclaw-plugin');
1919
- expect(src).not.toContain('RolloutReviewerRunner');
1920
- expect(src).not.toContain('nocturnal-trinity');
1921
- expect(src).not.toContain('InternalizationOrchestrator');
1922
- expect(src).not.toContain('createTask');
1923
- expect(src).not.toContain('enqueueTask');
1924
- });
1925
- it('CORE_NO_SCHEDULING: evaluator-runner.ts has no node:fs, node:cron imports', async () => {
1926
- const { readFileSync } = await import('node:fs');
1927
- const { resolve } = await import('node:path');
1928
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'evaluator-runner.ts'), 'utf-8');
1929
- expect(src).not.toContain('node:fs');
1930
- expect(src).not.toContain('node:cron');
1931
- });
1932
- it('BARREL_EXPORTS: internalization/index.ts does NOT export EvaluatorRunner (PRI-458 MVP-Quiet)', async () => {
1933
- // PRI-458: EvaluatorRunner is de-surfaced from the internal barrel (MVP-Quiet).
1934
- // It remains in runtime-v2/index.ts (public barrel) because rulehost-pipeline-runner.ts
1935
- // imports it from there (EP-02 exception). These negative assertions lock the boundary:
1936
- // if someone re-aggregates the evaluator exports into this barrel, the test will fail.
1937
- const { readFileSync } = await import('node:fs');
1938
- const { resolve } = await import('node:path');
1939
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
1940
- expect(src).not.toContain("from './evaluator-runner.js'");
1941
- expect(src).not.toContain("from './evaluator-output.js'");
1942
- expect(src).not.toContain("from './evaluator-prompt-builder.js'");
1943
- });
1944
- it('SCHEMA_REGISTRY: shared output-schema-registry registers evaluator-output-v1 schema', async () => {
1945
- const { readFileSync } = await import('node:fs');
1946
- const { resolve } = await import('node:path');
1947
- const src = readFileSync(resolve(__dirname, '..', 'adapter', 'output-schema-registry.ts'), 'utf-8');
1948
- expect(src).toContain('evaluator-output-v1');
1949
- expect(src).toContain('EvaluatorOutputV1Schema');
1950
- });
1951
- });
1952
- // ── PRI-RR: RolloutReviewerRunner boundary guards ──────────────────────────────
1953
- describe('PRI-RR RolloutReviewerRunner boundary', () => {
1954
- it('rollout_reviewer source files exist in internalization directory', async () => {
1955
- const { existsSync } = await import('node:fs');
1956
- const { resolve } = await import('node:path');
1957
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-runner.ts'))).toBe(true);
1958
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-output.ts'))).toBe(true);
1959
- expect(existsSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-prompt-builder.ts'))).toBe(true);
1960
- });
1961
- it('rollout_reviewer test file exists', async () => {
1962
- const { existsSync } = await import('node:fs');
1963
- const { resolve } = await import('node:path');
1964
- expect(existsSync(resolve(__dirname, 'rollout-reviewer-runner-vslice.test.ts'))).toBe(true);
1965
- });
1966
- it('CORE_NO_FORBIDDEN_IMPORTS: rollout-reviewer-output.ts has no openclaw-plugin, fs, path imports', async () => {
1967
- const { readFileSync } = await import('node:fs');
1968
- const { resolve } = await import('node:path');
1969
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-output.ts'), 'utf-8');
1970
- expect(src).not.toContain('openclaw-plugin');
1971
- expect(src).not.toContain('node:fs');
1972
- expect(src).not.toContain('node:path');
1973
- });
1974
- it('CORE_NO_FORBIDDEN_IMPORTS: rollout-reviewer-runner.ts has no openclaw-plugin, TrainerRunner, nocturnal-trinity imports', async () => {
1975
- const { readFileSync } = await import('node:fs');
1976
- const { resolve } = await import('node:path');
1977
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-runner.ts'), 'utf-8');
1978
- expect(src).not.toContain('openclaw-plugin');
1979
- expect(src).not.toContain('TrainerRunner');
1980
- expect(src).not.toContain('nocturnal-trinity');
1981
- expect(src).not.toContain('InternalizationOrchestrator');
1982
- expect(src).not.toContain('createTask');
1983
- expect(src).not.toContain('enqueueTask');
1984
- });
1985
- it('CORE_NO_SCHEDULING: rollout-reviewer-runner.ts has no node:fs, node:cron imports', async () => {
1986
- const { readFileSync } = await import('node:fs');
1987
- const { resolve } = await import('node:path');
1988
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rollout-reviewer-runner.ts'), 'utf-8');
1989
- expect(src).not.toContain('node:fs');
1990
- expect(src).not.toContain('node:cron');
1991
- });
1992
- it('BARREL_EXPORTS: internalization/index.ts does NOT export RolloutReviewerRunner (PRI-458 MVP-Quiet)', async () => {
1993
- // PRI-458: RolloutReviewerRunner is de-surfaced from the internal barrel (MVP-Quiet).
1994
- // It remains in runtime-v2/index.ts (public barrel) because runtime-internalization-run-once.ts
1995
- // imports it from there and package.json has no deep import path available (EP-02 exception).
1996
- const { readFileSync } = await import('node:fs');
1997
- const { resolve } = await import('node:path');
1998
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
1999
- expect(src).not.toContain("from './rollout-reviewer-runner.js'");
2000
- expect(src).not.toContain("from './rollout-reviewer-output.js'");
2001
- expect(src).not.toContain("from './rollout-reviewer-prompt-builder.js'");
2002
- });
2003
- it('SCHEMA_REGISTRY: shared output-schema-registry registers rollout-reviewer-output-v1 schema', async () => {
2004
- const { readFileSync } = await import('node:fs');
2005
- const { resolve } = await import('node:path');
2006
- const src = readFileSync(resolve(__dirname, '..', 'adapter', 'output-schema-registry.ts'), 'utf-8');
2007
- expect(src).toContain('rollout-reviewer-output-v1');
2008
- expect(src).toContain('RolloutReviewerOutputV1Schema');
2009
- });
2010
- });
2011
- describe('PRI-114: correction-proposal boundary', () => {
2012
- it('CORE_PURE: correction-proposal.ts has zero infrastructure imports', async () => {
2013
- const { readFileSync } = await import('node:fs');
2014
- const { resolve } = await import('node:path');
2015
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'correction-proposal.ts'), 'utf-8');
2016
- expect(src).not.toContain('node:vm');
2017
- expect(src).not.toContain('node:fs');
2018
- expect(src).not.toContain('openclaw-plugin');
2019
- expect(src).not.toContain('require(');
2020
- });
2021
- it('CONTRACT_IMPORT: rule-host-contracts.ts imports CorrectionProposal from same directory', async () => {
2022
- const { readFileSync } = await import('node:fs');
2023
- const { resolve } = await import('node:path');
2024
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-contracts.ts'), 'utf-8');
2025
- expect(src).toContain("from './correction-proposal.js'");
2026
- });
2027
- it('EVALUATOR_IMPORT: rule-host-evaluator.ts imports validateCorrectionProposal from same directory', async () => {
2028
- const { readFileSync } = await import('node:fs');
2029
- const { resolve } = await import('node:path');
2030
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'rule-host-evaluator.ts'), 'utf-8');
2031
- expect(src).toContain("from './correction-proposal.js'");
2032
- expect(src).toContain('validateCorrectionProposal');
2033
- });
2034
- it('BARREL_EXPORTS: runtime-v2/index.ts exports CorrectionProposal and validators', async () => {
2035
- const { readFileSync } = await import('node:fs');
2036
- const { resolve } = await import('node:path');
2037
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2038
- expect(src).toContain('CorrectionProposal');
2039
- expect(src).toContain('validateProposedParams');
2040
- expect(src).toContain('validateCorrectionProposal');
2041
- expect(src).toContain("from './internalization/correction-proposal.js'");
2042
- });
2043
- });
2044
- // ── PRI-172: Refiner Sandbox Wrapper boundary ────────────────────────────
2045
- describe('PRI-172: refiner-sandbox-wrapper boundary', () => {
2046
- it('CORE_PURE: refiner-sandbox-wrapper.ts has zero infrastructure imports', async () => {
2047
- const { readFileSync } = await import('node:fs');
2048
- const { resolve } = await import('node:path');
2049
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-sandbox-wrapper.ts'), 'utf-8');
2050
- const importLines = src.split('\n').filter((line) => line.trim().startsWith('import'));
2051
- const vmImports = importLines.filter((line) => line.includes('node:vm'));
2052
- expect(vmImports).toEqual([]);
2053
- const fsImports = importLines.filter((line) => line.includes('node:fs'));
2054
- expect(fsImports).toEqual([]);
2055
- expect(src).not.toContain('openclaw-plugin');
2056
- expect(src).not.toContain('eval(');
2057
- expect(src).not.toContain('new Function');
2058
- });
2059
- it('BARREL_EXPORTS: runtime-v2/index.ts exports RefinerSandboxResult and evaluateInRefinerSandbox', async () => {
2060
- const { readFileSync } = await import('node:fs');
2061
- const { resolve } = await import('node:path');
2062
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2063
- expect(src).toContain('evaluateInRefinerSandbox');
2064
- expect(src).toContain('RefinerSandboxResult');
2065
- expect(src).toContain('RefinerSandboxFailedCase');
2066
- expect(src).toContain("from './internalization/refiner-sandbox-wrapper.js'");
2067
- });
2068
- it('REUSES_REPLAY: refiner-sandbox-wrapper.ts imports ReplayEvaluateFn from replay validator', async () => {
2069
- const { readFileSync } = await import('node:fs');
2070
- const { resolve } = await import('node:path');
2071
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-sandbox-wrapper.ts'), 'utf-8');
2072
- expect(src).toContain("from '../golden-trace-replay-validator.js'");
2073
- expect(src).toContain('ReplayEvaluateFn');
2074
- });
2075
- it('REUSES_FORBIDDEN: refiner-sandbox-wrapper.ts imports checkForbiddenPatterns from rule-code-validator', async () => {
2076
- const { readFileSync } = await import('node:fs');
2077
- const { resolve } = await import('node:path');
2078
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-sandbox-wrapper.ts'), 'utf-8');
2079
- expect(src).toContain("from './rule-code-validator.js'");
2080
- expect(src).toContain('checkForbiddenPatterns');
2081
- });
2082
- });
2083
- // ── PRI-173: Refiner RuleHost Gate boundary ────────────────────────────
2084
- describe('PRI-173: refiner-rulehost-gate boundary', () => {
2085
- it('CORE_PURE: refiner-rulehost-gate.ts has zero infrastructure imports', async () => {
2086
- const { readFileSync } = await import('node:fs');
2087
- const { resolve } = await import('node:path');
2088
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-rulehost-gate.ts'), 'utf-8');
2089
- expect(src).not.toContain('node:vm');
2090
- expect(src).not.toContain('node:fs');
2091
- expect(src).not.toContain('node:path');
2092
- expect(src).not.toContain('node:process');
2093
- expect(src).not.toContain('openclaw-plugin');
2094
- expect(src).not.toContain('eval(');
2095
- expect(src).not.toContain('new Function');
2096
- });
2097
- it('BARREL_EXPORTS: runtime-v2/index.ts exports evaluateRefinerRuleHostGate and types', async () => {
2098
- const { readFileSync } = await import('node:fs');
2099
- const { resolve } = await import('node:path');
2100
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2101
- expect(src).toContain('evaluateRefinerRuleHostGate');
2102
- expect(src).toContain('RefinerRuleHostGateDecision');
2103
- expect(src).toContain('RefinerRuleHostGateInput');
2104
- expect(src).toContain('RefinerRuleHostGateResult');
2105
- expect(src).toContain("from './internalization/refiner-rulehost-gate.js'");
2106
- });
2107
- it('USES_SANDBOX: refiner-rulehost-gate.ts imports RefinerSandboxResult from refiner-sandbox-wrapper', async () => {
2108
- const { readFileSync } = await import('node:fs');
2109
- const { resolve } = await import('node:path');
2110
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'refiner-rulehost-gate.ts'), 'utf-8');
2111
- expect(src).toContain("from './refiner-sandbox-wrapper.js'");
2112
- expect(src).toContain('RefinerSandboxResult');
2113
- });
2114
- });
2115
- describe('PRI-146: RuleHostWriter shadow activation boundary', () => {
2116
- it('CORE_PURE: rule-host-writer.ts has zero infrastructure imports', async () => {
2117
- const { readFileSync } = await import('node:fs');
2118
- const { resolve } = await import('node:path');
2119
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
2120
- expect(src).not.toContain('node:vm');
2121
- expect(src).not.toContain('node:fs');
2122
- expect(src).not.toContain('node:path');
2123
- expect(src).not.toContain('node:process');
2124
- expect(src).not.toContain('openclaw-plugin');
2125
- expect(src).not.toContain('eval(');
2126
- expect(src).not.toContain('new Function');
2127
- });
2128
- it('SHADOW_AFTER_APPROVAL: rule-host-writer.ts uses shadow action for owner-approved activations (PRI-489)', async () => {
2129
- const { readFileSync } = await import('node:fs');
2130
- const { resolve } = await import('node:path');
2131
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
2132
- // PRI-489: Owner approval creates a SHADOW activation first. The only
2133
- // shadow -> live transition is `pd activation promote` (atomic action
2134
- // rewrite in SqliteActivationStateStore.promoteActivation). Live action
2135
- // must never appear as a return value from activate(), only in comments
2136
- // documenting the promote path.
2137
- expect(src).toContain("action: 'code_tool_hook_shadow_activate'");
2138
- expect(src).toContain('accepted_shadow');
2139
- });
2140
- it('USES_GATE: rule-host-writer.ts imports evaluateRefinerRuleHostGate', async () => {
2141
- const { readFileSync } = await import('node:fs');
2142
- const { resolve } = await import('node:path');
2143
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
2144
- expect(src).toContain('evaluateRefinerRuleHostGate');
2145
- expect(src).toContain("from '../../internalization/refiner-rulehost-gate.js'");
2146
- });
2147
- it('IMPLEMENTS_CHANNEL_WRITER: rule-host-writer.ts implements ChannelWriter interface', async () => {
2148
- const { readFileSync } = await import('node:fs');
2149
- const { resolve } = await import('node:path');
2150
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'writers', 'rule-host-writer.ts'), 'utf-8');
2151
- expect(src).toContain('implements ChannelWriter');
2152
- expect(src).toContain("channel = 'code_tool_hook'");
2153
- });
2154
- it('BARREL_EXPORTS: activation/index.ts exports RuleHostWriter', async () => {
2155
- const { readFileSync } = await import('node:fs');
2156
- const { resolve } = await import('node:path');
2157
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'index.ts'), 'utf-8');
2158
- expect(src).toContain('RuleHostWriter');
2159
- expect(src).toContain("from './writers/rule-host-writer.js'");
2160
- });
2161
- it('CHANNEL_MAP: code_tool_hook is in HIGH_RISK_CHANNEL_MAP', async () => {
2162
- const { readFileSync } = await import('node:fs');
2163
- const { resolve } = await import('node:path');
2164
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'activation-types.ts'), 'utf-8');
2165
- expect(src).toContain("code_tool_hook: 'high'");
2166
- });
2167
- });
2168
- // ── PRI-117: Nocturnal god-class freeze — no Runtime V2 → Nocturnal reverse imports ─
2169
- describe('PRI-117 Nocturnal god-class freeze', () => {
2170
- const NOCTURNAL_GOD_CLASSES = [
2171
- 'nocturnal-trinity',
2172
- 'nocturnal-service',
2173
- '../core/nocturnal-trinity.js',
2174
- '../service/nocturnal-service.js',
2175
- '../../core/nocturnal-trinity.js',
2176
- '../../service/nocturnal-service.js',
2177
- ];
2178
- it('RUNTIME_V2_NO_NOCTURNAL_TRINITY_IMPORT: runtime-v2 must not import nocturnal-trinity', async () => {
2179
- const { readdirSync, readFileSync } = await import('node:fs');
2180
- const { resolve, join } = await import('node:path');
2181
- const runtimeDir = resolve(__dirname, '..');
2182
- const allFiles = [];
2183
- function collectTsFiles(dir) {
2184
- if (dir.includes('node_modules'))
2185
- return;
2186
- try {
2187
- const entries = readdirSync(dir, { withFileTypes: true });
2188
- for (const entry of entries) {
2189
- const fullPath = join(dir, entry.name);
2190
- if (entry.isDirectory()) {
2191
- collectTsFiles(fullPath);
2192
- }
2193
- else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.test.ts')) {
2194
- allFiles.push(fullPath);
2195
- }
2196
- }
2197
- }
2198
- catch {
2199
- // Skip inaccessible directories
2200
- }
2201
- }
2202
- collectTsFiles(runtimeDir);
2203
- for (const file of allFiles) {
2204
- const src = readFileSync(file, 'utf-8');
2205
- for (const badImport of NOCTURNAL_GOD_CLASSES) {
2206
- expect(src).not.toContain(badImport);
2207
- }
2208
- }
2209
- });
2210
- it('OPENCLAW_TRINITY_RUNTIME_ADAPTER_IS_LEGACY: OpenClawTrinityRuntimeAdapter must not be referenced in runtime-v2', async () => {
2211
- const { readdirSync, readFileSync } = await import('node:fs');
2212
- const { resolve, join } = await import('node:path');
2213
- const runtimeDir = resolve(__dirname, '..');
2214
- const allFiles = [];
2215
- function collectTsFiles(dir) {
2216
- if (dir.includes('node_modules'))
2217
- return;
2218
- try {
2219
- const entries = readdirSync(dir, { withFileTypes: true });
2220
- for (const entry of entries) {
2221
- const fullPath = join(dir, entry.name);
2222
- if (entry.isDirectory()) {
2223
- collectTsFiles(fullPath);
2224
- }
2225
- else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.test.ts')) {
2226
- allFiles.push(fullPath);
2227
- }
2228
- }
2229
- }
2230
- catch {
2231
- // Skip inaccessible directories
2232
- }
2233
- }
2234
- collectTsFiles(runtimeDir);
2235
- for (const file of allFiles) {
2236
- const src = readFileSync(file, 'utf-8');
2237
- expect(src).not.toContain('OpenClawTrinityRuntimeAdapter');
2238
- expect(src).not.toContain('TrinityRuntimeAdapter');
2239
- expect(src).not.toContain('runTrinity');
2240
- expect(src).not.toContain('runTrinityAsync');
2241
- }
2242
- });
2243
- it('NOCTURNAL_TRINITY_STUBS_ARE_TEST_ONLY: invokeStub* functions must not appear in non-test runtime-v2 files', async () => {
2244
- const { readdirSync, readFileSync } = await import('node:fs');
2245
- const { resolve, join } = await import('node:path');
2246
- const runtimeDir = resolve(__dirname, '..');
2247
- const allFiles = [];
2248
- function collectTsFiles(dir) {
2249
- if (dir.includes('node_modules'))
2250
- return;
2251
- try {
2252
- const entries = readdirSync(dir, { withFileTypes: true });
2253
- for (const entry of entries) {
2254
- const fullPath = join(dir, entry.name);
2255
- if (entry.isDirectory()) {
2256
- collectTsFiles(fullPath);
2257
- }
2258
- else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.test.ts')) {
2259
- allFiles.push(fullPath);
2260
- }
2261
- }
2262
- }
2263
- catch {
2264
- // Skip inaccessible directories
2265
- }
2266
- }
2267
- collectTsFiles(runtimeDir);
2268
- for (const file of allFiles) {
2269
- const src = readFileSync(file, 'utf-8');
2270
- expect(src).not.toContain('invokeStubDreamer');
2271
- expect(src).not.toContain('invokeStubPhilosopher');
2272
- expect(src).not.toContain('invokeStubScribe');
2273
- }
2274
- });
2275
- it('RUNTIME_V2_USES_PEER_RUNNERS: DreamerRunner/ScribeRunner/ArtificerRunner are the canonical MVP-Core entry points', async () => {
2276
- // PRI-458: narrowed to MVP-Core runners only. PhilosopherRunner (MVP-Quiet)
2277
- // remains in runtime-v2/index.ts for rulehost-pipeline-runner.ts compatibility
2278
- // but is no longer asserted as a canonical entry point.
2279
- const { readFileSync } = await import('node:fs');
2280
- const { resolve } = await import('node:path');
2281
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2282
- expect(src).toContain('DreamerRunner');
2283
- expect(src).toContain('ScribeRunner');
2284
- expect(src).toContain('ArtificerRunner');
2285
- });
2286
- });
2287
- // ── Phase 2 Migration: Evolution Types ────────────────────────────────────────
2288
- describe('Phase 2.1 evolution types migration', () => {
2289
- const CORE_FILES = [
2290
- 'evolution/evolution-types.ts',
2291
- ];
2292
- for (const file of CORE_FILES) {
2293
- it(`core ${file} has zero infrastructure imports`, async () => {
2294
- const { readFileSync } = await import('node:fs');
2295
- const { resolve } = await import('node:path');
2296
- const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
2297
- expect(src).not.toContain('node:fs');
2298
- expect(src).not.toContain('node:path');
2299
- expect(src).not.toContain('openclaw-plugin');
2300
- });
2301
- }
2302
- it('core barrel does NOT export the retired Evolution Points/Tier surface (PRI-770)', async () => {
2303
- const { readFileSync } = await import('node:fs');
2304
- const { resolve } = await import('node:path');
2305
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2306
- expect(src).not.toContain('EvolutionTier');
2307
- expect(src).not.toContain('TIER_DEFINITIONS');
2308
- expect(src).not.toContain('getTierDefinition');
2309
- expect(src).not.toContain('getTierByPoints');
2310
- });
2311
- it('core barrel exports EvolutionPrinciple, EvolutionPrincipleStatus, EvolutionPainDetectedData', async () => {
2312
- const { readFileSync } = await import('node:fs');
2313
- const { resolve } = await import('node:path');
2314
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2315
- expect(src).toContain('EvolutionPrinciple');
2316
- expect(src).toContain('EvolutionPrincipleStatus');
2317
- expect(src).toContain('EvolutionPainDetectedData');
2318
- });
2319
- it('plugin evolution-types.ts re-exports from core with backward-compatible aliases', async () => {
2320
- const { readFileSync } = await import('node:fs');
2321
- const { resolve } = await import('node:path');
2322
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/evolution-types.ts'), 'utf-8');
2323
- expect(src).toContain("from '@principles/core/runtime-v2'");
2324
- expect(src).not.toContain('EvolutionTier');
2325
- expect(src).toContain('EvolutionPrinciple');
2326
- expect(src).toContain('type Principle = EvolutionPrinciple');
2327
- expect(src).toContain('type PrincipleStatus = EvolutionPrincipleStatus');
2328
- expect(src).toContain('type PainDetectedData = EvolutionPainDetectedData');
2329
- });
2330
- });
2331
- // ── Phase 2 Migration: Correction Types ───────────────────────────────────────
2332
- describe('Phase 2.2 correction types migration', () => {
2333
- const CORE_FILES = [
2334
- 'correction/correction-types.ts',
2335
- 'correction/index.ts',
2336
- ];
2337
- for (const file of CORE_FILES) {
2338
- it(`core ${file} has zero infrastructure imports`, async () => {
2339
- const { readFileSync } = await import('node:fs');
2340
- const { resolve } = await import('node:path');
2341
- const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
2342
- expect(src).not.toContain('node:fs');
2343
- expect(src).not.toContain('node:path');
2344
- expect(src).not.toContain('openclaw-plugin');
2345
- });
2346
- }
2347
- it('core barrel exports CorrectionKeyword, CorrectionKeywordStore, MAX_CORRECTION_KEYWORDS', async () => {
2348
- const { readFileSync } = await import('node:fs');
2349
- const { resolve } = await import('node:path');
2350
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2351
- expect(src).toContain('CorrectionKeyword');
2352
- expect(src).toContain('CorrectionKeywordStore');
2353
- expect(src).toContain('MAX_CORRECTION_KEYWORDS');
2354
- expect(src).toContain("from './correction/correction-types.js'");
2355
- });
2356
- it('plugin correction-types.ts re-exports from core', async () => {
2357
- const { readFileSync } = await import('node:fs');
2358
- const { resolve } = await import('node:path');
2359
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/correction-types.ts'), 'utf-8');
2360
- expect(src).toContain("from '@principles/core/runtime-v2'");
2361
- expect(src).toContain('CorrectionKeyword');
2362
- expect(src).toContain('MAX_CORRECTION_KEYWORDS');
2363
- });
2364
- it('plugin correction-types.ts does NOT define CorrectionKeyword interface locally', async () => {
2365
- const { readFileSync } = await import('node:fs');
2366
- const { resolve } = await import('node:path');
2367
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/core/correction-types.ts'), 'utf-8');
2368
- expect(src).not.toMatch(/^export interface CorrectionKeyword/m);
2369
- });
2370
- });
2371
- // ── Phase 2 Migration: Types Directory (queue, hygiene, events) ──
2372
- describe('Phase 2.4 types directory migration', () => {
2373
- const CORE_TYPE_FILES = [
2374
- 'types/hygiene-types.ts',
2375
- 'types/event-types.ts',
2376
- 'types/event-payload.ts',
2377
- ];
2378
- for (const file of CORE_TYPE_FILES) {
2379
- it(`core ${file} has zero infrastructure imports`, async () => {
2380
- const { readFileSync } = await import('node:fs');
2381
- const { resolve } = await import('node:path');
2382
- const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
2383
- expect(src).not.toContain('node:fs');
2384
- expect(src).not.toContain('node:path');
2385
- expect(src).not.toContain('openclaw-plugin');
2386
- });
2387
- }
2388
- it('core barrel does NOT export the retired queue brand types (PRI-770)', async () => {
2389
- const { readFileSync } = await import('node:fs');
2390
- const { resolve } = await import('node:path');
2391
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2392
- expect(src).not.toContain('QueueItemId');
2393
- expect(src).not.toContain('WorkflowId');
2394
- expect(src).not.toContain("from './types/queue-types.js'");
2395
- });
2396
- it('core barrel exports HygieneStats, createEmptyHygieneStats', async () => {
2397
- const { readFileSync } = await import('node:fs');
2398
- const { resolve } = await import('node:path');
2399
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2400
- expect(src).toContain('HygieneStats');
2401
- expect(src).toContain('createEmptyHygieneStats');
2402
- expect(src).toContain("from './types/hygiene-types.js'");
2403
- });
2404
- it('core barrel exports EventType, EventLogEntry, EventEvolutionStats', async () => {
2405
- const { readFileSync } = await import('node:fs');
2406
- const { resolve } = await import('node:path');
2407
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2408
- expect(src).toContain('EventType');
2409
- expect(src).toContain('EventLogEntry');
2410
- expect(src).toContain('EventEvolutionStats');
2411
- expect(src).toContain("from './types/event-types.js'");
2412
- });
2413
- it('core barrel exports DiscriminatedEventLogEntry, isToolCallEventEntry', async () => {
2414
- const { readFileSync } = await import('node:fs');
2415
- const { resolve } = await import('node:path');
2416
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2417
- expect(src).toContain('DiscriminatedEventLogEntry');
2418
- expect(src).toContain('isToolCallEventEntry');
2419
- expect(src).toContain("from './types/event-payload.js'");
2420
- });
2421
- it('plugin types/hygiene-types.ts re-exports from core', async () => {
2422
- const { readFileSync } = await import('node:fs');
2423
- const { resolve } = await import('node:path');
2424
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/hygiene-types.ts'), 'utf-8');
2425
- expect(src).toContain("@principles/core/runtime-v2");
2426
- });
2427
- it('plugin types/event-types.ts re-exports from core', async () => {
2428
- const { readFileSync } = await import('node:fs');
2429
- const { resolve } = await import('node:path');
2430
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/event-types.ts'), 'utf-8');
2431
- expect(src).toContain("@principles/core/runtime-v2");
2432
- });
2433
- });
2434
- // ── Phase 2 Migration: Principle-Tree Data Structures ─────────────────────────
2435
- describe('Phase 2.6 principle-tree data structures migration', () => {
2436
- const CORE_TYPE_FILES = [
2437
- 'types/principle-dependency.ts',
2438
- 'types/principle-value-metrics.ts',
2439
- 'types/principle-lifecycle-event.ts',
2440
- 'types/principle-tree-store.ts',
2441
- ];
2442
- for (const file of CORE_TYPE_FILES) {
2443
- it(`core ${file} has zero infrastructure imports`, async () => {
2444
- const { readFileSync } = await import('node:fs');
2445
- const { resolve } = await import('node:path');
2446
- const src = readFileSync(resolve(__dirname, '..', file), 'utf-8');
2447
- expect(src).not.toContain('node:fs');
2448
- expect(src).not.toContain('node:path');
2449
- expect(src).not.toContain('openclaw-plugin');
2450
- });
2451
- }
2452
- it('core barrel exports PrincipleDependency, PrincipleValueMetrics, PrincipleLifecycleEvent, PrincipleTreeStore', async () => {
2453
- const { readFileSync } = await import('node:fs');
2454
- const { resolve } = await import('node:path');
2455
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2456
- expect(src).toContain('PrincipleDependency');
2457
- expect(src).toContain('PrincipleValueMetrics');
2458
- expect(src).toContain('PrincipleLifecycleEvent');
2459
- expect(src).toContain('PrincipleTreeStore');
2460
- });
2461
- it('plugin principle-tree-schema.ts re-exports PrincipleDependency, PrincipleValueMetrics, PrincipleLifecycleEvent, PrincipleTreeStore from core', async () => {
2462
- const { readFileSync } = await import('node:fs');
2463
- const { resolve } = await import('node:path');
2464
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
2465
- expect(src).toContain("from '@principles/core/runtime-v2'");
2466
- expect(src).toContain('PrincipleDependency');
2467
- expect(src).toContain('PrincipleValueMetrics');
2468
- expect(src).toContain('PrincipleLifecycleEvent');
2469
- expect(src).toContain('PrincipleTreeStore');
2470
- });
2471
- it('plugin principle-tree-schema.ts does NOT define PrincipleDependency or PrincipleTreeStore locally', async () => {
2472
- const { readFileSync } = await import('node:fs');
2473
- const { resolve } = await import('node:path');
2474
- const src = readFileSync(resolve(__dirname, '../../../../openclaw-plugin/src/types/principle-tree-schema.ts'), 'utf-8');
2475
- expect(src).not.toMatch(/^export interface PrincipleDependency/m);
2476
- expect(src).not.toMatch(/^export interface PrincipleTreeStore/m);
2477
- });
2478
- });
2479
- // ── PRI-141: Task Three Strikes Out Mechanism ──────────────────────────────────
2480
- describe('PRI-141 Task Three Strikes Out Mechanism', () => {
2481
- it('core barrel exports isUnresolvable, recordRejection, DEFAULT_UNRESOLVABLE_THRESHOLD', async () => {
2482
- const { readFileSync } = await import('node:fs');
2483
- const { resolve } = await import('node:path');
2484
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2485
- expect(src).toContain('isUnresolvable');
2486
- expect(src).toContain('recordRejection');
2487
- expect(src).toContain('DEFAULT_UNRESOLVABLE_THRESHOLD');
2488
- });
2489
- it('core barrel exports UnresolvableSample type', async () => {
2490
- const { readFileSync } = await import('node:fs');
2491
- const { resolve } = await import('node:path');
2492
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2493
- expect(src).toContain('UnresolvableSample');
2494
- });
2495
- it('internalization-task-guards.ts has zero infrastructure imports', async () => {
2496
- const { readFileSync } = await import('node:fs');
2497
- const { resolve } = await import('node:path');
2498
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'internalization-task-guards.ts'), 'utf-8');
2499
- expect(src).not.toContain('node:fs');
2500
- expect(src).not.toContain('node:path');
2501
- expect(src).not.toContain('openclaw-plugin');
2502
- expect(src).not.toContain('node:cron');
2503
- });
2504
- it('PITaskRecord includes rejectionCount field', async () => {
2505
- const { readFileSync } = await import('node:fs');
2506
- const { resolve } = await import('node:path');
2507
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'peer-runner-contracts.ts'), 'utf-8');
2508
- expect(src).toContain('rejectionCount');
2509
- });
2510
- it('PITaskMetadata includes rejectionCount field', async () => {
2511
- const { readFileSync } = await import('node:fs');
2512
- const { resolve } = await import('node:path');
2513
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'pitask-metadata.ts'), 'utf-8');
2514
- expect(src).toContain('rejectionCount');
2515
- });
2516
- });
2517
- // ── PRI-139: L1 Hard Cap & LRU Eviction ──────────────────────────────────────
2518
- describe('PRI-139 L1 Hard Cap & LRU Eviction', () => {
2519
- it('core barrel exports enforceL1HardCap, validateL1CapConfig, DEFAULT_L1_HARD_CAP, MAX_L1_HARD_CAP', async () => {
2520
- const { readFileSync } = await import('node:fs');
2521
- const { resolve } = await import('node:path');
2522
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2523
- expect(src).toContain('enforceL1HardCap');
2524
- expect(src).toContain('validateL1CapConfig');
2525
- expect(src).toContain('DEFAULT_L1_HARD_CAP');
2526
- expect(src).toContain('MAX_L1_HARD_CAP');
2527
- });
2528
- it('core barrel exports L1CapConfig, L1EvictionCandidate, L1EvictionResult types', async () => {
2529
- const { readFileSync } = await import('node:fs');
2530
- const { resolve } = await import('node:path');
2531
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2532
- expect(src).toContain('L1CapConfig');
2533
- expect(src).toContain('L1EvictionCandidate');
2534
- expect(src).toContain('L1EvictionResult');
2535
- });
2536
- it('l1-hard-cap.ts has zero infrastructure imports', async () => {
2537
- const { readFileSync } = await import('node:fs');
2538
- const { resolve } = await import('node:path');
2539
- const src = readFileSync(resolve(__dirname, '..', 'l1-hard-cap.ts'), 'utf-8');
2540
- expect(src).not.toContain('node:fs');
2541
- expect(src).not.toContain('node:path');
2542
- expect(src).not.toContain('openclaw-plugin');
2543
- });
2544
- it('LedgerPrinciple includes lastTriggeredAt field', async () => {
2545
- const { readFileSync } = await import('node:fs');
2546
- const { resolve } = await import('node:path');
2547
- // PRI-443: type moved to pure module
2548
- const src = readFileSync(resolve(__dirname, '..', 'types', 'ledger-store.ts'), 'utf-8');
2549
- expect(src).toContain('lastTriggeredAt');
2550
- });
2551
- it('PruningHealthSummary includes activeL1Count and l1Cap fields', async () => {
2552
- const { readFileSync } = await import('node:fs');
2553
- const { resolve } = await import('node:path');
2554
- const src = readFileSync(resolve(__dirname, '..', 'pruning-read-model.ts'), 'utf-8');
2555
- expect(src).toContain('activeL1Count');
2556
- expect(src).toContain('l1Cap');
2557
- });
2558
- });
2559
- // ── PRI-142: IntakeToInternalizationBridge ──────────────────────────────────────
2560
- describe('PRI-142 IntakeToInternalizationBridge', () => {
2561
- it('core barrel exports computeBridgeDecision, buildDreamerTaskSeed, buildDreamerSeedFromCandidate, seedIntakeTask, ROUTE_CHANNEL_MAP', async () => {
2562
- const { readFileSync } = await import('node:fs');
2563
- const { resolve } = await import('node:path');
2564
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2565
- expect(src).toContain('computeBridgeDecision');
2566
- expect(src).toContain('buildDreamerTaskSeed');
2567
- expect(src).toContain('buildDreamerSeedFromCandidate');
2568
- expect(src).toContain('seedIntakeTask');
2569
- expect(src).toContain('ROUTE_CHANNEL_MAP');
2570
- });
2571
- it('core barrel exports IntakeToInternalizationBridgeInput, BridgeDecision, BridgeTaskSeed, BridgeTaskStore types', async () => {
2572
- const { readFileSync } = await import('node:fs');
2573
- const { resolve } = await import('node:path');
2574
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2575
- expect(src).toContain('IntakeToInternalizationBridgeInput');
2576
- expect(src).toContain('BridgeDecision');
2577
- expect(src).toContain('BridgeTaskSeed');
2578
- expect(src).toContain('BridgeTaskStore');
2579
- });
2580
- it('intake-to-internalization-bridge.ts has zero infrastructure imports', async () => {
2581
- const { readFileSync } = await import('node:fs');
2582
- const { resolve } = await import('node:path');
2583
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'intake-to-internalization-bridge.ts'), 'utf-8');
2584
- expect(src).not.toContain('node:fs');
2585
- expect(src).not.toContain('node:path');
2586
- expect(src).not.toContain('node:process');
2587
- expect(src).not.toContain('openclaw-plugin');
2588
- });
2589
- it('internalization/index.ts exports bridge symbols', async () => {
2590
- const { readFileSync } = await import('node:fs');
2591
- const { resolve } = await import('node:path');
2592
- const src = readFileSync(resolve(__dirname, '..', 'internalization', 'index.ts'), 'utf-8');
2593
- expect(src).toContain('computeBridgeDecision');
2594
- expect(src).toContain('buildDreamerTaskSeed');
2595
- expect(src).toContain('buildDreamerSeedFromCandidate');
2596
- expect(src).toContain('seedIntakeTask');
2597
- expect(src).toContain('ROUTE_CHANNEL_MAP');
2598
- expect(src).toContain('IntakeToInternalizationBridgeInput');
2599
- expect(src).toContain('BridgeDecision');
2600
- expect(src).toContain('BridgeTaskSeed');
2601
- expect(src).toContain('BridgeTaskStore');
2602
- });
2603
- });
2604
- // ── PRI-144: ActivationDispatcher & Low-risk Writers ──────────────────────────
2605
- describe('PRI-144 ActivationDispatcher & Low-risk Writers', () => {
2606
- it('core barrel exports ActivationDispatcher, PromptWriter, DeferArchiveWriter, LOW_RISK_CHANNELS, makeIdempotencyKey, isLowRiskChannel, getChannelRiskLevel', async () => {
2607
- const { readFileSync } = await import('node:fs');
2608
- const { resolve } = await import('node:path');
2609
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2610
- expect(src).toContain('ActivationDispatcher');
2611
- expect(src).toContain('PromptWriter');
2612
- expect(src).toContain('DeferArchiveWriter');
2613
- expect(src).toContain('LOW_RISK_CHANNELS');
2614
- expect(src).toContain('makeIdempotencyKey');
2615
- expect(src).toContain('isLowRiskChannel');
2616
- expect(src).toContain('getChannelRiskLevel');
2617
- });
2618
- it('core barrel exports ActivationDecision, DispatchInput, PIArtifactSnapshot, ChannelWriter types', async () => {
2619
- const { readFileSync } = await import('node:fs');
2620
- const { resolve } = await import('node:path');
2621
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2622
- expect(src).toContain('ActivationDecision');
2623
- expect(src).toContain('DispatchInput');
2624
- expect(src).toContain('PIArtifactSnapshot');
2625
- expect(src).toContain('ChannelWriter');
2626
- });
2627
- it('activation core files have zero infrastructure imports', async () => {
2628
- const { readFileSync } = await import('node:fs');
2629
- const { resolve } = await import('node:path');
2630
- const files = [
2631
- resolve(__dirname, '..', 'activation', 'activation-types.ts'),
2632
- resolve(__dirname, '..', 'activation', 'activation-dispatcher.ts'),
2633
- resolve(__dirname, '..', 'activation', 'low-risk-writers.ts'),
2634
- resolve(__dirname, '..', 'activation', 'index.ts'),
2635
- resolve(__dirname, '..', 'activation', 'approval-queue.ts'),
2636
- resolve(__dirname, '..', 'activation', 'memory-approval-store.ts'),
2637
- resolve(__dirname, '..', 'activation', 'sqlite-approval-store.ts'),
2638
- ];
2639
- for (const file of files) {
2640
- const src = readFileSync(file, 'utf-8');
2641
- expect(src).not.toContain('node:fs');
2642
- expect(src).not.toContain('node:path');
2643
- expect(src).not.toContain('node:process');
2644
- expect(src).not.toContain('openclaw-plugin');
2645
- }
2646
- });
2647
- it('activation/index.ts exports all public symbols', async () => {
2648
- const { readFileSync } = await import('node:fs');
2649
- const { resolve } = await import('node:path');
2650
- const src = readFileSync(resolve(__dirname, '..', 'activation', 'index.ts'), 'utf-8');
2651
- expect(src).toContain('ActivationDispatcher');
2652
- expect(src).toContain('PromptWriter');
2653
- expect(src).toContain('DeferArchiveWriter');
2654
- expect(src).toContain('LOW_RISK_CHANNELS');
2655
- expect(src).toContain('makeIdempotencyKey');
2656
- expect(src).toContain('isLowRiskChannel');
2657
- expect(src).toContain('getChannelRiskLevel');
2658
- expect(src).toContain('MemoryActivationStateStore');
2659
- expect(src).toContain('MemoryArtifactReadModel');
2660
- expect(src).toContain('ApprovalQueue');
2661
- expect(src).toContain('decideAutoPromotion');
2662
- expect(src).toContain('MemoryApprovalQueueStore');
2663
- expect(src).toContain('SqliteApprovalQueueStore');
2664
- expect(src).toContain('ApprovalQueueStore');
2665
- expect(src).toContain('AUTO_PROMOTION_CONFIDENCE_THRESHOLD');
2666
- expect(src).toContain('AUTO_PROMOTABLE_CHANNELS');
2667
- });
2668
- });
2669
- // ── PRI-189: SourceTraceLocator contract boundary ──────────────────────────────
2670
- describe('PRI-189 SourceTraceLocator contract boundary', () => {
2671
- it('source-trace-locator.ts has zero infrastructure imports', async () => {
2672
- const { readFileSync } = await import('node:fs');
2673
- const { resolve } = await import('node:path');
2674
- const src = readFileSync(resolve(__dirname, '..', 'store', 'trajectory', 'source-trace-locator.ts'), 'utf-8');
2675
- expect(src).not.toContain('node:fs');
2676
- expect(src).not.toContain('node:path');
2677
- expect(src).not.toContain('node:process');
2678
- expect(src).not.toContain('openclaw-plugin');
2679
- });
2680
- it('sqlite-source-trace-locator.ts has zero infrastructure imports', async () => {
2681
- const { readFileSync } = await import('node:fs');
2682
- const { resolve } = await import('node:path');
2683
- const src = readFileSync(resolve(__dirname, '..', 'store', 'trajectory', 'sqlite-source-trace-locator.ts'), 'utf-8');
2684
- expect(src).not.toContain('node:fs');
2685
- expect(src).not.toContain('node:path');
2686
- expect(src).not.toContain('node:process');
2687
- expect(src).not.toContain('openclaw-plugin');
2688
- });
2689
- it('core barrel exports SourceTraceLocator and SqliteSourceTraceLocator', async () => {
2690
- const { readFileSync } = await import('node:fs');
2691
- const { resolve } = await import('node:path');
2692
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2693
- expect(src).toContain('SourceTraceLocator');
2694
- expect(src).toContain('SqliteSourceTraceLocator');
2695
- expect(src).toContain('SourceTraceLocateDecision');
2696
- expect(src).toContain('SourceTraceCandidate');
2697
- });
2698
- it('store/trajectory/index.ts re-exports SourceTraceLocator + SqliteSourceTraceLocator', async () => {
2699
- const { existsSync, readFileSync } = await import('node:fs');
2700
- const { resolve } = await import('node:path');
2701
- const indexPath = resolve(__dirname, '..', 'store', 'trajectory', 'index.ts');
2702
- expect(existsSync(indexPath)).toBe(true);
2703
- const src = readFileSync(indexPath, 'utf-8');
2704
- expect(src).toContain('SourceTraceLocator');
2705
- expect(src).toContain('SqliteSourceTraceLocator');
2706
- });
2707
- });
2708
- describe('PRI-190 FullTrace quality contract boundary', () => {
2709
- it('full-trace-contract.ts has zero infrastructure imports', async () => {
2710
- const { readFileSync } = await import('node:fs');
2711
- const { resolve } = await import('node:path');
2712
- const src = readFileSync(resolve(__dirname, '..', 'full-trace-contract.ts'), 'utf-8');
2713
- expect(src).not.toContain('node:fs');
2714
- expect(src).not.toContain('node:path');
2715
- expect(src).not.toContain('node:process');
2716
- expect(src).not.toContain('openclaw-plugin');
2717
- });
2718
- it('core barrel exports FullTracePayloadV2Schema and contract functions', async () => {
2719
- const { readFileSync } = await import('node:fs');
2720
- const { resolve } = await import('node:path');
2721
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2722
- expect(src).toContain('FullTracePayloadV2Schema');
2723
- expect(src).toContain('TraceSourceRefSchema');
2724
- expect(src).toContain('TraceTimelineEntrySchema');
2725
- expect(src).toContain('validateFullTracePayload');
2726
- expect(src).toContain('sanitizeFullTracePayload');
2727
- expect(src).toContain('buildFullTraceTimeline');
2728
- expect(src).toContain('buildSourceRefs');
2729
- });
2730
- it('context-payload.ts re-exports full-trace-contract types', async () => {
2731
- const { readFileSync } = await import('node:fs');
2732
- const { resolve } = await import('node:path');
2733
- const src = readFileSync(resolve(__dirname, '..', 'context-payload.ts'), 'utf-8');
2734
- expect(src).toContain('full-trace-contract');
2735
- expect(src).toContain('FullTracePayloadV2Schema');
2736
- expect(src).toContain('validateFullTracePayload');
2737
- expect(src).toContain('sanitizeFullTracePayload');
2738
- });
2739
- it('DiagnosticianContextPayloadSchema accepts FullTracePayloadV2', async () => {
2740
- const { readFileSync } = await import('node:fs');
2741
- const { resolve } = await import('node:path');
2742
- const src = readFileSync(resolve(__dirname, '..', 'context-payload.ts'), 'utf-8');
2743
- expect(src).toContain('FullTracePayloadV2Schema');
2744
- });
2745
- });
2746
- // PRI-191 TraceRefiner / PRI-192 TraceRefinerAgent boundary describes removed
2747
- // (PRI-770): both modules had zero production consumers and were deleted.
2748
- // ── PRI-215: Synthetic baseline architecture boundary ──────────────────────
2749
- //
2750
- // After PRI-206, the architecture is:
2751
- // Core: packages/principles-core/src/runtime-v2/synthetic-baseline.ts
2752
- // (pure contract/helper code — zero I/O)
2753
- // I/O Runner: packages/pd-cli/src/services/synthetic-baseline-runner.ts
2754
- // CLI Command: packages/pd-cli/src/commands/runtime-synthetic-baseline.ts
2755
- //
2756
- // These guards prevent future PRs from moving I/O back into core.
2757
- // ERR-011 reference: core must not import runtime orchestration classes
2758
- // ERR-012 reference: guard against stale-main rollback of baseline
2759
- // ERR-002 reference: not applicable — no degrade path in these tests
2760
- const FORBIDDEN_NODE_IO_MODULES = new Set([
2761
- 'fs',
2762
- 'fs/promises',
2763
- 'path',
2764
- 'os',
2765
- 'child_process',
2766
- 'process',
2767
- 'better-sqlite3',
2768
- 'node:fs',
2769
- 'node:path',
2770
- 'node:os',
2771
- 'node:child_process',
2772
- 'node:process',
2773
- ]);
2774
- const FORBIDDEN_RUNTIME_ORCHESTRATION_CLASSES = new Set([
2775
- 'RuntimeStateManager',
2776
- 'SqliteContextAssembler',
2777
- 'SqliteHistoryQuery',
2778
- 'SqliteDiagnosticianCommitter',
2779
- 'PainSignalBridge',
2780
- 'SplitDiagnosticianRunner',
2781
- 'DisabledDiagnosticianRunner',
2782
- 'DiagRootCauseRunner',
2783
- 'DiagDistillerRunner',
2784
- 'DiagRouterRunner',
2785
- 'TestDoubleRuntimeAdapter',
2786
- 'OperatorHealthReadModel',
2787
- 'createInternalizationQueueReadModel',
2788
- 'PrincipleTreeLedgerAdapter',
2789
- 'CandidateIntakeService',
2790
- ]);
2791
- describe('PRI-215 synthetic baseline architecture boundary', () => {
2792
- function extractImportModulePaths(src) {
2793
- const paths = [];
2794
- for (const m of src.matchAll(/import\s+[\s\S]*?from\s+['"]([^'"]+)['"]/g)) {
2795
- if (m[1] != null)
2796
- paths.push(m[1]);
2797
- }
2798
- for (const m of src.matchAll(/import\s+['"]([^'"]+)['"]/g)) {
2799
- if (m[1] != null && !paths.includes(m[1]))
2800
- paths.push(m[1]);
2801
- }
2802
- return paths;
2803
- }
2804
- function extractImportIdentifiers(src) {
2805
- const ids = [];
2806
- for (const block of src.matchAll(/import\s+([\s\S]*?)\s+from\s+['"][^'"]+['"]/g)) {
2807
- if (block[1] == null)
2808
- continue;
2809
- const clause = block[1].trim();
2810
- const defaultMatch = /^(\w+)/.exec(clause);
2811
- if (defaultMatch?.[1])
2812
- ids.push(defaultMatch[1]);
2813
- const namedMatch = /\{([\s\S]*)\}/.exec(clause);
2814
- if (namedMatch?.[1]) {
2815
- namedMatch[1].split(',').forEach((part) => {
2816
- const trimmed = part.trim();
2817
- if (!trimmed)
2818
- return;
2819
- const asParts = trimmed.split(/\s+as\s+/);
2820
- if (asParts[0])
2821
- ids.push(asParts[0].trim());
2822
- if (asParts.length > 1) {
2823
- const alias = asParts[asParts.length - 1];
2824
- if (alias)
2825
- ids.push(alias.trim());
2826
- }
2827
- });
2828
- }
2829
- }
2830
- return ids;
2831
- }
2832
- // ── Core boundary: no Node I/O imports ──────────────────────────────────
2833
- it('CORE_NO_NODE_IO: synthetic-baseline.ts does not import Node I/O modules', async () => {
2834
- const { readFileSync } = await import('node:fs');
2835
- const { resolve } = await import('node:path');
2836
- const src = readFileSync(resolve(__dirname, '..', 'synthetic-baseline.ts'), 'utf-8');
2837
- const importModulePaths = extractImportModulePaths(src);
2838
- for (const mod of FORBIDDEN_NODE_IO_MODULES) {
2839
- const found = importModulePaths.filter((p) => p === mod || p.startsWith(mod + '/'));
2840
- expect(found).toEqual([]);
2841
- }
2842
- });
2843
- // ── Core boundary: no runtime orchestration imports ─────────────────────
2844
- it('CORE_NO_RUNTIME_CLASSES: synthetic-baseline.ts does not import runtime orchestration classes', async () => {
2845
- const { readFileSync } = await import('node:fs');
2846
- const { resolve } = await import('node:path');
2847
- const src = readFileSync(resolve(__dirname, '..', 'synthetic-baseline.ts'), 'utf-8');
2848
- const importIdentifiers = extractImportIdentifiers(src);
2849
- for (const cls of FORBIDDEN_RUNTIME_ORCHESTRATION_CLASSES) {
2850
- expect(importIdentifiers).not.toContain(cls);
2851
- }
2852
- });
2853
- // ── Import parsing: side-effect import detection ────────────────────────
2854
- it('IMPORT_PARSING_SIDE_EFFECT: extractImportModulePaths catches side-effect imports like import "node:fs"', () => {
2855
- const src = `import 'node:fs';\nimport { foo } from 'bar';\n`;
2856
- const paths = extractImportModulePaths(src);
2857
- expect(paths).toContain('node:fs');
2858
- expect(paths).toContain('bar');
2859
- });
2860
- // ── Import parsing: multiline import detection ──────────────────────────
2861
- it('IMPORT_PARSING_MULTILINE: extractImportModulePaths catches multiline imports from forbidden modules', () => {
2862
- const src = `import {\n RuntimeStateManager,\n SqliteContextAssembler\n} from './runtime';\n`;
2863
- const paths = extractImportModulePaths(src);
2864
- expect(paths).toContain('./runtime');
2865
- });
2866
- // ── Import parsing: aliased named import detection ──────────────────────
2867
- it('IMPORT_PARSING_ALIAS: extractImportIdentifiers catches both original and alias for "as" imports', () => {
2868
- const src = `import { RuntimeStateManager as RSM, PainSignalBridge } from './runtime';\n`;
2869
- const ids = extractImportIdentifiers(src);
2870
- expect(ids).toContain('RuntimeStateManager');
2871
- expect(ids).toContain('RSM');
2872
- expect(ids).toContain('PainSignalBridge');
2873
- });
2874
- // ── I/O Runner location ─────────────────────────────────────────────────
2875
- it('IO_RUNNER_OUTSIDE_CORE: I/O runner exists at pd-cli/src/services/synthetic-baseline-runner.ts', async () => {
2876
- const { existsSync } = await import('node:fs');
2877
- const { resolve } = await import('node:path');
2878
- const runnerPath = resolve(__dirname, '../../../../pd-cli/src/services/synthetic-baseline-runner.ts');
2879
- expect(existsSync(runnerPath)).toBe(true);
2880
- });
2881
- // ── CLI Command location ────────────────────────────────────────────────
2882
- it('CLI_COMMAND_OUTSIDE_CORE: CLI command exists at pd-cli/src/commands/runtime-synthetic-baseline.ts', async () => {
2883
- const { existsSync } = await import('node:fs');
2884
- const { resolve } = await import('node:path');
2885
- const cmdPath = resolve(__dirname, '../../../../pd-cli/src/commands/runtime-synthetic-baseline.ts');
2886
- expect(existsSync(cmdPath)).toBe(true);
2887
- });
2888
- // ── Frozen legacy untouched ────────────────────────────────────────────
2889
- it('FROZEN_LEGACY_UNTOUCHED: ADR-0005 frozen files are not imported by synthetic-baseline.ts', async () => {
2890
- const { readFileSync } = await import('node:fs');
2891
- const { resolve } = await import('node:path');
2892
- const src = readFileSync(resolve(__dirname, '..', 'synthetic-baseline.ts'), 'utf-8');
2893
- expect(src).not.toContain('nocturnal-trinity');
2894
- expect(src).not.toContain('nocturnal-arbiter');
2895
- expect(src).not.toContain('nocturnal-service');
2896
- });
2897
- });
2898
- describe('PRI-225: No unsafe type assertions on untrusted metadata arrays', () => {
2899
- it('INTEGRITY_READ_MODEL_NO_AS_STRING_ARRAY: internalization-chain-integrity-read-model.ts must not use `as string[]` on untrusted data', async () => {
2900
- const { readFileSync } = await import('node:fs');
2901
- const { resolve } = await import('node:path');
2902
- const src = readFileSync(resolve(__dirname, '..', 'internalization-chain-integrity-read-model.ts'), 'utf-8');
2903
- expect(src).not.toContain('as string[]');
2904
- });
2905
- });
2906
- // ── PRI-239: Feature flag registry architecture boundary ──────────────────
2907
- //
2908
- // Core: packages/principles-core/src/runtime-v2/feature-flags/feature-flag-contract.ts
2909
- // I/O Loader: packages/pd-cli/src/services/pd-config-loader.ts (PRI-460: replaced feature-flag-loader.ts)
2910
- // CLI Command: packages/pd-cli/src/commands/runtime-features.ts
2911
- // Consumption: packages/pd-cli/src/commands/runtime-canary.ts (GFI check)
2912
- describe('PRI-239: Feature flag registry architecture boundary', () => {
2913
- it('CORE_NO_NODE_IO: feature-flag-contract.ts does not import Node I/O modules', async () => {
2914
- const { readFileSync } = await import('node:fs');
2915
- const { resolve } = await import('node:path');
2916
- const src = readFileSync(resolve(__dirname, '..', 'feature-flags', 'feature-flag-contract.ts'), 'utf-8');
2917
- expect(src).not.toMatch(/from\s+['"]node:fs['"]/);
2918
- expect(src).not.toMatch(/from\s+['"]node:path['"]/);
2919
- expect(src).not.toMatch(/from\s+['"]fs['"]/);
2920
- expect(src).not.toMatch(/from\s+['"]path['"]/);
2921
- expect(src).not.toMatch(/from\s+['"]js-yaml['"]/);
2922
- });
2923
- it('CORE_NO_RUNTIME_CLASSES: feature-flag-contract.ts does not import runtime orchestration classes', async () => {
2924
- const { readFileSync } = await import('node:fs');
2925
- const { resolve } = await import('node:path');
2926
- const src = readFileSync(resolve(__dirname, '..', 'feature-flags', 'feature-flag-contract.ts'), 'utf-8');
2927
- expect(src).not.toContain('RuntimeStateManager');
2928
- expect(src).not.toContain('InternalizationOrchestrator');
2929
- expect(src).not.toContain('SqliteConnection');
2930
- });
2931
- it('IO_LOADER_OUTSIDE_CORE: I/O loader exists at pd-cli/src/services/pd-config-loader.ts', async () => {
2932
- const { existsSync } = await import('node:fs');
2933
- const { resolve } = await import('node:path');
2934
- expect(existsSync(resolve(__dirname, '../../../../pd-cli/src/services/pd-config-loader.ts'))).toBe(true);
2935
- });
2936
- it('CLI_COMMAND_OUTSIDE_CORE: CLI command exists at pd-cli/src/commands/runtime-features.ts', async () => {
2937
- const { existsSync } = await import('node:fs');
2938
- const { resolve } = await import('node:path');
2939
- expect(existsSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-features.ts'))).toBe(true);
2940
- });
2941
- it('FROZEN_LEGACY_UNTOUCHED: ADR-0005 frozen files are not imported by feature-flag-contract.ts', async () => {
2942
- const { readFileSync } = await import('node:fs');
2943
- const { resolve } = await import('node:path');
2944
- const src = readFileSync(resolve(__dirname, '..', 'feature-flags', 'feature-flag-contract.ts'), 'utf-8');
2945
- expect(src).not.toContain('nocturnal-trinity');
2946
- expect(src).not.toContain('nocturnal-arbiter');
2947
- expect(src).not.toContain('nocturnal-service');
2948
- });
2949
- it('CONSUMPTION_WIRED: runtime-canary.ts imports canonical PD config loader', async () => {
2950
- const { readFileSync } = await import('node:fs');
2951
- const { resolve } = await import('node:path');
2952
- const src = readFileSync(resolve(__dirname, '../../../../pd-cli/src/commands/runtime-canary.ts'), 'utf-8');
2953
- expect(src).toContain('pd-config-loader');
2954
- expect(src).toContain('loadPdConfig');
2955
- });
2956
- });
2957
- describe('PRI-304: PD-Owned Config Contract barrel exports and purity', () => {
2958
- it('BARREL_EXPORTS: runtime-v2/index.ts exports PD config contract symbols', async () => {
2959
- const { readFileSync } = await import('node:fs');
2960
- const { resolve } = await import('node:path');
2961
- const src = readFileSync(resolve(__dirname, '..', 'index.ts'), 'utf-8');
2962
- // Core types
2963
- expect(src).toContain('PdConfig');
2964
- expect(src).toContain('PdConfigValidationResult');
2965
- expect(src).toContain('EffectivePdConfig');
2966
- expect(src).toContain('RedactedPdConfigSummary');
2967
- // Core functions
2968
- expect(src).toContain('validatePdConfig');
2969
- expect(src).toContain('computeEffectivePdConfig');
2970
- expect(src).toContain('redactPdConfig');
2971
- expect(src).toContain('redactConfigValue');
2972
- expect(src).toContain('computeFeatureFlagsFromConfig');
2973
- expect(src).toContain('isFeatureEnabled');
2974
- // Defaults
2975
- expect(src).toContain('getDefaultPdConfig');
2976
- expect(src).toContain('DEFAULT_RUNTIME_PROFILE_ID');
2977
- // Config barrel import path
2978
- expect(src).toContain("from './config/index.js'");
2979
- });
2980
- it('CORE_PURE: config/ module has zero infrastructure imports', async () => {
2981
- const { readFileSync } = await import('node:fs');
2982
- const { resolve } = await import('node:path');
2983
- const configDir = resolve(__dirname, '..', 'config');
2984
- const files = ['pd-config-types.ts', 'pd-config-validate.ts', 'pd-config-defaults.ts', 'pd-config-effective.ts', 'pd-config-redaction.ts', 'pd-config-feature-flags.ts', 'index.ts'];
2985
- for (const file of files) {
2986
- const src = readFileSync(resolve(configDir, file), 'utf-8');
2987
- expect(src).not.toContain('node:fs');
2988
- expect(src).not.toContain('node:path');
2989
- expect(src).not.toContain('node:process');
2990
- expect(src).not.toContain('openclaw-plugin');
2991
- expect(src).not.toContain('eval(');
2992
- expect(src).not.toContain('new Function');
2993
- }
2994
- });
2995
- });
2996
- describe('PRI-372: split diagnostician runners extend BasePeerRunner', () => {
2997
- it('DiagRootCauseRunner extends BasePeerRunner', async () => {
2998
- const { DiagRootCauseRunner } = await import('../internalization/diag-rootcause-runner.js');
2999
- const { BasePeerRunner } = await import('../runner/base-peer-runner.js');
3000
- expect(DiagRootCauseRunner.prototype).toBeInstanceOf(BasePeerRunner);
3001
- });
3002
- it('DiagDistillerRunner extends BasePeerRunner', async () => {
3003
- const { DiagDistillerRunner } = await import('../internalization/diag-distiller-runner.js');
3004
- const { BasePeerRunner } = await import('../runner/base-peer-runner.js');
3005
- expect(DiagDistillerRunner.prototype).toBeInstanceOf(BasePeerRunner);
3006
- });
3007
- it('DiagRouterRunner extends BasePeerRunner', async () => {
3008
- const { DiagRouterRunner } = await import('../internalization/diag-router-runner.js');
3009
- const { BasePeerRunner } = await import('../runner/base-peer-runner.js');
3010
- expect(DiagRouterRunner.prototype).toBeInstanceOf(BasePeerRunner);
3011
- });
3012
- });
3013
- // ── PRI-416: Type Single-Ownership Guards ──────────────────────────────────────
3014
- //
3015
- // These guards ensure that critical types/functions are defined exactly once
3016
- // within principles-core/src/. This prevents the "duplicate type definition"
3017
- // debt that led to PRI-413/PRI-415 (e.g., HybridLedgerStore in both
3018
- // principle-tree-ledger.ts and types.ts).
3019
- describe('PRI-416: type single-ownership guards', () => {
3020
- let fs; // eslint-disable-line @typescript-eslint/consistent-type-imports
3021
- let pathModule; // eslint-disable-line @typescript-eslint/consistent-type-imports
3022
- let coreSrcDir;
3023
- beforeAll(async () => {
3024
- fs = await import('fs');
3025
- pathModule = await import('path');
3026
- coreSrcDir = pathModule.resolve(__dirname, '..', '..');
3027
- });
3028
- function findDefinitions(pattern) {
3029
- const hits = [];
3030
- function scan(dir) {
3031
- for (const entry of fs.readdirSync(dir)) {
3032
- const full = pathModule.join(dir, entry);
3033
- const stat = fs.statSync(full);
3034
- if (stat.isDirectory()) {
3035
- if (entry === 'node_modules' || entry === '__tests__')
3036
- continue;
3037
- scan(full);
3038
- }
3039
- else if (entry.endsWith('.ts') && !entry.endsWith('.test.ts') && !entry.endsWith('.d.ts')) {
3040
- const content = fs.readFileSync(full, 'utf-8');
3041
- if (pattern.test(content)) {
3042
- hits.push(full.replace(coreSrcDir + pathModule.sep, '').replace(coreSrcDir + '/', '').replace(/\\/g, '/'));
3043
- }
3044
- }
3045
- }
3046
- }
3047
- scan(coreSrcDir);
3048
- return hits;
3049
- }
3050
- it('InjectablePrinciple is defined exactly once in core/src/', () => {
3051
- const hits = findDefinitions(/export\s+interface\s+InjectablePrinciple\s*\{/);
3052
- expect(hits).toEqual(['prompt-builder/principle-selection.ts']);
3053
- });
3054
- it('HybridLedgerStore is defined exactly once in core/src/', () => {
3055
- const hits = findDefinitions(/export\s+interface\s+HybridLedgerStore\s*\{/);
3056
- expect(hits).toEqual(['runtime-v2/types/ledger-store.ts']);
3057
- });
3058
- it('atomicWriteFileSync is NOT exported from any core/src/ file (PRI-443 Phase 4)', () => {
3059
- // After PRI-443 Phase 4, atomicWriteFileSync is inlined as a PRIVATE helper
3060
- // inside principle-tree-ledger.ts. It must NOT be exported from core.
3061
- const hits = findDefinitions(/export\s+function\s+atomicWriteFileSync\s*\(/);
3062
- expect(hits).toEqual([]);
3063
- });
3064
- it('atomicWriteFileSync is defined exactly once as a private function in principle-tree-ledger.ts (PRI-443 Phase 4)', () => {
3065
- // The function is now a private (non-exported) helper inlined in principle-tree-ledger.ts
3066
- const hits = findDefinitions(/function\s+atomicWriteFileSync\s*\(/);
3067
- expect(hits).toEqual(['principle-tree-ledger.ts']);
3068
- });
3069
- });
3070
- // ── PRI-416: Barrel Cap Guards ────────────────────────────────────────────────
3071
- //
3072
- // The barrel export file (index.ts) must stay lean to avoid bloat.
3073
- // After PRI-415 cleanup, it has ~263 total lines and ~40 export lines.
3074
- // Set upper limits to prevent future regression.
3075
- describe('PRI-416: barrel cap guards', () => {
3076
- const BARREL_MAX_TOTAL_LINES = 300;
3077
- const BARREL_MAX_EXPORT_LINES = 50;
3078
- it('index.ts total lines <= ' + BARREL_MAX_TOTAL_LINES, async () => {
3079
- const fsMod = await import('fs'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3080
- const pathMod = await import('path'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3081
- const barrelPath = pathMod.resolve(__dirname, '..', '..', 'index.ts');
3082
- const content = fsMod.readFileSync(barrelPath, 'utf-8');
3083
- const lineCount = content.split('\n').length;
3084
- expect(lineCount).toBeLessThanOrEqual(BARREL_MAX_TOTAL_LINES);
3085
- });
3086
- it('index.ts export lines <= ' + BARREL_MAX_EXPORT_LINES, async () => {
3087
- const fsMod = await import('fs'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3088
- const pathMod = await import('path'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3089
- const barrelPath = pathMod.resolve(__dirname, '..', '..', 'index.ts');
3090
- const content = fsMod.readFileSync(barrelPath, 'utf-8');
3091
- const exportLines = content.split('\n').filter((l) => /^\s*export\s/.test(l));
3092
- expect(exportLines.length).toBeLessThanOrEqual(BARREL_MAX_EXPORT_LINES);
3093
- });
3094
- });
3095
- // ── PRI-775: Barrel Export Surface Freeze ─────────────────────────────────────
3096
- //
3097
- // The two public barrels (src/index.ts, src/runtime-v2/index.ts) are the first
3098
- // surface every AI task and developer reads; ghost exports accumulate exactly
3099
- // there (PRI-751 audit section 2). The export-name SET of each barrel is
3100
- // frozen via snapshot fixtures: adding OR removing a name must update the
3101
- // fixture with a PRI-tagged reason in the PR. Count-only caps are blind to
3102
- // delete-one-add-one drift, which is how ghost families regrow.
3103
- //
3104
- // The extractor strips comments from captured tokens and validates that every
3105
- // frozen entry is a real identifier — the snapshot must be a name SET, never
3106
- // source-text fragments (review finding: 12/1719 comment-polluted entries).
3107
- // Whitespace variants of the block form are captured, not missed. Wildcard
3108
- // re-exports, default exports and non-identifier captures fail loud: the
3109
- // guard refuses to freeze a surface it cannot prove.
3110
- describe('PRI-775: barrel export surface freeze', () => {
3111
- const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
3112
- function extractExportNames(src) {
3113
- if (/^export\s+\*/m.test(src)) {
3114
- throw new Error('PRI-775: wildcard re-export (`export *`) detected. A name-set snapshot cannot prove '
3115
- + 'the surface of a star re-export, so the freeze refuses to guess: enumerate the '
3116
- + 'exports explicitly or extend this guard deliberately.');
3117
- }
3118
- if (/^export\s+default/m.test(src)) {
3119
- throw new Error('PRI-775: default export detected. A barrel default export is invisible to the '
3120
- + 'name-set snapshot, so the freeze refuses to guess: use a named export or '
3121
- + 'extend this guard deliberately.');
3122
- }
3123
- const names = new Set();
3124
- for (const block of src.match(/\bexport\s*(?:type\s*)?\{[^}]*\}/g) ?? []) {
3125
- // Strip comments BEFORE splitting on commas: a comment that itself
3126
- // contains a comma would otherwise be cut in half and glue comment
3127
- // text onto the following real symbol (hit on real barrel source).
3128
- const inner = block
3129
- .slice(block.indexOf('{') + 1, block.indexOf('}'))
3130
- .replace(/\/\*[\s\S]*?\*\//g, '')
3131
- .replace(/\/\/.*$/gm, '');
3132
- for (let token of inner.split(',')) {
3133
- token = token.trim();
3134
- if (!token)
3135
- continue;
3136
- if (token.startsWith('type '))
3137
- token = token.slice(5).trim();
3138
- const asIdx = token.indexOf(' as ');
3139
- if (asIdx !== -1)
3140
- token = token.slice(asIdx + 4).trim();
3141
- if (!token)
3142
- continue;
3143
- if (!IDENTIFIER_RE.test(token)) {
3144
- throw new Error(`PRI-775: extractor captured a non-identifier export token ${JSON.stringify(token)}. `
3145
- + 'This guard freezes identifier names only; fail loud instead of freezing '
3146
- + 'source-text fragments. Fix the extractor or the barrel formatting.');
3147
- }
3148
- names.add(token);
3149
- }
3150
- }
3151
- for (const m of src.match(/^export (?:const|function|class|interface|enum|abstract class) [A-Za-z0-9_]+/gm) ?? []) {
3152
- const decl = m.split(/\s/).pop();
3153
- if (decl)
3154
- names.add(decl);
3155
- }
3156
- return [...names].sort();
3157
- }
3158
- async function readFixture(fixtureFile) {
3159
- const fsMod = await import('fs'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3160
- const pathMod = await import('path'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3161
- return JSON.parse(fsMod.readFileSync(pathMod.resolve(__dirname, 'fixtures', fixtureFile), 'utf-8'));
3162
- }
3163
- for (const fixtureFile of ['runtime-v2-barrel-surface.json', 'core-barrel-surface.json']) {
3164
- it(`${fixtureFile}: export surface matches the frozen snapshot`, async () => {
3165
- const fsMod = await import('fs'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3166
- const pathMod = await import('path'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3167
- const fixture = await readFixture(fixtureFile);
3168
- const src = fsMod.readFileSync(pathMod.resolve(__dirname, '..', '..', '..', fixture.barrel), 'utf-8');
3169
- const current = extractExportNames(src);
3170
- const added = current.filter((n) => !fixture.names.includes(n));
3171
- const removed = fixture.names.filter((n) => !current.includes(n));
3172
- const diffMessage = [
3173
- `${fixture.barrel} export surface drifted from the frozen snapshot (PRI-775):`,
3174
- ...(added.length > 0 ? [` + added (${added.length}): ${added.join(', ')}`] : []),
3175
- ...(removed.length > 0 ? [` - removed (${removed.length}): ${removed.join(', ')}`] : []),
3176
- 'To change the surface intentionally: update __tests__/fixtures/' + fixtureFile,
3177
- ' and state the reason with a PRI tag in the PR description. Ghost exports',
3178
- ' without production consumers are how barrel entropy regrows (PRI-751 audit).',
3179
- ].join('\n');
3180
- expect(added.length + removed.length, diffMessage).toBe(0);
3181
- });
3182
- }
3183
- it('barrel surface snapshots are self-consistent', async () => {
3184
- for (const fixtureFile of ['runtime-v2-barrel-surface.json', 'core-barrel-surface.json']) {
3185
- const fixture = await readFixture(fixtureFile);
3186
- expect(fixture.names.length, `${fixtureFile}: "count" field is stale`).toBe(fixture.count);
3187
- expect([...fixture.names].sort(), `${fixtureFile}: names are not sorted/deduped`).toEqual(fixture.names);
3188
- expect(new Set(fixture.names).size, `${fixtureFile}: duplicate names`).toBe(fixture.names.length);
3189
- expect(fixture.names.every((n) => IDENTIFIER_RE.test(n)), `${fixtureFile}: snapshot contains non-identifier names (comment/text pollution)`).toBe(true);
3190
- }
3191
- });
3192
- it('extractor contract: comments, aliases, type-only blocks, and fail-loud traps', () => {
3193
- // Comments inside an export block must never leak into the frozen names.
3194
- expect(extractExportNames([
3195
- 'export {',
3196
- ' /** @deprecated use Bar instead */',
3197
- ' Foo,',
3198
- ' Bar, // trailing note',
3199
- "} from './x.js';",
3200
- ].join('\n'))).toEqual(['Bar', 'Foo']);
3201
- // A comma inside a comment must not split the comment in half and glue
3202
- // comment text onto the next symbol (hit on real barrel source).
3203
- expect(extractExportNames([
3204
- 'export {',
3205
- ' // re-exports Foo, not deep imports.',
3206
- ' Foo,',
3207
- ' /* block, comment */ Baz,',
3208
- "} from './x.js';",
3209
- ].join('\n'))).toEqual(['Baz', 'Foo']);
3210
- // Aliases freeze the exported (right-hand) name; inline `type` modifier is honored.
3211
- expect(extractExportNames([
3212
- 'export {',
3213
- ' InternalFoo as Foo,',
3214
- ' type InternalBar as Bar,',
3215
- "} from './x.js';",
3216
- ].join('\n'))).toEqual(['Bar', 'Foo']);
3217
- // `export type { ... }` blocks and value declarations are all captured.
3218
- expect(extractExportNames([
3219
- 'export type { Baz };',
3220
- 'export const QUX = 1;',
3221
- 'export function qux(): void {}',
3222
- 'export class Qux {}',
3223
- 'export interface IQux {}',
3224
- 'export enum QuxKind { A }',
3225
- 'export abstract class BaseQux {}',
3226
- ].join('\n'))).toEqual(['BaseQux', 'Baz', 'IQux', 'QUX', 'Qux', 'QuxKind', 'qux']);
3227
- // Wildcard re-exports cannot be proven by a name snapshot: refuse.
3228
- expect(() => extractExportNames("export * from './x.js';")).toThrow(/wildcard/);
3229
- // Text fragments that never reduce to an identifier fail loud, never freeze.
3230
- expect(() => extractExportNames('export { 123bad } from "./x.js";')).toThrow(/non-identifier/);
3231
- // Whitespace variants of the block form are captured, not missed
3232
- // (`export{Foo}` slipped past the old strict-space regex).
3233
- expect(extractExportNames("export{NoSpace} from './x.js';")).toEqual(['NoSpace']);
3234
- expect(extractExportNames("export type{NoSpaceType} from './x.js';")).toEqual(['NoSpaceType']);
3235
- // A barrel default export is invisible to the name set: refuse.
3236
- expect(() => extractExportNames("import Foo from './x.js';\nexport default Foo;\n")).toThrow(/default/);
3237
- });
3238
- });
3239
- // ── PRI-443: Pure module boundary guards ──────────────────────────────────────
3240
- //
3241
- // Phases 1-3 extracted pure types/codecs/schema out of I/O modules. These guards
3242
- // ensure those pure modules never regress to importing fs/path, and that the
3243
- // runtime-v2 barrel never re-exports I/O functions from principle-tree-ledger.
3244
- describe('PRI-443: pure module boundary guards', () => {
3245
- const FORBIDDEN_PURE_IMPORTS = [
3246
- "from 'fs'",
3247
- 'from "fs"',
3248
- "from 'node:fs'",
3249
- 'from "node:fs"',
3250
- "from 'path'",
3251
- 'from "path"',
3252
- "from 'node:path'",
3253
- 'from "node:path"',
3254
- ];
3255
- async function readSrc(relPath) {
3256
- const fsMod = await import('fs'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3257
- const pathMod = await import('path'); // eslint-disable-line @typescript-eslint/consistent-type-imports
3258
- const full = pathMod.resolve(__dirname, '..', relPath);
3259
- return fsMod.readFileSync(full, 'utf-8');
3260
- }
3261
- it('runtime-v2/types/ledger-store.ts has zero fs/path imports (pure types module)', async () => {
3262
- const src = await readSrc('types/ledger-store.ts');
3263
- for (const pat of FORBIDDEN_PURE_IMPORTS) {
3264
- expect(src).not.toContain(pat);
3265
- }
3266
- });
3267
- it('runtime-v2/principle-tree/ledger-codec.ts has zero fs/path imports (pure codec module)', async () => {
3268
- const src = await readSrc('principle-tree/ledger-codec.ts');
3269
- for (const pat of FORBIDDEN_PURE_IMPORTS) {
3270
- expect(src).not.toContain(pat);
3271
- }
3272
- });
3273
- it('runtime-v2/types/pain-signal.ts has zero fs/path imports (pure schema module)', async () => {
3274
- const src = await readSrc('types/pain-signal.ts');
3275
- for (const pat of FORBIDDEN_PURE_IMPORTS) {
3276
- expect(src).not.toContain(pat);
3277
- }
3278
- });
3279
- it('runtime-v2/index.ts barrel does NOT export I/O functions from principle-tree-ledger', async () => {
3280
- const src = await readSrc('index.ts');
3281
- // I/O functions must not be re-exported through the pure-types barrel.
3282
- expect(src).not.toMatch(/export\s+\{[^}]*\bloadLedger\b[^}]*\}\s*from\s*['"]\.\.\/principle-tree-ledger/);
3283
- expect(src).not.toMatch(/export\s+\{[^}]*\bsaveLedger\b[^}]*\}\s*from\s*['"]\.\.\/principle-tree-ledger/);
3284
- expect(src).not.toMatch(/export\s+\{[^}]*\bgetLedgerFilePathPublic\b[^}]*\}\s*from\s*['"]\.\.\/principle-tree-ledger/);
3285
- expect(src).not.toMatch(/export\s+\{[^}]*\bupdatePrinciple\b[^}]*\}\s*from\s*['"]\.\.\/principle-tree-ledger/);
3286
- expect(src).not.toMatch(/export\s+\{[^}]*\batomicWriteFileSync\b[^}]*\}\s*from\s*['"]\.\.\/principle-tree-ledger/);
3287
- });
3288
- it('runtime-v2/index.ts barrel re-exports LedgerTreeStore type from pure types module, not from principle-tree-ledger', async () => {
3289
- const src = await readSrc('index.ts');
3290
- // The type must come from the pure types module (./types/ledger-store.js),
3291
- // NOT from the I/O module (../principle-tree-ledger.js).
3292
- expect(src).toMatch(/export\s+type\s+\{\s*LedgerTreeStore\s*\}\s*from\s*['"]\.\/types\/ledger-store\.js['"]/);
3293
- expect(src).not.toMatch(/export\s+type\s+\{\s*LedgerTreeStore\s*\}\s*from\s*['"]\.\.\/principle-tree-ledger\.js['"]/);
3294
- });
3295
- });
3296
- describe('PRI-450 / PRI-462: core I/O seam registry guard', () => {
3297
- // Registry lives at packages/principles-core/io-seam-registry.json
3298
- // (3 levels up from __tests__: __tests__ → runtime-v2 → src → principles-core)
3299
- const registryPath = pathSync.resolve(__dirname, '..', '..', '..', 'io-seam-registry.json');
3300
- const registryRaw = fsSync.readFileSync(registryPath, 'utf-8');
3301
- const registry = JSON.parse(registryRaw);
3302
- // Runtime-validate the registry shape (Runtime Contract Rule 1+2: treat
3303
- // parsed JSON as unknown, validate with typeof/Array.isArray before access).
3304
- // `as` is used only for type narrowing AFTER runtime checks, not to bypass them.
3305
- function isValidRegistry(v) {
3306
- if (typeof v !== 'object' || v === null || !Object.hasOwn(v, 'seams'))
3307
- return false;
3308
- const { seams } = v;
3309
- if (!Array.isArray(seams))
3310
- return false;
3311
- return seams.every((s) => typeof s === 'object' && s !== null &&
3312
- typeof s.name === 'string' &&
3313
- typeof s.description === 'string' &&
3314
- Array.isArray(s.files) &&
3315
- s.files.every((f) => typeof f === 'string'));
3316
- }
3317
- // Flatten all registry files into a Set (relative to packages/principles-core/src/).
3318
- const ALLOWED_IO_FILES = new Set(isValidRegistry(registry)
3319
- ? registry.seams.flatMap((s) => s.files)
3320
- : []);
3321
- // Extract all RUNTIME import module paths from source code.
3322
- // Handles: import ... from 'mod', import 'mod' (side-effect), and multiline imports.
3323
- // EXCLUDES `import type ... from` — type-only imports are erased at compile time
3324
- // and do not introduce runtime I/O. Reuses the same pattern proven in the
3325
- // PRI-215 extractImportModulePaths helper.
3326
- //
3327
- // The negative lookahead `(?!type\b)` after `import\s+` prevents matching
3328
- // `import type { X } from 'mod'` and `import type X from 'mod'`.
3329
- function extractImportPaths(src) {
3330
- const paths = [];
3331
- // `import ... from 'mod'` — but NOT `import type ... from 'mod'`.
3332
- for (const m of src.matchAll(/import\s+(?!type\b)[\s\S]*?from\s+['"]([^'"]+)['"]/g)) {
3333
- if (m[1] != null)
3334
- paths.push(m[1]);
3335
- }
3336
- // Side-effect `import 'mod'` — `import type 'mod'` is not valid TS so no
3337
- // exclusion needed, but the lookahead keeps it defensive.
3338
- for (const m of src.matchAll(/import\s+(?!type\b)['"]([^'"]+)['"]/g)) {
3339
- if (m[1] != null && !paths.includes(m[1]))
3340
- paths.push(m[1]);
3341
- }
3342
- return paths;
3343
- }
3344
- // Check if any runtime import path references a Node I/O module.
3345
- // Covers fs, path, child_process, better-sqlite3 (including sub-paths like fs/promises).
3346
- // Type-only imports (`import type ... from 'fs'`) are excluded by extractImportPaths.
3347
- //
3348
- // This MUST stay in sync with eslint.config.js `no-restricted-imports` patterns.
3349
- // ESLint uses `allowTypeImports: true` for child_process/better-sqlite3, so the
3350
- // arch test is the runtime-I/O backstop for those modules.
3351
- function importsNodeIo(src) {
3352
- const paths = extractImportPaths(src);
3353
- return paths.some((p) => p === 'fs' || p.startsWith('fs/') ||
3354
- p === 'node:fs' || p.startsWith('node:fs/') ||
3355
- p === 'path' || p.startsWith('path/') ||
3356
- p === 'node:path' || p.startsWith('node:path/') ||
3357
- p === 'child_process' || p.startsWith('child_process/') ||
3358
- p === 'node:child_process' || p.startsWith('node:child_process/') ||
3359
- p === 'better-sqlite3');
3360
- }
3361
- // Back-compat alias: keep the old name working for any external callers/tests
3362
- // that referenced importsFsOrPath directly. New code should use importsNodeIo.
3363
- const importsFsOrPath = importsNodeIo;
3364
- function collectTsFiles(dir, acc) {
3365
- const entries = fsSync.readdirSync(dir, { withFileTypes: true });
3366
- for (const entry of entries) {
3367
- const fullPath = pathSync.join(dir, entry.name);
3368
- if (entry.isDirectory()) {
3369
- collectTsFiles(fullPath, acc);
3370
- }
3371
- else if (entry.isFile() &&
3372
- entry.name.endsWith('.ts') &&
3373
- !entry.name.endsWith('.test.ts') &&
3374
- !entry.name.endsWith('.spec.ts')) {
3375
- acc.push(fullPath);
3376
- }
3377
- }
3378
- }
3379
- // ── Registry validity (PRI-462) ───────────────────────────────────────────
3380
- it('io-seam-registry.json is valid: seams array with name/description/files', () => {
3381
- expect(isValidRegistry(registry)).toBe(true);
3382
- if (!isValidRegistry(registry))
3383
- return; // type narrowing
3384
- expect(registry.seams.length).toBeGreaterThan(0);
3385
- for (const seam of registry.seams) {
3386
- expect(seam.name.length).toBeGreaterThan(0);
3387
- expect(seam.description.length).toBeGreaterThan(0);
3388
- expect(seam.files.length).toBeGreaterThan(0);
3389
- }
3390
- });
3391
- it('registry has no duplicate files across seams', () => {
3392
- if (!isValidRegistry(registry)) {
3393
- // isValidRegistry test above will fail with details; skip here.
3394
- expect(isValidRegistry(registry)).toBe(true);
3395
- return;
3396
- }
3397
- const seen = new Set();
3398
- const dupes = [];
3399
- for (const seam of registry.seams) {
3400
- for (const f of seam.files) {
3401
- if (seen.has(f))
3402
- dupes.push(f);
3403
- seen.add(f);
3404
- }
3405
- }
3406
- expect(dupes).toEqual([]);
3407
- });
3408
- it('every seam description explains why the I/O is allowed (non-trivial)', () => {
3409
- if (!isValidRegistry(registry)) {
3410
- expect(isValidRegistry(registry)).toBe(true);
3411
- return;
3412
- }
3413
- const weak = [];
3414
- for (const seam of registry.seams) {
3415
- // Description must be at least 20 chars — a single word like "legacy" is
3416
- // not an explanation. This forces maintainers to write a real rationale.
3417
- if (seam.description.trim().length < 20) {
3418
- weak.push(`${seam.name}: "${seam.description}"`);
3419
- }
3420
- }
3421
- expect(weak).toEqual([]);
3422
- });
3423
- // ── Registry ↔ production files (PRI-450, EP-02) ──────────────────────────
3424
- it('core/src/ production files: only registry-listed files import Node I/O modules (fs/path/child_process/better-sqlite3)', () => {
3425
- const coreSrcDir = pathSync.resolve(__dirname, '..', '..');
3426
- const allFiles = [];
3427
- collectTsFiles(coreSrcDir, allFiles);
3428
- const violations = [];
3429
- for (const filePath of allFiles) {
3430
- const content = fsSync.readFileSync(filePath, 'utf-8');
3431
- if (importsNodeIo(content)) {
3432
- const relPath = pathSync.relative(coreSrcDir, filePath).replace(/\\/g, '/');
3433
- if (!ALLOWED_IO_FILES.has(relPath)) {
3434
- violations.push(relPath);
3435
- }
3436
- }
3437
- }
3438
- if (violations.length > 0) {
3439
- throw new Error(`Found ${violations.length} file(s) importing fs/path/child_process/better-sqlite3 that are NOT in io-seam-registry.json.\n` +
3440
- `Add them to the appropriate seam in packages/principles-core/io-seam-registry.json.\n` +
3441
- `Note: \`import type\` from these modules is allowed (erased at runtime) and won't trigger this.\n` +
3442
- `Violations:\n ` + violations.join('\n '));
3443
- }
3444
- });
3445
- it('registry-listed files all exist on disk', () => {
3446
- const coreSrcDir = pathSync.resolve(__dirname, '..', '..');
3447
- const missing = [];
3448
- for (const relPath of ALLOWED_IO_FILES) {
3449
- const fullPath = pathSync.join(coreSrcDir, ...relPath.split('/'));
3450
- if (!fsSync.existsSync(fullPath)) {
3451
- missing.push(relPath);
3452
- }
3453
- }
3454
- expect(missing).toEqual([]);
3455
- });
3456
- // ── Registry ↔ ESLint exemption (PRI-462, EP-06 single source of truth) ───
3457
- //
3458
- // ESLint's no-restricted-imports exemption list must be DERIVED from the
3459
- // registry, not hand-maintained. This test verifies eslint.config.js
3460
- // references the registry file, proving the two stay in sync.
3461
- it('eslint.config.js derives fs/path exemption from the registry (no shadow list)', () => {
3462
- const eslintPath = pathSync.resolve(__dirname, '..', '..', '..', '..', '..', 'eslint.config.js');
3463
- const eslintSrc = fsSync.readFileSync(eslintPath, 'utf-8');
3464
- // The eslint config must read the registry JSON — if this reference is
3465
- // removed, someone has reintroduced a hand-maintained shadow list.
3466
- expect(eslintSrc).toContain('io-seam-registry.json');
3467
- });
3468
- // ── Helper unit tests ─────────────────────────────────────────────────────
3469
- it('importsNodeIo detects sub-path imports (fs/promises) and side-effect imports', () => {
3470
- // Sub-path import
3471
- expect(importsNodeIo(`import { mkdir } from 'node:fs/promises';`)).toBe(true);
3472
- expect(importsNodeIo(`import { posix } from 'path/posix';`)).toBe(true);
3473
- // Side-effect import
3474
- expect(importsNodeIo(`import 'fs';`)).toBe(true);
3475
- expect(importsNodeIo(`import "node:path";`)).toBe(true);
3476
- // Standard import
3477
- expect(importsNodeIo(`import * as fs from 'fs';`)).toBe(true);
3478
- expect(importsNodeIo(`import { resolve } from 'node:path';`)).toBe(true);
3479
- // Non-I/O imports
3480
- expect(importsNodeIo(`import { foo } from 'bar';`)).toBe(false);
3481
- expect(importsNodeIo(``)).toBe(false);
3482
- });
3483
- it('importsNodeIo detects child_process and better-sqlite3 runtime imports', () => {
3484
- // Runtime child_process imports
3485
- expect(importsNodeIo(`import { spawn } from 'child_process';`)).toBe(true);
3486
- expect(importsNodeIo(`import { execSync } from 'node:child_process';`)).toBe(true);
3487
- expect(importsNodeIo(`import { fork } from 'child_process/promises';`)).toBe(true);
3488
- // Runtime better-sqlite3 import
3489
- expect(importsNodeIo(`import Database from 'better-sqlite3';`)).toBe(true);
3490
- // Mixed runtime + type import from child_process (still runtime I/O)
3491
- expect(importsNodeIo(`import { spawn, type SpawnOptions } from 'child_process';`)).toBe(true);
3492
- });
3493
- it('importsNodeIo EXCLUDES `import type` (erased at runtime, no I/O)', () => {
3494
- // Type-only imports from forbidden modules — must NOT trigger
3495
- expect(importsNodeIo(`import type { Database } from 'better-sqlite3';`)).toBe(false);
3496
- expect(importsNodeIo(`import type BetterSqlite3 from 'better-sqlite3';`)).toBe(false);
3497
- expect(importsNodeIo(`import type { SpawnOptions } from 'child_process';`)).toBe(false);
3498
- expect(importsNodeIo(`import type { Stats } from 'node:fs';`)).toBe(false);
3499
- expect(importsNodeIo(`import type { Platform } from 'node:process';`)).toBe(false);
3500
- // Mixed: a real `import type` next to a runtime import from a DIFFERENT module
3501
- // — the type import is excluded, the runtime import is detected.
3502
- expect(importsNodeIo(`import type { Database } from 'better-sqlite3';\nimport { spawn } from 'child_process';`)).toBe(true);
3503
- });
3504
- it('importsFsOrPath alias stays in sync with importsNodeIo', () => {
3505
- // The back-compat alias must point to the same implementation.
3506
- expect(importsFsOrPath(`import { spawn } from 'child_process';`)).toBe(true);
3507
- expect(importsFsOrPath(`import type { Database } from 'better-sqlite3';`)).toBe(false);
3508
- });
3509
- });
3510
- // ===========================================================================
3511
- // SEC-BASE-1: Supply Chain Provenance Guards
3512
- // Guards the npm publish / CI supply chain controls declared in
3513
- // docs/architecture/SECURITY_BASELINE.md §3 (supply chain layer).
3514
- // ===========================================================================
3515
- describe('SEC-BASE-1: supply chain provenance guards', () => {
3516
- const REPO_ROOT = pathSync.resolve(__dirname, '../../../../..');
3517
- function readWorkflow(name) {
3518
- const p = pathSync.join(REPO_ROOT, '.github', 'workflows', name);
3519
- try {
3520
- return fsSync.readFileSync(p, 'utf8');
3521
- }
3522
- catch {
3523
- return null;
3524
- }
3525
- }
3526
- it('publish surface uses --provenance', () => {
3527
- // Changesets cutover (SPEC v1.2): the per-package npm publish command
3528
- // moved from publish-npm.yml into the shared action the train calls —
3529
- // the invariant spans the whole publish surface.
3530
- const workflow = readWorkflow('publish-npm.yml');
3531
- expect(workflow, 'publish-npm.yml should exist').not.toBeNull();
3532
- const actionPath = pathSync.join(REPO_ROOT, '.github', 'actions', 'publish-npm-package', 'action.yml');
3533
- let action = '';
3534
- try {
3535
- action = fsSync.readFileSync(actionPath, 'utf8');
3536
- }
3537
- catch {
3538
- action = '';
3539
- }
3540
- expect(`${workflow}\n${action}`).toMatch(/npm\s+publish\s+--provenance/);
3541
- });
3542
- it('publish-npm.yml uses npm ci --ignore-scripts', () => {
3543
- const content = readWorkflow('publish-npm.yml');
3544
- expect(content).not.toBeNull();
3545
- expect(content).toMatch(/npm\s+ci\s+--ignore-scripts/);
3546
- });
3547
- it('SECURITY.md exists at .github/SECURITY.md', () => {
3548
- const p = pathSync.join(REPO_ROOT, '.github', 'SECURITY.md');
3549
- expect(fsSync.existsSync(p), `${p} should exist`).toBe(true);
3550
- });
3551
- it('CodeQL workflow targets javascript-typescript', () => {
3552
- const content = readWorkflow('codeql.yml');
3553
- expect(content, 'codeql.yml should exist').not.toBeNull();
3554
- expect(content).toMatch(/javascript-typescript/);
3555
- });
3556
- it('dependabot.yml covers npm and github-actions', () => {
3557
- const p = pathSync.join(REPO_ROOT, '.github', 'dependabot.yml');
3558
- const content = fsSync.readFileSync(p, 'utf8');
3559
- expect(content).toMatch(/package-ecosystem:\s*['"]?npm['"]?/m);
3560
- expect(content).toMatch(/package-ecosystem:\s*['"]?github-actions['"]?/m);
3561
- });
3562
- });
3563
- // ===========================================================================
3564
- // SEC-BASE-2: Sandbox Escape Regression Guards
3565
- // Guards the vm sandbox layer declared in SECURITY_BASELINE.md §4.
3566
- // Escape payload regression lives in
3567
- // packages/openclaw-plugin/tests/core/sandbox-escape-regression.test.ts
3568
- // ===========================================================================
3569
- describe('SEC-BASE-2: sandbox escape regression guards', () => {
3570
- const REPO_ROOT = pathSync.resolve(__dirname, '../../../../..');
3571
- it('rule-code-validator forbids import.meta', async () => {
3572
- const { checkForbiddenPatterns } = await import('../internalization/rule-code-validator.js');
3573
- const labels = checkForbiddenPatterns('const u = import.meta.url;');
3574
- expect(labels).toContain('import.meta');
3575
- });
3576
- it('rule-code-validator forbids WeakRef / FinalizationRegistry', async () => {
3577
- const { checkForbiddenPatterns } = await import('../internalization/rule-code-validator.js');
3578
- expect(checkForbiddenPatterns('new WeakRef({});')).toContain('WeakRef');
3579
- expect(checkForbiddenPatterns('new FinalizationRegistry(() => {});')).toContain('FinalizationRegistry');
3580
- });
3581
- it('rule-code-validator forbids SharedArrayBuffer / Atomics', async () => {
3582
- const { checkForbiddenPatterns } = await import('../internalization/rule-code-validator.js');
3583
- expect(checkForbiddenPatterns('new SharedArrayBuffer(8);')).toContain('SharedArrayBuffer');
3584
- expect(checkForbiddenPatterns('Atomics.load(new Int32Array(1), 0);')).toContain('Atomics');
3585
- });
3586
- it('rule-implementation-runtime.ts uses spawnSync with bounded resources', () => {
3587
- const sourcePath = pathSync.join(REPO_ROOT, 'packages', 'openclaw-plugin', 'src', 'core', 'rule-implementation-runtime.ts');
3588
- const source = fsSync.readFileSync(sourcePath, 'utf8');
3589
- expect(source).toContain('spawnSync');
3590
- expect(source).toContain('windowsHide: true');
3591
- expect(source).toContain('maxBuffer');
3592
- expect(source).toContain('--max-old-space-size');
3593
- expect(source).toMatch(/timeout:\s*\w+/);
3594
- });
3595
- });
3596
- // ===========================================================================
3597
- // SEC-BASE-3: PII Redaction Guards
3598
- // Guards that the implemented PII sanitization patterns exist in
3599
- // openclaw-plugin (trajectory.ts redactText) and that message-sanitize hook
3600
- // applies sanitization to message content.
3601
- //
3602
- // IMPLEMENTED (MVP): <EMAIL>, <TOKEN> (sk/rk/pk prefix), <PATH>, <WINDOWS_PATH>
3603
- // POST-MVP GAPS (documented in SECURITY_BASELINE.md): <PHONE>, <CARD>, <IP>
3604
- // ===========================================================================
3605
- describe('SEC-BASE-3: PII redaction guards', () => {
3606
- const REPO_ROOT = pathSync.resolve(__dirname, '../../../../..');
3607
- it('openclaw-plugin contains email redaction pattern with <EMAIL> replacement', () => {
3608
- const pluginDir = pathSync.join(REPO_ROOT, 'packages', 'openclaw-plugin', 'src');
3609
- const files = fsSync.readdirSync(pluginDir, { recursive: true, encoding: 'utf8' })
3610
- .filter((f) => typeof f === 'string' && f.endsWith('.ts') && !f.includes('__tests__'));
3611
- let foundEmail = false;
3612
- for (const f of files) {
3613
- const content = fsSync.readFileSync(pathSync.join(pluginDir, f), 'utf8');
3614
- // Look for: <EMAIL> replacement token AND a regex containing @ (email pattern)
3615
- if (/<EMAIL>/.test(content) && /\.\s*replace\s*\(\s*\/.*@.*\//.test(content)) {
3616
- foundEmail = true;
3617
- break;
3618
- }
3619
- }
3620
- expect(foundEmail, 'openclaw-plugin should contain email redaction pattern with <EMAIL> replacement').toBe(true);
3621
- });
3622
- it('openclaw-plugin contains API token redaction pattern (<TOKEN> with sk/rk/pk prefix)', () => {
3623
- const pluginDir = pathSync.join(REPO_ROOT, 'packages', 'openclaw-plugin', 'src');
3624
- const files = fsSync.readdirSync(pluginDir, { recursive: true, encoding: 'utf8' })
3625
- .filter((f) => typeof f === 'string' && f.endsWith('.ts') && !f.includes('__tests__'));
3626
- let foundToken = false;
3627
- for (const f of files) {
3628
- const content = fsSync.readFileSync(pathSync.join(pluginDir, f), 'utf8');
3629
- // Look for: <TOKEN> replacement token AND a regex containing (sk|rk|pk)
3630
- if (/<TOKEN>/.test(content) && /\(sk\|rk\|pk\)/.test(content)) {
3631
- foundToken = true;
3632
- break;
3633
- }
3634
- }
3635
- expect(foundToken, 'openclaw-plugin should contain API token redaction pattern with <TOKEN> replacement').toBe(true);
3636
- });
3637
- it('openclaw-plugin message-sanitize hook applies sanitization', () => {
3638
- const sourcePath = pathSync.join(REPO_ROOT, 'packages', 'openclaw-plugin', 'src', 'hooks', 'message-sanitize.ts');
3639
- const source = fsSync.readFileSync(sourcePath, 'utf8');
3640
- // Delegate pattern: import from core + apply to message content
3641
- expect(source).toMatch(/coreSanitize|sanitizeValue|sanitiz/i);
3642
- });
3643
- });
3644
- // ===========================================================================
3645
- // SEC-BASE-4: Log Secret Redaction & SQLite SQL Injection Guards
3646
- // Guards that:
3647
- // (a) core does not emit raw secret-named fields in logger output
3648
- // (b) core does not string-concatenate SQL (uses parameterized queries)
3649
- // ===========================================================================
3650
- describe('SEC-BASE-4: log secret redaction & SQL injection guards', () => {
3651
- const REPO_ROOT = pathSync.resolve(__dirname, '../../../../..');
3652
- it('core source does not log raw api_key / token / secret / password fields', () => {
3653
- const coreDir = pathSync.join(REPO_ROOT, 'packages', 'principles-core', 'src');
3654
- const files = fsSync.readdirSync(coreDir, { recursive: true, encoding: 'utf8' })
3655
- .filter((f) => typeof f === 'string' && f.endsWith('.ts') && !f.includes('__tests__'));
3656
- const suspicious = [];
3657
- for (const f of files) {
3658
- const content = fsSync.readFileSync(pathSync.join(coreDir, f), 'utf8');
3659
- const lines = content.split('\n');
3660
- lines.forEach((line, idx) => {
3661
- if (/log(ger)?\./i.test(line) || /console\./.test(line)) {
3662
- if (/\b(api[_-]?key|token|secret|password|credential)\b/i.test(line) && !/<REDACTED>/.test(line) && !/sanitiz/i.test(line)) {
3663
- suspicious.push(`${f}:${idx + 1}: ${line.trim()}`);
3664
- }
3665
- }
3666
- });
3667
- }
3668
- expect(suspicious, `Suspicious unredacted logger lines in core:\n${suspicious.join('\n')}`).toEqual([]);
3669
- });
3670
- it('core source does not string-concatenate SQL statements', () => {
3671
- const coreDir = pathSync.join(REPO_ROOT, 'packages', 'principles-core', 'src');
3672
- const files = fsSync.readdirSync(coreDir, { recursive: true, encoding: 'utf8' })
3673
- .filter((f) => typeof f === 'string'
3674
- && f.endsWith('.ts')
3675
- && !f.endsWith('.test.ts')
3676
- && !f.includes('__tests__'));
3677
- const suspicious = [];
3678
- // Known-safe pre-built clause variables (constructed from controlled
3679
- // conditions with `?` placeholders for values — not user input).
3680
- // `placeholders` = e.g. `ids.map(() => '?').join(',')` → generates `?,?,?`
3681
- // (a string of `?` placeholder characters, NOT user values).
3682
- const SAFE_CLAUSE_VARS = new Set([
3683
- 'whereClause', 'orderByClause', 'limitClause', 'setClause',
3684
- 'conflictClause', 'returningClause', 'onConflictClause',
3685
- 'placeholders',
3686
- ]);
3687
- // DML statements that MUST use parameterized values (`?` placeholders).
3688
- // DDL (ALTER TABLE / CREATE TABLE / CREATE INDEX / DROP) is excluded
3689
- // because SQLite does not accept `?` placeholders for identifiers (column
3690
- // names, table names) — DDL string-concat with controlled constants is
3691
- // the only valid pattern and is verified separately.
3692
- const DML_RE = /\b(SELECT|INSERT\s+INTO|UPDATE\s+\w|DELETE\s+FROM)\b/i;
3693
- for (const f of files) {
3694
- const content = fsSync.readFileSync(pathSync.join(coreDir, f), 'utf8');
3695
- // Find line number offset for reporting.
3696
- const lines = content.split('\n');
3697
- // Match .prepare(`...`) and .exec(`...`) template-literal SQL arguments.
3698
- // Uses [\s\S]*? (non-greedy, dotAll-equivalent) to capture multi-line
3699
- // template literals. Only the FIRST argument (the SQL string) is inspected.
3700
- const templateSqlRe = /\.(prepare|exec)\s*\(\s*`([\s\S]*?)`/g;
3701
- let m;
3702
- while ((m = templateSqlRe.exec(content)) !== null) {
3703
- // rc-2-no-as-bypass: RegExpExecArray indices are `string | undefined`
3704
- // under noUncheckedIndexedAccess. Use array destructuring (ESLint
3705
- // prefer-destructuring) + explicit undefined check (fail-loud).
3706
- const [, , sqlBody] = m;
3707
- if (sqlBody === undefined)
3708
- continue;
3709
- if (!DML_RE.test(sqlBody))
3710
- continue; // DDL-only is allowed
3711
- // Find line number of the match start.
3712
- const matchOffset = m.index;
3713
- const lineNum = content.slice(0, matchOffset).split('\n').length;
3714
- // Check for `${X}` interpolations inside the SQL template body.
3715
- const interpRe = /\$\{([^}]+)\}/g;
3716
- let im;
3717
- while ((im = interpRe.exec(sqlBody)) !== null) {
3718
- const [, expr] = im;
3719
- if (expr === undefined)
3720
- continue;
3721
- const exprTrimmed = expr.trim();
3722
- // Safe: ends with .join(...) — column-list / placeholder-list pattern.
3723
- if (/\.join\s*\(/.test(exprTrimmed))
3724
- continue;
3725
- // Safe: known pre-built clause variable.
3726
- const rootVar = exprTrimmed.split('.')[0]?.split('[')[0]?.split('(')[0];
3727
- if (rootVar !== undefined && SAFE_CLAUSE_VARS.has(rootVar.trim()))
3728
- continue;
3729
- // Safe: numeric / length / index expressions (not user data).
3730
- if (/^\d+$/.test(exprTrimmed) || /\.length$/.test(exprTrimmed))
3731
- continue;
3732
- suspicious.push(`${f}:${lineNum}: interpolation \${${exprTrimmed}} in DML template`);
3733
- }
3734
- }
3735
- // Also check for string-concatenation pattern: .prepare('...' + var + '...')
3736
- // This is a single-line check (string concat SQL is rarely multi-line).
3737
- const concatSqlRe = /\.(prepare|exec)\s*\(\s*['"][^'"]*['"]\s*\+/g;
3738
- let cm;
3739
- while ((cm = concatSqlRe.exec(content)) !== null) {
3740
- const lineNum = content.slice(0, cm.index).split('\n').length;
3741
- const line = lines[lineNum - 1] || '';
3742
- // Only flag if the concatenated string contains DML keywords.
3743
- if (DML_RE.test(line)) {
3744
- suspicious.push(`${f}:${lineNum}: string-concat in DML: ${line.trim()}`);
3745
- }
3746
- }
3747
- }
3748
- expect(suspicious, `Suspicious string-concatenated or interpolated DML in core:\n${suspicious.join('\n')}`).toEqual([]);
3749
- });
3750
- });
3751
- // ===========================================================================
3752
- // SEC-BASE-5: Network & Config Isolation Guards
3753
- // Guards:
3754
- // (a) core does not import node:http / node:https / undici / fetch (NET-1)
3755
- // (b) pd-console server config does not default to 0.0.0.0 (NET-5)
3756
- // (c) code_tool_hook config defaults to require_approval (CFG-4)
3757
- // ===========================================================================
3758
- describe('SEC-BASE-5: network & config isolation guards', () => {
3759
- const REPO_ROOT = pathSync.resolve(__dirname, '../../../../..');
3760
- it('core does not import node:http / node:https / undici / fetch for business', () => {
3761
- // PRI-683: pi-ai-http-transport.ts is the registered exception
3762
- // (io-seam-registry.json `pi-ai-http-transport` seam). It owns the LLM
3763
- // transport's undici Agent config; requests still originate from pi-ai.
3764
- const registryPath = pathSync.join(REPO_ROOT, 'packages', 'principles-core', 'io-seam-registry.json');
3765
- const registry = JSON.parse(fsSync.readFileSync(registryPath, 'utf8'));
3766
- const registeredFiles = new Set();
3767
- for (const seam of registry.seams) {
3768
- for (const file of seam.files)
3769
- registeredFiles.add(file);
3770
- }
3771
- const coreDir = pathSync.join(REPO_ROOT, 'packages', 'principles-core', 'src');
3772
- const files = fsSync.readdirSync(coreDir, { recursive: true, encoding: 'utf8' })
3773
- .filter((f) => typeof f === 'string' && f.endsWith('.ts') && !f.includes('__tests__'));
3774
- const violations = [];
3775
- for (const f of files) {
3776
- const content = fsSync.readFileSync(pathSync.join(coreDir, f), 'utf8');
3777
- const lines = content.split('\n');
3778
- const isRegisteredSeam = registeredFiles.has(f.replace(/\\/g, '/'));
3779
- lines.forEach((line, idx) => {
3780
- if (/^import\s+type/.test(line.trim()))
3781
- return;
3782
- if (/from\s+['"]node:http['"]/.test(line) || /from\s+['"]node:https['"]/.test(line)
3783
- || /from\s+['"]undici['"]/.test(line) || /from\s+['"]node-fetch['"]/.test(line)) {
3784
- if (isRegisteredSeam)
3785
- return;
3786
- violations.push(`${f}:${idx + 1}: ${line.trim()}`);
3787
- }
3788
- if (!/^\s*(\/\/|\/\*|\*)/.test(line) && /\bfetch\s*\(/.test(line) && !/import/.test(line)) {
3789
- if (isRegisteredSeam)
3790
- return;
3791
- violations.push(`${f}:${idx + 1}: ${line.trim()}`);
3792
- }
3793
- });
3794
- }
3795
- expect(violations, `core should not import network modules (NET-1):\n${violations.join('\n')}`).toEqual([]);
3796
- });
3797
- it('pd-console server config does not default to 0.0.0.0', () => {
3798
- const consoleDir = pathSync.join(REPO_ROOT, 'packages', 'pd-console', 'src');
3799
- if (!fsSync.existsSync(consoleDir)) {
3800
- // pd-console may not exist in this worktree — skip with explicit note
3801
- console.warn('SEC-BASE-5: pd-console src dir not found, skipping bind_host check');
3802
- return;
3803
- }
3804
- const files = fsSync.readdirSync(consoleDir, { recursive: true, encoding: 'utf8' })
3805
- .filter((f) => typeof f === 'string' && f.endsWith('.ts'));
3806
- const violations = [];
3807
- for (const f of files) {
3808
- const content = fsSync.readFileSync(pathSync.join(consoleDir, f), 'utf8');
3809
- const lines = content.split('\n');
3810
- lines.forEach((line, idx) => {
3811
- // rc-9-no-silent-fallback: previously used `!/comment/.test(line)` which
3812
- // matched any line containing the substring "comment" (e.g. a variable
3813
- // named `commentField`), silently skipping real 0.0.0.0 defaults.
3814
- // Only skip genuine comment lines.
3815
- const trimmed = line.trim();
3816
- const isCommentLine = trimmed.startsWith('//') || trimmed.startsWith('*') || trimmed.startsWith('/*');
3817
- if (/host\s*[:=]\s*['"]0\.0\.0\.0['"]/.test(line) && !isCommentLine) {
3818
- violations.push(`${f}:${idx + 1}: ${line.trim()}`);
3819
- }
3820
- });
3821
- }
3822
- expect(violations, `pd-console should not default to 0.0.0.0 (NET-5):\n${violations.join('\n')}`).toEqual([]);
3823
- });
3824
- it('code_tool_hook config defaults to require_approval', () => {
3825
- // rc-9-no-silent-fallback: this was previously `expect(true).toBe(true)`
3826
- // (a tautology that always passed, giving false confidence). Now it fails
3827
- // loud if the require_approval decision is removed from the codebase.
3828
- // The `requireApproval` decision is enforced in gate.ts and is the
3829
- // MVP-Core safety boundary for code_tool_hook.
3830
- const pluginDir = pathSync.join(REPO_ROOT, 'packages', 'openclaw-plugin', 'src');
3831
- const files = fsSync.readdirSync(pluginDir, { recursive: true, encoding: 'utf8' })
3832
- .filter((f) => typeof f === 'string' && f.endsWith('.ts') && !f.includes('__tests__'));
3833
- let foundRequireApproval = false;
3834
- for (const f of files) {
3835
- const content = fsSync.readFileSync(pathSync.join(pluginDir, f), 'utf8');
3836
- if (/code[_-]?tool[_-]?hook/i.test(content) && /require[_-]?approval/i.test(content)) {
3837
- foundRequireApproval = true;
3838
- break;
3839
- }
3840
- }
3841
- expect(foundRequireApproval, 'code_tool_hook should reference require_approval decision in openclaw-plugin src ' +
3842
- '(expected in hooks/gate.ts). If removed, the code_tool_hook safety boundary is broken.').toBe(true);
3843
- });
3844
- });
3845
- //# sourceMappingURL=architecture-regression.test.js.map