create-principles-disciple 1.94.0 → 1.96.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/console/dist/server/config/WorkspaceConfigStore.js +2 -1
  2. package/console/dist/server/config/pd-config-store.d.ts +33 -0
  3. package/console/dist/server/config/pd-config-store.js +196 -0
  4. package/console/dist/server/index.js +19 -4
  5. package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +0 -2
  6. package/console/dist/server/models/EvidenceChainConsoleModel.js +36 -2
  7. package/console/dist/server/models/HealthCheckModel.js +5 -3
  8. package/console/dist/server/models/IntentDecisionModel.d.ts +66 -0
  9. package/console/dist/server/models/IntentDecisionModel.js +207 -0
  10. package/console/dist/server/models/IntentPageModel.d.ts +52 -0
  11. package/console/dist/server/models/IntentPageModel.js +292 -0
  12. package/console/dist/server/models/PrinciplesConsoleModel.d.ts +2 -0
  13. package/console/dist/server/models/PrinciplesConsoleModel.js +37 -1
  14. package/console/dist/server/models/WorkspaceService.d.ts +0 -28
  15. package/console/dist/server/models/WorkspaceService.js +0 -115
  16. package/console/dist/server/routes/config.js +55 -1
  17. package/console/dist/server/routes/intent-decisions.d.ts +33 -0
  18. package/console/dist/server/routes/intent-decisions.js +499 -0
  19. package/console/dist/server/routes/intent.d.ts +7 -0
  20. package/console/dist/server/routes/intent.js +223 -0
  21. package/console/dist/server/routes/principles.js +67 -1
  22. package/console/dist/server/routes/update.d.ts +0 -1
  23. package/console/dist/server/routes/update.js +14 -11
  24. package/console/dist/types.d.ts +1 -0
  25. package/console/dist/ui/App.js +2 -60
  26. package/console/dist/ui/api.d.ts +58 -18
  27. package/console/dist/ui/api.js +78 -6
  28. package/console/dist/ui/components/layout/app-sidebar.js +13 -12
  29. package/console/dist/ui/components/ui/badge.d.ts +1 -1
  30. package/console/dist/ui/components/ui/button.d.ts +1 -1
  31. package/console/dist/ui/components/ui/shiny-text.d.ts +28 -0
  32. package/console/dist/ui/components/ui/shiny-text.js +46 -0
  33. package/console/dist/ui/i18n/en.json +306 -3
  34. package/console/dist/ui/i18n/zh-CN.json +306 -3
  35. package/console/dist/ui/pages/activation/ActivationPage.js +2 -1
  36. package/console/dist/ui/pages/control-center/AgentCard.d.ts +31 -0
  37. package/console/dist/ui/pages/control-center/AgentCard.js +156 -0
  38. package/console/dist/ui/pages/control-center/AgentGroup.d.ts +26 -0
  39. package/console/dist/ui/pages/control-center/AgentGroup.js +38 -0
  40. package/console/dist/ui/pages/control-center/ControlCenterPage.js +103 -41
  41. package/console/dist/ui/pages/control-center/EmpathyObserverCostHint.d.ts +28 -0
  42. package/console/dist/ui/pages/control-center/EmpathyObserverCostHint.js +38 -0
  43. package/console/dist/ui/pages/control-center/WorkflowDiagram.d.ts +17 -0
  44. package/console/dist/ui/pages/control-center/WorkflowDiagram.js +55 -0
  45. package/console/dist/ui/pages/debt/DebtPage.js +219 -2
  46. package/console/dist/ui/pages/focus/FocusPage.js +2 -1
  47. package/console/dist/ui/pages/intent/IntentOnboarding.d.ts +67 -0
  48. package/console/dist/ui/pages/intent/IntentOnboarding.js +289 -0
  49. package/console/dist/ui/pages/intent/IntentPage.d.ts +1 -0
  50. package/console/dist/ui/pages/intent/IntentPage.js +258 -0
  51. package/console/dist/ui/pages/pain/PainPage.js +234 -4
  52. package/console/dist/ui/pages/pain/pain-card-helpers.d.ts +75 -0
  53. package/console/dist/ui/pages/pain/pain-card-helpers.js +78 -0
  54. package/console/dist/ui/pages/principles/PrinciplesPage.js +2 -1
  55. package/console/dist/ui/utils/agent-metadata.d.ts +58 -0
  56. package/console/dist/ui/utils/agent-metadata.js +275 -0
  57. package/console/dist/ui/utils/control-center-helpers.d.ts +19 -0
  58. package/console/dist/ui/utils/control-center-helpers.js +37 -0
  59. package/console/dist/ui/utils/validators.d.ts +200 -0
  60. package/console/dist/ui/utils/validators.js +563 -0
  61. package/console/dist/web/assets/app.css +498 -3
  62. package/console/dist/web/assets/app.js +5063 -1418
  63. package/console/package.json +3 -0
  64. package/core/dist/principle-tree-ledger.d.ts +55 -4
  65. package/core/dist/principle-tree-ledger.d.ts.map +1 -1
  66. package/core/dist/principle-tree-ledger.js +472 -13
  67. package/core/dist/principle-tree-ledger.js.map +1 -1
  68. package/core/dist/prompt-builder/__tests__/prompt-builder-core.test.js +58 -0
  69. package/core/dist/prompt-builder/__tests__/prompt-builder-core.test.js.map +1 -1
  70. package/core/dist/prompt-builder/empathy-keyword-matching.d.ts.map +1 -1
  71. package/core/dist/prompt-builder/empathy-keyword-matching.js +9 -6
  72. package/core/dist/prompt-builder/empathy-keyword-matching.js.map +1 -1
  73. package/core/dist/prompt-builder/size-guard.d.ts +1 -0
  74. package/core/dist/prompt-builder/size-guard.d.ts.map +1 -1
  75. package/core/dist/prompt-builder/size-guard.js +21 -0
  76. package/core/dist/prompt-builder/size-guard.js.map +1 -1
  77. package/core/dist/prompt-builder/types.d.ts +2 -0
  78. package/core/dist/prompt-builder/types.d.ts.map +1 -1
  79. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +143 -65
  80. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  81. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +85 -7
  82. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -1
  83. package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.d.ts +2 -0
  84. package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.d.ts.map +1 -0
  85. package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.js +284 -0
  86. package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.js.map +1 -0
  87. package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js +70 -0
  88. package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js.map +1 -1
  89. package/core/dist/runtime-v2/__tests__/golden-trace.test.js +136 -1
  90. package/core/dist/runtime-v2/__tests__/golden-trace.test.js.map +1 -1
  91. package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +105 -0
  92. package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +1 -1
  93. package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js +7 -5
  94. package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -1
  95. package/core/dist/runtime-v2/__tests__/pi-artifact-store.test.js +11 -0
  96. package/core/dist/runtime-v2/__tests__/pi-artifact-store.test.js.map +1 -1
  97. package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js +15 -2
  98. package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js.map +1 -1
  99. package/core/dist/runtime-v2/__tests__/schema-float-precision.test.d.ts +2 -0
  100. package/core/dist/runtime-v2/__tests__/schema-float-precision.test.d.ts.map +1 -0
  101. package/core/dist/runtime-v2/__tests__/schema-float-precision.test.js +290 -0
  102. package/core/dist/runtime-v2/__tests__/schema-float-precision.test.js.map +1 -0
  103. package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.d.ts +2 -0
  104. package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.d.ts.map +1 -0
  105. package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.js +158 -0
  106. package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.js.map +1 -0
  107. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts +2 -0
  108. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts.map +1 -0
  109. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js +211 -0
  110. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js.map +1 -0
  111. package/core/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js +15 -1
  112. package/core/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js.map +1 -1
  113. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.d.ts +2 -0
  114. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.d.ts.map +1 -0
  115. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.js +62 -0
  116. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.js.map +1 -0
  117. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js +12 -2
  118. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js.map +1 -1
  119. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.d.ts +2 -0
  120. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.d.ts.map +1 -0
  121. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.js +56 -0
  122. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.js.map +1 -0
  123. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js +8 -0
  124. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js.map +1 -1
  125. package/core/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js +20 -0
  126. package/core/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js.map +1 -1
  127. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts.map +1 -1
  128. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js +6 -0
  129. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js.map +1 -1
  130. package/core/dist/runtime-v2/activation/sqlite-approval-store.d.ts.map +1 -1
  131. package/core/dist/runtime-v2/activation/sqlite-approval-store.js +86 -32
  132. package/core/dist/runtime-v2/activation/sqlite-approval-store.js.map +1 -1
  133. package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +158 -1
  134. package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -1
  135. package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts +11 -0
  136. package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -1
  137. package/core/dist/runtime-v2/activation/writers/rule-host-writer.js +55 -11
  138. package/core/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
  139. package/core/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js +134 -15
  140. package/core/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js.map +1 -1
  141. package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.d.ts +18 -0
  142. package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.d.ts.map +1 -0
  143. package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.js +251 -0
  144. package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.js.map +1 -0
  145. package/core/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.js +73 -0
  146. package/core/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.js.map +1 -1
  147. package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.d.ts +98 -0
  148. package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.d.ts.map +1 -1
  149. package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.js +131 -0
  150. package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.js.map +1 -1
  151. package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.d.ts +8 -0
  152. package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
  153. package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.js +66 -3
  154. package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.js.map +1 -1
  155. package/core/dist/runtime-v2/diagnostician-output.d.ts +23 -0
  156. package/core/dist/runtime-v2/diagnostician-output.d.ts.map +1 -1
  157. package/core/dist/runtime-v2/diagnostician-output.js +16 -0
  158. package/core/dist/runtime-v2/diagnostician-output.js.map +1 -1
  159. package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts +32 -0
  160. package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts.map +1 -1
  161. package/core/dist/runtime-v2/diagnostician-prompt-builder.js.map +1 -1
  162. package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts +1 -1
  163. package/core/dist/runtime-v2/evidence-triage/source-descriptors.js +1 -1
  164. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +23 -0
  165. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
  166. package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.d.ts +2 -0
  167. package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.d.ts.map +1 -0
  168. package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.js +30 -0
  169. package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.js.map +1 -0
  170. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts +2 -0
  171. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts.map +1 -0
  172. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js +74 -0
  173. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js.map +1 -0
  174. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts +2 -0
  175. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts.map +1 -0
  176. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js +246 -0
  177. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js.map +1 -0
  178. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  179. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +9 -0
  180. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  181. package/core/dist/runtime-v2/feature-flags/index.d.ts +2 -0
  182. package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
  183. package/core/dist/runtime-v2/feature-flags/index.js +2 -0
  184. package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
  185. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -1
  186. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js +0 -9
  187. package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -1
  188. package/{plugin/dist/core/surface-guard.d.ts → core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts} +15 -5
  189. package/core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts.map +1 -0
  190. package/{plugin/dist/core/surface-guard.js → core/dist/runtime-v2/feature-flags/surface-guard-policy.js} +14 -2
  191. package/core/dist/runtime-v2/feature-flags/surface-guard-policy.js.map +1 -0
  192. package/core/dist/runtime-v2/golden-trace-replay-validator.js +1 -1
  193. package/core/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -1
  194. package/core/dist/runtime-v2/golden-trace.d.ts +19 -3
  195. package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
  196. package/core/dist/runtime-v2/golden-trace.js +2 -0
  197. package/core/dist/runtime-v2/golden-trace.js.map +1 -1
  198. package/core/dist/runtime-v2/index.d.ts +21 -4
  199. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  200. package/core/dist/runtime-v2/index.js +21 -3
  201. package/core/dist/runtime-v2/index.js.map +1 -1
  202. package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.d.ts +2 -0
  203. package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.d.ts.map +1 -0
  204. package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.js +185 -0
  205. package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.js.map +1 -0
  206. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts +2 -0
  207. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts.map +1 -0
  208. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js +88 -0
  209. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js.map +1 -0
  210. package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.d.ts +2 -0
  211. package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.d.ts.map +1 -0
  212. package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js +181 -0
  213. package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js.map +1 -0
  214. package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.d.ts +2 -0
  215. package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.d.ts.map +1 -0
  216. package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.js +168 -0
  217. package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.js.map +1 -0
  218. package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.d.ts +2 -0
  219. package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.d.ts.map +1 -0
  220. package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.js +121 -0
  221. package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.js.map +1 -0
  222. package/core/dist/runtime-v2/intent/index.d.ts +8 -0
  223. package/core/dist/runtime-v2/intent/index.d.ts.map +1 -0
  224. package/core/dist/runtime-v2/intent/index.js +8 -0
  225. package/core/dist/runtime-v2/intent/index.js.map +1 -0
  226. package/core/dist/runtime-v2/intent/intent-browser.d.ts +23 -0
  227. package/core/dist/runtime-v2/intent/intent-browser.d.ts.map +1 -0
  228. package/core/dist/runtime-v2/intent/intent-browser.js +21 -0
  229. package/core/dist/runtime-v2/intent/intent-browser.js.map +1 -0
  230. package/core/dist/runtime-v2/intent/intent-decision-record.d.ts +125 -0
  231. package/core/dist/runtime-v2/intent/intent-decision-record.d.ts.map +1 -0
  232. package/core/dist/runtime-v2/intent/intent-decision-record.js +21 -0
  233. package/core/dist/runtime-v2/intent/intent-decision-record.js.map +1 -0
  234. package/core/dist/runtime-v2/intent/intent-doc-reader-port.d.ts +95 -0
  235. package/core/dist/runtime-v2/intent/intent-doc-reader-port.d.ts.map +1 -0
  236. package/core/dist/runtime-v2/intent/intent-doc-reader-port.js +43 -0
  237. package/core/dist/runtime-v2/intent/intent-doc-reader-port.js.map +1 -0
  238. package/core/dist/runtime-v2/intent/intent-doc-version.d.ts +28 -0
  239. package/core/dist/runtime-v2/intent/intent-doc-version.d.ts.map +1 -0
  240. package/core/dist/runtime-v2/intent/intent-doc-version.js +21 -0
  241. package/core/dist/runtime-v2/intent/intent-doc-version.js.map +1 -0
  242. package/core/dist/runtime-v2/intent/intent-doc.d.ts +35 -0
  243. package/core/dist/runtime-v2/intent/intent-doc.d.ts.map +1 -0
  244. package/core/dist/runtime-v2/intent/intent-doc.js +158 -0
  245. package/core/dist/runtime-v2/intent/intent-doc.js.map +1 -0
  246. package/core/dist/runtime-v2/intent/intent-friction-block.d.ts +63 -0
  247. package/core/dist/runtime-v2/intent/intent-friction-block.d.ts.map +1 -0
  248. package/core/dist/runtime-v2/intent/intent-friction-block.js +129 -0
  249. package/core/dist/runtime-v2/intent/intent-friction-block.js.map +1 -0
  250. package/core/dist/runtime-v2/intent/intent-hash.d.ts +2 -0
  251. package/core/dist/runtime-v2/intent/intent-hash.d.ts.map +1 -0
  252. package/core/dist/runtime-v2/intent/intent-hash.js +10 -0
  253. package/core/dist/runtime-v2/intent/intent-hash.js.map +1 -0
  254. package/core/dist/runtime-v2/intent/intent-patch-proposal.d.ts +42 -0
  255. package/core/dist/runtime-v2/intent/intent-patch-proposal.d.ts.map +1 -0
  256. package/core/dist/runtime-v2/intent/intent-patch-proposal.js +81 -0
  257. package/core/dist/runtime-v2/intent/intent-patch-proposal.js.map +1 -0
  258. package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.d.ts +54 -0
  259. package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.d.ts.map +1 -0
  260. package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.js +219 -0
  261. package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.js.map +1 -0
  262. package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +41 -1
  263. package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
  264. package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +130 -2
  265. package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -1
  266. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts +2 -0
  267. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts.map +1 -0
  268. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js +228 -0
  269. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js.map +1 -0
  270. package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +41 -11
  271. package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
  272. package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.d.ts +2 -0
  273. package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.d.ts.map +1 -0
  274. package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js +360 -0
  275. package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js.map +1 -0
  276. package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.d.ts +2 -0
  277. package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.d.ts.map +1 -0
  278. package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.js +333 -0
  279. package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.js.map +1 -0
  280. package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.d.ts +2 -0
  281. package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.d.ts.map +1 -0
  282. package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.js +113 -0
  283. package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.js.map +1 -0
  284. package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js +135 -0
  285. package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js.map +1 -1
  286. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts +2 -0
  287. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts.map +1 -0
  288. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js +449 -0
  289. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js.map +1 -0
  290. package/core/dist/runtime-v2/internalization/adversarial-case.d.ts.map +1 -1
  291. package/core/dist/runtime-v2/internalization/adversarial-case.js +24 -0
  292. package/core/dist/runtime-v2/internalization/adversarial-case.js.map +1 -1
  293. package/core/dist/runtime-v2/internalization/artificer-output.d.ts +10 -0
  294. package/core/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
  295. package/core/dist/runtime-v2/internalization/artificer-output.js +45 -0
  296. package/core/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
  297. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +2 -2
  298. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
  299. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js +7 -2
  300. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
  301. package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts +66 -0
  302. package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts.map +1 -0
  303. package/core/dist/runtime-v2/internalization/behavior-example-pack.js +183 -0
  304. package/core/dist/runtime-v2/internalization/behavior-example-pack.js.map +1 -0
  305. package/core/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts +13 -0
  306. package/core/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts.map +1 -1
  307. package/core/dist/runtime-v2/internalization/diag-rootcause-runner.js +42 -0
  308. package/core/dist/runtime-v2/internalization/diag-rootcause-runner.js.map +1 -1
  309. package/core/dist/runtime-v2/internalization/diag-router-runner.d.ts.map +1 -1
  310. package/core/dist/runtime-v2/internalization/diag-router-runner.js +27 -0
  311. package/core/dist/runtime-v2/internalization/diag-router-runner.js.map +1 -1
  312. package/core/dist/runtime-v2/internalization/evaluator-output.d.ts +8 -0
  313. package/core/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
  314. package/core/dist/runtime-v2/internalization/evaluator-output.js +10 -0
  315. package/core/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
  316. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +17 -0
  317. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
  318. package/core/dist/runtime-v2/internalization/evaluator-runner.js +118 -24
  319. package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
  320. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
  321. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +1 -1
  322. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
  323. package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts +61 -0
  324. package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts.map +1 -0
  325. package/core/dist/runtime-v2/internalization/rule-context-v2.js +301 -0
  326. package/core/dist/runtime-v2/internalization/rule-context-v2.js.map +1 -0
  327. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +9 -0
  328. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
  329. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts +55 -0
  330. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts.map +1 -0
  331. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js +131 -0
  332. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js.map +1 -0
  333. package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
  334. package/core/dist/runtime-v2/pain-signal-observability.js +280 -56
  335. package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
  336. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts +12 -0
  337. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
  338. package/core/dist/runtime-v2/pain-signal-runtime-factory.js +1 -1
  339. package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
  340. package/core/dist/runtime-v2/pain-to-principle-service.d.ts +6 -0
  341. package/core/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
  342. package/core/dist/runtime-v2/pain-to-principle-service.js +2 -0
  343. package/core/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
  344. package/core/dist/runtime-v2/principle-tree/ledger-codec.js.map +1 -1
  345. package/core/dist/runtime-v2/proven-channel-baseline.js +1 -1
  346. package/core/dist/runtime-v2/proven-channel-baseline.js.map +1 -1
  347. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts +2 -0
  348. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts.map +1 -0
  349. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js +95 -0
  350. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js.map +1 -0
  351. package/core/dist/runtime-v2/risk/index.d.ts +7 -0
  352. package/core/dist/runtime-v2/risk/index.d.ts.map +1 -0
  353. package/core/dist/runtime-v2/risk/index.js +6 -0
  354. package/core/dist/runtime-v2/risk/index.js.map +1 -0
  355. package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts +18 -0
  356. package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts.map +1 -0
  357. package/core/dist/runtime-v2/risk/risk-calculator-policy.js +47 -0
  358. package/core/dist/runtime-v2/risk/risk-calculator-policy.js.map +1 -0
  359. package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.d.ts +2 -0
  360. package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.d.ts.map +1 -0
  361. package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.js +55 -0
  362. package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.js.map +1 -0
  363. package/core/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.d.ts.map +1 -1
  364. package/core/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js +6 -0
  365. package/core/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js.map +1 -1
  366. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.d.ts +2 -0
  367. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.d.ts.map +1 -0
  368. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.js +272 -0
  369. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.js.map +1 -0
  370. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts +2 -0
  371. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts.map +1 -0
  372. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js +83 -0
  373. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js.map +1 -0
  374. package/core/dist/runtime-v2/store/intent/index.d.ts +7 -0
  375. package/core/dist/runtime-v2/store/intent/index.d.ts.map +1 -0
  376. package/core/dist/runtime-v2/store/intent/index.js +6 -0
  377. package/core/dist/runtime-v2/store/intent/index.js.map +1 -0
  378. package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.d.ts +51 -0
  379. package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.d.ts.map +1 -0
  380. package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.js +306 -0
  381. package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.js.map +1 -0
  382. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts +28 -0
  383. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts.map +1 -0
  384. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js +88 -0
  385. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js.map +1 -0
  386. package/core/dist/runtime-v2/store/sqlite-connection-pragma.test.js +14 -3
  387. package/core/dist/runtime-v2/store/sqlite-connection-pragma.test.js.map +1 -1
  388. package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.d.ts +2 -0
  389. package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.d.ts.map +1 -0
  390. package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.js +72 -0
  391. package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.js.map +1 -0
  392. package/core/dist/runtime-v2/store/sqlite-connection.d.ts +27 -0
  393. package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
  394. package/core/dist/runtime-v2/store/sqlite-connection.js +138 -12
  395. package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
  396. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts +2 -0
  397. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts.map +1 -0
  398. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js +149 -0
  399. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js.map +1 -0
  400. package/core/dist/runtime-v2/thinking-models/index.d.ts +3 -0
  401. package/core/dist/runtime-v2/thinking-models/index.d.ts.map +1 -0
  402. package/core/dist/runtime-v2/thinking-models/index.js +3 -0
  403. package/core/dist/runtime-v2/thinking-models/index.js.map +1 -0
  404. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts +73 -0
  405. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts.map +1 -0
  406. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js +227 -0
  407. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js.map +1 -0
  408. package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +40 -1
  409. package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +1 -1
  410. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
  411. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js +28 -1
  412. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
  413. package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts +3 -0
  414. package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts.map +1 -1
  415. package/core/dist/runtime-v2/tools/artificer-output-typebox.js +3 -0
  416. package/core/dist/runtime-v2/tools/artificer-output-typebox.js.map +1 -1
  417. package/core/dist/runtime-v2/types/event-payload.d.ts +1 -20
  418. package/core/dist/runtime-v2/types/event-payload.d.ts.map +1 -1
  419. package/core/dist/runtime-v2/types/event-payload.js +0 -12
  420. package/core/dist/runtime-v2/types/event-payload.js.map +1 -1
  421. package/core/dist/runtime-v2/types/event-types.d.ts +5 -34
  422. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  423. package/core/dist/runtime-v2/types/event-types.js +0 -19
  424. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  425. package/core/dist/runtime-v2/types/evidence-chain-contract.d.ts +63 -0
  426. package/core/dist/runtime-v2/types/evidence-chain-contract.d.ts.map +1 -1
  427. package/core/dist/runtime-v2/types/evidence-chain-contract.js +234 -9
  428. package/core/dist/runtime-v2/types/evidence-chain-contract.js.map +1 -1
  429. package/core/dist/runtime-v2/types/index.d.ts +5 -5
  430. package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
  431. package/core/dist/runtime-v2/types/index.js +5 -3
  432. package/core/dist/runtime-v2/types/index.js.map +1 -1
  433. package/core/dist/runtime-v2/types/ledger-store.d.ts +30 -30
  434. package/core/dist/runtime-v2/types/ledger-store.d.ts.map +1 -1
  435. package/core/dist/runtime-v2/types/ledger-store.js +10 -5
  436. package/core/dist/runtime-v2/types/ledger-store.js.map +1 -1
  437. package/core/dist/workflow-funnel-loader.d.ts +2 -2
  438. package/core/dist/workflow-funnel-loader.d.ts.map +1 -1
  439. package/core/package.json +4 -0
  440. package/dist/installer.d.ts.map +1 -1
  441. package/dist/installer.js +16 -0
  442. package/dist/installer.js.map +1 -1
  443. package/package.json +1 -1
  444. package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.d.ts +9 -0
  445. package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.d.ts.map +1 -0
  446. package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js +237 -0
  447. package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js.map +1 -0
  448. package/pd-cli/dist/commands/intent.d.ts +76 -0
  449. package/pd-cli/dist/commands/intent.d.ts.map +1 -0
  450. package/pd-cli/dist/commands/intent.js +411 -0
  451. package/pd-cli/dist/commands/intent.js.map +1 -0
  452. package/pd-cli/dist/commands/runtime-init.d.ts +43 -0
  453. package/pd-cli/dist/commands/runtime-init.d.ts.map +1 -0
  454. package/pd-cli/dist/commands/runtime-init.js +264 -0
  455. package/pd-cli/dist/commands/runtime-init.js.map +1 -0
  456. package/pd-cli/dist/index.js +25 -0
  457. package/pd-cli/dist/index.js.map +1 -1
  458. package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
  459. package/pd-cli/dist/services/demo-story-a-runner.js +6 -0
  460. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  461. package/pd-cli/package.json +1 -0
  462. package/plugin/dist/commands/pain.js +2 -0
  463. package/plugin/dist/core/behavior-example-pack-assembler.d.ts +43 -0
  464. package/plugin/dist/core/behavior-example-pack-assembler.js +247 -0
  465. package/plugin/dist/core/control-ui-db.d.ts +11 -0
  466. package/plugin/dist/core/control-ui-db.js +40 -16
  467. package/plugin/dist/core/event-log.js +0 -5
  468. package/plugin/dist/core/intent-doc-reader-adapter.d.ts +36 -0
  469. package/plugin/dist/core/intent-doc-reader-adapter.js +76 -0
  470. package/plugin/dist/core/intent-doc-reader.d.ts +89 -0
  471. package/plugin/dist/core/intent-doc-reader.js +210 -0
  472. package/plugin/dist/core/principle-tree-ledger.d.ts +27 -79
  473. package/plugin/dist/core/principle-tree-ledger.js +39 -524
  474. package/plugin/dist/core/reflection/reflection-context.d.ts +2 -2
  475. package/plugin/dist/core/rule-context-assembler.d.ts +45 -0
  476. package/plugin/dist/core/rule-context-assembler.js +148 -0
  477. package/plugin/dist/core/thinking-models.d.ts +12 -57
  478. package/plugin/dist/core/thinking-models.js +18 -224
  479. package/plugin/dist/core/trajectory-types.d.ts +18 -0
  480. package/plugin/dist/core/trajectory.d.ts +50 -2
  481. package/plugin/dist/core/trajectory.js +435 -254
  482. package/plugin/dist/core/workspace-context.d.ts +2 -3
  483. package/plugin/dist/hooks/gate.js +59 -2
  484. package/plugin/dist/hooks/pain.js +5 -0
  485. package/plugin/dist/hooks/prompt-helpers.d.ts +19 -1
  486. package/plugin/dist/hooks/prompt-helpers.js +39 -2
  487. package/plugin/dist/hooks/prompt-types.d.ts +8 -0
  488. package/plugin/dist/hooks/prompt.js +81 -21
  489. package/plugin/dist/index.d.ts +3 -1
  490. package/plugin/dist/index.js +10 -6
  491. package/plugin/dist/service/runtime-summary-service.js +1 -1
  492. package/plugin/dist/service/subagent-workflow/workflow-store.d.ts +14 -0
  493. package/plugin/dist/service/subagent-workflow/workflow-store.js +91 -2
  494. package/plugin/dist/types/event-types.d.ts +1 -1
  495. package/plugin/package.json +6 -3
  496. package/plugin/scripts/acceptance-test.mjs +3 -3
  497. package/plugin/dist/core/evolution-migration.d.ts +0 -5
  498. package/plugin/dist/core/evolution-migration.js +0 -65
  499. package/plugin/dist/core/principle-tree-ledger-adapter.d.ts +0 -32
  500. package/plugin/dist/core/principle-tree-ledger-adapter.js +0 -125
  501. package/plugin/dist/core/risk-calculator.d.ts +0 -22
  502. package/plugin/dist/core/risk-calculator.js +0 -88
  503. package/plugin/dist/core/rule-host-helpers.d.ts +0 -8
  504. package/plugin/dist/core/rule-host-helpers.js +0 -7
  505. package/plugin/dist/core/rule-host-types.d.ts +0 -7
  506. package/plugin/dist/core/rule-host-types.js +0 -7
  507. package/plugin/dist/core/schema/db-types.d.ts +0 -11
  508. package/plugin/dist/core/schema/db-types.js +0 -5
  509. package/plugin/dist/core/schema/index.d.ts +0 -17
  510. package/plugin/dist/core/schema/index.js +0 -15
  511. package/plugin/dist/core/schema/migration-runner.d.ts +0 -53
  512. package/plugin/dist/core/schema/migration-runner.js +0 -170
  513. package/plugin/dist/core/schema/migrations/001-init-trajectory.d.ts +0 -6
  514. package/plugin/dist/core/schema/migrations/001-init-trajectory.js +0 -190
  515. package/plugin/dist/core/schema/migrations/002-init-central.d.ts +0 -5
  516. package/plugin/dist/core/schema/migrations/002-init-central.js +0 -108
  517. package/plugin/dist/core/schema/migrations/003-init-workflow.d.ts +0 -5
  518. package/plugin/dist/core/schema/migrations/003-init-workflow.js +0 -50
  519. package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.d.ts +0 -8
  520. package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.js +0 -66
  521. package/plugin/dist/core/schema/migrations/index.d.ts +0 -16
  522. package/plugin/dist/core/schema/migrations/index.js +0 -27
  523. package/plugin/dist/core/schema/schema-definitions.d.ts +0 -46
  524. package/plugin/dist/core/schema/schema-definitions.js +0 -599
  525. package/plugin/dist/service/central-database.d.ts +0 -138
  526. package/plugin/dist/service/central-database.js +0 -731
  527. package/plugin/dist/service/central-sync-service.d.ts +0 -8
  528. package/plugin/dist/service/central-sync-service.js +0 -71
  529. package/plugin/scripts/db-migrate.mjs +0 -170
  530. package/plugin/scripts/validate-live-path.ts +0 -462
