create-principles-disciple 1.95.0 → 1.97.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 (263) hide show
  1. package/console/dist/server/config/pd-config-store.js +49 -12
  2. package/console/dist/server/index.js +4 -3
  3. package/console/dist/server/models/IntentPageModel.d.ts +36 -2
  4. package/console/dist/server/models/IntentPageModel.js +213 -11
  5. package/console/dist/server/routes/intent.d.ts +5 -1
  6. package/console/dist/server/routes/intent.js +200 -12
  7. package/console/dist/types.d.ts +1 -0
  8. package/console/dist/ui/App.js +0 -53
  9. package/console/dist/ui/api.d.ts +18 -4
  10. package/console/dist/ui/api.js +38 -5
  11. package/console/dist/ui/components/layout/app-sidebar.js +12 -12
  12. package/console/dist/ui/components/ui/badge.d.ts +1 -1
  13. package/console/dist/ui/i18n/en.json +142 -3
  14. package/console/dist/ui/i18n/zh-CN.json +142 -3
  15. package/console/dist/ui/pages/control-center/AgentCard.d.ts +31 -0
  16. package/console/dist/ui/pages/control-center/AgentCard.js +156 -0
  17. package/console/dist/ui/pages/control-center/AgentGroup.d.ts +26 -0
  18. package/console/dist/ui/pages/control-center/AgentGroup.js +38 -0
  19. package/console/dist/ui/pages/control-center/ControlCenterPage.js +77 -41
  20. package/console/dist/ui/pages/control-center/WorkflowDiagram.d.ts +17 -0
  21. package/console/dist/ui/pages/control-center/WorkflowDiagram.js +55 -0
  22. package/console/dist/ui/pages/intent/IntentOnboarding.d.ts +67 -0
  23. package/console/dist/ui/pages/intent/IntentOnboarding.js +289 -0
  24. package/console/dist/ui/pages/intent/IntentPage.js +117 -6
  25. package/console/dist/ui/utils/agent-metadata.d.ts +58 -0
  26. package/console/dist/ui/utils/agent-metadata.js +275 -0
  27. package/console/dist/ui/utils/control-center-helpers.d.ts +19 -0
  28. package/console/dist/ui/utils/control-center-helpers.js +37 -0
  29. package/console/dist/ui/utils/validators.d.ts +37 -0
  30. package/console/dist/ui/utils/validators.js +130 -0
  31. package/console/dist/web/assets/app.css +360 -3
  32. package/console/dist/web/assets/app.js +2952 -1143
  33. package/console/package.json +1 -1
  34. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +27 -35
  35. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  36. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +85 -7
  37. package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -1
  38. package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js +70 -0
  39. package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js.map +1 -1
  40. package/core/dist/runtime-v2/__tests__/golden-trace.test.js +136 -1
  41. package/core/dist/runtime-v2/__tests__/golden-trace.test.js.map +1 -1
  42. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts +2 -0
  43. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts.map +1 -0
  44. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js +211 -0
  45. package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js.map +1 -0
  46. package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +93 -0
  47. package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -1
  48. package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts +11 -0
  49. package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -1
  50. package/core/dist/runtime-v2/activation/writers/rule-host-writer.js +22 -0
  51. package/core/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
  52. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts +2 -0
  53. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts.map +1 -0
  54. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js +74 -0
  55. package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js.map +1 -0
  56. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts +2 -0
  57. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts.map +1 -0
  58. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js +246 -0
  59. package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js.map +1 -0
  60. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  61. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +7 -0
  62. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  63. package/core/dist/runtime-v2/feature-flags/index.d.ts +2 -0
  64. package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
  65. package/core/dist/runtime-v2/feature-flags/index.js +2 -0
  66. package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
  67. package/{plugin/dist/core/surface-guard.d.ts → core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts} +15 -5
  68. package/core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts.map +1 -0
  69. package/{plugin/dist/core/surface-guard.js → core/dist/runtime-v2/feature-flags/surface-guard-policy.js} +14 -2
  70. package/core/dist/runtime-v2/feature-flags/surface-guard-policy.js.map +1 -0
  71. package/core/dist/runtime-v2/golden-trace-replay-validator.js +1 -1
  72. package/core/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -1
  73. package/core/dist/runtime-v2/golden-trace.d.ts +19 -3
  74. package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
  75. package/core/dist/runtime-v2/golden-trace.js +2 -0
  76. package/core/dist/runtime-v2/golden-trace.js.map +1 -1
  77. package/core/dist/runtime-v2/index.d.ts +15 -3
  78. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  79. package/core/dist/runtime-v2/index.js +11 -2
  80. package/core/dist/runtime-v2/index.js.map +1 -1
  81. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts +2 -0
  82. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts.map +1 -0
  83. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js +88 -0
  84. package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js.map +1 -0
  85. package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js +91 -1
  86. package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js.map +1 -1
  87. package/core/dist/runtime-v2/intent/index.d.ts +2 -0
  88. package/core/dist/runtime-v2/intent/index.d.ts.map +1 -1
  89. package/core/dist/runtime-v2/intent/index.js +2 -0
  90. package/core/dist/runtime-v2/intent/index.js.map +1 -1
  91. package/core/dist/runtime-v2/intent/intent-browser.d.ts +23 -0
  92. package/core/dist/runtime-v2/intent/intent-browser.d.ts.map +1 -0
  93. package/core/dist/runtime-v2/intent/intent-browser.js +21 -0
  94. package/core/dist/runtime-v2/intent/intent-browser.js.map +1 -0
  95. package/core/dist/runtime-v2/intent/intent-doc-version.d.ts +28 -0
  96. package/core/dist/runtime-v2/intent/intent-doc-version.d.ts.map +1 -0
  97. package/core/dist/runtime-v2/intent/intent-doc-version.js +21 -0
  98. package/core/dist/runtime-v2/intent/intent-doc-version.js.map +1 -0
  99. package/core/dist/runtime-v2/intent/intent-doc.d.ts +17 -1
  100. package/core/dist/runtime-v2/intent/intent-doc.d.ts.map +1 -1
  101. package/core/dist/runtime-v2/intent/intent-doc.js +95 -7
  102. package/core/dist/runtime-v2/intent/intent-doc.js.map +1 -1
  103. package/core/dist/runtime-v2/intent/intent-hash.d.ts +2 -0
  104. package/core/dist/runtime-v2/intent/intent-hash.d.ts.map +1 -0
  105. package/core/dist/runtime-v2/intent/intent-hash.js +10 -0
  106. package/core/dist/runtime-v2/intent/intent-hash.js.map +1 -0
  107. package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +41 -1
  108. package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
  109. package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +130 -2
  110. package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -1
  111. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts +2 -0
  112. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts.map +1 -0
  113. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js +228 -0
  114. package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js.map +1 -0
  115. package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +41 -11
  116. package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
  117. package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js +135 -0
  118. package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js.map +1 -1
  119. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts +2 -0
  120. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts.map +1 -0
  121. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js +449 -0
  122. package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js.map +1 -0
  123. package/core/dist/runtime-v2/internalization/adversarial-case.d.ts.map +1 -1
  124. package/core/dist/runtime-v2/internalization/adversarial-case.js +24 -0
  125. package/core/dist/runtime-v2/internalization/adversarial-case.js.map +1 -1
  126. package/core/dist/runtime-v2/internalization/artificer-output.d.ts +10 -0
  127. package/core/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
  128. package/core/dist/runtime-v2/internalization/artificer-output.js +45 -0
  129. package/core/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
  130. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +2 -2
  131. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
  132. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js +7 -2
  133. package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
  134. package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts +66 -0
  135. package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts.map +1 -0
  136. package/core/dist/runtime-v2/internalization/behavior-example-pack.js +183 -0
  137. package/core/dist/runtime-v2/internalization/behavior-example-pack.js.map +1 -0
  138. package/core/dist/runtime-v2/internalization/evaluator-output.d.ts +8 -0
  139. package/core/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
  140. package/core/dist/runtime-v2/internalization/evaluator-output.js +10 -0
  141. package/core/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
  142. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +17 -0
  143. package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
  144. package/core/dist/runtime-v2/internalization/evaluator-runner.js +118 -24
  145. package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
  146. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
  147. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +1 -1
  148. package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
  149. package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts +61 -0
  150. package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts.map +1 -0
  151. package/core/dist/runtime-v2/internalization/rule-context-v2.js +301 -0
  152. package/core/dist/runtime-v2/internalization/rule-context-v2.js.map +1 -0
  153. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +9 -0
  154. package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
  155. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts +55 -0
  156. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts.map +1 -0
  157. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js +131 -0
  158. package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js.map +1 -0
  159. package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
  160. package/core/dist/runtime-v2/pain-signal-observability.js +24 -1
  161. package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
  162. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts +2 -0
  163. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts.map +1 -0
  164. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js +95 -0
  165. package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js.map +1 -0
  166. package/core/dist/runtime-v2/risk/index.d.ts +7 -0
  167. package/core/dist/runtime-v2/risk/index.d.ts.map +1 -0
  168. package/core/dist/runtime-v2/risk/index.js +6 -0
  169. package/core/dist/runtime-v2/risk/index.js.map +1 -0
  170. package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts +18 -0
  171. package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts.map +1 -0
  172. package/core/dist/runtime-v2/risk/risk-calculator-policy.js +47 -0
  173. package/core/dist/runtime-v2/risk/risk-calculator-policy.js.map +1 -0
  174. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts +2 -0
  175. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts.map +1 -0
  176. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js +83 -0
  177. package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js.map +1 -0
  178. package/core/dist/runtime-v2/store/intent/index.d.ts +2 -1
  179. package/core/dist/runtime-v2/store/intent/index.d.ts.map +1 -1
  180. package/core/dist/runtime-v2/store/intent/index.js +2 -1
  181. package/core/dist/runtime-v2/store/intent/index.js.map +1 -1
  182. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts +28 -0
  183. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts.map +1 -0
  184. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js +88 -0
  185. package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js.map +1 -0
  186. package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
  187. package/core/dist/runtime-v2/store/sqlite-connection.js +14 -0
  188. package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
  189. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts +2 -0
  190. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts.map +1 -0
  191. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js +149 -0
  192. package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js.map +1 -0
  193. package/core/dist/runtime-v2/thinking-models/index.d.ts +3 -0
  194. package/core/dist/runtime-v2/thinking-models/index.d.ts.map +1 -0
  195. package/core/dist/runtime-v2/thinking-models/index.js +3 -0
  196. package/core/dist/runtime-v2/thinking-models/index.js.map +1 -0
  197. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts +73 -0
  198. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts.map +1 -0
  199. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js +227 -0
  200. package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js.map +1 -0
  201. package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +40 -1
  202. package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +1 -1
  203. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
  204. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js +28 -1
  205. package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
  206. package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts +3 -0
  207. package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts.map +1 -1
  208. package/core/dist/runtime-v2/tools/artificer-output-typebox.js +3 -0
  209. package/core/dist/runtime-v2/tools/artificer-output-typebox.js.map +1 -1
  210. package/core/package.json +4 -0
  211. package/package.json +1 -1
  212. package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js +74 -3
  213. package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js.map +1 -1
  214. package/pd-cli/dist/commands/intent.d.ts +21 -4
  215. package/pd-cli/dist/commands/intent.d.ts.map +1 -1
  216. package/pd-cli/dist/commands/intent.js +88 -27
  217. package/pd-cli/dist/commands/intent.js.map +1 -1
  218. package/plugin/dist/commands/pain.js +2 -2
  219. package/plugin/dist/core/behavior-example-pack-assembler.d.ts +43 -0
  220. package/plugin/dist/core/behavior-example-pack-assembler.js +247 -0
  221. package/plugin/dist/core/intent-doc-reader-adapter.d.ts +13 -5
  222. package/plugin/dist/core/intent-doc-reader-adapter.js +25 -5
  223. package/plugin/dist/core/intent-doc-reader.d.ts +13 -4
  224. package/plugin/dist/core/intent-doc-reader.js +45 -24
  225. package/plugin/dist/core/rule-context-assembler.d.ts +45 -0
  226. package/plugin/dist/core/rule-context-assembler.js +148 -0
  227. package/plugin/dist/core/thinking-models.d.ts +12 -57
  228. package/plugin/dist/core/thinking-models.js +18 -224
  229. package/plugin/dist/core/trajectory-types.d.ts +18 -0
  230. package/plugin/dist/core/trajectory.d.ts +34 -2
  231. package/plugin/dist/core/trajectory.js +103 -0
  232. package/plugin/dist/hooks/gate.js +59 -2
  233. package/plugin/dist/hooks/pain.js +2 -2
  234. package/plugin/dist/hooks/prompt.js +2 -1
  235. package/plugin/dist/index.js +1 -1
  236. package/plugin/package.json +1 -1
  237. package/plugin/dist/core/evolution-migration.d.ts +0 -5
  238. package/plugin/dist/core/evolution-migration.js +0 -65
  239. package/plugin/dist/core/risk-calculator.d.ts +0 -22
  240. package/plugin/dist/core/risk-calculator.js +0 -88
  241. package/plugin/dist/core/rule-host-helpers.d.ts +0 -8
  242. package/plugin/dist/core/rule-host-helpers.js +0 -7
  243. package/plugin/dist/core/rule-host-types.d.ts +0 -7
  244. package/plugin/dist/core/rule-host-types.js +0 -7
  245. package/plugin/dist/core/schema/db-types.d.ts +0 -11
  246. package/plugin/dist/core/schema/db-types.js +0 -5
  247. package/plugin/dist/core/schema/index.d.ts +0 -17
  248. package/plugin/dist/core/schema/index.js +0 -15
  249. package/plugin/dist/core/schema/migration-runner.d.ts +0 -53
  250. package/plugin/dist/core/schema/migration-runner.js +0 -170
  251. package/plugin/dist/core/schema/migrations/001-init-trajectory.d.ts +0 -6
  252. package/plugin/dist/core/schema/migrations/001-init-trajectory.js +0 -190
  253. package/plugin/dist/core/schema/migrations/002-init-central.d.ts +0 -5
  254. package/plugin/dist/core/schema/migrations/002-init-central.js +0 -108
  255. package/plugin/dist/core/schema/migrations/003-init-workflow.d.ts +0 -5
  256. package/plugin/dist/core/schema/migrations/003-init-workflow.js +0 -50
  257. package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.d.ts +0 -8
  258. package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.js +0 -66
  259. package/plugin/dist/core/schema/migrations/index.d.ts +0 -16
  260. package/plugin/dist/core/schema/migrations/index.js +0 -27
  261. package/plugin/dist/core/schema/schema-definitions.d.ts +0 -46
  262. package/plugin/dist/core/schema/schema-definitions.js +0 -599
  263. package/plugin/scripts/db-migrate.mjs +0 -170
