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.
- package/console/dist/server/config/pd-config-store.js +49 -12
- package/console/dist/server/index.js +4 -3
- package/console/dist/server/models/IntentPageModel.d.ts +36 -2
- package/console/dist/server/models/IntentPageModel.js +213 -11
- package/console/dist/server/routes/intent.d.ts +5 -1
- package/console/dist/server/routes/intent.js +200 -12
- package/console/dist/types.d.ts +1 -0
- package/console/dist/ui/App.js +0 -53
- package/console/dist/ui/api.d.ts +18 -4
- package/console/dist/ui/api.js +38 -5
- package/console/dist/ui/components/layout/app-sidebar.js +12 -12
- package/console/dist/ui/components/ui/badge.d.ts +1 -1
- package/console/dist/ui/i18n/en.json +142 -3
- package/console/dist/ui/i18n/zh-CN.json +142 -3
- package/console/dist/ui/pages/control-center/AgentCard.d.ts +31 -0
- package/console/dist/ui/pages/control-center/AgentCard.js +156 -0
- package/console/dist/ui/pages/control-center/AgentGroup.d.ts +26 -0
- package/console/dist/ui/pages/control-center/AgentGroup.js +38 -0
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +77 -41
- package/console/dist/ui/pages/control-center/WorkflowDiagram.d.ts +17 -0
- package/console/dist/ui/pages/control-center/WorkflowDiagram.js +55 -0
- package/console/dist/ui/pages/intent/IntentOnboarding.d.ts +67 -0
- package/console/dist/ui/pages/intent/IntentOnboarding.js +289 -0
- package/console/dist/ui/pages/intent/IntentPage.js +117 -6
- package/console/dist/ui/utils/agent-metadata.d.ts +58 -0
- package/console/dist/ui/utils/agent-metadata.js +275 -0
- package/console/dist/ui/utils/control-center-helpers.d.ts +19 -0
- package/console/dist/ui/utils/control-center-helpers.js +37 -0
- package/console/dist/ui/utils/validators.d.ts +37 -0
- package/console/dist/ui/utils/validators.js +130 -0
- package/console/dist/web/assets/app.css +360 -3
- package/console/dist/web/assets/app.js +2952 -1143
- package/console/package.json +1 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +27 -35
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +85 -7
- package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js +70 -0
- package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/golden-trace.test.js +136 -1
- package/core/dist/runtime-v2/__tests__/golden-trace.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js +211 -0
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +93 -0
- package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts +11 -0
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.js +22 -0
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js +74 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js +246 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +7 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.js +2 -0
- package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
- package/{plugin/dist/core/surface-guard.d.ts → core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts} +15 -5
- package/core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts.map +1 -0
- package/{plugin/dist/core/surface-guard.js → core/dist/runtime-v2/feature-flags/surface-guard-policy.js} +14 -2
- package/core/dist/runtime-v2/feature-flags/surface-guard-policy.js.map +1 -0
- package/core/dist/runtime-v2/golden-trace-replay-validator.js +1 -1
- package/core/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -1
- package/core/dist/runtime-v2/golden-trace.d.ts +19 -3
- package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
- package/core/dist/runtime-v2/golden-trace.js +2 -0
- package/core/dist/runtime-v2/golden-trace.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +15 -3
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +11 -2
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts +2 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js +88 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js +91 -1
- package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js.map +1 -1
- package/core/dist/runtime-v2/intent/index.d.ts +2 -0
- package/core/dist/runtime-v2/intent/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/intent/index.js +2 -0
- package/core/dist/runtime-v2/intent/index.js.map +1 -1
- package/core/dist/runtime-v2/intent/intent-browser.d.ts +23 -0
- package/core/dist/runtime-v2/intent/intent-browser.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-browser.js +21 -0
- package/core/dist/runtime-v2/intent/intent-browser.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.d.ts +28 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.js +21 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc.d.ts +17 -1
- package/core/dist/runtime-v2/intent/intent-doc.d.ts.map +1 -1
- package/core/dist/runtime-v2/intent/intent-doc.js +95 -7
- package/core/dist/runtime-v2/intent/intent-doc.js.map +1 -1
- package/core/dist/runtime-v2/intent/intent-hash.d.ts +2 -0
- package/core/dist/runtime-v2/intent/intent-hash.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-hash.js +10 -0
- package/core/dist/runtime-v2/intent/intent-hash.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js +41 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +130 -2
- package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js +228 -0
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +41 -11
- package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js +135 -0
- package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js +449 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/adversarial-case.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/adversarial-case.js +24 -0
- package/core/dist/runtime-v2/internalization/adversarial-case.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-output.d.ts +10 -0
- package/core/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-output.js +45 -0
- package/core/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +2 -2
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js +7 -2
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts +66 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.js +183 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.js.map +1 -0
- package/core/dist/runtime-v2/internalization/evaluator-output.d.ts +8 -0
- package/core/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-output.js +10 -0
- package/core/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +17 -0
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.js +118 -24
- package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +1 -1
- package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
- package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts +61 -0
- package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/rule-context-v2.js +301 -0
- package/core/dist/runtime-v2/internalization/rule-context-v2.js.map +1 -0
- package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +9 -0
- package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts +55 -0
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js +131 -0
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js.map +1 -0
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +24 -1
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts +2 -0
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js +95 -0
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/risk/index.d.ts +7 -0
- package/core/dist/runtime-v2/risk/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/risk/index.js +6 -0
- package/core/dist/runtime-v2/risk/index.js.map +1 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts +18 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.js +47 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.js.map +1 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts +2 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js +83 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js.map +1 -0
- package/core/dist/runtime-v2/store/intent/index.d.ts +2 -1
- package/core/dist/runtime-v2/store/intent/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/intent/index.js +2 -1
- package/core/dist/runtime-v2/store/intent/index.js.map +1 -1
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts +28 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js +88 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js.map +1 -0
- package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/sqlite-connection.js +14 -0
- package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts +2 -0
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js +149 -0
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/thinking-models/index.d.ts +3 -0
- package/core/dist/runtime-v2/thinking-models/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/thinking-models/index.js +3 -0
- package/core/dist/runtime-v2/thinking-models/index.js.map +1 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts +73 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js +227 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js.map +1 -0
- package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +40 -1
- package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js +28 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts +3 -0
- package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-output-typebox.js +3 -0
- package/core/dist/runtime-v2/tools/artificer-output-typebox.js.map +1 -1
- package/core/package.json +4 -0
- package/package.json +1 -1
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js +74 -3
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js.map +1 -1
- package/pd-cli/dist/commands/intent.d.ts +21 -4
- package/pd-cli/dist/commands/intent.d.ts.map +1 -1
- package/pd-cli/dist/commands/intent.js +88 -27
- package/pd-cli/dist/commands/intent.js.map +1 -1
- package/plugin/dist/commands/pain.js +2 -2
- package/plugin/dist/core/behavior-example-pack-assembler.d.ts +43 -0
- package/plugin/dist/core/behavior-example-pack-assembler.js +247 -0
- package/plugin/dist/core/intent-doc-reader-adapter.d.ts +13 -5
- package/plugin/dist/core/intent-doc-reader-adapter.js +25 -5
- package/plugin/dist/core/intent-doc-reader.d.ts +13 -4
- package/plugin/dist/core/intent-doc-reader.js +45 -24
- package/plugin/dist/core/rule-context-assembler.d.ts +45 -0
- package/plugin/dist/core/rule-context-assembler.js +148 -0
- package/plugin/dist/core/thinking-models.d.ts +12 -57
- package/plugin/dist/core/thinking-models.js +18 -224
- package/plugin/dist/core/trajectory-types.d.ts +18 -0
- package/plugin/dist/core/trajectory.d.ts +34 -2
- package/plugin/dist/core/trajectory.js +103 -0
- package/plugin/dist/hooks/gate.js +59 -2
- package/plugin/dist/hooks/pain.js +2 -2
- package/plugin/dist/hooks/prompt.js +2 -1
- package/plugin/dist/index.js +1 -1
- package/plugin/package.json +1 -1
- package/plugin/dist/core/evolution-migration.d.ts +0 -5
- package/plugin/dist/core/evolution-migration.js +0 -65
- package/plugin/dist/core/risk-calculator.d.ts +0 -22
- package/plugin/dist/core/risk-calculator.js +0 -88
- package/plugin/dist/core/rule-host-helpers.d.ts +0 -8
- package/plugin/dist/core/rule-host-helpers.js +0 -7
- package/plugin/dist/core/rule-host-types.d.ts +0 -7
- package/plugin/dist/core/rule-host-types.js +0 -7
- package/plugin/dist/core/schema/db-types.d.ts +0 -11
- package/plugin/dist/core/schema/db-types.js +0 -5
- package/plugin/dist/core/schema/index.d.ts +0 -17
- package/plugin/dist/core/schema/index.js +0 -15
- package/plugin/dist/core/schema/migration-runner.d.ts +0 -53
- package/plugin/dist/core/schema/migration-runner.js +0 -170
- package/plugin/dist/core/schema/migrations/001-init-trajectory.d.ts +0 -6
- package/plugin/dist/core/schema/migrations/001-init-trajectory.js +0 -190
- package/plugin/dist/core/schema/migrations/002-init-central.d.ts +0 -5
- package/plugin/dist/core/schema/migrations/002-init-central.js +0 -108
- package/plugin/dist/core/schema/migrations/003-init-workflow.d.ts +0 -5
- package/plugin/dist/core/schema/migrations/003-init-workflow.js +0 -50
- package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.d.ts +0 -8
- package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.js +0 -66
- package/plugin/dist/core/schema/migrations/index.d.ts +0 -16
- package/plugin/dist/core/schema/migrations/index.js +0 -27
- package/plugin/dist/core/schema/schema-definitions.d.ts +0 -46
- package/plugin/dist/core/schema/schema-definitions.js +0 -599
- package/plugin/scripts/db-migrate.mjs +0 -170
|
@@ -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;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
export interface ErrorResponse {
|
|
20
20
|
error?: string;
|
|
21
21
|
message?: string;
|
|
22
|
+
reason?: string;
|
|
22
23
|
nextAction?: string;
|
|
23
24
|
}
|
|
24
25
|
export declare function validateErrorResponse(v: unknown): ErrorResponse | null;
|
|
@@ -567,3 +568,39 @@ export interface IntentSummaryData {
|
|
|
567
568
|
export declare function validateIntentWarning(v: unknown): IntentDocWarningData | null;
|
|
568
569
|
export declare function validateIntentSections(v: unknown): IntentSectionsData | null;
|
|
569
570
|
export declare function validateIntentSummary(v: unknown): IntentSummaryData | null;
|
|
571
|
+
export interface IntentRawContentData {
|
|
572
|
+
content: string;
|
|
573
|
+
path: string;
|
|
574
|
+
}
|
|
575
|
+
export declare function validateIntentRawContent(v: unknown): IntentRawContentData | null;
|
|
576
|
+
export interface IntentInitResultData {
|
|
577
|
+
ok: boolean;
|
|
578
|
+
created: boolean;
|
|
579
|
+
path?: string;
|
|
580
|
+
reason?: string;
|
|
581
|
+
nextAction?: string;
|
|
582
|
+
}
|
|
583
|
+
export interface IntentSaveResultData {
|
|
584
|
+
ok: boolean;
|
|
585
|
+
saved: boolean;
|
|
586
|
+
path?: string;
|
|
587
|
+
contentHash?: string;
|
|
588
|
+
lastEditedAt?: string;
|
|
589
|
+
warnings?: IntentDocWarningData[];
|
|
590
|
+
reason?: string;
|
|
591
|
+
nextAction?: string;
|
|
592
|
+
}
|
|
593
|
+
export declare function validateIntentInitResult(v: unknown): IntentInitResultData | null;
|
|
594
|
+
export declare function validateIntentSaveResult(v: unknown): IntentSaveResultData | null;
|
|
595
|
+
export interface IntentVersionEntry {
|
|
596
|
+
id: string;
|
|
597
|
+
lang: string;
|
|
598
|
+
contentHash: string;
|
|
599
|
+
contentSnapshot: string;
|
|
600
|
+
reason: string;
|
|
601
|
+
createdAt: string;
|
|
602
|
+
}
|
|
603
|
+
export interface IntentVersionData {
|
|
604
|
+
versions: IntentVersionEntry[];
|
|
605
|
+
}
|
|
606
|
+
export declare function validateIntentVersions(v: unknown): IntentVersionData | null;
|
|
@@ -62,6 +62,14 @@ export function validateErrorResponse(v) {
|
|
|
62
62
|
if (Object.hasOwn(v, 'error') && isString(v.error)) {
|
|
63
63
|
result.error = v.error;
|
|
64
64
|
}
|
|
65
|
+
// N4 (PR-1083 review): surfacing the machine-readable `reason` field lets
|
|
66
|
+
// the UI branch on structured error codes instead of parsing natural
|
|
67
|
+
// language out of nextAction. Previously `nextAction.includes("32KB")`
|
|
68
|
+
// would silently regress to "saveFailed" the moment the backend phrased
|
|
69
|
+
// the cap differently or returned localized text.
|
|
70
|
+
if (Object.hasOwn(v, 'reason') && isString(v.reason)) {
|
|
71
|
+
result.reason = v.reason;
|
|
72
|
+
}
|
|
65
73
|
if (Object.hasOwn(v, 'nextAction') && isString(v.nextAction)) {
|
|
66
74
|
result.nextAction = v.nextAction;
|
|
67
75
|
}
|
|
@@ -1626,3 +1634,125 @@ export function validateIntentSummary(v) {
|
|
|
1626
1634
|
}
|
|
1627
1635
|
return result;
|
|
1628
1636
|
}
|
|
1637
|
+
export function validateIntentRawContent(v) {
|
|
1638
|
+
if (!isObject(v))
|
|
1639
|
+
return null;
|
|
1640
|
+
if (!Object.hasOwn(v, 'content') || !isString(v.content))
|
|
1641
|
+
return null;
|
|
1642
|
+
if (!Object.hasOwn(v, 'path') || !isString(v.path))
|
|
1643
|
+
return null;
|
|
1644
|
+
return { content: v.content, path: v.path };
|
|
1645
|
+
}
|
|
1646
|
+
export function validateIntentInitResult(v) {
|
|
1647
|
+
if (!isObject(v))
|
|
1648
|
+
return null;
|
|
1649
|
+
// Required fields
|
|
1650
|
+
if (!Object.hasOwn(v, 'ok') || !isBoolean(v.ok))
|
|
1651
|
+
return null;
|
|
1652
|
+
if (!Object.hasOwn(v, 'created') || !isBoolean(v.created))
|
|
1653
|
+
return null;
|
|
1654
|
+
const result = {
|
|
1655
|
+
ok: v.ok,
|
|
1656
|
+
created: v.created,
|
|
1657
|
+
};
|
|
1658
|
+
// Optional fields
|
|
1659
|
+
const path = readNullableString(v, 'path');
|
|
1660
|
+
if (!path.valid)
|
|
1661
|
+
return null;
|
|
1662
|
+
if (path.value !== null)
|
|
1663
|
+
result.path = path.value;
|
|
1664
|
+
const reason = readNullableString(v, 'reason');
|
|
1665
|
+
if (!reason.valid)
|
|
1666
|
+
return null;
|
|
1667
|
+
if (reason.value !== null)
|
|
1668
|
+
result.reason = reason.value;
|
|
1669
|
+
const nextAction = readNullableString(v, 'nextAction');
|
|
1670
|
+
if (!nextAction.valid)
|
|
1671
|
+
return null;
|
|
1672
|
+
if (nextAction.value !== null)
|
|
1673
|
+
result.nextAction = nextAction.value;
|
|
1674
|
+
return result;
|
|
1675
|
+
}
|
|
1676
|
+
export function validateIntentSaveResult(v) {
|
|
1677
|
+
if (!isObject(v))
|
|
1678
|
+
return null;
|
|
1679
|
+
// Required fields
|
|
1680
|
+
if (!Object.hasOwn(v, 'ok') || !isBoolean(v.ok))
|
|
1681
|
+
return null;
|
|
1682
|
+
if (!Object.hasOwn(v, 'saved') || !isBoolean(v.saved))
|
|
1683
|
+
return null;
|
|
1684
|
+
const result = {
|
|
1685
|
+
ok: v.ok,
|
|
1686
|
+
saved: v.saved,
|
|
1687
|
+
};
|
|
1688
|
+
// Optional fields
|
|
1689
|
+
const path = readNullableString(v, 'path');
|
|
1690
|
+
if (!path.valid)
|
|
1691
|
+
return null;
|
|
1692
|
+
if (path.value !== null)
|
|
1693
|
+
result.path = path.value;
|
|
1694
|
+
const contentHash = readNullableString(v, 'contentHash');
|
|
1695
|
+
if (!contentHash.valid)
|
|
1696
|
+
return null;
|
|
1697
|
+
if (contentHash.value !== null)
|
|
1698
|
+
result.contentHash = contentHash.value;
|
|
1699
|
+
const lastEditedAt = readNullableString(v, 'lastEditedAt');
|
|
1700
|
+
if (!lastEditedAt.valid)
|
|
1701
|
+
return null;
|
|
1702
|
+
if (lastEditedAt.value !== null)
|
|
1703
|
+
result.lastEditedAt = lastEditedAt.value;
|
|
1704
|
+
const reason = readNullableString(v, 'reason');
|
|
1705
|
+
if (!reason.valid)
|
|
1706
|
+
return null;
|
|
1707
|
+
if (reason.value !== null)
|
|
1708
|
+
result.reason = reason.value;
|
|
1709
|
+
const nextAction = readNullableString(v, 'nextAction');
|
|
1710
|
+
if (!nextAction.valid)
|
|
1711
|
+
return null;
|
|
1712
|
+
if (nextAction.value !== null)
|
|
1713
|
+
result.nextAction = nextAction.value;
|
|
1714
|
+
if (Object.hasOwn(v, 'warnings')) {
|
|
1715
|
+
if (!Array.isArray(v.warnings))
|
|
1716
|
+
return null;
|
|
1717
|
+
const warnings = validateArray(v.warnings, validateIntentWarning);
|
|
1718
|
+
if (warnings === null)
|
|
1719
|
+
return null;
|
|
1720
|
+
result.warnings = warnings;
|
|
1721
|
+
}
|
|
1722
|
+
return result;
|
|
1723
|
+
}
|
|
1724
|
+
function validateIntentVersionEntry(v) {
|
|
1725
|
+
if (!isObject(v))
|
|
1726
|
+
return null;
|
|
1727
|
+
// Required string fields — fail loud on missing or wrong type (rc-3, rc-4)
|
|
1728
|
+
if (!Object.hasOwn(v, 'id') || !isString(v.id))
|
|
1729
|
+
return null;
|
|
1730
|
+
if (!Object.hasOwn(v, 'lang') || !isString(v.lang))
|
|
1731
|
+
return null;
|
|
1732
|
+
if (!Object.hasOwn(v, 'contentHash') || !isString(v.contentHash))
|
|
1733
|
+
return null;
|
|
1734
|
+
if (!Object.hasOwn(v, 'contentSnapshot') || !isString(v.contentSnapshot))
|
|
1735
|
+
return null;
|
|
1736
|
+
if (!Object.hasOwn(v, 'reason') || !isString(v.reason))
|
|
1737
|
+
return null;
|
|
1738
|
+
if (!Object.hasOwn(v, 'createdAt') || !isString(v.createdAt))
|
|
1739
|
+
return null;
|
|
1740
|
+
return {
|
|
1741
|
+
id: v.id,
|
|
1742
|
+
lang: v.lang,
|
|
1743
|
+
contentHash: v.contentHash,
|
|
1744
|
+
contentSnapshot: v.contentSnapshot,
|
|
1745
|
+
reason: v.reason,
|
|
1746
|
+
createdAt: v.createdAt,
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
export function validateIntentVersions(v) {
|
|
1750
|
+
if (!isObject(v))
|
|
1751
|
+
return null;
|
|
1752
|
+
if (!Object.hasOwn(v, 'versions') || !Array.isArray(v.versions))
|
|
1753
|
+
return null;
|
|
1754
|
+
const versions = validateArray(v.versions, validateIntentVersionEntry);
|
|
1755
|
+
if (versions === null)
|
|
1756
|
+
return null;
|
|
1757
|
+
return { versions };
|
|
1758
|
+
}
|