create-principles-disciple 1.100.0 → 1.102.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/index.js +9 -0
- package/console/dist/server/models/ActivationsConsoleModel.d.ts +37 -1
- package/console/dist/server/models/ActivationsConsoleModel.js +114 -13
- package/console/dist/server/routes/onboarding.d.ts +34 -0
- package/console/dist/server/routes/onboarding.js +324 -0
- package/console/dist/ui/App.js +74 -15
- package/console/dist/ui/api.d.ts +17 -1
- package/console/dist/ui/api.js +6 -1
- package/console/dist/ui/components/onboarding/CircuitDiagram.d.ts +8 -0
- package/console/dist/ui/components/onboarding/CircuitDiagram.js +18 -0
- package/console/dist/ui/components/onboarding/DemoResultView.d.ts +22 -0
- package/console/dist/ui/components/onboarding/DemoResultView.js +15 -0
- package/console/dist/ui/i18n/en.json +127 -0
- package/console/dist/ui/i18n/zh-CN.json +127 -0
- package/console/dist/ui/pages/activation/ActivationValidators.js +1 -1
- package/console/dist/ui/pages/control-center/AgentCard.js +10 -3
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +1 -1
- package/console/dist/ui/pages/settings/SettingsPage.js +64 -5
- package/console/dist/ui/pages/signal-keywords/KeywordEditDialog.d.ts +12 -0
- package/console/dist/ui/pages/signal-keywords/KeywordEditDialog.js +41 -0
- package/console/dist/ui/pages/signal-keywords/KeywordListSection.d.ts +10 -0
- package/console/dist/ui/pages/signal-keywords/KeywordListSection.js +39 -0
- package/console/dist/ui/pages/signal-keywords/PendingTermsSection.d.ts +14 -0
- package/console/dist/ui/pages/signal-keywords/PendingTermsSection.js +35 -0
- package/console/dist/ui/pages/signal-keywords/SignalKeywordsPage.d.ts +1 -0
- package/console/dist/ui/pages/signal-keywords/SignalKeywordsPage.js +49 -0
- package/console/dist/ui/pages/welcome/WelcomePage.d.ts +5 -0
- package/console/dist/ui/pages/welcome/WelcomePage.js +185 -0
- package/console/dist/ui/utils/__tests__/onboarding-state.test.d.ts +1 -0
- package/console/dist/ui/utils/__tests__/onboarding-state.test.js +72 -0
- package/console/dist/ui/utils/agent-metadata.d.ts +13 -0
- package/console/dist/ui/utils/agent-metadata.js +26 -0
- package/console/dist/ui/utils/onboarding-state.d.ts +25 -0
- package/console/dist/ui/utils/onboarding-state.js +77 -0
- package/console/dist/ui/utils/signal-keywords-api.d.ts +68 -0
- package/console/dist/ui/utils/signal-keywords-api.js +121 -0
- package/console/dist/ui/utils/signal-keywords-types.d.ts +57 -0
- package/console/dist/ui/utils/signal-keywords-types.js +10 -0
- package/console/dist/ui/utils/signal-keywords-validators.d.ts +20 -0
- package/console/dist/ui/utils/signal-keywords-validators.js +114 -0
- package/console/dist/web/assets/app.css +401 -0
- package/console/dist/web/assets/app.js +6904 -1835
- package/core/dist/index.d.ts +2 -0
- package/core/dist/index.d.ts.map +1 -1
- package/core/dist/index.js +1 -0
- package/core/dist/index.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/admission-gate.test.js +63 -1
- package/core/dist/runtime-v2/__tests__/admission-gate.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +21 -5
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/chain-integrity-attack.test.js +17 -0
- package/core/dist/runtime-v2/__tests__/chain-integrity-attack.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/chain-integrity-real-path.test.js +12 -0
- package/core/dist/runtime-v2/__tests__/chain-integrity-real-path.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +28 -0
- package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.js +168 -1
- package/core/dist/runtime-v2/__tests__/internalization-chain-integrity-read-model.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +8 -0
- package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js +53 -0
- package/core/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/helpers.d.ts +21 -0
- package/core/dist/runtime-v2/activation/__tests__/helpers.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/helpers.js +132 -0
- package/core/dist/runtime-v2/activation/__tests__/helpers.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js +2 -117
- package/core/dist/runtime-v2/activation/__tests__/story-a-acceptance.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 +18 -2
- package/core/dist/runtime-v2/activation/activation-dispatcher.js.map +1 -1
- package/core/dist/runtime-v2/activation/index.d.ts +1 -1
- package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/index.js +1 -1
- package/core/dist/runtime-v2/activation/index.js.map +1 -1
- package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +253 -6
- 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 +12 -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 +96 -2
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
- package/core/dist/runtime-v2/admission-gate.d.ts +27 -0
- package/core/dist/runtime-v2/admission-gate.d.ts.map +1 -1
- package/core/dist/runtime-v2/admission-gate.js +55 -0
- package/core/dist/runtime-v2/admission-gate.js.map +1 -1
- package/core/dist/runtime-v2/cli/diagnose.d.ts +4 -0
- package/core/dist/runtime-v2/cli/diagnose.d.ts.map +1 -1
- package/core/dist/runtime-v2/cli/diagnose.js +25 -0
- package/core/dist/runtime-v2/cli/diagnose.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/internal-agent-names.test.d.ts +2 -0
- package/core/dist/runtime-v2/config/__tests__/internal-agent-names.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/config/__tests__/internal-agent-names.test.js +15 -0
- package/core/dist/runtime-v2/config/__tests__/internal-agent-names.test.js.map +1 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +7 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +28 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js +1 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-redaction-deep.test.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js +1 -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 +5 -3
- package/core/dist/runtime-v2/config/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/index.js +8 -2
- package/core/dist/runtime-v2/config/index.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-defaults.d.ts +2 -1
- package/core/dist/runtime-v2/config/pd-config-defaults.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-defaults.js +12 -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 +25 -1
- package/core/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-feature-flags.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-feature-flags.js +6 -1
- package/core/dist/runtime-v2/config/pd-config-feature-flags.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-redaction.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-redaction.js +9 -0
- package/core/dist/runtime-v2/config/pd-config-redaction.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-types.d.ts +110 -1
- package/core/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-types.js +7 -0
- package/core/dist/runtime-v2/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-validate.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-validate.js +114 -1
- package/core/dist/runtime-v2/config/pd-config-validate.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-profile-constants.d.ts +27 -0
- package/core/dist/runtime-v2/config/pd-profile-constants.d.ts.map +1 -0
- package/core/dist/runtime-v2/config/pd-profile-constants.js +145 -0
- package/core/dist/runtime-v2/config/pd-profile-constants.js.map +1 -0
- package/core/dist/runtime-v2/config/pd-validate-profile.d.ts +28 -0
- package/core/dist/runtime-v2/config/pd-validate-profile.d.ts.map +1 -0
- package/core/dist/runtime-v2/config/pd-validate-profile.js +482 -0
- package/core/dist/runtime-v2/config/pd-validate-profile.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +26 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.test.js +12 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/plugin-surface-registry.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 +8 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js +8 -2
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +6 -4
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +5 -3
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js +25 -0
- package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder-v2.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +139 -0
- package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +20 -1
- package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js +7 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-runner.test.js +21 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-runner.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js +23 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-host-input-builder.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-output.d.ts +7 -0
- package/core/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-output.js +22 -1
- package/core/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js +2 -0
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-runner.js +13 -0
- package/core/dist/runtime-v2/internalization/artificer-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-distiller-runner.js +4 -1
- package/core/dist/runtime-v2/internalization/diag-distiller-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.js +7 -1
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-router-runner.js +4 -1
- package/core/dist/runtime-v2/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.js +7 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/index.d.ts +1 -1
- package/core/dist/runtime-v2/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/index.js +1 -1
- package/core/dist/runtime-v2/internalization/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/internalization-task-guards.d.ts +7 -0
- package/core/dist/runtime-v2/internalization/internalization-task-guards.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/internalization-task-guards.js +8 -0
- package/core/dist/runtime-v2/internalization/internalization-task-guards.js.map +1 -1
- package/core/dist/runtime-v2/internalization-chain-integrity-read-model.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization-chain-integrity-read-model.js +57 -1
- package/core/dist/runtime-v2/internalization-chain-integrity-read-model.js.map +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js.map +1 -1
- package/core/dist/runtime-v2/runner/__tests__/diagnose.test.js +91 -1
- package/core/dist/runtime-v2/runner/__tests__/diagnose.test.js.map +1 -1
- package/core/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.d.ts +2 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.js +39 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/keyword-stage.test.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.d.ts +2 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.js +34 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/llm-stage.test.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.d.ts +2 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.js +222 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/signal-collector.test.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/types.test.d.ts +2 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/types.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/types.test.js +35 -0
- package/core/dist/runtime-v2/signal-collector/__tests__/types.test.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/index.d.ts +5 -0
- package/core/dist/runtime-v2/signal-collector/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/index.js +5 -0
- package/core/dist/runtime-v2/signal-collector/index.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts +20 -0
- package/core/dist/runtime-v2/signal-collector/keyword-stage.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/keyword-stage.js +61 -0
- package/core/dist/runtime-v2/signal-collector/keyword-stage.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts +16 -0
- package/core/dist/runtime-v2/signal-collector/llm-stage.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/llm-stage.js +34 -0
- package/core/dist/runtime-v2/signal-collector/llm-stage.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/signal-collector.d.ts +16 -0
- package/core/dist/runtime-v2/signal-collector/signal-collector.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/signal-collector.js +71 -0
- package/core/dist/runtime-v2/signal-collector/signal-collector.js.map +1 -0
- package/core/dist/runtime-v2/signal-collector/types.d.ts +61 -0
- package/core/dist/runtime-v2/signal-collector/types.d.ts.map +1 -0
- package/core/dist/runtime-v2/signal-collector/types.js +45 -0
- package/core/dist/runtime-v2/signal-collector/types.js.map +1 -0
- package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.js +19 -0
- package/core/dist/runtime-v2/store/candidate/sqlite-candidate-store.js.map +1 -1
- package/core/dist/runtime-v2/store/schema-conformance.test.js +73 -0
- package/core/dist/runtime-v2/store/schema-conformance.test.js.map +1 -1
- package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.js +41 -7
- package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.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 +22 -1
- package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime-v2/types/event-types.d.ts +40 -3
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js +9 -0
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/dist/runtime-v2/types/index.d.ts +2 -2
- package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/index.js +1 -1
- package/core/dist/runtime-v2/types/index.js.map +1 -1
- package/core/dist/workflow-funnel-loader.js +1 -1
- package/core/dist/workflow-funnel-loader.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +3 -0
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +167 -1
- package/dist/installer.js.map +1 -1
- package/dist/mvp-config.d.ts +8 -0
- package/dist/mvp-config.d.ts.map +1 -1
- package/dist/mvp-config.js +12 -2
- package/dist/mvp-config.js.map +1 -1
- package/package.json +1 -1
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +89 -7
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts +3 -0
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +39 -14
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.d.ts +4 -0
- package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.js +244 -10
- package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
- package/pd-cli/dist/index.js +7 -84
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.js +1 -1
- package/pd-cli/dist/services/rulehost-pipeline-runner.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/commands/context.js +17 -11
- package/plugin/dist/commands/samples.js +25 -0
- package/plugin/dist/core/event-log.d.ts +11 -1
- package/plugin/dist/core/event-log.js +13 -0
- package/plugin/dist/core/init.js +3 -4
- package/plugin/dist/core/rule-host.d.ts +68 -0
- package/plugin/dist/core/rule-host.js +167 -28
- package/plugin/dist/core/signal-collector-host.d.ts +105 -0
- package/plugin/dist/core/signal-collector-host.js +337 -0
- package/plugin/dist/hooks/prompt.d.ts +3 -2
- package/plugin/dist/hooks/prompt.js +47 -571
- package/plugin/dist/types/event-types.d.ts +1 -1
- package/plugin/dist/types.d.ts +5 -25
- package/plugin/dist/types.js +4 -9
- package/plugin/dist/utils/hashing.js +1 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signal-keywords-types — 信号关键词前端类型定义
|
|
3
|
+
*
|
|
4
|
+
* 镜像后端 UnifiedKeyword / PendingTerm 等类型,供控制台 UI 消费。
|
|
5
|
+
*
|
|
6
|
+
* ERR entries:
|
|
7
|
+
* - rc-1: 纯静态类型定义,无 untrusted 输入
|
|
8
|
+
* - rc-2: 无 `as` bypass
|
|
9
|
+
*/
|
|
10
|
+
export type KeywordCategory = 'correction' | 'empathy';
|
|
11
|
+
/** 词库来源 — 词库中已有的审定点 */
|
|
12
|
+
export type TermSource = 'seed' | 'migrated' | 'owner_promoted';
|
|
13
|
+
export interface UnifiedKeyword {
|
|
14
|
+
term: string;
|
|
15
|
+
category: KeywordCategory;
|
|
16
|
+
/** 权重 0-1 */
|
|
17
|
+
weight: number;
|
|
18
|
+
/** 高精度 vs 歧义词 */
|
|
19
|
+
precision: 'high' | 'ambiguous';
|
|
20
|
+
source: TermSource;
|
|
21
|
+
}
|
|
22
|
+
export interface UnifiedKeywordStore {
|
|
23
|
+
version: number;
|
|
24
|
+
/** key = term */
|
|
25
|
+
terms: Record<string, UnifiedKeyword>;
|
|
26
|
+
}
|
|
27
|
+
/** 候选来源 — LLM 新发现的词(待 owner 审批) */
|
|
28
|
+
export type PendingTermSource = 'llm_candidate';
|
|
29
|
+
export interface PendingTerm {
|
|
30
|
+
term: string;
|
|
31
|
+
suggestedCategory: KeywordCategory;
|
|
32
|
+
suggestedPrecision: 'high' | 'ambiguous';
|
|
33
|
+
/** LLM 给出的发现理由 */
|
|
34
|
+
reason: string;
|
|
35
|
+
/** ISO 时间戳 */
|
|
36
|
+
discoveredAt: string;
|
|
37
|
+
source: PendingTermSource;
|
|
38
|
+
}
|
|
39
|
+
export interface PendingTermStore {
|
|
40
|
+
version: number;
|
|
41
|
+
terms: PendingTerm[];
|
|
42
|
+
}
|
|
43
|
+
/** 更新词库的请求体 */
|
|
44
|
+
export interface UpdateKeywordStoreRequest {
|
|
45
|
+
version: number;
|
|
46
|
+
terms: Record<string, Omit<UnifiedKeyword, 'term'>>;
|
|
47
|
+
}
|
|
48
|
+
/** 审批一个 PendingTerm 的请求体 */
|
|
49
|
+
export interface AdmitPendingTermRequest {
|
|
50
|
+
term: string;
|
|
51
|
+
category: KeywordCategory;
|
|
52
|
+
precision: 'high' | 'ambiguous';
|
|
53
|
+
}
|
|
54
|
+
/** SignalKeywordsPage 使用的关键词类型(UnifiedKeyword 的别名) */
|
|
55
|
+
export type SignalKeyword = UnifiedKeyword;
|
|
56
|
+
/** SignalKeywordsPage 使用的待确认信号词类型(PendingTerm 的别名) */
|
|
57
|
+
export type PendingSignalTerm = PendingTerm;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signal-keywords-validators — 信号关键词 API 响应运行时校验
|
|
3
|
+
*
|
|
4
|
+
* 遵循 rc-1 ~ rc-5 运行时契约规则:
|
|
5
|
+
* - rc-1: 将 parsed JSON 作 unknown 处理
|
|
6
|
+
* - rc-2: 不用 as bypass,用 typeof / Array.isArray / type guard
|
|
7
|
+
* - rc-3: 必填字段缺失时 loud fail(返回 null)
|
|
8
|
+
* - rc-4: 校验数组元素类型
|
|
9
|
+
* - rc-5: 用 Object.hasOwn 而非 in
|
|
10
|
+
*
|
|
11
|
+
* ERR entries:
|
|
12
|
+
* - ERR-001: unknown 输入 -> runtime validation
|
|
13
|
+
* - ERR-005: 数组元素逐项校验
|
|
14
|
+
* - ERR-007: 拒绝非数组 payload
|
|
15
|
+
* - ERR-009: 必填字段 loud fail
|
|
16
|
+
* - ERR-013: 用 Object.hasOwn 替代 in
|
|
17
|
+
*/
|
|
18
|
+
import type { UnifiedKeywordStore, PendingTermStore } from './signal-keywords-types.js';
|
|
19
|
+
export declare function validateUnifiedKeywordStore(raw: unknown): UnifiedKeywordStore | null;
|
|
20
|
+
export declare function validatePendingTermStore(raw: unknown): PendingTermStore | null;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* signal-keywords-validators — 信号关键词 API 响应运行时校验
|
|
3
|
+
*
|
|
4
|
+
* 遵循 rc-1 ~ rc-5 运行时契约规则:
|
|
5
|
+
* - rc-1: 将 parsed JSON 作 unknown 处理
|
|
6
|
+
* - rc-2: 不用 as bypass,用 typeof / Array.isArray / type guard
|
|
7
|
+
* - rc-3: 必填字段缺失时 loud fail(返回 null)
|
|
8
|
+
* - rc-4: 校验数组元素类型
|
|
9
|
+
* - rc-5: 用 Object.hasOwn 而非 in
|
|
10
|
+
*
|
|
11
|
+
* ERR entries:
|
|
12
|
+
* - ERR-001: unknown 输入 -> runtime validation
|
|
13
|
+
* - ERR-005: 数组元素逐项校验
|
|
14
|
+
* - ERR-007: 拒绝非数组 payload
|
|
15
|
+
* - ERR-009: 必填字段 loud fail
|
|
16
|
+
* - ERR-013: 用 Object.hasOwn 替代 in
|
|
17
|
+
*/
|
|
18
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
19
|
+
function isRecord(value) {
|
|
20
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
21
|
+
}
|
|
22
|
+
// ── UnifiedKeywordStore ───────────────────────────────────────────────────────
|
|
23
|
+
export function validateUnifiedKeywordStore(raw) {
|
|
24
|
+
if (!isRecord(raw))
|
|
25
|
+
return null;
|
|
26
|
+
if (!Object.hasOwn(raw, 'version') || !Object.hasOwn(raw, 'terms')) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const { version } = raw;
|
|
30
|
+
const { terms } = raw;
|
|
31
|
+
if (typeof version !== 'number')
|
|
32
|
+
return null;
|
|
33
|
+
if (!isRecord(terms))
|
|
34
|
+
return null;
|
|
35
|
+
// rc-4: 校验每个 term 条目
|
|
36
|
+
const validatedTerms = {};
|
|
37
|
+
for (const [termKey, termRaw] of Object.entries(terms)) {
|
|
38
|
+
if (!isRecord(termRaw))
|
|
39
|
+
return null;
|
|
40
|
+
if (!Object.hasOwn(termRaw, 'term') ||
|
|
41
|
+
!Object.hasOwn(termRaw, 'category') ||
|
|
42
|
+
!Object.hasOwn(termRaw, 'weight') ||
|
|
43
|
+
!Object.hasOwn(termRaw, 'precision') ||
|
|
44
|
+
!Object.hasOwn(termRaw, 'source')) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const t = termRaw;
|
|
48
|
+
if (typeof t.term !== 'string' ||
|
|
49
|
+
t.term.length === 0 ||
|
|
50
|
+
(t.category !== 'correction' && t.category !== 'empathy') ||
|
|
51
|
+
typeof t.weight !== 'number' ||
|
|
52
|
+
Number.isNaN(t.weight) ||
|
|
53
|
+
t.weight < 0 ||
|
|
54
|
+
t.weight > 1 ||
|
|
55
|
+
(t.precision !== 'high' && t.precision !== 'ambiguous') ||
|
|
56
|
+
(t.source !== 'seed' && t.source !== 'migrated' && t.source !== 'owner_promoted')) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
validatedTerms[termKey] = {
|
|
60
|
+
term: t.term,
|
|
61
|
+
category: t.category,
|
|
62
|
+
weight: t.weight,
|
|
63
|
+
precision: t.precision,
|
|
64
|
+
source: t.source,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return { version, terms: validatedTerms };
|
|
68
|
+
}
|
|
69
|
+
// ── PendingTermStore ──────────────────────────────────────────────────────────
|
|
70
|
+
export function validatePendingTermStore(raw) {
|
|
71
|
+
if (!isRecord(raw))
|
|
72
|
+
return null;
|
|
73
|
+
if (!Object.hasOwn(raw, 'version') || !Object.hasOwn(raw, 'terms')) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const { version } = raw;
|
|
77
|
+
const { terms } = raw;
|
|
78
|
+
if (typeof version !== 'number')
|
|
79
|
+
return null;
|
|
80
|
+
if (!Array.isArray(terms))
|
|
81
|
+
return null;
|
|
82
|
+
// rc-4: 校验每个 pending term
|
|
83
|
+
const validatedTerms = [];
|
|
84
|
+
for (const itemRaw of terms) {
|
|
85
|
+
if (!isRecord(itemRaw))
|
|
86
|
+
return null;
|
|
87
|
+
if (!Object.hasOwn(itemRaw, 'term') ||
|
|
88
|
+
!Object.hasOwn(itemRaw, 'suggestedCategory') ||
|
|
89
|
+
!Object.hasOwn(itemRaw, 'suggestedPrecision') ||
|
|
90
|
+
!Object.hasOwn(itemRaw, 'reason') ||
|
|
91
|
+
!Object.hasOwn(itemRaw, 'discoveredAt')) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
const t = itemRaw;
|
|
95
|
+
if (typeof t.term !== 'string' ||
|
|
96
|
+
t.term.length === 0 ||
|
|
97
|
+
(t.suggestedCategory !== 'correction' && t.suggestedCategory !== 'empathy') ||
|
|
98
|
+
(t.suggestedPrecision !== 'high' && t.suggestedPrecision !== 'ambiguous') ||
|
|
99
|
+
typeof t.reason !== 'string' ||
|
|
100
|
+
typeof t.discoveredAt !== 'string') {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
validatedTerms.push({
|
|
104
|
+
term: t.term,
|
|
105
|
+
suggestedCategory: t.suggestedCategory,
|
|
106
|
+
suggestedPrecision: t.suggestedPrecision,
|
|
107
|
+
reason: t.reason,
|
|
108
|
+
discoveredAt: t.discoveredAt,
|
|
109
|
+
// source 总是 'llm_candidate'
|
|
110
|
+
source: 'llm_candidate',
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return { version, terms: validatedTerms };
|
|
114
|
+
}
|