@@ -0,0 +1,156 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { ChevronRight } from "lucide-react";
5
+ import { cn } from "../../../lib/utils.js";
6
+ /** 状态点样式:ready / notready / off */
7
+ function statusDotClasses(agent) {
8
+ const base = "w-2 h-2 rounded-full border-2 shrink-0";
9
+ if (!agent.enabled) {
10
+ return cn(base, "border-ink-4 bg-surface opacity-50");
11
+ }
12
+ switch (agent.readiness) {
13
+ case "ready":
14
+ return cn(base, "border-green bg-green");
15
+ case "not_ready":
16
+ return cn(base, "border-amber bg-surface");
17
+ case "needs_setup":
18
+ return cn(base, "border-amber bg-surface");
19
+ default:
20
+ return cn(base, "border-ink-4 bg-surface");
21
+ }
22
+ }
23
+ /** impact-box 左边框色 */
24
+ function impactBorderClass(level) {
25
+ switch (level) {
26
+ case "danger":
27
+ return "border-l-danger";
28
+ case "green":
29
+ return "border-l-green";
30
+ default:
31
+ return "border-l-amber";
32
+ }
33
+ }
34
+ /** impact label 色 */
35
+ function impactLabelClass(level) {
36
+ switch (level) {
37
+ case "danger":
38
+ return "text-danger";
39
+ case "green":
40
+ return "text-green";
41
+ default:
42
+ return "text-ink-4";
43
+ }
44
+ }
45
+ /**
46
+ * 渲染含反引号 code 片段的文本。
47
+ * 输入示例:'`DiagnosticianContextPayload`(pain 信号上下文)'
48
+ * 输出:[<code>DiagnosticianContextPayload</code>, "(pain 信号上下文)"]
49
+ */
50
+ function renderTextWithCode(text) {
51
+ const parts = text.split("`");
52
+ const nodes = [];
53
+ for (let i = 0; i < parts.length; i++) {
54
+ const part = parts[i];
55
+ if (part === undefined)
56
+ continue;
57
+ if (i % 2 === 0) {
58
+ if (part.length > 0) {
59
+ nodes.push(part);
60
+ }
61
+ }
62
+ else {
63
+ // Odd index = content between backticks = code
64
+ nodes.push(_jsx("code", { className: "font-mono text-[11px] text-ink-2 bg-paper-2 px-[5px] py-[1px] rounded-[2px]", children: part }, `code-${i}`));
65
+ }
66
+ }
67
+ return nodes;
68
+ }
69
+ export function AgentCard({ agent, meta, profiles, onBindingChange, saving, locale, }) {
70
+ const { t } = useTranslation();
71
+ const isSaving = saving === agent.name;
72
+ // L2 / L3 / confirm 状态
73
+ const [isOpen, setIsOpen] = useState(false);
74
+ const [showTechDetail, setShowTechDetail] = useState(false);
75
+ const [confirming, setConfirming] = useState(false);
76
+ // locale 决定取 Zh 还是 En 字段
77
+ const isZh = locale === "zh-CN";
78
+ const displayName = isZh ? meta.displayNameZh : meta.displayNameEn;
79
+ const role = isZh ? meta.roleZh : meta.roleEn;
80
+ const detail = isZh ? meta.detailZh : meta.detailEn;
81
+ const impact = isZh ? meta.impactZh : meta.impactEn;
82
+ const techDetail = isZh ? meta.techDetailZh : meta.techDetailEn;
83
+ const mvpNote = isZh ? meta.mvpNoteZh : meta.mvpNoteEn;
84
+ // 段落用 \n\n 分隔
85
+ const detailParagraphs = detail.split("\n\n").filter((p) => p.length > 0);
86
+ // 头部点击:toggle isOpen(但点击 toggle 按钮 / confirm-bar / tech-toggle 不触发)
87
+ const handleHeadClick = (e) => {
88
+ const target = e.target;
89
+ if (target.closest("[data-agent-toggle]") ||
90
+ target.closest("[data-confirm-bar]") ||
91
+ target.closest("[data-tech-toggle]")) {
92
+ return;
93
+ }
94
+ setIsOpen((prev) => !prev);
95
+ };
96
+ // toggle 按钮点击
97
+ const handleToggleClick = (e) => {
98
+ e.stopPropagation();
99
+ if (agent.enabled) {
100
+ // 当前 on → 要关
101
+ if (meta.isCore) {
102
+ // 核心代理:显示内联确认 + 自动展开
103
+ setConfirming(true);
104
+ setIsOpen(true);
105
+ }
106
+ else {
107
+ // 非核心代理:直接关
108
+ onBindingChange(agent.name, agent.runtimeProfileId, false);
109
+ }
110
+ }
111
+ else {
112
+ // 当前 off → 要开
113
+ onBindingChange(agent.name, agent.runtimeProfileId, true);
114
+ }
115
+ };
116
+ // 确认停用
117
+ const handleConfirmOff = (e) => {
118
+ e.stopPropagation();
119
+ onBindingChange(agent.name, agent.runtimeProfileId, false);
120
+ setConfirming(false);
121
+ };
122
+ // 取消确认
123
+ const handleCancelConfirm = (e) => {
124
+ e.stopPropagation();
125
+ setConfirming(false);
126
+ };
127
+ // tech-toggle 点击
128
+ const handleTechToggleClick = (e) => {
129
+ e.stopPropagation();
130
+ setShowTechDetail((prev) => !prev);
131
+ };
132
+ // profile select 变更
133
+ const handleProfileChange = (e) => {
134
+ onBindingChange(agent.name, e.target.value, agent.enabled);
135
+ };
136
+ return (_jsxs("div", { "data-agent-card": agent.name, className: cn("bg-surface border border-line-2 rounded-[4px] mb-[6px] overflow-hidden transition-colors hover:border-line", !meta.isCore && "border-dashed", !agent.enabled && "opacity-72"), children: [_jsxs("div", { className: "px-[16px] py-[12px] cursor-pointer flex items-center gap-[12px]", onClick: handleHeadClick, role: "button", tabIndex: 0, "aria-expanded": isOpen, onKeyDown: (e) => {
137
+ if (e.key === "Enter" || e.key === " ") {
138
+ e.preventDefault();
139
+ setIsOpen((prev) => !prev);
140
+ }
141
+ }, children: [_jsx("div", { className: statusDotClasses(agent), "aria-hidden": "true" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsxs("div", { className: cn("text-[14px] font-semibold tracking-[-0.005em] flex items-center gap-[8px]", agent.enabled ? "text-ink" : "text-ink-3"), children: [_jsx("span", { children: displayName }), _jsx("span", { className: "font-mono text-[11.5px] text-ink-4 font-normal", children: agent.name })] }), _jsx("div", { className: "text-[12.5px] text-ink-3 mt-[2px] leading-[1.5]", children: role })] }), _jsx("button", { type: "button", "data-agent-toggle": true, onClick: handleToggleClick, disabled: isSaving, "aria-label": agent.enabled
142
+ ? t("pages.controlCenter.agentDisabled")
143
+ : t("pages.controlCenter.agentEnabled"), className: cn("rounded-[3px] px-[14px] py-[6px] text-[12.5px] font-medium transition-colors disabled:opacity-50", agent.enabled
144
+ ? "border border-gov bg-gov text-paper hover:bg-gov-2"
145
+ : "border border-line bg-surface text-ink hover:border-line-2"), children: isSaving
146
+ ? t("pages.controlCenter.saving")
147
+ : agent.enabled
148
+ ? t("pages.controlCenter.on")
149
+ : t("pages.controlCenter.off") }), _jsx(ChevronRight, { className: cn("w-[14px] h-[14px] text-ink-4 transition-transform shrink-0", isOpen && "rotate-90"), "aria-hidden": "true" })] }), isOpen && (_jsxs("div", { className: "px-[16px] pb-[14px] border-t border-line-2 bg-panel", children: [_jsx("div", { className: "pt-[14px] text-[13px] text-ink-3 leading-[1.62]", children: detailParagraphs.map((para, i) => (_jsx("p", { className: i > 0 ? "mt-2" : undefined, children: renderTextWithCode(para) }, i))) }), mvpNote && (_jsx("div", { className: "mt-3 text-[12px] text-ink-4 font-mono italic", children: mvpNote })), _jsxs("div", { className: cn("mt-[12px] px-[12px] py-[10px] border border-line-2 border-l-[2.5px] rounded-[4px] bg-paper-2 text-[12.5px] text-ink-3 leading-[1.55]", impactBorderClass(meta.impactLevel)), children: [_jsx("span", { className: cn("block mb-[3px] text-[10px] font-mono uppercase tracking-[0.08em] font-medium", impactLabelClass(meta.impactLevel)), children: t("pages.controlCenter.impact.label") }), impact] }), Object.keys(techDetail).length > 0 && (_jsxs(_Fragment, { children: [_jsxs("div", { "data-tech-toggle": true, className: "mt-[12px] pt-[12px] border-t border-line-2 flex items-center gap-[6px] cursor-pointer text-[11px] text-ink-4 font-mono uppercase tracking-[0.04em] hover:text-ink-2 transition-colors", onClick: handleTechToggleClick, role: "button", tabIndex: 0, "aria-expanded": showTechDetail, onKeyDown: (e) => {
150
+ if (e.key === "Enter" || e.key === " ") {
151
+ e.preventDefault();
152
+ e.stopPropagation();
153
+ setShowTechDetail((prev) => !prev);
154
+ }
155
+ }, children: [_jsx(ChevronRight, { className: cn("w-[12px] h-[12px] transition-transform", showTechDetail && "rotate-90"), "aria-hidden": "true" }), t("pages.controlCenter.techDetail")] }), showTechDetail && (_jsx("div", { className: "mt-2 grid grid-cols-[72px_1fr] gap-x-[14px] gap-y-[6px] text-[12px] leading-[1.55]", children: Object.entries(techDetail).map(([k, v]) => (_jsxs("div", { className: "contents", children: [_jsx("div", { className: "text-ink-4 font-mono text-[10.5px] uppercase tracking-[0.04em] pt-px", children: k }), _jsx("div", { className: "text-ink-3", children: renderTextWithCode(v) })] }, k))) }))] })), _jsxs("div", { className: "mt-[12px] pt-[12px] border-t border-line-2 flex items-center gap-[10px] text-[12px]", children: [_jsx("span", { className: "text-ink-4 font-mono text-[10.5px] uppercase tracking-[0.04em]", children: t("pages.controlCenter.profileLabelShort") }), _jsx("select", { value: agent.runtimeProfileId, onChange: handleProfileChange, disabled: isSaving, className: "font-mono text-[11px] text-ink-2 bg-surface border border-line-2 rounded-[3px] px-2 py-1 cursor-pointer focus:outline-none focus:border-gov disabled:opacity-50", "aria-label": t("pages.controlCenter.profileLabel"), children: profiles.map((p) => (_jsx("option", { value: p.id, children: p.label }, p.id))) })] }), confirming && (_jsxs("div", { "data-confirm-bar": true, className: "mt-[10px] px-[12px] py-[10px] border border-danger rounded-[4px] bg-danger/10 text-[12px] text-ink-2 leading-[1.55]", children: [_jsx("div", { children: impact }), _jsxs("div", { className: "mt-2 flex gap-[8px]", children: [_jsx("button", { type: "button", onClick: handleConfirmOff, className: "text-[11.5px] px-[12px] py-[4px] rounded-[3px] border border-transparent bg-danger text-paper font-medium hover:opacity-90 transition-opacity focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", children: t("pages.controlCenter.impact.confirmAck") }), _jsx("button", { type: "button", onClick: handleCancelConfirm, className: "text-[11.5px] px-[12px] py-[4px] rounded-[3px] border border-line bg-transparent text-ink-3 hover:border-line-2 transition-colors focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", children: t("pages.controlCenter.impact.confirmCancel") })] })] }))] }))] }));
156
+ }
@@ -0,0 +1,26 @@
1
+ import { type AgentGroupMeta } from "../../utils/agent-metadata.js";
2
+ import type { RedactedAgentSummary, RedactedRuntimeProfileSummary } from "../../api.js";
3
+ import { type AgentLocale } from "./AgentCard.js";
4
+ /**
5
+ * AgentGroup — 依赖分组容器
6
+ *
7
+ * 渲染 group header(名称 + 标签 + 提示)+ 该组所有 AgentCard。
8
+ * 标签样式按 GroupTag(must/recommend/optional/independent)区分。
9
+ *
10
+ * rc 合规:
11
+ * - rc-2/rc-5: 父组件已用 groupAgentsByDependency 过滤未知代理,本组件用
12
+ * isKnownAgentName 类型守卫二次校验 agent.name 后取 meta(防御性,不静默)
13
+ * - rc-9: 若 agents 为空数组,渲染 group header 但显示空状态提示
14
+ *
15
+ * 品牌约束:无 translateY / scale hover,无硬编码色值
16
+ */
17
+ interface AgentGroupProps {
18
+ groupMeta: AgentGroupMeta;
19
+ agents: RedactedAgentSummary[];
20
+ profiles: RedactedRuntimeProfileSummary[];
21
+ onBindingChange: (agentName: string, runtimeProfile: string, enabled: boolean) => void;
22
+ saving: string | null;
23
+ locale: AgentLocale;
24
+ }
25
+ export declare function AgentGroup({ groupMeta, agents, profiles, onBindingChange, saving, locale, }: AgentGroupProps): import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from "react-i18next";
3
+ import { cn } from "../../../lib/utils.js";
4
+ import { AGENT_METADATA, } from "../../utils/agent-metadata.js";
5
+ import { isKnownAgentName } from "../../utils/control-center-helpers.js";
6
+ import { AgentCard } from "./AgentCard.js";
7
+ /** gtag 样式按 GroupTag 区分 */
8
+ function gtagClasses(tag) {
9
+ const base = "text-[10px] font-mono px-[7px] py-[2px] rounded-[2px] tracking-[0.02em] font-medium border border-transparent";
10
+ switch (tag) {
11
+ case "must":
12
+ return cn(base, "bg-danger/10 text-danger border-danger/22");
13
+ case "recommend":
14
+ return cn(base, "bg-amber/10 text-amber border-amber/22");
15
+ case "optional":
16
+ return cn(base, "bg-paper-2 text-ink-4 border-line-2");
17
+ case "independent":
18
+ return cn(base, "bg-green/10 text-green border-green/22");
19
+ default:
20
+ return base;
21
+ }
22
+ }
23
+ export function AgentGroup({ groupMeta, agents, profiles, onBindingChange, saving, locale, }) {
24
+ const { t } = useTranslation();
25
+ const isZh = locale === "zh-CN";
26
+ const groupName = isZh ? groupMeta.labelZh : groupMeta.labelEn;
27
+ const groupTagLabel = isZh ? groupMeta.tagLabelZh : groupMeta.tagLabelEn;
28
+ const groupHint = isZh ? groupMeta.hintZh : groupMeta.hintEn;
29
+ // rc-2/rc-5: 先用类型守卫缩窄 agent.name,避免 as 绕过;
30
+ // 空状态判断基于过滤后的 knownAgents,避免"全部未知时仍渲染 group header 但无卡片"
31
+ // 用对象级类型谓词让 TS 在后续 map 中正确缩窄 agent.name(Array.filter 对
32
+ // 子属性的 string 谓词不会传播到元素类型)
33
+ const knownAgents = agents.filter((agent) => isKnownAgentName(agent.name));
34
+ return (_jsxs("div", { className: "mb-[20px]", children: [_jsxs("div", { className: "px-[14px] py-[9px] bg-paper-2 border border-line-2 rounded-[4px] flex items-center gap-[10px] mb-[8px]", children: [_jsx("span", { className: "text-[12.5px] font-semibold text-ink-2", children: groupName }), _jsx("span", { className: gtagClasses(groupMeta.tag), children: groupTagLabel }), _jsx("span", { className: "ml-auto text-[11px] text-ink-4 font-mono leading-[1.4] max-w-[32ch] text-right", children: groupHint })] }), knownAgents.length === 0 ? (_jsx("div", { className: "py-2 px-4 text-[12.5px] text-ink-4 italic", children: "\u2014" })) : (knownAgents.map((agent) => {
35
+ const meta = AGENT_METADATA[agent.name];
36
+ return (_jsx(AgentCard, { agent: agent, meta: meta, profiles: profiles, onBindingChange: onBindingChange, saving: saving, locale: locale }, agent.name));
37
+ }))] }));
38
+ }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useCallback } from "react";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { toast } from "sonner";
@@ -6,9 +6,12 @@ import { PageShell } from "../../components/layout/page-shell.js";
6
6
  import { PageLoading } from "../../components/layout/page-loading.js";
