create-principles-disciple 1.82.0 → 1.83.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.d.ts +135 -0
- package/console/dist/server/config/pd-config-store.js +660 -0
- package/console/dist/server/index.js +40 -389
- package/console/dist/server/models/ActivationsConsoleModel.d.ts +33 -0
- package/console/dist/server/models/ActivationsConsoleModel.js +112 -0
- package/console/dist/server/models/ApprovalsConsoleModel.d.ts +5 -0
- package/console/dist/server/models/ApprovalsConsoleModel.js +14 -0
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.d.ts +25 -0
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +126 -0
- package/console/dist/server/models/ConsoleLifecycleDatasource.d.ts +13 -0
- package/console/dist/server/models/ConsoleLifecycleDatasource.js +73 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +58 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.js +493 -0
- package/console/dist/server/models/GovernanceConsoleModel.d.ts +74 -0
- package/console/dist/server/models/GovernanceConsoleModel.js +246 -0
- package/console/dist/server/models/HealthCheckModel.d.ts +0 -4
- package/console/dist/server/models/HealthCheckModel.js +49 -80
- package/console/dist/server/models/LifecycleConsoleModel.d.ts +19 -0
- package/console/dist/server/models/LifecycleConsoleModel.js +55 -0
- package/console/dist/server/models/PrincipleClassifier.d.ts +41 -0
- package/console/dist/server/models/PrincipleClassifier.js +100 -0
- package/console/dist/server/models/PrinciplesConsoleModel.d.ts +12 -1
- package/console/dist/server/models/PrinciplesConsoleModel.js +53 -6
- package/console/dist/server/models/WorkspaceService.d.ts +2 -1
- package/console/dist/server/models/WorkspaceService.js +51 -23
- package/console/dist/server/routes/activations.d.ts +3 -0
- package/console/dist/server/routes/activations.js +111 -0
- package/console/dist/server/routes/approvals-grouped.d.ts +3 -0
- package/console/dist/server/routes/approvals-grouped.js +32 -0
- package/console/dist/server/routes/approvals.js +28 -4
- package/console/dist/server/routes/config.d.ts +27 -0
- package/console/dist/server/routes/config.js +213 -0
- package/console/dist/server/routes/evidence-chain.d.ts +9 -0
- package/console/dist/server/routes/evidence-chain.js +32 -0
- package/console/dist/server/routes/governance.d.ts +3 -0
- package/console/dist/server/routes/governance.js +32 -0
- package/console/dist/server/routes/{evolution.d.ts → lifecycle.d.ts} +2 -2
- package/console/dist/server/routes/lifecycle.js +48 -0
- package/console/dist/server/routes/principles.js +74 -1
- package/console/dist/server/routes/workspaces.js +8 -1
- package/console/dist/server/utils/response.d.ts +1 -1
- package/console/dist/server/utils/response.js +6 -2
- package/console/dist/types.d.ts +1 -0
- package/console/dist/ui/App.js +116 -40
- package/console/dist/ui/api.d.ts +88 -501
- package/console/dist/ui/api.js +139 -162
- package/console/dist/ui/components/approval-card.js +1 -1
- package/console/dist/ui/components/approval-detail-dialog.js +1 -1
- package/console/dist/ui/components/auth/login-form.d.ts +3 -0
- package/console/dist/ui/components/auth/login-form.js +36 -0
- package/console/dist/ui/components/auth/splash-screen.d.ts +8 -0
- package/console/dist/ui/components/auth/splash-screen.js +22 -0
- package/console/dist/ui/components/layout/app-sidebar.d.ts +1 -0
- package/console/dist/ui/components/layout/app-sidebar.js +56 -0
- package/console/dist/ui/components/layout/page-shell.d.ts +11 -0
- package/console/dist/ui/components/layout/page-shell.js +10 -0
- package/console/dist/ui/components/layout/section-title.d.ts +10 -0
- package/console/dist/ui/components/layout/section-title.js +9 -0
- package/console/dist/ui/components/theme-provider.d.ts +1 -1
- package/console/dist/ui/components/theme-provider.js +13 -8
- package/console/dist/ui/components/theme-toggle.js +2 -21
- package/console/dist/ui/components/ui/badge.d.ts +1 -1
- package/console/dist/ui/components/ui/badge.js +7 -5
- package/console/dist/ui/components/ui/button.d.ts +2 -2
- package/console/dist/ui/components/ui/button.js +12 -11
- package/console/dist/ui/components/ui/card.js +6 -6
- package/console/dist/ui/components/ui/sheet.d.ts +1 -1
- package/console/dist/ui/i18n/en.json +401 -343
- package/console/dist/ui/i18n/index.js +2 -2
- package/console/dist/ui/i18n/zh-CN.json +406 -348
- package/console/dist/ui/main.d.ts +1 -1
- package/console/dist/ui/main.js +1 -0
- package/console/dist/ui/pages/activation/ActivationPage.d.ts +1 -0
- package/console/dist/ui/pages/activation/ActivationPage.js +150 -0
- package/console/dist/ui/pages/activation/ActivationValidators.d.ts +20 -0
- package/console/dist/ui/pages/activation/ActivationValidators.js +156 -0
- package/console/dist/ui/pages/control-center/ControlCenterPage.d.ts +1 -0
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +447 -0
- package/console/dist/ui/pages/debt/DebtPage.d.ts +1 -0
- package/console/dist/ui/pages/debt/DebtPage.js +5 -0
- package/console/dist/ui/pages/design-system/DesignSystemPage.d.ts +1 -0
- package/console/dist/ui/pages/design-system/DesignSystemPage.js +30 -0
- package/console/dist/ui/pages/focus/FocusPage.d.ts +1 -0
- package/console/dist/ui/pages/focus/FocusPage.js +265 -0
- package/console/dist/ui/pages/pain/PainEvidenceValidators.d.ts +59 -0
- package/console/dist/ui/pages/pain/PainEvidenceValidators.js +125 -0
- package/console/dist/ui/pages/pain/PainPage.js +136 -0
- package/console/dist/ui/pages/principles/PrincipleDetailPage.js +264 -0
- package/console/dist/ui/pages/principles/PrinciplesPage.js +244 -0
- package/console/dist/ui/pages/report-problem/ReportProblemPage.js +245 -0
- package/console/dist/ui/pages/settings/SettingsPage.d.ts +4 -0
- package/console/dist/ui/pages/settings/SettingsPage.js +202 -0
- package/console/dist/ui/pages/settings/UpdatePage.d.ts +5 -0
- package/console/dist/ui/pages/settings/UpdatePage.js +168 -0
- package/console/dist/ui/utils/control-center-helpers.d.ts +58 -0
- package/console/dist/ui/utils/control-center-helpers.js +152 -0
- package/console/dist/ui/utils/validators.d.ts +350 -0
- package/console/dist/ui/utils/validators.js +995 -0
- package/console/dist/web/assets/app.css +672 -902
- package/console/dist/web/assets/app.js +6404 -15347
- package/console/dist/web/assets/jetbrains-mono-cyrillic-400-normal-C5JECUCT.woff2 +0 -0
- package/console/dist/web/assets/jetbrains-mono-cyrillic-400-normal-FGCZYWMY.woff +0 -0
- package/console/dist/web/assets/jetbrains-mono-cyrillic-ext-400-normal-C7IFWGF6.woff2 +0 -0
- package/console/dist/web/assets/jetbrains-mono-cyrillic-ext-400-normal-PWXUA557.woff +0 -0
- package/console/dist/web/assets/jetbrains-mono-greek-400-normal-JJNQZMPZ.woff +0 -0
- package/console/dist/web/assets/jetbrains-mono-greek-400-normal-O7JTTR3P.woff2 +0 -0
- package/console/dist/web/assets/jetbrains-mono-latin-400-normal-3OOWLGQ2.woff2 +0 -0
- package/console/dist/web/assets/jetbrains-mono-latin-400-normal-WDD34GPP.woff +0 -0
- package/console/dist/web/assets/jetbrains-mono-latin-ext-400-normal-55RNMRQS.woff +0 -0
- package/console/dist/web/assets/jetbrains-mono-latin-ext-400-normal-JVR3IR4Z.woff2 +0 -0
- package/console/dist/web/assets/jetbrains-mono-vietnamese-400-normal-7ULXAK72.woff +0 -0
- package/console/dist/web/assets/jetbrains-mono-vietnamese-400-normal-KU7YLUPA.woff2 +0 -0
- package/console/package.json +2 -1
- package/core/dist/runtime-v2/__tests__/admission-gate.test.js +49 -0
- package/core/dist/runtime-v2/__tests__/admission-gate.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +16 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.d.ts +21 -0
- package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.js +354 -0
- package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/language-directive.test.d.ts +12 -0
- package/core/dist/runtime-v2/__tests__/language-directive.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/language-directive.test.js +162 -0
- package/core/dist/runtime-v2/__tests__/language-directive.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js +23 -1
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +48 -3
- package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js +13 -1
- package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.d.ts +12 -0
- package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.js +194 -0
- package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/runtime-config-boundary.test.js +5 -3
- package/core/dist/runtime-v2/__tests__/runtime-config-boundary.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js +1 -0
- package/core/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/approval-queue.test.js +54 -0
- package/core/dist/runtime-v2/activation/__tests__/approval-queue.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js +15 -2
- package/core/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js +10 -0
- package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js +17 -2
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js +36 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/activation-dispatcher.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/activation-dispatcher.js +1 -1
- package/core/dist/runtime-v2/activation/activation-dispatcher.js.map +1 -1
- package/core/dist/runtime-v2/activation/activation-types.d.ts +10 -0
- package/core/dist/runtime-v2/activation/activation-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/activation-types.js.map +1 -1
- package/core/dist/runtime-v2/activation/approval-queue.d.ts +6 -0
- package/core/dist/runtime-v2/activation/approval-queue.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/approval-queue.js +3 -0
- package/core/dist/runtime-v2/activation/approval-queue.js.map +1 -1
- package/core/dist/runtime-v2/activation/memory-activation-state-store.d.ts +2 -0
- package/core/dist/runtime-v2/activation/memory-activation-state-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/memory-activation-state-store.js +17 -1
- package/core/dist/runtime-v2/activation/memory-activation-state-store.js.map +1 -1
- package/core/dist/runtime-v2/activation/memory-approval-store.d.ts +6 -0
- package/core/dist/runtime-v2/activation/memory-approval-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/memory-approval-store.js +16 -0
- package/core/dist/runtime-v2/activation/memory-approval-store.js.map +1 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +1 -1
- package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts +2 -0
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js +34 -6
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-approval-store.d.ts +6 -0
- package/core/dist/runtime-v2/activation/sqlite-approval-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-approval-store.js +10 -0
- package/core/dist/runtime-v2/activation/sqlite-approval-store.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js +51 -1
- package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js +145 -0
- package/core/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/json-extractor.d.ts +13 -0
- package/core/dist/runtime-v2/adapter/json-extractor.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/json-extractor.js +103 -0
- package/core/dist/runtime-v2/adapter/json-extractor.js.map +1 -1
- package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts +4 -2
- package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js +57 -5
- package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.d.ts +18 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +633 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js +92 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js.map +1 -1
- package/core/dist/runtime-v2/config/index.d.ts +3 -1
- package/core/dist/runtime-v2/config/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/index.js +1 -0
- package/core/dist/runtime-v2/config/index.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-agent-binding.d.ts +93 -0
- package/core/dist/runtime-v2/config/pd-config-agent-binding.d.ts.map +1 -0
- package/core/dist/runtime-v2/config/pd-config-agent-binding.js +184 -0
- package/core/dist/runtime-v2/config/pd-config-agent-binding.js.map +1 -0
- package/core/dist/runtime-v2/config/pd-config-defaults.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-defaults.js +2 -0
- package/core/dist/runtime-v2/config/pd-config-defaults.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-effective.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-effective.js +3 -0
- package/core/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-types.d.ts +8 -0
- package/core/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.d.ts +13 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.js +97 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.js.map +1 -0
- package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts +3 -2
- package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/diagnostician-prompt-builder.js +6 -4
- package/core/dist/runtime-v2/diagnostician-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/evidence-sanitizer.d.ts +57 -0
- package/core/dist/runtime-v2/evidence-sanitizer.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-sanitizer.js +213 -0
- package/core/dist/runtime-v2/evidence-sanitizer.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.d.ts +7 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.js +170 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.d.ts +18 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.js +277 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.d.ts +13 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js +264 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.d.ts +16 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.js +316 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/admission-events.d.ts +126 -0
- package/core/dist/runtime-v2/evidence-triage/admission-events.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/admission-events.js +159 -0
- package/core/dist/runtime-v2/evidence-triage/admission-events.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/index.d.ts +16 -0
- package/core/dist/runtime-v2/evidence-triage/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/index.js +13 -0
- package/core/dist/runtime-v2/evidence-triage/index.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts +48 -0
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.js +131 -0
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts +32 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.js +95 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/trigger-controller.d.ts +116 -0
- package/core/dist/runtime-v2/evidence-triage/trigger-controller.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/trigger-controller.js +218 -0
- package/core/dist/runtime-v2/evidence-triage/trigger-controller.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/types.d.ts +65 -0
- package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/types.js +38 -0
- package/core/dist/runtime-v2/evidence-triage/types.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +10 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- 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 +1 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +8 -1
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +7 -1
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.d.ts +12 -0
- package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.js +83 -0
- package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +10 -0
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js +13 -1
- package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-runner.d.ts +3 -0
- package/core/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/scribe-runner.js +2 -0
- package/core/dist/runtime-v2/internalization/scribe-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization-chain-integrity-read-model.js +1 -1
- package/core/dist/runtime-v2/internalization-chain-integrity-read-model.js.map +1 -1
- package/core/dist/runtime-v2/language-directive.d.ts +80 -0
- package/core/dist/runtime-v2/language-directive.d.ts.map +1 -0
- package/core/dist/runtime-v2/language-directive.js +108 -0
- package/core/dist/runtime-v2/language-directive.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 -11
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts +16 -0
- package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-runtime-factory.js +97 -6
- package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime-v2/pain-to-principle-service.d.ts +7 -0
- package/core/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-to-principle-service.js +2 -0
- package/core/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.d.ts.map +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js +14 -0
- package/core/dist/runtime-v2/proven-channel-baseline.js.map +1 -1
- package/core/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.js +40 -0
- package/core/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.js.map +1 -1
- package/core/dist/runtime-v2/runner/base-peer-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/runner/base-peer-runner.js +1 -0
- package/core/dist/runtime-v2/runner/base-peer-runner.js.map +1 -1
- package/core/dist/runtime-v2/runner/diagnostician-runner-options.d.ts +10 -0
- package/core/dist/runtime-v2/runner/diagnostician-runner-options.d.ts.map +1 -1
- package/core/dist/runtime-v2/runner/diagnostician-runner-options.js +1 -0
- package/core/dist/runtime-v2/runner/diagnostician-runner-options.js.map +1 -1
- package/core/dist/runtime-v2/runner/diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/runner/diagnostician-runner.js +28 -4
- package/core/dist/runtime-v2/runner/diagnostician-runner.js.map +1 -1
- package/core/dist/runtime-v2/runner/peer-runner-types.d.ts +9 -0
- package/core/dist/runtime-v2/runner/peer-runner-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/runtime-state-manager.integration.test.js +34 -1
- package/core/dist/runtime-v2/store/runtime-state-manager.integration.test.js.map +1 -1
- package/core/dist/runtime-v2/store/runtime-state-manager.js +1 -0
- package/core/dist/runtime-v2/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/sqlite-connection.js +9 -1
- package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime-v2/store/task/sqlite-task-store.js +1 -1
- package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime-v2/task-status.d.ts +4 -4
- package/core/dist/runtime-v2/task-status.d.ts.map +1 -1
- package/core/dist/runtime-v2/task-status.js +2 -2
- package/core/dist/runtime-v2/task-status.js.map +1 -1
- package/core/package.json +1 -1
- package/package.json +2 -2
- package/pd-cli/dist/commands/console.d.ts +2 -0
- package/pd-cli/dist/commands/console.d.ts.map +1 -1
- package/pd-cli/dist/commands/console.js +6 -1
- package/pd-cli/dist/commands/console.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +18 -1
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/pain-evidence.d.ts +41 -0
- package/pd-cli/dist/commands/pain-evidence.d.ts.map +1 -0
- package/pd-cli/dist/commands/pain-evidence.js +177 -0
- package/pd-cli/dist/commands/pain-evidence.js.map +1 -0
- package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-record.js +24 -9
- package/pd-cli/dist/commands/pain-record.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts +19 -0
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -0
- package/pd-cli/dist/commands/pain-retry.js +485 -0
- package/pd-cli/dist/commands/pain-retry.js.map +1 -0
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +59 -9
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-uat.d.ts +1 -0
- package/pd-cli/dist/commands/runtime-uat.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-uat.guard.test.d.ts +2 -0
- package/pd-cli/dist/commands/runtime-uat.guard.test.d.ts.map +1 -0
- package/pd-cli/dist/commands/runtime-uat.guard.test.js +155 -0
- package/pd-cli/dist/commands/runtime-uat.guard.test.js.map +1 -0
- package/pd-cli/dist/commands/runtime-uat.js +29 -3
- package/pd-cli/dist/commands/runtime-uat.js.map +1 -1
- package/pd-cli/dist/config-reader.d.ts +25 -0
- package/pd-cli/dist/config-reader.d.ts.map +1 -0
- package/pd-cli/dist/config-reader.js +109 -0
- package/pd-cli/dist/config-reader.js.map +1 -0
- package/pd-cli/dist/index.js +40 -5
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
- package/pd-cli/dist/services/console-launcher.js +29 -15
- package/pd-cli/dist/services/console-launcher.js.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.js +1 -0
- package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
- package/pd-cli/dist/utils/production-workspace-guard.d.ts +77 -0
- package/pd-cli/dist/utils/production-workspace-guard.d.ts.map +1 -0
- package/pd-cli/dist/utils/production-workspace-guard.js +170 -0
- package/pd-cli/dist/utils/production-workspace-guard.js.map +1 -0
- package/pd-cli/dist/utils/production-workspace-guard.test.d.ts +2 -0
- package/pd-cli/dist/utils/production-workspace-guard.test.d.ts.map +1 -0
- package/pd-cli/dist/utils/production-workspace-guard.test.js +95 -0
- package/pd-cli/dist/utils/production-workspace-guard.test.js.map +1 -0
- package/pd-cli/package.json +1 -1
- package/plugin/dist/commands/pain.js +27 -2
- package/plugin/dist/core/pain-diagnostic-gate.d.ts +6 -0
- package/plugin/dist/core/pain-diagnostic-gate.js +9 -0
- package/plugin/dist/hooks/after-tool-call-helpers.d.ts +90 -0
- package/plugin/dist/hooks/after-tool-call-helpers.js +486 -0
- package/plugin/dist/hooks/after-tool-call-types.d.ts +92 -0
- package/plugin/dist/hooks/after-tool-call-types.js +13 -0
- package/plugin/dist/hooks/gate-block-helper.js +73 -29
- package/plugin/dist/hooks/llm.js +49 -29
- package/plugin/dist/hooks/message-sanitize.d.ts +21 -0
- package/plugin/dist/hooks/message-sanitize.js +30 -0
- package/plugin/dist/hooks/pain.d.ts +26 -3
- package/plugin/dist/hooks/pain.js +165 -425
- package/plugin/dist/hooks/prompt.js +3 -2
- package/plugin/dist/hooks/trajectory-evidence.d.ts +11 -0
- package/plugin/dist/hooks/trajectory-evidence.js +65 -0
- package/plugin/dist/hooks/triage-adapter.d.ts +82 -0
- package/plugin/dist/hooks/triage-adapter.js +121 -0
- package/console/dist/server/models/EventLogReadModel.d.ts +0 -33
- package/console/dist/server/models/EventLogReadModel.js +0 -218
- package/console/dist/server/models/EvolutionConsoleModel.d.ts +0 -79
- package/console/dist/server/models/EvolutionConsoleModel.js +0 -179
- package/console/dist/server/models/FeedbackConsoleModel.d.ts +0 -38
- package/console/dist/server/models/FeedbackConsoleModel.js +0 -129
- package/console/dist/server/models/GateConsoleModel.d.ts +0 -50
- package/console/dist/server/models/GateConsoleModel.js +0 -151
- package/console/dist/server/models/OverviewConsoleModel.d.ts +0 -22
- package/console/dist/server/models/OverviewConsoleModel.js +0 -202
- package/console/dist/server/models/PipelineStatsModel.d.ts +0 -35
- package/console/dist/server/models/PipelineStatsModel.js +0 -129
- package/console/dist/server/models/SampleConsoleModel.d.ts +0 -21
- package/console/dist/server/models/SampleConsoleModel.js +0 -188
- package/console/dist/server/models/ThinkingModelsConsoleModel.d.ts +0 -22
- package/console/dist/server/models/ThinkingModelsConsoleModel.js +0 -75
- package/console/dist/server/routes/agents.d.ts +0 -3
- package/console/dist/server/routes/agents.js +0 -442
- package/console/dist/server/routes/central.d.ts +0 -5
- package/console/dist/server/routes/central.js +0 -31
- package/console/dist/server/routes/events.d.ts +0 -10
- package/console/dist/server/routes/events.js +0 -99
- package/console/dist/server/routes/evolution.js +0 -73
- package/console/dist/server/routes/feedback.d.ts +0 -3
- package/console/dist/server/routes/feedback.js +0 -65
- package/console/dist/server/routes/gates.d.ts +0 -3
- package/console/dist/server/routes/gates.js +0 -52
- package/console/dist/server/routes/overview.d.ts +0 -3
- package/console/dist/server/routes/overview.js +0 -49
- package/console/dist/server/routes/pipeline.d.ts +0 -3
- package/console/dist/server/routes/pipeline.js +0 -33
- package/console/dist/server/routes/samples.d.ts +0 -3
- package/console/dist/server/routes/samples.js +0 -101
- package/console/dist/server/routes/thinking-models.d.ts +0 -3
- package/console/dist/server/routes/thinking-models.js +0 -54
- package/console/dist/ui/components/app-sidebar.d.ts +0 -7
- package/console/dist/ui/components/app-sidebar.js +0 -75
- package/console/dist/ui/components/compare-view.d.ts +0 -7
- package/console/dist/ui/components/compare-view.js +0 -32
- package/console/dist/ui/components/data-freshness-indicator.d.ts +0 -10
- package/console/dist/ui/components/data-freshness-indicator.js +0 -63
- package/console/dist/ui/components/health-diagnostic-card.d.ts +0 -15
- package/console/dist/ui/components/health-diagnostic-card.js +0 -42
- package/console/dist/ui/components/page-header.d.ts +0 -10
- package/console/dist/ui/components/page-header.js +0 -37
- package/console/dist/ui/hooks/useAutoRefresh.d.ts +0 -13
- package/console/dist/ui/hooks/useAutoRefresh.js +0 -64
- package/console/dist/ui/hooks/useBookmarks.d.ts +0 -6
- package/console/dist/ui/hooks/useBookmarks.js +0 -43
- package/console/dist/ui/hooks/useDebounce.d.ts +0 -2
- package/console/dist/ui/hooks/useDebounce.js +0 -32
- package/console/dist/ui/hooks/useKeyboardNavigation.d.ts +0 -14
- package/console/dist/ui/hooks/useKeyboardNavigation.js +0 -75
- package/console/dist/ui/pages/AgentsPage.d.ts +0 -1
- package/console/dist/ui/pages/AgentsPage.js +0 -167
- package/console/dist/ui/pages/ApprovalsPage.d.ts +0 -1
- package/console/dist/ui/pages/ApprovalsPage.js +0 -123
- package/console/dist/ui/pages/CentralPage.d.ts +0 -1
- package/console/dist/ui/pages/CentralPage.js +0 -57
- package/console/dist/ui/pages/DataFlowPage.d.ts +0 -1
- package/console/dist/ui/pages/DataFlowPage.js +0 -158
- package/console/dist/ui/pages/EventLogPage.d.ts +0 -1
- package/console/dist/ui/pages/EventLogPage.js +0 -176
- package/console/dist/ui/pages/EvolutionPage.d.ts +0 -1
- package/console/dist/ui/pages/EvolutionPage.js +0 -118
- package/console/dist/ui/pages/FeedbackPage.d.ts +0 -1
- package/console/dist/ui/pages/FeedbackPage.js +0 -46
- package/console/dist/ui/pages/GatesPage.d.ts +0 -1
- package/console/dist/ui/pages/GatesPage.js +0 -31
- package/console/dist/ui/pages/LoginPage.d.ts +0 -5
- package/console/dist/ui/pages/LoginPage.js +0 -39
- package/console/dist/ui/pages/OverviewPage.d.ts +0 -1
- package/console/dist/ui/pages/OverviewPage.js +0 -50
- package/console/dist/ui/pages/PainPage.js +0 -50
- package/console/dist/ui/pages/PrincipleDetailPage.js +0 -145
- package/console/dist/ui/pages/PrinciplesPage.js +0 -322
- package/console/dist/ui/pages/ReportProblemPage.js +0 -186
- package/console/dist/ui/pages/SamplesPage.d.ts +0 -1
- package/console/dist/ui/pages/SamplesPage.js +0 -105
- package/console/dist/ui/pages/SettingsPage.d.ts +0 -1
- package/console/dist/ui/pages/SettingsPage.js +0 -86
- package/console/dist/ui/pages/TasksPage.d.ts +0 -1
- package/console/dist/ui/pages/TasksPage.js +0 -373
- package/console/dist/ui/pages/ThinkingModelsPage.d.ts +0 -1
- package/console/dist/ui/pages/ThinkingModelsPage.js +0 -32
- package/console/dist/ui/pages/UpdatePage.d.ts +0 -1
- package/console/dist/ui/pages/UpdatePage.js +0 -142
- /package/console/dist/ui/pages/{PainPage.d.ts → pain/PainPage.d.ts} +0 -0
- /package/console/dist/ui/pages/{PrincipleDetailPage.d.ts → principles/PrincipleDetailPage.d.ts} +0 -0
- /package/console/dist/ui/pages/{PrinciplesPage.d.ts → principles/PrinciplesPage.d.ts} +0 -0
- /package/console/dist/ui/pages/{ReportProblemPage.d.ts → report-problem/ReportProblemPage.d.ts} +0 -0
|
@@ -17,6 +17,7 @@ import { evaluatePainDiagnosticGate } from '../core/pain-diagnostic-gate.js';
|
|
|
17
17
|
import { emitPainDetectedEvent, buildTrajectoryEvidence } from './pain.js';
|
|
18
18
|
import { CorrectionCueLearner } from '../core/correction-cue-learner.js';
|
|
19
19
|
import { detectCorrectionCue as coreDetectCorrectionCue, extractMessageContent, isMinimalTrigger, } from '@principles/core/prompt-builder';
|
|
20
|
+
import { sanitizeForEvidence } from './message-sanitize.js';
|
|
20
21
|
// ---------------------------------------------------------------------------
|
|
21
22
|
// Static file cache — avoids re-reading rarely-changing files every message
|
|
22
23
|
// ---------------------------------------------------------------------------
|
|
@@ -452,7 +453,7 @@ The empathy observer subagent handles pain detection independently.
|
|
|
452
453
|
confidence: result.confidence,
|
|
453
454
|
detection_mode: 'structured',
|
|
454
455
|
deduped: false,
|
|
455
|
-
trigger_text_excerpt: latestUserMessage.substring(0, 120),
|
|
456
|
+
trigger_text_excerpt: sanitizeForEvidence(latestUserMessage, workspaceDir).substring(0, 120),
|
|
456
457
|
raw_score: painScore,
|
|
457
458
|
calibrated_score: painScore,
|
|
458
459
|
eventId,
|
|
@@ -466,7 +467,7 @@ The empathy observer subagent handles pain detection independently.
|
|
|
466
467
|
severity: result.severity,
|
|
467
468
|
origin: 'system_infer',
|
|
468
469
|
confidence: result.confidence,
|
|
469
|
-
text: latestUserMessage,
|
|
470
|
+
text: sanitizeForEvidence(latestUserMessage, workspaceDir),
|
|
470
471
|
});
|
|
471
472
|
}
|
|
472
473
|
catch (error) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory Evidence Builder — PRI-326
|
|
3
|
+
*
|
|
4
|
+
* Extracted from pain.ts to avoid circular imports between
|
|
5
|
+
* pain.ts and after-tool-call-helpers.ts.
|
|
6
|
+
*
|
|
7
|
+
* Pure data extraction — reads from trajectory DB, sanitizes, returns evidence entries.
|
|
8
|
+
*/
|
|
9
|
+
import type { PainEvidenceEntry } from '@principles/core/runtime-v2';
|
|
10
|
+
import type { WorkspaceContext } from '../core/workspace-context.js';
|
|
11
|
+
export declare function buildTrajectoryEvidence(wctx: WorkspaceContext, sessionId: string): PainEvidenceEntry[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory Evidence Builder — PRI-326
|
|
3
|
+
*
|
|
4
|
+
* Extracted from pain.ts to avoid circular imports between
|
|
5
|
+
* pain.ts and after-tool-call-helpers.ts.
|
|
6
|
+
*
|
|
7
|
+
* Pure data extraction — reads from trajectory DB, sanitizes, returns evidence entries.
|
|
8
|
+
*/
|
|
9
|
+
import { sanitizeAssistantText } from './message-sanitize.js';
|
|
10
|
+
import { MAX_EVIDENCE_ENTRIES, MAX_EVIDENCE_NOTE_CHARS } from '@principles/core/runtime-v2';
|
|
11
|
+
export function buildTrajectoryEvidence(wctx, sessionId) {
|
|
12
|
+
const evidence = [];
|
|
13
|
+
if (!wctx.trajectory || sessionId === 'unknown') {
|
|
14
|
+
evidence.push({
|
|
15
|
+
sourceRef: 'owner_message:unavailable',
|
|
16
|
+
note: `trajectory_unavailable: ${!wctx.trajectory ? 'no_trajectory_db' : 'unknown_session'}`,
|
|
17
|
+
});
|
|
18
|
+
return evidence.slice(0, MAX_EVIDENCE_ENTRIES);
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const userTurns = wctx.trajectory.listUserTurnsForSession(sessionId) ?? [];
|
|
22
|
+
const lastCorrectionTurn = [...userTurns].reverse().find(t => t.correctionDetected);
|
|
23
|
+
if (lastCorrectionTurn) {
|
|
24
|
+
const sanitizedOwnerMessage = sanitizeAssistantText((lastCorrectionTurn.rawExcerpt ?? '').slice(0, MAX_EVIDENCE_NOTE_CHARS));
|
|
25
|
+
evidence.push({
|
|
26
|
+
sourceRef: `owner_message:${lastCorrectionTurn.createdAt}`,
|
|
27
|
+
note: sanitizedOwnerMessage,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
evidence.push({
|
|
33
|
+
sourceRef: 'owner_message:unavailable',
|
|
34
|
+
note: `trajectory_user_turns_unavailable: ${String(e).slice(0, 100)}`,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const assistantTurns = wctx.trajectory.listAssistantTurns(sessionId) ?? [];
|
|
39
|
+
const recentAssistant = assistantTurns.slice(-3);
|
|
40
|
+
for (const turn of recentAssistant) {
|
|
41
|
+
if (evidence.length >= MAX_EVIDENCE_ENTRIES)
|
|
42
|
+
break;
|
|
43
|
+
const sanitizedNote = sanitizeAssistantText((turn.sanitizedText ?? '').slice(0, MAX_EVIDENCE_NOTE_CHARS));
|
|
44
|
+
evidence.push({
|
|
45
|
+
sourceRef: `agent_turn:${turn.createdAt}`,
|
|
46
|
+
note: sanitizedNote,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
if (evidence.length < MAX_EVIDENCE_ENTRIES) {
|
|
52
|
+
evidence.push({
|
|
53
|
+
sourceRef: 'agent_turn:unavailable',
|
|
54
|
+
note: `trajectory_assistant_turns_unavailable: ${String(e).slice(0, 100)}`,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (evidence.length === 0) {
|
|
59
|
+
evidence.push({
|
|
60
|
+
sourceRef: 'trajectory:empty',
|
|
61
|
+
note: 'trajectory_available_but_empty: no user correction or assistant turns found',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return evidence.slice(0, MAX_EVIDENCE_ENTRIES);
|
|
65
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triage Adapter — PEAT-B1
|
|
3
|
+
*
|
|
4
|
+
* Plugin-side adapter that maps OpenClaw hook context to evidence triage input.
|
|
5
|
+
* Calls the pure triage policy from principles-core.
|
|
6
|
+
*
|
|
7
|
+
* This file lives in openclaw-plugin because it:
|
|
8
|
+
* - Maps hook-specific context (source strings, session state) to SourceKind
|
|
9
|
+
* - Wraps evaluatePainDiagnosticGate as a compatibility sub-policy
|
|
10
|
+
* - Knows about OpenClaw hook conventions (sessionId, toolName, etc.)
|
|
11
|
+
*
|
|
12
|
+
* It does NOT expose evaluatePainDiagnosticGate to core.
|
|
13
|
+
* Core only sees SourceKind and TriageResult.
|
|
14
|
+
*
|
|
15
|
+
* ERR checklist:
|
|
16
|
+
* - ERR-001: Source kind derived from runtime values with guards, not `as` casts.
|
|
17
|
+
* - ERR-002: Every triage result carries reason + nextAction.
|
|
18
|
+
* - ERR-024/025/048: Production-path tests cover this adapter.
|
|
19
|
+
*/
|
|
20
|
+
import { type TriageResult, type SourceKind } from '@principles/core/runtime-v2';
|
|
21
|
+
/**
|
|
22
|
+
* Map after_tool_call hook context to SourceKind.
|
|
23
|
+
*
|
|
24
|
+
* Classifies based on:
|
|
25
|
+
* - toolName: 'pain' or 'skill:pain' → agent_on_owner_request
|
|
26
|
+
* - failureSource: 'dispatch_error' vs 'tool_failure'
|
|
27
|
+
* - isRisky + score: only used for rulehost_block upgrade, not for kind resolution
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveSourceKindFromToolFailure(toolName: string | undefined, failureSource: 'tool_failure' | 'dispatch_error', provenance?: 'openclaw_context_bound' | 'owner_reported_no_host_trace' | 'automatic_hook'): SourceKind;
|
|
30
|
+
/**
|
|
31
|
+
* Map empathy/semantic detection context to SourceKind.
|
|
32
|
+
*
|
|
33
|
+
* Classifies based on detection source prefix:
|
|
34
|
+
* - 'llm_paralysis' → llm_paralysis
|
|
35
|
+
* - 'llm_*' (detection rule) → semantic
|
|
36
|
+
* - 'user_empathy' or empathy keyword match → empathy_inferred
|
|
37
|
+
* - GFI threshold crossed → gfi_threshold
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveSourceKindFromLlmDetection(detectionSource: string, isGfiTriggered: boolean): SourceKind;
|
|
40
|
+
/**
|
|
41
|
+
* Map gate-block context to SourceKind.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveSourceKindFromGateBlock(): SourceKind;
|
|
44
|
+
/**
|
|
45
|
+
* Map /pd-pain command to SourceKind.
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveSourceKindFromCommand(): SourceKind;
|
|
48
|
+
/**
|
|
49
|
+
* Map provider/rate-limit failure to SourceKind.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveSourceKindFromProvider(isRateLimit: boolean): SourceKind;
|
|
52
|
+
/**
|
|
53
|
+
* Map subagent error to SourceKind.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveSourceKindFromSubagent(): SourceKind;
|
|
56
|
+
/**
|
|
57
|
+
* Evaluate evidence triage for a given source kind and context.
|
|
58
|
+
*
|
|
59
|
+
* This is the main entry point for hooks. It calls the pure triage policy
|
|
60
|
+
* from principles-core and returns the result.
|
|
61
|
+
*
|
|
62
|
+
* The caller (hook) is responsible for:
|
|
63
|
+
* - Checking the painEvidenceAdmission feature flag
|
|
64
|
+
* - Acting on the triage result (proceed to diagnosis, store evidence, etc.)
|
|
65
|
+
* - Falling back to existing behavior when the flag is off
|
|
66
|
+
*/
|
|
67
|
+
export declare function evaluateEvidenceTriage(sourceKind: SourceKind, score: number, options?: {
|
|
68
|
+
isUnsafeHighConfidence?: boolean;
|
|
69
|
+
provenance?: 'openclaw_context_bound' | 'owner_reported_no_host_trace' | 'automatic_hook';
|
|
70
|
+
}): TriageResult;
|
|
71
|
+
/**
|
|
72
|
+
* Determine if a gate-blocked action is a high-confidence unsafe action.
|
|
73
|
+
*
|
|
74
|
+
* This is a heuristic that the plugin adapter owns. Core does not know about
|
|
75
|
+
* these heuristics — it only receives the boolean flag.
|
|
76
|
+
*
|
|
77
|
+
* Criteria for high-confidence unsafe:
|
|
78
|
+
* - Score >= 70 (high severity)
|
|
79
|
+
* - Tool is in the risky write set
|
|
80
|
+
* - Action would be irreversible (file deletion, force push, etc.)
|
|
81
|
+
*/
|
|
82
|
+
export declare function isHighConfidenceUnsafeAction(score: number, isRisky: boolean): boolean;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triage Adapter — PEAT-B1
|
|
3
|
+
*
|
|
4
|
+
* Plugin-side adapter that maps OpenClaw hook context to evidence triage input.
|
|
5
|
+
* Calls the pure triage policy from principles-core.
|
|
6
|
+
*
|
|
7
|
+
* This file lives in openclaw-plugin because it:
|
|
8
|
+
* - Maps hook-specific context (source strings, session state) to SourceKind
|
|
9
|
+
* - Wraps evaluatePainDiagnosticGate as a compatibility sub-policy
|
|
10
|
+
* - Knows about OpenClaw hook conventions (sessionId, toolName, etc.)
|
|
11
|
+
*
|
|
12
|
+
* It does NOT expose evaluatePainDiagnosticGate to core.
|
|
13
|
+
* Core only sees SourceKind and TriageResult.
|
|
14
|
+
*
|
|
15
|
+
* ERR checklist:
|
|
16
|
+
* - ERR-001: Source kind derived from runtime values with guards, not `as` casts.
|
|
17
|
+
* - ERR-002: Every triage result carries reason + nextAction.
|
|
18
|
+
* - ERR-024/025/048: Production-path tests cover this adapter.
|
|
19
|
+
*/
|
|
20
|
+
import { evaluateTriage, } from '@principles/core/runtime-v2';
|
|
21
|
+
// ── Source Kind Resolution ───────────────────────────────────────────────────
|
|
22
|
+
/**
|
|
23
|
+
* Map after_tool_call hook context to SourceKind.
|
|
24
|
+
*
|
|
25
|
+
* Classifies based on:
|
|
26
|
+
* - toolName: 'pain' or 'skill:pain' → agent_on_owner_request
|
|
27
|
+
* - failureSource: 'dispatch_error' vs 'tool_failure'
|
|
28
|
+
* - isRisky + score: only used for rulehost_block upgrade, not for kind resolution
|
|
29
|
+
*/
|
|
30
|
+
export function resolveSourceKindFromToolFailure(toolName, failureSource, provenance) {
|
|
31
|
+
// Manual pain via agent tool call
|
|
32
|
+
if (toolName === 'pain' || toolName === 'skill:pain') {
|
|
33
|
+
return provenance === 'openclaw_context_bound' ? 'agent_on_owner_request' : 'owner_reported';
|
|
34
|
+
}
|
|
35
|
+
// Dispatch errors (tool not found, unknown tool)
|
|
36
|
+
if (failureSource === 'dispatch_error') {
|
|
37
|
+
return 'dispatch_error';
|
|
38
|
+
}
|
|
39
|
+
// Regular tool failure
|
|
40
|
+
return 'tool_failure';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Map empathy/semantic detection context to SourceKind.
|
|
44
|
+
*
|
|
45
|
+
* Classifies based on detection source prefix:
|
|
46
|
+
* - 'llm_paralysis' → llm_paralysis
|
|
47
|
+
* - 'llm_*' (detection rule) → semantic
|
|
48
|
+
* - 'user_empathy' or empathy keyword match → empathy_inferred
|
|
49
|
+
* - GFI threshold crossed → gfi_threshold
|
|
50
|
+
*/
|
|
51
|
+
export function resolveSourceKindFromLlmDetection(detectionSource, isGfiTriggered) {
|
|
52
|
+
if (isGfiTriggered)
|
|
53
|
+
return 'gfi_threshold';
|
|
54
|
+
if (detectionSource === 'llm_paralysis')
|
|
55
|
+
return 'llm_paralysis';
|
|
56
|
+
if (detectionSource.startsWith('llm_'))
|
|
57
|
+
return 'semantic';
|
|
58
|
+
if (detectionSource === 'user_empathy')
|
|
59
|
+
return 'empathy_inferred';
|
|
60
|
+
return 'unknown';
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Map gate-block context to SourceKind.
|
|
64
|
+
*/
|
|
65
|
+
export function resolveSourceKindFromGateBlock() {
|
|
66
|
+
return 'rulehost_block';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Map /pd-pain command to SourceKind.
|
|
70
|
+
*/
|
|
71
|
+
export function resolveSourceKindFromCommand() {
|
|
72
|
+
return 'owner_reported';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Map provider/rate-limit failure to SourceKind.
|
|
76
|
+
*/
|
|
77
|
+
export function resolveSourceKindFromProvider(isRateLimit) {
|
|
78
|
+
return isRateLimit ? 'rate_limit' : 'provider_failure';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Map subagent error to SourceKind.
|
|
82
|
+
*/
|
|
83
|
+
export function resolveSourceKindFromSubagent() {
|
|
84
|
+
return 'subagent_error';
|
|
85
|
+
}
|
|
86
|
+
// ── Triage Evaluation ───────────────────────────────────────────────────────
|
|
87
|
+
/**
|
|
88
|
+
* Evaluate evidence triage for a given source kind and context.
|
|
89
|
+
*
|
|
90
|
+
* This is the main entry point for hooks. It calls the pure triage policy
|
|
91
|
+
* from principles-core and returns the result.
|
|
92
|
+
*
|
|
93
|
+
* The caller (hook) is responsible for:
|
|
94
|
+
* - Checking the painEvidenceAdmission feature flag
|
|
95
|
+
* - Acting on the triage result (proceed to diagnosis, store evidence, etc.)
|
|
96
|
+
* - Falling back to existing behavior when the flag is off
|
|
97
|
+
*/
|
|
98
|
+
export function evaluateEvidenceTriage(sourceKind, score, options) {
|
|
99
|
+
const input = {
|
|
100
|
+
sourceKind,
|
|
101
|
+
score,
|
|
102
|
+
isUnsafeHighConfidence: options?.isUnsafeHighConfidence,
|
|
103
|
+
provenance: options?.provenance,
|
|
104
|
+
};
|
|
105
|
+
return evaluateTriage(input);
|
|
106
|
+
}
|
|
107
|
+
// ── High-Confidence Unsafe Action Detection ──────────────────────────────────
|
|
108
|
+
/**
|
|
109
|
+
* Determine if a gate-blocked action is a high-confidence unsafe action.
|
|
110
|
+
*
|
|
111
|
+
* This is a heuristic that the plugin adapter owns. Core does not know about
|
|
112
|
+
* these heuristics — it only receives the boolean flag.
|
|
113
|
+
*
|
|
114
|
+
* Criteria for high-confidence unsafe:
|
|
115
|
+
* - Score >= 70 (high severity)
|
|
116
|
+
* - Tool is in the risky write set
|
|
117
|
+
* - Action would be irreversible (file deletion, force push, etc.)
|
|
118
|
+
*/
|
|
119
|
+
export function isHighConfidenceUnsafeAction(score, isRisky) {
|
|
120
|
+
return isRisky && score >= 70;
|
|
121
|
+
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { EventLogEntry, GateBlockEvent } from '../types/index.js';
|
|
2
|
-
export declare class EventLogReadModel {
|
|
3
|
-
private readonly logsDir;
|
|
4
|
-
constructor(stateDir: string);
|
|
5
|
-
private readFilesWithConcurrency;
|
|
6
|
-
getEventsPaginated(options: {
|
|
7
|
-
types?: string[];
|
|
8
|
-
startDate?: string;
|
|
9
|
-
endDate?: string;
|
|
10
|
-
searchQuery?: string;
|
|
11
|
-
page?: number;
|
|
12
|
-
pageSize?: number;
|
|
13
|
-
}): Promise<{
|
|
14
|
-
events: EventLogEntry[];
|
|
15
|
-
total: number;
|
|
16
|
-
totalPages: number;
|
|
17
|
-
}>;
|
|
18
|
-
countEventsGroupedByType(dateRange?: {
|
|
19
|
-
startDate?: string;
|
|
20
|
-
endDate?: string;
|
|
21
|
-
}): Promise<Record<string, number>>;
|
|
22
|
-
getRelatedEvents(eventId: string, maxDistance?: number): Promise<EventLogEntry[]>;
|
|
23
|
-
getGateBlocks(limit?: number): Promise<GateBlockEvent[]>;
|
|
24
|
-
countGateBlocksToday(): Promise<number>;
|
|
25
|
-
countEventsByTypeToday(eventType: string): Promise<number>;
|
|
26
|
-
getEventsByTypes(types: string[], limit?: number): Promise<EventLogEntry[]>;
|
|
27
|
-
countEventsByTypeAndDate(eventType: string, date: string): Promise<number>;
|
|
28
|
-
countEventsByCategoryAndDate(category: string, date: string): Promise<number>;
|
|
29
|
-
private getEventFiles;
|
|
30
|
-
private readEventsOfFile;
|
|
31
|
-
private readLines;
|
|
32
|
-
dispose(): void;
|
|
33
|
-
}
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
function extractFileDate(filePath) {
|
|
4
|
-
const match = /events_(\d{4}-\d{2}-\d{2})\.jsonl/.exec(filePath);
|
|
5
|
-
return match ? match[1] : null;
|
|
6
|
-
}
|
|
7
|
-
export class EventLogReadModel {
|
|
8
|
-
logsDir;
|
|
9
|
-
constructor(stateDir) {
|
|
10
|
-
this.logsDir = path.join(stateDir, 'logs');
|
|
11
|
-
}
|
|
12
|
-
async readFilesWithConcurrency(files, processor, concurrency = 5) {
|
|
13
|
-
void this;
|
|
14
|
-
const results = [];
|
|
15
|
-
for (let i = 0; i < files.length; i += concurrency) {
|
|
16
|
-
const batch = files.slice(i, i + concurrency);
|
|
17
|
-
const batchResults = await Promise.all(batch.map(processor));
|
|
18
|
-
for (const batchResult of batchResults) {
|
|
19
|
-
results.push(...batchResult);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return results;
|
|
23
|
-
}
|
|
24
|
-
async getEventsPaginated(options) {
|
|
25
|
-
const { types, startDate, endDate, searchQuery, page = 1, pageSize = 50, } = options;
|
|
26
|
-
const allFiles = this.getEventFiles().reverse(); // newest first
|
|
27
|
-
const filteredFiles = allFiles.filter(file => {
|
|
28
|
-
if (!startDate && !endDate)
|
|
29
|
-
return true;
|
|
30
|
-
const fileDate = extractFileDate(file);
|
|
31
|
-
if (!fileDate)
|
|
32
|
-
return true;
|
|
33
|
-
if (startDate && fileDate < startDate)
|
|
34
|
-
return false;
|
|
35
|
-
if (endDate && fileDate > endDate)
|
|
36
|
-
return false;
|
|
37
|
-
return true;
|
|
38
|
-
});
|
|
39
|
-
const allEntries = await this.readFilesWithConcurrency(filteredFiles, (file) => this.readEventsOfFile(file));
|
|
40
|
-
const allMatchingEvents = [];
|
|
41
|
-
for (const entry of allEntries.reverse()) {
|
|
42
|
-
if (types && types.length > 0 && !types.includes(entry.type))
|
|
43
|
-
continue;
|
|
44
|
-
if (searchQuery) {
|
|
45
|
-
const entryStr = JSON.stringify(entry).toLowerCase();
|
|
46
|
-
if (!entryStr.includes(searchQuery.toLowerCase()))
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
allMatchingEvents.push(entry);
|
|
50
|
-
}
|
|
51
|
-
const total = allMatchingEvents.length;
|
|
52
|
-
const totalPages = Math.ceil(total / pageSize);
|
|
53
|
-
const startIndex = (page - 1) * pageSize;
|
|
54
|
-
const events = allMatchingEvents.slice(startIndex, startIndex + pageSize);
|
|
55
|
-
return { events, total, totalPages };
|
|
56
|
-
}
|
|
57
|
-
async countEventsGroupedByType(dateRange) {
|
|
58
|
-
const allFiles = this.getEventFiles().reverse();
|
|
59
|
-
const filteredFiles = allFiles.filter(file => {
|
|
60
|
-
if (!dateRange?.startDate && !dateRange?.endDate)
|
|
61
|
-
return true;
|
|
62
|
-
const fileDate = extractFileDate(file);
|
|
63
|
-
if (!fileDate)
|
|
64
|
-
return true;
|
|
65
|
-
if (dateRange.startDate && fileDate < dateRange.startDate)
|
|
66
|
-
return false;
|
|
67
|
-
if (dateRange.endDate && fileDate > dateRange.endDate)
|
|
68
|
-
return false;
|
|
69
|
-
return true;
|
|
70
|
-
});
|
|
71
|
-
const allEntries = await this.readFilesWithConcurrency(filteredFiles, (file) => this.readEventsOfFile(file));
|
|
72
|
-
const counts = {};
|
|
73
|
-
for (const entry of allEntries) {
|
|
74
|
-
counts[entry.type] = (counts[entry.type] || 0) + 1;
|
|
75
|
-
}
|
|
76
|
-
return counts;
|
|
77
|
-
}
|
|
78
|
-
async getRelatedEvents(eventId, maxDistance = 10) {
|
|
79
|
-
const allFiles = this.getEventFiles().reverse();
|
|
80
|
-
const allEntries = await this.readFilesWithConcurrency(allFiles, (file) => this.readEventsOfFile(file));
|
|
81
|
-
const relatedEvents = [];
|
|
82
|
-
let foundTarget = false;
|
|
83
|
-
let distance = 0;
|
|
84
|
-
for (const entry of allEntries) {
|
|
85
|
-
if (entry.id === eventId) {
|
|
86
|
-
foundTarget = true;
|
|
87
|
-
relatedEvents.push(entry);
|
|
88
|
-
}
|
|
89
|
-
else if (foundTarget && distance < maxDistance) {
|
|
90
|
-
relatedEvents.push(entry);
|
|
91
|
-
distance++;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return relatedEvents;
|
|
95
|
-
}
|
|
96
|
-
async getGateBlocks(limit = 100) {
|
|
97
|
-
const files = this.getEventFiles();
|
|
98
|
-
const allEntries = await this.readFilesWithConcurrency(files, (file) => this.readEventsOfFile(file));
|
|
99
|
-
const blocks = [];
|
|
100
|
-
for (const entry of allEntries.reverse()) {
|
|
101
|
-
if (entry.type === 'gate_block' && blocks.length < limit) {
|
|
102
|
-
blocks.push(entry);
|
|
103
|
-
}
|
|
104
|
-
if (blocks.length >= limit)
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
return blocks;
|
|
108
|
-
}
|
|
109
|
-
async countGateBlocksToday() {
|
|
110
|
-
const [today] = new Date().toISOString().split('T');
|
|
111
|
-
const file = path.join(this.logsDir, `events_${today}.jsonl`);
|
|
112
|
-
if (!fs.existsSync(file))
|
|
113
|
-
return 0;
|
|
114
|
-
let count = 0;
|
|
115
|
-
for await (const line of this.readLines(file)) {
|
|
116
|
-
try {
|
|
117
|
-
const entry = JSON.parse(line);
|
|
118
|
-
if (entry.type === 'gate_block')
|
|
119
|
-
count++;
|
|
120
|
-
}
|
|
121
|
-
catch { /* skip malformed */ }
|
|
122
|
-
}
|
|
123
|
-
return count;
|
|
124
|
-
}
|
|
125
|
-
async countEventsByTypeToday(eventType) {
|
|
126
|
-
const [today] = new Date().toISOString().split('T');
|
|
127
|
-
const file = path.join(this.logsDir, `events_${today}.jsonl`);
|
|
128
|
-
if (!fs.existsSync(file))
|
|
129
|
-
return 0;
|
|
130
|
-
let count = 0;
|
|
131
|
-
for await (const line of this.readLines(file)) {
|
|
132
|
-
try {
|
|
133
|
-
const entry = JSON.parse(line);
|
|
134
|
-
if (entry.type === eventType)
|
|
135
|
-
count++;
|
|
136
|
-
}
|
|
137
|
-
catch { /* skip malformed */ }
|
|
138
|
-
}
|
|
139
|
-
return count;
|
|
140
|
-
}
|
|
141
|
-
async getEventsByTypes(types, limit = 50) {
|
|
142
|
-
const files = this.getEventFiles();
|
|
143
|
-
const allEntries = await this.readFilesWithConcurrency(files, (file) => this.readEventsOfFile(file));
|
|
144
|
-
const results = [];
|
|
145
|
-
for (const entry of allEntries.reverse()) {
|
|
146
|
-
if (types.includes(entry.type) && results.length < limit) {
|
|
147
|
-
results.push(entry);
|
|
148
|
-
}
|
|
149
|
-
if (results.length >= limit)
|
|
150
|
-
break;
|
|
151
|
-
}
|
|
152
|
-
return results;
|
|
153
|
-
}
|
|
154
|
-
async countEventsByTypeAndDate(eventType, date) {
|
|
155
|
-
const file = path.join(this.logsDir, `events_${date}.jsonl`);
|
|
156
|
-
if (!fs.existsSync(file))
|
|
157
|
-
return 0;
|
|
158
|
-
let count = 0;
|
|
159
|
-
for await (const line of this.readLines(file)) {
|
|
160
|
-
try {
|
|
161
|
-
const entry = JSON.parse(line);
|
|
162
|
-
if (entry.type === eventType)
|
|
163
|
-
count++;
|
|
164
|
-
}
|
|
165
|
-
catch { /* skip malformed */ }
|
|
166
|
-
}
|
|
167
|
-
return count;
|
|
168
|
-
}
|
|
169
|
-
async countEventsByCategoryAndDate(category, date) {
|
|
170
|
-
const file = path.join(this.logsDir, `events_${date}.jsonl`);
|
|
171
|
-
if (!fs.existsSync(file))
|
|
172
|
-
return 0;
|
|
173
|
-
let count = 0;
|
|
174
|
-
for await (const line of this.readLines(file)) {
|
|
175
|
-
try {
|
|
176
|
-
const entry = JSON.parse(line);
|
|
177
|
-
if (entry.category === category)
|
|
178
|
-
count++;
|
|
179
|
-
}
|
|
180
|
-
catch { /* skip malformed */ }
|
|
181
|
-
}
|
|
182
|
-
return count;
|
|
183
|
-
}
|
|
184
|
-
getEventFiles() {
|
|
185
|
-
if (!fs.existsSync(this.logsDir))
|
|
186
|
-
return [];
|
|
187
|
-
return fs.readdirSync(this.logsDir)
|
|
188
|
-
.filter(f => f.startsWith('events_') && f.endsWith('.jsonl'))
|
|
189
|
-
.sort()
|
|
190
|
-
.map(f => path.join(this.logsDir, f));
|
|
191
|
-
}
|
|
192
|
-
async readEventsOfFile(filePath) {
|
|
193
|
-
const entries = [];
|
|
194
|
-
for await (const line of this.readLines(filePath)) {
|
|
195
|
-
try {
|
|
196
|
-
entries.push(JSON.parse(line));
|
|
197
|
-
}
|
|
198
|
-
catch { /* skip malformed */ }
|
|
199
|
-
}
|
|
200
|
-
return entries;
|
|
201
|
-
}
|
|
202
|
-
async *readLines(filePath) {
|
|
203
|
-
const fileStream = fs.createReadStream(filePath, { encoding: 'utf8' });
|
|
204
|
-
const readline = await import('readline');
|
|
205
|
-
const rl = readline.createInterface({
|
|
206
|
-
input: fileStream,
|
|
207
|
-
crlfDelay: Infinity,
|
|
208
|
-
});
|
|
209
|
-
for await (const line of rl) {
|
|
210
|
-
if (line.trim())
|
|
211
|
-
yield line;
|
|
212
|
-
}
|
|
213
|
-
void this.logsDir;
|
|
214
|
-
}
|
|
215
|
-
dispose() {
|
|
216
|
-
void this.logsDir;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
export type PrincipleStatus = 'candidate' | 'active' | 'archived' | 'deprecated' | 'probation';
|
|
2
|
-
export interface EvolutionStats {
|
|
3
|
-
total: number;
|
|
4
|
-
pending: number;
|
|
5
|
-
inProgress: number;
|
|
6
|
-
completed: number;
|
|
7
|
-
failed: number;
|
|
8
|
-
stageDistribution: {
|
|
9
|
-
stage: string;
|
|
10
|
-
count: number;
|
|
11
|
-
}[];
|
|
12
|
-
}
|
|
13
|
-
export interface EvolutionTaskItem {
|
|
14
|
-
taskId: string;
|
|
15
|
-
taskKind: string;
|
|
16
|
-
status: string;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
leaseOwner: string | null;
|
|
19
|
-
leaseExpiresAt: string | null;
|
|
20
|
-
}
|
|
21
|
-
export interface EvolutionTasksOutput {
|
|
22
|
-
items: EvolutionTaskItem[];
|
|
23
|
-
pagination: {
|
|
24
|
-
page: number;
|
|
25
|
-
pageSize: number;
|
|
26
|
-
total: number;
|
|
27
|
-
totalPages: number;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface PrincipleLifecycleSummary {
|
|
31
|
-
candidate: number;
|
|
32
|
-
probation: number;
|
|
33
|
-
active: number;
|
|
34
|
-
deprecated: number;
|
|
35
|
-
archived: number;
|
|
36
|
-
total: number;
|
|
37
|
-
}
|
|
38
|
-
export interface PrincipleTransition {
|
|
39
|
-
principleId: string;
|
|
40
|
-
status: PrincipleStatus;
|
|
41
|
-
text: string;
|
|
42
|
-
triggerPattern: string;
|
|
43
|
-
action: string;
|
|
44
|
-
evaluability: string;
|
|
45
|
-
createdAt: string;
|
|
46
|
-
updatedAt: string;
|
|
47
|
-
}
|
|
48
|
-
export interface EvolutionPrinciplesOutput {
|
|
49
|
-
summary: PrincipleLifecycleSummary;
|
|
50
|
-
recent: PrincipleTransition[];
|
|
51
|
-
}
|
|
52
|
-
export interface QueueHealthOutput {
|
|
53
|
-
pendingCount: number;
|
|
54
|
-
retryWaitCount: number;
|
|
55
|
-
countsByTaskKind: Record<string, number>;
|
|
56
|
-
countsByChannel: Record<string, number>;
|
|
57
|
-
invalidMetadataCount: number;
|
|
58
|
-
blockedCount: number;
|
|
59
|
-
dependencyFailedCount: number;
|
|
60
|
-
readyTaskCount: number;
|
|
61
|
-
noReadyTasksReason: string | null;
|
|
62
|
-
}
|
|
63
|
-
export declare class EvolutionConsoleModel {
|
|
64
|
-
private readonly workspaceDir;
|
|
65
|
-
private stateManager;
|
|
66
|
-
private initPromise;
|
|
67
|
-
constructor(workspaceDir: string);
|
|
68
|
-
private ensureInitialized;
|
|
69
|
-
getStats(): Promise<EvolutionStats>;
|
|
70
|
-
getTasks(filters?: {
|
|
71
|
-
status?: string;
|
|
72
|
-
taskKind?: string;
|
|
73
|
-
page?: number;
|
|
74
|
-
pageSize?: number;
|
|
75
|
-
}): Promise<EvolutionTasksOutput>;
|
|
76
|
-
getPrinciples(): Promise<EvolutionPrinciplesOutput>;
|
|
77
|
-
getQueueHealth(): Promise<QueueHealthOutput>;
|
|
78
|
-
dispose(): void;
|
|
79
|
-
}
|