@@ -4,6 +4,8 @@
4
4
  * PRI-344: Extracted from PainPage.tsx for testability.
5
5
  * No React dependency, no I/O. All functions are pure.
6
6
  */
7
+ import type { IntentTensionData, IntentDecisionRecordData } from '../../utils/validators.js';
8
+ import type { IntentDecisionInputPayload } from '../../api.js';
7
9
  export type ConfidenceLabel = 'high' | 'mid' | 'low';
8
10
  /**
9
11
  * Map a numeric confidence to a human-readable label.
@@ -33,6 +35,12 @@ export interface Layer2Data {
33
35
  degradedReason: string | null;
34
36
  /** next action guidance */
35
37
  nextAction: string | null;
38
+ /**
39
+ * PRI-469: optional intent tension from the diagnostician artifact.
40
+ * Present only when the record carries a validated intentTension.
41
+ * The UI renders an IntentTensionPanel when this is non-null (SPEC §22.1.2).
42
+ */
43
+ intentTension: IntentTensionData | null;
36
44
  }
37
45
  export interface Layer3Data {
38
46
  id: string;
@@ -72,6 +80,8 @@ export interface RecordData {
72
80
  /** PRI-380: internalization task linkage */
73
81
  internalizationTaskId?: string;
74
82
  dreamerTaskStatus?: string;
83
+ /** PRI-469: optional intent tension from diagnostician artifact (SPEC §16). */
84
+ intentTension?: IntentTensionData;
75
85
  }
76
86
  /**
77
87
  * Build the three-layer card data from a record.
@@ -98,3 +108,68 @@ export declare function buildDebugIdSummary(record: RecordData): string;
98
108
  * string, AND no conclusion/applicability/failureReason/degradedReason.
99
109
  */
100
110
  export declare function isLayer2EffectivelyEmpty(record: RecordData): boolean;
111
+ /**
112
+ * Whether the IntentTensionPanel should render a high-salience decision panel.
113
+ *
114
+ * SPEC §22.1.3: when `source = none`, do NOT render a high-salience decision
115
+ * panel. The tension may still be shown in technical details as "no intent
116
+ * tension", but it must not compete for the Owner's attention.
117
+ *
118
+ * This helper is pure and tested independently of the React component.
119
+ */
120
+ export declare function shouldRenderIntentTensionPanel(tension: IntentTensionData | null | undefined): tension is IntentTensionData;
121
+ /**
122
+ * Whether follow-up actions (precipitate candidate principle, promote to
123
+ * RuleHost, view Intent Patch Proposal) should be visible.
124
+ *
125
+ * SPEC §22.1.4: follow-up actions are NOT the first-layer decision. They only
126
+ * appear after the Owner has confirmed a decision (an IntentDecisionRecord
127
+ * has been persisted for this tension).
128
+ *
129
+ * PRI-470: replaced the PRI-469 stub. Now returns true only when a non-empty
130
+ * decisions array exists — i.e., at least one IntentDecisionRecord has been
131
+ * persisted for this tension.
132
+ */
133
+ export declare function shouldRenderFollowUpActions(decisions?: IntentDecisionRecordData[] | null): boolean;
134
+ /**
135
+ * Context needed to build an IntentDecisionInputPayload from a tension.
136
+ * `id` is a caller-supplied UUID for the decision record. `recordId` is the
137
+ * evidence chain record ID used as a fallback when taskId is not available.
138
+ * `painId` and `intentDocHash` are optional.
139
+ */
140
+ export interface IntentDecisionContext {
141
+ id: string;
142
+ recordId: string;
143
+ painId?: string;
144
+ taskId?: string;
145
+ intentDocHash?: string;
146
+ }
147
+ /**
148
+ * The Owner's decision on an intent tension. `ownerAction` overrides
149
+ * `tension.suggestedOwnerAction` — the Owner may choose a different action
150
+ * than the one PD suggested. `note` is an optional trimmed annotation.
151
+ */
152
+ export interface IntentDecisionChoice {
153
+ ownerAction: string;
154
+ note?: string;
155
+ }
156
+ /**
157
+ * Build an IntentDecisionInputPayload from an IntentTension and the Owner's
158
+ * chosen action. The payload is sent to POST /api/v1/intent-decisions.
159
+ *
160
+ * - `id` is the caller-supplied decision UUID (P0 fix: server requires this).
161
+ * - `taskId` falls back to `recordId` when not provided.
162
+ * - Optional fields (painId, intentDocHash, note) are omitted when empty.
163
+ * - `note` is trimmed before being included.
164
+ * - `evidenceRefs` is passed through as-is; truncation is the backend's job
165
+ * (the frontend must not silently drop evidence the Owner might rely on).
166
+ * - `ownerAction` overrides `tension.suggestedOwnerAction` — the Owner may
167
+ * choose a different action than the one PD suggested.
168
+ *
169
+ * P0 fix (PRI-471): the previous payload used `evidence` + `explanation` +
170
+ * `suggestedAction` and omitted `id`, which did not match the server's
171
+ * `IntentDecisionInput` contract (SPEC §21.7). The server requires `id` and
172
+ * `evidenceRefs`, and does not accept `explanation` or `suggestedAction` —
173
+ * those are snapshot fields the server persists from the tension, not inputs.
174
+ */
175
+ export declare function buildIntentDecisionPayload(tension: IntentTensionData, context: IntentDecisionContext, choice: IntentDecisionChoice): IntentDecisionInputPayload;
@@ -37,6 +37,8 @@ export function buildCardLayers(record) {
37
37
  failureReason: record.failureReason ?? null,
38
38
  degradedReason: record.degradedReason ?? null,
39
39
  nextAction: record.nextAction ?? null,
40
+ // PRI-469: pass intentTension through to Layer 2 for the IntentTensionPanel.
41
+ intentTension: record.intentTension ?? null,
40
42
  };
41
43
  const layer3 = {
42
44
  id: record.id,
@@ -101,3 +103,79 @@ export function isLayer2EffectivelyEmpty(record) {
101
103
  return true;
102
104
  return false;
103
105
  }
106
+ // ── PRI-469: Intent Tension panel rendering helpers (SPEC §22.1) ─────────────
107
+ /**
108
+ * Whether the IntentTensionPanel should render a high-salience decision panel.
109
+ *
110
+ * SPEC §22.1.3: when `source = none`, do NOT render a high-salience decision
111
+ * panel. The tension may still be shown in technical details as "no intent
112
+ * tension", but it must not compete for the Owner's attention.
113
+ *
114
+ * This helper is pure and tested independently of the React component.
115
+ */
116
+ export function shouldRenderIntentTensionPanel(tension) {
117
+ if (!tension)
118
+ return false;
119
+ // source='none' means no tension detected — suppress the high-salience panel.
120
+ if (tension.source === 'none')
121
+ return false;
122
+ return true;
123
+ }
124
+ /**
125
+ * Whether follow-up actions (precipitate candidate principle, promote to
126
+ * RuleHost, view Intent Patch Proposal) should be visible.
127
+ *
128
+ * SPEC §22.1.4: follow-up actions are NOT the first-layer decision. They only
129
+ * appear after the Owner has confirmed a decision (an IntentDecisionRecord
130
+ * has been persisted for this tension).
131
+ *
132
+ * PRI-470: replaced the PRI-469 stub. Now returns true only when a non-empty
133
+ * decisions array exists — i.e., at least one IntentDecisionRecord has been
134
+ * persisted for this tension.
135
+ */
136
+ export function shouldRenderFollowUpActions(decisions) {
137
+ if (!Array.isArray(decisions))
138
+ return false;
139
+ return decisions.length > 0;
140
+ }
141
+ /**
142
+ * Build an IntentDecisionInputPayload from an IntentTension and the Owner's
143
+ * chosen action. The payload is sent to POST /api/v1/intent-decisions.
144
+ *
145
+ * - `id` is the caller-supplied decision UUID (P0 fix: server requires this).
146
+ * - `taskId` falls back to `recordId` when not provided.
147
+ * - Optional fields (painId, intentDocHash, note) are omitted when empty.
148
+ * - `note` is trimmed before being included.
149
+ * - `evidenceRefs` is passed through as-is; truncation is the backend's job
150
+ * (the frontend must not silently drop evidence the Owner might rely on).
151
+ * - `ownerAction` overrides `tension.suggestedOwnerAction` — the Owner may
152
+ * choose a different action than the one PD suggested.
153
+ *
154
+ * P0 fix (PRI-471): the previous payload used `evidence` + `explanation` +
155
+ * `suggestedAction` and omitted `id`, which did not match the server's
156
+ * `IntentDecisionInput` contract (SPEC §21.7). The server requires `id` and
157
+ * `evidenceRefs`, and does not accept `explanation` or `suggestedAction` —
158
+ * those are snapshot fields the server persists from the tension, not inputs.
159
+ */
160
+ export function buildIntentDecisionPayload(tension, context, choice) {
161
+ const { ownerAction, note } = choice;
162
+ const payload = {
163
+ id: context.id,
164
+ taskId: context.taskId ?? context.recordId,
165
+ source: tension.source,
166
+ evidenceStrength: tension.evidenceStrength,
167
+ relatedIntentFields: tension.relatedIntentFields,
168
+ evidenceRefs: tension.evidence,
169
+ ownerAction,
170
+ };
171
+ if (context.painId !== undefined && context.painId.length > 0) {
172
+ payload.painId = context.painId;
173
+ }
174
+ if (context.intentDocHash !== undefined && context.intentDocHash.length > 0) {
175
+ payload.intentDocHash = context.intentDocHash;
176
+ }
177
+ if (note !== undefined && note.trim().length > 0) {
178
+ payload.note = note.trim();
179
+ }
180
+ return payload;
181
+ }
@@ -6,6 +6,7 @@ import { PageShell } from "../../components/layout/page-shell.js";
6
6
  import { SectionTitle } from "../../components/layout/section-title.js";
7
7
  import { Button } from "../../components/ui/button.js";
8
8
  import { Skeleton } from "../../components/ui/skeleton.js";
9
+ import { ShinyText } from "../../components/ui/shiny-text.js";
9
10
  import { fetchPrinciples, fetchApprovalsGrouped, } from "../../api.js";
10
11
  import { enumLabel } from "../../utils/enum-labels.js";
11
12
  // ── Map principle status to review status ───────────────────────────────────
@@ -215,7 +216,7 @@ export function PrinciplesPage() {
215
216
  { value: "rejected", label: t("principles.statusRejected") },
216
217
  { value: "parked", label: t("principles.statusParked") },
217
218
  ];
218
- return (_jsxs(PageShell, { children: [_jsx(SectionTitle, { children: t("principles.reviewTitle") }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: t("principles.reviewSubtitle") }), _jsx("p", { className: "text-ink-3 text-[14px] leading-relaxed mb-6", children: t("principles.reviewDescription") }), _jsxs("div", { className: "flex flex-wrap items-center gap-3 mb-6", children: [_jsxs("div", { className: "flex gap-1", role: "group", "aria-label": "Filter mode", children: [_jsxs("button", { onClick: () => setFilterMode('actionable'), className: "font-mono text-[11px] uppercase tracking-[0.02em] border rounded-[2px] px-2 py-1 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gov " +
219
+ return (_jsxs(PageShell, { children: [_jsx(SectionTitle, { children: t("principles.reviewTitle") }), _jsx(ShinyText, { as: "h1", className: "text-[29px] font-semibold tracking-tight text-ink mb-2", duration: 4.5, brightness: 0.5, disabled: !(filterMode === 'actionable' && (categories?.owner_actionable ?? 0) > 0), children: t("principles.reviewSubtitle") }), _jsx("p", { className: "text-ink-3 text-[14px] leading-relaxed mb-6", children: t("principles.reviewDescription") }), _jsxs("div", { className: "flex flex-wrap items-center gap-3 mb-6", children: [_jsxs("div", { className: "flex gap-1", role: "group", "aria-label": "Filter mode", children: [_jsxs("button", { onClick: () => setFilterMode('actionable'), className: "font-mono text-[11px] uppercase tracking-[0.02em] border rounded-[2px] px-2 py-1 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gov " +
219
220
  (filterMode === 'actionable'
220
221
  ? "bg-gov text-paper border-gov"
221
222
  : "bg-surface text-ink-3 border-line hover:border-line-2"), children: [t("principles.filterActionable", { defaultValue: "Actionable" }), categories?.owner_actionable ? ` (${categories.owner_actionable})` : ''] }), _jsxs("button", { onClick: () => setFilterMode('all'), className: "font-mono text-[11px] uppercase tracking-[0.02em] border rounded-[2px] px-2 py-1 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-gov " +
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Agent Metadata — Control Center agent grouping & role descriptions
3
+ *
4
+ * Pure data module (no React, no I/O). Defines:
5
+ * - Which dependency cluster each of the 9 internal agents belongs to
6
+ * - Bilingual role / detail / impact / tech-detail text for progressive disclosure
7
+ * - Whether toggling the agent off requires inline confirmation (isCore)
8
+ *
9
+ * Content source: design-prototype/control-center.html (approved prototype).
10
+ * Agent names match INTERNAL_AGENT_NAMES from @principles/core (camelCase).
11
+ *
12
+ * ERR entries:
13
+ * - rc-1: pure static data, no untrusted input
14
+ * - rc-2: no `as` bypasses
15
+ * - rc-5: consumers use Object.hasOwn() to look up metadata by agent name
16
+ */
17
+ import type { InternalAgentName } from '@principles/core/runtime-v2';
18
+ export type AgentGroup = 'core_trio' | 'code_chain' | 'quality_polish' | 'sidechain';
19
+ export type ImpactLevel = 'danger' | 'amber' | 'green';
20
+ export type GroupTag = 'must' | 'recommend' | 'optional' | 'independent';
21
+ export interface AgentMeta {
22
+ name: InternalAgentName;
23
+ group: AgentGroup;
24
+ /** 中文角色名(如"诊断师") */
25
+ displayNameZh: string;
26
+ displayNameEn: string;
27
+ /** 一句话角色(L1 折叠态显示) */
28
+ roleZh: string;
29
+ roleEn: string;
30
+ /** 展开后的详细说明(L2),段落用 \n\n 分隔 */
31
+ detailZh: string;
32
+ detailEn: string;
33
+ /** 关掉会怎样(L2 impact box) */
34
+ impactLevel: ImpactLevel;
35
+ impactZh: string;
36
+ impactEn: string;
37
+ /** 技术细节(L3 嵌套折叠)— 键为标签,值可含反引号包裹的 code 片段 */
38
+ techDetailZh: Record<string, string>;
39
+ techDetailEn: Record<string, string>;
40
+ /** 是否核心代理(关掉需 inline confirm)。true 对应原型 data-core="true" */
41
+ isCore: boolean;
42
+ /** MVP 状态说明(可选,仅 philosopher/rolloutReviewer 有) */
43
+ mvpNoteZh?: string;
44
+ mvpNoteEn?: string;
45
+ }
46
+ export interface AgentGroupMeta {
47
+ id: AgentGroup;
48
+ labelZh: string;
49
+ labelEn: string;
50
+ tag: GroupTag;
51
+ tagLabelZh: string;
52
+ tagLabelEn: string;
53
+ hintZh: string;
54
+ hintEn: string;
55
+ }
56
+ export declare const GROUP_ORDER: AgentGroup[];
57
+ export declare const AGENT_GROUPS: AgentGroupMeta[];
58
+ export declare const AGENT_METADATA: Record<InternalAgentName, AgentMeta>;
@@ -0,0 +1,275 @@
1
+ /**
2
+ * Agent Metadata — Control Center agent grouping & role descriptions
3
+ *
4
+ * Pure data module (no React, no I/O). Defines:
5
+ * - Which dependency cluster each of the 9 internal agents belongs to
6
+ * - Bilingual role / detail / impact / tech-detail text for progressive disclosure
7
+ * - Whether toggling the agent off requires inline confirmation (isCore)
8
+ *
9
+ * Content source: design-prototype/control-center.html (approved prototype).
10
+ * Agent names match INTERNAL_AGENT_NAMES from @principles/core (camelCase).
11
+ *
12
+ * ERR entries:
13
+ * - rc-1: pure static data, no untrusted input
14
+ * - rc-2: no `as` bypasses
15
+ * - rc-5: consumers use Object.hasOwn() to look up metadata by agent name
16
+ */
17
+ // ── Group order (matches render order on the page) ───────────────────────────
18
+ export const GROUP_ORDER = [
19
+ 'core_trio',
20
+ 'code_chain',
21
+ 'quality_polish',
22
+ 'sidechain',
23
+ ];
24
+ // ── Group metadata ───────────────────────────────────────────────────────────
25
+ export const AGENT_GROUPS = [
26
+ {
27
+ id: 'core_trio',
28
+ labelZh: '核心三件套',
29
+ labelEn: 'Core Trio',
30
+ tag: 'must',
31
+ tagLabelZh: '必须一起开',
32
+ tagLabelEn: 'Must together',
33
+ hintZh: '关掉任何一个,PD 都无法把错误转化为原则',
34
+ hintEn: 'Disabling any one breaks the error-to-principle pipeline',
35
+ },
36
+ {
37
+ id: 'code_chain',
38
+ labelZh: '代码实现链',
39
+ labelEn: 'Code Chain',
40
+ tag: 'recommend',
41
+ tagLabelZh: '推荐一起开',
42
+ tagLabelEn: 'Recommend together',
43
+ hintZh: '只开 artificer 会降级为纯提示通道;只开 evaluator 无意义',
44
+ hintEn: 'Only artificer degrades to prompt-only; only evaluator is meaningless',
45
+ },
46
+ {
47
+ id: 'quality_polish',
48
+ labelZh: '质量打磨',
49
+ labelEn: 'Quality Polish',
50
+ tag: 'optional',
51
+ tagLabelZh: '可选 · 单独开关',
52
+ tagLabelEn: 'Optional · toggle individually',
53
+ hintZh: '让原则更精炼,关掉也能用,只是质量略粗',
54
+ hintEn: 'Refines principles; disabling is fine, just slightly rougher quality',
55
+ },
56
+ {
57
+ id: 'sidechain',
58
+ labelZh: '侧链服务',
59
+ labelEn: 'Sidechain',
60
+ tag: 'independent',
61
+ tagLabelZh: '独立 · 单独开关',
62
+ tagLabelEn: 'Independent · toggle individually',
63
+ hintZh: '不影响主管道,只影响 pain 信号检测精度',
64
+ hintEn: 'Does not affect the main pipeline; only pain signal detection precision',
65
+ },
66
+ ];
67
+ // ── Agent metadata (covers all 9 INTERNAL_AGENT_NAMES) ───────────────────────
68
+ export const AGENT_METADATA = {
69
+ diagnostician: {
70
+ name: 'diagnostician',
71
+ group: 'core_trio',
72
+ displayNameZh: '诊断师',
73
+ displayNameEn: 'Diagnostician',
74
+ roleZh: '问"为什么会出错",找到根本原因',
75
+ roleEn: 'Asks "why did it go wrong" and finds the root cause',
76
+ detailZh: '当 Agent 做错了什么,诊断师负责像事故复盘一样追问"为什么",找到根本原因,而不是只记下"出错了"。然后把原因抽象成一条原则候选。\n\n它其实是 3 个子阶段串联:找根因 → 抽象原则 → 决定怎么处理。',
77
+ detailEn: 'When an Agent makes a mistake, the Diagnostician runs a post-mortem asking "why" to find the root cause — not just recording "it failed". It then abstracts the cause into a principle candidate.\n\nIt is actually 3 sub-stages chained: find root cause → abstract principle → decide how to handle.',
78
+ impactLevel: 'danger',
79
+ impactZh: 'Pain 信号无法进入内化管道。诊断是入口,关掉后整个流程瘫痪,无法生成新的原则候选。',
80
+ impactEn: 'Pain signals cannot enter the internalization pipeline. Diagnosis is the entry point; disabling paralyzes the entire flow — no new principle candidates can be generated.',
81
+ techDetailZh: {
82
+ '输入': '`DiagnosticianContextPayload`(pain 信号上下文)',
83
+ '输出': '`DiagnosticianOutputV1` · rootCause / violatedPrinciples / recommendations[] / confidence',
84
+ '编排': '由 `PainSignalBridge` 触发;`diagnostician_split_pipeline` flag 控制单体 vs 3 段拆分',
85
+ '阶段': '`diag_rootcause` → `diag_distiller` → `diag_router`',
86
+ },
87
+ techDetailEn: {
88
+ 'Input': '`DiagnosticianContextPayload` (pain signal context)',
89
+ 'Output': '`DiagnosticianOutputV1` · rootCause / violatedPrinciples / recommendations[] / confidence',
90
+ 'Orchestration': 'Triggered by `PainSignalBridge`; `diagnostician_split_pipeline` flag controls monolithic vs 3-stage split',
91
+ 'Stages': '`diag_rootcause` → `diag_distiller` → `diag_router`',
92
+ },
93
+ isCore: true,
94
+ },
95
+ dreamer: {
96
+ name: 'dreamer',
97
+ group: 'core_trio',
98
+ displayNameZh: '梦想家',
99
+ displayNameEn: 'Dreamer',
100
+ roleZh: '想出 2-3 种不同的纠正方案',
101
+ roleEn: 'Proposes 2-3 distinct correction options',
102
+ detailZh: '诊断完成后,梦想家从不同角度提出多个纠正方案——就像 brainstorming,先发散再收敛。每个方案都包含"当时做错了什么 / 应该怎么做 / 为什么"。\n\n它是内化引擎的第一站,接收诊断产物,输出候选方案。',
103
+ detailEn: 'After diagnosis, the Dreamer proposes multiple correction options from different angles — like brainstorming, diverge first then converge. Each option includes "what went wrong / what should be done / why".\n\nIt is the first stop of the internalization engine, receiving diagnosis output and producing candidates.',
104
+ impactLevel: 'danger',
105
+ impactZh: '内化引擎失去入口。Dreamer 是链首,关掉后无候选方案生成,内化瘫痪。',
106
+ impactEn: 'The internalization engine loses its entry point. Dreamer is the chain head; disabling means no candidates are generated — internalization is paralyzed.',
107
+ techDetailZh: {
108
+ '输入': '诊断阶段的 distilled principle / candidate artifact',
109
+ '输出': '`DreamerOutput` · 1-5 个候选,每个含 badDecision / betterDecision / riskLevel / strategicPerspective',
110
+ '注意': '`InternalizationAutoConsumerService` 当前仅自动消费 dreamer,下游需手动触发',
111
+ },
112
+ techDetailEn: {
113
+ 'Input': 'Distilled principle / candidate artifact from the diagnosis stage',
114
+ 'Output': '`DreamerOutput` · 1-5 candidates, each with badDecision / betterDecision / riskLevel / strategicPerspective',
115
+ 'Note': '`InternalizationAutoConsumerService` currently only auto-consumes dreamer; downstream must be triggered manually',
116
+ },
117
+ isCore: true,
118
+ },
119
+ scribe: {
120
+ name: 'scribe',
121
+ group: 'core_trio',
122
+ displayNameZh: '抄写员',
123
+ displayNameEn: 'Scribe',
124
+ roleZh: '把方案写成正式的原则条文',
125
+ roleEn: 'Writes the chosen option into a formal principle statement',
126
+ detailZh: '梦想家给出多个方案后,抄写员负责把选中的方案转写成清晰、可执行的原则条文——就像把会议纪要整理成正式文档。\n\n这条原则文本是后续所有工作的承载者:评估员会反向溯源到这里做质量校验。',
127
+ detailEn: 'After the Dreamer proposes multiple options, the Scribe transforms the selected one into a clear, executable principle statement — like turning meeting notes into a formal document.\n\nThis principle text is the carrier for all downstream work: the Evaluator traces back here for quality checks.',
128
+ impactLevel: 'danger',
129
+ impactZh: '无原则文本产出。Scribe 是原则承载者,关掉后管道断裂,核心瘫痪。',
130
+ impactEn: 'No principle text is produced. Scribe is the principle carrier; disabling breaks the pipeline — core is paralyzed.',
131
+ techDetailZh: {
132
+ '输入': 'Philosopher artifact(或 dreamer 直连)',
133
+ '输出': '`ScribeOutputV1` · principleDraft + sourcePhilosopherArtifactId(lineage 强制校验)',
134
+ '语言': '支持 Owner 偏好语言(`outputLanguage`,PRI-336)',
135
+ },
136
+ techDetailEn: {
137
+ 'Input': 'Philosopher artifact (or direct from dreamer)',
138
+ 'Output': '`ScribeOutputV1` · principleDraft + sourcePhilosopherArtifactId (lineage enforced)',
139
+ 'Language': 'Supports Owner preferred language (`outputLanguage`, PRI-336)',
140
+ },
141
+ isCore: true,
142
+ },
143
+ artificer: {
144
+ name: 'artificer',
145
+ group: 'code_chain',
146
+ displayNameZh: '工匠',
147
+ displayNameEn: 'Artificer',
148
+ roleZh: '把原则变成可执行的拦截代码',
149
+ roleEn: 'Turns the principle into executable interception code',
150
+ detailZh: '原则写好后,工匠负责把它变成代码——一个 `evaluate()` 函数,会在 Agent 发起工具调用时拦截检查。这比"提示词"更刚性、更可靠。\n\n同时生成 golden trace 测试用例,确保代码行为符合预期。',
151
+ detailEn: 'Once the principle is written, the Artificer turns it into code — an `evaluate()` function that intercepts and checks Agent tool calls. This is more rigid and reliable than "prompt wording".\n\nIt also generates golden trace test cases to ensure the code behaves as intended.',
152
+ impactLevel: 'amber',
153
+ impactZh: '降级运行。退回纯 prompt 通道,principle 文本仍可内化,但无 RuleHost 实现代码。',
154
+ impactEn: 'Degraded mode. Falls back to prompt-only channel; principle text can still be internalized, but no RuleHost implementation code.',
155
+ techDetailZh: {
156
+ '输入': 'Scribe artifact(principleDraft)',
157
+ '输出': '`ArtificerRuleOutput` · implementationCode + goldenTraceCases + affectedTools',
158
+ '信任边界': 'activation-capable,LLM 输出作 `unknown` 处理,validateOutput + lineage 通过才 commit',
159
+ 'L2 模式': '`rulehost-code-generation` flag 开启 write-test-fix 循环(沙盒回放 → 重试,最多 3 次)',
160
+ },
161
+ techDetailEn: {
162
+ 'Input': 'Scribe artifact (principleDraft)',
163
+ 'Output': '`ArtificerRuleOutput` · implementationCode + goldenTraceCases + affectedTools',
164
+ 'Trust boundary': 'activation-capable; LLM output treated as `unknown`; commit only after validateOutput + lineage pass',
165
+ 'L2 mode': '`rulehost-code-generation` flag enables write-test-fix loop (sandbox replay → retry, max 3)',
166
+ },
167
+ isCore: true,
168
+ },
169
+ evaluator: {
170
+ name: 'evaluator',
171
+ group: 'code_chain',
172
+ displayNameZh: '评估员',
173
+ displayNameEn: 'Evaluator',
174
+ roleZh: '审查原则和代码质量,决定能否生效',
175
+ roleEn: 'Reviews principle & code quality, decides whether it can activate',
176
+ detailZh: '工匠写完代码后,评估员做质量审查:原则是否清晰?代码是否符合原则意图?有没有覆盖足够多的场景?\n\n给出 approved / needs_revision / rejected 决策。只有 approved 的原则才能通过 RuleHost 通道激活。',
177
+ detailEn: 'After the Artificer writes the code, the Evaluator does a quality review: is the principle clear? Does the code match the principle intent? Does it cover enough scenarios?\n\nIt returns an approved / needs_revision / rejected decision. Only approved principles can activate via the RuleHost channel.',
178
+ impactLevel: 'amber',
179
+ impactZh: '降级运行。Principle 仍写入,但无 validated 标记,RuleHost 通道无法激活。',
180
+ impactEn: 'Degraded mode. Principle is still written, but without the validated mark — RuleHost channel cannot activate.',
181
+ techDetailZh: {
182
+ '输入': 'Artificer artifact + Scribe artifact(反向溯源 principle 文本)',
183
+ '输出': '`EvaluatorOutputV1/V2` · decision + score + strengths/concerns + codeReview',
184
+ 'V2 模式': '运行 adversarial sandbox replay,通过则持久化 `artifactKind: "rule"` artifact',
185
+ },
186
+ techDetailEn: {
187
+ 'Input': 'Artificer artifact + Scribe artifact (reverse-traces principle text)',
188
+ 'Output': '`EvaluatorOutputV1/V2` · decision + score + strengths/concerns + codeReview',
189
+ 'V2 mode': 'Runs adversarial sandbox replay; on pass, persists `artifactKind: "rule"` artifact',
190
+ },
191
+ isCore: true,
192
+ },
193
+ philosopher: {
194
+ name: 'philosopher',
195
+ group: 'quality_polish',
196
+ displayNameZh: '哲学家',
197
+ displayNameEn: 'Philosopher',
198
+ roleZh: '从多个方案中选出最优并精炼',
199
+ roleEn: 'Selects the best option from multiple candidates and refines it',
200
+ detailZh: '梦想家给出多个方案后,哲学家负责收敛——选出最优的一个,精炼成单一原则候选。\n\n关掉它,梦想家的产出会直接交给抄写员,原则可能略粗糙,但人工审批时仍可修改。',
201
+ detailEn: 'After the Dreamer proposes multiple options, the Philosopher converges — selects the best one and refines it into a single principle candidate.\n\nDisabling it means the Dreamer output goes directly to the Scribe; principles may be slightly rougher, but can still be edited during Owner review.',
202
+ impactLevel: 'green',
203
+ impactZh: '无影响。Dreamer 产出直接给 Scribe,质量略粗但人工审批可纠正。属设计预期。',
204
+ impactEn: 'No impact. Dreamer output goes directly to Scribe; slightly rougher quality but Owner review can correct. This is by design.',
205
+ techDetailZh: {
206
+ 'MVP 状态': 'MVP-Quiet(ADR-0014 §2.5)。默认关闭,代码保留。',
207
+ '输出': '`PhilosopherOutputV1` · principleCandidate + sourceDreamerArtifactId',
208
+ },
209
+ techDetailEn: {
210
+ 'MVP status': 'MVP-Quiet (ADR-0014 §2.5). Off by default; code retained.',
211
+ 'Output': '`PhilosopherOutputV1` · principleCandidate + sourceDreamerArtifactId',
212
+ },
213
+ isCore: false,
214
+ mvpNoteZh: 'MVP-Quiet(ADR-0014 §2.5)。默认关闭,代码保留。',
215
+ mvpNoteEn: 'MVP-Quiet (ADR-0014 §2.5). Off by default; code retained.',
216
+ },
217
+ rolloutReviewer: {
218
+ name: 'rolloutReviewer',
219
+ group: 'quality_polish',
220
+ displayNameZh: '上线评审员',
221
+ displayNameEn: 'Rollout Reviewer',
222
+ roleZh: '原则生效前的最后一道审查',
223
+ roleEn: 'Final review before a principle goes live',
224
+ detailZh: '评估员通过后,上线评审员做最终把关——评估上线风险、安全检查,决定是否真的推向 rollout。\n\n它本就是 MVP-Quiet 默认关闭的,关掉不影响任何功能。',
225
+ detailEn: 'After the Evaluator passes, the Rollout Reviewer does the final gate — assessing rollout risks and safety checks, deciding whether to actually push to rollout.\n\nIt is already MVP-Quiet (off by default); disabling does not affect any functionality.',
226
+ impactLevel: 'green',
227
+ impactZh: '无影响。本就是 MVP-Quiet 默认关闭。',
228
+ impactEn: 'No impact. Already MVP-Quiet (off by default).',
229
+ techDetailZh: {
230
+ 'MVP 状态': 'MVP-Quiet。不在 `MVP_CORE_TASK_KINDS` 白名单中。',
231
+ '输出': '`RolloutReviewerOutputV1` · approve_rollout / needs_revision / reject + rolloutRisks + safetyChecks',
232
+ '实现': '唯一不继承 `BasePeerRunner` 的 peer runner',
233
+ },
234
+ techDetailEn: {
235
+ 'MVP status': 'MVP-Quiet. Not in the `MVP_CORE_TASK_KINDS` whitelist.',
236
+ 'Output': '`RolloutReviewerOutputV1` · approve_rollout / needs_revision / reject + rolloutRisks + safetyChecks',
237
+ 'Implementation': 'The only peer runner that does not extend `BasePeerRunner`',
238
+ },
239
+ isCore: false,
240
+ mvpNoteZh: 'MVP-Quiet。不在 MVP_CORE_TASK_KINDS 白名单中。',
241
+ mvpNoteEn: 'MVP-Quiet. Not in the MVP_CORE_TASK_KINDS whitelist.',
242
+ },
243
+ correctionObserver: {
244
+ name: 'correctionObserver',
245
+ group: 'sidechain',
246
+ displayNameZh: '纠正观察员',
247
+ displayNameEn: 'Correction Observer',
248
+ roleZh: '后台优化"纠错关键词",减少误报',
249
+ roleEn: 'Background optimizer for "correction keywords", reducing false positives',
250
+ detailZh: 'PD 用一组关键词检测 Agent 是否在被纠正。但关键词会过时或误报。纠正观察员定期审查历史,自动调整关键词权重,衰减误报。\n\n它在后台每 15 分钟跑一次,不影响主管道。',
251
+ detailEn: 'PD uses a set of keywords to detect whether an Agent is being corrected. But keywords go stale or produce false positives. The Correction Observer periodically reviews history, auto-adjusting keyword weights and decaying false positives.\n\nIt runs in the background every 15 minutes and does not affect the main pipeline.',
252
+ impactLevel: 'amber',
253
+ impactZh: '纠错关键词停止自优化。确定性 pain 检测仍工作,但误报会逐步累积。',
254
+ impactEn: 'Correction keywords stop self-optimizing. Deterministic pain detection still works, but false positives gradually accumulate.',
255
+ techDetailZh: {},
256
+ techDetailEn: {},
257
+ isCore: true,
258
+ },
259
+ empathyObserver: {
260
+ name: 'empathyObserver',
261
+ group: 'sidechain',
262
+ displayNameZh: '共情观察员',
263
+ displayNameEn: 'Empathy Observer',
264
+ roleZh: '从用户语气中捕捉传统检测漏掉的挫败感',
265
+ roleEn: 'Catches frustration that traditional detection misses',
266
+ detailZh: '传统 pain 检测只能抓"命令失败""抛异常"这类硬错误。但用户说"又来了""怎么还是这样"时,其实已经很不满意了——这种情感摩擦硬检测抓不到。\n\n共情观察员用语义分析实时捕捉这类信号,弥补检测盲区。',
267
+ detailEn: 'Traditional pain detection only catches hard errors like "command failed" or "exception thrown". But when a user says "here we go again" or "why is this still happening", they are already frustrated — this emotional friction is invisible to hard detection.\n\nThe Empathy Observer uses semantic analysis to catch these signals in real time, covering the detection blind spot.',
268
+ impactLevel: 'amber',
269
+ impactZh: '退回纯确定性 pain 检测。常规对话下 pain 触发稀疏,内化速度显著下降。',
270
+ impactEn: 'Falls back to deterministic-only pain detection. In normal conversation, pain triggers become sparse — internalization speed drops significantly.',
271
+ techDetailZh: {},
272
+ techDetailEn: {},
273
+ isCore: true,
274
+ },
275
+ };
@@ -13,6 +13,7 @@
13
13
  * - ERR-045: ANY-segment redaction for sensitive keys
14
14
  */
15
15
  import type { ReadinessStatus } from '../api.js';
16
+ import { AGENT_METADATA, type AgentGroup } from './agent-metadata.js';
16
17
  export interface RedactedRuntimeProfileSummary {
17
18
  id: string;
18
19
  type: string;
@@ -57,4 +58,22 @@ export declare function getReadinessBadgeVariant(readiness: ReadinessStatus): 'd
57
58
  export declare function getReadinessLabel(readiness: ReadinessStatus): string;
58
59
  export declare function computeOverallReadiness(diag: ControlCenterDiagnostics): ReadinessStatus;
59
60
  export declare function groupAgentsByReadiness(diag: ControlCenterDiagnostics): Record<ReadinessStatus, RedactedAgentSummary[]>;
61
+ export type AgentDependencyGroups = Record<AgentGroup, RedactedAgentSummary[]>;
62
+ /**
63
+ * Type guard: is `name` a known internal agent with metadata?
64
+ * Replaces `as keyof typeof AGENT_METADATA` (rc-2: no `as` bypass).
65
+ */
66
+ export declare function isKnownAgentName(name: string): name is keyof typeof AGENT_METADATA;
67
+ /**
68
+ * Group agents by dependency cluster (core_trio / code_chain / quality_polish / sidechain).
69
+ * Agents not found in AGENT_METADATA go to the `unknown` bucket for fail-loud
70
+ * handling by the caller (rc-5: Object.hasOwn lookup; rc-9: no silent fallback).
71
+ *
72
+ * Group insertion order matches GROUP_ORDER (core_trio → code_chain → quality_polish → sidechain),
73
+ * so Object.keys(groups) returns the render order.
74
+ */
75
+ export declare function groupAgentsByDependency(agents: RedactedAgentSummary[]): {
76
+ groups: AgentDependencyGroups;
77
+ unknown: RedactedAgentSummary[];
78
+ };
60
79
  export declare function redactDiagnosticsForCopy(diag: ControlCenterDiagnostics): string;
@@ -12,6 +12,7 @@
12
12
  * - ERR-014/ERR-016/ERR-017: Safe serialization for diagnostics copy
13
13
  * - ERR-045: ANY-segment redaction for sensitive keys
14
14
  */
15
+ import { AGENT_METADATA } from './agent-metadata.js';
15
16
  // ── Readiness Badge Variant ──────────────────────────────────────────────────
16
17
  export function getReadinessBadgeVariant(readiness) {
17
18
  switch (readiness) {
@@ -70,6 +71,42 @@ export function groupAgentsByReadiness(diag) {
70
71
  }
71
72
  return groups;
72
73
  }
74
+ /**
75
+ * Type guard: is `name` a known internal agent with metadata?
76
+ * Replaces `as keyof typeof AGENT_METADATA` (rc-2: no `as` bypass).
77
+ */
78
+ export function isKnownAgentName(name) {
79
+ return Object.hasOwn(AGENT_METADATA, name);
80
+ }
81
+ /**
82
+ * Group agents by dependency cluster (core_trio / code_chain / quality_polish / sidechain).
83
+ * Agents not found in AGENT_METADATA go to the `unknown` bucket for fail-loud
84
+ * handling by the caller (rc-5: Object.hasOwn lookup; rc-9: no silent fallback).
85
+ *
86
+ * Group insertion order matches GROUP_ORDER (core_trio → code_chain → quality_polish → sidechain),
87
+ * so Object.keys(groups) returns the render order.
88
+ */
89
+ export function groupAgentsByDependency(agents) {
90
+ const groups = {
91
+ core_trio: [],
92
+ code_chain: [],
93
+ quality_polish: [],
94
+ sidechain: [],
95
+ };
96
+ const unknown = [];
97
+ for (const agent of agents) {
98
+ // rc-5: Object.hasOwn for untrusted keys (agent.name comes from server response)
99
+ if (isKnownAgentName(agent.name)) {
100
+ const meta = AGENT_METADATA[agent.name];
101
+ groups[meta.group].push(agent);
102
+ }
103
+ else {
104
+ // rc-9: unknown agents go to a separate bucket; caller decides how to surface
105
+ unknown.push(agent);
106
+ }
107
+ }
108
+ return { groups, unknown };
109
+ }
73
110
  // ── Redacted Diagnostics for Copy ────────────────────────────────────────────
74
111
  /** Maximum items per section in diagnostics output (ERR-014/ERR-016/ERR-017) */
75
112
  const MAX_ITEMS_PER_SECTION = 50;