7
7
  import { SectionTitle } from "../../components/layout/section-title.js";
8
8
  import { fetchConfigSummary, fetchConfigCatalog, updateAgentBinding, updateDefaultRuntime, } from "../../api.js";
9
- import { computeOverallReadiness, groupAgentsByReadiness, redactDiagnosticsForCopy, } from "../../utils/control-center-helpers.js";
9
+ import { computeOverallReadiness, groupAgentsByReadiness, groupAgentsByDependency, isKnownAgentName, redactDiagnosticsForCopy, } from "../../utils/control-center-helpers.js";
10
10
  import { enumLabel } from "../../utils/enum-labels.js";
11
11
  import { EmpathyObserverCostHint } from "./EmpathyObserverCostHint.js";
12
+ import { WorkflowDiagram } from "./WorkflowDiagram.js";
13
+ import { AgentGroup } from "./AgentGroup.js";
14
+ import { AGENT_GROUPS, AGENT_METADATA, } from "../../utils/agent-metadata.js";
12
15
  // ── Runtime validators (H section / ERR-001/005/009/013) ─────────────────────
13
16
  function validateSource(raw) {
14
17
  if (typeof raw !== "string")
@@ -284,46 +287,70 @@ function readinessTagClasses(readiness) {
284
287
  }
285
288
  }
