@principles/core 1.287.1 → 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 +4 -3
  21. package/dist/runtime-v2/index.d.ts.map +1 -1
  22. package/dist/runtime-v2/index.js +2 -2
  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,2128 +0,0 @@
1
- /**
2
- * PiAiRuntimeAdapter unit tests.
3
- *
4
- * Verifies all PDRuntimeAdapter interface methods, pi-ai API usage,
5
- * error mapping, DiagnosticianOutputV1 validation, retry logic,
6
- * and telemetry emission.
7
- *
8
- * All pi-ai calls are mocked — no real API keys needed.
9
- */
10
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
11
- import { PDRuntimeError } from '../../error-categories.js';
12
- // Mock @earendil-works/pi-ai/compat (value facade used by the adapter) at module level
13
- vi.mock('@earendil-works/pi-ai/compat', () => ({
14
- getModel: vi.fn(),
15
- getProviders: vi.fn(() => ['openrouter', 'anthropic', 'openai', 'google']),
16
- completeSimple: vi.fn(),
17
- }));
18
- // Mock store/event-emitter to capture telemetry calls
19
- vi.mock('../../store/event-emitter.js', () => ({
20
- storeEmitter: { emitTelemetry: vi.fn() },
21
- }));
22
- import { getModel, completeSimple } from '@earendil-works/pi-ai/compat';
23
- import { storeEmitter } from '../../store/event-emitter.js';
24
- import { PiAiRuntimeAdapter } from '../pi-ai-runtime-adapter.js';
25
- const mockGetModel = getModel;
26
- const mockComplete = completeSimple;
27
- const mockEmitTelemetry = storeEmitter.emitTelemetry;
28
- // ── Fixtures ──
29
- const VALID_DIAGNOSIS = {
30
- valid: true,
31
- diagnosisId: 'diag-test-1',
32
- summary: 'Test summary',
33
- rootCause: 'Test root cause',
34
- violatedPrinciples: [],
35
- evidence: [],
36
- recommendations: [{ kind: 'defer', description: 'no actionable recommendation' }],
37
- confidence: 0.9,
38
- };
39
- function makeAssistantMessage(text, overrides = {}) {
40
- return {
41
- content: [{ type: 'text', text }],
42
- role: 'assistant',
43
- stopReason: 'stop',
44
- api: 'openai-completions',
45
- provider: 'openrouter',
46
- model: 'anthropic/claude-sonnet-4',
47
- usage: { input: 10, output: 5, cacheRead: 0, cacheWrite: 0, totalTokens: 15, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
48
- timestamp: Date.now(),
49
- ...overrides,
50
- };
51
- }
52
- /** Create an AssistantMessage that resolved with stopReason:'error'. */
53
- function makeErrorResponse(errorMessage, overrides = {}) {
54
- return makeAssistantMessage('', {
55
- stopReason: 'error',
56
- errorMessage,
57
- content: [],
58
- ...overrides,
59
- });
60
- }
61
- /** Create an AssistantMessage that resolved with stopReason:'aborted'. */
62
- function makeAbortedResponse(errorMessage = 'The operation was aborted') {
63
- return makeAssistantMessage('', {
64
- stopReason: 'aborted',
65
- errorMessage,
66
- content: [],
67
- });
68
- }
69
- function makeStartRunInput(overrides = {}) {
70
- return {
71
- agentSpec: { agentId: 'diagnostician', schemaVersion: 'v1' },
72
- inputPayload: 'Diagnose this pain signal',
73
- contextItems: [],
74
- timeoutMs: 60_000,
75
- ...overrides,
76
- };
77
- }
78
- function makeAdapter(overrides = {}) {
79
- return new PiAiRuntimeAdapter({
80
- provider: 'openrouter',
81
- model: 'anthropic/claude-sonnet-4',
82
- apiKeyEnv: 'TEST_API_KEY',
83
- _testBackoffDelayMs: 0,
84
- outputPathStrategy: 'free_form_only', // Default to free_form for existing tests
85
- ...overrides,
86
- });
87
- }
88
- /**
89
- * Helper: assert that startRun rejects with a PDRuntimeError of the given category.
90
- * Uses a fresh adapter and mock setup to avoid mock-consumption issues.
91
- */
92
- async function expectStartRunError(category, mockSetup, adapterOverrides = {}) {
93
- mockSetup();
94
- const adapter = makeAdapter(adapterOverrides);
95
- let caught = undefined;
96
- try {
97
- await adapter.startRun(makeStartRunInput());
98
- }
99
- catch (err) {
100
- caught = err instanceof PDRuntimeError ? err : undefined;
101
- }
102
- expect(caught).toBeInstanceOf(PDRuntimeError);
103
- expect(caught?.category).toBe(category);
104
- }
105
- /** Extract the first emitted telemetry event matching the given eventType. */
106
- function findTelemetryEvent(eventType) {
107
- // Runtime Contract Rule 2 (no `as` bypass): validate the mock-call shape
108
- // before treating it as a telemetry payload.
109
- const call = mockEmitTelemetry.mock.calls.find((c) => {
110
- const [payload] = c;
111
- return (typeof payload === 'object' &&
112
- payload !== null &&
113
- Object.hasOwn(payload, 'eventType') &&
114
- payload.eventType === eventType);
115
- });
116
- if (!call)
117
- return undefined;
118
- const [payload] = call;
119
- return typeof payload === 'object' && payload !== null
120
- ? payload
121
- : undefined;
122
- }
123
- /**
124
- * Type guard for the tool-context shape passed as the 2nd arg to completeSimple.
125
- * Avoids `as` casts on mock-call data (Runtime Contract Rule 2 / ERR-001).
126
- */
127
- function isToolContext(value) {
128
- if (typeof value !== 'object' || value === null || !Object.hasOwn(value, 'tools')) {
129
- return false;
130
- }
131
- const { tools } = value;
132
- if (!Array.isArray(tools))
133
- return false;
134
- return tools.every((tool) => {
135
- if (typeof tool !== 'object' || tool === null)
136
- return false;
137
- return (Object.hasOwn(tool, 'name') &&
138
- typeof tool.name === 'string' &&
139
- Object.hasOwn(tool, 'parameters'));
140
- });
141
- }
142
- // ── Tests ──
143
- describe('PiAiRuntimeAdapter', () => {
144
- beforeEach(() => {
145
- vi.clearAllMocks();
146
- process.env.TEST_API_KEY = 'test-key-123';
147
- // Default mock: getModel returns a model object, complete returns valid diagnosis
148
- mockGetModel.mockReturnValue({ id: 'anthropic/claude-sonnet-4' });
149
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
150
- });
151
- afterEach(() => {
152
- delete process.env.TEST_API_KEY;
153
- });
154
- // ── kind() ──
155
- describe('kind()', () => {
156
- it('returns "pi-ai" (RS-02)', () => {
157
- const adapter = makeAdapter();
158
- expect(adapter.kind()).toBe('pi-ai');
159
- });
160
- });
161
- // ── getCapabilities() ──
162
- describe('getCapabilities()', () => {
163
- it('returns correct RuntimeCapabilities shape', async () => {
164
- const adapter = makeAdapter();
165
- const caps = await adapter.getCapabilities();
166
- expect(caps.supportsStructuredJsonOutput).toBe(true);
167
- expect(caps.supportsToolUse).toBe(false);
168
- expect(caps.supportsWorkingDirectory).toBe(false);
169
- expect(caps.supportsModelSelection).toBe(true);
170
- expect(caps.supportsLongRunningSessions).toBe(false);
171
- expect(caps.supportsCancellation).toBe(true);
172
- expect(caps.supportsArtifactWriteBack).toBe(false);
173
- expect(caps.supportsConcurrentRuns).toBe(false);
174
- expect(caps.supportsStreaming).toBe(false);
175
- });
176
- });
177
- // ── healthCheck() ──
178
- describe('healthCheck()', () => {
179
- it('returns healthy=true when apiKey exists, getModel succeeds, and complete probe returns {"ok":true}', async () => {
180
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"ok":true}'));
181
- const adapter = makeAdapter();
182
- const health = await adapter.healthCheck();
183
- expect(health.healthy).toBe(true);
184
- expect(health.degraded).toBe(false);
185
- expect(health.warnings).toEqual([]);
186
- expect(mockGetModel).toHaveBeenCalledWith('openrouter', 'anthropic/claude-sonnet-4');
187
- });
188
- it('returns healthy=false when apiKeyEnv is missing', async () => {
189
- delete process.env.TEST_API_KEY;
190
- const adapter = makeAdapter();
191
- const health = await adapter.healthCheck();
192
- expect(health.healthy).toBe(false);
193
- expect(health.degraded).toBe(false);
194
- expect(health.warnings.some(w => w.includes('TEST_API_KEY'))).toBe(true);
195
- });
196
- it('returns healthy=false when getModel throws', async () => {
197
- mockGetModel.mockImplementationOnce(() => { throw new Error('invalid provider'); });
198
- const adapter = makeAdapter();
199
- const health = await adapter.healthCheck();
200
- expect(health.healthy).toBe(false);
201
- expect(health.degraded).toBe(false);
202
- expect(health.warnings.some(w => w.includes('invalid provider'))).toBe(true);
203
- });
204
- it('returns healthy=false with degraded=true when complete probe returns unexpected result', async () => {
205
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"unexpected": true}'));
206
- const adapter = makeAdapter();
207
- const health = await adapter.healthCheck();
208
- expect(health.healthy).toBe(false);
209
- expect(health.degraded).toBe(true);
210
- expect(health.warnings.some(w => w.includes('unexpected result'))).toBe(true);
211
- });
212
- it('returns healthy=false with degraded=true when probe times out', async () => {
213
- mockComplete.mockImplementationOnce(() => {
214
- const err = new DOMException('The operation was aborted', 'AbortError');
215
- throw err;
216
- });
217
- const adapter = makeAdapter();
218
- const health = await adapter.healthCheck();
219
- expect(health.healthy).toBe(false);
220
- expect(health.degraded).toBe(true);
221
- expect(health.warnings.some(w => w.includes('timed out'))).toBe(true);
222
- });
223
- it('returns healthy=false with degraded=true when complete resolves with stopReason:error + timeout message', async () => {
224
- mockComplete.mockResolvedValueOnce(makeErrorResponse('Request timed out.'));
225
- const adapter = makeAdapter();
226
- const health = await adapter.healthCheck();
227
- expect(health.healthy).toBe(false);
228
- expect(health.degraded).toBe(true);
229
- expect(health.warnings.some(w => w.includes('timed out'))).toBe(true);
230
- // Must NOT say "no text content"
231
- expect(health.warnings.every(w => !w.includes('no text content'))).toBe(true);
232
- });
233
- it('returns healthy=false with degraded=false when complete resolves with stopReason:error + auth error', async () => {
234
- mockComplete.mockResolvedValueOnce(makeErrorResponse('401 Unauthorized'));
235
- const adapter = makeAdapter();
236
- const health = await adapter.healthCheck();
237
- expect(health.healthy).toBe(false);
238
- expect(health.degraded).toBe(false);
239
- expect(health.warnings.some(w => w.includes('execution failed') || w.includes('401'))).toBe(true);
240
- // Must NOT misclassify as "no text content"
241
- expect(health.warnings.every(w => !w.includes('no text content'))).toBe(true);
242
- });
243
- it('respects config.timeoutMs for probe timeout', async () => {
244
- // Capture the timeoutMs passed to complete
245
- let capturedTimeoutMs = undefined;
246
- mockComplete.mockImplementationOnce(async (_model, _ctx, opts) => {
247
- capturedTimeoutMs = opts.timeoutMs;
248
- return makeAssistantMessage('{"ok":true}');
249
- });
250
- const adapter = makeAdapter({ timeoutMs: 15_000 });
251
- await adapter.healthCheck();
252
- expect(capturedTimeoutMs).toBe(15_000);
253
- });
254
- });
255
- // ── startRun() — success path ──
256
- describe('startRun()', () => {
257
- it('calls getModel with provider and model from config', async () => {
258
- const adapter = makeAdapter();
259
- await adapter.startRun(makeStartRunInput());
260
- expect(mockGetModel).toHaveBeenCalledWith('openrouter', 'anthropic/claude-sonnet-4');
261
- });
262
- it('calls complete with correct context including UserMessage with timestamp', async () => {
263
- const adapter = makeAdapter();
264
- await adapter.startRun(makeStartRunInput());
265
- expect(mockComplete).toHaveBeenCalledTimes(1);
266
- const [, context] = mockComplete.mock.calls[0];
267
- expect(context.messages).toHaveLength(1);
268
- expect(context.messages[0]).toBeDefined();
269
- if (context.messages[0]) {
270
- expect(context.messages[0].role).toBe('user');
271
- expect(context.messages[0].content).toBe('Diagnose this pain signal');
272
- expect(typeof context.messages[0].timestamp).toBe('number');
273
- }
274
- });
275
- it('passes apiKey, effectiveTimeoutMs (input > config > default), and maxRetries: 0 to complete options', async () => {
276
- const adapter = makeAdapter({ maxRetries: 3, timeoutMs: 120_000 });
277
- await adapter.startRun(makeStartRunInput({ timeoutMs: 90_000 }));
278
- const [, , options] = mockComplete.mock.calls[0];
279
- expect(options.apiKey).toBe('test-key-123');
280
- expect(options.maxRetries).toBe(0);
281
- expect(options.timeoutMs).toBe(90_000);
282
- });
283
- it('returns RunHandle with runId, runtimeKind="pi-ai", and valid ISO startedAt', async () => {
284
- const adapter = makeAdapter();
285
- const handle = await adapter.startRun(makeStartRunInput());
286
- expect(handle.runId).toBeTruthy();
287
- expect(handle.runtimeKind).toBe('pi-ai');
288
- expect(new Date(handle.startedAt).toISOString()).toBe(handle.startedAt);
289
- });
290
- it('stores output in memory (fetchOutput works after startRun completes)', async () => {
291
- const adapter = makeAdapter();
292
- const handle = await adapter.startRun(makeStartRunInput());
293
- const output = await adapter.fetchOutput(handle.runId);
294
- expect(output).not.toBeNull();
295
- expect(output?.runId).toBe(handle.runId);
296
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
297
- });
298
- it('serializes non-string inputPayload to JSON for the UserMessage', async () => {
299
- const adapter = makeAdapter();
300
- await adapter.startRun(makeStartRunInput({ inputPayload: { pain: 'signal', severity: 0.8 } }));
301
- const [, context] = mockComplete.mock.calls[0];
302
- expect(context.messages[0]).toBeDefined();
303
- if (context.messages[0]) {
304
- expect(context.messages[0].content).toBe('{"pain":"signal","severity":0.8}');
305
- }
306
- });
307
- // ── systemPrompt support (PRI-501 follow-up) ──
308
- it('TC1: passes config.systemPrompt to Context.systemPrompt when set', async () => {
309
- const adapter = makeAdapter({ systemPrompt: 'You are a diagnostician.' });
310
- await adapter.startRun(makeStartRunInput());
311
- const [, context] = mockComplete.mock.calls[0];
312
- expect(context.systemPrompt).toBe('You are a diagnostician.');
313
- });
314
- it('TC2: omits Context.systemPrompt when config.systemPrompt is unset (backward compat)', async () => {
315
- const adapter = makeAdapter();
316
- await adapter.startRun(makeStartRunInput());
317
- const [, context] = mockComplete.mock.calls[0];
318
- expect(context.systemPrompt).toBeUndefined();
319
- });
320
- it('TC3: omits Context.systemPrompt when config.systemPrompt is empty string', async () => {
321
- const adapter = makeAdapter({ systemPrompt: '' });
322
- await adapter.startRun(makeStartRunInput());
323
- const [, context] = mockComplete.mock.calls[0];
324
- expect(context.systemPrompt).toBeUndefined();
325
- });
326
- // ── layered systemPrompt (PRI-633) ──
327
- it('PRI-633: StartRunInput.systemPrompt rides as Context.systemPrompt (base layer)', async () => {
328
- const adapter = makeAdapter();
329
- await adapter.startRun(makeStartRunInput({ systemPrompt: 'You are a root cause analysis expert.' }));
330
- const [, context] = mockComplete.mock.calls[0];
331
- expect(context.systemPrompt).toBe('You are a root cause analysis expert.');
332
- });
333
- it('PRI-633: profile config.systemPrompt is appended AFTER the run base layer', async () => {
334
- const adapter = makeAdapter({ systemPrompt: 'PROFILE APPEND LAYER' });
335
- await adapter.startRun(makeStartRunInput({ systemPrompt: 'BASE ROLE LAYER' }));
336
- const [, context] = mockComplete.mock.calls[0];
337
- expect(context.systemPrompt).toBe('BASE ROLE LAYER\n\nPROFILE APPEND LAYER');
338
- });
339
- it('PRI-633: omit Context.systemPrompt when both layers are absent/blank (unchanged shape)', async () => {
340
- const adapter = makeAdapter({ systemPrompt: ' ' });
341
- await adapter.startRun(makeStartRunInput({ systemPrompt: undefined }));
342
- const [, context] = mockComplete.mock.calls[0];
343
- expect(context.systemPrompt).toBeUndefined();
344
- });
345
- });
346
- // ── JSON extraction (balanced parsing) ──
347
- describe('JSON extraction (balanced parsing)', () => {
348
- it('parses plain JSON from LLM response', async () => {
349
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
350
- const adapter = makeAdapter();
351
- const handle = await adapter.startRun(makeStartRunInput());
352
- const output = await adapter.fetchOutput(handle.runId);
353
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
354
- });
355
- it('parses JSON wrapped in prose text', async () => {
356
- const proseWrapped = `Here is the analysis:\n${JSON.stringify(VALID_DIAGNOSIS)}\nDone.`;
357
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(proseWrapped));
358
- const adapter = makeAdapter();
359
- const handle = await adapter.startRun(makeStartRunInput());
360
- const output = await adapter.fetchOutput(handle.runId);
361
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
362
- });
363
- it('parses JSON inside code fences', async () => {
364
- const codeFenced = '```json\n' + JSON.stringify(VALID_DIAGNOSIS) + '\n```';
365
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(codeFenced));
366
- const adapter = makeAdapter();
367
- const handle = await adapter.startRun(makeStartRunInput());
368
- const output = await adapter.fetchOutput(handle.runId);
369
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
370
- });
371
- it('throws output_invalid when no JSON object found in response', async () => {
372
- await expectStartRunError('output_invalid', () => {
373
- mockComplete.mockReset();
374
- mockComplete.mockResolvedValue(makeAssistantMessage('No JSON here at all'));
375
- });
376
- });
377
- });
378
- // ── startRun() error mapping ──
379
- describe('startRun() error mapping', () => {
380
- it('throws PDRuntimeError("runtime_unavailable") when apiKeyEnv missing from process.env', async () => {
381
- await expectStartRunError('runtime_unavailable', () => {
382
- delete process.env.TEST_API_KEY;
383
- });
384
- });
385
- it('throws PDRuntimeError("timeout") when LLM request is aborted/timed out', async () => {
386
- await expectStartRunError('timeout', () => {
387
- mockComplete.mockReset();
388
- mockComplete.mockImplementation(() => {
389
- throw new DOMException('The operation was aborted', 'AbortError');
390
- });
391
- });
392
- });
393
- it('throws PDRuntimeError("output_invalid") when LLM response contains no parseable JSON', async () => {
394
- await expectStartRunError('output_invalid', () => {
395
- mockComplete.mockReset();
396
- mockComplete.mockResolvedValue(makeAssistantMessage('Just plain text, no JSON at all'));
397
- });
398
- });
399
- it('skips schema validation when no outputSchemaRef is provided (backward compatible)', async () => {
400
- mockComplete.mockReset();
401
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify({ valid: true, missing: 'fields' })));
402
- const adapter = makeAdapter();
403
- const handle = await adapter.startRun(makeStartRunInput());
404
- const output = await adapter.fetchOutput(handle.runId);
405
- expect(output?.payload).toMatchObject({ valid: true, missing: 'fields' });
406
- });
407
- it('throws PDRuntimeError("output_invalid") when parsed JSON does not match schema for given outputSchemaRef', async () => {
408
- mockComplete.mockReset();
409
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify({ valid: true, missing: 'fields' })));
410
- const adapter = makeAdapter();
411
- await expect(adapter.startRun(makeStartRunInput({
412
- outputSchemaRef: 'diagnostician-output-v1',
413
- }))).rejects.toMatchObject({ category: 'output_invalid' });
414
- });
415
- it('throws PDRuntimeError("execution_failed") after retry exhaustion on network error', async () => {
416
- await expectStartRunError('execution_failed', () => {
417
- mockComplete.mockReset();
418
- mockComplete.mockRejectedValue(new Error('ECONNREFUSED'));
419
- }, { maxRetries: 1 });
420
- });
421
- it('throws PDRuntimeError("timeout") when complete resolves with stopReason:error + timeout message', async () => {
422
- await expectStartRunError('timeout', () => {
423
- mockComplete.mockReset();
424
- mockComplete.mockResolvedValue(makeErrorResponse('Request timed out.'));
425
- });
426
- });
427
- it('throws PDRuntimeError("execution_failed") when complete resolves with stopReason:error + 401 Unauthorized', async () => {
428
- await expectStartRunError('execution_failed', () => {
429
- mockComplete.mockReset();
430
- mockComplete.mockResolvedValue(makeErrorResponse('401 Unauthorized'));
431
- });
432
- });
433
- it('throws PDRuntimeError("timeout") when complete resolves with stopReason:aborted', async () => {
434
- await expectStartRunError('timeout', () => {
435
- mockComplete.mockReset();
436
- mockComplete.mockResolvedValue(makeAbortedResponse());
437
- });
438
- });
439
- it('retries resolved stopReason:error (execution_failed) before giving up', async () => {
440
- // First call: resolves with error, second call: succeeds
441
- mockComplete
442
- .mockResolvedValueOnce(makeErrorResponse('503 Service Unavailable'))
443
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
444
- const adapter = makeAdapter({ maxRetries: 2 });
445
- const handle = await adapter.startRun(makeStartRunInput());
446
- expect(mockComplete).toHaveBeenCalledTimes(2);
447
- expect(handle.runId).toBeTruthy();
448
- });
449
- it('RunStatus.reason includes bounded errorMessage from resolved-error response', async () => {
450
- mockComplete.mockReset();
451
- mockComplete.mockResolvedValue(makeErrorResponse('401 Unauthorized: invalid API key'));
452
- const adapter = makeAdapter({ maxRetries: 0 });
453
- try {
454
- await adapter.startRun(makeStartRunInput());
455
- }
456
- catch {
457
- // startRun throws, but internally run state should have the reason
458
- }
459
- // Telemetry should include the error message
460
- const failedEvent = findTelemetryEvent('runtime_invocation_failed');
461
- expect(failedEvent).toBeDefined();
462
- const payload = failedEvent?.payload;
463
- expect(payload.errorCategory).toBe('execution_failed');
464
- expect(typeof payload.errorMessage).toBe('string');
465
- expect(payload.errorMessage.includes('401')).toBe(true);
466
- });
467
- });
468
- // ── startRun() retry logic ──
469
- describe('startRun() retry logic', () => {
470
- it('retries transient failures up to maxRetries times', async () => {
471
- // Fail twice, succeed on third
472
- mockComplete
473
- .mockRejectedValueOnce(new Error('ECONNREFUSED'))
474
- .mockRejectedValueOnce(new Error('ETIMEDOUT'))
475
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
476
- const adapter = makeAdapter({ maxRetries: 2 });
477
- const handle = await adapter.startRun(makeStartRunInput());
478
- expect(mockComplete).toHaveBeenCalledTimes(3);
479
- expect(handle.runtimeKind).toBe('pi-ai');
480
- });
481
- it('succeeds on second attempt after first transient failure', async () => {
482
- mockComplete
483
- .mockRejectedValueOnce(new Error('socket hang up'))
484
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
485
- const adapter = makeAdapter({ maxRetries: 2 });
486
- const handle = await adapter.startRun(makeStartRunInput());
487
- expect(mockComplete).toHaveBeenCalledTimes(2);
488
- expect(handle.runId).toBeTruthy();
489
- });
490
- it('does not retry on PDRuntimeError (output_invalid)', async () => {
491
- mockComplete.mockReset();
492
- mockComplete
493
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })))
494
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })))
495
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })))
496
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify({ valid: true })));
497
- const adapter = makeAdapter({ maxRetries: 3 });
498
- await expect(adapter.startRun(makeStartRunInput({
499
- outputSchemaRef: 'diagnostician-output-v1',
500
- }))).rejects.toThrow(PDRuntimeError);
501
- // 1 original + 3 repair attempts = 4 calls (not infinite retries)
502
- expect(mockComplete).toHaveBeenCalledTimes(4);
503
- });
504
- it('does not retry on PDRuntimeError (runtime_unavailable)', async () => {
505
- delete process.env.TEST_API_KEY;
506
- const adapter = makeAdapter({ maxRetries: 3 });
507
- await expect(adapter.startRun(makeStartRunInput())).rejects.toMatchObject({
508
- category: 'runtime_unavailable',
509
- });
510
- // complete should not be called at all — error happens before LLM call
511
- expect(mockComplete).not.toHaveBeenCalled();
512
- });
513
- });
514
- // ── pollRun() ──
515
- describe('pollRun()', () => {
516
- it('returns terminal status (succeeded) for completed run', async () => {
517
- const adapter = makeAdapter();
518
- const handle = await adapter.startRun(makeStartRunInput());
519
- const status = await adapter.pollRun(handle.runId);
520
- expect(status.runId).toBe(handle.runId);
521
- expect(status.status).toBe('succeeded');
522
- expect(status.startedAt).toBeTruthy();
523
- expect(status.endedAt).toBeTruthy();
524
- });
525
- it('returns failed status with reason when startRun fails', async () => {
526
- mockComplete.mockReset();
527
- mockComplete.mockImplementation(async () => {
528
- throw new DOMException('aborted', 'AbortError');
529
- });
530
- const adapter = makeAdapter();
531
- try {
532
- await adapter.startRun(makeStartRunInput());
533
- }
534
- catch (err) {
535
- // Verify the error path doesn't crash and emits telemetry
536
- expect(err).toBeInstanceOf(PDRuntimeError);
537
- }
538
- });
539
- it('throws PDRuntimeError("input_invalid") for unknown runId', async () => {
540
- const adapter = makeAdapter();
541
- await expect(adapter.pollRun('nonexistent-run-id')).rejects.toThrow(PDRuntimeError);
542
- await expect(adapter.pollRun('nonexistent-run-id')).rejects.toMatchObject({
543
- category: 'input_invalid',
544
- });
545
- });
546
- });
547
- // ── fetchOutput() ──
548
- describe('fetchOutput()', () => {
549
- it('returns StructuredRunOutput with runId and payload after successful run', async () => {
550
- const adapter = makeAdapter();
551
- const handle = await adapter.startRun(makeStartRunInput());
552
- const output = await adapter.fetchOutput(handle.runId);
553
- expect(output).not.toBeNull();
554
- expect(output?.runId).toBe(handle.runId);
555
- expect(output?.payload).toMatchObject({
556
- valid: true,
557
- diagnosisId: 'diag-test-1',
558
- });
559
- });
560
- it('returns null for unknown runId', async () => {
561
- const adapter = makeAdapter();
562
- const output = await adapter.fetchOutput('nonexistent-run-id');
563
- expect(output).toBeNull();
564
- });
565
- });
566
- // ── cancelRun() ──
567
- describe('cancelRun()', () => {
568
- it('resolves without error', async () => {
569
- const adapter = makeAdapter();
570
- await expect(adapter.cancelRun('any-run-id')).resolves.toBeUndefined();
571
- });
572
- });
573
- // ── fetchArtifacts() ──
574
- describe('fetchArtifacts()', () => {
575
- it('returns empty array for a run that was started', async () => {
576
- const adapter = makeAdapter();
577
- const input = makeStartRunInput({ taskRef: { taskId: 'test-run-id' } });
578
- const handle = await adapter.startRun(input);
579
- const artifacts = await adapter.fetchArtifacts(handle.runId);
580
- expect(artifacts).toEqual([]);
581
- });
582
- it('throws for an unknown runId', async () => {
583
- const adapter = makeAdapter();
584
- await expect(adapter.fetchArtifacts('unknown-run-id')).rejects.toThrow("Run 'unknown-run-id' not found");
585
- });
586
- });
587
- // ── telemetry (AD-15) ──
588
- describe('telemetry (AD-15)', () => {
589
- it('emits runtime_invocation_started event on startRun', async () => {
590
- const adapter = makeAdapter();
591
- await adapter.startRun(makeStartRunInput());
592
- const startedEvent = findTelemetryEvent('runtime_invocation_started');
593
- expect(startedEvent).toBeDefined();
594
- const payload = startedEvent?.payload;
595
- expect(payload.runtimeKind).toBe('pi-ai');
596
- expect(payload.provider).toBe('openrouter');
597
- expect(payload.model).toBe('anthropic/claude-sonnet-4');
598
- });
599
- it('emits runtime_invocation_succeeded on successful completion', async () => {
600
- const adapter = makeAdapter();
601
- await adapter.startRun(makeStartRunInput());
602
- const succeededEvent = findTelemetryEvent('runtime_invocation_succeeded');
603
- expect(succeededEvent).toBeDefined();
604
- const payload = succeededEvent?.payload;
605
- expect(payload.runtimeKind).toBe('pi-ai');
606
- });
607
- it('emits runtime_invocation_failed on failure', async () => {
608
- mockComplete.mockReset();
609
- mockComplete.mockRejectedValue(new Error('network down'));
610
- const adapter = makeAdapter({ maxRetries: 0 });
611
- try {
612
- await adapter.startRun(makeStartRunInput());
613
- }
614
- catch { /* expected */ }
615
- const failedEvent = findTelemetryEvent('runtime_invocation_failed');
616
- expect(failedEvent).toBeDefined();
617
- const payload = failedEvent?.payload;
618
- expect(payload.runtimeKind).toBe('pi-ai');
619
- expect(payload.errorCategory).toBe('execution_failed');
620
- });
621
- it('emits runtime_invocation_started before LLM call (even if call fails)', async () => {
622
- mockComplete.mockReset();
623
- mockComplete.mockRejectedValue(new Error('fail'));
624
- const adapter = makeAdapter({ maxRetries: 0 });
625
- try {
626
- await adapter.startRun(makeStartRunInput());
627
- }
628
- catch { /* expected */ }
629
- const startedEvent = findTelemetryEvent('runtime_invocation_started');
630
- expect(startedEvent).toBeDefined();
631
- });
632
- });
633
- // ── Error category coverage ──
634
- describe('error category coverage', () => {
635
- it('all 5 PDRuntimeError categories are reachable', () => {
636
- // This test documents which categories are tested where:
637
- // - runtime_unavailable: apiKeyEnv missing test
638
- // - timeout: AbortError test
639
- // - output_invalid: JSON parse failure + schema mismatch tests
640
- // - execution_failed: retry exhaustion test
641
- // - input_invalid: pollRun with unknown runId test
642
- const categories = ['runtime_unavailable', 'timeout', 'output_invalid', 'execution_failed', 'input_invalid'];
643
- expect(categories).toHaveLength(5);
644
- });
645
- });
646
- // ── Run state management ──
647
- describe('run state management', () => {
648
- it('stores failed run state on error', async () => {
649
- mockComplete.mockReset();
650
- mockComplete.mockImplementation(() => {
651
- throw new DOMException('aborted', 'AbortError');
652
- });
653
- const adapter = makeAdapter();
654
- // startRun will throw, but internally the run state should be stored
655
- try {
656
- await adapter.startRun(makeStartRunInput());
657
- }
658
- catch {
659
- // We don't have the runId since startRun threw.
660
- // This test verifies the error path doesn't crash.
661
- }
662
- // Verify the adapter didn't crash and telemetry was emitted
663
- expect(mockEmitTelemetry).toHaveBeenCalled();
664
- });
665
- it('creates run state before LLM call', async () => {
666
- let resolveComplete;
667
- const blockedPromise = new Promise(resolve => { resolveComplete = resolve; });
668
- mockComplete.mockReturnValueOnce(blockedPromise);
669
- const adapter = makeAdapter();
670
- // Start the run — it will block on complete()
671
- const handlePromise = adapter.startRun(makeStartRunInput());
672
- // Unblock the LLM call
673
- if (resolveComplete) {
674
- resolveComplete(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
675
- }
676
- const handle = await handlePromise;
677
- // After completion, pollRun should return succeeded
678
- const status = await adapter.pollRun(handle.runId);
679
- expect(status.status).toBe('succeeded');
680
- });
681
- });
682
- // ── startRun() output repair (PRI-71) ──
683
- describe('startRun() output repair (PRI-71)', () => {
684
- /** Invalid output with string confidence and wrong-case kind. */
685
- const INVALID_DIAGNOSIS = {
686
- valid: true,
687
- diagnosisId: 'diag-repair-1',
688
- taskId: 'task-repair-1',
689
- summary: 'Test repair',
690
- rootCause: 'Test root cause',
691
- violatedPrinciples: [],
692
- evidence: [],
693
- recommendations: [{ kind: 'Rule', description: 'Fix casing' }],
694
- confidence: '85%',
695
- };
696
- /** Make a startRunInput with diagnostician output schema ref. */
697
- function makeDiagnosticianInput(overrides = {}) {
698
- return makeStartRunInput({
699
- outputSchemaRef: 'diagnostician-output-v1',
700
- taskRef: { taskId: 'task-repair-1' },
701
- ...overrides,
702
- });
703
- }
704
- it('repairs confidence "85%" to 0.85 via second LLM call', async () => {
705
- mockComplete
706
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
707
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
708
- const adapter = makeAdapter();
709
- const handle = await adapter.startRun(makeDiagnosticianInput());
710
- expect(mockComplete).toHaveBeenCalledTimes(2);
711
- const output = await adapter.fetchOutput(handle.runId);
712
- expect(output?.payload).toMatchObject({ confidence: 0.9 });
713
- });
714
- it('PRI-633: repair calls carry the merged layered system prompt', async () => {
715
- mockComplete
716
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
717
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
718
- const adapter = makeAdapter({ systemPrompt: 'PROFILE APPEND LAYER' });
719
- await adapter.startRun(makeDiagnosticianInput({ systemPrompt: 'BASE ROLE LAYER' }));
720
- expect(mockComplete).toHaveBeenCalledTimes(2);
721
- // Call 2 is the repair call — its Context must keep the layered prompt.
722
- const [, repairContext] = mockComplete.mock.calls[1];
723
- expect(repairContext.systemPrompt).toBe('BASE ROLE LAYER\n\nPROFILE APPEND LAYER');
724
- });
725
- it('repair fails — still throws output_invalid after repair attempt', async () => {
726
- mockComplete
727
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
728
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
729
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
730
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)));
731
- const adapter = makeAdapter();
732
- await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
733
- category: 'output_invalid',
734
- });
735
- // 1 original + 3 repair attempts = 4 calls
736
- expect(mockComplete).toHaveBeenCalledTimes(4);
737
- });
738
- it('unknown outputSchemaRef fails loud before repair is attempted (rc-3)', async () => {
739
- // CodeRabbit PR #1259: unknown non-empty ref now fails loud at schema
740
- // resolution (in startRun), so repair is never attempted.
741
- // NOTE: no mockComplete setup — resolution fails BEFORE any LLM call,
742
- // so no mock value is queued to leak into subsequent tests.
743
- const adapter = makeAdapter();
744
- await expect(adapter.startRun(makeStartRunInput({
745
- outputSchemaRef: 'custom-unknown-v1',
746
- }))).rejects.toMatchObject({
747
- category: 'output_invalid',
748
- message: expect.stringMatching(/Unknown outputSchemaRef: custom-unknown-v1/i),
749
- });
750
- // LLM was never called because resolution failed first.
751
- expect(mockComplete).toHaveBeenCalledTimes(0);
752
- });
753
- it('skips repair for non-JSON output (no schema errors to report)', async () => {
754
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('Not JSON at all'));
755
- const adapter = makeAdapter();
756
- await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
757
- category: 'output_invalid',
758
- });
759
- expect(mockComplete).toHaveBeenCalledTimes(1);
760
- });
761
- it('emits output_extraction_failed telemetry when extractJsonObject returns null', async () => {
762
- const proseOutput = 'I evaluated the plan and it looks good. The implementation is solid.';
763
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(proseOutput));
764
- const adapter = makeAdapter();
765
- try {
766
- await adapter.startRun(makeDiagnosticianInput());
767
- }
768
- catch { /* expected */ }
769
- const extractionEvent = findTelemetryEvent('output_extraction_failed');
770
- expect(extractionEvent).toBeDefined();
771
- const payload = extractionEvent?.payload;
772
- expect(payload.outputSchemaRef).toBe('diagnostician-output-v1');
773
- expect(payload.provider).toBe('openrouter');
774
- expect(payload.model).toBe('anthropic/claude-sonnet-4');
775
- expect(payload.rawOutputPreview).toBe(proseOutput);
776
- });
777
- it('emits output_repair_attempted telemetry on repair attempt', async () => {
778
- mockComplete
779
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
780
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
781
- const adapter = makeAdapter();
782
- await adapter.startRun(makeDiagnosticianInput());
783
- const repairEvent = findTelemetryEvent('output_repair_attempted');
784
- expect(repairEvent).toBeDefined();
785
- const payload = repairEvent?.payload;
786
- expect(payload.repaired).toBe(true);
787
- expect(payload.attemptsUsed).toBe(1);
788
- });
789
- it('emits output_repair_attempted with repaired=false on failure', async () => {
790
- mockComplete
791
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
792
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
793
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
794
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)));
795
- const adapter = makeAdapter();
796
- try {
797
- await adapter.startRun(makeDiagnosticianInput());
798
- }
799
- catch { /* expected */ }
800
- const repairEvent = findTelemetryEvent('output_repair_attempted');
801
- expect(repairEvent).toBeDefined();
802
- const payload = repairEvent?.payload;
803
- expect(payload.repaired).toBe(false);
804
- });
805
- it('reuses same provider/model for repair call', async () => {
806
- mockComplete
807
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
808
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
809
- const adapter = makeAdapter();
810
- await adapter.startRun(makeDiagnosticianInput());
811
- // Both calls should use same model
812
- expect(mockComplete).toHaveBeenCalledTimes(2);
813
- const [model1] = mockComplete.mock.calls[0];
814
- const [model2] = mockComplete.mock.calls[1];
815
- expect(model1).toEqual(model2);
816
- });
817
- it('repair call includes the repair prompt with schema errors', async () => {
818
- mockComplete
819
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
820
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
821
- const adapter = makeAdapter();
822
- await adapter.startRun(makeDiagnosticianInput());
823
- // Second call's context should contain the repair prompt
824
- const [, context] = mockComplete.mock.calls[1];
825
- const repairMessage = context.messages[0]?.content ?? '';
826
- expect(repairMessage).toContain('schema');
827
- expect(repairMessage).toContain('confidence');
828
- });
829
- it('repair budget exhausted — default maxRepairAttempts=3, no infinite loop', async () => {
830
- mockComplete
831
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
832
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
833
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)))
834
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS)));
835
- const adapter = makeAdapter();
836
- await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
837
- category: 'output_invalid',
838
- });
839
- // 1 original + 3 repair attempts = 4 calls total (not infinite)
840
- expect(mockComplete).toHaveBeenCalledTimes(4);
841
- });
842
- it('repairs evaluator-output-v1 with prose-wrapped JSON', async () => {
843
- const EVALUATOR_OUTPUT_INVALID = {
844
- taskId: 'task-eval-repair-1',
845
- sourceArtificerArtifactId: 'pi-art-artificer-repair-1',
846
- evaluation: {
847
- decision: 'approved',
848
- summary: 'Good plan',
849
- score: '0.85',
850
- strengths: ['Clear'],
851
- concerns: [],
852
- requiredChanges: [],
853
- },
854
- sourceTrace: {
855
- artificerArtifactId: 'pi-art-artificer-repair-1',
856
- },
857
- risks: [],
858
- generatedAt: '2026-05-11T12:00:00.000Z',
859
- };
860
- const EVALUATOR_OUTPUT_VALID = {
861
- taskId: 'task-eval-repair-1',
862
- sourceArtificerArtifactId: 'pi-art-artificer-repair-1',
863
- evaluation: {
864
- decision: 'approved',
865
- summary: 'Good plan',
866
- score: 0.85,
867
- strengths: ['Clear'],
868
- concerns: [],
869
- requiredChanges: [],
870
- },
871
- sourceTrace: {
872
- artificerArtifactId: 'pi-art-artificer-repair-1',
873
- },
874
- risks: [],
875
- generatedAt: '2026-05-11T12:00:00.000Z',
876
- };
877
- mockComplete
878
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(EVALUATOR_OUTPUT_INVALID)))
879
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(EVALUATOR_OUTPUT_VALID)));
880
- const adapter = makeAdapter();
881
- const handle = await adapter.startRun(makeStartRunInput({
882
- outputSchemaRef: 'evaluator-output-v1',
883
- taskRef: { taskId: 'task-eval-repair-1' },
884
- }));
885
- expect(mockComplete).toHaveBeenCalledTimes(2);
886
- const output = await adapter.fetchOutput(handle.runId);
887
- expect(output?.payload).toMatchObject({ evaluation: { score: 0.85 } });
888
- });
889
- });
890
- // ── startRun() schema dispatch by outputSchemaRef ──
891
- describe('startRun() schema dispatch by outputSchemaRef', () => {
892
- const VALID_DREAMER_OUTPUT = {
893
- valid: true,
894
- taskId: 'task-dreamer-1',
895
- candidates: [
896
- {
897
- candidateIndex: 0,
898
- badDecision: 'Ignored error handling',
899
- betterDecision: 'Add try/catch around API calls',
900
- rationale: 'Prevents unhandled rejections',
901
- confidence: 0.85,
902
- riskLevel: 'low',
903
- strategicPerspective: 'Defensive programming',
904
- },
905
- ],
906
- contextRefs: [],
907
- generatedAt: '2025-01-01T00:00:00.000Z',
908
- };
909
- const VALID_PHILOSOPHER_OUTPUT = {
910
- taskId: 'task-philosopher-1',
911
- sourceDreamerArtifactId: 'pi-art-dreamer-1',
912
- thesis: 'Error handling is essential for reliability',
913
- principleCandidate: {
914
- title: 'Always handle API errors',
915
- rationale: 'Unhandled errors cause cascading failures',
916
- scope: 'All external API calls',
917
- confidence: 0.9,
918
- },
919
- risks: ['May add boilerplate'],
920
- generatedAt: '2025-01-01T00:00:00.000Z',
921
- };
922
- it('validates dreamer-output-v1 with DreamerOutputV1Schema', async () => {
923
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DREAMER_OUTPUT)));
924
- const adapter = makeAdapter();
925
- const handle = await adapter.startRun(makeStartRunInput({
926
- outputSchemaRef: 'dreamer-output-v1',
927
- taskRef: { taskId: 'task-dreamer-1' },
928
- }));
929
- const output = await adapter.fetchOutput(handle.runId);
930
- expect(output?.payload).toMatchObject({ valid: true });
931
- });
932
- it('rejects invalid dreamer output with output_invalid', async () => {
933
- const invalidDreamerOutput = { valid: true, taskId: 'task-dreamer-1', candidates: 'not-array' };
934
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(invalidDreamerOutput)));
935
- const adapter = makeAdapter();
936
- await expect(adapter.startRun(makeStartRunInput({
937
- outputSchemaRef: 'dreamer-output-v1',
938
- taskRef: { taskId: 'task-dreamer-1' },
939
- }))).rejects.toMatchObject({ category: 'output_invalid' });
940
- });
941
- it('validates philosopher-output-v1 with PhilosopherOutputV1Schema', async () => {
942
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_PHILOSOPHER_OUTPUT)));
943
- const adapter = makeAdapter();
944
- const handle = await adapter.startRun(makeStartRunInput({
945
- outputSchemaRef: 'philosopher-output-v1',
946
- taskRef: { taskId: 'task-philosopher-1' },
947
- }));
948
- const output = await adapter.fetchOutput(handle.runId);
949
- expect(output?.payload).toMatchObject({ thesis: 'Error handling is essential for reliability' });
950
- });
951
- it('rejects invalid philosopher output with output_invalid', async () => {
952
- const invalidPhilosopherOutput = { taskId: 'task-philosopher-1', principleCandidate: null };
953
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(invalidPhilosopherOutput)));
954
- const adapter = makeAdapter();
955
- await expect(adapter.startRun(makeStartRunInput({
956
- outputSchemaRef: 'philosopher-output-v1',
957
- taskRef: { taskId: 'task-philosopher-1' },
958
- }))).rejects.toMatchObject({ category: 'output_invalid' });
959
- });
960
- it('falls back to DiagnosticianOutputV1Schema for diagnostician-output-v1', async () => {
961
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
962
- const adapter = makeAdapter();
963
- const handle = await adapter.startRun(makeStartRunInput({
964
- outputSchemaRef: 'diagnostician-output-v1',
965
- taskRef: { taskId: 'task-test-1' },
966
- }));
967
- const output = await adapter.fetchOutput(handle.runId);
968
- expect(output?.payload).toMatchObject({ valid: true, diagnosisId: 'diag-test-1' });
969
- });
970
- it('unknown outputSchemaRef fails loud with output_invalid (rc-3, was silent skip)', async () => {
971
- // CodeRabbit PR #1259: previously an unknown non-empty outputSchemaRef
972
- // resolved to undefined and silently skipped schema-gated validation.
973
- // That is an rc-9/rc-3 silent-fallback. Now it fails loud, consistent
974
- // with OpenClawCliRuntimeAdapter.fetchOutput.
975
- // NOTE: no mockComplete setup — resolution fails BEFORE any LLM call.
976
- const adapter = makeAdapter();
977
- await expect(adapter.startRun(makeStartRunInput({
978
- outputSchemaRef: 'custom-output-v1',
979
- }))).rejects.toMatchObject({
980
- category: 'output_invalid',
981
- message: expect.stringMatching(/Unknown outputSchemaRef: custom-output-v1/i),
982
- });
983
- expect(mockComplete).toHaveBeenCalledTimes(0);
984
- });
985
- it('no outputSchemaRef skips schema validation (backward compatible)', async () => {
986
- const arbitraryOutput = { anything: 'goes' };
987
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(arbitraryOutput)));
988
- const adapter = makeAdapter();
989
- const handle = await adapter.startRun(makeStartRunInput());
990
- const output = await adapter.fetchOutput(handle.runId);
991
- expect(output?.payload).toMatchObject(arbitraryOutput);
992
- });
993
- it('attempts repair for dreamer-output-v1 schema errors', async () => {
994
- const invalidDreamerOutput = {
995
- valid: true,
996
- taskId: 'task-dreamer-1',
997
- candidates: [{ candidateIndex: 0, badDecision: 'test', betterDecision: 'test', rationale: 'test', confidence: '85%', riskLevel: 'low', strategicPerspective: 'test' }],
998
- contextRefs: [],
999
- generatedAt: '2025-01-01T00:00:00.000Z',
1000
- };
1001
- mockComplete
1002
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(invalidDreamerOutput)))
1003
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DREAMER_OUTPUT)));
1004
- const adapter = makeAdapter();
1005
- const handle = await adapter.startRun(makeStartRunInput({
1006
- outputSchemaRef: 'dreamer-output-v1',
1007
- taskRef: { taskId: 'task-dreamer-1' },
1008
- }));
1009
- expect(mockComplete).toHaveBeenCalledTimes(2);
1010
- const output = await adapter.fetchOutput(handle.runId);
1011
- expect(output?.payload).toMatchObject({ valid: true });
1012
- });
1013
- });
1014
- // ── PRI-200: Structured output repair loop with evidence pack ──
1015
- describe('PRI-200: structured output repair loop with evidence pack', () => {
1016
- const INVALID_DIAGNOSIS_SCHEMA = {
1017
- valid: true,
1018
- diagnosisId: 'diag-pri200-1',
1019
- taskId: 'task-pri200-1',
1020
- summary: 'Test PRI-200',
1021
- rootCause: 'Test root cause',
1022
- violatedPrinciples: [],
1023
- evidence: [],
1024
- recommendations: [{ kind: 'Rule', description: 'Fix casing' }],
1025
- confidence: '85%',
1026
- };
1027
- function makeDiagnosticianInput(overrides = {}) {
1028
- return makeStartRunInput({
1029
- outputSchemaRef: 'diagnostician-output-v1',
1030
- taskRef: { taskId: 'task-pri200-1' },
1031
- ...overrides,
1032
- });
1033
- }
1034
- function resetMock() {
1035
- mockComplete.mockReset();
1036
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1037
- }
1038
- it('1. valid JSON + valid schema → no repair triggered', async () => {
1039
- resetMock();
1040
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1041
- const adapter = makeAdapter();
1042
- const handle = await adapter.startRun(makeDiagnosticianInput());
1043
- expect(mockComplete).toHaveBeenCalledTimes(1);
1044
- const output = await adapter.fetchOutput(handle.runId);
1045
- expect(output?.payload).toMatchObject({ confidence: 0.9 });
1046
- const repairEvent = findTelemetryEvent('output_repair_attempted');
1047
- expect(repairEvent).toBeUndefined();
1048
- const schemaInvalidEvent = findTelemetryEvent('output_schema_invalid');
1049
- expect(schemaInvalidEvent).toBeUndefined();
1050
- });
1051
- it('2. prose-wrapped JSON extraction succeeds → no repair triggered', async () => {
1052
- resetMock();
1053
- const proseWrapped = `Here is the analysis:\n${JSON.stringify(VALID_DIAGNOSIS)}\nDone.`;
1054
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(proseWrapped));
1055
- const adapter = makeAdapter();
1056
- const handle = await adapter.startRun(makeDiagnosticianInput());
1057
- expect(mockComplete).toHaveBeenCalledTimes(1);
1058
- const output = await adapter.fetchOutput(handle.runId);
1059
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1060
- });
1061
- it('3. extraction failed → output_extraction_failed telemetry + output_invalid', async () => {
1062
- resetMock();
1063
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('No JSON here at all'));
1064
- const adapter = makeAdapter();
1065
- try {
1066
- await adapter.startRun(makeDiagnosticianInput());
1067
- }
1068
- catch { /* expected */ }
1069
- const extractionEvent = findTelemetryEvent('output_extraction_failed');
1070
- expect(extractionEvent).toBeDefined();
1071
- const payload = extractionEvent?.payload;
1072
- expect(payload.outputSchemaRef).toBe('diagnostician-output-v1');
1073
- expect(payload.provider).toBe('openrouter');
1074
- expect(payload.model).toBe('anthropic/claude-sonnet-4');
1075
- expect(typeof payload.rawOutputPreview).toBe('string');
1076
- });
1077
- it('4. schema invalid once, repair returns valid → success + repairAttempts[0].repaired=true', async () => {
1078
- resetMock();
1079
- mockComplete
1080
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
1081
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1082
- const adapter = makeAdapter();
1083
- const handle = await adapter.startRun(makeDiagnosticianInput());
1084
- expect(mockComplete).toHaveBeenCalledTimes(2);
1085
- const output = await adapter.fetchOutput(handle.runId);
1086
- expect(output?.payload).toMatchObject({ confidence: 0.9 });
1087
- const repairEvent = findTelemetryEvent('output_repair_attempted');
1088
- expect(repairEvent).toBeDefined();
1089
- const repairPayload = repairEvent?.payload;
1090
- expect(repairPayload.repaired).toBe(true);
1091
- expect(repairPayload.attemptsUsed).toBe(1);
1092
- });
1093
- it('5. schema invalid, repair also invalid → output_repair_exhausted + output_invalid', async () => {
1094
- resetMock();
1095
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
1096
- const adapter = makeAdapter();
1097
- await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
1098
- category: 'output_invalid',
1099
- });
1100
- const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
1101
- expect(exhaustedEvent).toBeDefined();
1102
- const exhaustedPayload = exhaustedEvent?.payload;
1103
- expect(exhaustedPayload.outputSchemaRef).toBe('diagnostician-output-v1');
1104
- expect(exhaustedPayload.provider).toBe('openrouter');
1105
- expect(exhaustedPayload.model).toBe('anthropic/claude-sonnet-4');
1106
- expect(typeof exhaustedPayload.rawOutputPreview).toBe('string');
1107
- expect(Array.isArray(exhaustedPayload.validationErrors)).toBe(true);
1108
- expect(Array.isArray(exhaustedPayload.repairAttempts)).toBe(true);
1109
- expect(typeof exhaustedPayload.finalFailureReason).toBe('string');
1110
- });
1111
- it('6. repair loop never exceeds configured max attempts', async () => {
1112
- resetMock();
1113
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
1114
- const adapter = makeAdapter();
1115
- await expect(adapter.startRun(makeDiagnosticianInput())).rejects.toMatchObject({
1116
- category: 'output_invalid',
1117
- });
1118
- // 1 original + 3 repair (default maxRepairAttempts=3) = 4 calls total
1119
- expect(mockComplete).toHaveBeenCalledTimes(4);
1120
- });
1121
- it('7. repair prompt includes schemaRef and error paths', async () => {
1122
- resetMock();
1123
- mockComplete
1124
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
1125
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1126
- const adapter = makeAdapter();
1127
- await adapter.startRun(makeDiagnosticianInput());
1128
- const [, context] = mockComplete.mock.calls[1];
1129
- const repairMessage = context.messages[0]?.content ?? '';
1130
- expect(repairMessage).toContain('diagnostician-output-v1');
1131
- expect(repairMessage).toContain('/confidence');
1132
- });
1133
- it('8. repair attempt must not override lineage fields silently', async () => {
1134
- resetMock();
1135
- const originalWithLineage = {
1136
- ...INVALID_DIAGNOSIS_SCHEMA,
1137
- taskId: 'task-original-1',
1138
- };
1139
- const repairedWithChangedLineage = {
1140
- ...VALID_DIAGNOSIS,
1141
- taskId: 'task-CHANGED-by-llm',
1142
- };
1143
- mockComplete
1144
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(originalWithLineage)))
1145
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(repairedWithChangedLineage)));
1146
- const adapter = makeAdapter();
1147
- const handle = await adapter.startRun(makeDiagnosticianInput({
1148
- taskRef: { taskId: 'task-original-1' },
1149
- }));
1150
- const output = await adapter.fetchOutput(handle.runId);
1151
- const payload = output?.payload;
1152
- // taskId is a lineage field — it must be stripped from output (PRI-272).
1153
- // Downstream consumers get taskId from RunnerContext/TaskRecord.
1154
- expect(payload.taskId).toBeUndefined();
1155
- });
1156
- it('9. provider/model/rawOutputPreview are present in evidence pack', async () => {
1157
- resetMock();
1158
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
1159
- const adapter = makeAdapter();
1160
- try {
1161
- await adapter.startRun(makeDiagnosticianInput());
1162
- }
1163
- catch { /* expected */ }
1164
- const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
1165
- expect(exhaustedEvent).toBeDefined();
1166
- const payload = exhaustedEvent?.payload;
1167
- expect(payload.provider).toBe('openrouter');
1168
- expect(payload.model).toBe('anthropic/claude-sonnet-4');
1169
- expect(typeof payload.rawOutputPreview).toBe('string');
1170
- expect(payload.rawOutputPreview.length).toBeGreaterThan(0);
1171
- });
1172
- it('10. unknown schemaRef fails loud (rc-3; was backward-compatible silent skip)', async () => {
1173
- // CodeRabbit PR #1259: previously an unknown non-empty outputSchemaRef
1174
- // silently skipped schema validation (the "backward-compatible behavior").
1175
- // That silent skip is an rc-9/rc-3 defect — now it fails loud, matching
1176
- // OpenClawCliRuntimeAdapter. NOTE: no mockComplete setup because schema
1177
- // resolution fails before any LLM call.
1178
- resetMock();
1179
- const adapter = makeAdapter();
1180
- await expect(adapter.startRun(makeStartRunInput({
1181
- outputSchemaRef: 'custom-unknown-v1',
1182
- }))).rejects.toMatchObject({
1183
- category: 'output_invalid',
1184
- message: expect.stringMatching(/Unknown outputSchemaRef: custom-unknown-v1/i),
1185
- });
1186
- expect(mockComplete).toHaveBeenCalledTimes(0);
1187
- });
1188
- it('emits output_schema_invalid telemetry before repair attempt', async () => {
1189
- resetMock();
1190
- mockComplete
1191
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
1192
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1193
- const adapter = makeAdapter();
1194
- await adapter.startRun(makeDiagnosticianInput());
1195
- const schemaInvalidEvent = findTelemetryEvent('output_schema_invalid');
1196
- expect(schemaInvalidEvent).toBeDefined();
1197
- const payload = schemaInvalidEvent?.payload;
1198
- expect(payload.outputSchemaRef).toBe('diagnostician-output-v1');
1199
- expect(payload.provider).toBe('openrouter');
1200
- expect(payload.model).toBe('anthropic/claude-sonnet-4');
1201
- expect(typeof payload.rawOutputPreview).toBe('string');
1202
- expect(Array.isArray(payload.validationErrors)).toBe(true);
1203
- expect(payload.validationErrors.length).toBeGreaterThan(0);
1204
- });
1205
- it('evidence pack includes repairAttempts with schemaRef and attempt number', async () => {
1206
- resetMock();
1207
- mockComplete.mockResolvedValue(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)));
1208
- const adapter = makeAdapter();
1209
- try {
1210
- await adapter.startRun(makeDiagnosticianInput());
1211
- }
1212
- catch { /* expected */ }
1213
- const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
1214
- expect(exhaustedEvent).toBeDefined();
1215
- const payload = exhaustedEvent?.payload;
1216
- const attempts = payload.repairAttempts;
1217
- expect(attempts.length).toBeGreaterThan(0);
1218
- expect(attempts[0]?.schemaRef).toBe('diagnostician-output-v1');
1219
- expect(typeof attempts[0]?.attempt).toBe('number');
1220
- expect(typeof attempts[0]?.repaired).toBe('boolean');
1221
- });
1222
- it('output_schema_invalid telemetry includes validation error paths', async () => {
1223
- resetMock();
1224
- mockComplete
1225
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(INVALID_DIAGNOSIS_SCHEMA)))
1226
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1227
- const adapter = makeAdapter();
1228
- await adapter.startRun(makeDiagnosticianInput());
1229
- const schemaInvalidEvent = findTelemetryEvent('output_schema_invalid');
1230
- expect(schemaInvalidEvent).toBeDefined();
1231
- const payload = schemaInvalidEvent?.payload;
1232
- const errors = payload.validationErrors;
1233
- expect(errors.length).toBeGreaterThan(0);
1234
- const errorPaths = errors.map(e => e.path);
1235
- expect(errorPaths.some(p => typeof p === 'string' && p.includes('confidence'))).toBe(true);
1236
- });
1237
- });
1238
- // ── PRI-220: Provider Timeout and Transient Retry Policy ──
1239
- describe('PRI-220: Provider Timeout and Transient Retry Policy', () => {
1240
- it('1. provider timeout before client budget is provider_transient_timeout', async () => {
1241
- // LLM call fails with timeout-like error, client signal is NOT aborted
1242
- mockComplete.mockReset();
1243
- mockComplete.mockRejectedValue(new Error('connection timeout'));
1244
- const adapter = makeAdapter({ maxRetries: 0 });
1245
- let caughtErr = undefined;
1246
- try {
1247
- await adapter.startRun(makeStartRunInput());
1248
- }
1249
- catch (err) {
1250
- if (err instanceof PDRuntimeError)
1251
- caughtErr = err;
1252
- }
1253
- expect(caughtErr).toBeDefined();
1254
- expect(caughtErr?.category).toBe('timeout');
1255
- expect(caughtErr?.details?.timeoutClassification).toBe('provider_transient_timeout');
1256
- expect(caughtErr?.details?.effectiveTimeoutMs).toBe(60_000);
1257
- expect(typeof caughtErr?.details?.elapsedMs).toBe('number');
1258
- });
1259
- it('2. client timeout budget exhausted when signal is aborted', async () => {
1260
- // LLM call aborts, client signal IS aborted
1261
- mockComplete.mockReset();
1262
- mockComplete.mockImplementation(async (_model, _ctx, options) => {
1263
- const signal = options.signal;
1264
- const err = new DOMException('The operation was aborted', 'AbortError');
1265
- Object.defineProperty(signal, 'aborted', { value: true, writable: true });
1266
- throw err;
1267
- });
1268
- const adapter = makeAdapter({ maxRetries: 0 });
1269
- let caughtErr = undefined;
1270
- try {
1271
- await adapter.startRun(makeStartRunInput());
1272
- }
1273
- catch (err) {
1274
- if (err instanceof PDRuntimeError)
1275
- caughtErr = err;
1276
- }
1277
- expect(caughtErr).toBeDefined();
1278
- expect(caughtErr?.category).toBe('timeout');
1279
- expect(caughtErr?.details?.timeoutClassification).toBe('client_timeout_budget_exhausted');
1280
- });
1281
- it('3. unrecognized generic non-timeout error is classified as not_applicable', async () => {
1282
- mockComplete.mockReset();
1283
- mockComplete.mockRejectedValue(new Error('Generic database connection failed'));
1284
- const adapter = makeAdapter({ maxRetries: 0 });
1285
- let caughtErr = undefined;
1286
- try {
1287
- await adapter.startRun(makeStartRunInput());
1288
- }
1289
- catch (err) {
1290
- if (err instanceof PDRuntimeError)
1291
- caughtErr = err;
1292
- }
1293
- expect(caughtErr).toBeDefined();
1294
- expect(caughtErr?.category).toBe('execution_failed');
1295
- expect(caughtErr?.details?.timeoutClassification).toBeUndefined();
1296
- });
1297
- it('5. provider_transient_timeout retries and then succeeds within max limits', async () => {
1298
- mockComplete.mockReset();
1299
- // First attempt: transient timeout, Second attempt: success
1300
- mockComplete
1301
- .mockRejectedValueOnce(new Error('socket timeout'))
1302
- .mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1303
- const adapter = makeAdapter({ maxRetries: 2 });
1304
- const handle = await adapter.startRun(makeStartRunInput());
1305
- expect(mockComplete).toHaveBeenCalledTimes(2);
1306
- expect(handle.runId).toBeDefined();
1307
- // Check telemetry has retry attempt
1308
- const retryEvent = findTelemetryEvent('runtime_invocation_failed');
1309
- expect(retryEvent).toBeDefined();
1310
- const payload = retryEvent?.payload;
1311
- expect(payload?.isRetryAttempt).toBe(true);
1312
- expect(payload?.retryAttempt).toBe(0);
1313
- });
1314
- it('6. provider_transient_timeout exhausted maxRetries and fails permanently', async () => {
1315
- mockComplete.mockReset();
1316
- mockComplete.mockRejectedValue(new Error('API read timeout'));
1317
- const adapter = makeAdapter({ maxRetries: 1 });
1318
- let caughtErr = undefined;
1319
- try {
1320
- await adapter.startRun(makeStartRunInput());
1321
- }
1322
- catch (err) {
1323
- if (err instanceof PDRuntimeError)
1324
- caughtErr = err;
1325
- }
1326
- expect(mockComplete).toHaveBeenCalledTimes(2); // attempt 0 and attempt 1
1327
- expect(caughtErr).toBeDefined();
1328
- expect(caughtErr?.category).toBe('timeout');
1329
- expect(caughtErr?.details?.retryAttempt).toBe(1);
1330
- });
1331
- it('7. client_timeout_budget_exhausted is never retried', async () => {
1332
- mockComplete.mockReset();
1333
- mockComplete.mockImplementation(async (_model, _ctx, options) => {
1334
- const signal = options.signal;
1335
- Object.defineProperty(signal, 'aborted', { value: true, writable: true });
1336
- throw new DOMException('The operation was aborted', 'AbortError');
1337
- });
1338
- const adapter = makeAdapter({ maxRetries: 2 });
1339
- let caughtErr = undefined;
1340
- try {
1341
- await adapter.startRun(makeStartRunInput());
1342
- }
1343
- catch (err) {
1344
- if (err instanceof PDRuntimeError)
1345
- caughtErr = err;
1346
- }
1347
- expect(mockComplete).toHaveBeenCalledTimes(1); // Fails immediately, no retry
1348
- expect(caughtErr).toBeDefined();
1349
- expect(caughtErr?.category).toBe('timeout');
1350
- expect(caughtErr?.details?.timeoutClassification).toBe('client_timeout_budget_exhausted');
1351
- });
1352
- it('10. circular objects, BigInt, and null-prototype objects in errors do not crash telemetry', async () => {
1353
- mockComplete.mockReset();
1354
- mockComplete.mockRejectedValueOnce(new Error('fail'));
1355
- const nullProto = Object.create(null);
1356
- nullProto.message = 'null prototype error';
1357
- const circular = { message: 'circular error' };
1358
- circular.self = circular;
1359
- const bigIntErr = { message: 'bigint error', value: 9007199254740991n };
1360
- const adapter = makeAdapter({ maxRetries: 0 });
1361
- try {
1362
- await adapter.startRun(makeStartRunInput({ inputPayload: nullProto }));
1363
- }
1364
- catch { /* expected */ }
1365
- try {
1366
- await adapter.startRun(makeStartRunInput({ inputPayload: circular }));
1367
- }
1368
- catch { /* expected */ }
1369
- try {
1370
- await adapter.startRun(makeStartRunInput({ inputPayload: bigIntErr }));
1371
- }
1372
- catch { /* expected */ }
1373
- expect(true).toBe(true);
1374
- });
1375
- it('12. telemetry includes provider/model/elapsedMs/timeoutMs/timeoutSource/classification/attempt', async () => {
1376
- mockComplete.mockReset();
1377
- mockComplete.mockRejectedValue(new Error('request abort'));
1378
- const adapter = makeAdapter({ maxRetries: 0 });
1379
- try {
1380
- await adapter.startRun(makeStartRunInput({ timeoutMs: 33_000 }));
1381
- }
1382
- catch { /* expected */ }
1383
- const failedEvent = findTelemetryEvent('runtime_invocation_failed');
1384
- expect(failedEvent).toBeDefined();
1385
- const payload = failedEvent?.payload;
1386
- expect(payload.provider).toBe('openrouter');
1387
- expect(payload.model).toBe('anthropic/claude-sonnet-4');
1388
- expect(typeof payload.elapsedMs).toBe('number');
1389
- expect(payload.effectiveTimeoutMs).toBe(33_000);
1390
- expect(payload.timeoutSource).toBe('runner_input');
1391
- expect(payload.timeoutClassification).toBe('provider_transient_timeout');
1392
- expect(payload.retryAttempt).toBe(0);
1393
- });
1394
- it('13. caps subsequent retry attempt timeoutMs to remaining overall budget', async () => {
1395
- mockComplete.mockReset();
1396
- mockComplete.mockImplementationOnce(async (_model, _ctx, _options) => {
1397
- await new Promise(resolve => setTimeout(resolve, 40));
1398
- throw new Error('transient timeout');
1399
- });
1400
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1401
- const adapter = makeAdapter({ maxRetries: 2 });
1402
- await adapter.startRun(makeStartRunInput({ timeoutMs: 100 }));
1403
- expect(mockComplete).toHaveBeenCalledTimes(2);
1404
- const secondCallOpts = mockComplete.mock.calls[1]?.[2];
1405
- expect(secondCallOpts).toBeDefined();
1406
- const tc = secondCallOpts.timeoutMs;
1407
- expect(typeof tc).toBe('number');
1408
- expect(tc).toBeLessThanOrEqual(70);
1409
- expect(tc).toBeGreaterThan(0);
1410
- });
1411
- it('14. fails fast with client_timeout_budget_exhausted when budget is exhausted', async () => {
1412
- mockComplete.mockReset();
1413
- mockComplete.mockImplementation(async () => {
1414
- await new Promise(resolve => setTimeout(resolve, 50));
1415
- throw new Error('transient timeout');
1416
- });
1417
- const adapter = makeAdapter({ maxRetries: 2 });
1418
- let caughtErr = undefined;
1419
- try {
1420
- await adapter.startRun(makeStartRunInput({ timeoutMs: 30 }));
1421
- }
1422
- catch (err) {
1423
- if (err instanceof PDRuntimeError)
1424
- caughtErr = err;
1425
- }
1426
- expect(mockComplete).toHaveBeenCalledTimes(1);
1427
- expect(caughtErr).toBeDefined();
1428
- expect(caughtErr?.category).toBe('timeout');
1429
- expect(caughtErr?.details?.timeoutClassification).toBe('client_timeout_budget_exhausted');
1430
- });
1431
- it('15. untrusted error classification ignores inherited properties and handles malformed fields safely', async () => {
1432
- mockComplete.mockReset();
1433
- const proto = {
1434
- message: 'timeout - inherited but should be ignored if not own property',
1435
- name: 'AbortError',
1436
- };
1437
- const malformedErr = Object.create(proto);
1438
- malformedErr.message = 'ordinary own message';
1439
- malformedErr.name = 'OrdinaryError';
1440
- mockComplete.mockRejectedValueOnce(malformedErr);
1441
- const adapter = makeAdapter({ maxRetries: 0 });
1442
- let caughtErr = undefined;
1443
- try {
1444
- await adapter.startRun(makeStartRunInput());
1445
- }
1446
- catch (err) {
1447
- if (err instanceof PDRuntimeError)
1448
- caughtErr = err;
1449
- }
1450
- expect(caughtErr).toBeDefined();
1451
- expect(caughtErr?.category).toBe('execution_failed');
1452
- expect(caughtErr?.details?.timeoutClassification).toBeUndefined();
1453
- });
1454
- });
1455
- // ── PRI-400: Reasoning-model output handling (BUG-007a/b) ──
1456
- describe('PRI-400: reasoning-model output handling (BUG-007a/b)', () => {
1457
- /** Create an AssistantMessage with empty text content but ThinkingContent with valid JSON. */
1458
- function makeThinkingOnlyResponse(thinkingText, overrides = {}) {
1459
- return {
1460
- content: [
1461
- { type: 'text', text: '' },
1462
- { type: 'thinking', thinking: thinkingText },
1463
- ],
1464
- role: 'assistant',
1465
- stopReason: 'length',
1466
- api: 'openai-completions',
1467
- provider: 'lmstudio',
1468
- model: 'qwen3.6-27b-mtp',
1469
- usage: { input: 10, output: 5, cacheRead: 0, cacheWrite: 0, totalTokens: 15, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
1470
- timestamp: Date.now(),
1471
- ...overrides,
1472
- };
1473
- }
1474
- /** Create an AssistantMessage with empty content and no thinking. */
1475
- function makeEmptyContentResponse(overrides = {}) {
1476
- return {
1477
- content: [{ type: 'text', text: '' }],
1478
- role: 'assistant',
1479
- stopReason: 'length',
1480
- api: 'openai-completions',
1481
- provider: 'lmstudio',
1482
- model: 'qwen3.6-27b-mtp',
1483
- usage: { input: 10, output: 0, cacheRead: 0, cacheWrite: 0, totalTokens: 10, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
1484
- timestamp: Date.now(),
1485
- ...overrides,
1486
- };
1487
- }
1488
- it('(a) content="" + ThinkingContent with valid JSON + stopReason="length" → extracts JSON from thinking', async () => {
1489
- // Simulates the exact dogfood scenario: reasoning model spends all tokens on thinking
1490
- const thinkingWithJson = `Let me analyze this step by step...\n\n${JSON.stringify(VALID_DIAGNOSIS)}`;
1491
- mockComplete.mockResolvedValueOnce(makeThinkingOnlyResponse(thinkingWithJson));
1492
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1493
- const handle = await adapter.startRun(makeStartRunInput());
1494
- const output = await adapter.fetchOutput(handle.runId);
1495
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1496
- });
1497
- it('(b) content="" + no ThinkingContent + stopReason="length" → fail-loud with truncation error', async () => {
1498
- mockComplete.mockResolvedValueOnce(makeEmptyContentResponse());
1499
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1500
- let caughtErr;
1501
- try {
1502
- await adapter.startRun(makeStartRunInput());
1503
- }
1504
- catch (err) {
1505
- if (err instanceof PDRuntimeError)
1506
- caughtErr = err;
1507
- }
1508
- expect(caughtErr).toBeInstanceOf(PDRuntimeError);
1509
- expect(caughtErr?.category).toBe('output_invalid');
1510
- expect(caughtErr?.message).toContain('truncated');
1511
- expect(caughtErr?.details?.nextAction).toBeDefined();
1512
- });
1513
- it('content="" + no ThinkingContent + stopReason="stop" → fail-loud with "No text or reasoning"', async () => {
1514
- mockComplete.mockResolvedValueOnce(makeEmptyContentResponse({ stopReason: 'stop' }));
1515
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1516
- let caughtErr;
1517
- try {
1518
- await adapter.startRun(makeStartRunInput());
1519
- }
1520
- catch (err) {
1521
- if (err instanceof PDRuntimeError)
1522
- caughtErr = err;
1523
- }
1524
- expect(caughtErr).toBeInstanceOf(PDRuntimeError);
1525
- expect(caughtErr?.category).toBe('output_invalid');
1526
- expect(caughtErr?.message).toContain('No text or reasoning content');
1527
- expect(caughtErr?.details?.nextAction).toBeDefined();
1528
- });
1529
- it('(c) content="normal JSON" + no ThinkingContent → existing path unchanged (regression)', async () => {
1530
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1531
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1532
- const handle = await adapter.startRun(makeStartRunInput());
1533
- const output = await adapter.fetchOutput(handle.runId);
1534
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1535
- });
1536
- it('content="" + ThinkingContent with no extractable JSON → output_invalid', async () => {
1537
- mockComplete.mockResolvedValueOnce(makeThinkingOnlyResponse('Just thinking prose, no JSON here'));
1538
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1539
- let caughtErr;
1540
- try {
1541
- await adapter.startRun(makeStartRunInput());
1542
- }
1543
- catch (err) {
1544
- if (err instanceof PDRuntimeError)
1545
- caughtErr = err;
1546
- }
1547
- expect(caughtErr).toBeInstanceOf(PDRuntimeError);
1548
- expect(caughtErr?.category).toBe('output_invalid');
1549
- });
1550
- it('stopReason="length" with empty content and empty thinking → fail-loud with nextAction', async () => {
1551
- mockComplete.mockResolvedValueOnce(makeEmptyContentResponse());
1552
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1553
- let caughtErr;
1554
- try {
1555
- await adapter.startRun(makeStartRunInput());
1556
- }
1557
- catch (err) {
1558
- if (err instanceof PDRuntimeError)
1559
- caughtErr = err;
1560
- }
1561
- expect(caughtErr).toBeInstanceOf(PDRuntimeError);
1562
- expect(caughtErr?.category).toBe('output_invalid');
1563
- expect(caughtErr?.message).toContain('finish_reason=length');
1564
- expect(caughtErr?.details?.nextAction).toContain('maxTokens');
1565
- });
1566
- it('stopReason="length" with valid thinking content → succeeds despite truncation', async () => {
1567
- const thinkingWithJson = JSON.stringify(VALID_DIAGNOSIS);
1568
- mockComplete.mockResolvedValueOnce(makeThinkingOnlyResponse(thinkingWithJson));
1569
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1570
- const handle = await adapter.startRun(makeStartRunInput());
1571
- const output = await adapter.fetchOutput(handle.runId);
1572
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1573
- });
1574
- it('completeWithRetry omits maxTokens by default (PRI-621: pi-ai native model ceiling)', async () => {
1575
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1576
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1577
- await adapter.startRun(makeStartRunInput());
1578
- const [, , options] = mockComplete.mock.calls[0];
1579
- expect(options.maxTokens).toBeUndefined();
1580
- });
1581
- it('completeWithRetry uses config.maxTokens override when provided', async () => {
1582
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1583
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only', maxTokens: 8192 });
1584
- await adapter.startRun(makeStartRunInput());
1585
- const [, , options] = mockComplete.mock.calls[0];
1586
- expect(options.maxTokens).toBe(8192);
1587
- });
1588
- it('completeWithRetry omits maxTokens for deepseek too — provider-name heuristic retired (PRI-621)', async () => {
1589
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1590
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only', provider: 'deepseek', model: 'deepseek-v4-flash', baseUrl: 'https://api.deepseek.com' });
1591
- await adapter.startRun(makeStartRunInput());
1592
- const [, , options] = mockComplete.mock.calls[0];
1593
- expect(options.maxTokens).toBeUndefined();
1594
- });
1595
- it('PRI-621: custom provider relaying a catalog-known model keeps catalog metadata (catalog-first resolveModel)', async () => {
1596
- // Bai relay serving deepseek-v4-flash: the catalog entry (reasoning
1597
- // model, 384K output ceiling) must survive with only transport fields
1598
- // overridden — the old hardcoded fallback misclassified it as
1599
- // non-reasoning with a 32K ceiling and fed the RC0 budget bug.
1600
- mockGetModel.mockImplementation((_provider, id) => id === 'deepseek-v4-flash'
1601
- ? {
1602
- id: 'deepseek-v4-flash',
1603
- name: 'DeepSeek V4 Flash',
1604
- api: 'openai-completions',
1605
- provider: 'deepseek',
1606
- baseUrl: 'https://api.deepseek.com',
1607
- reasoning: true,
1608
- input: ['text'],
1609
- cost: { input: 0.14, output: 0.28, cacheRead: 0, cacheWrite: 0 },
1610
- contextWindow: 1_000_000,
1611
- maxTokens: 384_000,
1612
- }
1613
- : undefined);
1614
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1615
- const adapter = makeAdapter({ provider: 'Bai', model: 'deepseek-v4-flash', baseUrl: 'https://api.b.ai/v1', outputPathStrategy: 'free_form_only' });
1616
- await adapter.startRun(makeStartRunInput());
1617
- const [model] = mockComplete.mock.calls[0];
1618
- expect(model.provider).toBe('Bai');
1619
- expect(model.baseUrl).toBe('https://api.b.ai/v1');
1620
- expect(model.reasoning).toBe(true);
1621
- expect(model.maxTokens).toBe(384_000);
1622
- });
1623
- it('PRI-621: custom provider with unknown model id falls back to conservative hardcoded metadata', async () => {
1624
- mockGetModel.mockReturnValue(undefined);
1625
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1626
- const adapter = makeAdapter({ provider: 'Bai', model: 'totally-unknown-model', baseUrl: 'https://api.b.ai/v1', outputPathStrategy: 'free_form_only' });
1627
- await adapter.startRun(makeStartRunInput());
1628
- const [model] = mockComplete.mock.calls[0];
1629
- expect(model.reasoning).toBe(false);
1630
- expect(model.maxTokens).toBe(32_000);
1631
- });
1632
- it('PRI-621: built-in provider with unknown model id fails loud (runtime_unavailable)', async () => {
1633
- mockGetModel.mockReturnValue(undefined);
1634
- const adapter = makeAdapter({ provider: 'openai', model: 'gpt-not-a-model' });
1635
- await expect(adapter.startRun(makeStartRunInput())).rejects.toMatchObject({ category: 'runtime_unavailable' });
1636
- });
1637
- it('PRI-621 RC3: schema-aware extraction picks the full object over an earlier inner fragment', async () => {
1638
- // Recurrence of 2026-08-28: the answer contained a small lineage
1639
- // fragment BEFORE the complete output; first-object extraction kept
1640
- // validating the fragment ("all required properties undefined") and
1641
- // the repair loop fixed the wrong object.
1642
- const response = `Here is the trace reference {"diagnosisId":"diag-fragment-1"} and the complete output below:\n${JSON.stringify(VALID_DIAGNOSIS)}`;
1643
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(response));
1644
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1645
- const handle = await adapter.startRun(makeStartRunInput({ outputSchemaRef: 'diagnostician-output-v1' }));
1646
- const output = await adapter.fetchOutput(handle.runId);
1647
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1648
- });
1649
- it('mixed content: text + thinking → prefers text content (regression)', async () => {
1650
- // When both text and thinking are present, text should be preferred
1651
- const mixedResponse = {
1652
- content: [
1653
- { type: 'text', text: JSON.stringify(VALID_DIAGNOSIS) },
1654
- { type: 'thinking', thinking: 'Some reasoning here' },
1655
- ],
1656
- role: 'assistant',
1657
- stopReason: 'stop',
1658
- api: 'openai-completions',
1659
- provider: 'openrouter',
1660
- model: 'anthropic/claude-sonnet-4',
1661
- usage: { input: 10, output: 5, cacheRead: 0, cacheWrite: 0, totalTokens: 15, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
1662
- timestamp: Date.now(),
1663
- };
1664
- mockComplete.mockResolvedValueOnce(mixedResponse);
1665
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1666
- const handle = await adapter.startRun(makeStartRunInput());
1667
- const output = await adapter.fetchOutput(handle.runId);
1668
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1669
- });
1670
- });
1671
- // ── PRI-405: Reasoning-model E2E stub tests ───────────────────────────────
1672
- describe('PRI-405: reasoning-model E2E stub tests', () => {
1673
- /** Valid DiagRootCauseOutputV1 for split pipeline Stage A. */
1674
- const VALID_ROOT_CAUSE_OUTPUT = {
1675
- valid: true,
1676
- diagnosisId: 'diag-pri405-1',
1677
- taskId: 'diag_rootcause-diagnosis_pain-pri405',
1678
- summary: 'AI助手在修改代码前未阅读错误手册,导致重复了类型断言绕过校验问题',
1679
- causalChain: [
1680
- {
1681
- why: 1,
1682
- statement: 'AI助手直接使用as类型断言绕过运行时校验',
1683
- evidenceRefs: ['owner_reported:cli'],
1684
- },
1685
- {
1686
- why: 2,
1687
- statement: '修改代码前未阅读AGENTS.md中的错误手册和ERR-001相关条目',
1688
- evidenceRefs: ['owner_reported:cli'],
1689
- },
1690
- {
1691
- why: 3,
1692
- statement: '缺乏强制性的代码修改前必读规范检查机制',
1693
- evidenceRefs: ['owner_reported:cli'],
1694
- },
1695
- ],
1696
- rootCause: 'Design: 缺乏强制性的代码修改前必读规范检查机制,导致AI助手绕过关键校验步骤',
1697
- rootCauseCategory: 'Design',
1698
- evidence: [
1699
- {
1700
- sourceRef: 'owner_reported:cli',
1701
- note: 'AI助手在修改代码时使用了as类型断言绕过运行时校验,违反了AGENTS.md中ERR-001的规定',
1702
- },
1703
- ],
1704
- confidence: 0.85,
1705
- ambiguityNotes: [
1706
- '关联核心公理: T-01 (先理解结构再修改)',
1707
- ],
1708
- };
1709
- /** Create a thinking-only response (no text block) simulating reasoning model output. */
1710
- function makeThinkingOnlyResponse(thinkingText, overrides = {}) {
1711
- return {
1712
- content: [
1713
- { type: 'thinking', thinking: thinkingText },
1714
- ],
1715
- role: 'assistant',
1716
- stopReason: 'length',
1717
- api: 'openai-completions',
1718
- provider: 'lmstudio',
1719
- model: 'qwen3.6-27b-mtp',
1720
- usage: { input: 10, output: 5, cacheRead: 0, cacheWrite: 0, totalTokens: 15, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
1721
- timestamp: Date.now(),
1722
- ...overrides,
1723
- };
1724
- }
1725
- // ── Scenario A: thinking fallback + schema validation passes ──
1726
- it('Scenario A: thinking-only response with valid JSON passes diag-rootcause-output-v1 schema validation', async () => {
1727
- // Simulates reasoning model that puts all structured output in thinking block
1728
- const thinkingWithJson = `让我逐步分析这个pain信号...\n\n${JSON.stringify(VALID_ROOT_CAUSE_OUTPUT)}`;
1729
- mockComplete.mockResolvedValueOnce(makeThinkingOnlyResponse(thinkingWithJson));
1730
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1731
- const handle = await adapter.startRun(makeStartRunInput({
1732
- outputSchemaRef: 'diag-rootcause-output-v1',
1733
- taskRef: { taskId: 'diag_rootcause-diagnosis_pain-pri405' },
1734
- }));
1735
- const output = await adapter.fetchOutput(handle.runId);
1736
- expect(output).not.toBeNull();
1737
- // Schema validation passed — output was extracted from thinking and validated
1738
- expect(output?.payload).toMatchObject({
1739
- valid: true,
1740
- diagnosisId: 'diag-pri405-1',
1741
- rootCauseCategory: 'Design',
1742
- });
1743
- // taskId is a lineage field — stripped by adapter (PRI-272)
1744
- const payload = output?.payload;
1745
- expect(payload.taskId).toBeUndefined();
1746
- });
1747
- // ── Scenario B: thinking with prose (no JSON) + truncated → fail-loud ──
1748
- it('Scenario B: thinking with prose but no JSON + stopReason=length → fail-loud output_invalid', async () => {
1749
- // Simulates reasoning model that spent all tokens on thinking prose, no JSON output.
1750
- // extractAssistantTextOrThrow extracts the thinking text (it has content),
1751
- // but extractJsonObject finds no JSON → output_invalid.
1752
- // This is the correct fail-loud path: the adapter does NOT silently succeed.
1753
- const thinkingProseOnly = 'Here is a thinking process: 1. analyze the pain signal 2. identify root cause 3. classify the category...';
1754
- mockComplete.mockResolvedValueOnce(makeThinkingOnlyResponse(thinkingProseOnly));
1755
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1756
- let caughtErr;
1757
- try {
1758
- await adapter.startRun(makeStartRunInput({
1759
- outputSchemaRef: 'diag-rootcause-output-v1',
1760
- taskRef: { taskId: 'diag_rootcause-diagnosis_pain-pri405' },
1761
- }));
1762
- }
1763
- catch (err) {
1764
- if (err instanceof PDRuntimeError)
1765
- caughtErr = err;
1766
- }
1767
- // EP-03: fail-loud with structured reason — adapter does NOT silently succeed
1768
- expect(caughtErr).toBeInstanceOf(PDRuntimeError);
1769
- expect(caughtErr?.category).toBe('output_invalid');
1770
- // The error must indicate why: either no JSON found, truncated, or finish_reason=length
1771
- const reason = caughtErr?.message ?? '';
1772
- expect(reason.includes('No valid JSON') || reason.includes('truncated') || reason.includes('finish_reason=length'), `Expected reason to indicate extraction failure, got: ${reason}`).toBe(true);
1773
- });
1774
- it('Scenario B (variant): empty thinking + stopReason=length → fail-loud with truncated + nextAction containing maxTokens', async () => {
1775
- // When thinking is empty and stopReason=length, extractAssistantTextOrThrow
1776
- // throws the specific truncated error with nextAction guidance.
1777
- mockComplete.mockResolvedValueOnce(makeThinkingOnlyResponse('', { stopReason: 'length' }));
1778
- const adapter = makeAdapter({ outputPathStrategy: 'free_form_only' });
1779
- let caughtErr;
1780
- try {
1781
- await adapter.startRun(makeStartRunInput({
1782
- outputSchemaRef: 'diag-rootcause-output-v1',
1783
- taskRef: { taskId: 'diag_rootcause-diagnosis_pain-pri405' },
1784
- }));
1785
- }
1786
- catch (err) {
1787
- if (err instanceof PDRuntimeError)
1788
- caughtErr = err;
1789
- }
1790
- // EP-03: fail-loud with structured reason and nextAction
1791
- expect(caughtErr).toBeInstanceOf(PDRuntimeError);
1792
- expect(caughtErr?.category).toBe('output_invalid');
1793
- expect(caughtErr?.message).toContain('truncated');
1794
- expect(caughtErr?.details?.nextAction).toBeDefined();
1795
- const nextAction = String(caughtErr?.details?.nextAction ?? '');
1796
- expect(nextAction.includes('maxTokens')).toBe(true);
1797
- });
1798
- });
1799
- // ── PRI-284: tool_call_first / json_mode_first path tests ──
1800
- describe('output path strategy: tool_call_first (PRI-284)', () => {
1801
- function makeToolCallResponse(args, toolName = 'record_diagnostician_output_v1') {
1802
- return {
1803
- content: [
1804
- { type: 'toolCall', id: 'call-1', name: toolName, arguments: args },
1805
- ],
1806
- role: 'assistant',
1807
- stopReason: 'toolUse',
1808
- api: 'openai-completions',
1809
- provider: 'openrouter',
1810
- model: 'anthropic/claude-sonnet-4',
1811
- usage: { input: 10, output: 5, cacheRead: 0, cacheWrite: 0, totalTokens: 15, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } },
1812
- timestamp: Date.now(),
1813
- };
1814
- }
1815
- function makeToolCallInput(overrides = {}) {
1816
- return {
1817
- agentSpec: { agentId: 'diagnostician', schemaVersion: 'v1' },
1818
- inputPayload: 'Diagnose this pain signal',
1819
- contextItems: [],
1820
- timeoutMs: 60_000,
1821
- outputSchemaRef: 'diagnostician-output-v1',
1822
- ...overrides,
1823
- };
1824
- }
1825
- it('tool_call success: provider returns toolUse with valid schema → output extracted from tool args', async () => {
1826
- mockComplete.mockResolvedValueOnce(makeToolCallResponse(VALID_DIAGNOSIS));
1827
- const adapter = makeAdapter({ outputPathStrategy: 'tool_call_first' });
1828
- const handle = await adapter.startRun(makeToolCallInput());
1829
- const output = await adapter.fetchOutput(handle.runId);
1830
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1', valid: true });
1831
- // Verify telemetry includes correct outputPath
1832
- const pathEvent = findTelemetryEvent('output_path_chosen');
1833
- expect(pathEvent?.payload).toMatchObject({
1834
- outputPath: 'tool_call',
1835
- outputSchemaRef: 'diagnostician-output-v1',
1836
- });
1837
- });
1838
- it('tool_call strips lineage fields from tool args (ERR-008)', async () => {
1839
- const outputWithLineage = { ...VALID_DIAGNOSIS, sourcePainId: 'pain-injected', sourceTaskId: 'task-injected' };
1840
- mockComplete.mockResolvedValueOnce(makeToolCallResponse(outputWithLineage));
1841
- const adapter = makeAdapter({ outputPathStrategy: 'tool_call_first' });
1842
- const handle = await adapter.startRun(makeToolCallInput());
1843
- const output = await adapter.fetchOutput(handle.runId);
1844
- expect(output?.payload).not.toHaveProperty('sourcePainId');
1845
- expect(output?.payload).not.toHaveProperty('sourceTaskId');
1846
- // Non-lineage fields preserved
1847
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1848
- });
1849
- it('tool_call schema invalid → falls through to json_mode → free_form', async () => {
1850
- // Path 1: tool call with invalid schema args
1851
- const invalidToolArgs = { invalid: 'data' };
1852
- mockComplete.mockResolvedValueOnce(makeToolCallResponse(invalidToolArgs));
1853
- // Path 2: json_mode also fails (non-JSON text)
1854
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('not json at all'));
1855
- // Path 3: free_form succeeds
1856
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1857
- const adapter = makeAdapter({ outputPathStrategy: 'tool_call_first' });
1858
- const handle = await adapter.startRun(makeToolCallInput());
1859
- const output = await adapter.fetchOutput(handle.runId);
1860
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1861
- // Verify fallback telemetry was emitted for tool_call path.
1862
- // Runtime Contract Rule 2: validate shape before reading eventType.
1863
- const fallbackEvents = mockEmitTelemetry.mock.calls.filter((c) => {
1864
- const [payload] = c;
1865
- return (typeof payload === 'object' &&
1866
- payload !== null &&
1867
- Object.hasOwn(payload, 'eventType') &&
1868
- payload.eventType === 'output_path_fallback');
1869
- });
1870
- expect(fallbackEvents.length).toBeGreaterThanOrEqual(1);
1871
- });
1872
- it('tool_call not supported (stopReason != toolUse) → falls to json_mode', async () => {
1873
- // Path 1 (tool_call): provider returns non-toolUse response
1874
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('not json'));
1875
- // Path 2 (json_mode): provider returns valid JSON
1876
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1877
- const adapter = makeAdapter({ outputPathStrategy: 'tool_call_first' });
1878
- const handle = await adapter.startRun(makeToolCallInput());
1879
- const output = await adapter.fetchOutput(handle.runId);
1880
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1881
- });
1882
- it('tool_call uses per-runner schema from registry, not hardcoded (PRI-284)', async () => {
1883
- mockComplete.mockResolvedValueOnce(makeToolCallResponse(VALID_DIAGNOSIS));
1884
- const adapter = makeAdapter({ outputPathStrategy: 'tool_call_first' });
1885
- await adapter.startRun(makeToolCallInput());
1886
- // Verify the context passed to completeSimple includes a tool
1887
- // whose name is derived from the schemaRef, not hardcoded.
1888
- // Runtime Contract Rule 2 (no `as` bypass): use a type guard on the
1889
- // unknown mock-call shape instead of asserting the type.
1890
- const [firstCallArgs] = mockComplete.mock.calls;
1891
- expect(firstCallArgs).toBeDefined();
1892
- const rawContext = firstCallArgs?.[1];
1893
- expect(isToolContext(rawContext)).toBe(true);
1894
- if (!isToolContext(rawContext))
1895
- throw new Error('invalid tool context');
1896
- expect(rawContext.tools.length).toBe(1);
1897
- const [tool] = rawContext.tools;
1898
- if (!tool)
1899
- throw new Error('expected exactly one tool');
1900
- // Name derived from schemaRef 'diagnostician-output-v1'
1901
- expect(tool.name).toBe('record_diagnostician_output_v1');
1902
- // Not the old hardcoded name
1903
- expect(tool.name).not.toBe('record_diagnosis_v1');
1904
- // Parameters should be the schema from registry
1905
- expect(tool.parameters).toBeDefined();
1906
- });
1907
- });
1908
- describe('output path strategy: json_mode_first (PRI-284)', () => {
1909
- function makeJsonModeInput(overrides = {}) {
1910
- return {
1911
- agentSpec: { agentId: 'diagnostician', schemaVersion: 'v1' },
1912
- inputPayload: 'Diagnose this pain signal',
1913
- contextItems: [],
1914
- timeoutMs: 60_000,
1915
- outputSchemaRef: 'diagnostician-output-v1',
1916
- ...overrides,
1917
- };
1918
- }
1919
- it('json_mode success: provider returns valid JSON text → output extracted', async () => {
1920
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1921
- const adapter = makeAdapter({ outputPathStrategy: 'json_mode_first' });
1922
- const handle = await adapter.startRun(makeJsonModeInput());
1923
- const output = await adapter.fetchOutput(handle.runId);
1924
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1925
- const pathEvent = findTelemetryEvent('output_path_chosen');
1926
- expect(pathEvent?.payload).toMatchObject({
1927
- outputPath: 'json_object_mode',
1928
- });
1929
- });
1930
- it('json_mode strips lineage fields (ERR-008)', async () => {
1931
- const outputWithLineage = { ...VALID_DIAGNOSIS, sourcePainId: 'pain-llm-injected' };
1932
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(outputWithLineage)));
1933
- const adapter = makeAdapter({ outputPathStrategy: 'json_mode_first' });
1934
- const handle = await adapter.startRun(makeJsonModeInput());
1935
- const output = await adapter.fetchOutput(handle.runId);
1936
- expect(output?.payload).not.toHaveProperty('sourcePainId');
1937
- });
1938
- it('json_mode parse fails → falls to free_form', async () => {
1939
- // Path 2: json_mode returns non-parseable text
1940
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('this is not json at all'));
1941
- // Path 3: free_form succeeds
1942
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1943
- const adapter = makeAdapter({ outputPathStrategy: 'json_mode_first' });
1944
- const handle = await adapter.startRun(makeJsonModeInput());
1945
- const output = await adapter.fetchOutput(handle.runId);
1946
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1947
- // Verify fallback telemetry.
1948
- // Runtime Contract Rule 2: validate shape before reading eventType.
1949
- const fallbackEvents = mockEmitTelemetry.mock.calls.filter((c) => {
1950
- const [payload] = c;
1951
- return (typeof payload === 'object' &&
1952
- payload !== null &&
1953
- Object.hasOwn(payload, 'eventType') &&
1954
- payload.eventType === 'output_path_fallback');
1955
- });
1956
- expect(fallbackEvents.length).toBeGreaterThanOrEqual(1);
1957
- });
1958
- it('json_mode schema invalid → falls to free_form', async () => {
1959
- // Path 2: json_mode returns valid JSON but wrong schema
1960
- const wrongSchema = { wrongField: 'wrong value' };
1961
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(wrongSchema)));
1962
- // Path 3: free_form succeeds with correct schema
1963
- mockComplete.mockResolvedValueOnce(makeAssistantMessage(JSON.stringify(VALID_DIAGNOSIS)));
1964
- const adapter = makeAdapter({ outputPathStrategy: 'json_mode_first' });
1965
- const handle = await adapter.startRun(makeJsonModeInput());
1966
- const output = await adapter.fetchOutput(handle.runId);
1967
- expect(output?.payload).toMatchObject({ diagnosisId: 'diag-test-1' });
1968
- });
1969
- });
1970
- // ── PRI-707: finish metadata preservation + truncation classification ──
1971
- //
1972
- // Before PRI-707 the provider's stopReason/usage were dropped whenever any
1973
- // text was extractable, so a token-limit cut was indistinguishable from a
1974
- // true format error ("No valid JSON found in LLM response"). These tests
1975
- // pin the preserved evidence surfaces: error details (→ durable
1976
- // diagnosticJson via the runner's classifyError path), telemetry payloads,
1977
- // and the repair-prompt truncation notice.
1978
- describe('PRI-707: finish metadata preservation and truncation classification', () => {
1979
- function makeSchemaInput(overrides = {}) {
1980
- return {
1981
- agentSpec: { agentId: 'diagnostician', schemaVersion: 'v1' },
1982
- inputPayload: 'Diagnose this pain signal',
1983
- contextItems: [],
1984
- timeoutMs: 60_000,
1985
- outputSchemaRef: 'diagnostician-output-v1',
1986
- ...overrides,
1987
- };
1988
- }
1989
- /** Type-guard the repair prompt out of a completeSimple mock call (rc-2). */
1990
- function repairPromptFromCall(call) {
1991
- if (!Array.isArray(call) || call.length < 2)
1992
- return undefined;
1993
- const [context] = call.slice(1, 2);
1994
- if (typeof context !== 'object' || context === null || !Object.hasOwn(context, 'messages'))
1995
- return undefined;
1996
- const { messages } = context;
1997
- if (!Array.isArray(messages) || messages.length === 0)
1998
- return undefined;
1999
- const [first] = messages;
2000
- if (typeof first !== 'object' || first === null || !Object.hasOwn(first, 'content'))
2001
- return undefined;
2002
- const { content } = first;
2003
- return typeof content === 'string' ? content : undefined;
2004
- }
2005
- function usageWith(output) {
2006
- return { input: 120, output, cacheRead: 0, cacheWrite: 0, totalTokens: 120 + output, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 } };
2007
- }
2008
- it('T3+T4: finish_reason=length + usage → extraction failure carries truncated evidence (details + telemetry)', async () => {
2009
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"diagnosisId":"diag-trunc', {
2010
- stopReason: 'length',
2011
- usage: usageWith(64),
2012
- }));
2013
- const adapter = makeAdapter(); // free_form_only → Path 3 directly
2014
- let caught;
2015
- try {
2016
- await adapter.startRun(makeSchemaInput());
2017
- }
2018
- catch (err) {
2019
- caught = err instanceof PDRuntimeError ? err : undefined;
2020
- }
2021
- expect(caught?.category).toBe('output_invalid');
2022
- expect(caught?.message).toContain('finish_reason=length');
2023
- // The runner persists err.details into diagnosticJson.output_failure_details
2024
- // (PRI-559 P0-2) — so these fields become durable failure evidence.
2025
- expect(caught?.details).toMatchObject({
2026
- truncated: true,
2027
- stopReason: 'length',
2028
- outputTokens: 64,
2029
- });
2030
- expect(typeof caught?.details?.nextAction).toBe('string');
2031
- const extractionEvent = findTelemetryEvent('output_extraction_failed');
2032
- expect(extractionEvent?.payload).toMatchObject({
2033
- stopReason: 'length',
2034
- outputTokens: 64,
2035
- truncated: true,
2036
- });
2037
- });
2038
- it('T5: finish_reason=stop + no extractable JSON → conservative legacy classification, no truncation claim', async () => {
2039
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('I cannot answer that.'));
2040
- const adapter = makeAdapter();
2041
- let caught;
2042
- try {
2043
- await adapter.startRun(makeSchemaInput());
2044
- }
2045
- catch (err) {
2046
- caught = err instanceof PDRuntimeError ? err : undefined;
2047
- }
2048
- expect(caught?.category).toBe('output_invalid');
2049
- expect(caught?.message).toBe('[output_invalid] No valid JSON found in LLM response');
2050
- expect(caught?.details).toBeUndefined();
2051
- const extractionEvent = findTelemetryEvent('output_extraction_failed');
2052
- const payload = extractionEvent?.payload;
2053
- expect(payload?.truncated).toBeUndefined();
2054
- });
2055
- it('T2: valid JSON + schema violation with finish_reason=stop → schema-invalid, never claimed as truncation', async () => {
2056
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"unexpected":true}'));
2057
- // Repair attempts fail (unparseable) → exhausted.
2058
- mockComplete.mockResolvedValue(makeAssistantMessage('still not json'));
2059
- const adapter = makeAdapter();
2060
- let caught;
2061
- try {
2062
- await adapter.startRun(makeSchemaInput());
2063
- }
2064
- catch (err) {
2065
- caught = err instanceof PDRuntimeError ? err : undefined;
2066
- }
2067
- expect(caught?.category).toBe('output_invalid');
2068
- expect(caught?.message).toContain('does not match');
2069
- const evidencePack = caught?.details?.evidencePack;
2070
- expect(evidencePack).toBeDefined();
2071
- // The PRI-621 RC3 heuristic fires (object matches no required key)…
2072
- expect(evidencePack?.truncationSuspected).toBe(true);
2073
- // …but the definitive finish-metadata signal must NOT claim truncation.
2074
- expect(evidencePack?.truncated).toBeUndefined();
2075
- expect(evidencePack?.stopReason).toBe('stop');
2076
- });
2077
- it('T8: finish_reason=length + schema violation → repair prompt carries truncation notice and evidencePack marks truncated', async () => {
2078
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"unexpected":true}', { stopReason: 'length' }));
2079
- mockComplete.mockResolvedValue(makeAssistantMessage('still not json'));
2080
- const adapter = makeAdapter();
2081
- let caught;
2082
- try {
2083
- await adapter.startRun(makeSchemaInput());
2084
- }
2085
- catch (err) {
2086
- caught = err instanceof PDRuntimeError ? err : undefined;
2087
- }
2088
- const evidencePack = caught?.details?.evidencePack;
2089
- expect(evidencePack?.truncated).toBe(true);
2090
- expect(evidencePack?.stopReason).toBe('length');
2091
- // Terminal telemetry must carry the same truncation evidence so
2092
- // monitoring can distinguish a token-limit cut from an ordinary
2093
- // schema failure (PR #1574 review finding). Default helper usage
2094
- // reports output: 5.
2095
- const exhaustedEvent = findTelemetryEvent('output_repair_exhausted');
2096
- expect(exhaustedEvent?.payload).toMatchObject({
2097
- stopReason: 'length',
2098
- truncated: true,
2099
- outputTokens: 5,
2100
- });
2101
- // The FIRST completeSimple call is the original generation; repair
2102
- // calls follow. Their user message must carry the truncation notice so
2103
- // the repair LLM stops treating a cut fragment as a misunderstanding.
2104
- const repairCalls = mockComplete.mock.calls.slice(1);
2105
- expect(repairCalls.length).toBeGreaterThan(0);
2106
- const firstRepairPrompt = repairPromptFromCall(repairCalls[0]);
2107
- expect(firstRepairPrompt).toContain('TRUNCATION NOTICE');
2108
- expect(firstRepairPrompt).toContain('finish_reason=length');
2109
- });
2110
- it('truncation notice absent when finish metadata shows a clean stop (repair prompt unchanged)', async () => {
2111
- mockComplete.mockResolvedValueOnce(makeAssistantMessage('{"unexpected":true}'));
2112
- mockComplete.mockResolvedValue(makeAssistantMessage('still not json'));
2113
- const adapter = makeAdapter();
2114
- try {
2115
- await adapter.startRun(makeSchemaInput());
2116
- }
2117
- catch {
2118
- // output_invalid expected — assertion is on the prompt below.
2119
- }
2120
- const repairCalls = mockComplete.mock.calls.slice(1);
2121
- expect(repairCalls.length).toBeGreaterThan(0);
2122
- const firstRepairPrompt = repairPromptFromCall(repairCalls[0]);
2123
- expect(firstRepairPrompt).toBeDefined();
2124
- expect(firstRepairPrompt).not.toContain('TRUNCATION NOTICE');
2125
- });
2126
- });
2127
- });
2128
- //# sourceMappingURL=pi-ai-runtime-adapter.test.js.map