@dsmm/dsmm 0.1.9 → 0.2.2
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/README.md +46 -58
- package/agent-presets/dsmm-builder/agent.cordis.yml +91 -186
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +120 -17
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +169 -0
- package/agent-presets/dsmm-coding/preset.yml +3 -0
- package/agent-presets/dsmm-complex/agent.cordis.yml +154 -0
- package/agent-presets/dsmm-complex/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +122 -15
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +179 -0
- package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
- package/agent-presets/dsmm-deep/agent.cordis.yml +189 -0
- package/agent-presets/dsmm-deep/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +168 -0
- package/agent-presets/dsmm-documenting/preset.yml +3 -0
- package/agent-presets/dsmm-frontend/agent.cordis.yml +161 -0
- package/agent-presets/dsmm-frontend/preset.yml +3 -0
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +153 -0
- package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +72 -17
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +127 -0
- package/agent-presets/dsmm-normal-task/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +109 -15
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +109 -15
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +174 -190
- package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +102 -16
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +134 -15
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +132 -0
- package/agent-presets/dsmm-quick/preset.yml +3 -0
- package/agent-presets/dsmm-research/agent.cordis.yml +156 -0
- package/agent-presets/dsmm-research/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +108 -16
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/cordis.patch.yml +1 -5
- package/docs/agent-presets.md +48 -15
- package/docs/compatibility.md +58 -68
- package/docs/deferred-native-approval-risk.md +19 -0
- package/docs/design.md +43 -2
- package/docs/lsp.md +12 -12
- package/docs/migration-from-ocmm.md +10 -2
- package/docs/model-routing.md +84 -59
- package/docs/native-permissions.md +35 -0
- package/docs/profiles.md +43 -64
- package/docs/releasing.md +159 -8
- package/docs/roadmap.md +77 -17
- package/docs/runtime-recovery.md +12 -0
- package/docs/safety-guards.md +7 -3
- package/docs/settings-status.md +46 -40
- package/docs/skill-sync.md +89 -14
- package/lib/child-admission-contract.d.ts +37 -0
- package/lib/child-admission-contract.js +2 -0
- package/lib/child-admission.d.ts +42 -0
- package/lib/child-admission.js +162 -0
- package/lib/child-capture.d.ts +81 -0
- package/lib/child-capture.js +203 -0
- package/lib/child-evidence.d.ts +17 -0
- package/lib/child-evidence.js +43 -0
- package/lib/client/ChildrenPanel.d.ts +43 -0
- package/lib/client/ChildrenPanel.js +82 -0
- package/lib/client/DeploymentPage.d.ts +18 -0
- package/lib/client/DeploymentPage.js +127 -0
- package/lib/client/EditableChoice.d.ts +17 -0
- package/lib/client/EditableChoice.js +49 -0
- package/lib/client/PermissionsPanel.d.ts +14 -0
- package/lib/client/PermissionsPanel.js +46 -0
- package/lib/client/ProfilesSection.js +32 -15
- package/lib/client/RoleAvailability.d.ts +7 -0
- package/lib/client/RoleAvailability.js +19 -0
- package/lib/client/SessionProfiles.js +27 -9
- package/lib/client/StructuredEditor.js +15 -7
- package/lib/client/children-controller.d.ts +98 -0
- package/lib/client/children-controller.js +296 -0
- package/lib/client/children-locales.d.ts +367 -0
- package/lib/client/children-locales.js +69 -0
- package/lib/client/controller.d.ts +6 -1
- package/lib/client/controller.js +14 -8
- package/lib/client/deployment-controller.d.ts +50 -0
- package/lib/client/deployment-controller.js +193 -0
- package/lib/client/deployment-data.d.ts +17 -0
- package/lib/client/deployment-data.js +138 -0
- package/lib/client/deployment-locales.d.ts +70 -0
- package/lib/client/deployment-locales.js +81 -0
- package/lib/client/diagnostics.d.ts +14 -0
- package/lib/client/diagnostics.js +53 -0
- package/lib/client/index.d.ts +4 -0
- package/lib/client/index.js +145 -1
- package/lib/client/locales.d.ts +58 -0
- package/lib/client/locales.js +38 -18
- package/lib/client/permission-client.d.ts +16 -0
- package/lib/client/permission-client.js +38 -0
- package/lib/client/permission-controller.d.ts +62 -0
- package/lib/client/permission-controller.js +149 -0
- package/lib/client/permission-locales.d.ts +114 -0
- package/lib/client/permission-locales.js +75 -0
- package/lib/client/plugins-contract.d.ts +27 -0
- package/lib/client/plugins-contract.js +2 -0
- package/lib/client/session-labels.js +4 -4
- package/lib/client/structured.js +19 -5
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +36 -0
- package/lib/client.js +6724 -1604
- package/lib/commands.js +3 -0
- package/lib/config-file-store.d.ts +23 -0
- package/lib/config-file-store.js +67 -0
- package/lib/core-permission-authority.d.ts +18 -0
- package/lib/core-permission-authority.js +255 -0
- package/lib/core-permissions.d.ts +8 -0
- package/lib/core-permissions.js +33 -0
- package/lib/delivery-authority.d.ts +68 -0
- package/lib/delivery-authority.js +260 -0
- package/lib/deployment-config.d.ts +60 -0
- package/lib/deployment-config.js +205 -0
- package/lib/deployment-permission-rules.d.ts +55 -0
- package/lib/deployment-permission-rules.js +306 -0
- package/lib/dsh-home.d.ts +3 -0
- package/lib/dsh-home.js +10 -0
- package/lib/dsh-types.d.ts +22 -69
- package/lib/guards.d.ts +3 -2
- package/lib/guards.js +44 -6
- package/lib/host-llm-startup.d.ts +41 -0
- package/lib/host-llm-startup.js +65 -0
- package/lib/host-llm.d.ts +92 -0
- package/lib/host-llm.js +325 -0
- package/lib/index.d.ts +23 -5
- package/lib/index.js +383 -40
- package/lib/legacy-child-policy.d.ts +51 -0
- package/lib/legacy-child-policy.js +123 -0
- package/lib/legacy-read-composition.d.ts +20 -0
- package/lib/legacy-read-composition.js +144 -0
- package/lib/legacy-read-contracts.d.ts +157 -0
- package/lib/legacy-read-contracts.js +39 -0
- package/lib/legacy-read-host.d.ts +19 -0
- package/lib/legacy-read-host.js +67 -0
- package/lib/legacy-read-integration.d.ts +121 -0
- package/lib/legacy-read-integration.js +522 -0
- package/lib/legacy-read-proxy.d.ts +26 -0
- package/lib/legacy-read-proxy.js +237 -0
- package/lib/live-pi-ai-owner.d.ts +18 -0
- package/lib/live-pi-ai-owner.js +144 -0
- package/lib/llm-runtime.d.ts +11 -0
- package/lib/llm-runtime.js +21 -0
- package/lib/lsp.d.ts +13 -0
- package/lib/lsp.js +60 -0
- package/lib/managed-settings.d.ts +5 -0
- package/lib/managed-settings.js +14 -0
- package/lib/mode.js +42 -47
- package/lib/model-parameter-policy.d.ts +11 -0
- package/lib/model-parameter-policy.js +27 -0
- package/lib/model-routing.js +33 -19
- package/lib/modules.d.ts +35 -0
- package/lib/modules.js +37 -0
- package/lib/native-child-evidence.d.ts +42 -0
- package/lib/native-child-evidence.js +133 -0
- package/lib/native-pi-ai-wire.d.ts +37 -0
- package/lib/native-pi-ai-wire.js +261 -0
- package/lib/native-scope.d.ts +9 -0
- package/lib/native-scope.js +20 -0
- package/lib/permission-bash.d.ts +6 -0
- package/lib/permission-bash.js +7 -0
- package/lib/permission-control.d.ts +73 -0
- package/lib/permission-control.js +205 -0
- package/lib/permission-controller.d.ts +68 -0
- package/lib/permission-controller.js +317 -0
- package/lib/permission-errors.d.ts +7 -0
- package/lib/permission-errors.js +21 -0
- package/lib/permission-fs-search.d.ts +5 -0
- package/lib/permission-fs-search.js +7 -0
- package/lib/permission-fs.d.ts +5 -0
- package/lib/permission-fs.js +7 -0
- package/lib/permission-native-access.d.ts +11 -0
- package/lib/permission-native-access.js +6 -0
- package/lib/permission-native-command.d.ts +10 -0
- package/lib/permission-native-command.js +93 -0
- package/lib/permission-native-rules.d.ts +75 -0
- package/lib/permission-native-rules.js +278 -0
- package/lib/permission-pwsh.d.ts +6 -0
- package/lib/permission-pwsh.js +7 -0
- package/lib/permission-remote.d.ts +26 -0
- package/lib/permission-remote.js +53 -0
- package/lib/permission-rpc.d.ts +29 -0
- package/lib/permission-rpc.js +152 -0
- package/lib/permission-rules.d.ts +115 -0
- package/lib/permission-rules.js +256 -0
- package/lib/permission-settings.d.ts +45 -0
- package/lib/permission-settings.js +48 -0
- package/lib/permission-shell.d.ts +38 -0
- package/lib/permission-shell.js +150 -0
- package/lib/permission-web.d.ts +5 -0
- package/lib/permission-web.js +7 -0
- package/lib/plan-validation.js +6 -44
- package/lib/preset-materializer.js +2 -0
- package/lib/preset-registry.d.ts +1 -1
- package/lib/preset-registry.js +38 -24
- package/lib/preset-skills.d.ts +4 -1
- package/lib/preset-skills.js +60 -19
- package/lib/profile-diagnostics.d.ts +45 -0
- package/lib/profile-diagnostics.js +148 -0
- package/lib/profile-locale.d.ts +3 -0
- package/lib/profile-locale.js +2 -0
- package/lib/profile-remote.d.ts +22 -0
- package/lib/profile-remote.js +344 -27
- package/lib/profile-rpc.d.ts +25 -1
- package/lib/profile-rpc.js +143 -3
- package/lib/profile-runtime.d.ts +63 -0
- package/lib/profile-runtime.js +496 -77
- package/lib/profile-store.d.ts +56 -1
- package/lib/profile-store.js +377 -111
- package/lib/profile-types.d.ts +125 -1
- package/lib/profile-types.js +1 -0
- package/lib/profiles.d.ts +16 -2
- package/lib/profiles.js +156 -79
- package/lib/prompt-content.d.ts +25 -0
- package/lib/prompt-content.js +27 -0
- package/lib/prompts.d.ts +45 -4
- package/lib/prompts.js +157 -43
- package/lib/recovery-policy.js +20 -7
- package/lib/role-control-remote.d.ts +38 -0
- package/lib/role-control-remote.js +211 -0
- package/lib/role-control-rpc.d.ts +51 -0
- package/lib/role-control-rpc.js +377 -0
- package/lib/role-control-types.d.ts +92 -0
- package/lib/role-control-types.js +8 -0
- package/lib/role-invocation.d.ts +47 -0
- package/lib/role-invocation.js +135 -0
- package/lib/role-llm-runtime.d.ts +17 -0
- package/lib/role-llm-runtime.js +62 -0
- package/lib/role-llm.d.ts +31 -0
- package/lib/role-llm.js +66 -0
- package/lib/role-policy.d.ts +92 -0
- package/lib/role-policy.js +601 -0
- package/lib/role-providers.d.ts +7 -3
- package/lib/role-providers.js +74 -46
- package/lib/role-routing.d.ts +11 -2
- package/lib/role-routing.js +42 -25
- package/lib/role-runs.d.ts +135 -0
- package/lib/role-runs.js +304 -0
- package/lib/role-subagents.d.ts +63 -4
- package/lib/role-subagents.js +299 -47
- package/lib/roles.d.ts +20 -9
- package/lib/roles.js +87 -216
- package/lib/route-json.d.ts +19 -0
- package/lib/route-json.js +129 -0
- package/lib/routing-policy.d.ts +2 -0
- package/lib/routing-policy.js +12 -2
- package/lib/runtime-integration.d.ts +112 -0
- package/lib/runtime-integration.js +784 -0
- package/lib/runtime-recovery.js +34 -13
- package/lib/session-scope.js +2 -0
- package/lib/settings.d.ts +116 -14
- package/lib/settings.js +455 -149
- package/lib/skills.d.ts +24 -9
- package/lib/skills.js +114 -35
- package/lib/state.d.ts +10 -6
- package/lib/state.js +48 -49
- package/lib/status.d.ts +35 -1
- package/lib/status.js +58 -17
- package/lib/subagent-runtime.d.ts +45 -0
- package/lib/subagent-runtime.js +131 -0
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +112 -45
- package/patches/subagent-runtime.yml +15 -0
- package/prompts/deepseek-flash.md +1 -1
- package/prompts/deepseek-v4-pro.md +2 -2
- package/prompts/deepwork.md +153 -20
- package/prompts/source/agents/clarifier.md +47 -0
- package/prompts/source/agents/orchestrator.md +72 -0
- package/prompts/source/agents/plan-critic.md +29 -0
- package/prompts/source/agents/planner.md +21 -0
- package/prompts/source/agents/reviewer.md +23 -0
- package/prompts/source/catalog.json +548 -0
- package/prompts/source/category/coding.md +46 -0
- package/prompts/source/category/complex.md +29 -0
- package/prompts/source/category/creative.md +40 -0
- package/prompts/source/category/cross-cutting.md +54 -0
- package/prompts/source/category/deep.md +64 -0
- package/prompts/source/category/documenting.md +68 -0
- package/prompts/source/category/frontend.md +38 -0
- package/prompts/source/category/hard-reasoning.md +53 -0
- package/prompts/source/category/normal-task.md +27 -0
- package/prompts/source/category/quick.md +34 -0
- package/prompts/source/category/research.md +58 -0
- package/prompts/source/deepwork/claude-opus-5.md +28 -0
- package/prompts/source/deepwork/codex.md +9 -0
- package/prompts/source/deepwork/default.md +136 -0
- package/prompts/source/deepwork/gemini.md +191 -0
- package/prompts/source/deepwork/glm.md +263 -0
- package/prompts/source/deepwork/gpt.md +49 -0
- package/prompts/source/deepwork/kimi-k27.md +13 -0
- package/prompts/source/deepwork/planner.md +44 -0
- package/prompts/source/deepwork/swe-2.md +13 -0
- package/prompts/source/manifest.json +3233 -0
- package/prompts/source/shared/dsh-host-contract.md +8 -0
- package/prompts/source/shared/locale.md +8 -0
- package/prompts/source/shared/shell-safety.md +7 -0
- package/prompts/source/terminal/builder.md +13 -0
- package/prompts/source/terminal/clarifier.md +41 -0
- package/prompts/source/terminal/code-search.md +39 -0
- package/prompts/source/terminal/coding.md +41 -0
- package/prompts/source/terminal/complex.md +43 -0
- package/prompts/source/terminal/creative.md +41 -0
- package/prompts/source/terminal/cross-cutting.md +43 -0
- package/prompts/source/terminal/deep.md +43 -0
- package/prompts/source/terminal/doc-search.md +39 -0
- package/prompts/source/terminal/documenting.md +41 -0
- package/prompts/source/terminal/frontend.md +41 -0
- package/prompts/source/terminal/hard-reasoning.md +41 -0
- package/prompts/source/terminal/media-reader.md +39 -0
- package/prompts/source/terminal/normal-task.md +41 -0
- package/prompts/source/terminal/oracle-2nd.md +53 -0
- package/prompts/source/terminal/oracle.md +53 -0
- package/prompts/source/terminal/orchestrator.md +26 -0
- package/prompts/source/terminal/plan-critic.md +41 -0
- package/prompts/source/terminal/planner.md +42 -0
- package/prompts/source/terminal/quick.md +39 -0
- package/prompts/source/terminal/research.md +39 -0
- package/prompts/source/terminal/reviewer.md +53 -0
- package/scripts/cold-profile-composition.mjs +329 -0
- package/scripts/cold-profile-sources.mjs +238 -0
- package/scripts/migrate-cold-profile.mjs +315 -0
- package/skills/ast-grep/LICENSE +21 -0
- package/skills/ast-grep/README.md +138 -0
- package/skills/ast-grep/SKILL.md +287 -0
- package/skills/ast-grep/SOURCE +1 -0
- package/skills/ast-grep/install.ps1 +235 -0
- package/skills/ast-grep/install.sh +286 -0
- package/skills/ast-grep/references/cli.md +233 -0
- package/skills/ast-grep/references/install.md +168 -0
- package/skills/ast-grep/references/patterns.md +149 -0
- package/skills/ast-grep/references/pitfalls.md +305 -0
- package/skills/ast-grep/references/recipes.md +404 -0
- package/skills/ast-grep/references/sgconfig.md +250 -0
- package/skills/ast-grep/references/yaml-rules.md +511 -0
- package/skills/ast-grep/scripts/ast_grep_helper.py +760 -0
- package/skills/ast-grep/tests/smoke.ps1 +129 -0
- package/skills/ast-grep/tests/smoke.sh +212 -0
- package/skills/ast-grep/tests/test_resolver.py +154 -0
- package/skills/brainstorming/SKILL.md +123 -9
- package/skills/coding-agent-sessions/LICENSE-UPSTREAM.md +82 -0
- package/skills/coding-agent-sessions/NOTICE.md +24 -0
- package/skills/coding-agent-sessions/SKILL.md +147 -0
- package/skills/coding-agent-sessions/agents/openai.yaml +4 -0
- package/skills/coding-agent-sessions/pyrightconfig.json +5 -0
- package/skills/coding-agent-sessions/references/all-platforms.md +77 -0
- package/skills/coding-agent-sessions/references/claude.md +34 -0
- package/skills/coding-agent-sessions/references/codex.md +32 -0
- package/skills/coding-agent-sessions/references/opencode.md +45 -0
- package/skills/coding-agent-sessions/references/senpi.md +29 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/__init__.py +1 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/aside_scanner.py +140 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/claude.py +66 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/cli.py +283 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/codex.py +105 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/file_scanners.py +275 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/jsonio.py +55 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/kiro_scanner.py +91 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/opencode.py +289 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/pi_family.py +46 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/scanners.py +104 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_optional_scanners.py +203 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/sqlite_scanners.py +177 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/timeparse.py +51 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/transcript.py +149 -0
- package/skills/coding-agent-sessions/scripts/agent_sessions/types.py +57 -0
- package/skills/coding-agent-sessions/scripts/find-agent-sessions.py +19 -0
- package/skills/coding-agent-sessions/scripts/tests/test_agent_sessions.py +322 -0
- package/skills/coding-agent-sessions/scripts/tests/test_aside_scanner.py +131 -0
- package/skills/coding-agent-sessions/scripts/tests/test_cli_contract.py +126 -0
- package/skills/coding-agent-sessions/scripts/tests/test_extended_scanners.py +262 -0
- package/skills/coding-agent-sessions/scripts/tests/test_optional_sqlite_scanners.py +79 -0
- package/skills/coding-agent-sessions/scripts/tests/test_pi_family_scanners.py +130 -0
- package/skills/debugging/SKILL.md +130 -4
- package/skills/debugging/references/logging.md +2 -0
- package/skills/debugging/references/methodology/00-setup.md +16 -62
- package/skills/debugging/references/methodology/02-investigate.md +11 -5
- package/skills/debugging/references/methodology/03-flaky-triage.md +6 -4
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +6 -16
- package/skills/debugging/references/methodology/05-escalate.md +2 -0
- package/skills/debugging/references/methodology/06-fix.md +8 -6
- package/skills/debugging/references/methodology/08-qa.md +7 -5
- package/skills/debugging/references/methodology/09-cleanup.md +16 -152
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +7 -18
- package/skills/debugging/references/runtimes/bundled-js-binary.md +3 -16
- package/skills/debugging/references/runtimes/go.md +2 -0
- package/skills/debugging/references/runtimes/native-binary.md +11 -54
- package/skills/debugging/references/runtimes/node.md +6 -15
- package/skills/debugging/references/runtimes/python.md +5 -15
- package/skills/debugging/references/runtimes/rust.md +4 -18
- package/skills/debugging/references/scripts/dap.test.mjs +539 -0
- package/skills/debugging/references/scripts/fixture-adapter.mjs +164 -0
- package/skills/debugging/references/tools/dap.md +4 -2
- package/skills/debugging/references/tools/ghidra.md +6 -15
- package/skills/debugging/references/tools/playwright-cli.md +5 -15
- package/skills/debugging/references/tools/pwndbg.md +2 -0
- package/skills/debugging/references/tools/pwntools.md +6 -16
- package/skills/dispatching-parallel-agents/SKILL.md +96 -7
- package/skills/frontend/.frontend-materialized.json +856 -0
- package/skills/frontend/ATTRIBUTION.md +37 -0
- package/skills/frontend/LICENSE-Apache-2.0.txt +201 -0
- package/skills/frontend/LICENSE-taste-skill.txt +21 -0
- package/skills/frontend/LICENSE-ui-ux-pro-max.txt +21 -0
- package/skills/frontend/SKILL.md +145 -0
- package/skills/frontend/references/design/README.md +256 -0
- package/skills/frontend/references/design/_INDEX.md +206 -0
- package/skills/frontend/references/design/airbnb.md +393 -0
- package/skills/frontend/references/design/airtable.md +92 -0
- package/skills/frontend/references/design/apple.md +250 -0
- package/skills/frontend/references/design/aside.md +211 -0
- package/skills/frontend/references/design/binance.md +348 -0
- package/skills/frontend/references/design/bmw.md +183 -0
- package/skills/frontend/references/design/brutalist-skill.md +92 -0
- package/skills/frontend/references/design/bugatti.md +271 -0
- package/skills/frontend/references/design/cal.md +262 -0
- package/skills/frontend/references/design/claude.md +315 -0
- package/skills/frontend/references/design/clay.md +307 -0
- package/skills/frontend/references/design/clickhouse.md +284 -0
- package/skills/frontend/references/design/clone-from-url.md +69 -0
- package/skills/frontend/references/design/cohere.md +269 -0
- package/skills/frontend/references/design/coinbase.md +132 -0
- package/skills/frontend/references/design/composio.md +310 -0
- package/skills/frontend/references/design/cursor.md +312 -0
- package/skills/frontend/references/design/design-system-architecture.md +250 -0
- package/skills/frontend/references/design/elevenlabs.md +268 -0
- package/skills/frontend/references/design/expo.md +284 -0
- package/skills/frontend/references/design/ferrari.md +317 -0
- package/skills/frontend/references/design/figma.md +223 -0
- package/skills/frontend/references/design/framer.md +249 -0
- package/skills/frontend/references/design/gpt-tasteskill.md +74 -0
- package/skills/frontend/references/design/hashicorp.md +281 -0
- package/skills/frontend/references/design/ibm.md +335 -0
- package/skills/frontend/references/design/image-to-code-skill.md +1228 -0
- package/skills/frontend/references/design/imagegen-brandkit.md +798 -0
- package/skills/frontend/references/design/imagegen-frontend-mobile.md +1465 -0
- package/skills/frontend/references/design/imagegen-frontend-web.md +987 -0
- package/skills/frontend/references/design/interaction-skill.md +52 -0
- package/skills/frontend/references/design/intercom.md +149 -0
- package/skills/frontend/references/design/kraken.md +128 -0
- package/skills/frontend/references/design/lamborghini.md +291 -0
- package/skills/frontend/references/design/linear.app.md +370 -0
- package/skills/frontend/references/design/lovable.md +301 -0
- package/skills/frontend/references/design/mastercard.md +368 -0
- package/skills/frontend/references/design/meta.md +369 -0
- package/skills/frontend/references/design/minimalist-skill.md +85 -0
- package/skills/frontend/references/design/minimax.md +260 -0
- package/skills/frontend/references/design/mintlify.md +329 -0
- package/skills/frontend/references/design/miro.md +111 -0
- package/skills/frontend/references/design/mistral.ai.md +264 -0
- package/skills/frontend/references/design/mongodb.md +269 -0
- package/skills/frontend/references/design/nike.md +366 -0
- package/skills/frontend/references/design/notion.md +312 -0
- package/skills/frontend/references/design/nvidia.md +296 -0
- package/skills/frontend/references/design/ollama.md +270 -0
- package/skills/frontend/references/design/opencode.ai.md +284 -0
- package/skills/frontend/references/design/output-skill.md +49 -0
- package/skills/frontend/references/design/pinterest.md +233 -0
- package/skills/frontend/references/design/playstation.md +367 -0
- package/skills/frontend/references/design/posthog.md +259 -0
- package/skills/frontend/references/design/raycast.md +271 -0
- package/skills/frontend/references/design/react-dev-tooling-skill.md +232 -0
- package/skills/frontend/references/design/redesign-skill.md +178 -0
- package/skills/frontend/references/design/renault.md +314 -0
- package/skills/frontend/references/design/replicate.md +264 -0
- package/skills/frontend/references/design/resend.md +306 -0
- package/skills/frontend/references/design/revolut.md +188 -0
- package/skills/frontend/references/design/runwayml.md +247 -0
- package/skills/frontend/references/design/sanity.md +360 -0
- package/skills/frontend/references/design/sentry.md +265 -0
- package/skills/frontend/references/design/shopify.md +353 -0
- package/skills/frontend/references/design/soft-skill.md +98 -0
- package/skills/frontend/references/design/spacex.md +197 -0
- package/skills/frontend/references/design/spotify.md +249 -0
- package/skills/frontend/references/design/starbucks.md +583 -0
- package/skills/frontend/references/design/stitch-design-example.md +121 -0
- package/skills/frontend/references/design/stitch-skill.md +184 -0
- package/skills/frontend/references/design/stripe.md +325 -0
- package/skills/frontend/references/design/supabase.md +258 -0
- package/skills/frontend/references/design/superhuman.md +255 -0
- package/skills/frontend/references/design/taste-skill.md +1206 -0
- package/skills/frontend/references/design/tesla.md +289 -0
- package/skills/frontend/references/design/theverge.md +342 -0
- package/skills/frontend/references/design/together.ai.md +266 -0
- package/skills/frontend/references/design/uber.md +298 -0
- package/skills/frontend/references/design/vercel.md +313 -0
- package/skills/frontend/references/design/vodafone.md +426 -0
- package/skills/frontend/references/design/voltagent.md +326 -0
- package/skills/frontend/references/design/warp.md +256 -0
- package/skills/frontend/references/design/webflow.md +95 -0
- package/skills/frontend/references/design/wired.md +281 -0
- package/skills/frontend/references/design/wise.md +176 -0
- package/skills/frontend/references/design/x.ai.md +260 -0
- package/skills/frontend/references/design/zapier.md +331 -0
- package/skills/frontend/references/perfection/README.md +264 -0
- package/skills/frontend/references/perfection/react-perf-tooling.md +234 -0
- package/skills/frontend/references/ui-ux-db/README.md +659 -0
- package/skills/frontend/references/ui-ux-db/data/app-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/data/charts.csv +26 -0
- package/skills/frontend/references/ui-ux-db/data/colors.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/google-fonts.csv +1924 -0
- package/skills/frontend/references/ui-ux-db/data/icons.csv +106 -0
- package/skills/frontend/references/ui-ux-db/data/landing.csv +35 -0
- package/skills/frontend/references/ui-ux-db/data/products.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/react-performance.csv +45 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/angular.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/astro.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/flutter.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/html-tailwind.csv +56 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/jetpack-compose.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/laravel.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nextjs.csv +53 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxt-ui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/nuxtjs.csv +59 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react-native.csv +52 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/react.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/shadcn.csv +61 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/svelte.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/swiftui.csv +51 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/threejs.csv +54 -0
- package/skills/frontend/references/ui-ux-db/data/stacks/vue.csv +50 -0
- package/skills/frontend/references/ui-ux-db/data/styles.csv +85 -0
- package/skills/frontend/references/ui-ux-db/data/typography.csv +74 -0
- package/skills/frontend/references/ui-ux-db/data/ui-reasoning.csv +162 -0
- package/skills/frontend/references/ui-ux-db/data/ux-guidelines.csv +100 -0
- package/skills/frontend/references/ui-ux-db/data/web-interface.csv +31 -0
- package/skills/frontend/references/ui-ux-db/scripts/core.py +262 -0
- package/skills/frontend/references/ui-ux-db/scripts/design_system.py +1148 -0
- package/skills/frontend/references/ui-ux-db/scripts/search.py +114 -0
- package/skills/frontend/scripts/perfection/lighthouse-audit.py +201 -0
- package/skills/git-master/SKILL.md +115 -0
- package/skills/git-master/agents/openai.yaml +13 -0
- package/skills/init-deep/SKILL.md +282 -0
- package/skills/receiving-code-review/SKILL.md +117 -7
- package/skills/remove-ai-slops/SKILL.md +160 -8
- package/skills/requesting-code-review/SKILL.md +98 -3
- package/skills/requesting-code-review/code-reviewer.md +59 -0
- package/skills/subagent-driven-development/SKILL.md +179 -6
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
- package/skills/subagent-driven-development/implementer-prompt.md +87 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +37 -0
- package/skills/using-git-worktrees/SKILL.md +144 -0
- package/skills/writing-plans/SKILL.md +126 -7
- package/skills/writing-plans/plan-document-reviewer-prompt.md +47 -0
package/lib/settings.js
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
import Schema from "@deepseek-ai/schemastery";
|
|
2
2
|
import { DEFAULT_DSMM_LSP_SETTINGS, resolveLspSettings } from "./lsp.js";
|
|
3
|
-
import { DSMM_ROLE_IDS } from "./roles.js";
|
|
3
|
+
import { DSMM_ROLES, DSMM_ROLE_IDS, isRootRole } from "./roles.js";
|
|
4
4
|
import { DSMM_SKILL_NAMES } from "./skills.js";
|
|
5
|
-
import { DEFAULT_DSMM_RUNTIME_POLICY, normalizeRateLimitOverrides, normalizeRoutingStrategy, normalizeRuntimePolicy, resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
5
|
+
import { DEFAULT_DSMM_RUNTIME_POLICY, DSMM_RATE_LIMIT_BOUNDS, normalizeRateLimitOverrides, normalizeRoutingStrategy, normalizeRuntimePolicy, resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
6
|
+
import { DEPRECATED_DSMM_FIELDS, DsmmConfigValidationError, safeDiagnosticField } from "./profile-diagnostics.js";
|
|
7
|
+
import { DSMM_LOCALES } from "./profile-locale.js";
|
|
8
|
+
import { normalizeModelRouteJson, validateModelRouteFieldName } from "./route-json.js";
|
|
9
|
+
import { DEFAULT_PERMISSION_CONTROL, permissionControlSchema, resolvePermissionControl } from "./permission-settings.js";
|
|
10
|
+
export { DSMM_LOCALES } from "./profile-locale.js";
|
|
6
11
|
export { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
7
12
|
export { DSMM_SKILL_NAMES, MVP_SKILL_NAMES } from "./skills.js";
|
|
8
|
-
export const DSMM_SETTINGS_NAMESPACE = "dsmm";
|
|
9
13
|
export const DSMM_STATUS_COMMAND = "dsmm-status";
|
|
10
14
|
export const DEFAULT_DSMM_SETTINGS = {
|
|
15
|
+
permissionControl: DEFAULT_PERMISSION_CONTROL,
|
|
16
|
+
modelParameters: { passthrough: true },
|
|
17
|
+
modules: { deepwork: { enabled: true } },
|
|
11
18
|
modeName: "deepwork",
|
|
12
19
|
defaultActive: false,
|
|
13
20
|
promptOrder: 50,
|
|
14
21
|
deepseekV4ProCalibration: "auto",
|
|
15
22
|
deepseekV4ProDefaultReasoningEffort: "high",
|
|
16
|
-
deepseekV4ProMaxReasoningPresets: ["dsmm-plan-critic", "dsmm-reviewer"],
|
|
17
23
|
deepseekFlashCalibration: "auto",
|
|
18
24
|
deepseekFlashDefaultReasoningEffort: "high",
|
|
19
|
-
deepseekFlashMaxReasoningPresets: ["dsmm-plan-critic", "dsmm-reviewer"],
|
|
20
25
|
skills: createDefaultSkillSettings(),
|
|
21
26
|
roles: createDefaultRoleSettings(),
|
|
22
27
|
roleRouting: {},
|
|
23
28
|
runtimePolicy: DEFAULT_DSMM_RUNTIME_POLICY,
|
|
24
29
|
presets: {
|
|
25
|
-
materialize: false
|
|
30
|
+
materialize: false,
|
|
31
|
+
plannerRootEnabled: false
|
|
26
32
|
},
|
|
33
|
+
subagents: { enableRunInBackground: false, backgroundMode: "one-shot", toolTopology: "per-role", allowRouteOverride: false },
|
|
27
34
|
workflow: {
|
|
28
35
|
policy: "risk-based",
|
|
29
36
|
strictGates: true,
|
|
@@ -66,39 +73,46 @@ function createDefaultSkillSettings() {
|
|
|
66
73
|
return Object.fromEntries(DSMM_SKILL_NAMES.map((id) => [id, true]));
|
|
67
74
|
}
|
|
68
75
|
function createDefaultRoleSettings() {
|
|
69
|
-
return Object.fromEntries(
|
|
70
|
-
}
|
|
71
|
-
const SKILLS_SCHEMA = Schema.object(
|
|
72
|
-
brainstorming: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills.brainstorming),
|
|
73
|
-
"writing-plans": Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills["writing-plans"]),
|
|
74
|
-
"requesting-code-review": Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills["requesting-code-review"]),
|
|
75
|
-
"receiving-code-review": Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills["receiving-code-review"]),
|
|
76
|
-
"subagent-driven-development": Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills["subagent-driven-development"]),
|
|
77
|
-
"dispatching-parallel-agents": Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills["dispatching-parallel-agents"]),
|
|
78
|
-
"remove-ai-slops": Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills["remove-ai-slops"])
|
|
79
|
-
});
|
|
76
|
+
return Object.fromEntries(DSMM_ROLES.map((role) => [role.id, role.enabledByDefault]));
|
|
77
|
+
}
|
|
78
|
+
const SKILLS_SCHEMA = Schema.object(Object.fromEntries(DSMM_SKILL_NAMES.map((name) => [name, Schema.boolean().default(DEFAULT_DSMM_SETTINGS.skills[name])])));
|
|
80
79
|
const ROLES_SCHEMA = Schema.object(Object.fromEntries(DSMM_ROLE_IDS.map((id) => [id, Schema.boolean().default(DEFAULT_DSMM_SETTINGS.roles[id])])));
|
|
81
|
-
const
|
|
80
|
+
const MODEL_ROUTE_FIELDS_SCHEMA = Schema.object({
|
|
82
81
|
provider: Schema.string().required(),
|
|
83
82
|
model: Schema.string().required(),
|
|
84
|
-
reasoningEffort: Schema.string()
|
|
83
|
+
reasoningEffort: Schema.string(),
|
|
84
|
+
temperature: Schema.number(),
|
|
85
|
+
maxTokens: Schema.number().step(1).min(1),
|
|
86
|
+
stop: Schema.array(Schema.string())
|
|
85
87
|
});
|
|
88
|
+
const MODEL_ROUTE_SCHEMA = Schema.transform(Schema.any(), (input) => normalizeModelRouteJson(input, true, true));
|
|
89
|
+
const LEVEL_OVERRIDE_SCHEMA = Schema.union([MODEL_ROUTE_SCHEMA, Schema.object({ reasoningEffort: Schema.string().required() })]);
|
|
90
|
+
const LEVELS_SCHEMA = Schema.object({ low: LEVEL_OVERRIDE_SCHEMA, high: LEVEL_OVERRIDE_SCHEMA, max: LEVEL_OVERRIDE_SCHEMA });
|
|
91
|
+
const LOCALE_SCHEMA = Schema.union(DSMM_LOCALES.map(locale => Schema.const(locale)));
|
|
92
|
+
const RATE_LIMIT_CONFIG_SCHEMA = Schema.object(Object.fromEntries(Object.keys(DEFAULT_DSMM_RUNTIME_POLICY.rateLimit).map((key) => [key, Schema.number()])));
|
|
93
|
+
const ROUTING_STRATEGY_CONFIG_SCHEMA = Schema.union([Schema.const("startup-lock"), Schema.const("rate-limit-fallback")]);
|
|
94
|
+
const RUNTIME_POLICY_CONFIG_SCHEMA = Schema.object({ strategy: ROUTING_STRATEGY_CONFIG_SCHEMA, rateLimit: RATE_LIMIT_CONFIG_SCHEMA });
|
|
95
|
+
const ROLE_FALLBACK_ROUTE_LIMIT = 32;
|
|
96
|
+
const ROLE_FALLBACK_ROUTES_SCHEMA = Schema.array(MODEL_ROUTE_SCHEMA);
|
|
86
97
|
// A dictionary retains unknown keys for fail-closed validation by the resolver.
|
|
87
98
|
const ROLE_ROUTING_SCHEMA = Schema.dict(Schema.object({
|
|
99
|
+
levels: LEVELS_SCHEMA,
|
|
88
100
|
primary: Schema.union([Schema.const(undefined), MODEL_ROUTE_SCHEMA]),
|
|
89
|
-
fallbackRoutes: Schema.union([Schema.const(undefined),
|
|
90
|
-
strategy:
|
|
91
|
-
rateLimit:
|
|
101
|
+
fallbackRoutes: Schema.union([Schema.const(undefined), ROLE_FALLBACK_ROUTES_SCHEMA]),
|
|
102
|
+
strategy: ROUTING_STRATEGY_CONFIG_SCHEMA,
|
|
103
|
+
rateLimit: RATE_LIMIT_CONFIG_SCHEMA
|
|
92
104
|
}).required()).default({});
|
|
93
105
|
// Schemastery treats null like an omitted default. Validate the untouched map
|
|
94
106
|
// before object defaults can erase an explicitly malformed routing policy.
|
|
95
107
|
const ROLE_ROUTING_VALIDATION_SCHEMA = Schema.transform(Schema.any(), (input) => {
|
|
96
108
|
if (!isRoutingRecord(input))
|
|
97
109
|
return input;
|
|
110
|
+
rejectDeprecatedFields(input);
|
|
111
|
+
if (Object.hasOwn(input, "locale"))
|
|
112
|
+
validateLocale(input.locale);
|
|
98
113
|
if (isRoutingRecord(input.runtimeRecovery) && Array.isArray(input.runtimeRecovery.fallbackRoutes)) {
|
|
99
114
|
for (const route of input.runtimeRecovery.fallbackRoutes) {
|
|
100
|
-
|
|
101
|
-
normalizeRecoveryEffort(route);
|
|
115
|
+
normalizeExplicitRoute(route);
|
|
102
116
|
}
|
|
103
117
|
}
|
|
104
118
|
const roleRouting = resolveRoleRouting(input.roleRouting);
|
|
@@ -107,8 +121,16 @@ const ROLE_ROUTING_VALIDATION_SCHEMA = Schema.transform(Schema.any(), (input) =>
|
|
|
107
121
|
});
|
|
108
122
|
const PRESETS_SCHEMA = Schema.object({
|
|
109
123
|
materialize: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.presets.materialize),
|
|
124
|
+
plannerRootEnabled: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.presets.plannerRootEnabled),
|
|
110
125
|
root: Schema.string()
|
|
111
126
|
});
|
|
127
|
+
const SUBAGENTS_SCHEMA = Schema.object({
|
|
128
|
+
toolTopology: Schema.union([Schema.const("per-role"), Schema.const("parameterized")]).default("per-role"),
|
|
129
|
+
allowRouteOverride: Schema.boolean().default(false),
|
|
130
|
+
enableRunInBackground: Schema.boolean().default(false),
|
|
131
|
+
backgroundMode: Schema.union([Schema.const("one-shot"), Schema.const("continuable")]).default("one-shot"),
|
|
132
|
+
maxDepth: Schema.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER)
|
|
133
|
+
});
|
|
112
134
|
const FINAL_REVIEW_POLICY_SCHEMA = Schema.union([
|
|
113
135
|
Schema.const("simple-oracle-complex-reviewer"),
|
|
114
136
|
Schema.const("reviewer-only"),
|
|
@@ -164,11 +186,7 @@ const RUNTIME_RECOVERY_SCHEMA = Schema.object({
|
|
|
164
186
|
enabled: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.runtimeRecovery.enabled),
|
|
165
187
|
retryOnStatusCodes: Schema.array(Number).default([...DEFAULT_DSMM_SETTINGS.runtimeRecovery.retryOnStatusCodes]),
|
|
166
188
|
retryOnCodes: Schema.array(String).default([...DEFAULT_DSMM_SETTINGS.runtimeRecovery.retryOnCodes]),
|
|
167
|
-
fallbackRoutes: Schema.array(
|
|
168
|
-
provider: Schema.string(),
|
|
169
|
-
model: Schema.string(),
|
|
170
|
-
reasoningEffort: Schema.string()
|
|
171
|
-
})).default(DEFAULT_DSMM_SETTINGS.runtimeRecovery.fallbackRoutes.map((route) => ({ ...route }))),
|
|
189
|
+
fallbackRoutes: Schema.array(MODEL_ROUTE_SCHEMA).max(ROLE_FALLBACK_ROUTE_LIMIT).default(DEFAULT_DSMM_SETTINGS.runtimeRecovery.fallbackRoutes.map((route) => ({ ...route }))),
|
|
172
190
|
maxFallbackAttempts: Schema.number().default(DEFAULT_DSMM_SETTINGS.runtimeRecovery.maxFallbackAttempts),
|
|
173
191
|
idleContinuation: RUNTIME_RECOVERY_IDLE_CONTINUATION_SCHEMA
|
|
174
192
|
});
|
|
@@ -182,8 +200,6 @@ const DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA = Schema.union([
|
|
|
182
200
|
Schema.const("low"),
|
|
183
201
|
Schema.const("high")
|
|
184
202
|
]).default(DEFAULT_DSMM_SETTINGS.deepseekV4ProDefaultReasoningEffort);
|
|
185
|
-
const DEEPSEEK_MAX_REASONING_PRESETS_SCHEMA = Schema.array(String)
|
|
186
|
-
.default([...DEFAULT_DSMM_SETTINGS.deepseekV4ProMaxReasoningPresets]);
|
|
187
203
|
const LSP_SCHEMA = Schema.object({
|
|
188
204
|
enabled: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.lsp.enabled),
|
|
189
205
|
serverName: Schema.string().default(DEFAULT_DSMM_SETTINGS.lsp.serverName),
|
|
@@ -194,67 +210,150 @@ const LSP_SCHEMA = Schema.object({
|
|
|
194
210
|
toolCallTimeoutMs: Schema.number().default(DEFAULT_DSMM_SETTINGS.lsp.toolCallTimeoutMs),
|
|
195
211
|
failOnStartupError: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.lsp.failOnStartupError)
|
|
196
212
|
});
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
213
|
+
const CONFIG_FIELDS_SCHEMA = Schema.object({
|
|
214
|
+
permissionControl: permissionControlSchema,
|
|
215
|
+
modelParameters: Schema.object({ passthrough: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.modelParameters.passthrough) }),
|
|
216
|
+
locale: LOCALE_SCHEMA,
|
|
217
|
+
sessionPersistence: Schema.union([Schema.const(undefined), Schema.object({
|
|
218
|
+
root: Schema.string().required(),
|
|
219
|
+
compression: Schema.union([Schema.const("zstd"), Schema.const("none")])
|
|
220
|
+
})]),
|
|
221
|
+
modeName: Schema.string().default(DEFAULT_DSMM_SETTINGS.modeName),
|
|
222
|
+
section: Schema.string(),
|
|
223
|
+
defaultActive: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.defaultActive),
|
|
224
|
+
promptOrder: Schema.number().default(DEFAULT_DSMM_SETTINGS.promptOrder),
|
|
225
|
+
deepseekV4ProCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
226
|
+
deepseekV4ProDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
227
|
+
deepseekFlashCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
228
|
+
deepseekFlashDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
229
|
+
skills: SKILLS_SCHEMA,
|
|
230
|
+
roles: ROLES_SCHEMA,
|
|
231
|
+
roleRouting: ROLE_ROUTING_SCHEMA,
|
|
232
|
+
runtimePolicy: RUNTIME_POLICY_CONFIG_SCHEMA,
|
|
233
|
+
presets: PRESETS_SCHEMA,
|
|
234
|
+
subagents: SUBAGENTS_SCHEMA,
|
|
235
|
+
workflow: WORKFLOW_CONFIG_SCHEMA,
|
|
236
|
+
guards: GUARDS_SCHEMA,
|
|
237
|
+
runtimeRecovery: RUNTIME_RECOVERY_SCHEMA,
|
|
238
|
+
lsp: LSP_SCHEMA
|
|
239
|
+
});
|
|
240
|
+
const MODULES_SCHEMA = Schema.object({ deepwork: Schema.object({ enabled: Schema.boolean() }) });
|
|
241
|
+
const GLOBAL_FIELDS_SCHEMA = Schema.object({ ...CONFIG_FIELDS_SCHEMA.dict, modules: MODULES_SCHEMA });
|
|
242
|
+
/** Only data is transported. Defaults remain resolved by the existing authority. */
|
|
243
|
+
export function deploymentEditorSchema() {
|
|
244
|
+
const project = (schema) => schema === permissionControlSchema && schema.type === "transform"
|
|
245
|
+
? project(schema.inner) : schema === permissionControlSchema.inner.dict.rules
|
|
246
|
+
? { type: "array", inner: { type: "object", fields: {}, additionalProperties: "json" } } : schema === MODEL_ROUTE_SCHEMA
|
|
247
|
+
? { ...project(MODEL_ROUTE_FIELDS_SCHEMA), additionalProperties: "json" } : ({
|
|
248
|
+
type: schema.type,
|
|
249
|
+
...(schema.dict === undefined ? {} : { fields: Object.fromEntries(Object.entries(schema.dict).filter(([key]) => key !== "sessionPersistence").map(([key, child]) => {
|
|
250
|
+
const node = project(child);
|
|
251
|
+
if (schema === MODEL_ROUTE_FIELDS_SCHEMA && ["provider", "model", "reasoningEffort"].includes(key))
|
|
252
|
+
node.nonempty = true;
|
|
253
|
+
if (schema === RATE_LIMIT_CONFIG_SCHEMA) {
|
|
254
|
+
const [min, max] = DSMM_RATE_LIMIT_BOUNDS[key];
|
|
255
|
+
Object.assign(node, { min, max, step: 1 });
|
|
256
|
+
}
|
|
257
|
+
return [key, node];
|
|
258
|
+
})) }),
|
|
259
|
+
...(schema.inner === undefined ? {} : { inner: project(schema.inner) }),
|
|
260
|
+
...(schema.list === undefined ? {} : { alternatives: schema.list.map(project) }),
|
|
261
|
+
...(["string", "number", "boolean"].includes(typeof schema.value) ? { value: schema.value } : {}),
|
|
262
|
+
...(typeof schema.meta.min === "number" ? { min: schema.meta.min } : {}),
|
|
263
|
+
...(typeof schema.meta.max === "number" ? { max: schema.meta.max } : {}),
|
|
264
|
+
...(typeof schema.meta.step === "number" ? { step: schema.meta.step } : {}),
|
|
265
|
+
...(schema.meta.required === true ? { required: true } : {}),
|
|
266
|
+
...(schema === ROLE_ROUTING_SCHEMA ? { keys: [...DSMM_ROLE_IDS] } : {}),
|
|
267
|
+
...(schema === ROLE_FALLBACK_ROUTES_SCHEMA ? { max: ROLE_FALLBACK_ROUTE_LIMIT } : {})
|
|
268
|
+
});
|
|
269
|
+
return project(GLOBAL_FIELDS_SCHEMA);
|
|
270
|
+
}
|
|
271
|
+
/** Transport nodes carry no business defaults. Only deployment input is volatile. */
|
|
272
|
+
function sparseSchema(schema) {
|
|
273
|
+
if (schema === permissionControlSchema && schema.type === "transform")
|
|
274
|
+
return sparseSchema(schema.inner);
|
|
275
|
+
const { default: _default, required: _required, ...meta } = schema.meta;
|
|
276
|
+
return new Schema({ ...schema, meta,
|
|
277
|
+
...(schema.dict === undefined ? {} : { dict: Object.fromEntries(Object.entries(schema.dict).map(([key, child]) => [key, sparseSchema(child)])) }),
|
|
278
|
+
...(schema.inner === undefined ? {} : { inner: sparseSchema(schema.inner) }),
|
|
279
|
+
...(schema.list === undefined ? {} : { list: schema.list.map(sparseSchema) }) });
|
|
280
|
+
}
|
|
281
|
+
const TRANSPORT_FIELDS_SCHEMA = sparseSchema(CONFIG_FIELDS_SCHEMA);
|
|
282
|
+
export const DSMM_CONFIG_SCHEMA = Schema.intersect([
|
|
283
|
+
Schema.transform(Schema.any(), (input) => { resolveConfig(validateSparseConfig(input ?? {})); return {}; }),
|
|
284
|
+
sparseSchema(CONFIG_FIELDS_SCHEMA)
|
|
285
|
+
]).default({});
|
|
286
|
+
for (const [key, schema] of Object.entries(TRANSPORT_FIELDS_SCHEMA.dict)) {
|
|
287
|
+
if (key !== "sessionPersistence")
|
|
288
|
+
TRANSPORT_FIELDS_SCHEMA.set(key, schema.volatile());
|
|
289
|
+
}
|
|
290
|
+
// Native forms require a fixed object root: volatile nodes cannot sit under an
|
|
291
|
+
// intersection. Keep that schema intact and validate through the public protocol.
|
|
292
|
+
export const DSMM_NATIVE_CONFIG_SCHEMA = new Proxy(TRANSPORT_FIELDS_SCHEMA.default({}), {
|
|
293
|
+
apply(target, receiver, args) {
|
|
294
|
+
validateSparseConfig(args[0] ?? {});
|
|
295
|
+
return Reflect.apply(target, receiver, args);
|
|
296
|
+
},
|
|
297
|
+
get(target, key, receiver) {
|
|
298
|
+
if (key !== "~standard")
|
|
299
|
+
return Reflect.get(target, key, receiver);
|
|
300
|
+
return { version: 1, vendor: "schemastery", validate(input) {
|
|
301
|
+
validateSparseConfig(input ?? {});
|
|
302
|
+
return target["~standard"].validate(input);
|
|
303
|
+
} };
|
|
304
|
+
}
|
|
305
|
+
});
|
|
222
306
|
export const DSMM_SETTINGS_SCHEMA = Schema.intersect([ROLE_ROUTING_VALIDATION_SCHEMA, Schema.object({
|
|
307
|
+
permissionControl: permissionControlSchema,
|
|
308
|
+
modelParameters: Schema.object({ passthrough: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.modelParameters.passthrough) }),
|
|
309
|
+
locale: LOCALE_SCHEMA,
|
|
310
|
+
modules: Schema.object({ deepwork: Schema.object({ enabled: Schema.boolean().default(true) }) }),
|
|
223
311
|
modeName: Schema.string().default(DEFAULT_DSMM_SETTINGS.modeName),
|
|
224
312
|
defaultActive: Schema.boolean().default(DEFAULT_DSMM_SETTINGS.defaultActive),
|
|
225
313
|
promptOrder: Schema.number().default(DEFAULT_DSMM_SETTINGS.promptOrder),
|
|
226
314
|
deepseekV4ProCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
227
315
|
deepseekV4ProDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
228
|
-
deepseekV4ProMaxReasoningPresets: DEEPSEEK_MAX_REASONING_PRESETS_SCHEMA,
|
|
229
316
|
deepseekFlashCalibration: DEEPSEEK_CALIBRATION_SCHEMA,
|
|
230
317
|
deepseekFlashDefaultReasoningEffort: DEEPSEEK_DEFAULT_REASONING_EFFORT_SCHEMA,
|
|
231
|
-
deepseekFlashMaxReasoningPresets: DEEPSEEK_MAX_REASONING_PRESETS_SCHEMA,
|
|
232
318
|
skills: SKILLS_SCHEMA,
|
|
233
319
|
roles: ROLES_SCHEMA,
|
|
234
320
|
roleRouting: ROLE_ROUTING_SCHEMA,
|
|
235
321
|
runtimePolicy: Schema.any(),
|
|
236
322
|
presets: PRESETS_SCHEMA,
|
|
323
|
+
subagents: SUBAGENTS_SCHEMA,
|
|
237
324
|
workflow: WORKFLOW_SCHEMA,
|
|
238
325
|
guards: GUARDS_SCHEMA,
|
|
239
326
|
runtimeRecovery: RUNTIME_RECOVERY_SCHEMA,
|
|
240
327
|
lsp: LSP_SCHEMA
|
|
241
328
|
})]).default({});
|
|
242
329
|
export function resolveConfig(config = {}) {
|
|
330
|
+
rejectDeprecatedFields(config);
|
|
331
|
+
if (Object.hasOwn(config, "locale"))
|
|
332
|
+
validateLocale(config.locale);
|
|
333
|
+
if (config.subagents !== undefined)
|
|
334
|
+
validateShape(config.subagents, SUBAGENTS_SCHEMA, ["subagents"]);
|
|
335
|
+
if (config.modelParameters !== undefined)
|
|
336
|
+
validateShape(config.modelParameters, CONFIG_FIELDS_SCHEMA.dict.modelParameters, ["modelParameters"]);
|
|
337
|
+
if (config.permissionControl !== undefined)
|
|
338
|
+
validateShape(config.permissionControl, permissionControlSchema, ["permissionControl"]);
|
|
243
339
|
const settings = {
|
|
340
|
+
permissionControl: resolvePermissionControl(config.permissionControl),
|
|
341
|
+
modelParameters: { passthrough: config.modelParameters?.passthrough ?? DEFAULT_DSMM_SETTINGS.modelParameters.passthrough },
|
|
342
|
+
...(config.locale === undefined ? {} : { locale: config.locale }),
|
|
343
|
+
modules: { deepwork: { enabled: config.modules?.deepwork?.enabled ?? DEFAULT_DSMM_SETTINGS.modules.deepwork.enabled } },
|
|
244
344
|
modeName: normalizeModeName(config.modeName),
|
|
245
345
|
defaultActive: config.defaultActive ?? DEFAULT_DSMM_SETTINGS.defaultActive,
|
|
246
346
|
promptOrder: config.promptOrder ?? DEFAULT_DSMM_SETTINGS.promptOrder,
|
|
247
347
|
deepseekV4ProCalibration: config.deepseekV4ProCalibration ?? DEFAULT_DSMM_SETTINGS.deepseekV4ProCalibration,
|
|
248
348
|
deepseekV4ProDefaultReasoningEffort: config.deepseekV4ProDefaultReasoningEffort ?? DEFAULT_DSMM_SETTINGS.deepseekV4ProDefaultReasoningEffort,
|
|
249
|
-
deepseekV4ProMaxReasoningPresets: resolveMaxReasoningPresets(config.deepseekV4ProMaxReasoningPresets, DEFAULT_DSMM_SETTINGS.deepseekV4ProMaxReasoningPresets),
|
|
250
349
|
deepseekFlashCalibration: config.deepseekFlashCalibration ?? DEFAULT_DSMM_SETTINGS.deepseekFlashCalibration,
|
|
251
350
|
deepseekFlashDefaultReasoningEffort: config.deepseekFlashDefaultReasoningEffort ?? DEFAULT_DSMM_SETTINGS.deepseekFlashDefaultReasoningEffort,
|
|
252
|
-
deepseekFlashMaxReasoningPresets: resolveMaxReasoningPresets(config.deepseekFlashMaxReasoningPresets, DEFAULT_DSMM_SETTINGS.deepseekFlashMaxReasoningPresets),
|
|
253
351
|
skills: { ...DEFAULT_DSMM_SETTINGS.skills, ...config.skills },
|
|
254
352
|
roles: { ...DEFAULT_DSMM_SETTINGS.roles, ...config.roles },
|
|
255
353
|
roleRouting: resolveRoleRouting(config.roleRouting),
|
|
256
354
|
runtimePolicy: normalizeRuntimePolicy(Object.hasOwn(config, "runtimePolicy") ? validatePresentRuntimePolicy(config.runtimePolicy) : undefined),
|
|
257
355
|
presets: resolvePresetSettings(config.presets),
|
|
356
|
+
subagents: SUBAGENTS_SCHEMA(config.subagents ?? {}),
|
|
258
357
|
workflow: resolveWorkflowSettings(config.workflow),
|
|
259
358
|
guards: resolveGuardSettings(config.guards),
|
|
260
359
|
runtimeRecovery: resolveRuntimeRecoverySettings(config.runtimeRecovery),
|
|
@@ -264,42 +363,300 @@ export function resolveConfig(config = {}) {
|
|
|
264
363
|
resolveRoleRuntimePolicy(settings, role);
|
|
265
364
|
return settings;
|
|
266
365
|
}
|
|
366
|
+
/** Reject references, accessors, prototypes and non-JSON data before any merge. */
|
|
367
|
+
export function copyJson(input) {
|
|
368
|
+
const active = new Set();
|
|
369
|
+
const copy = (value, depth) => {
|
|
370
|
+
if (depth > 32)
|
|
371
|
+
throw new TypeError("Deepwork configuration nesting is too deep");
|
|
372
|
+
if (value === null || typeof value === "boolean" || typeof value === "string")
|
|
373
|
+
return value;
|
|
374
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
375
|
+
return value;
|
|
376
|
+
if (typeof value !== "object" || value === null || active.has(value))
|
|
377
|
+
throw new TypeError("Deepwork configuration must be plain JSON data");
|
|
378
|
+
const prototype = Object.getPrototypeOf(value);
|
|
379
|
+
if (Array.isArray(value) ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null)
|
|
380
|
+
throw new TypeError("Deepwork configuration must use plain objects");
|
|
381
|
+
if (Object.getOwnPropertySymbols(value).length > 0)
|
|
382
|
+
throw new TypeError("Deepwork configuration must not contain symbols");
|
|
383
|
+
active.add(value);
|
|
384
|
+
const result = Array.isArray(value) ? [] : {};
|
|
385
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(value))) {
|
|
386
|
+
if (Array.isArray(value) && key === "length")
|
|
387
|
+
continue;
|
|
388
|
+
if (["__proto__", "prototype", "constructor"].includes(key) || !Object.hasOwn(descriptor, "value") || !descriptor.enumerable)
|
|
389
|
+
throw new TypeError("Deepwork configuration contains an unsafe property");
|
|
390
|
+
if (Array.isArray(value) && !/^(0|[1-9][0-9]*)$/u.test(key))
|
|
391
|
+
throw new TypeError("Deepwork configuration arrays must contain only elements");
|
|
392
|
+
Reflect.set(result, key, copy(descriptor.value, depth + 1));
|
|
393
|
+
}
|
|
394
|
+
if (Array.isArray(value) && Object.keys(result).length !== value.length)
|
|
395
|
+
throw new TypeError("Deepwork configuration arrays must not have holes");
|
|
396
|
+
active.delete(value);
|
|
397
|
+
return result;
|
|
398
|
+
};
|
|
399
|
+
return copy(input, 0);
|
|
400
|
+
}
|
|
401
|
+
export function freezeSettings(input) {
|
|
402
|
+
const result = copyJson(input);
|
|
403
|
+
const freeze = (value) => {
|
|
404
|
+
if (value === null || typeof value !== "object")
|
|
405
|
+
return;
|
|
406
|
+
for (const child of Object.values(value))
|
|
407
|
+
freeze(child);
|
|
408
|
+
Object.freeze(value);
|
|
409
|
+
};
|
|
410
|
+
freeze(result);
|
|
411
|
+
return result;
|
|
412
|
+
}
|
|
413
|
+
function validateShape(value, schema, path = []) {
|
|
414
|
+
const fail = (code = "invalid-type") => { throw new DsmmConfigValidationError(code, path); };
|
|
415
|
+
if (schema === MODEL_ROUTE_SCHEMA) {
|
|
416
|
+
try {
|
|
417
|
+
normalizeModelRouteJson(value, true, true);
|
|
418
|
+
}
|
|
419
|
+
catch {
|
|
420
|
+
fail("invalid-route");
|
|
421
|
+
}
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
if (value === null || value === undefined)
|
|
425
|
+
fail();
|
|
426
|
+
if (schema.type === "transform") {
|
|
427
|
+
validateShape(value, schema.inner, path);
|
|
428
|
+
}
|
|
429
|
+
else if (schema.type === "object") {
|
|
430
|
+
if (typeof value !== "object" || Array.isArray(value))
|
|
431
|
+
fail();
|
|
432
|
+
for (const [key, child] of Object.entries(value)) {
|
|
433
|
+
const field = schema.dict !== undefined && Object.hasOwn(schema.dict, key) ? schema.dict[key] : undefined;
|
|
434
|
+
if (field === undefined)
|
|
435
|
+
throw new DsmmConfigValidationError("unknown-field", [...path, key]);
|
|
436
|
+
validateShape(child, field, [...path, key]);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
else if (schema.type === "dict") {
|
|
440
|
+
if (typeof value !== "object" || Array.isArray(value))
|
|
441
|
+
throw new TypeError("Deepwork configuration field must be an object");
|
|
442
|
+
for (const [key, child] of Object.entries(value))
|
|
443
|
+
validateShape(child, schema.inner, [...path, key]);
|
|
444
|
+
}
|
|
445
|
+
else if (schema.type === "array") {
|
|
446
|
+
if (!Array.isArray(value))
|
|
447
|
+
throw new TypeError("Deepwork configuration field must be an array");
|
|
448
|
+
value.forEach((child, index) => validateShape(child, schema.inner, [...path, index]));
|
|
449
|
+
}
|
|
450
|
+
else if (schema.type === "union") {
|
|
451
|
+
for (const child of schema.list ?? []) {
|
|
452
|
+
try {
|
|
453
|
+
validateShape(value, child, path);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
catch { /* Try the other declared alternatives. */ }
|
|
457
|
+
}
|
|
458
|
+
fail("unsupported-value");
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
try {
|
|
462
|
+
schema(value);
|
|
463
|
+
}
|
|
464
|
+
catch {
|
|
465
|
+
fail();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
/** Sparse grammar and full semantic validation are separate from native refs. */
|
|
470
|
+
export function validateSparseConfig(input, global = false) {
|
|
471
|
+
if (isRoutingRecord(input))
|
|
472
|
+
rejectDeprecatedFields(input);
|
|
473
|
+
const config = copyJson(input);
|
|
474
|
+
if (isRoutingRecord(config.roleRouting)) {
|
|
475
|
+
for (const [role, policy] of Object.entries(config.roleRouting))
|
|
476
|
+
if (isRoutingRecord(policy) && Object.hasOwn(policy, "levels")) {
|
|
477
|
+
if (!DSMM_ROLE_IDS.includes(role))
|
|
478
|
+
throw new DsmmConfigValidationError("unknown-field", ["roleRouting", role]);
|
|
479
|
+
if (role === "dsmm-orchestrator")
|
|
480
|
+
throw new DsmmConfigValidationError("unsupported-value", `roleRouting.${role}.levels`);
|
|
481
|
+
if (!isRoutingRecord(policy.levels))
|
|
482
|
+
throw new DsmmConfigValidationError("invalid-type", `roleRouting.${role}.levels`);
|
|
483
|
+
for (const [level, value] of Object.entries(policy.levels)) {
|
|
484
|
+
const field = safeDiagnosticField(["roleRouting", role, "levels", level]);
|
|
485
|
+
if (!["low", "high", "max"].includes(level))
|
|
486
|
+
throw new DsmmConfigValidationError("unsupported-value", ["roleRouting", role, "levels", level]);
|
|
487
|
+
normalizeLevelOverride(value, field);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
validateShape(config, global ? GLOBAL_FIELDS_SCHEMA : CONFIG_FIELDS_SCHEMA);
|
|
492
|
+
if (global && Object.hasOwn(config, "sessionPersistence"))
|
|
493
|
+
throw new TypeError("Native session storage is not a global deployment field");
|
|
494
|
+
// A deployment layer may override one primary-route member and inherit the
|
|
495
|
+
// others. Validate its present members here; resolveDeployment validates the
|
|
496
|
+
// complete route only after both sparse layers have merged.
|
|
497
|
+
const routing = config.roleRouting === undefined ? undefined : copyJson(config.roleRouting);
|
|
498
|
+
for (const policy of Object.values(routing ?? {})) {
|
|
499
|
+
if (policy?.primary !== undefined && (!Object.hasOwn(policy.primary, "provider") || !Object.hasOwn(policy.primary, "model")))
|
|
500
|
+
delete policy.primary;
|
|
501
|
+
}
|
|
502
|
+
const settings = resolveConfig({ ...config, ...(routing === undefined ? {} : { roleRouting: routing }) });
|
|
503
|
+
DSMM_SETTINGS_SCHEMA(settings);
|
|
504
|
+
return config;
|
|
505
|
+
}
|
|
506
|
+
export function validateDeploymentPath(path) {
|
|
507
|
+
const deprecated = path.find(key => DEPRECATED_DSMM_FIELDS.includes(key));
|
|
508
|
+
if (deprecated !== undefined)
|
|
509
|
+
throw new DsmmConfigValidationError("deprecated-field", path);
|
|
510
|
+
let schema = GLOBAL_FIELDS_SCHEMA;
|
|
511
|
+
if (path.length === 0 || path[0] === "sessionPersistence")
|
|
512
|
+
throw new TypeError("Not an editable deployment field");
|
|
513
|
+
for (const key of path) {
|
|
514
|
+
if (schema.type === "union")
|
|
515
|
+
schema = schema.list?.find((node) => node === MODEL_ROUTE_SCHEMA || node.type === "object") ?? schema;
|
|
516
|
+
if (schema === MODEL_ROUTE_SCHEMA) {
|
|
517
|
+
if (path.some(part => ["__proto__", "prototype", "constructor"].includes(part)))
|
|
518
|
+
throw new DsmmConfigValidationError("invalid-route", path);
|
|
519
|
+
try {
|
|
520
|
+
validateModelRouteFieldName(key);
|
|
521
|
+
}
|
|
522
|
+
catch {
|
|
523
|
+
throw new DsmmConfigValidationError("invalid-route", path);
|
|
524
|
+
}
|
|
525
|
+
const field = MODEL_ROUTE_FIELDS_SCHEMA.dict[key];
|
|
526
|
+
if (Object.hasOwn(MODEL_ROUTE_FIELDS_SCHEMA.dict, key)) {
|
|
527
|
+
schema = field;
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
while (schema.type === "transform")
|
|
533
|
+
schema = schema.inner;
|
|
534
|
+
const child = schema.type === "object" ? schema.dict !== undefined && Object.hasOwn(schema.dict, key) ? schema.dict[key] : undefined : schema.type === "dict" ? schema.inner : undefined;
|
|
535
|
+
if (child === undefined)
|
|
536
|
+
throw new DsmmConfigValidationError("unknown-field", path);
|
|
537
|
+
schema = child;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
export function mergeConfigLayers(...layers) {
|
|
541
|
+
const merge = (base, overlay, path = []) => {
|
|
542
|
+
const result = copyJson(base);
|
|
543
|
+
for (const [key, value] of Object.entries(overlay)) {
|
|
544
|
+
const previous = result[key];
|
|
545
|
+
result[key] = path.at(-1) !== "levels" && value !== null && typeof value === "object" && !Array.isArray(value)
|
|
546
|
+
&& previous !== null && typeof previous === "object" && !Array.isArray(previous)
|
|
547
|
+
? merge(previous, value, [...path, key]) : copyJson(value);
|
|
548
|
+
}
|
|
549
|
+
return result;
|
|
550
|
+
};
|
|
551
|
+
return layers.reduce((base, layer) => merge(base, copyJson(layer)), {});
|
|
552
|
+
}
|
|
553
|
+
export function resolveDeployment(global, profile) {
|
|
554
|
+
const merged = mergeConfigLayers(validateSparseConfig(global, true), validateSparseConfig(profile));
|
|
555
|
+
const settings = resolveConfig(merged);
|
|
556
|
+
validateResolvedSettings(settings);
|
|
557
|
+
return freezeSettings(settings);
|
|
558
|
+
}
|
|
559
|
+
export function validateResolvedSettings(settings) {
|
|
560
|
+
const plain = copyJson(settings);
|
|
561
|
+
validateShape(plain, GLOBAL_FIELDS_SCHEMA);
|
|
562
|
+
DSMM_SETTINGS_SCHEMA(plain);
|
|
563
|
+
return plain;
|
|
564
|
+
}
|
|
267
565
|
function validatePresentRuntimePolicy(value) {
|
|
268
566
|
if (value === undefined)
|
|
269
567
|
throw new TypeError("dsmm runtimePolicy must be an object when present");
|
|
270
568
|
return value;
|
|
271
569
|
}
|
|
272
|
-
function
|
|
273
|
-
const
|
|
274
|
-
|
|
570
|
+
export function rejectDeprecatedFields(input, prefix = "") {
|
|
571
|
+
for (const key of DEPRECATED_DSMM_FIELDS)
|
|
572
|
+
if (Object.hasOwn(input, key))
|
|
573
|
+
throw new DsmmConfigValidationError("deprecated-field", `${prefix}${key}`);
|
|
574
|
+
}
|
|
575
|
+
export function validateLocale(value, field = "locale") {
|
|
576
|
+
if (typeof value !== "string" || !DSMM_LOCALES.includes(value))
|
|
577
|
+
throw new DsmmConfigValidationError("unsupported-value", field);
|
|
578
|
+
}
|
|
579
|
+
export function normalizeLevelOverride(value, field = "route") {
|
|
580
|
+
try {
|
|
581
|
+
value = copyJson(value);
|
|
582
|
+
}
|
|
583
|
+
catch {
|
|
584
|
+
throw new DsmmConfigValidationError("invalid-route", field);
|
|
585
|
+
}
|
|
586
|
+
if (!isRoutingRecord(value))
|
|
587
|
+
throw new DsmmConfigValidationError("invalid-route", field);
|
|
588
|
+
if (Object.hasOwn(value, "provider") || Object.hasOwn(value, "model")) {
|
|
589
|
+
try {
|
|
590
|
+
const route = normalizeExplicitRoute(value);
|
|
591
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/u.test(route.provider) || route.model.length > 512 || route.model.includes("://") || /[\u0000-\u001f\u007f]/u.test(route.model) || route.reasoningEffort !== undefined && (route.reasoningEffort.length > 64 || /[\u0000-\u001f\u007f]/u.test(route.reasoningEffort)))
|
|
592
|
+
throw new Error("Invalid bounded route");
|
|
593
|
+
return route;
|
|
594
|
+
}
|
|
595
|
+
catch {
|
|
596
|
+
throw new DsmmConfigValidationError("invalid-route", field);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
for (const key of Object.keys(value))
|
|
600
|
+
if (key !== "reasoningEffort")
|
|
601
|
+
throw new DsmmConfigValidationError("unknown-field", [...field.split("."), key]);
|
|
602
|
+
if (typeof value.reasoningEffort !== "string" || value.reasoningEffort.trim() === "" || value.reasoningEffort.length > 64 || /[\u0000-\u001f\u007f]/u.test(value.reasoningEffort))
|
|
603
|
+
throw new DsmmConfigValidationError("invalid-route", `${field}.reasoningEffort`);
|
|
604
|
+
return { reasoningEffort: value.reasoningEffort };
|
|
275
605
|
}
|
|
276
606
|
export function resolveRoleRouting(input) {
|
|
277
607
|
if (input === undefined)
|
|
278
608
|
return {};
|
|
609
|
+
input = copyJson(input);
|
|
279
610
|
if (!isRoutingRecord(input))
|
|
280
611
|
throw new TypeError("dsmm roleRouting must be an object");
|
|
281
612
|
const result = {};
|
|
282
613
|
for (const [key, value] of Object.entries(input)) {
|
|
283
614
|
if (!DSMM_ROLE_IDS.includes(key))
|
|
284
|
-
throw new
|
|
285
|
-
if (!isRoutingRecord(value) || Object.keys(value).some((field) => !["primary", "fallbackRoutes", "strategy", "rateLimit"].includes(field))) {
|
|
286
|
-
|
|
615
|
+
throw new DsmmConfigValidationError("unknown-field", ["roleRouting", key]);
|
|
616
|
+
if (!isRoutingRecord(value) || Object.keys(value).some((field) => !["primary", "fallbackRoutes", "strategy", "rateLimit", "levels"].includes(field))) {
|
|
617
|
+
if (!isRoutingRecord(value))
|
|
618
|
+
throw new DsmmConfigValidationError("invalid-type", `roleRouting.${key}`);
|
|
619
|
+
throw new DsmmConfigValidationError("unknown-field", ["roleRouting", key, Object.keys(value).find(field => !["primary", "fallbackRoutes", "strategy", "rateLimit", "levels"].includes(field))]);
|
|
287
620
|
}
|
|
288
621
|
const policy = {};
|
|
622
|
+
if (Object.hasOwn(value, "levels")) {
|
|
623
|
+
const field = `roleRouting.${key}.levels`;
|
|
624
|
+
if (key === "dsmm-orchestrator")
|
|
625
|
+
throw new DsmmConfigValidationError("unsupported-value", field);
|
|
626
|
+
if (!isRoutingRecord(value.levels))
|
|
627
|
+
throw new DsmmConfigValidationError("invalid-type", field);
|
|
628
|
+
policy.levels = {};
|
|
629
|
+
for (const [level, override] of Object.entries(value.levels)) {
|
|
630
|
+
if (!["low", "high", "max"].includes(level))
|
|
631
|
+
throw new DsmmConfigValidationError("unsupported-value", `${field}.${level}`);
|
|
632
|
+
policy.levels[level] = normalizeLevelOverride(override, `${field}.${level}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
289
635
|
if (Object.hasOwn(value, "strategy"))
|
|
290
636
|
policy.strategy = normalizeRoutingStrategy(value.strategy);
|
|
291
637
|
if (Object.hasOwn(value, "rateLimit"))
|
|
292
638
|
policy.rateLimit = normalizeRateLimitOverrides(value.rateLimit);
|
|
293
|
-
if (Object.hasOwn(value, "primary"))
|
|
294
|
-
|
|
639
|
+
if (Object.hasOwn(value, "primary")) {
|
|
640
|
+
try {
|
|
641
|
+
policy.primary = normalizeExplicitRoute(value.primary);
|
|
642
|
+
}
|
|
643
|
+
catch {
|
|
644
|
+
throw new DsmmConfigValidationError("invalid-route", `roleRouting.${key}.primary`);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
295
647
|
if (Object.hasOwn(value, "fallbackRoutes")) {
|
|
296
|
-
if (!Array.isArray(value.fallbackRoutes) || value.fallbackRoutes.length >
|
|
648
|
+
if (!Array.isArray(value.fallbackRoutes) || value.fallbackRoutes.length > ROLE_FALLBACK_ROUTE_LIMIT)
|
|
297
649
|
throw new TypeError("dsmm roleRouting fallbackRoutes must be an array with at most 32 entries");
|
|
298
650
|
policy.fallbackRoutes = [];
|
|
299
|
-
for (const entry of value.fallbackRoutes) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
651
|
+
for (const [index, entry] of value.fallbackRoutes.entries()) {
|
|
652
|
+
let route;
|
|
653
|
+
try {
|
|
654
|
+
route = normalizeExplicitRoute(entry);
|
|
655
|
+
}
|
|
656
|
+
catch {
|
|
657
|
+
throw new DsmmConfigValidationError("invalid-route", `roleRouting.${key}.fallbackRoutes[${index}]`);
|
|
658
|
+
}
|
|
659
|
+
policy.fallbackRoutes.push(route);
|
|
303
660
|
}
|
|
304
661
|
}
|
|
305
662
|
result[key] = policy;
|
|
@@ -310,26 +667,24 @@ function isRoutingRecord(value) {
|
|
|
310
667
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
311
668
|
}
|
|
312
669
|
function normalizeExplicitRoute(value) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
if (typeof value.provider !== "string" || value.provider.trim() === "" || typeof value.model !== "string" || value.model.trim() === "") {
|
|
317
|
-
throw new TypeError("dsmm explicit model route requires nonempty provider and model");
|
|
318
|
-
}
|
|
319
|
-
if (Object.hasOwn(value, "reasoningEffort") && (typeof value.reasoningEffort !== "string" || value.reasoningEffort.trim() === "")) {
|
|
320
|
-
throw new TypeError("dsmm explicit model route reasoningEffort must be nonempty");
|
|
321
|
-
}
|
|
322
|
-
return {
|
|
323
|
-
provider: value.provider.trim(), model: value.model.trim(),
|
|
324
|
-
...(typeof value.reasoningEffort === "string" ? { reasoningEffort: value.reasoningEffort.trim() } : {})
|
|
325
|
-
};
|
|
670
|
+
const route = normalizeModelRouteJson(value, false, true);
|
|
671
|
+
return { ...route, provider: route.provider.trim(), model: route.model.trim() };
|
|
326
672
|
}
|
|
327
673
|
export function isRoleEnabled(settings, role) {
|
|
328
674
|
return settings.roles[role];
|
|
329
675
|
}
|
|
676
|
+
/** Native standing-root availability is independent of child role enablement. */
|
|
677
|
+
export function isRootRoleEnabled(settings, id) {
|
|
678
|
+
const role = DSMM_ROLES.find(role => role.id === id);
|
|
679
|
+
return settings.modules.deepwork.enabled && settings.roles[id] && isRootRole(role)
|
|
680
|
+
&& (id !== "dsmm-planner" || settings.presets.plannerRootEnabled);
|
|
681
|
+
}
|
|
330
682
|
function resolvePresetSettings(config) {
|
|
683
|
+
if (config !== undefined)
|
|
684
|
+
validateShape(config, PRESETS_SCHEMA, ["presets"]);
|
|
331
685
|
return {
|
|
332
686
|
materialize: config?.materialize ?? DEFAULT_DSMM_SETTINGS.presets.materialize,
|
|
687
|
+
plannerRootEnabled: config?.plannerRootEnabled ?? DEFAULT_DSMM_SETTINGS.presets.plannerRootEnabled,
|
|
333
688
|
...(config?.root === undefined ? {} : { root: config.root })
|
|
334
689
|
};
|
|
335
690
|
}
|
|
@@ -392,24 +747,15 @@ function normalizeRetryCodes(input, defaults) {
|
|
|
392
747
|
}
|
|
393
748
|
function normalizeRecoveryRoutes(input, defaults) {
|
|
394
749
|
const normalized = [];
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
normalized.push({ provider, model, ...(reasoningEffort ? { reasoningEffort } : {}) });
|
|
750
|
+
const routes = copyJson(input ?? defaults);
|
|
751
|
+
if (!Array.isArray(routes) || routes.length > ROLE_FALLBACK_ROUTE_LIMIT)
|
|
752
|
+
throw new TypeError("dsmm recovery fallbackRoutes must contain at most 32 routes");
|
|
753
|
+
for (const route of routes) {
|
|
754
|
+
const candidate = normalizeExplicitRoute(route);
|
|
755
|
+
normalized.push(candidate);
|
|
402
756
|
}
|
|
403
757
|
return normalized;
|
|
404
758
|
}
|
|
405
|
-
function normalizeRecoveryEffort(route) {
|
|
406
|
-
if (!Object.hasOwn(route, "reasoningEffort"))
|
|
407
|
-
return undefined;
|
|
408
|
-
const value = route.reasoningEffort;
|
|
409
|
-
if (typeof value !== "string" || value.trim() === "")
|
|
410
|
-
throw new TypeError("dsmm recovery route reasoningEffort must be nonempty");
|
|
411
|
-
return value.trim();
|
|
412
|
-
}
|
|
413
759
|
function normalizeBoundedInteger(value, defaultValue) {
|
|
414
760
|
if (value === undefined || !Number.isFinite(value))
|
|
415
761
|
return defaultValue;
|
|
@@ -421,53 +767,13 @@ function normalizePositiveInteger(value, defaultValue) {
|
|
|
421
767
|
return Math.floor(value);
|
|
422
768
|
}
|
|
423
769
|
export function registerSettings(ctx, config = {}, options = {}) {
|
|
424
|
-
|
|
425
|
-
//
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
let getSettings = () => base;
|
|
433
|
-
let attached = false;
|
|
434
|
-
const installedSettingsByReadyContext = new WeakMap();
|
|
435
|
-
const ready = (readyCtx, settings) => {
|
|
436
|
-
if (settings === undefined || installedSettingsByReadyContext.get(readyCtx) === settings)
|
|
437
|
-
return;
|
|
438
|
-
const scope = settings.register(DSMM_SETTINGS_NAMESPACE, DSMM_SETTINGS_SCHEMA, { base, applies: "restart" });
|
|
439
|
-
const previousGetSettings = getSettings;
|
|
440
|
-
const previousAttached = attached;
|
|
441
|
-
getSettings = () => resolveConfig(scope.get());
|
|
442
|
-
try {
|
|
443
|
-
options.onChange?.(getSettings());
|
|
444
|
-
options.install?.(readyCtx, () => getSettings());
|
|
445
|
-
installedSettingsByReadyContext.set(readyCtx, settings);
|
|
446
|
-
readyCtx.effect?.(() => () => {
|
|
447
|
-
if (installedSettingsByReadyContext.get(readyCtx) === settings)
|
|
448
|
-
installedSettingsByReadyContext.delete(readyCtx);
|
|
449
|
-
});
|
|
450
|
-
attached = true;
|
|
451
|
-
}
|
|
452
|
-
catch (error) {
|
|
453
|
-
if (installedSettingsByReadyContext.get(readyCtx) === settings)
|
|
454
|
-
installedSettingsByReadyContext.delete(readyCtx);
|
|
455
|
-
getSettings = previousGetSettings;
|
|
456
|
-
attached = previousAttached;
|
|
457
|
-
throw error;
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
if (ctx.inject !== undefined) {
|
|
461
|
-
ctx.inject(["settings", "systemPrompt"], (readyCtx) => ready(readyCtx, readyCtx.settings));
|
|
462
|
-
return () => getSettings();
|
|
463
|
-
}
|
|
464
|
-
if (Object.prototype.hasOwnProperty.call(ctx, "settings")) {
|
|
465
|
-
ready(ctx, Object.getOwnPropertyDescriptor(ctx, "settings")?.value);
|
|
466
|
-
}
|
|
467
|
-
if (!attached) {
|
|
468
|
-
options.onChange?.(getSettings());
|
|
469
|
-
options.install?.(ctx, () => getSettings());
|
|
470
|
-
}
|
|
471
|
-
return () => getSettings();
|
|
770
|
+
// Loader owns entry identity, Config validation, revision and persistent patch.
|
|
771
|
+
// Each non-volatile reload receives a new deployment baseline. Profiles stay
|
|
772
|
+
// on the existing immutable admission path, never a parallel settings store.
|
|
773
|
+
const base = freezeSettings(options.resolved === undefined ? resolveConfig(validateSparseConfig(config)) : validateResolvedSettings(options.resolved));
|
|
774
|
+
const getSettings = () => base;
|
|
775
|
+
options.onChange?.(base);
|
|
776
|
+
options.install?.(ctx, getSettings);
|
|
777
|
+
return getSettings;
|
|
472
778
|
}
|
|
473
779
|
//# sourceMappingURL=settings.js.map
|