286
289
  // ── Sub-components ───────────────────────────────────────────────────────────
287
- function OverallStatusCard({ readiness, agents, }) {
290
+ /**
291
+ * CompactStatusBar — 紧凑状态条(替代 OverallStatusCard)
292
+ *
293
+ * 取自原型 control-center.html 第 153-168 行。一行展示:
294
+ * 已启用 N/M · 未就绪 N 项 · 核心管道 状态 · [需配置] pill
295
+ *
296
+ * 核心管道状态 = core_trio + code_chain 中已启用代理的就绪情况:
297
+ * - paralyzed: core_trio 任一 disabled 或有 not_ready
298
+ * - degraded: 有 needs_setup
299
+ * - ok: 全 ready
300
+ *
301
+ * rc-2: 用 Object.hasOwn 守卫 agent.name 查 AGENT_METADATA(无 as 绕过)
302
+ */
303
+ function CompactStatusBar({ readiness, agents, }) {
288
304
  const { t } = useTranslation();
289
305
  const enabledCount = agents.filter((a) => a.enabled).length;
290
306
  const totalCount = agents.length;
291
- let messageKey;
292
- switch (readiness) {
293
- case "ready":
294
- messageKey = "pages.controlCenter.configReady";
295
- break;
296
- case "needs_setup":
297
- messageKey = "pages.controlCenter.configNeedsSetup";
298
- break;
299
- case "not_ready":
300
- messageKey = "pages.controlCenter.configNotReady";
301
- break;
302
- case "disabled":
303
- messageKey = "pages.controlCenter.configDisabled";
304
- break;
305
- default:
306
- messageKey = "pages.controlCenter.configUnknown";
307
- break;
307
+ const notReadyCount = agents.filter((a) => a.enabled && a.readiness !== "ready").length;
308
+ // 核心管道状态:core_trio + code_chain 中已启用代理
309
+ // rc-2: 用 isKnownAgentName 类型守卫缩窄,不用 as 绕过
310
+ const coreAgents = agents.filter((a) => {
311
+ if (!isKnownAgentName(a.name))
312
+ return false;
313
+ const meta = AGENT_METADATA[a.name];
314
+ return meta.group === "core_trio" || meta.group === "code_chain";
315
+ });
316
+ const enabledCoreAgents = coreAgents.filter((a) => a.enabled);
317
+ const coreTrioAgents = coreAgents.filter((a) => {
318
+ if (!isKnownAgentName(a.name))
319
+ return false;
320
+ const meta = AGENT_METADATA[a.name];
321
+ return meta.group === "core_trio";
322
+ });
323
+ const codeChainAgents = coreAgents.filter((a) => {
324
+ if (!isKnownAgentName(a.name))
325
+ return false;
326
+ const meta = AGENT_METADATA[a.name];
327
+ return meta.group === "code_chain";
328
+ });
329
+ const coreTrioAnyDisabled = coreTrioAgents.some((a) => !a.enabled);
330
+ const codeChainAnyDisabled = codeChainAgents.some((a) => !a.enabled);
331
+ const coreAnyNotReady = enabledCoreAgents.some((a) => a.readiness === "not_ready");
332
+ const coreAnyNeedsSetup = enabledCoreAgents.some((a) => a.readiness === "needs_setup");
333
+ // 状态优先级(per AGENT_METADATA.impactZh):
334
+ // - paralyzed: core_trio 任一 disabled 或 enabled 但 not_ready
335
+ // (core_trio 是入口,关掉任何一个整个管道瘫痪)
336
+ // - degraded: code_chain 任一 disabled(降级运行,非瘫痪)
337
+ // 或 enabled 但 needs_setup
338
+ // - ok: 全 ready
339
+ //
340
+ // needsConfig 标记仅用于 readiness 异常(not_ready / needs_setup),
341
+ // 不用于主动 disabled — 主动 disable 是 owner 的有意决策,不是配置缺失。
342
+ let corePipelineKey;
343
+ const needsConfig = coreAnyNotReady || coreAnyNeedsSetup;
344
+ if (coreTrioAnyDisabled || coreAnyNotReady) {
345
+ corePipelineKey = "pages.controlCenter.status.corePipelineParalyzed";
308
346
  }
309
- return (_jsxs("div", { className: "bg-panel border border-line rounded-[6px] px-[18px] py-[14px]", children: [_jsxs("div", { className: "flex items-center gap-3 mb-2", children: [_jsx("span", { className: readinessTagClasses(readiness), children: enumLabel('readiness', readiness, t) }), _jsxs("span", { className: "text-ink-3 text-[13px]", children: [enabledCount, "/", totalCount, " ", t("pages.controlCenter.agentEnabled").toLowerCase()] })] }), _jsx("p", { className: "text-ink-2 text-[14px] leading-relaxed", children: t(messageKey) })] }));
310
- }
311
- function AgentRow({ agent, profiles, onBindingChange, saving, }) {
312
- const { t } = useTranslation();
313
- const isSaving = saving === agent.name;
314
- return (_jsxs("div", { className: "flex items-center gap-4 py-[10px] border-b border-line last:border-b-0", children: [_jsx("div", { className: "min-w-[140px]", children: _jsx("span", { className: "text-ink text-[13px] font-medium", children: agent.name }) }), _jsx("div", { className: "min-w-[100px]", children: _jsx("span", { className: readinessTagClasses(agent.readiness), children: enumLabel('readiness', agent.readiness, t) }) }), _jsx("div", { className: "flex-1", children: _jsx("select", { value: agent.runtimeProfileId, onChange: (e) => {
315
- onBindingChange(agent.name, e.target.value, agent.enabled);
316
- }, disabled: isSaving, className: "bg-surface border border-line rounded-[3px] px-2 py-1 text-[12.5px] text-ink focus:outline-none focus:border-gov disabled:opacity-50", "aria-label": t("pages.controlCenter.profileLabel"), children: profiles.map((p) => (_jsx("option", { value: p.id, children: p.label }, p.id))) }) }), _jsx("button", { type: "button", onClick: () => {
317
- onBindingChange(agent.name, agent.runtimeProfileId, !agent.enabled);
318
- }, disabled: isSaving, className: agent.enabled
319
- ? "border border-gov bg-gov text-paper rounded-[3px] px-[14px] py-[6px] text-[12.5px] font-medium hover:bg-gov-2 transition-colors disabled:opacity-50"
320
- : "border border-line bg-surface text-ink rounded-[3px] px-[14px] py-[6px] text-[12.5px] font-medium hover:border-line-2 transition-colors disabled:opacity-50", "aria-label": agent.enabled
321
- ? t("pages.controlCenter.agentDisabled")
322
- : t("pages.controlCenter.agentEnabled"), children: isSaving
323
- ? t("pages.controlCenter.saving")
324
- : agent.enabled
325
- ? t("pages.controlCenter.on")
326
- : t("pages.controlCenter.off") })] }));
347
+ else if (codeChainAnyDisabled || coreAnyNeedsSetup) {
348
+ corePipelineKey = "pages.controlCenter.status.corePipelineDegraded";
349
+ }
350
+ else {
351
+ corePipelineKey = "pages.controlCenter.status.corePipelineOk";
352
+ }
353
+ return (_jsxs("div", { className: "mt-5 px-[16px] py-[11px] bg-surface border border-line-2 rounded-[4px] flex items-center gap-[16px] text-[12.5px] text-ink-3 flex-wrap", children: [_jsxs("div", { className: "flex items-center gap-[6px]", children: [_jsx("span", { className: "text-ink-4 font-mono text-[11px] uppercase tracking-[0.04em]", children: t("pages.controlCenter.status.enabled") }), _jsxs("span", { className: "text-ink font-semibold", children: [_jsx("span", { className: "font-mono", children: enabledCount }), " /", " ", _jsx("span", { className: "font-mono", children: totalCount })] })] }), _jsxs("div", { className: "flex items-center gap-[6px]", children: [_jsx("span", { className: "text-ink-4 font-mono text-[11px] uppercase tracking-[0.04em]", children: t("pages.controlCenter.status.notReady") }), _jsx("span", { className: "text-ink font-semibold", children: _jsx("span", { className: "font-mono", children: notReadyCount }) })] }), _jsxs("div", { className: "flex items-center gap-[6px]", children: [_jsx("span", { className: "text-ink-4 font-mono text-[11px] uppercase tracking-[0.04em]", children: t("pages.controlCenter.status.corePipeline") }), _jsx("span", { className: "text-ink font-semibold", children: t(corePipelineKey) })] }), needsConfig && (_jsx("span", { className: "ml-auto px-[9px] py-[3px] rounded-[2px] text-[10.5px] font-mono tracking-[0.02em] font-medium border border-amber text-amber bg-amber/10", children: t("pages.controlCenter.status.needsConfig") }))] }));
327
354
  }
328
355
  function DefaultRuntimeSelector({ currentDefault, profiles, onDefaultChange, saving, }) {
329
356
  const { t } = useTranslation();
@@ -369,7 +396,7 @@ function AdvancedDiagnostics({ config, }) {
369
396
  }) })] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("button", { type: "button", onClick: handleCopy, className: "border border-line bg-surface text-ink rounded-[3px] px-[14px] py-[6px] text-[12.5px] font-medium hover:border-line-2 transition-colors focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", children: copied ? "✓" : t("pages.controlCenter.copyDiagnostics") }), _jsx("span", { className: "text-ink-4 text-[12px]", children: t("pages.controlCenter.redactedNote") })] })] })] }));
