@dsmm/dsmm 0.1.9 → 0.2.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/README.md +40 -24
- package/agent-presets/dsmm-builder/agent.cordis.yml +1949 -39
- package/agent-presets/dsmm-builder/preset.yml +1 -1
- package/agent-presets/dsmm-clarifier/agent.cordis.yml +436 -14
- package/agent-presets/dsmm-clarifier/preset.yml +1 -1
- package/agent-presets/dsmm-code-search/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-code-search/preset.yml +1 -1
- package/agent-presets/dsmm-coding/agent.cordis.yml +588 -0
- package/agent-presets/dsmm-coding/preset.yml +3 -0
- package/agent-presets/dsmm-complex/agent.cordis.yml +1140 -0
- package/agent-presets/dsmm-complex/preset.yml +3 -0
- package/agent-presets/dsmm-creative/agent.cordis.yml +536 -12
- package/agent-presets/dsmm-creative/preset.yml +1 -1
- package/agent-presets/dsmm-cross-cutting/agent.cordis.yml +1163 -0
- package/agent-presets/dsmm-cross-cutting/preset.yml +3 -0
- package/agent-presets/dsmm-deep/agent.cordis.yml +1173 -0
- package/agent-presets/dsmm-deep/preset.yml +3 -0
- package/agent-presets/dsmm-doc-search/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-doc-search/preset.yml +1 -1
- package/agent-presets/dsmm-documenting/agent.cordis.yml +581 -0
- package/agent-presets/dsmm-documenting/preset.yml +3 -0
- package/agent-presets/dsmm-frontend/agent.cordis.yml +580 -0
- package/agent-presets/dsmm-frontend/preset.yml +3 -0
- package/agent-presets/dsmm-hard-reasoning/agent.cordis.yml +572 -0
- package/agent-presets/dsmm-hard-reasoning/preset.yml +3 -0
- package/agent-presets/dsmm-media-reader/agent.cordis.yml +56 -14
- package/agent-presets/dsmm-media-reader/preset.yml +1 -1
- package/agent-presets/dsmm-normal-task/agent.cordis.yml +546 -0
- package/agent-presets/dsmm-normal-task/preset.yml +3 -0
- package/agent-presets/dsmm-oracle/agent.cordis.yml +421 -12
- package/agent-presets/dsmm-oracle/preset.yml +1 -1
- package/agent-presets/dsmm-oracle-2nd/agent.cordis.yml +421 -12
- package/agent-presets/dsmm-oracle-2nd/preset.yml +1 -1
- package/agent-presets/dsmm-orchestrator/agent.cordis.yml +2023 -43
- package/agent-presets/dsmm-orchestrator/preset.yml +1 -1
- package/agent-presets/dsmm-plan-critic/agent.cordis.yml +416 -13
- package/agent-presets/dsmm-plan-critic/preset.yml +1 -1
- package/agent-presets/dsmm-planner/agent.cordis.yml +462 -13
- package/agent-presets/dsmm-planner/preset.yml +1 -1
- package/agent-presets/dsmm-quick/agent.cordis.yml +119 -0
- package/agent-presets/dsmm-quick/preset.yml +3 -0
- package/agent-presets/dsmm-research/agent.cordis.yml +141 -0
- package/agent-presets/dsmm-research/preset.yml +3 -0
- package/agent-presets/dsmm-reviewer/agent.cordis.yml +420 -13
- package/agent-presets/dsmm-reviewer/preset.yml +1 -1
- package/cordis.patch.yml +1 -5
- package/docs/agent-presets.md +64 -15
- package/docs/compatibility.md +61 -13
- package/docs/design.md +41 -0
- package/docs/lsp.md +12 -2
- package/docs/migration-from-ocmm.md +8 -0
- package/docs/profiles.md +41 -15
- package/docs/releasing.md +78 -8
- package/docs/roadmap.md +6 -0
- package/docs/runtime-recovery.md +12 -0
- package/docs/safety-guards.md +7 -3
- package/docs/settings-status.md +148 -7
- package/docs/skill-sync.md +52 -14
- package/lib/client/DeploymentPage.d.ts +18 -0
- package/lib/client/DeploymentPage.js +120 -0
- package/lib/client/ProfilesSection.js +4 -2
- package/lib/client/deployment-controller.d.ts +50 -0
- package/lib/client/deployment-controller.js +193 -0
- package/lib/client/deployment-data.d.ts +16 -0
- package/lib/client/deployment-data.js +109 -0
- package/lib/client/deployment-locales.d.ts +66 -0
- package/lib/client/deployment-locales.js +72 -0
- package/lib/client/index.js +50 -0
- package/lib/client/locales.d.ts +4 -0
- package/lib/client/locales.js +4 -2
- package/lib/client/plugins-contract.d.ts +27 -0
- package/lib/client/plugins-contract.js +2 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/styles.js +16 -0
- package/lib/client.js +1048 -29
- 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/deployment-config.d.ts +37 -0
- package/lib/deployment-config.js +184 -0
- package/lib/dsh-home.d.ts +3 -0
- package/lib/dsh-home.js +10 -0
- package/lib/dsh-types.d.ts +12 -65
- package/lib/guards.d.ts +2 -1
- package/lib/guards.js +19 -2
- package/lib/index.d.ts +8 -1
- package/lib/index.js +115 -25
- package/lib/lsp.d.ts +13 -0
- package/lib/lsp.js +60 -0
- package/lib/mode.js +42 -47
- package/lib/model-routing.js +5 -2
- package/lib/modules.d.ts +27 -0
- package/lib/modules.js +21 -0
- package/lib/native-scope.d.ts +9 -0
- package/lib/native-scope.js +20 -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 +7 -4
- package/lib/preset-skills.d.ts +4 -1
- package/lib/preset-skills.js +60 -19
- package/lib/profile-remote.d.ts +14 -0
- package/lib/profile-remote.js +197 -4
- package/lib/profile-rpc.d.ts +24 -1
- package/lib/profile-rpc.js +139 -1
- package/lib/profile-runtime.d.ts +24 -0
- package/lib/profile-runtime.js +177 -33
- package/lib/profile-store.d.ts +45 -1
- package/lib/profile-store.js +236 -102
- package/lib/profile-types.d.ts +55 -0
- package/lib/prompt-content.d.ts +25 -0
- package/lib/prompt-content.js +27 -0
- package/lib/prompts.d.ts +8 -2
- package/lib/prompts.js +46 -34
- package/lib/role-policy.d.ts +51 -0
- package/lib/role-policy.js +224 -0
- package/lib/role-providers.d.ts +6 -2
- package/lib/role-providers.js +72 -39
- package/lib/role-subagents.d.ts +6 -2
- package/lib/role-subagents.js +187 -48
- package/lib/roles.d.ts +16 -4
- package/lib/roles.js +86 -186
- package/lib/runtime-recovery.js +16 -5
- package/lib/session-scope.js +2 -0
- package/lib/settings.d.ts +69 -1
- package/lib/settings.js +262 -91
- 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 +25 -0
- package/lib/status.js +47 -9
- package/locale/en.json +2 -2
- package/locale/zh.json +2 -2
- package/package.json +19 -2
- package/prompts/deepwork.md +144 -20
- package/prompts/source/agents/clarifier.md +45 -0
- package/prompts/source/agents/orchestrator.md +63 -0
- package/prompts/source/agents/plan-critic.md +25 -0
- package/prompts/source/agents/planner.md +19 -0
- package/prompts/source/agents/reviewer.md +17 -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 +38 -0
- package/prompts/source/category/cross-cutting.md +52 -0
- package/prompts/source/category/deep.md +62 -0
- package/prompts/source/category/documenting.md +62 -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 +56 -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 +129 -0
- package/prompts/source/deepwork/gemini.md +184 -0
- package/prompts/source/deepwork/glm.md +256 -0
- package/prompts/source/deepwork/gpt.md +43 -0
- package/prompts/source/deepwork/kimi-k27.md +13 -0
- package/prompts/source/deepwork/planner.md +41 -0
- package/prompts/source/deepwork/swe-2.md +13 -0
- package/prompts/source/manifest.json +3118 -0
- package/prompts/source/shared/dsh-host-contract.md +6 -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/skills/ast-grep/LICENSE +21 -0
- package/skills/ast-grep/README.md +138 -0
- package/skills/ast-grep/SKILL.md +284 -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 +102 -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 +144 -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 +125 -4
- package/skills/debugging/references/logging.md +2 -0
- package/skills/debugging/references/methodology/00-setup.md +2 -0
- package/skills/debugging/references/methodology/02-investigate.md +8 -2
- package/skills/debugging/references/methodology/03-flaky-triage.md +3 -1
- package/skills/debugging/references/methodology/04-hard-reasoning-escalation.md +4 -2
- package/skills/debugging/references/methodology/05-escalate.md +2 -0
- package/skills/debugging/references/methodology/06-fix.md +2 -0
- package/skills/debugging/references/methodology/08-qa.md +2 -0
- package/skills/debugging/references/methodology/09-cleanup.md +2 -0
- package/skills/debugging/references/methodology/partial-runtime-evidence.md +4 -2
- package/skills/debugging/references/runtimes/bundled-js-binary.md +2 -0
- package/skills/debugging/references/runtimes/go.md +2 -0
- package/skills/debugging/references/runtimes/native-binary.md +2 -0
- package/skills/debugging/references/runtimes/node.md +2 -0
- package/skills/debugging/references/runtimes/python.md +2 -0
- package/skills/debugging/references/runtimes/rust.md +2 -0
- 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 +3 -1
- package/skills/debugging/references/tools/ghidra.md +2 -0
- package/skills/debugging/references/tools/playwright-cli.md +2 -0
- package/skills/debugging/references/tools/pwndbg.md +2 -0
- package/skills/debugging/references/tools/pwntools.md +2 -0
- package/skills/dispatching-parallel-agents/SKILL.md +94 -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 +142 -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 +112 -0
- package/skills/git-master/agents/openai.yaml +13 -0
- package/skills/init-deep/SKILL.md +279 -0
- package/skills/receiving-code-review/SKILL.md +112 -7
- package/skills/remove-ai-slops/SKILL.md +159 -8
- package/skills/requesting-code-review/SKILL.md +96 -3
- package/skills/requesting-code-review/code-reviewer.md +47 -0
- package/skills/subagent-driven-development/SKILL.md +176 -6
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +23 -0
- package/skills/subagent-driven-development/implementer-prompt.md +69 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +32 -0
- package/skills/using-git-worktrees/SKILL.md +141 -0
- package/skills/writing-plans/SKILL.md +121 -7
- package/skills/writing-plans/plan-document-reviewer-prompt.md +38 -0
package/lib/prompts.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import type { DshLlmCallConfig } from "./dsh-types.js";
|
|
2
|
+
import type { SourceRoleContent } from "./prompt-content.js";
|
|
2
3
|
import type { DsmmSettings } from "./settings.js";
|
|
3
|
-
export
|
|
4
|
+
export { SOURCE_ROLE_CATALOG, buildRolePersona } from "./prompt-content.js";
|
|
5
|
+
export type { SourceRoleContent } from "./prompt-content.js";
|
|
6
|
+
export declare const BASE_DEEPWORK_PROMPT: string;
|
|
7
|
+
export declare function promptModelVariants(role: string | undefined, model: string): string[];
|
|
8
|
+
export declare function roleModelCalibration(role: SourceRoleContent | undefined, model: string): string;
|
|
4
9
|
export declare const DEEPSEEK_V4_PRO_OVERLAY = "<dsmm-deepseek-v4-pro-calibration>\n\nDeepSeek V4 Pro calibration is active.\n\n- Treat complex coding, architecture, migration, debugging, and review tasks as deliberate reasoning tasks.\n- First classify the task and identify the evidence needed.\n- Use tools before making repository-specific or API-specific claims.\n- Runtime reasoning effort is enforced by `agent/request`, not this prompt.\n- In `auto` calibration, explicit upstream reasoning effort is preserved; `strict` overrides it with computed policy.\n- Only adapter-advertised reasoning efforts are emitted; `max` is selected only for configured DW presets.\n- Keep final answers concise and do not expose private chain-of-thought.\n- When tool calls are enabled through the provider, preserve the provider-required reasoning/tool-call continuity.\n\n</dsmm-deepseek-v4-pro-calibration>";
|
|
5
10
|
export declare const DEEPSEEK_FLASH_OVERLAY = "<dsmm-deepseek-flash-calibration>\n\nDeepSeek-V41-Flash applies only to the verified deepseek-official/deepseek-flash or deepseek-account/deepseek-flash routes. The host catalog and explicit user model choice are authoritative.\n\n- Keep work outcome-first and avoid procedural review or approval loops.\n- Runtime reasoning effort is chosen by the adapter only from the resolved model's advertised efforts. If the catalog advertises no reasoning efforts, leave the request unchanged.\n- Auto preserves explicit upstream effort; strict overrides it only with an advertised effort.\n- Do not assume max, high, temperature, or another model's capabilities. Do not claim model heterogeneity when all child roles use the same route.\n- Maintain tool-call continuity required by the provider and never reveal private reasoning.\n\n</dsmm-deepseek-flash-calibration>";
|
|
6
11
|
export interface DeepworkPromptOptions {
|
|
7
12
|
route?: Pick<DshLlmCallConfig, "provider" | "model">;
|
|
8
13
|
selectedPreset?: string;
|
|
14
|
+
/** Existing effective-role resolver supplies content identity, not route authority. */
|
|
15
|
+
roleId?: string | null;
|
|
9
16
|
overrideSection?: string;
|
|
10
|
-
skillPrompt?: string;
|
|
11
17
|
}
|
|
12
18
|
export declare function buildDeepworkPrompt(settings: DsmmSettings, options?: DeepworkPromptOptions): string;
|
|
13
19
|
//# sourceMappingURL=prompts.d.ts.map
|
package/lib/prompts.js
CHANGED
|
@@ -1,36 +1,46 @@
|
|
|
1
1
|
import { desiredDeepseekEffort, isDeepseekFlashRoute, isDeepseekV4ProRoute } from "./model-routing.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Intent routing
|
|
9
|
-
|
|
10
|
-
Determine whether the user requests an explanation, diagnosis, implementation, or open-ended design. State the outcome and evidence in the user's language; classify aloud only when it helps the user.
|
|
11
|
-
|
|
12
|
-
## Workflow gates
|
|
13
|
-
|
|
14
|
-
- A clear implementation request authorizes its stated scope. Do not require design reapproval or a separate approval loop for equivalent implementation decisions.
|
|
15
|
-
- For complex business or behavior implementation, default to planner → plan-critic → implementation. Skip this sequence only for a bounded, simple, low-risk change or an explicit permitted user request. A task having multiple steps alone is not the criterion.
|
|
16
|
-
- Escalate choices that change scope or acceptance, weaken safety/data guarantees, change a public API/protocol or permissions, or cause an irreversible effect. Preserve explicit user configuration.
|
|
17
|
-
- Request implementation review when risk, uncertainty, or user requirements warrant it; reviewer is primary-lane self-review, while an Oracle is an externally configured cross-check. Do not run fixed review loops or manufacture an Oracle model.
|
|
18
|
-
- For completed implementation, gather evidence from tests, diagnostics, and real surfaces before declaring done.
|
|
19
|
-
- Keep scope exact. Do not add unrelated refactors, speculative abstractions, or surprise features.
|
|
20
|
-
- The bundled workflow skill set is available in this mode: \`brainstorming\`, \`writing-plans\`, \`subagent-driven-development\`, \`dispatching-parallel-agents\`, \`requesting-code-review\`, \`receiving-code-review\`, and \`remove-ai-slops\`.
|
|
21
|
-
- \`workflow.policy=risk-based\` uses the rules above. Explicit \`workflow.policy=legacy\` retains the configured \`strictGates\`, \`reviewCap\`, and \`finalReviewPolicy\` gates. Do not apply any Deepwork policy outside active \`{{modeName}}\` mode or DW-managed preset scope.
|
|
22
|
-
|
|
23
|
-
## Tool discipline
|
|
24
|
-
|
|
25
|
-
Use repository tools for repository-specific claims. Prefer narrow reads and searches before broad exploration. Use external documentation for library, API, CLI, or cloud-service details.
|
|
26
|
-
|
|
27
|
-
- Use the shell dialect available in the current DSH runtime. Keep commands short and inspectable; resolve exact paths before destructive actions and do not string-build cross-shell deletes.
|
|
28
|
-
- No autonomous Git writes: implementing or fixing does not authorize a commit, and a commit does not authorize pushing, tagging, rebasing, or releasing.
|
|
29
|
-
- Child tasks inherit the host's authority and depth limits. Delegate only through actually available DSH tools; preset files alone do not prove that a role is callable.
|
|
30
|
-
|
|
31
|
-
- Deepwork safety guards may enforce shell dialect, git-write approval, output-size, plan-format, question-label, and todo-discipline policy inside this mode; treat \`[dsmm safety]\` messages as binding policy feedback.
|
|
32
|
-
|
|
2
|
+
import { readPromptAsset as asset, SOURCE_ROLE_CATALOG, splitCategory } from "./prompt-content.js";
|
|
3
|
+
export { SOURCE_ROLE_CATALOG, buildRolePersona } from "./prompt-content.js";
|
|
4
|
+
const activation = `<dsmm-deepwork-mode>
|
|
5
|
+
Use this workflow only while the \`{{modeName}}\` mode is effectively active. This is an opt-in boundary: ordinary presets default off; DW roles default on, but explicit off wins and retains only persona/access. Never force common workflow or skills on merely from a role name.
|
|
6
|
+
\`workflow.policy=risk-based\` follows the source workflow below. Explicit \`workflow.policy=legacy\` retains the configured \`strictGates\`, \`reviewCap\` and \`finalReviewPolicy\` gates; it is compatibility policy, not extra authorization. Role scope, output and terminal delegation policy are authoritative over all workflow/model guidance.
|
|
7
|
+
Skills are native metadata and lazy bodies, never automatically injected. Load matching skills only through the actual native skill catalog. Treat \`[dsmm safety]\` messages as binding feedback. Implementing does not authorize a commit; a commit does not authorize push/tag/rebase/release.
|
|
33
8
|
</dsmm-deepwork-mode>`;
|
|
9
|
+
export const BASE_DEEPWORK_PROMPT = [activation, asset("deepwork/default.md"), asset("shared/shell-safety.md"), asset("shared/dsh-host-contract.md")].join("\n\n---\n\n");
|
|
10
|
+
// Prompt-only matching follows src/intent/model-family.ts, not model routing.
|
|
11
|
+
function modelName(fullId) {
|
|
12
|
+
const name = fullId.slice(fullId.lastIndexOf("/") + 1).toLowerCase();
|
|
13
|
+
const vendors = { openai: /^(?:gpt-|o\d|chatgpt-|codex-)/u, anthropic: /^claude-/u, google: /^gemini-/u, zhipu: /^glm-/u, deepseek: /^deepseek-/u };
|
|
14
|
+
const parts = name.split("."), direct = parts.slice(1).join("."), regional = parts.slice(2).join(".");
|
|
15
|
+
if (vendors[parts[0]]?.test(direct))
|
|
16
|
+
return direct;
|
|
17
|
+
if (/^(?:[a-z]{2}|[a-z]{2}-[a-z]+-\d+)$/u.test(parts[0]) && vendors[parts[1]]?.test(regional))
|
|
18
|
+
return regional;
|
|
19
|
+
return name;
|
|
20
|
+
}
|
|
21
|
+
export function promptModelVariants(role, model) {
|
|
22
|
+
const name = modelName(model);
|
|
23
|
+
const gpt = name.includes("gpt") || model.toLowerCase().includes("codex");
|
|
24
|
+
const opus = /^claude-opus-5(?:[-.]5)?(?:$|[-.](?:20\d{6}(?:[-.][a-z0-9]+)*|[a-z][a-z0-9-]*))$/iu.test(name.replace(/^global\.anthropic\./iu, "").replace(/@default$/iu, ""));
|
|
25
|
+
const kimi = ["kimi-for-coding", "kimi-for-coding-highspeed"].includes(name) || /^(?:kimi-k2[.-]?[78]|k2[-.]?p[78])(?:$|[-_.])/u.test(name);
|
|
26
|
+
const additive = gpt ? ["gpt"] : kimi ? ["kimi-k27"] : /^swe-2(?:[-.]|$)/u.test(name) ? ["swe-2"] : [];
|
|
27
|
+
const base = role === "planner" ? "planner" : role === "orchestrator" && opus ? "claude-opus-5"
|
|
28
|
+
: model.toLowerCase().includes("codex") ? "codex" : gpt ? "gpt" : name.startsWith("gemini-") ? "gemini" : name.includes("glm") ? "glm" : "default";
|
|
29
|
+
return [...new Set([base, ...additive])].filter((variant) => variant !== "default");
|
|
30
|
+
}
|
|
31
|
+
export function roleModelCalibration(role, model) {
|
|
32
|
+
const variants = promptModelVariants(role?.sourceId, model);
|
|
33
|
+
const layers = variants.map((variant) => asset(`deepwork/${variant}.md`));
|
|
34
|
+
if (role?.kind === "category" && role.promptArtifact !== null) {
|
|
35
|
+
const category = splitCategory(asset(role.promptArtifact.replace("prompts/source/", "")));
|
|
36
|
+
const name = modelName(model);
|
|
37
|
+
const family = model.toLowerCase().includes("codex") || name.includes("gpt") ? "gpt" : name.startsWith("gemini-") ? "gemini" : name.includes("glm") ? "glm" : name.includes("claude") ? "claude" : "unknown";
|
|
38
|
+
// Categories carry only their own family layer + additive model calibration,
|
|
39
|
+
// not the base-agent Gemini/GLM/planner workflow variants.
|
|
40
|
+
return [category.calibrations.get(family), ...layers.filter((_layer, index) => ["gpt", "kimi-k27", "swe-2"].includes(variants[index]))].filter(Boolean).join("\n\n---\n\n");
|
|
41
|
+
}
|
|
42
|
+
return layers.join("\n\n---\n\n");
|
|
43
|
+
}
|
|
34
44
|
export const DEEPSEEK_V4_PRO_OVERLAY = `<dsmm-deepseek-v4-pro-calibration>
|
|
35
45
|
|
|
36
46
|
DeepSeek V4 Pro calibration is active.
|
|
@@ -57,7 +67,10 @@ DeepSeek-V41-Flash applies only to the verified deepseek-official/deepseek-flash
|
|
|
57
67
|
|
|
58
68
|
</dsmm-deepseek-flash-calibration>`;
|
|
59
69
|
export function buildDeepworkPrompt(settings, options = {}) {
|
|
60
|
-
const
|
|
70
|
+
const role = SOURCE_ROLE_CATALOG.find((role) => role.id === (options.roleId === undefined ? options.selectedPreset : options.roleId));
|
|
71
|
+
const common = role === undefined ? BASE_DEEPWORK_PROMPT : [activation, asset("deepwork/default.md")].join("\n\n---\n\n");
|
|
72
|
+
const family = roleModelCalibration(role, options.route?.model ?? "");
|
|
73
|
+
const base = [options.overrideSection?.trim() || common, family === "" ? "" : `<workflow-model-calibration>\nThe role prompt is authoritative for scope, permissions and output. Model calibration never grants tools or changes the native route.\n\n${family}\n</workflow-model-calibration>`].filter(Boolean).join("\n\n---\n\n").replaceAll("{{modeName}}", settings.modeName);
|
|
61
74
|
const workflowPolicy = settings.workflow.policy === "legacy" ? `<dsmm-workflow-policy>
|
|
62
75
|
policy: legacy
|
|
63
76
|
strictGates: ${String(settings.workflow.strictGates)}
|
|
@@ -76,7 +89,6 @@ effectiveDesiredReasoningEffort: ${desiredDeepseekEffort(settings, options.selec
|
|
|
76
89
|
</dsmm-deepseek-${model}-policy>`;
|
|
77
90
|
const calibrated = model !== undefined && calibration !== "off"
|
|
78
91
|
? `${base}\n\n${model === "flash" ? DEEPSEEK_FLASH_OVERLAY : DEEPSEEK_V4_PRO_OVERLAY}\n\n${calibrationPolicy}` : base;
|
|
79
|
-
|
|
80
|
-
return options.skillPrompt === undefined || options.skillPrompt === "" ? prompt : `${prompt}\n\n${options.skillPrompt}`;
|
|
92
|
+
return `${calibrated}\n\n${workflowPolicy}`;
|
|
81
93
|
}
|
|
82
94
|
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { ToolRestriction, ToolRuntime } from "@deepseek-ai/dsh-tools";
|
|
2
|
+
import type { DshAgent, DshContext } from "./dsh-types.js";
|
|
3
|
+
import type { DsmmRoleId } from "./roles.js";
|
|
4
|
+
import type { DsmmSettings, DsmmSettingsGetter } from "./settings.js";
|
|
5
|
+
import type { DeepworkModeController } from "./state.js";
|
|
6
|
+
export interface DsmmRoleIdentity {
|
|
7
|
+
readonly role?: DsmmRoleId;
|
|
8
|
+
readonly child: boolean;
|
|
9
|
+
readonly epoch: string;
|
|
10
|
+
readonly parent?: DshAgent;
|
|
11
|
+
readonly readOnly?: boolean;
|
|
12
|
+
readonly toolFilter?: ToolRestriction;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveAdmittedDsmmRole(agent: DshAgent, settings: DsmmSettings, active: boolean): DsmmRoleId | undefined;
|
|
15
|
+
export declare function allowedRoleChildren(role: DsmmRoleId, child?: boolean): readonly DsmmRoleId[];
|
|
16
|
+
export declare function roleToolName(role: DsmmRoleId): string;
|
|
17
|
+
export declare function roleFromToolName(name: string): DsmmRoleId | undefined;
|
|
18
|
+
export declare function readonlyRoleTool(name: string, settings: DsmmSettings): boolean;
|
|
19
|
+
interface DelegationIdentity {
|
|
20
|
+
parent: DshAgent;
|
|
21
|
+
role: DsmmRoleId;
|
|
22
|
+
epoch: string;
|
|
23
|
+
toolFilter?: ToolRestriction;
|
|
24
|
+
}
|
|
25
|
+
/** Identity admission only: native services retain every run, inbox and retry lifecycle. */
|
|
26
|
+
export declare class DsmmRolePolicy {
|
|
27
|
+
private readonly ctx;
|
|
28
|
+
private readonly getSettings;
|
|
29
|
+
private readonly mode;
|
|
30
|
+
private readonly calls;
|
|
31
|
+
private readonly providers;
|
|
32
|
+
constructor(ctx: DshContext, getSettings: DsmmSettingsGetter, mode: DeepworkModeController);
|
|
33
|
+
captureProvider(provider: object): void;
|
|
34
|
+
private agents;
|
|
35
|
+
assertLive(agent: DshAgent): void;
|
|
36
|
+
/** Core fence runs before native prompt/body assembly or provider execution. */
|
|
37
|
+
assertModuleAdmission(agent: DshAgent): void;
|
|
38
|
+
identity(agent: DshAgent): DsmmRoleIdentity;
|
|
39
|
+
targets(agent: DshAgent): readonly DsmmRoleId[];
|
|
40
|
+
assertDelegation(parent: DshAgent, role: DsmmRoleId): DelegationIdentity;
|
|
41
|
+
duringDelegation<T>(parent: DshAgent, role: DsmmRoleId, operation: () => T, toolFilter?: ToolRestriction): T;
|
|
42
|
+
prepareContinuable(parent: DshAgent, role: DsmmRoleId, signal: AbortSignal): void;
|
|
43
|
+
admit(agent: DshAgent): DsmmRoleIdentity;
|
|
44
|
+
private bindChild;
|
|
45
|
+
private captureIdentity;
|
|
46
|
+
captureTools(agent: DshAgent, tools: ToolRuntime, controlledNames?: readonly string[], reset?: boolean): void;
|
|
47
|
+
toolDenial(agent: DshAgent, name: string, tools?: ToolRuntime): string | undefined;
|
|
48
|
+
installDrain(agent: DshAgent): void;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=role-policy.d.ts.map
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { foldSubagentDescriptor, SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
3
|
+
import { symbols } from "@deepseek-ai/cordis";
|
|
4
|
+
import { DSMM_ROLES, isDsmmRoleId } from "./roles.js";
|
|
5
|
+
import { childOwnedSessionEvents, resolveEffectiveDsmmRole, resolveSelectedAgentPreset } from "./session-scope.js";
|
|
6
|
+
const liveIdentities = new WeakMap();
|
|
7
|
+
const toolIdentities = new WeakMap();
|
|
8
|
+
function inheritToolFilter(parent, requested) {
|
|
9
|
+
if (parent === undefined && requested === undefined)
|
|
10
|
+
return undefined;
|
|
11
|
+
const allow = parent?.allow === undefined ? requested?.allow : requested?.allow === undefined ? parent.allow
|
|
12
|
+
: parent.allow.filter((name) => requested.allow.includes(name));
|
|
13
|
+
const deny = [...new Set([...parent?.deny ?? [], ...requested?.deny ?? []])];
|
|
14
|
+
return Object.freeze({ ...(allow === undefined ? {} : { allow: Object.freeze([...allow]) }),
|
|
15
|
+
...(parent?.deny === undefined && requested?.deny === undefined ? {} : { deny: Object.freeze(deny) }) });
|
|
16
|
+
}
|
|
17
|
+
export function resolveAdmittedDsmmRole(agent, settings, active) {
|
|
18
|
+
if (!settings.modules.deepwork.enabled)
|
|
19
|
+
return undefined;
|
|
20
|
+
const identity = liveIdentities.get(agent)?.identity;
|
|
21
|
+
return identity?.role === undefined ? resolveEffectiveDsmmRole(agent, settings, active)
|
|
22
|
+
: identity.role !== undefined && settings.roles[identity.role] ? identity.role : undefined;
|
|
23
|
+
}
|
|
24
|
+
const readTools = new Set(["read", "glob", "grep", "read_image", "web_search", "web_fetch", "skill", "load_skill", "structured_output", "send_message", "interrupt_agent", "exit_plan_mode", "ask_user_question", "todo_write", "job_output", "job_list", "job_kill"]);
|
|
25
|
+
const readLsp = new Set(["status", "diagnostics", "goto_definition", "find_references", "find_symbol_related", "symbols", "prepare_rename"]);
|
|
26
|
+
export function allowedRoleChildren(role, child = false) {
|
|
27
|
+
const definition = DSMM_ROLES.find((row) => row.id === role);
|
|
28
|
+
return child && role === "dsmm-builder" ? definition.childBuilderAllowedChildren ?? [] : definition.allowedChildren;
|
|
29
|
+
}
|
|
30
|
+
export function roleToolName(role) { return role.replace(/-/gu, "_"); }
|
|
31
|
+
export function roleFromToolName(name) {
|
|
32
|
+
return name === "explore" ? "dsmm-code-search" : DSMM_ROLES.find((row) => roleToolName(row.id) === name)?.id;
|
|
33
|
+
}
|
|
34
|
+
export function readonlyRoleTool(name, settings) {
|
|
35
|
+
return readTools.has(name) || name === `mcp__${settings.lsp.serverName}__${name.split("__").at(-1)}`
|
|
36
|
+
&& readLsp.has(name.split("__").at(-1));
|
|
37
|
+
}
|
|
38
|
+
/** Identity admission only: native services retain every run, inbox and retry lifecycle. */
|
|
39
|
+
export class DsmmRolePolicy {
|
|
40
|
+
ctx;
|
|
41
|
+
getSettings;
|
|
42
|
+
mode;
|
|
43
|
+
calls = new AsyncLocalStorage();
|
|
44
|
+
providers = new WeakSet();
|
|
45
|
+
constructor(ctx, getSettings, mode) {
|
|
46
|
+
this.ctx = ctx;
|
|
47
|
+
this.getSettings = getSettings;
|
|
48
|
+
this.mode = mode;
|
|
49
|
+
}
|
|
50
|
+
captureProvider(provider) { this.providers.add(provider); }
|
|
51
|
+
agents() {
|
|
52
|
+
const registry = this.ctx.get?.("agents");
|
|
53
|
+
if (registry === undefined)
|
|
54
|
+
throw new SubagentError("DSMM delegation requires native live Agent ownership", "UNAUTHORIZED");
|
|
55
|
+
return registry;
|
|
56
|
+
}
|
|
57
|
+
assertLive(agent) {
|
|
58
|
+
if (agent.id === undefined || this.agents().get(agent.id) !== agent)
|
|
59
|
+
throw new SubagentError("DSMM delegation requires the exact live Agent", "UNAUTHORIZED");
|
|
60
|
+
}
|
|
61
|
+
/** Core fence runs before native prompt/body assembly or provider execution. */
|
|
62
|
+
assertModuleAdmission(agent) {
|
|
63
|
+
this.assertLive(agent);
|
|
64
|
+
const settings = this.getSettings(agent);
|
|
65
|
+
const selected = agent.ctx?.get?.("agentPresets")?.composedPreset(agent.ctx)
|
|
66
|
+
?? resolveSelectedAgentPreset(agent.session);
|
|
67
|
+
const descriptor = foldSubagentDescriptor(childOwnedSessionEvents(agent.session));
|
|
68
|
+
const provider = descriptor === undefined ? undefined : this.ctx.get?.("subagents")?.getProvider(descriptor.provider);
|
|
69
|
+
const providerRole = descriptor?.provider.startsWith("dsmm-role-") && (provider === undefined || this.providers.has(provider))
|
|
70
|
+
? `dsmm-${descriptor.provider.slice("dsmm-role-".length)}` : undefined;
|
|
71
|
+
if (agent.session.header?.origin !== "subagent" && selected?.startsWith("dsmm-")
|
|
72
|
+
&& !isDsmmRoleId(selected))
|
|
73
|
+
throw new SubagentError("DSMM unknown standing root is not admitted", "UNAUTHORIZED");
|
|
74
|
+
const role = providerRole ?? (isDsmmRoleId(selected) ? selected : undefined);
|
|
75
|
+
if (role !== undefined && (!settings.modules.deepwork.enabled || !isDsmmRoleId(role))) {
|
|
76
|
+
throw new SubagentError("Deepwork module or role is not admitted in this Agent; standing presets and child resume cannot enable it", "UNAUTHORIZED");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
identity(agent) {
|
|
80
|
+
this.assertLive(agent);
|
|
81
|
+
const existing = liveIdentities.get(agent)?.identity;
|
|
82
|
+
if (existing?.child)
|
|
83
|
+
return existing;
|
|
84
|
+
const parent = this.agents().list().find((row) => row !== agent && this.agents().isOwnedBy(agent.id, row));
|
|
85
|
+
if (parent !== undefined) {
|
|
86
|
+
if (existing === undefined)
|
|
87
|
+
throw new SubagentError("DSMM child role identity was not admitted", "UNAUTHORIZED");
|
|
88
|
+
return existing;
|
|
89
|
+
}
|
|
90
|
+
const settings = this.getSettings(agent);
|
|
91
|
+
const selected = agent.ctx?.get?.("agentPresets")?.composedPreset(agent.ctx);
|
|
92
|
+
const role = isDsmmRoleId(selected) ? selected : settings.modules.deepwork.enabled && agent.session.header?.origin !== "subagent" && settings.roles["dsmm-orchestrator"] && this.mode.active(agent, settings.defaultActive) ? "dsmm-orchestrator" : undefined;
|
|
93
|
+
return Object.freeze({ role, child: agent.session.header?.origin === "subagent", epoch: this.getSettings.admission?.(agent).epoch ?? "trusted-direct" });
|
|
94
|
+
}
|
|
95
|
+
targets(agent) {
|
|
96
|
+
const identity = this.identity(agent);
|
|
97
|
+
const settings = this.getSettings(agent);
|
|
98
|
+
if (!settings.modules.deepwork.enabled || identity.role === undefined || !settings.roles[identity.role])
|
|
99
|
+
return [];
|
|
100
|
+
return allowedRoleChildren(identity.role, identity.child).filter((role) => settings.roles[role]
|
|
101
|
+
&& (identity.toolFilter?.allow === undefined || identity.toolFilter.allow.includes(roleToolName(role)))
|
|
102
|
+
&& !identity.toolFilter?.deny?.includes(roleToolName(role)));
|
|
103
|
+
}
|
|
104
|
+
assertDelegation(parent, role) {
|
|
105
|
+
const identity = this.identity(parent);
|
|
106
|
+
if (!this.targets(parent).includes(role))
|
|
107
|
+
throw new SubagentError(`DSMM ${identity.role ?? "unadmitted Agent"} cannot delegate ${role}`, "UNAUTHORIZED");
|
|
108
|
+
return { parent, role, epoch: identity.epoch };
|
|
109
|
+
}
|
|
110
|
+
duringDelegation(parent, role, operation, toolFilter) {
|
|
111
|
+
return this.calls.run({ ...this.assertDelegation(parent, role), toolFilter }, operation);
|
|
112
|
+
}
|
|
113
|
+
prepareContinuable(parent, role, signal) {
|
|
114
|
+
signal.throwIfAborted();
|
|
115
|
+
this.assertDelegation(parent, role);
|
|
116
|
+
}
|
|
117
|
+
admit(agent) {
|
|
118
|
+
this.assertLive(agent);
|
|
119
|
+
const agents = this.agents();
|
|
120
|
+
const parent = agents.list().find((row) => row !== agent && agents.isOwnedBy(agent.id, row));
|
|
121
|
+
const existing = liveIdentities.get(agent);
|
|
122
|
+
if (existing !== undefined) {
|
|
123
|
+
// A retained child owns its original capture, not its parent's newer
|
|
124
|
+
// mode/profile or a reinstall's replacement settings getter.
|
|
125
|
+
if (parent === undefined || existing.identity.parent !== parent || existing.readEpoch() !== existing.identity.epoch) {
|
|
126
|
+
throw new SubagentError("DSMM retained child admission no longer matches its exact owner or captured epoch", "UNAUTHORIZED");
|
|
127
|
+
}
|
|
128
|
+
this.assertLive(parent);
|
|
129
|
+
return existing.identity;
|
|
130
|
+
}
|
|
131
|
+
if (parent === undefined)
|
|
132
|
+
return this.identity(agent);
|
|
133
|
+
const parentIdentity = this.identity(parent);
|
|
134
|
+
if (parentIdentity.role === undefined) {
|
|
135
|
+
if (this.getSettings.admission?.(agent).epoch !== this.getSettings.admission?.(parent).epoch)
|
|
136
|
+
throw new SubagentError("DSMM child must inherit its exact parent's admission", "UNAUTHORIZED");
|
|
137
|
+
const identity = Object.freeze({ child: true, parent, epoch: parentIdentity.epoch,
|
|
138
|
+
...(parentIdentity.readOnly === undefined ? {} : { readOnly: parentIdentity.readOnly }),
|
|
139
|
+
...(parentIdentity.toolFilter === undefined ? {} : { toolFilter: parentIdentity.toolFilter }) });
|
|
140
|
+
return this.captureIdentity(agent, identity);
|
|
141
|
+
}
|
|
142
|
+
const invocation = this.calls.getStore();
|
|
143
|
+
if (invocation === undefined || invocation.parent !== parent) {
|
|
144
|
+
// A native cold resume already has a descriptor, but only the actual live
|
|
145
|
+
// owner and its captured policy can authorize the new residency.
|
|
146
|
+
const own = agent.session.snapshotEvents().slice(agent.session.inheritedEventCount ?? 0);
|
|
147
|
+
const descriptor = foldSubagentDescriptor(own);
|
|
148
|
+
const candidate = descriptor?.mode === "continuable" ? `dsmm-${descriptor.provider.slice("dsmm-role-".length)}` : undefined;
|
|
149
|
+
if (!descriptor?.provider.startsWith("dsmm-role-") || !isDsmmRoleId(candidate))
|
|
150
|
+
throw new SubagentError("DSMM children require an admitted role provider; generic spawn cannot bypass delegation policy", "UNAUTHORIZED");
|
|
151
|
+
return this.bindChild(agent, parent, candidate, descriptor.mode === "continuable" ? descriptor.toolFilter : undefined);
|
|
152
|
+
}
|
|
153
|
+
if (this.getSettings.admission?.(parent).epoch !== undefined && this.getSettings.admission(parent).epoch !== invocation.epoch)
|
|
154
|
+
throw new SubagentError("DSMM parent admission changed during delegation", "UNAUTHORIZED");
|
|
155
|
+
return this.bindChild(agent, parent, invocation.role, invocation.toolFilter);
|
|
156
|
+
}
|
|
157
|
+
bindChild(agent, parent, role, toolFilter) {
|
|
158
|
+
const admitted = this.assertDelegation(parent, role);
|
|
159
|
+
if (this.getSettings.admission?.(agent).epoch !== this.getSettings.admission?.(parent).epoch)
|
|
160
|
+
throw new SubagentError("DSMM child must inherit its exact parent's admission", "UNAUTHORIZED");
|
|
161
|
+
const parentIdentity = this.identity(parent);
|
|
162
|
+
const inheritedFilter = inheritToolFilter(parentIdentity.toolFilter, toolFilter);
|
|
163
|
+
const identity = Object.freeze({ role, child: true, parent, epoch: admitted.epoch,
|
|
164
|
+
readOnly: parentIdentity.readOnly === true || DSMM_ROLES.find((row) => row.id === parentIdentity.role)?.access === "read-only"
|
|
165
|
+
|| DSMM_ROLES.find((row) => row.id === role)?.access === "read-only",
|
|
166
|
+
...(inheritedFilter === undefined ? {} : { toolFilter: inheritedFilter }) });
|
|
167
|
+
return this.captureIdentity(agent, identity);
|
|
168
|
+
}
|
|
169
|
+
captureIdentity(agent, identity) {
|
|
170
|
+
liveIdentities.set(agent, { identity, readEpoch: () => this.getSettings.admission?.(agent).epoch ?? "trusted-direct" });
|
|
171
|
+
return identity;
|
|
172
|
+
}
|
|
173
|
+
captureTools(agent, tools, controlledNames = [], reset = false) {
|
|
174
|
+
const realm = Reflect.get(tools, symbols.original) ?? tools;
|
|
175
|
+
const previous = toolIdentities.get(agent);
|
|
176
|
+
const definitions = previous === undefined || reset || previous.realm !== realm ? new Map() : previous.definitions;
|
|
177
|
+
for (const schema of tools.schemas(agent)) {
|
|
178
|
+
if (previous === undefined || reset || previous.realm !== realm || controlledNames.includes(schema.name))
|
|
179
|
+
definitions.set(schema.name, tools.get(schema.name, agent));
|
|
180
|
+
}
|
|
181
|
+
toolIdentities.set(agent, { realm, definitions });
|
|
182
|
+
}
|
|
183
|
+
toolDenial(agent, name, tools) {
|
|
184
|
+
const identity = this.identity(agent);
|
|
185
|
+
const settings = this.getSettings(agent);
|
|
186
|
+
// With no DW role/module in this admission, same-named host tools are host-owned.
|
|
187
|
+
const target = !settings.modules.deepwork.enabled && identity.role === undefined ? undefined : roleFromToolName(name);
|
|
188
|
+
const readonly = identity.readOnly || DSMM_ROLES.find((row) => row.id === identity.role)?.access === "read-only";
|
|
189
|
+
if (tools !== undefined && (readonly || target !== undefined)) {
|
|
190
|
+
const admitted = toolIdentities.get(agent);
|
|
191
|
+
if (admitted === undefined || admitted.realm !== (Reflect.get(tools, symbols.original) ?? tools)
|
|
192
|
+
|| admitted.definitions.get(name) !== tools.get(name, agent))
|
|
193
|
+
return "DSMM tool definition was not admitted in this exact Agent realm";
|
|
194
|
+
}
|
|
195
|
+
if (target !== undefined)
|
|
196
|
+
return this.targets(agent).includes(target) ? undefined : `DSMM delegation to ${target} is not permitted`;
|
|
197
|
+
if (identity.toolFilter?.allow !== undefined && !identity.toolFilter.allow.includes(name) && name !== "structured_output"
|
|
198
|
+
|| identity.toolFilter?.deny?.includes(name))
|
|
199
|
+
return "DSMM child native toolFilter does not permit this tool";
|
|
200
|
+
if (readonly && !readonlyRoleTool(name, settings))
|
|
201
|
+
return "DSMM read-only role does not permit this tool";
|
|
202
|
+
if (identity.role === undefined)
|
|
203
|
+
return identity.child && settings.modules.deepwork.enabled && ["subagent", "spawn", "fork"].includes(name) ? "DSMM unadmitted children cannot delegate" : undefined;
|
|
204
|
+
if (!settings.modules.deepwork.enabled || !settings.roles[identity.role])
|
|
205
|
+
return "DSMM role is disabled in this Agent admission";
|
|
206
|
+
if (["subagent", "spawn", "fork"].includes(name))
|
|
207
|
+
return "Use the admitted DSMM role tools; generic delegation is not a role-policy bypass";
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
installDrain(agent) {
|
|
211
|
+
const native = agent.ctx;
|
|
212
|
+
if (native === undefined)
|
|
213
|
+
throw new Error("DSMM native role lifecycle requires an Agent context");
|
|
214
|
+
native.effect(() => async () => {
|
|
215
|
+
const agents = this.agents();
|
|
216
|
+
if (agents.get(agent.id) !== agent)
|
|
217
|
+
throw new Error("DSMM Agent was detached before continuable descendants drained");
|
|
218
|
+
await native.get("subagents")?.drainContinuableDescendants([agent]);
|
|
219
|
+
liveIdentities.delete(agent);
|
|
220
|
+
toolIdentities.delete(agent);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=role-policy.js.map
|
package/lib/role-providers.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { SubagentProvider } from "@deepseek-ai/dsh-subagent";
|
|
2
|
+
import type { Agent, AgentOptions } from "@deepseek-ai/dsh-agent";
|
|
2
3
|
import type { DshContext } from "./dsh-types.js";
|
|
3
4
|
import type { DsmmRoleId } from "./roles.js";
|
|
4
|
-
import type { DsmmSettingsGetter } from "./settings.js";
|
|
5
|
+
import type { DsmmSettings, DsmmSettingsGetter } from "./settings.js";
|
|
6
|
+
import type { DsmmRolePolicy } from "./role-policy.js";
|
|
5
7
|
export interface DsmmSubagentRegistry {
|
|
6
8
|
getProvider(name: string): SubagentProvider | undefined;
|
|
7
9
|
registerProvider(provider: SubagentProvider): () => void;
|
|
10
|
+
resolveMaxDepth?(configured?: number): number | undefined;
|
|
8
11
|
}
|
|
9
12
|
export declare function roleProviderName(role: DsmmRoleId): string;
|
|
10
13
|
export declare function roleFromProviderName(provider: string): DsmmRoleId | undefined;
|
|
14
|
+
export declare function roleAgentOptions(parent: Agent, role: DsmmRoleId, settings: DsmmSettings, signal: AbortSignal, explicit?: AgentOptions): Promise<AgentOptions | undefined>;
|
|
11
15
|
/** Only the native outer start owns descriptors, capability admission and returned runs. */
|
|
12
|
-
export declare function registerRoleProviders(ctx: DshContext, getSettings: DsmmSettingsGetter, getDeploymentSettings?: DsmmSettingsGetter): void;
|
|
16
|
+
export declare function registerRoleProviders(ctx: DshContext, getSettings: DsmmSettingsGetter, getDeploymentSettings?: DsmmSettingsGetter, policy?: DsmmRolePolicy): void;
|
|
13
17
|
//# sourceMappingURL=role-providers.d.ts.map
|
package/lib/role-providers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parentAgentOptionsForDelegation } from "@deepseek-ai/dsh-subagent";
|
|
1
|
+
import { parentAgentOptionsForDelegation, SubagentError } from "@deepseek-ai/dsh-subagent";
|
|
2
2
|
import { ReasoningEffortId } from "@deepseek-ai/dsh-llm";
|
|
3
3
|
import { DSMM_ROLE_IDS } from "./roles.js";
|
|
4
4
|
import { resolveRoleRuntimePolicy } from "./routing-policy.js";
|
|
@@ -9,14 +9,37 @@ export function roleProviderName(role) {
|
|
|
9
9
|
export function roleFromProviderName(provider) {
|
|
10
10
|
return DSMM_ROLE_IDS.find((role) => role !== "dsmm-orchestrator" && roleProviderName(role) === provider);
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const NO_CAPABILITIES = Object.freeze({ agentOptions: false, outputSchema: false, depthLimit: false, toolFilter: false, persona: false });
|
|
13
13
|
function supportedSpawn(provider) {
|
|
14
14
|
return provider !== undefined && provider.name === "spawn" && typeof provider.start === "function"
|
|
15
|
-
&& provider.inheritsParentContext === false && provider.agentRouteDefaults === undefined
|
|
16
|
-
|
|
15
|
+
&& provider.inheritsParentContext === false && provider.agentRouteDefaults === undefined;
|
|
16
|
+
}
|
|
17
|
+
export async function roleAgentOptions(parent, role, settings, signal, explicit) {
|
|
18
|
+
const primary = settings.roleRouting[role]?.primary;
|
|
19
|
+
const options = primary === undefined ? explicit : { ...primary,
|
|
20
|
+
reasoningEffort: primary.reasoningEffort === undefined ? undefined : ReasoningEffortId(primary.reasoningEffort), ...explicit };
|
|
21
|
+
if (primary !== undefined && explicit?.reasoningEffort === undefined
|
|
22
|
+
&& (explicit?.provider !== undefined && explicit.provider !== primary.provider || explicit?.model !== undefined && explicit.model !== primary.model))
|
|
23
|
+
options.reasoningEffort = undefined;
|
|
24
|
+
const inherited = parentAgentOptionsForDelegation(parent);
|
|
25
|
+
const provider = options?.provider ?? inherited.provider, model = options?.model ?? inherited.model;
|
|
26
|
+
if (provider === undefined || model === undefined)
|
|
27
|
+
throw new Error("dsmm role delegation requires an effective provider and model");
|
|
28
|
+
const changed = provider !== inherited.provider || model !== inherited.model;
|
|
29
|
+
const effort = options?.reasoningEffort ?? (primary === undefined && !changed ? inherited.reasoningEffort : undefined);
|
|
30
|
+
const llm = parent.ctx.get("llm");
|
|
31
|
+
if (llm?.resolveCallConfig === undefined)
|
|
32
|
+
throw new Error("dsmm role delegation requires the parent Agent native LLM service");
|
|
33
|
+
const candidates = [{ provider, model, ...(effort === undefined ? {} : { reasoningEffort: effort }) },
|
|
34
|
+
...explicit?.provider !== undefined || explicit?.model !== undefined ? [] : resolveRoleRuntimePolicy(settings, role).fallbackRoutes.map((route) => ({ ...route,
|
|
35
|
+
...(explicit?.reasoningEffort === undefined ? {} : { reasoningEffort: explicit.reasoningEffort }) }))];
|
|
36
|
+
const selected = await selectInitialModelRoute(llm, candidates, signal);
|
|
37
|
+
signal.throwIfAborted();
|
|
38
|
+
return primary === undefined && selected.provider === provider && selected.model === model ? explicit : { ...options, ...selected,
|
|
39
|
+
reasoningEffort: selected.reasoningEffort === undefined ? undefined : ReasoningEffortId(selected.reasoningEffort) };
|
|
17
40
|
}
|
|
18
41
|
/** Only the native outer start owns descriptors, capability admission and returned runs. */
|
|
19
|
-
export function registerRoleProviders(ctx, getSettings, getDeploymentSettings = getSettings) {
|
|
42
|
+
export function registerRoleProviders(ctx, getSettings, getDeploymentSettings = getSettings, policy) {
|
|
20
43
|
const installed = new WeakSet();
|
|
21
44
|
const install = (readyCtx) => {
|
|
22
45
|
const registry = readyCtx.get?.("subagents")
|
|
@@ -27,60 +50,70 @@ export function registerRoleProviders(ctx, getSettings, getDeploymentSettings =
|
|
|
27
50
|
installed.add(registry);
|
|
28
51
|
try {
|
|
29
52
|
const settings = getDeploymentSettings();
|
|
53
|
+
if (!settings.modules.deepwork.enabled)
|
|
54
|
+
return;
|
|
30
55
|
for (const role of DSMM_ROLE_IDS) {
|
|
31
56
|
if (role === "dsmm-orchestrator" || !settings.roles[role])
|
|
32
57
|
continue;
|
|
33
58
|
let active = true;
|
|
34
59
|
const dispose = registry.registerProvider({
|
|
35
|
-
name: roleProviderName(role),
|
|
60
|
+
name: roleProviderName(role),
|
|
61
|
+
get capabilities() { const spawn = registry.getProvider("spawn"); return supportedSpawn(spawn) ? spawn.capabilities : NO_CAPABILITIES; },
|
|
62
|
+
inheritsParentContext: false,
|
|
63
|
+
get prepareContinuable() {
|
|
64
|
+
const spawn = registry.getProvider("spawn");
|
|
65
|
+
if (!supportedSpawn(spawn) || spawn.prepareContinuable === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
return async (request) => {
|
|
68
|
+
if (!active || registry.getProvider("spawn") !== spawn)
|
|
69
|
+
throw new SubagentError("DSMM native continuable provider changed", "NO_PROVIDER");
|
|
70
|
+
const admitted = getSettings(request.parent);
|
|
71
|
+
if (!admitted.modules.deepwork.enabled || !admitted.roles[role])
|
|
72
|
+
throw new SubagentError("DSMM module or role is disabled", "UNAUTHORIZED");
|
|
73
|
+
if (!admitted.subagents.enableRunInBackground || admitted.subagents.backgroundMode !== "continuable")
|
|
74
|
+
throw new SubagentError("DSMM continuable delegation requires explicit admitted opt-in", "UNAUTHORIZED");
|
|
75
|
+
policy?.prepareContinuable(request.parent, role, request.signal);
|
|
76
|
+
return spawn.prepareContinuable(request);
|
|
77
|
+
};
|
|
78
|
+
},
|
|
36
79
|
async start(request) {
|
|
37
80
|
if (!active)
|
|
38
81
|
throw new Error("dsmm role provider is disposed");
|
|
39
82
|
const spawn = registry.getProvider("spawn");
|
|
40
83
|
if (!supportedSpawn(spawn))
|
|
41
84
|
throw new Error("dsmm role provider requires the supported native spawn capabilities");
|
|
85
|
+
if (request.descriptor.mode !== "one-shot" || request.descriptor.provider !== roleProviderName(role))
|
|
86
|
+
throw new SubagentError("DSMM alias requires its exact native descriptor", "UNAUTHORIZED");
|
|
87
|
+
const admission = policy?.assertDelegation(request.parent, role);
|
|
88
|
+
for (const [key, value] of Object.entries({ agentOptions: request.agentOptions, outputSchema: request.outputSchema, depthLimit: request.maxDepth, toolFilter: request.toolFilter, persona: request.persona })) {
|
|
89
|
+
if (value !== undefined && !spawn.capabilities[key])
|
|
90
|
+
throw new SubagentError(`DSMM spawn does not support ${key}`, "UNSUPPORTED_CAPABILITY");
|
|
91
|
+
}
|
|
42
92
|
const parentSettings = getSettings(request.parent);
|
|
43
|
-
if (!parentSettings.roles[role])
|
|
93
|
+
if (!parentSettings.modules.deepwork.enabled || !parentSettings.roles[role])
|
|
44
94
|
throw new Error("dsmm role provider is disabled by deployment configuration");
|
|
45
|
-
const
|
|
46
|
-
const agentOptions = primary === undefined ? request.agentOptions : {
|
|
47
|
-
...primary,
|
|
48
|
-
reasoningEffort: primary.reasoningEffort === undefined ? undefined : ReasoningEffortId(primary.reasoningEffort),
|
|
49
|
-
...request.agentOptions
|
|
50
|
-
};
|
|
51
|
-
if (primary !== undefined && request.agentOptions?.reasoningEffort === undefined
|
|
52
|
-
&& ((request.agentOptions?.provider !== undefined && request.agentOptions.provider !== primary.provider)
|
|
53
|
-
|| (request.agentOptions?.model !== undefined && request.agentOptions.model !== primary.model))) {
|
|
54
|
-
agentOptions.reasoningEffort = undefined;
|
|
55
|
-
}
|
|
56
|
-
const parentOptions = parentAgentOptionsForDelegation(request.parent);
|
|
57
|
-
const provider = agentOptions?.provider ?? parentOptions.provider;
|
|
58
|
-
const model = agentOptions?.model ?? parentOptions.model;
|
|
59
|
-
if (provider === undefined || model === undefined)
|
|
60
|
-
throw new Error("dsmm role delegation requires an effective provider and model");
|
|
61
|
-
const routeChanged = provider !== parentOptions.provider || model !== parentOptions.model;
|
|
62
|
-
const reasoningEffort = agentOptions?.reasoningEffort
|
|
63
|
-
?? (primary === undefined && !routeChanged ? parentOptions.reasoningEffort : undefined);
|
|
64
|
-
const llm = request.parent.ctx.get("llm");
|
|
65
|
-
if (llm?.resolveCallConfig === undefined)
|
|
66
|
-
throw new Error("dsmm role delegation requires the parent Agent native LLM service");
|
|
67
|
-
const explicitRoute = request.agentOptions?.provider !== undefined || request.agentOptions?.model !== undefined;
|
|
68
|
-
const candidates = [{ provider, model, ...(reasoningEffort === undefined ? {} : { reasoningEffort }) },
|
|
69
|
-
...explicitRoute ? [] : resolveRoleRuntimePolicy(parentSettings, role).fallbackRoutes.map((route) => ({ ...route,
|
|
70
|
-
...(request.agentOptions?.reasoningEffort === undefined ? {} : { reasoningEffort: request.agentOptions.reasoningEffort }) }))];
|
|
71
|
-
const selected = await selectInitialModelRoute(llm, candidates, request.signal);
|
|
95
|
+
const agentOptions = await roleAgentOptions(request.parent, role, parentSettings, request.signal, request.agentOptions);
|
|
72
96
|
request.signal.throwIfAborted();
|
|
73
97
|
if (!active || registry.getProvider("spawn") !== spawn)
|
|
74
98
|
throw new Error("dsmm role spawn provider changed during route validation; retry delegation");
|
|
99
|
+
if (admission !== undefined && policy.assertDelegation(request.parent, role).epoch !== admission.epoch)
|
|
100
|
+
throw new SubagentError("DSMM parent admission changed during route preflight", "UNAUTHORIZED");
|
|
75
101
|
// Preserve the native descriptor, authority filters and lifecycle;
|
|
76
102
|
// this alias owns only profile-derived route defaults and preflight.
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
const routed = agentOptions === request.agentOptions ? request : { ...request, agentOptions };
|
|
104
|
+
const maxDepth = request.maxDepth ?? registry.resolveMaxDepth?.(parentSettings.subagents.maxDepth);
|
|
105
|
+
if (maxDepth !== undefined && !spawn.capabilities.depthLimit)
|
|
106
|
+
throw new SubagentError("DSMM spawn cannot enforce the native depth limit", "UNSUPPORTED_CAPABILITY");
|
|
107
|
+
const resolved = maxDepth === undefined ? routed : { ...routed, maxDepth };
|
|
108
|
+
if (resolved.agentOptions !== undefined && !spawn.capabilities.agentOptions)
|
|
109
|
+
throw new SubagentError("DSMM spawn cannot accept the configured or selected child route", "UNSUPPORTED_CAPABILITY");
|
|
110
|
+
return policy === undefined ? spawn.start(resolved)
|
|
111
|
+
: policy.duringDelegation(request.parent, role, () => spawn.start(resolved), request.toolFilter);
|
|
82
112
|
}
|
|
83
113
|
});
|
|
114
|
+
const provider = registry.getProvider(roleProviderName(role));
|
|
115
|
+
if (provider !== undefined)
|
|
116
|
+
policy?.captureProvider(provider);
|
|
84
117
|
disposers.push(() => { active = false; dispose(); });
|
|
85
118
|
}
|
|
86
119
|
readyCtx.effect?.(() => () => {
|
package/lib/role-subagents.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
1
2
|
import type { DshContext } from "./dsh-types.js";
|
|
3
|
+
import { DsmmRolePolicy } from "./role-policy.js";
|
|
2
4
|
import type { DsmmSettingsGetter } from "./settings.js";
|
|
3
5
|
import type { DeepworkModeController } from "./state.js";
|
|
4
|
-
/**
|
|
5
|
-
export declare function
|
|
6
|
+
/** Keep native controls on the frozen startup substrate, not desired-save reconciliation. */
|
|
7
|
+
export declare function registerNativeSubagentControls(ctx: Context): Promise<void>;
|
|
8
|
+
/** Published name retained; all native/headless Agents consume one admitted policy. */
|
|
9
|
+
export declare function registerHeadlessRoleTools(ctx: DshContext, controller: DeepworkModeController, getSettings: DsmmSettingsGetter, policy?: DsmmRolePolicy): Promise<void>;
|
|
6
10
|
//# sourceMappingURL=role-subagents.d.ts.map
|