create-principles-disciple 1.92.0 → 1.94.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/AuthConfig.js +6 -0
- package/console/dist/server/config/pd-config-store.d.ts +7 -1
- package/console/dist/server/config/pd-config-store.js +11 -1
- package/console/dist/server/index.js +41 -22
- package/console/dist/server/models/ApprovalsConsoleModel.js +4 -12
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +6 -3
- package/console/dist/server/models/ConsoleLifecycleDatasource.js +1 -1
- package/console/dist/server/routes/activations.js +4 -0
- package/console/dist/server/routes/approvals.js +24 -4
- package/console/dist/server/routes/feedback-reports.js +7 -5
- package/console/dist/server/routes/lifecycle.js +6 -1
- package/console/dist/server/routes/principles.js +10 -2
- package/console/dist/server/routes/workspaces.js +4 -0
- package/console/dist/ui/components/ui/charts.js +4 -1
- package/console/dist/ui/components/ui/markdown.js +9 -5
- package/console/dist/ui/utils/enum-labels.js +4 -1
- package/console/dist/web/assets/app.js +5 -2
- package/core/dist/index.d.ts +2 -3
- package/core/dist/index.d.ts.map +1 -1
- package/core/dist/index.js +1 -3
- package/core/dist/index.js.map +1 -1
- package/core/dist/pain-signal.d.ts +11 -71
- package/core/dist/pain-signal.d.ts.map +1 -1
- package/core/dist/pain-signal.js +10 -120
- package/core/dist/pain-signal.js.map +1 -1
- package/core/dist/principle-tree-ledger.d.ts +4 -87
- package/core/dist/principle-tree-ledger.d.ts.map +1 -1
- package/core/dist/principle-tree-ledger.js +51 -148
- package/core/dist/principle-tree-ledger.js.map +1 -1
- package/core/dist/prompt-builder/__tests__/model-config.test.d.ts +2 -0
- package/core/dist/prompt-builder/__tests__/model-config.test.d.ts.map +1 -0
- package/core/dist/prompt-builder/__tests__/model-config.test.js +158 -0
- package/core/dist/prompt-builder/__tests__/model-config.test.js.map +1 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.d.ts +2 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.d.ts.map +1 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.js +42 -0
- package/core/dist/prompt-builder/__tests__/xml-escape.test.js.map +1 -0
- package/core/dist/prompt-builder/index.d.ts +3 -0
- package/core/dist/prompt-builder/index.d.ts.map +1 -1
- package/core/dist/prompt-builder/index.js +2 -0
- package/core/dist/prompt-builder/index.js.map +1 -1
- package/core/dist/prompt-builder/model-config.d.ts +42 -0
- package/core/dist/prompt-builder/model-config.d.ts.map +1 -0
- package/core/dist/prompt-builder/model-config.js +84 -0
- package/core/dist/prompt-builder/model-config.js.map +1 -0
- package/core/dist/prompt-builder/xml-escape.d.ts +12 -0
- package/core/dist/prompt-builder/xml-escape.d.ts.map +1 -0
- package/core/dist/prompt-builder/xml-escape.js +19 -0
- package/core/dist/prompt-builder/xml-escape.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +265 -20
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/barrel-io-cleanup.test.d.ts +12 -0
- package/core/dist/runtime-v2/__tests__/barrel-io-cleanup.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/barrel-io-cleanup.test.js +46 -0
- package/core/dist/runtime-v2/__tests__/barrel-io-cleanup.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/io-deletion.test.d.ts +12 -0
- package/core/dist/runtime-v2/__tests__/io-deletion.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/io-deletion.test.js +92 -0
- package/core/dist/runtime-v2/__tests__/io-deletion.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/ledger-codec.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/ledger-codec.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/ledger-codec.test.js +429 -0
- package/core/dist/runtime-v2/__tests__/ledger-codec.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/ledger-store.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/ledger-store.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/ledger-store.test.js +65 -0
- package/core/dist/runtime-v2/__tests__/ledger-store.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +395 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js +146 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-signal-unification.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-unification.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-unification.test.js +150 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-unification.test.js.map +1 -0
- package/core/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.js +199 -0
- package/core/dist/runtime-v2/adapter/__tests__/test-double-runtime-adapter.test.js.map +1 -1
- package/core/dist/runtime-v2/bridge-result-shaper.d.ts +53 -0
- package/core/dist/runtime-v2/bridge-result-shaper.d.ts.map +1 -0
- package/core/dist/runtime-v2/bridge-result-shaper.js +117 -0
- package/core/dist/runtime-v2/bridge-result-shaper.js.map +1 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts +13 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js +111 -0
- package/core/dist/runtime-v2/detection/__tests__/detection-funnel-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.d.ts +103 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.js +135 -0
- package/core/dist/runtime-v2/detection/detection-funnel-policy.js.map +1 -0
- package/core/dist/runtime-v2/detection/index.d.ts +10 -0
- package/core/dist/runtime-v2/detection/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/detection/index.js +9 -0
- package/core/dist/runtime-v2/detection/index.js.map +1 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js +156 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts +12 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js +181 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/observation-resolver.test.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js +104 -1
- package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/index.d.ts +3 -0
- package/core/dist/runtime-v2/evidence-triage/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/index.js +3 -0
- package/core/dist/runtime-v2/evidence-triage/index.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts +128 -0
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.d.ts.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js +203 -0
- package/core/dist/runtime-v2/evidence-triage/observation-resolver.js.map +1 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts +4 -0
- package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/triage-policy.js +66 -9
- package/core/dist/runtime-v2/evidence-triage/triage-policy.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.d.ts +14 -0
- package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/types.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +33 -4
- 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 +9 -2
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.d.ts +15 -0
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.js +450 -0
- package/core/dist/runtime-v2/feedback/__tests__/redact-sensitive.test.js.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.d.ts +13 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.js +243 -0
- package/core/dist/runtime-v2/feedback/__tests__/render-github-url.test.js.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.d.ts +12 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.js +172 -0
- package/core/dist/runtime-v2/feedback/__tests__/safe-stringify.test.js.map +1 -0
- package/core/dist/runtime-v2/index.d.ts +9 -6
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +8 -4
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js +306 -0
- package/core/dist/runtime-v2/internalization/__tests__/c2-live-runner-chain.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/index.d.ts +0 -16
- package/core/dist/runtime-v2/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/index.js +0 -8
- package/core/dist/runtime-v2/internalization/index.js.map +1 -1
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts +15 -0
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js +179 -0
- package/core/dist/runtime-v2/pain-gate/__tests__/pain-diagnostic-gate-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/pain-gate/index.d.ts +10 -0
- package/core/dist/runtime-v2/pain-gate/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/pain-gate/index.js +9 -0
- package/core/dist/runtime-v2/pain-gate/index.js.map +1 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts +121 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js +157 -0
- package/core/dist/runtime-v2/pain-gate/pain-diagnostic-gate-policy.js.map +1 -0
- package/core/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-bridge.js +14 -88
- package/core/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +15 -5
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/dist/runtime-v2/principle-tree/ledger-codec.d.ts +30 -0
- package/core/dist/runtime-v2/principle-tree/ledger-codec.d.ts.map +1 -0
- package/core/dist/runtime-v2/principle-tree/ledger-codec.js +154 -0
- package/core/dist/runtime-v2/principle-tree/ledger-codec.js.map +1 -0
- package/core/dist/runtime-v2/types/event-types.d.ts +0 -27
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js +2 -17
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/dist/runtime-v2/types/index.d.ts +4 -2
- package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/index.js +4 -1
- package/core/dist/runtime-v2/types/index.js.map +1 -1
- package/core/dist/runtime-v2/types/ledger-store.d.ts +101 -0
- package/core/dist/runtime-v2/types/ledger-store.d.ts.map +1 -0
- package/core/dist/runtime-v2/types/ledger-store.js +15 -0
- package/core/dist/runtime-v2/types/ledger-store.js.map +1 -0
- package/core/dist/runtime-v2/types/pain-signal.d.ts +7 -5
- package/core/dist/runtime-v2/types/pain-signal.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/pain-signal.js +25 -5
- package/core/dist/runtime-v2/types/pain-signal.js.map +1 -1
- package/core/package.json +3 -3
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +9 -3
- package/dist/installer.js.map +1 -1
- package/dist/mvp-config.d.ts +0 -10
- package/dist/mvp-config.d.ts.map +1 -1
- package/dist/mvp-config.js +0 -64
- package/dist/mvp-config.js.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +10 -4
- package/dist/utils/env.js.map +1 -1
- package/package.json +1 -1
- package/pd-cli/dist/commands/__tests__/legacy-cleanup.test.js +11 -3
- package/pd-cli/dist/commands/__tests__/legacy-cleanup.test.js.map +1 -1
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +2 -1
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +2 -1
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/dist/commands/mvp-smoke.js +1 -1
- package/pd-cli/dist/commands/mvp-smoke.js.map +1 -1
- package/pd-cli/dist/commands/rulecode.js +1 -1
- package/pd-cli/dist/commands/rulecode.js.map +1 -1
- package/pd-cli/dist/commands/runtime-canary.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-canary.js +10 -11
- package/pd-cli/dist/commands/runtime-canary.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-integrity.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-integrity.js +3 -1
- package/pd-cli/dist/commands/runtime-internalization-integrity.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-queue.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-queue.js +13 -16
- package/pd-cli/dist/commands/runtime-internalization-queue.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +3 -0
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js +61 -7
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/pd-cli/dist/commands/runtime-uat.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-uat.js +4 -1
- package/pd-cli/dist/commands/runtime-uat.js.map +1 -1
- package/pd-cli/dist/commands/runtime.js +1 -1
- package/pd-cli/dist/commands/runtime.js.map +1 -1
- package/pd-cli/dist/index.js +67 -34
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/legacy/session-history-import.js +7 -5
- package/pd-cli/dist/legacy/session-history-import.js.map +1 -1
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.d.ts +2 -0
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.d.ts.map +1 -0
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.js +314 -0
- package/pd-cli/dist/services/__tests__/rulehost-readiness.test.js.map +1 -0
- package/pd-cli/dist/services/__tests__/runtime-adapter-resolver.test.js +33 -14
- package/pd-cli/dist/services/__tests__/runtime-adapter-resolver.test.js.map +1 -1
- package/pd-cli/dist/services/pain-flood-simulation-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/pain-flood-simulation-runner.js +6 -2
- package/pd-cli/dist/services/pain-flood-simulation-runner.js.map +1 -1
- package/pd-cli/dist/services/rulehost-readiness.d.ts +62 -0
- package/pd-cli/dist/services/rulehost-readiness.d.ts.map +1 -0
- package/pd-cli/dist/services/rulehost-readiness.js +214 -0
- package/pd-cli/dist/services/rulehost-readiness.js.map +1 -0
- package/pd-cli/dist/services/runtime-adapter-resolver.d.ts +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.d.ts.map +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.js +9 -7
- package/pd-cli/dist/services/runtime-adapter-resolver.js.map +1 -1
- package/plugin/dist/commands/capabilities.js +3 -2
- package/plugin/dist/commands/disable-impl.js +1 -1
- package/plugin/dist/commands/evolution-status.js +0 -2
- package/plugin/dist/commands/focus.js +10 -2
- package/plugin/dist/commands/rollback-impl.js +1 -1
- package/plugin/dist/commands/thinking-os.js +5 -1
- package/plugin/dist/core/correction-cue-learner.js +2 -0
- package/plugin/dist/core/detection-funnel.d.ts +25 -11
- package/plugin/dist/core/detection-funnel.js +32 -80
- package/plugin/dist/core/event-log.d.ts +1 -3
- package/plugin/dist/core/event-log.js +27 -31
- package/plugin/dist/core/evolution-reducer.d.ts +0 -8
- package/plugin/dist/core/evolution-reducer.js +9 -19
- package/plugin/dist/core/focus-history.js +1 -1
- package/plugin/dist/core/hygiene/tracker.js +3 -3
- package/plugin/dist/core/pain-diagnostic-gate.d.ts +37 -28
- package/plugin/dist/core/pain-diagnostic-gate.js +53 -89
- package/plugin/dist/core/pain.d.ts +0 -63
- package/plugin/dist/core/pain.js +0 -167
- package/plugin/dist/core/paths.d.ts +0 -1
- package/plugin/dist/core/paths.js +2 -1
- package/plugin/dist/core/principle-compiler/compiler.js +2 -0
- package/plugin/dist/core/replay-engine.js +1 -1
- package/plugin/dist/core/rule-host.js +3 -1
- package/plugin/dist/core/schema/migrations/001-init-trajectory.js +3 -6
- package/plugin/dist/core/schema/schema-definitions.js +4 -9
- package/plugin/dist/core/thinking-os-parser.js +13 -4
- package/plugin/dist/core/trajectory.d.ts +0 -16
- package/plugin/dist/core/trajectory.js +9 -60
- package/plugin/dist/hooks/after-tool-call-helpers.d.ts +4 -1
- package/plugin/dist/hooks/after-tool-call-helpers.js +13 -17
- package/plugin/dist/hooks/gate-block-helper.js +57 -17
- package/plugin/dist/hooks/lifecycle.js +3 -6
- package/plugin/dist/hooks/llm.js +66 -26
- package/plugin/dist/hooks/pain.d.ts +3 -1
- package/plugin/dist/hooks/pain.js +119 -49
- package/plugin/dist/hooks/prompt-helpers.d.ts +87 -0
- package/plugin/dist/hooks/prompt-helpers.js +251 -0
- package/plugin/dist/hooks/prompt-types.d.ts +66 -0
- package/plugin/dist/hooks/prompt-types.js +12 -0
- package/plugin/dist/hooks/prompt.d.ts +7 -38
- package/plugin/dist/hooks/prompt.js +361 -325
- package/plugin/dist/hooks/raw-observation-adapter.d.ts +9 -50
- package/plugin/dist/hooks/raw-observation-adapter.js +9 -164
- package/plugin/dist/hooks/raw-observation-types.d.ts +6 -57
- package/plugin/dist/hooks/raw-observation-types.js +5 -9
- package/plugin/dist/hooks/trajectory-collector.d.ts +20 -4
- package/plugin/dist/hooks/trajectory-collector.js +95 -156
- package/plugin/dist/hooks/triage-adapter.js +6 -26
- package/plugin/dist/hooks/trigger-cooldown-tracker.d.ts +12 -0
- package/plugin/dist/hooks/trigger-cooldown-tracker.js +25 -0
- package/plugin/dist/index.js +7 -2
- package/plugin/dist/openclaw-sdk.d.ts +4 -1
- package/plugin/dist/service/evolution-worker.js +8 -62
- package/plugin/dist/service/internalization-auto-consumer-service.js +2 -1
- package/plugin/dist/service/runtime-summary-service.d.ts +0 -2
- package/plugin/dist/service/runtime-summary-service.js +8 -5
- package/plugin/dist/service/workflow-watchdog.js +2 -1
- package/plugin/dist/types/event-types.d.ts +1 -1
- package/plugin/dist/utils/retry.js +7 -2
- package/plugin/dist/utils/session-key.js +4 -1
- package/plugin/scripts/sync-plugin.mjs +33 -22
- package/plugin/scripts/validate-live-path.ts +0 -18
- package/plugin/templates/langs/en/skills/pd-cli-operator/SKILL.md +20 -11
- package/plugin/templates/langs/en/skills/pd-runtime-v2/SKILL.md +10 -0
- package/plugin/templates/langs/zh/skills/pd-cli-operator/SKILL.md +20 -11
- package/plugin/templates/langs/zh/skills/pd-runtime-v2/SKILL.md +10 -0
- package/console/dist/server/config/feature-flags.d.ts +0 -25
- package/console/dist/server/config/feature-flags.js +0 -101
- package/core/dist/io.d.ts +0 -35
- package/core/dist/io.d.ts.map +0 -1
- package/core/dist/io.js +0 -95
- package/core/dist/io.js.map +0 -1
- package/pd-cli/dist/commands/central-sync.d.ts +0 -10
- package/pd-cli/dist/commands/central-sync.d.ts.map +0 -1
- package/pd-cli/dist/commands/central-sync.js +0 -32
- package/pd-cli/dist/commands/central-sync.js.map +0 -1
- package/pd-cli/dist/services/feature-flag-loader.d.ts +0 -6
- package/pd-cli/dist/services/feature-flag-loader.d.ts.map +0 -1
- package/pd-cli/dist/services/feature-flag-loader.js +0 -53
- package/pd-cli/dist/services/feature-flag-loader.js.map +0 -1
- package/plugin/dist/core/observability.d.ts +0 -40
- package/plugin/dist/core/observability.js +0 -164
- package/plugin/dist/hooks/subagent.d.ts +0 -9
- package/plugin/dist/hooks/subagent.js +0 -122
package/core/dist/index.d.ts
CHANGED
|
@@ -16,9 +16,8 @@ export { PainSignalAdapter } from './pain-signal-adapter.js';
|
|
|
16
16
|
export { TelemetryEventSchema, validateTelemetryEvent } from './telemetry-event.js';
|
|
17
17
|
export type { TelemetryEvent, TelemetryEventValidationResult, TelemetryEventType } from './telemetry-event.js';
|
|
18
18
|
export { PrincipleInjector, DefaultPrincipleInjector, InjectionContext } from './principle-injector.js';
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export type { PromptInjectionPart, SizeGuardOptions } from './prompt-builder/index.js';
|
|
19
|
+
export { buildAttitudeDirective, detectCorrectionCue, escapeXml, extractMessageContent, isMinimalTrigger, truncateInjectionToBudget, isValidModelFormat, resolveModelFromConfig, } from './prompt-builder/index.js';
|
|
20
|
+
export type { PromptInjectionPart, SizeGuardOptions, CoreLogger, ModelConfigObject } from './prompt-builder/index.js';
|
|
22
21
|
export { matchEmpathyKeywords, createDefaultKeywordStore, applyKeywordUpdates, shouldTriggerOptimization, getKeywordStoreSummary, EMPATHY_SEED_KEYWORDS, DEFAULT_EMPATHY_KEYWORD_CONFIG, scoreToSeverity, severityToPenalty, normalizeSeverity, } from './prompt-builder/index.js';
|
|
23
22
|
export type { EmpathyKeywordStore, EmpathyKeywordEntry, EmpathyKeywordStats, EmpathyMatchResult, EmpathyKeywordUpdate, EmpathyOptimizationResult, SeedKeywordEntry, EmpathyKeywordConfig, } from './prompt-builder/index.js';
|
|
24
23
|
export { extractVersion, extractDate, extractSummary, parseWorkingMemorySection, workingMemoryToInjection, extractMilestones, validateCurrentFocus, mergeWorkingMemory, compressFocusContent, DEFAULT_FOCUS_COMPRESSION_OPTIONS, } from './prompt-builder/index.js';
|
package/core/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtG,YAAY,EAAE,UAAU,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAG/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACpF,Y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AQ,EACR,SAAS,GACV,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAG7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG3E,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,YAAY,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,oBAAoB,GACrB,MAAM,6BAA6B,CAAC"}
|
package/core/dist/index.js
CHANGED
|
@@ -16,10 +16,8 @@ export { PainSignalSchema, validatePainSignal, deriveSeverity, PainSeverity } fr
|
|
|
16
16
|
export { TelemetryEventSchema, validateTelemetryEvent } from './telemetry-event.js';
|
|
17
17
|
// PrincipleInjector interface and DefaultPrincipleInjector
|
|
18
18
|
export { DefaultPrincipleInjector } from './principle-injector.js';
|
|
19
|
-
// I/O utilities (D-03: atomicWriteFileSync for crash-safe writes)
|
|
20
|
-
export { atomicWriteFileSync } from './io.js';
|
|
21
19
|
// Prompt builder primitives — pure functions extracted from openclaw-plugin prompt hook (PRI-75)
|
|
22
|
-
export { buildAttitudeDirective, detectCorrectionCue, extractMessageContent, isMinimalTrigger, truncateInjectionToBudget, } from './prompt-builder/index.js';
|
|
20
|
+
export { buildAttitudeDirective, detectCorrectionCue, escapeXml, extractMessageContent, isMinimalTrigger, truncateInjectionToBudget, isValidModelFormat, resolveModelFromConfig, } from './prompt-builder/index.js';
|
|
23
21
|
// Prompt builder — empathy keyword matching (PRI-81 Phase A)
|
|
24
22
|
export { matchEmpathyKeywords, createDefaultKeywordStore, applyKeywordUpdates, shouldTriggerOptimization, getKeywordStoreSummary, EMPATHY_SEED_KEYWORDS, DEFAULT_EMPATHY_KEYWORD_CONFIG, scoreToSeverity, severityToPenalty, normalizeSeverity, } from './prompt-builder/index.js';
|
|
25
23
|
// Prompt builder — focus compression (PRI-81 Phase B)
|
package/core/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,mCAAmC;AACnC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMtG,wBAAwB;AACxB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGpF,2DAA2D;AAC3D,OAAO,EAAqB,wBAAwB,EAAoB,MAAM,yBAAyB,CAAC;AAExG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,mCAAmC;AACnC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAMtG,wBAAwB;AACxB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGpF,2DAA2D;AAC3D,OAAO,EAAqB,wBAAwB,EAAoB,MAAM,yBAAyB,CAAC;AAExG,iGAAiG;AACjG,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,SAAS,EACT,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AA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vB,2BAA2B,EAC3B,yBAAyB,EACzB,4BAA4B,EAC5B,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,uBAAuB,CAAC;AAE/B,yCAAyC;AACzC,OAAO,EACL,oCAAoC,EACpC,2BAA2B,EAC3B,wBAAwB,EACxB,iCAAiC,EACjC,2BAA2B,EAC3B,kCAAkC,GACnC,MAAM,uBAAuB,CAAC;AA4C/B,4BAA4B;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,8DAA8D;AAC9D,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAkB/B,mBAAmB;AACnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,gBAAgB;AAChB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAExE,yBAAyB;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -1,76 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Pain signal schema — re-exported from runtime-v2/types/pain-signal.ts.
|
|
3
3
|
*
|
|
4
|
-
* This
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* cross-workspace evolution and multi-domain support.
|
|
4
|
+
* This file exists for backward compatibility with imports from
|
|
5
|
+
* @principles/core (top-level barrel). The canonical definition
|
|
6
|
+
* lives in runtime-v2/types/pain-signal.ts (PRI-443).
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* The unified schema merges the stricter validations from both versions:
|
|
9
|
+
* - ISO 8601 timestamp format check
|
|
10
|
+
* - Context size limit (10KB)
|
|
11
|
+
* - version field with default
|
|
12
|
+
* - isStringRecord type guard (no `as` bypass)
|
|
10
13
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Severity levels derived from pain score thresholds.
|
|
14
|
-
* - low: 0-39 (minor issue, informational)
|
|
15
|
-
* - medium: 40-69 (moderate error)
|
|
16
|
-
* - high: 70-89 (severe violation)
|
|
17
|
-
* - critical: 90-100 (systemic failure, spiral detected)
|
|
18
|
-
*/
|
|
19
|
-
export declare const PainSeverity: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"medium">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"critical">]>;
|
|
20
|
-
export type PainSeverity = Static<typeof PainSeverity>;
|
|
21
|
-
/**
|
|
22
|
-
* TypeBox schema for a universal pain signal.
|
|
23
|
-
*
|
|
24
|
-
* Every signal MUST have: source, score, timestamp, reason, sessionId,
|
|
25
|
-
* agentId, traceId, triggerTextPreview. Optional fields (domain, severity,
|
|
26
|
-
* context) default during validation.
|
|
27
|
-
*/
|
|
28
|
-
export declare const PainSignalSchema: import("@sinclair/typebox").TObject<{
|
|
29
|
-
/** What triggered this pain signal (e.g., 'tool_failure', 'human_intervention') */
|
|
30
|
-
source: import("@sinclair/typebox").TString;
|
|
31
|
-
/** Pain score 0-100 */
|
|
32
|
-
score: import("@sinclair/typebox").TNumber;
|
|
33
|
-
/** ISO 8601 timestamp */
|
|
34
|
-
timestamp: import("@sinclair/typebox").TString;
|
|
35
|
-
/** Human-readable reason / error description */
|
|
36
|
-
reason: import("@sinclair/typebox").TString;
|
|
37
|
-
/** Session ID — identifies which conversation this happened in */
|
|
38
|
-
sessionId: import("@sinclair/typebox").TString;
|
|
39
|
-
/** Agent ID — identifies which agent (main, builder, diagnostician, etc.) */
|
|
40
|
-
agentId: import("@sinclair/typebox").TString;
|
|
41
|
-
/** Correlation trace ID for linking events across the pipeline */
|
|
42
|
-
traceId: import("@sinclair/typebox").TString;
|
|
43
|
-
/** Preview of the text that triggered this pain */
|
|
44
|
-
triggerTextPreview: import("@sinclair/typebox").TString;
|
|
45
|
-
/** Schema version for forward compatibility (e.g., '0.1.0') */
|
|
46
|
-
version: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
47
|
-
/** Domain context (e.g., 'coding', 'writing', 'analysis') */
|
|
48
|
-
domain: import("@sinclair/typebox").TString;
|
|
49
|
-
/** Severity level derived from score */
|
|
50
|
-
severity: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"low">, import("@sinclair/typebox").TLiteral<"medium">, import("@sinclair/typebox").TLiteral<"high">, import("@sinclair/typebox").TLiteral<"critical">]>;
|
|
51
|
-
/** Additional structured context payload */
|
|
52
|
-
context: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
53
|
-
}>;
|
|
54
|
-
export type PainSignal = Static<typeof PainSignalSchema>;
|
|
55
|
-
/**
|
|
56
|
-
* Derives severity from a numeric pain score.
|
|
57
|
-
*/
|
|
58
|
-
export declare function deriveSeverity(score: number): PainSeverity;
|
|
59
|
-
export interface PainSignalValidationResult {
|
|
60
|
-
valid: boolean;
|
|
61
|
-
errors: string[];
|
|
62
|
-
signal?: PainSignal;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Validates an arbitrary object against the PainSignal schema.
|
|
66
|
-
*
|
|
67
|
-
* Returns a structured result with:
|
|
68
|
-
* - `valid`: whether the input conforms to the schema
|
|
69
|
-
* - `errors`: human-readable list of validation failures
|
|
70
|
-
* - `signal`: the typed signal (only present when valid)
|
|
71
|
-
*
|
|
72
|
-
* Missing optional fields (domain, severity, context, version) are filled with defaults
|
|
73
|
-
* before validation so callers get a fully-formed signal back.
|
|
74
|
-
*/
|
|
75
|
-
export declare function validatePainSignal(input: unknown): PainSignalValidationResult;
|
|
14
|
+
export { PainSeverity, PainSignalSchema, deriveSeverity, validatePainSignal, } from './runtime-v2/types/pain-signal.js';
|
|
15
|
+
export type { PainSignal, PainSignalValidationResult, } from './runtime-v2/types/pain-signal.js';
|
|
76
16
|
//# sourceMappingURL=pain-signal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pain-signal.d.ts","sourceRoot":"","sources":["../src/pain-signal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pain-signal.d.ts","sourceRoot":"","sources":["../src/pain-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EACV,UAAU,EACV,0BAA0B,GAC3B,MAAM,mCAAmC,CAAC"}
|
package/core/dist/pain-signal.js
CHANGED
|
@@ -1,125 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Pain signal schema — re-exported from runtime-v2/types/pain-signal.ts.
|
|
3
3
|
*
|
|
4
|
-
* This
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* cross-workspace evolution and multi-domain support.
|
|
4
|
+
* This file exists for backward compatibility with imports from
|
|
5
|
+
* @principles/core (top-level barrel). The canonical definition
|
|
6
|
+
* lives in runtime-v2/types/pain-signal.ts (PRI-443).
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* The unified schema merges the stricter validations from both versions:
|
|
9
|
+
* - ISO 8601 timestamp format check
|
|
10
|
+
* - Context size limit (10KB)
|
|
11
|
+
* - version field with default
|
|
12
|
+
* - isStringRecord type guard (no `as` bypass)
|
|
10
13
|
*/
|
|
11
|
-
|
|
12
|
-
import { Value } from '@sinclair/typebox/value';
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// PainSignal Schema
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
/**
|
|
17
|
-
* Severity levels derived from pain score thresholds.
|
|
18
|
-
* - low: 0-39 (minor issue, informational)
|
|
19
|
-
* - medium: 40-69 (moderate error)
|
|
20
|
-
* - high: 70-89 (severe violation)
|
|
21
|
-
* - critical: 90-100 (systemic failure, spiral detected)
|
|
22
|
-
*/
|
|
23
|
-
export const PainSeverity = Type.Union([
|
|
24
|
-
Type.Literal('low'),
|
|
25
|
-
Type.Literal('medium'),
|
|
26
|
-
Type.Literal('high'),
|
|
27
|
-
Type.Literal('critical'),
|
|
28
|
-
]);
|
|
29
|
-
/**
|
|
30
|
-
* TypeBox schema for a universal pain signal.
|
|
31
|
-
*
|
|
32
|
-
* Every signal MUST have: source, score, timestamp, reason, sessionId,
|
|
33
|
-
* agentId, traceId, triggerTextPreview. Optional fields (domain, severity,
|
|
34
|
-
* context) default during validation.
|
|
35
|
-
*/
|
|
36
|
-
export const PainSignalSchema = Type.Object({
|
|
37
|
-
/** What triggered this pain signal (e.g., 'tool_failure', 'human_intervention') */
|
|
38
|
-
source: Type.String({ minLength: 1 }),
|
|
39
|
-
/** Pain score 0-100 */
|
|
40
|
-
score: Type.Number({ minimum: 0, maximum: 100 }),
|
|
41
|
-
/** ISO 8601 timestamp */
|
|
42
|
-
timestamp: Type.String({ minLength: 1 }),
|
|
43
|
-
/** Human-readable reason / error description */
|
|
44
|
-
reason: Type.String({ minLength: 1 }),
|
|
45
|
-
/** Session ID — identifies which conversation this happened in */
|
|
46
|
-
sessionId: Type.String({ minLength: 1 }),
|
|
47
|
-
/** Agent ID — identifies which agent (main, builder, diagnostician, etc.) */
|
|
48
|
-
agentId: Type.String({ minLength: 1 }),
|
|
49
|
-
/** Correlation trace ID for linking events across the pipeline */
|
|
50
|
-
traceId: Type.String({ minLength: 1 }),
|
|
51
|
-
/** Preview of the text that triggered this pain */
|
|
52
|
-
triggerTextPreview: Type.String(),
|
|
53
|
-
/** Schema version for forward compatibility (e.g., '0.1.0') */
|
|
54
|
-
version: Type.Optional(Type.String({ default: '0.1.0' })),
|
|
55
|
-
/** Domain context (e.g., 'coding', 'writing', 'analysis') */
|
|
56
|
-
domain: Type.String({ default: 'coding' }),
|
|
57
|
-
/** Severity level derived from score */
|
|
58
|
-
severity: PainSeverity,
|
|
59
|
-
/** Additional structured context payload */
|
|
60
|
-
context: Type.Record(Type.String(), Type.Unknown()),
|
|
61
|
-
});
|
|
62
|
-
// ---------------------------------------------------------------------------
|
|
63
|
-
// Default Derivation
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
/**
|
|
66
|
-
* Derives severity from a numeric pain score.
|
|
67
|
-
*/
|
|
68
|
-
export function deriveSeverity(score) {
|
|
69
|
-
if (score >= 90)
|
|
70
|
-
return 'critical';
|
|
71
|
-
if (score >= 70)
|
|
72
|
-
return 'high';
|
|
73
|
-
if (score >= 40)
|
|
74
|
-
return 'medium';
|
|
75
|
-
return 'low';
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Validates an arbitrary object against the PainSignal schema.
|
|
79
|
-
*
|
|
80
|
-
* Returns a structured result with:
|
|
81
|
-
* - `valid`: whether the input conforms to the schema
|
|
82
|
-
* - `errors`: human-readable list of validation failures
|
|
83
|
-
* - `signal`: the typed signal (only present when valid)
|
|
84
|
-
*
|
|
85
|
-
* Missing optional fields (domain, severity, context, version) are filled with defaults
|
|
86
|
-
* before validation so callers get a fully-formed signal back.
|
|
87
|
-
*/
|
|
88
|
-
export function validatePainSignal(input) {
|
|
89
|
-
if (typeof input !== 'object' || input === null || Array.isArray(input)) {
|
|
90
|
-
return { valid: false, errors: ['Input must be a non-null object'] };
|
|
91
|
-
}
|
|
92
|
-
const raw = input;
|
|
93
|
-
// Apply defaults for optional fields before validation
|
|
94
|
-
const hydrated = {
|
|
95
|
-
...raw,
|
|
96
|
-
domain: raw.domain ?? 'coding',
|
|
97
|
-
version: raw.version ?? '0.1.0',
|
|
98
|
-
severity: raw.severity ?? deriveSeverity(typeof raw.score === 'number' ? raw.score : 0),
|
|
99
|
-
context: raw.context ?? {},
|
|
100
|
-
};
|
|
101
|
-
// Security: enforce context size limit to prevent memory exhaustion
|
|
102
|
-
const MAX_CONTEXT_SIZE = 10_000;
|
|
103
|
-
if (JSON.stringify(hydrated.context).length > MAX_CONTEXT_SIZE) {
|
|
104
|
-
return { valid: false, errors: ['Context object exceeds maximum size (10KB)'] };
|
|
105
|
-
}
|
|
106
|
-
// Validate ISO 8601 timestamp format
|
|
107
|
-
if (typeof hydrated.timestamp === 'string' &&
|
|
108
|
-
isNaN(Date.parse(hydrated.timestamp))) {
|
|
109
|
-
return { valid: false, errors: ['timestamp must be a valid ISO 8601 date string'] };
|
|
110
|
-
}
|
|
111
|
-
// Collect TypeBox errors using Decode (strict, not Cast which coerces)
|
|
112
|
-
const errors = [...Value.Errors(PainSignalSchema, hydrated)];
|
|
113
|
-
if (errors.length > 0) {
|
|
114
|
-
return {
|
|
115
|
-
valid: false,
|
|
116
|
-
errors: errors.map((e) => `${e.path ? `${e.path}: ` : ''}${e.message}`),
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
valid: true,
|
|
121
|
-
errors: [],
|
|
122
|
-
signal: Value.Cast(PainSignalSchema, hydrated),
|
|
123
|
-
};
|
|
124
|
-
}
|
|
14
|
+
export { PainSeverity, PainSignalSchema, deriveSeverity, validatePainSignal, } from './runtime-v2/types/pain-signal.js';
|
|
125
15
|
//# sourceMappingURL=pain-signal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pain-signal.js","sourceRoot":"","sources":["../src/pain-signal.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pain-signal.js","sourceRoot":"","sources":["../src/pain-signal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,kBAAkB,GACnB,MAAM,mCAAmC,CAAC"}
|
|
@@ -10,93 +10,10 @@
|
|
|
10
10
|
* M8 key insight: ledger operations are single-process. No cross-process
|
|
11
11
|
* locking needed for pd-cli usage. The file write is atomic (rename).
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export type
|
|
16
|
-
export
|
|
17
|
-
export interface Principle {
|
|
18
|
-
id: string;
|
|
19
|
-
version: number;
|
|
20
|
-
text: string;
|
|
21
|
-
triggerPattern: string;
|
|
22
|
-
action: string;
|
|
23
|
-
status: PrincipleStatus;
|
|
24
|
-
priority: PrinciplePriority;
|
|
25
|
-
scope: PrincipleScope;
|
|
26
|
-
evaluability: PrincipleEvaluability;
|
|
27
|
-
valueScore: number;
|
|
28
|
-
adherenceRate: number;
|
|
29
|
-
painPreventedCount: number;
|
|
30
|
-
derivedFromPainIds: string[];
|
|
31
|
-
ruleIds: string[];
|
|
32
|
-
conflictsWithPrincipleIds: string[];
|
|
33
|
-
createdAt: string;
|
|
34
|
-
updatedAt: string;
|
|
35
|
-
}
|
|
36
|
-
export interface Rule {
|
|
37
|
-
id: string;
|
|
38
|
-
principleId: string;
|
|
39
|
-
ruleIds: string[];
|
|
40
|
-
implementationIds: string[];
|
|
41
|
-
type?: string;
|
|
42
|
-
status?: string;
|
|
43
|
-
lifecycleState?: string;
|
|
44
|
-
createdAt?: string;
|
|
45
|
-
updatedAt?: string;
|
|
46
|
-
}
|
|
47
|
-
export interface Implementation {
|
|
48
|
-
id: string;
|
|
49
|
-
ruleId: string;
|
|
50
|
-
type?: string;
|
|
51
|
-
lifecycleState?: string;
|
|
52
|
-
[key: string]: unknown;
|
|
53
|
-
}
|
|
54
|
-
export interface PrincipleValueMetrics {
|
|
55
|
-
principleId: string;
|
|
56
|
-
painPreventedCount?: number;
|
|
57
|
-
lastPainPreventedAt?: string;
|
|
58
|
-
avgPainSeverityPrevented?: number;
|
|
59
|
-
totalOpportunities?: number;
|
|
60
|
-
adheredCount?: number;
|
|
61
|
-
violatedCount?: number;
|
|
62
|
-
implementationCost?: number;
|
|
63
|
-
benefitScore?: number;
|
|
64
|
-
calculatedAt?: string;
|
|
65
|
-
}
|
|
66
|
-
export interface LedgerPrinciple extends Principle {
|
|
67
|
-
suggestedRules?: string[];
|
|
68
|
-
lastTriggeredAt?: string;
|
|
69
|
-
}
|
|
70
|
-
export interface LedgerRule extends Rule {
|
|
71
|
-
implementationIds: string[];
|
|
72
|
-
}
|
|
73
|
-
export interface LedgerTreeStore {
|
|
74
|
-
principles: Record<string, LedgerPrinciple>;
|
|
75
|
-
rules: Record<string, LedgerRule>;
|
|
76
|
-
implementations: Record<string, Implementation>;
|
|
77
|
-
metrics: Record<string, PrincipleValueMetrics>;
|
|
78
|
-
lastUpdated: string;
|
|
79
|
-
}
|
|
80
|
-
export interface LegacyPrincipleTrainingState {
|
|
81
|
-
principleId: string;
|
|
82
|
-
evaluability: 'deterministic' | 'weak_heuristic' | 'manual_only';
|
|
83
|
-
applicableOpportunityCount: number;
|
|
84
|
-
observedViolationCount: number;
|
|
85
|
-
complianceRate: number;
|
|
86
|
-
violationTrend: number;
|
|
87
|
-
generatedSampleCount: number;
|
|
88
|
-
approvedSampleCount: number;
|
|
89
|
-
includedTrainRunIds: string[];
|
|
90
|
-
deployedCheckpointIds: string[];
|
|
91
|
-
lastEvalScore?: number;
|
|
92
|
-
internalizationStatus: 'prompt_only' | 'needs_training' | 'in_training' | 'deployed_pending_eval' | 'internalized' | 'regressed';
|
|
93
|
-
}
|
|
94
|
-
export type LegacyPrincipleTrainingStore = Record<string, LegacyPrincipleTrainingState>;
|
|
95
|
-
export interface HybridLedgerStore {
|
|
96
|
-
trainingStore: LegacyPrincipleTrainingStore;
|
|
97
|
-
tree: LedgerTreeStore;
|
|
98
|
-
}
|
|
99
|
-
export declare const TREE_NAMESPACE = "_tree";
|
|
13
|
+
import type { Principle, Rule, Implementation, PrincipleValueMetrics, LedgerPrinciple, LedgerRule, LedgerTreeStore, LegacyPrincipleTrainingState, LegacyPrincipleTrainingStore, HybridLedgerStore } from './runtime-v2/types/ledger-store.js';
|
|
14
|
+
import { TREE_NAMESPACE } from './runtime-v2/types/ledger-store.js';
|
|
15
|
+
export type { Principle, Rule, Implementation, PrincipleValueMetrics, LedgerPrinciple, LedgerRule, LedgerTreeStore, LegacyPrincipleTrainingState, LegacyPrincipleTrainingStore, HybridLedgerStore, };
|
|
16
|
+
export { TREE_NAMESPACE };
|
|
100
17
|
export declare function loadLedger(stateDir: string): HybridLedgerStore;
|
|
101
18
|
export declare function saveLedger(stateDir: string, store: HybridLedgerStore): void;
|
|
102
19
|
export declare function addPrincipleToLedger(stateDir: string, principle: LedgerPrinciple): LedgerPrinciple;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"principle-tree-ledger.d.ts","sourceRoot":"","sources":["../src/principle-tree-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"principle-tree-ledger.d.ts","sourceRoot":"","sources":["../src/principle-tree-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,eAAe,EACf,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAYpE,YAAY,EACV,SAAS,EACT,IAAI,EACJ,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,eAAe,EACf,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,GAClB,CAAC;AACF,OAAO,EAAE,cAAc,EAAE,CAAC;AAkG1B,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAE9D;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAK3E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,eAAe,CAMlG;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAiBzH;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,GAAG,qBAAqB,CAMxI;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE"}
|