370
397
  }
371
398
  export function ControlCenterPage() {
372
- const { t } = useTranslation();
399
+ const { t, i18n } = useTranslation();
373
400
  const [configData, setConfigData] = useState(null);
374
401
  const [catalogData, setCatalogData] = useState(null);
375
402
  const [loadingState, setLoadingState] = useState("loading");
@@ -457,7 +484,7 @@ export function ControlCenterPage() {
457
484
  };
458
485
  const overallReadiness = computeOverallReadiness(diagnostics);
459
486
  const availableProfiles = catalogData?.profiles ?? configData.runtimeProfiles;
460
- return (_jsx(PageShell, { children: _jsxs("div", { className: "animate-[pdFadeIn_400ms_ease-out]", children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.controlCenter.eyebrow") }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: t("pages.controlCenter.title") }), _jsx("p", { className: "text-ink-3 text-[14px] max-w-[760px] leading-relaxed mb-7", children: t("pages.controlCenter.subtitle") }), _jsx("section", { "aria-labelledby": "section-readiness", children: _jsx(OverallStatusCard, { readiness: overallReadiness, agents: configData.agents }) }), (() => {
487
+ return (_jsx(PageShell, { children: _jsxs("div", { className: "animate-[pdFadeIn_400ms_ease-out]", children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.controlCenter.eyebrow") }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: t("pages.controlCenter.title") }), _jsx("p", { className: "text-ink-3 text-[14px] max-w-[760px] leading-relaxed mb-7", children: t("pages.controlCenter.subtitle") }), _jsx(WorkflowDiagram, {}), _jsx(CompactStatusBar, { readiness: overallReadiness, agents: configData.agents }), (() => {
461
488
  const empathyAgent = configData.agents.find((a) => a.name === "empathyObserver" && a.enabled);
462
489
  if (!empathyAgent)
463
490
  return null;
@@ -471,5 +498,14 @@ export function ControlCenterPage() {
471
498
  if (acked)
472
499
  return null;
473
500
  return (_jsx(EmpathyObserverCostHint, { agent: empathyAgent, profiles: availableProfiles }));
474
- })(), _jsxs("section", { className: "mt-8", "aria-labelledby": "section-agents", children: [_jsx(SectionTitle, { id: "section-agents", children: t("pages.controlCenter.internalAgents") }), _jsx("p", { className: "text-ink-3 text-[13px] leading-relaxed mb-3", children: t("pages.controlCenter.internalAgentsDescription") }), _jsx("div", { className: "bg-panel border border-line rounded-[6px] px-[18px] py-[6px]", children: configData.agents.length === 0 ? (_jsx("div", { className: "py-3 text-ink-3 text-[13px]", children: "\u2014" })) : (configData.agents.map((agent) => (_jsx(AgentRow, { agent: agent, profiles: availableProfiles, onBindingChange: handleBindingChange, saving: savingAgent }, agent.name)))) })] }), _jsxs("section", { className: "mt-8", "aria-labelledby": "section-default-runtime", children: [_jsx(SectionTitle, { id: "section-default-runtime", children: t("pages.controlCenter.defaultRuntime") }), _jsx(DefaultRuntimeSelector, { currentDefault: configData.defaultRuntime, profiles: availableProfiles, onDefaultChange: handleDefaultRuntimeChange, saving: savingDefault })] }), _jsx("section", { className: "mt-8", "aria-labelledby": "section-diagnostics", children: _jsx(AdvancedDiagnostics, { config: configData }) })] }) }));
501
+ })(), _jsxs("section", { className: "mt-8", "aria-labelledby": "section-agents", children: [_jsx(SectionTitle, { id: "section-agents", children: t("pages.controlCenter.internalAgents") }), _jsx("p", { className: "text-ink-3 text-[13px] leading-relaxed mb-3", children: t("pages.controlCenter.internalAgentsDescription") }), (() => {
502
+ const { groups, unknown } = groupAgentsByDependency(configData.agents);
503
+ const locale = i18n.language.startsWith("en")
504
+ ? "en"
505
+ : "zh-CN";
506
+ return (_jsxs(_Fragment, { children: [AGENT_GROUPS.map((groupMeta) => (_jsx(AgentGroup, { groupMeta: groupMeta, agents: groups[groupMeta.id], profiles: availableProfiles, onBindingChange: handleBindingChange, saving: savingAgent, locale: locale }, groupMeta.id))), unknown.length > 0 && (_jsx("div", { className: "mt-3 px-3 py-2 border border-amber/30 border-l-2 border-l-amber rounded-[4px] bg-amber/10 text-[12.5px] text-ink-3", children: t("pages.controlCenter.unknownAgentsWarning", {
507
+ count: unknown.length,
508
+ names: unknown.map((a) => a.name).join(", "),
509
+ }) }))] }));
510
+ })()] }), _jsxs("section", { className: "mt-8", "aria-labelledby": "section-default-runtime", children: [_jsx(SectionTitle, { id: "section-default-runtime", children: t("pages.controlCenter.defaultRuntime") }), _jsx(DefaultRuntimeSelector, { currentDefault: configData.defaultRuntime, profiles: availableProfiles, onDefaultChange: handleDefaultRuntimeChange, saving: savingDefault })] }), _jsx("section", { className: "mt-8", "aria-labelledby": "section-diagnostics", children: _jsx(AdvancedDiagnostics, { config: configData }) }), _jsx("p", { className: "mt-10 pt-[18px] border-t border-line-2 text-ink-4 text-[12px] leading-[1.6] max-w-[60ch] font-mono", children: t("pages.controlCenter.footerNote") })] }) }));
475
511
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * WorkflowDiagram — PD 行为回路 4 阶段图
3
+ *
4
+ * 纯展示组件,所有文本来自 i18n。Phase 03(Owner 审批)用虚线边框 +
5
+ * gov 色调高亮,强调"人在治理中心"(品牌 Principle 3)。
6
+ *
7
+ * 视觉规格取自 design-prototype/control-center.html 第 115-151 行。
8
+ *
9
+ * rc 合规:
10
+ * - rc-1: 纯展示组件,消费 i18n 字符串(已受控),无 untrusted 数据
11
+ * - rc-8: 无 JSON 序列化路径
12
+ *
13
+ * 品牌约束(PRI-CR1 B.4.4):
14
+ * - 禁止 translateY / scale hover 效果(仅 rotate 允许用于箭头朝向)
15
+ * - 无硬编码十六进制色值,全用 token
16
+ */
17
+ export declare function WorkflowDiagram(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from "react-i18next";
3
+ import { ChevronRight, RefreshCw } from "lucide-react";
4
+ /**
5
+ * WorkflowDiagram — PD 行为回路 4 阶段图
6
+ *
7
+ * 纯展示组件,所有文本来自 i18n。Phase 03(Owner 审批)用虚线边框 +
8
+ * gov 色调高亮,强调"人在治理中心"(品牌 Principle 3)。
9
+ *
10
+ * 视觉规格取自 design-prototype/control-center.html 第 115-151 行。
11
+ *
12
+ * rc 合规:
13
+ * - rc-1: 纯展示组件,消费 i18n 字符串(已受控),无 untrusted 数据
14
+ * - rc-8: 无 JSON 序列化路径
15
+ *
16
+ * 品牌约束(PRI-CR1 B.4.4):
17
+ * - 禁止 translateY / scale hover 效果(仅 rotate 允许用于箭头朝向)
18
+ * - 无硬编码十六进制色值,全用 token
19
+ */
20
+ export function WorkflowDiagram() {
21
+ const { t } = useTranslation();
22
+ const phases = [
23
+ {
24
+ num: "01",
25
+ nameKey: "pages.controlCenter.workflow.phase01",
26
+ descKey: "pages.controlCenter.workflow.phase01Desc",
27
+ isHuman: false,
28
+ },
29
+ {
30
+ num: "02",
31
+ nameKey: "pages.controlCenter.workflow.phase02",
32
+ descKey: "pages.controlCenter.workflow.phase02Desc",
33
+ isHuman: false,
34
+ },
35
+ {
36
+ num: "03",
37
+ nameKey: "pages.controlCenter.workflow.phase03",
38
+ descKey: "pages.controlCenter.workflow.phase03Desc",
39
+ isHuman: true,
40
+ },
41
+ {
42
+ num: "04",
43
+ nameKey: "pages.controlCenter.workflow.phase04",
44
+ descKey: "pages.controlCenter.workflow.phase04Desc",
45
+ isHuman: false,
46
+ },
47
+ ];
48
+ return (_jsxs("div", { className: "mt-8 bg-surface border border-line-2 rounded-[8px] px-[22px] py-[18px]", children: [_jsxs("div", { className: "flex items-center gap-2 mb-4", children: [_jsx("span", { className: "text-[11px] font-mono uppercase tracking-[0.1em] text-ink-4 font-medium", children: t("pages.controlCenter.workflow.title") }), _jsx("span", { className: "text-[11px] font-mono uppercase tracking-[0.1em] text-ink-4", children: t("pages.controlCenter.workflow.subtitle") }), _jsx("span", { className: "flex-1 h-px bg-line-2", "aria-hidden": "true" })] }), _jsx("div", { className: "grid grid-cols-[1fr_24px_1fr_24px_1fr_24px_1fr] items-stretch", children: phases.map((phase, idx) => (_jsxs("div", { className: "contents", children: [_jsxs("div", { className: phase.isHuman
49
+ ? "px-[10px] py-[12px] text-center flex flex-col gap-[5px] justify-center border border-dashed border-gov bg-gov/10 rounded-[4px]"
50
+ : "px-[10px] py-[12px] text-center flex flex-col gap-[5px] justify-center bg-paper-2 border border-line-2 rounded-[4px]", children: [_jsx("div", { className: "text-[10px] font-mono text-ink-4 tracking-[0.06em]", children: phase.num }), _jsx("div", { className: phase.isHuman
51
+ ? "text-[14px] font-semibold text-gov tracking-[-0.005em]"
52
+ : "text-[14px] font-semibold text-ink tracking-[-0.005em]", children: t(phase.nameKey) }), _jsx("div", { className: phase.isHuman
53
+ ? "text-[11.5px] text-gov-2 italic leading-[1.45] whitespace-pre-line"
54
+ : "text-[11.5px] text-ink-3 leading-[1.45] whitespace-pre-line", children: t(phase.descKey) })] }), idx < phases.length - 1 && (_jsx("div", { className: "flex items-center justify-center text-ink-4 font-mono", children: _jsx(ChevronRight, { className: "w-[18px] h-[18px]", "aria-hidden": "true" }) }))] }, phase.num))) }), _jsxs("div", { className: "mt-[14px] pt-[12px] border-t border-line-2 flex items-center gap-[10px] text-[11.5px] text-ink-4 font-mono leading-[1.5]", children: [_jsx(RefreshCw, { className: "w-[14px] h-[14px] text-gov shrink-0", "aria-hidden": "true" }), _jsx("span", { children: t("pages.controlCenter.workflow.loopHint") })] })] }));
55
+ }
@@ -0,0 +1,67 @@
1
+ /**
2
+ * PRI-477 + spec 2026-06-27: Intent Engineering onboarding components.
3
+ *
4
+ * Three components:
5
+ * 1. OnboardingModal — 5-step wizard (intro → Why → Desired Outcome →
6
+ * Non-negotiables → Stop/Escalation → Current Strategic Focus → finish)
7
+ * 2. IntentEditor — section editor with 5 independent textareas (one per
8
+ * section), replacing the single monolithic textarea
9
+ * 3. CreateIntentButton — creates INTENT.md template, optionally shows wizard
10
+ *
11
+ * SPEC §22.1.1 update: Intent Page supports inline editing. This breaks the
12
+ * original "read-only governance view" constraint, but preserves the
13
+ * Owner-owned boundary: all edits are triggered by Owner clicking buttons,
14
+ * never by Agent auto-modification (SPEC §3.9 preserved).
15
+ *
16
+ * Architecture note: parseIntentDocSections / assembleIntentDoc are imported
17
+ * from @principles/core/runtime-v2. These are pure functions (no I/O, no
18
+ * node:crypto) and safe for the browser bundle. The crypto-dependent
19
+ * computeIntentContentHash lives in intent-hash.ts to keep intent-doc.ts
20
+ * browser-bundleable.
21
+ */
22
+ import { type IntentDocSections } from "@principles/core/runtime-v2/intent-browser";
23
+ interface OnboardingModalProps {
24
+ /** Called when user completes all 5 steps with the assembled sections */
25
+ onComplete: (sections: IntentDocSections) => void;
26
+ /** Called when user clicks "Skip" — creates empty template without wizard */
27
+ onSkip: () => void;
28
+ /** Called when user closes the modal without completing */
29
+ onClose: () => void;
30
+ }
31
+ export declare function OnboardingModal({ onComplete, onSkip, onClose }: OnboardingModalProps): import("react/jsx-runtime").JSX.Element;
32
+ interface IntentEditorProps {
33
+ /** Initial content to populate the editor (current INTENT.md content) */
34
+ initialContent: string;
35
+ /** Called after successful save — parent should refresh the summary */
36
+ onSaved: () => void;
37
+ /** Called when user cancels editing — parent should hide the editor */
38
+ onCancel: () => void;
39
+ /** Language for bilingual INTENT.md */
40
+ lang: 'zh-CN' | 'en';
41
+ }
42
+ export declare function IntentEditor({ initialContent, onSaved, onCancel, lang }: IntentEditorProps): import("react/jsx-runtime").JSX.Element;
43
+ interface CreateIntentButtonProps {
44
+ /**
45
+ * Called after INTENT.md is successfully created (or already existed).
46
+ * Receives `openEditor` so the parent (IntentPage) can split the two
47
+ * concerns of the create flow:
48
+ * - always: refresh the summary so NotFoundBanner updates to sections
49
+ * - optionally: open the inline editor immediately afterwards
50
+ *
51
+ * PR-1083 review (CodeRabbit A5): previously this was `() => void` and only
52
+ * invoked when openEditor was true — so the Skip path left NotFoundBanner
53
+ * showing stale "file not found" state after a successful create.
54
+ */
55
+ onCreated: (openEditor: boolean) => void;
56
+ /** If true, show onboarding wizard before creating. If false, create directly. */
57
+ showOnboarding?: boolean;
58
+ /** Language for bilingual INTENT.md */
59
+ lang: 'zh-CN' | 'en';
60
+ }
61
+ export declare function CreateIntentButton({ onCreated, showOnboarding, lang }: CreateIntentButtonProps): import("react/jsx-runtime").JSX.Element;
62
+ interface EditButtonProps {
63
+ onClick: () => void;
64
+ loading?: boolean;
65
+ }
66
+ export declare function EditButton({ onClick, loading }: EditButtonProps): import("react/jsx-runtime").JSX.Element;
67
+ export {};