@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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { parseRoleAvailability } from "../profile-remote.js";
|
|
3
|
+
export function roleAvailability(value) {
|
|
4
|
+
if (value === undefined)
|
|
5
|
+
return undefined;
|
|
6
|
+
try {
|
|
7
|
+
return parseRoleAvailability(value);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function RoleAvailability({ value, t }) {
|
|
14
|
+
const state = roleAvailability(value);
|
|
15
|
+
if (state === undefined)
|
|
16
|
+
return _jsx("p", { className: "dsmm-hint", children: t("availabilityUnknown") });
|
|
17
|
+
return _jsxs("div", { className: "dsmm-availability", "data-dsmm-role-availability": state.id, children: [_jsx("p", { children: t(state.required ? "roleRequired" : "roleOptional", { reason: state.requiredReason ?? "—" }) }), _jsx("p", { children: t("roleCeiling", { startup: t(state.startupAvailable ? "enabled" : "disabled"), deployment: t(state.deploymentEnabled ? "enabled" : "disabled"), admitted: t(state.admitted ? "enabled" : "disabled") }) }), _jsx("p", { className: "dsmm-hint", children: t("roleProvenance", { source: state.source, capture: state.capture }) }), state.reason !== undefined && _jsx("p", { children: t("roleUnavailableReason", { reason: state.reason }) })] });
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=RoleAvailability.js.map
|
|
@@ -2,15 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useEffect, useId, useState } from "react";
|
|
3
3
|
import { Button, IconBranchOutlineRegular, Menu } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
4
|
import { sessionProfileLabels } from "./session-labels.js";
|
|
5
|
+
import { IssueDetails, ProfileWarnings, profileWarnings } from "./diagnostics.js";
|
|
6
|
+
import { RoleAvailability } from "./RoleAvailability.js";
|
|
7
|
+
import { parseSubagentRuntimeAdmissionView } from "../profile-remote.js";
|
|
8
|
+
import { isSafeDiagnosticField } from "../profile-diagnostics.js";
|
|
5
9
|
const MENU_ISSUE_CODES = new Set(["validation", "conflict", "not-found", "lock-timeout", "unsafe-path", "io", "activation", "corrupt-selection", "limit", "busy", "maintenance", "disposed", "not-owned", "unavailable", "cancelled", "model-unconfigured", "model-choice-changed", "model-service-unavailable", "model-observation-unavailable", "model-selection-failed"]);
|
|
6
|
-
const MENU_ROLE_FIELD = /^(?:settings\.roleRouting\.)?dsmm-(?:orchestrator|planner|plan-critic|builder|reviewer|oracle|oracle-2nd|creative|code-search|doc-search|clarifier|media-reader)(?:\.(?:primary|fallbackRoutes)(?:\[[0-7]\])?(?:\.(?:provider|model|reasoningEffort))?|\.strategy|\.rateLimit(?:\.(?:maxRetries|initialDelayMs|maxDelayMs|maxTotalDelayMs|switchAfterRateLimits|maxSwitches))?)?$/u;
|
|
7
|
-
const MENU_COMMON_FIELD = /^(?:version|id|label|content|sessionId|expectedRevision|expectedSelectionRevision|expectedAdmissionEpoch|settings(?:\.(?:defaultActive|roleRouting|workflow|guards|runtimeRecovery|runtimePolicy))?)$/u;
|
|
8
10
|
function menuIssue(issue) {
|
|
9
11
|
const code = MENU_ISSUE_CODES.has(issue.code) ? issue.code : issue.kind === "transport" ? "transport" : "unavailable";
|
|
10
12
|
const field = issue.field;
|
|
11
13
|
// Only closed configuration grammar is displayable; never echo messages,
|
|
12
14
|
// arbitrary wire fields, provider identifiers, credentials or file paths.
|
|
13
|
-
return { code, ...(
|
|
15
|
+
return { code, ...(isSafeDiagnosticField(field) ? { field } : {}) };
|
|
14
16
|
}
|
|
15
17
|
export function SessionScope({ state, actions, t, compact = false }) {
|
|
16
18
|
const prefix = useId();
|
|
@@ -18,12 +20,26 @@ export function SessionScope({ state, actions, t, compact = false }) {
|
|
|
18
20
|
const labels = session === null ? null : sessionProfileLabels(session, t);
|
|
19
21
|
const selected = state.snapshot?.profiles.find((profile) => profile.id === state.sessionChoice);
|
|
20
22
|
const disabled = state.busy !== null || state.pendingEditor !== null || state.sessionBusy !== null || state.dirty;
|
|
23
|
+
const current = () => actions.readProfileView().currentSessionId === state.currentSessionId;
|
|
21
24
|
const allowed = session !== null && session.switchAllowed && /^[a-f0-9]{64}$|^absent$/u.test(session.selection.selectionRevision);
|
|
22
25
|
const status = state.sessionNotice === null ? "" : t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "sessionAppliedWithModel" : state.sessionNotice === "applied" ? "sessionApplied" : "sessionResetDone");
|
|
23
|
-
|
|
26
|
+
let binding = session?.subagentRuntime;
|
|
27
|
+
try {
|
|
28
|
+
if (binding !== undefined)
|
|
29
|
+
binding = parseSubagentRuntimeAdmissionView(binding);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
binding = undefined;
|
|
33
|
+
}
|
|
34
|
+
return _jsxs("div", { className: "dsmm-session-scope", "aria-busy": state.sessionBusy !== null, "data-dsmm-session-scope": true, children: [!compact && _jsx("h3", { children: t("sessionScope") }), state.currentSessionId === null ? _jsx("p", { className: "dsmm-hint", children: t("noSession") }) : _jsxs(_Fragment, { children: [labels !== null && _jsx("p", { "data-dsmm-session-state": true, children: labels.admitted }), labels !== null && !compact && _jsx("p", { className: "dsmm-hint", "data-dsmm-session-future-default": true, children: labels.futureDefault }), session === null && _jsx("p", { className: "dsmm-hint", children: t("sessionUnavailable") }), session?.warnings?.length ? _jsxs("div", { children: [_jsx("p", { children: t("admissionWarnings") }), _jsx(ProfileWarnings, { warnings: session.warnings, t: t })] }) : null, session !== null && !session.switchAllowed && _jsx("p", { className: "dsmm-hint", children: t("sessionBusy", { reason: session.switchUnavailableReason ?? "unavailable" }) }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-choice`, children: t("sessionSelect") }), _jsxs("select", { id: `${prefix}-choice`, value: state.sessionChoice ?? "", disabled: disabled || !allowed, onChange: (event) => { if (current())
|
|
35
|
+
actions.chooseSessionProfile(event.currentTarget.value || null); }, children: [_jsx("option", { value: "", children: t("sessionBaseline") }), state.sessionChoice !== null && selected === undefined && _jsx("option", { value: state.sessionChoice, children: state.sessionChoice }), state.snapshot?.profiles.map((profile) => _jsxs("option", { value: profile.id, disabled: profile.revision === null || profile.error !== undefined, children: [profile.label?.trim() ? `${profile.label} (${profile.id})` : profile.id, profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""] }, profile.id))] })] }), !compact && _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-hint", children: t("sessionModelHint") }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed || session?.profileModel === undefined, onClick: () => { if (current())
|
|
36
|
+
void actions.useSessionProfileModel(); }, children: t("headerUseCurrentModel") }), session !== null && _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: binding === undefined ? t("bindingUnknown") : t("bindingState", { binding: binding.binding, ready: t(binding.deliveryFenceReady ? "enabled" : "disabled"), restart: t(binding.restartRequired ? "enabled" : "disabled") }) }), binding?.reason !== undefined && _jsx("p", { children: t("bindingReason", { reason: binding.reason }) })] }), session?.roles !== undefined && _jsxs("details", { children: [_jsx("summary", { children: t("admittedRoles") }), session.roles.map(role => _jsxs("div", { className: "dsmm-availability", children: [_jsx("p", { children: role.id }), _jsx(RoleAvailability, { value: role, t: t })] }, role.id))] })] }), state.dirty && _jsx("p", { className: "dsmm-hint", children: t("sessionDirty") }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed || (state.sessionChoice !== null && selected?.revision == null), onClick: () => { if (current())
|
|
37
|
+
void actions.applySession(); }, children: t(state.sessionBusy === "apply" ? "sessionApplying" : "sessionApply") }), !compact && _jsx(Button, { type: "button", variant: "outline", disabled: disabled || !allowed, onClick: () => { if (current())
|
|
38
|
+
void actions.resetSession(); }, children: t(state.sessionBusy === "reset" ? "sessionResetting" : "sessionReset") }), _jsx(Button, { type: "button", variant: "outline", disabled: state.sessionBusy !== null || state.busy !== null || state.pendingEditor !== null, onClick: () => { if (current())
|
|
39
|
+
void actions.refreshSession(); }, children: t("sessionRefresh") })] }), !compact && session?.rolePolicy !== undefined && _jsx("p", { "data-dsmm-session-policy": true, children: t("roleState", { route: session.rolePolicy.route === undefined ? t("inheritRoute") : `${session.rolePolicy.route.provider}/${session.rolePolicy.route.model}${session.rolePolicy.route.reasoningEffort === undefined ? "" : ` (${session.rolePolicy.route.reasoningEffort})`}`, strategy: session.rolePolicy.strategy, retries: session.rolePolicy.retries, failures: session.rolePolicy.rateLimitFailures, switches: session.rolePolicy.switches, delay: session.rolePolicy.totalDelayMs }) })] }), state.sessionIssue !== null && _jsx("p", { role: "alert", children: state.sessionIssue.source === "profile-model" ? t(state.sessionIssue.code === "model-unconfigured" ? "headerNoProfileModel" : state.sessionIssue.code === "model-choice-changed" ? "headerModelChoiceChanged" : "headerModelUnconfirmed")
|
|
24
40
|
: state.sessionIssue.code === "conflict" ? t("sessionConflict")
|
|
25
41
|
: ["busy", "maintenance", "disposed", "not-owned"].includes(state.sessionIssue.code) ? t("sessionBusy", { reason: state.sessionIssue.code })
|
|
26
|
-
: t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.sessionBusy === "read" ? t("reading") : status })] });
|
|
42
|
+
: t(state.sessionIssue.code === "validation" ? "validation" : "sessionUnavailable") }), state.sessionIssue !== null && _jsx(IssueDetails, { issue: state.sessionIssue, t: t }), _jsx("p", { className: "dsmm-status", role: "status", "aria-live": "polite", "aria-atomic": "true", children: state.sessionBusy === "read" ? t("reading") : status })] });
|
|
27
43
|
}
|
|
28
44
|
/** Root-scoped native menu; an explicitly scoped foreign occurrence still refuses. */
|
|
29
45
|
export function SessionProfiles(props) {
|
|
@@ -36,7 +52,7 @@ export function SessionProfiles(props) {
|
|
|
36
52
|
return null;
|
|
37
53
|
const { t } = props;
|
|
38
54
|
const session = state.session;
|
|
39
|
-
const admission = session?.admittedSelection
|
|
55
|
+
const admission = session?.admittedSelection;
|
|
40
56
|
const unknownCaptured = session !== null && admission === undefined;
|
|
41
57
|
const current = session === null ? "__dsmm_session_unavailable__" : unknownCaptured ? "__dsmm_captured_default__" : admission?.selectedId ?? "";
|
|
42
58
|
const profiles = state.snapshot?.profiles ?? [];
|
|
@@ -62,11 +78,13 @@ export function SessionProfiles(props) {
|
|
|
62
78
|
feedback = t("headerBusy");
|
|
63
79
|
else if (state.sessionNotice !== null)
|
|
64
80
|
feedback = t(state.sessionNotice === "mode-on" ? "headerModeOn" : state.sessionNotice === "mode-off" ? "headerModeOff" : state.sessionNotice === "applied-with-model" ? "headerAppliedWithModel" : "headerApplied");
|
|
65
|
-
const profileName = unknownCaptured ? t("headerCaptured") : currentSaved?.
|
|
81
|
+
const profileName = unknownCaptured ? t("headerCaptured") : currentSaved?.revision === admission?.appliedRevision && currentSaved?.label?.trim() ? `${currentSaved.label} (${currentSaved.id})` : admission?.selectedId ?? t("sessionBaseline");
|
|
66
82
|
const currentLabel = t("headerCurrentProfile", { profile: session === null ? t("headerUnavailable") : profileName });
|
|
67
83
|
const entries = [{ type: "label", id: "@current", text: currentLabel }];
|
|
84
|
+
for (const warning of profileWarnings(session?.warnings))
|
|
85
|
+
entries.push({ type: "label", id: `@warning:${warning.code}`, text: t("warningMarker", { code: warning.code, field: warning.field }) });
|
|
68
86
|
if (id === null && state.snapshot !== null)
|
|
69
|
-
entries.push({ type: "label", id: "@future", text: t("sessionFutureDefault", { profile: state.snapshot.profiles.find((profile) => profile.id === state.snapshot.selectedId)?.label
|
|
87
|
+
entries.push({ type: "label", id: "@future", text: t("sessionFutureDefault", { profile: state.snapshot.profiles.find((profile) => profile.id === state.snapshot.selectedId)?.label?.trim() || state.snapshot.selectedId || t("sessionBaseline") }) });
|
|
70
88
|
if (feedback !== "" && (state.sessionNotice === null || state.sessionIssue !== null))
|
|
71
89
|
entries.push({ type: "label", id: "@status", text: feedback });
|
|
72
90
|
const mode = session?.deepwork;
|
|
@@ -83,7 +101,7 @@ export function SessionProfiles(props) {
|
|
|
83
101
|
entries.push({ id: "__dsmm_captured_default__", label: t("headerCaptured"), disabled: true });
|
|
84
102
|
entries.push({ type: "separator", id: "@keep-separator" }, { type: "label", id: "@keep-heading", text: t("headerCompactProfiles") }, { id: "", label: t("sessionBaseline"), disabled });
|
|
85
103
|
for (const profile of profiles)
|
|
86
|
-
entries.push({ id: profile.id, label: (profile.label
|
|
104
|
+
entries.push({ id: profile.id, label: (profile.label?.trim() ? profile.label : profile.id) + (profile.error === undefined && profile.revision !== null ? "" : ` — ${t("headerSavedUnavailable")}`) + (profileWarnings(profile.warnings).length ? ` — ${t("warningProfile")}` : ""), disabled: disabled || profile.revision === null || profile.error !== undefined });
|
|
87
105
|
entries.push({ type: "separator", id: "@model-separator" }, { id: "@use-model", label: t("headerUseCurrentModel"), disabled: disabled || session?.profileModel === undefined });
|
|
88
106
|
const open = openFor === id;
|
|
89
107
|
return _jsxs("div", { className: "dsmm-header-profiles", "data-dsmm-header-profile": true, "aria-busy": committing, children: [_jsx(Menu, { open: open, autoFocus: true, portal: true, align: "start", className: "dsmm-profile-anchor", listClassName: "dsmm-profile-menu", items: entries, selectedId: current, footer: [{ id: "@refresh", label: t("headerCompactRefresh"), disabled: committing || state.busy !== null }], anchor: _jsx(Button, { type: "button", size: "sm", variant: "toolbar", className: "dsmm-profile-trigger", icon: _jsx(IconBranchOutlineRegular, {}), "aria-label": t("headerProfileLabel"), "aria-haspopup": "menu", "aria-expanded": open, "aria-describedby": `${prefix}-feedback`, onClick: () => setOpenFor(open ? undefined : id) }), onClose: () => setOpenFor(undefined), onSelect: (value) => {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useState } from "react";
|
|
3
3
|
import { Button, Input } from "@deepseek-ai/dsh-client-ui-primitives";
|
|
4
|
+
import { DSMM_LOCALES } from "../profile-locale.js";
|
|
4
5
|
import { DSMM_RATE_LIMIT_BOUNDS, normalizeRateLimitPolicy } from "../routing-policy.js";
|
|
5
6
|
import { structuredDocument } from "./structured.js";
|
|
6
7
|
import { RETRY_FIELD_LABEL_KEYS } from "./locales.js";
|
|
7
|
-
|
|
8
|
+
import { RoleAvailability, roleAvailability } from "./RoleAvailability.js";
|
|
9
|
+
import { EditableChoice } from "./EditableChoice.js";
|
|
8
10
|
function RetryNumber({ id, name, field, value, inherited, path, disabled, actions, t }) {
|
|
9
11
|
const [draft, setDraft] = useState(value === undefined ? "" : String(value));
|
|
10
12
|
const [invalid, setInvalid] = useState(false);
|
|
@@ -28,19 +30,22 @@ function RouteFields({ value, path, name, catalog, disabled, edit, editRoute, t
|
|
|
28
30
|
const group = providers.find((candidate) => candidate.id === value.provider);
|
|
29
31
|
const model = group?.models.find((candidate) => candidate.id === value.model);
|
|
30
32
|
const efforts = model?.reasoning?.efforts ?? [];
|
|
31
|
-
const providerListed = group !== undefined;
|
|
32
|
-
const modelListed = model !== undefined;
|
|
33
33
|
const updateModel = (provider, modelId) => {
|
|
34
34
|
// This is an explicit user change, not a catalog refresh. Clear only this
|
|
35
35
|
// route's adapter-owned effort; do not save or touch the native model default.
|
|
36
36
|
editRoute(path, provider, modelId);
|
|
37
37
|
};
|
|
38
|
-
return _jsxs("div", { className: "dsmm-route-fields", children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-provider`, children: t("routeProvider", { name }) }),
|
|
38
|
+
return _jsxs("div", { className: "dsmm-route-fields", children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-provider`, children: t("routeProvider", { name }) }), _jsx(EditableChoice, { id: `${prefix}-provider`, label: t("routeProvider", { name }), value: value.provider, options: providers, disabled: disabled, onChange: provider => updateModel(provider, value.model), onSelect: provider => updateModel(provider, "") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-model`, children: t("routeModel", { name }) }), _jsx(EditableChoice, { id: `${prefix}-model`, label: t("routeModel", { name }), value: value.model, options: group?.models ?? [], disabled: disabled, onChange: modelId => updateModel(value.provider, modelId) })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-effort`, children: t("routeEffort", { name }) }), _jsx(EditableChoice, { id: `${prefix}-effort`, label: t("routeEffort", { name }), value: value.reasoningEffort ?? "", options: efforts, disabled: disabled, placeholder: t("effortDefault"), onChange: effort => edit([...path, "reasoningEffort"], effort || undefined) })] })] });
|
|
39
39
|
}
|
|
40
40
|
function PolicyFields({ value, inherited, path, name, disabled, actions, t }) {
|
|
41
41
|
const prefix = useId();
|
|
42
42
|
return _jsxs("div", { className: "dsmm-policy-fields", children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-strategy`, children: t("strategy", { name }) }), _jsxs("select", { id: `${prefix}-strategy`, disabled: disabled, value: value.strategy ?? "", onChange: (event) => actions.editPath([...path, "strategy"], event.currentTarget.value || undefined), children: [_jsx("option", { value: "", children: t("inheritStrategy", { value: inherited?.strategy ?? t("unknownDefault") }) }), _jsx("option", { value: "startup-lock", children: t("startupLock") }), _jsx("option", { value: "rate-limit-fallback", children: t("rateFallback") })] })] }), _jsx("p", { className: "dsmm-hint", children: t("strategyHint") }), _jsx("div", { className: "dsmm-route-fields", children: Object.keys(DSMM_RATE_LIMIT_BOUNDS).map((field) => _jsx(RetryNumber, { id: `${prefix}-${field}`, t: t, name: name, field: field, value: value.rateLimit?.[field], inherited: inherited?.rateLimit[field], path: [...path, "rateLimit", field], disabled: disabled, actions: actions }, field)) })] });
|
|
43
43
|
}
|
|
44
|
+
function LevelFields({ level, value, path, catalog, disabled, actions, t }) {
|
|
45
|
+
const prefix = useId();
|
|
46
|
+
const mode = value === undefined ? "inherit" : value.provider === undefined ? "effort" : "route";
|
|
47
|
+
return _jsxs("fieldset", { "data-dsmm-level": level, children: [_jsx("legend", { children: t("levelName", { level }) }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-mode`, children: t("levelMode", { level }) }), _jsxs("select", { id: `${prefix}-mode`, value: mode, disabled: disabled, onChange: event => actions.editPath(path, event.currentTarget.value === "inherit" ? undefined : event.currentTarget.value === "effort" ? { reasoningEffort: "" } : { provider: "", model: "" }), children: [_jsx("option", { value: "inherit", children: t("levelUnconfigured") }), _jsx("option", { value: "effort", children: t("levelEffortOnly") }), _jsx("option", { value: "route", children: t("levelFullRoute") })] })] }), mode === "effort" && _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-effort`, children: t("routeEffort", { name: level }) }), _jsx(EditableChoice, { id: `${prefix}-effort`, label: t("routeEffort", { name: level }), value: value?.reasoningEffort ?? "", options: [], disabled: disabled, onChange: effort => actions.editPath([...path, "reasoningEffort"], effort) })] }), value?.provider !== undefined && _jsx(RouteFields, { value: value, path: path, name: t("levelName", { level }), catalog: catalog, disabled: disabled, edit: actions.editPath, editRoute: actions.editRoute, t: t })] });
|
|
48
|
+
}
|
|
44
49
|
/** The same raw draft drives every control; there is no form-to-document rewrite. */
|
|
45
50
|
export function StructuredEditor({ state, actions, disabled, t }) {
|
|
46
51
|
const prefix = useId();
|
|
@@ -61,7 +66,10 @@ export function StructuredEditor({ state, actions, disabled, t }) {
|
|
|
61
66
|
}
|
|
62
67
|
catch { /* Invalid effective values remain a raw/Host validation error. */ }
|
|
63
68
|
const rolePath = ["settings", "roleRouting", role?.id ?? ""];
|
|
64
|
-
|
|
69
|
+
const availability = roleAvailability(role?.availability);
|
|
70
|
+
const namedRoles = document.settings.roles;
|
|
71
|
+
const topology = document.settings.subagents?.toolTopology;
|
|
72
|
+
return _jsxs("div", { className: "dsmm-structured", "data-dsmm-structured": true, children: [_jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-label`, children: t("profileLabel") }), _jsx(Input, { id: `${prefix}-label`, className: "dsmm-input", value: document.label ?? "", disabled: disabled, onChange: (event) => actions.editPath(["label"], event.currentTarget.value) }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || document.label === undefined, onClick: () => actions.editPath(["label"], undefined), children: t("omitLabel") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-locale`, children: t("businessLocale") }), _jsxs("select", { id: `${prefix}-locale`, value: String(document.settings.locale ?? ""), disabled: disabled, "aria-describedby": `${prefix}-locale-hint`, onChange: event => actions.editPath(["settings", "locale"], event.currentTarget.value || undefined), children: [_jsx("option", { value: "", children: t("inheritLocale") }), typeof document.settings.locale === "string" && !DSMM_LOCALES.includes(document.settings.locale) && _jsx("option", { value: document.settings.locale, children: t("unsupportedLocale") }), DSMM_LOCALES.map(locale => _jsx("option", { value: locale, children: locale }, locale))] }), _jsx("p", { id: `${prefix}-locale-hint`, className: "dsmm-hint", children: t("localeHint") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-topology`, children: t("toolTopology") }), _jsxs("select", { id: `${prefix}-topology`, value: topology ?? "", disabled: disabled, "aria-describedby": `${prefix}-topology-hint`, onChange: event => actions.editPath(["settings", "subagents", "toolTopology"], event.currentTarget.value || undefined), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "per-role", children: "per-role" }), _jsx("option", { value: "parameterized", children: "parameterized" })] }), _jsx("p", { id: `${prefix}-topology-hint`, className: "dsmm-hint", children: t("topologyHint") })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-active`, children: t("defaultActive") }), _jsxs("select", { id: `${prefix}-active`, disabled: disabled, value: document.settings.defaultActive === undefined ? "" : String(document.settings.defaultActive), onChange: (event) => actions.editPath(["settings", "defaultActive"], event.currentTarget.value === "" ? undefined : event.currentTarget.value === "true"), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "true", children: t("enabled") }), _jsx("option", { value: "false", children: t("disabled") })] }), _jsx("p", { className: "dsmm-hint", children: t("activeHint") })] }), _jsxs("fieldset", { children: [_jsx("legend", { children: t("profileDefaults") }), _jsx(PolicyFields, { t: t, value: document.runtimePolicy, inherited: baseline, path: ["settings", "runtimePolicy"], name: t("profileDefaults"), disabled: disabled, actions: actions })] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-role`, children: t("roleSelect") }), _jsxs("select", { id: `${prefix}-role`, disabled: disabled || roles.length === 0 || state.invalidFields.length > 0, value: role?.id ?? "", onChange: (event) => setSelectedRole(event.currentTarget.value), children: [roles.length === 0 && _jsx("option", { value: "", children: t("rolesUnavailable") }), roles.map((candidate) => _jsxs("option", { value: candidate.id, children: [candidate.label, candidate.enabled ? "" : ` — ${t("roleDisabled")}`] }, candidate.id))] })] }), role !== undefined && policy !== undefined && _jsxs("fieldset", { "data-dsmm-role": role.id, children: [_jsx("legend", { children: role.label }), _jsx(RoleAvailability, { value: role.availability, t: t }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-role-enabled`, children: t("namedRole", { name: role.label }) }), _jsxs("select", { id: `${prefix}-role-enabled`, value: namedRoles?.[role.id] === undefined ? "" : String(namedRoles[role.id]), disabled: disabled, "aria-describedby": `${prefix}-role-hint`, onChange: event => actions.editPath(["settings", "roles", role.id], event.currentTarget.value === "" ? undefined : event.currentTarget.value === "true"), children: [_jsx("option", { value: "", children: t("inherit") }), _jsx("option", { value: "true", disabled: availability === undefined || !availability.startupAvailable || !availability.deploymentEnabled || availability.reason === "module-off", children: t("enabled") }), _jsx("option", { value: "false", disabled: availability === undefined || availability.required, children: t("disabled") })] }), _jsx("p", { id: `${prefix}-role-hint`, className: "dsmm-hint", children: t("namedRoleHint") })] }), _jsx(PolicyFields, { t: t, value: policy, inherited: inherited, path: rolePath, name: role.label, disabled: disabled, actions: actions }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-primary-mode`, children: t("primaryMode", { name: role.label }) }), _jsxs("select", { id: `${prefix}-primary-mode`, disabled: disabled, value: policy.primary === undefined ? "inherit" : "explicit", onChange: (event) => actions.editPath([...rolePath, "primary"], event.currentTarget.value === "inherit" ? undefined : { provider: "", model: "" }), children: [_jsx("option", { value: "inherit", children: t("inheritRoute") }), _jsx("option", { value: "explicit", children: t("configuredRoute") })] })] }), policy.primary !== undefined && _jsx(RouteFields, { t: t, value: policy.primary, path: [...rolePath, "primary"], name: t("primaryName", { name: role.label }), catalog: state.catalog, disabled: disabled, edit: actions.editPath, editRoute: actions.editRoute }), _jsx("p", { className: "dsmm-hint", children: t("effortChangeHint") }), _jsx("p", { className: "dsmm-hint", children: t("normalLevel") }), role.id === "dsmm-orchestrator" ? _jsx("p", { className: "dsmm-hint", children: t("orchestratorLevels") }) : _jsxs(_Fragment, { children: [_jsx("p", { className: "dsmm-hint", children: t("levelsHint") }), ["low", "high", "max"].map(level => _jsx(LevelFields, { level: level, value: policy.levels?.[level], path: [...rolePath, "levels", level], catalog: state.catalog, disabled: disabled, actions: actions, t: t }, level))] }), _jsxs("div", { className: "dsmm-field", children: [_jsx("label", { htmlFor: `${prefix}-fallback-mode`, children: t("fallbackMode", { name: role.label }) }), _jsxs("select", { id: `${prefix}-fallback-mode`, disabled: disabled, value: policy.fallbackRoutes === undefined ? "inherit" : "explicit", onChange: (event) => actions.editPath([...rolePath, "fallbackRoutes"], event.currentTarget.value === "inherit" ? undefined : []), children: [_jsx("option", { value: "inherit", children: t("inheritChain") }), _jsx("option", { value: "explicit", children: t("configuredChain") })] })] }), policy.fallbackRoutes?.length === 0 && _jsx("p", { className: "dsmm-hint", children: t("emptyChain") }), policy.fallbackRoutes?.map((candidate, index) => {
|
|
65
73
|
const name = t("fallbackName", { name: role.label, index: index + 1 });
|
|
66
74
|
return _jsxs("fieldset", { children: [_jsx("legend", { children: name }), _jsx(RouteFields, { t: t, value: candidate, path: [...rolePath, "fallbackRoutes", index], name: name, catalog: state.catalog, disabled: disabled, edit: actions.editPath, editRoute: actions.editRoute }), _jsxs("div", { className: "dsmm-actions", children: [_jsx(Button, { type: "button", variant: "outline", disabled: disabled || index === 0, onClick: () => actions.moveFallback(role.id, index, index - 1), children: t("moveUp", { name }) }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || index === policy.fallbackRoutes.length - 1, onClick: () => actions.moveFallback(role.id, index, index + 1), children: t("moveDown", { name }) }), _jsx(Button, { type: "button", variant: "outline", disabled: disabled, onClick: () => actions.editPath([...rolePath, "fallbackRoutes", index], undefined), children: t("removeFallback", { name }) })] })] }, index);
|
|
67
75
|
}), _jsx(Button, { type: "button", variant: "outline", disabled: disabled || (policy.fallbackRoutes?.length ?? 0) >= 32, onClick: () => {
|
|
@@ -69,6 +77,6 @@ export function StructuredEditor({ state, actions, disabled, t }) {
|
|
|
69
77
|
actions.editPath([...rolePath, "fallbackRoutes"], [{ provider: "", model: "" }]);
|
|
70
78
|
else
|
|
71
79
|
actions.editPath([...rolePath, "fallbackRoutes", policy.fallbackRoutes.length], { provider: "", model: "" });
|
|
72
|
-
}, children: t("addFallback", { name: role.label }) })] })] });
|
|
80
|
+
}, children: t("addFallback", { name: role.label }) })] }, role.id)] });
|
|
73
81
|
}
|
|
74
82
|
//# sourceMappingURL=StructuredEditor.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { DsmmChildrenRemote } from "../role-control-remote.js";
|
|
2
|
+
import type { BackgroundTransitionResult, ChildSessionSnapshot, RoleControlAvailability, RoleControlDescendantsSnapshot, RoleControlErrorInfo, SubagentInterruptReceipt, SubagentPromptReceipt, SubagentPromptRequest } from "../role-control-types.js";
|
|
3
|
+
export interface ChildrenIssue extends Partial<RoleControlErrorInfo> {
|
|
4
|
+
kind: "domain" | "transport" | "protocol" | "local";
|
|
5
|
+
code: RoleControlErrorInfo["code"];
|
|
6
|
+
unknown?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export type ChildImage = Extract<SubagentPromptRequest["content"][number], {
|
|
9
|
+
type: "image";
|
|
10
|
+
}>;
|
|
11
|
+
export interface ChildDraft {
|
|
12
|
+
text: string;
|
|
13
|
+
delivery: "queue" | "steer";
|
|
14
|
+
images: readonly ChildImage[];
|
|
15
|
+
imageBusy: boolean;
|
|
16
|
+
uncertain: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type ChildOutcome = {
|
|
19
|
+
kind: "background";
|
|
20
|
+
receipt: BackgroundTransitionResult;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "prompt";
|
|
23
|
+
receipt: SubagentPromptReceipt;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "interrupt";
|
|
26
|
+
receipt: SubagentInterruptReceipt;
|
|
27
|
+
};
|
|
28
|
+
export interface ChildrenSnapshot {
|
|
29
|
+
sessionId: string | null;
|
|
30
|
+
generation: number;
|
|
31
|
+
snapshot: ChildSessionSnapshot | null;
|
|
32
|
+
descendants: RoleControlDescendantsSnapshot | null;
|
|
33
|
+
fresh: boolean;
|
|
34
|
+
reading: boolean;
|
|
35
|
+
issue: ChildrenIssue | null;
|
|
36
|
+
descendantIssue: ChildrenIssue | null;
|
|
37
|
+
drafts: ReadonlyMap<string, ChildDraft>;
|
|
38
|
+
pending: ReadonlyMap<string, "background" | "prompt" | "interrupt">;
|
|
39
|
+
issues: ReadonlyMap<string, ChildrenIssue>;
|
|
40
|
+
outcomes: ReadonlyMap<string, ChildOutcome>;
|
|
41
|
+
}
|
|
42
|
+
export interface ChildrenActions {
|
|
43
|
+
refresh(generation: number): Promise<void>;
|
|
44
|
+
background(generation: number, toolCallId: string, runId: string): Promise<void>;
|
|
45
|
+
prompt(generation: number, childId: string): Promise<void>;
|
|
46
|
+
interrupt(generation: number, childId: string): Promise<void>;
|
|
47
|
+
editText(generation: number, childId: string, text: string): void;
|
|
48
|
+
setDelivery(generation: number, childId: string, delivery: "queue" | "steer"): void;
|
|
49
|
+
addImages(generation: number, childId: string, files: readonly File[]): Promise<void>;
|
|
50
|
+
removeImage(generation: number, childId: string, image: ChildImage): void;
|
|
51
|
+
acknowledgeUnknown(generation: number, childId: string): void;
|
|
52
|
+
}
|
|
53
|
+
export declare const EMPTY_CHILD_DRAFT: ChildDraft;
|
|
54
|
+
export declare const childActionKey: (childId: string) => string;
|
|
55
|
+
export declare const runActionKey: (toolCallId: string, runId: string) => string;
|
|
56
|
+
export declare function enabled(availability: RoleControlAvailability | undefined): boolean;
|
|
57
|
+
/** Client presentation/draft state only. Host owns all run, inbox and admission authority. */
|
|
58
|
+
export declare class ChildrenController {
|
|
59
|
+
private readonly remote;
|
|
60
|
+
private current;
|
|
61
|
+
private owner;
|
|
62
|
+
private connection;
|
|
63
|
+
private connectionGeneration;
|
|
64
|
+
private observedAdmission;
|
|
65
|
+
private disposed;
|
|
66
|
+
private listeners;
|
|
67
|
+
readonly store: {
|
|
68
|
+
getSnapshot: () => ChildrenSnapshot;
|
|
69
|
+
subscribe: (listener: () => void) => (() => void);
|
|
70
|
+
};
|
|
71
|
+
readonly actions: ChildrenActions;
|
|
72
|
+
constructor(remote: DsmmChildrenRemote);
|
|
73
|
+
dispose(): void;
|
|
74
|
+
bindConnection(connection: object | null, generation?: unknown): void;
|
|
75
|
+
bindScope(sessionId: string | null, owner: object | null): void;
|
|
76
|
+
observeAdmission(sessionId: string, epoch: string): void;
|
|
77
|
+
private publish;
|
|
78
|
+
private fence;
|
|
79
|
+
private live;
|
|
80
|
+
private available;
|
|
81
|
+
private draft;
|
|
82
|
+
private child;
|
|
83
|
+
private editDraft;
|
|
84
|
+
private publishDraft;
|
|
85
|
+
private issue;
|
|
86
|
+
private unwrap;
|
|
87
|
+
refresh(generation: number): Promise<void>;
|
|
88
|
+
private begin;
|
|
89
|
+
private finish;
|
|
90
|
+
private refuse;
|
|
91
|
+
private accepted;
|
|
92
|
+
background(generation: number, toolCallId: string, runId: string): Promise<void>;
|
|
93
|
+
private canControl;
|
|
94
|
+
prompt(generation: number, id: string): Promise<void>;
|
|
95
|
+
interrupt(generation: number, id: string): Promise<void>;
|
|
96
|
+
addImages(generation: number, id: string, files: readonly File[]): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=children-controller.d.ts.map
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { ROLE_CONTROL_REMOTE, parseChildSessionSnapshot, parseRoleControlDescendants, parseRoleControlErrorInfo, parseRoleControlPromptRequest } from "../role-control-remote.js";
|
|
2
|
+
export const EMPTY_CHILD_DRAFT = { text: "", delivery: "queue", images: [], imageBusy: false, uncertain: false };
|
|
3
|
+
export const childActionKey = (childId) => `child:${childId}`;
|
|
4
|
+
export const runActionKey = (toolCallId, runId) => `run:${JSON.stringify([toolCallId, runId])}`;
|
|
5
|
+
export function enabled(availability) { return availability?.enabled === true; }
|
|
6
|
+
class ControlFailure extends Error {
|
|
7
|
+
safe;
|
|
8
|
+
constructor(safe) {
|
|
9
|
+
super("Child control refused.");
|
|
10
|
+
this.safe = safe;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Client presentation/draft state only. Host owns all run, inbox and admission authority. */
|
|
14
|
+
export class ChildrenController {
|
|
15
|
+
remote;
|
|
16
|
+
current = { sessionId: null, generation: 0, snapshot: null, descendants: null, fresh: false, reading: false,
|
|
17
|
+
issue: null, descendantIssue: null, drafts: new Map(), pending: new Map(), issues: new Map(), outcomes: new Map() };
|
|
18
|
+
owner = null;
|
|
19
|
+
connection = null;
|
|
20
|
+
connectionGeneration;
|
|
21
|
+
observedAdmission = null;
|
|
22
|
+
disposed = false;
|
|
23
|
+
listeners = new Set();
|
|
24
|
+
store = {
|
|
25
|
+
getSnapshot: () => this.current,
|
|
26
|
+
subscribe: (listener) => { this.listeners.add(listener); return () => { this.listeners.delete(listener); }; },
|
|
27
|
+
};
|
|
28
|
+
actions = {
|
|
29
|
+
refresh: generation => this.refresh(generation), background: (generation, call, run) => this.background(generation, call, run),
|
|
30
|
+
prompt: (generation, child) => this.prompt(generation, child), interrupt: (generation, child) => this.interrupt(generation, child),
|
|
31
|
+
editText: (generation, child, text) => this.editDraft(generation, child, { text }),
|
|
32
|
+
setDelivery: (generation, child, delivery) => this.editDraft(generation, child, { delivery }),
|
|
33
|
+
addImages: (generation, child, files) => this.addImages(generation, child, files),
|
|
34
|
+
removeImage: (generation, child, image) => { const draft = this.draft(child); if (!draft.imageBusy)
|
|
35
|
+
this.editDraft(generation, child, { images: draft.images.filter(part => part !== image) }); },
|
|
36
|
+
acknowledgeUnknown: (generation, child) => { if (this.available(generation))
|
|
37
|
+
this.editDraft(generation, child, { uncertain: false }); },
|
|
38
|
+
};
|
|
39
|
+
constructor(remote) {
|
|
40
|
+
this.remote = remote;
|
|
41
|
+
}
|
|
42
|
+
dispose() { if (this.disposed)
|
|
43
|
+
return; this.owner = null; this.connection = null; this.fence(false); this.disposed = true; this.listeners.clear(); }
|
|
44
|
+
bindConnection(connection, generation) {
|
|
45
|
+
if (this.disposed || connection === this.connection && generation === this.connectionGeneration)
|
|
46
|
+
return;
|
|
47
|
+
this.connection = connection;
|
|
48
|
+
this.connectionGeneration = generation;
|
|
49
|
+
this.fence(true);
|
|
50
|
+
if (connection !== null)
|
|
51
|
+
void this.refresh(this.current.generation);
|
|
52
|
+
}
|
|
53
|
+
bindScope(sessionId, owner) {
|
|
54
|
+
if (this.disposed || sessionId === this.current.sessionId && owner === this.owner)
|
|
55
|
+
return;
|
|
56
|
+
this.owner = owner;
|
|
57
|
+
this.observedAdmission = null;
|
|
58
|
+
this.fence(false, sessionId);
|
|
59
|
+
if (sessionId !== null && owner !== null)
|
|
60
|
+
void this.refresh(this.current.generation);
|
|
61
|
+
}
|
|
62
|
+
observeAdmission(sessionId, epoch) {
|
|
63
|
+
if (this.disposed || sessionId !== this.current.sessionId || epoch === this.observedAdmission)
|
|
64
|
+
return;
|
|
65
|
+
this.observedAdmission = epoch;
|
|
66
|
+
if (this.current.snapshot?.admissionEpoch === epoch)
|
|
67
|
+
return;
|
|
68
|
+
this.fence(true);
|
|
69
|
+
void this.refresh(this.current.generation);
|
|
70
|
+
}
|
|
71
|
+
publish(patch) {
|
|
72
|
+
if (this.disposed)
|
|
73
|
+
return;
|
|
74
|
+
this.current = { ...this.current, ...patch };
|
|
75
|
+
for (const listener of this.listeners)
|
|
76
|
+
listener();
|
|
77
|
+
}
|
|
78
|
+
fence(preserveDrafts, sessionId = this.current.sessionId) {
|
|
79
|
+
const drafts = new Map();
|
|
80
|
+
if (preserveDrafts)
|
|
81
|
+
for (const [id, draft] of this.current.drafts)
|
|
82
|
+
drafts.set(id, { ...draft, imageBusy: false,
|
|
83
|
+
uncertain: draft.uncertain || this.current.pending.get(childActionKey(id)) === "prompt" });
|
|
84
|
+
this.publish({ sessionId, generation: this.current.generation + 1, snapshot: preserveDrafts ? this.current.snapshot : null,
|
|
85
|
+
fresh: false, descendants: null, reading: false, drafts, pending: new Map(), issues: new Map(), outcomes: new Map(), issue: null, descendantIssue: null });
|
|
86
|
+
}
|
|
87
|
+
live(generation) { return !this.disposed && generation === this.current.generation && this.owner !== null && this.connection !== null && this.current.sessionId !== null; }
|
|
88
|
+
available(generation) { return this.live(generation) && this.current.fresh && !this.current.reading; }
|
|
89
|
+
draft(id) { return this.current.drafts.get(id) ?? EMPTY_CHILD_DRAFT; }
|
|
90
|
+
child(id) { return this.current.snapshot?.children.find(child => child.id === id && child.parentSessionId === this.current.sessionId); }
|
|
91
|
+
editDraft(generation, id, patch) {
|
|
92
|
+
if (this.disposed || generation !== this.current.generation || this.child(id)?.mode !== "continuable" || this.current.pending.has(childActionKey(id)))
|
|
93
|
+
return;
|
|
94
|
+
this.publishDraft(id, patch);
|
|
95
|
+
}
|
|
96
|
+
publishDraft(id, patch) {
|
|
97
|
+
const drafts = new Map(this.current.drafts);
|
|
98
|
+
drafts.set(id, { ...this.draft(id), ...patch });
|
|
99
|
+
this.publish({ drafts });
|
|
100
|
+
}
|
|
101
|
+
issue(error) {
|
|
102
|
+
if (error instanceof ControlFailure)
|
|
103
|
+
return error.safe;
|
|
104
|
+
return { kind: "transport", code: "unavailable", unknown: true };
|
|
105
|
+
}
|
|
106
|
+
async unwrap(method, call) {
|
|
107
|
+
const result = await call();
|
|
108
|
+
if (!result.ok) {
|
|
109
|
+
if (result.error.code === "dsmm-children/refused") {
|
|
110
|
+
let info;
|
|
111
|
+
try {
|
|
112
|
+
info = parseRoleControlErrorInfo(result.error.details);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
throw new ControlFailure({ kind: "protocol", code: "unavailable", unknown: true });
|
|
116
|
+
}
|
|
117
|
+
throw new ControlFailure({ kind: "domain", ...info });
|
|
118
|
+
}
|
|
119
|
+
throw new ControlFailure({ kind: "transport", code: "unavailable", unknown: true });
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
const codec = ROLE_CONTROL_REMOTE.descriptors.find(row => row.method === method).result;
|
|
123
|
+
if (codec.mode !== "strict")
|
|
124
|
+
throw new TypeError("Child result requires a strict codec.");
|
|
125
|
+
return codec.create().parse(result.value);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
throw new ControlFailure({ kind: "protocol", code: "unavailable", unknown: true });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
async refresh(generation) {
|
|
132
|
+
if (!this.live(generation) || this.current.reading || this.current.pending.size > 0 || [...this.current.drafts.values()].some(draft => draft.imageBusy))
|
|
133
|
+
return;
|
|
134
|
+
const id = this.current.sessionId;
|
|
135
|
+
this.publish({ reading: true, issue: null, descendantIssue: null, fresh: false });
|
|
136
|
+
const [description, descendants] = await Promise.allSettled([this.unwrap("describe", () => this.remote.describe(id)), this.unwrap("descendants", () => this.remote.descendants(id))]);
|
|
137
|
+
if (!this.live(generation))
|
|
138
|
+
return;
|
|
139
|
+
if (description.status === "rejected") {
|
|
140
|
+
this.publish({ reading: false, issue: this.issue(description.reason), descendants: null });
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const snapshot = parseChildSessionSnapshot(description.value);
|
|
144
|
+
if (snapshot.sessionId !== id) {
|
|
145
|
+
this.publish({ reading: false, issue: { kind: "protocol", code: "not-owned" }, descendants: null });
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (this.observedAdmission !== null && snapshot.admissionEpoch !== this.observedAdmission) {
|
|
149
|
+
this.publish({ reading: false, issue: { kind: "protocol", code: "conflict" }, descendants: null });
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
let tree = null, descendantIssue = null;
|
|
153
|
+
if (descendants.status === "rejected")
|
|
154
|
+
descendantIssue = this.issue(descendants.reason);
|
|
155
|
+
else {
|
|
156
|
+
tree = parseRoleControlDescendants(descendants.value);
|
|
157
|
+
if (tree.sessionId !== id || tree.admissionEpoch !== snapshot.admissionEpoch) {
|
|
158
|
+
tree = null;
|
|
159
|
+
descendantIssue = { kind: "protocol", code: "conflict" };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this.publish({ snapshot, descendants: tree, descendantIssue, fresh: true, reading: false, generation: generation + 1 });
|
|
163
|
+
}
|
|
164
|
+
begin(key, kind) {
|
|
165
|
+
const pending = new Map(this.current.pending), issues = new Map(this.current.issues), outcomes = new Map(this.current.outcomes);
|
|
166
|
+
pending.set(key, kind);
|
|
167
|
+
issues.delete(key);
|
|
168
|
+
outcomes.delete(key);
|
|
169
|
+
this.publish({ pending, issues, outcomes });
|
|
170
|
+
}
|
|
171
|
+
finish(key) { const pending = new Map(this.current.pending); pending.delete(key); this.publish({ pending }); }
|
|
172
|
+
refuse(key, error) { const issues = new Map(this.current.issues); issues.set(key, this.issue(error)); this.publish({ issues }); }
|
|
173
|
+
accepted(key, outcome) { const outcomes = new Map(this.current.outcomes); outcomes.set(key, outcome); this.publish({ outcomes }); }
|
|
174
|
+
async background(generation, toolCallId, runId) {
|
|
175
|
+
const key = runActionKey(toolCallId, runId), snapshot = this.current.snapshot;
|
|
176
|
+
const run = snapshot?.runs.find(row => row.toolCallId === toolCallId && row.invocation?.runId === runId);
|
|
177
|
+
if (!this.available(generation) || this.current.pending.has(key) || this.current.outcomes.get(key)?.kind === "background"
|
|
178
|
+
|| run?.state !== "running" || !enabled(run.background) || !enabled(snapshot?.capabilities.background))
|
|
179
|
+
return;
|
|
180
|
+
this.begin(key, "background");
|
|
181
|
+
try {
|
|
182
|
+
const receipt = await this.unwrap("background", () => this.remote.background(snapshot.sessionId, { sessionId: snapshot.sessionId, toolCallId, runId, expectedAdmissionEpoch: snapshot.admissionEpoch }));
|
|
183
|
+
if (!this.live(generation))
|
|
184
|
+
return;
|
|
185
|
+
if (receipt.runId !== runId)
|
|
186
|
+
throw new ControlFailure({ kind: "protocol", code: "conflict", unknown: true });
|
|
187
|
+
this.accepted(key, { kind: "background", receipt });
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
if (this.live(generation))
|
|
191
|
+
this.refuse(key, error);
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
if (this.live(generation))
|
|
195
|
+
this.finish(key);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
canControl(generation, id, action) {
|
|
199
|
+
const child = this.child(id);
|
|
200
|
+
return this.available(generation) && !this.current.pending.has(childActionKey(id)) && child?.mode === "continuable" && !child.readonly
|
|
201
|
+
&& enabled(child.controls[action]) && enabled(this.current.snapshot?.capabilities[action]);
|
|
202
|
+
}
|
|
203
|
+
async prompt(generation, id) {
|
|
204
|
+
const draft = this.draft(id), key = childActionKey(id);
|
|
205
|
+
if (!this.canControl(generation, id, "prompt") || draft.uncertain || draft.imageBusy || draft.text.trim() === "" && draft.images.length === 0
|
|
206
|
+
|| draft.images.length > 0 && !enabled(this.current.snapshot?.capabilities.images))
|
|
207
|
+
return;
|
|
208
|
+
this.begin(key, "prompt");
|
|
209
|
+
try {
|
|
210
|
+
let clientTimeZone;
|
|
211
|
+
try {
|
|
212
|
+
clientTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
213
|
+
}
|
|
214
|
+
catch { /* Omission delegates to native zone handling. */ }
|
|
215
|
+
let request;
|
|
216
|
+
try {
|
|
217
|
+
request = parseRoleControlPromptRequest({ requestId: crypto.randomUUID(), parentSessionId: this.current.sessionId, childSessionId: id, mode: "continuable", delivery: draft.delivery,
|
|
218
|
+
content: [...(draft.text === "" ? [] : [{ type: "text", text: draft.text }]), ...draft.images], ...(clientTimeZone === undefined ? {} : { clientTimeZone }) });
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
throw new ControlFailure({ kind: "local", code: "invalid-content" });
|
|
222
|
+
}
|
|
223
|
+
const receipt = await this.unwrap("prompt", () => this.remote.prompt(this.current.sessionId, request));
|
|
224
|
+
if (!this.live(generation))
|
|
225
|
+
return;
|
|
226
|
+
this.accepted(key, { kind: "prompt", receipt });
|
|
227
|
+
const drafts = new Map(this.current.drafts);
|
|
228
|
+
drafts.set(id, { ...draft, text: "", images: [], uncertain: false });
|
|
229
|
+
this.publish({ drafts });
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
if (this.live(generation)) {
|
|
233
|
+
const issue = this.issue(error);
|
|
234
|
+
this.refuse(key, error);
|
|
235
|
+
if (issue.unknown) {
|
|
236
|
+
const drafts = new Map(this.current.drafts);
|
|
237
|
+
drafts.set(id, { ...this.draft(id), uncertain: true });
|
|
238
|
+
this.publish({ drafts });
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
if (this.live(generation))
|
|
244
|
+
this.finish(key);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
async interrupt(generation, id) {
|
|
248
|
+
if (!this.canControl(generation, id, "interrupt"))
|
|
249
|
+
return;
|
|
250
|
+
const key = childActionKey(id);
|
|
251
|
+
this.begin(key, "interrupt");
|
|
252
|
+
try {
|
|
253
|
+
const receipt = await this.unwrap("interrupt", () => this.remote.interrupt(this.current.sessionId, { parentSessionId: this.current.sessionId, childSessionId: id, mode: "continuable" }));
|
|
254
|
+
if (this.live(generation))
|
|
255
|
+
this.accepted(key, { kind: "interrupt", receipt });
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
if (this.live(generation))
|
|
259
|
+
this.refuse(key, error);
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
if (this.live(generation))
|
|
263
|
+
this.finish(key);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
async addImages(generation, id, files) {
|
|
267
|
+
if (!this.canControl(generation, id, "prompt") || !enabled(this.current.snapshot?.capabilities.images) || this.draft(id).imageBusy || files.length === 0)
|
|
268
|
+
return;
|
|
269
|
+
this.editDraft(generation, id, { imageBusy: true });
|
|
270
|
+
try {
|
|
271
|
+
const images = [];
|
|
272
|
+
for (const file of files) {
|
|
273
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
274
|
+
if (!this.live(generation))
|
|
275
|
+
return;
|
|
276
|
+
let body = "";
|
|
277
|
+
for (const byte of bytes)
|
|
278
|
+
body += String.fromCharCode(byte);
|
|
279
|
+
const parsed = parseRoleControlPromptRequest({ requestId: "image-intake", parentSessionId: this.current.sessionId, childSessionId: id, mode: "continuable", delivery: "queue",
|
|
280
|
+
content: [{ type: "image", mediaType: file.type, data: btoa(body), name: file.name }] });
|
|
281
|
+
images.push(parsed.content[0]);
|
|
282
|
+
}
|
|
283
|
+
if (this.live(generation))
|
|
284
|
+
this.publishDraft(id, { images: [...this.draft(id).images, ...images] });
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
if (this.live(generation))
|
|
288
|
+
this.refuse(childActionKey(id), new ControlFailure({ kind: "local", code: "invalid-content" }));
|
|
289
|
+
}
|
|
290
|
+
finally {
|
|
291
|
+
if (this.live(generation))
|
|
292
|
+
this.publishDraft(id, { imageBusy: false });
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=children-controller.js.map
|