@toddzheng024/dscode-desktop 0.0.0-stage → 0.7.33
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/LICENSE +21 -0
- package/README.md +120 -2
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/bin/apply_patch +9 -0
- package/cordis.patch.yml +433 -0
- package/docs/CHANGELOG.md +641 -0
- package/docs/account-login.md +44 -0
- package/docs/auto-review.md +128 -0
- package/docs/browser-use.md +783 -0
- package/docs/computer-use.md +81 -0
- package/docs/custom-providers.md +88 -0
- package/docs/demo.md +76 -0
- package/docs/distribution.md +58 -0
- package/docs/dscode-ultra.md +75 -0
- package/docs/email.md +296 -0
- package/docs/exec.md +40 -0
- package/docs/hub-distribution.md +190 -0
- package/docs/memory.md +121 -0
- package/docs/opencode-go.md +61 -0
- package/docs/plugin-hub.md +68 -0
- package/docs/releases/0.2.0.md +28 -0
- package/docs/releases/0.3.0.md +21 -0
- package/docs/releases/0.4.0.md +20 -0
- package/docs/releases/0.5.0.md +19 -0
- package/docs/releases/0.6.0.md +20 -0
- package/docs/releases/0.7.0.md +22 -0
- package/docs/releases/0.7.1.md +20 -0
- package/docs/releases/0.7.10.md +10 -0
- package/docs/releases/0.7.11.md +17 -0
- package/docs/releases/0.7.12.md +11 -0
- package/docs/releases/0.7.13.md +12 -0
- package/docs/releases/0.7.14.md +11 -0
- package/docs/releases/0.7.15.md +11 -0
- package/docs/releases/0.7.16.md +10 -0
- package/docs/releases/0.7.17.md +12 -0
- package/docs/releases/0.7.18.md +13 -0
- package/docs/releases/0.7.19.md +8 -0
- package/docs/releases/0.7.2.md +19 -0
- package/docs/releases/0.7.20.md +10 -0
- package/docs/releases/0.7.21.md +9 -0
- package/docs/releases/0.7.22.md +11 -0
- package/docs/releases/0.7.23.md +14 -0
- package/docs/releases/0.7.24.md +11 -0
- package/docs/releases/0.7.25.md +8 -0
- package/docs/releases/0.7.26.md +18 -0
- package/docs/releases/0.7.27.md +8 -0
- package/docs/releases/0.7.28.md +22 -0
- package/docs/releases/0.7.29.md +12 -0
- package/docs/releases/0.7.3.md +23 -0
- package/docs/releases/0.7.30.md +19 -0
- package/docs/releases/0.7.31.md +14 -0
- package/docs/releases/0.7.32.md +14 -0
- package/docs/releases/0.7.33.md +30 -0
- package/docs/releases/0.7.4.md +16 -0
- package/docs/releases/0.7.5.md +18 -0
- package/docs/releases/0.7.6.md +29 -0
- package/docs/releases/0.7.7.md +36 -0
- package/docs/releases/0.7.8.md +14 -0
- package/docs/releases/0.7.9.md +15 -0
- package/docs/session-bridge.md +80 -0
- package/docs/session-cards.md +53 -0
- package/docs/session-communication.md +186 -0
- package/docs/session-metrics.md +41 -0
- package/docs/skills.md +81 -0
- package/docs/triggers.md +338 -0
- package/docs/tui-commands.md +204 -0
- package/extensions/browser/manifest.json +22 -0
- package/extensions/browser/popup.css +6 -0
- package/extensions/browser/popup.html +11 -0
- package/extensions/browser/popup.mjs +47 -0
- package/extensions/browser/protocol.mjs +168 -0
- package/extensions/browser/worker.mjs +94 -0
- package/icon.svg +7 -0
- package/locale/en.json +6 -0
- package/locale/zh-cn.json +6 -0
- package/node_modules/@deepseek-ai/node-addon-system/LICENSE +21 -0
- package/node_modules/@deepseek-ai/node-addon-system/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system/README.md +15 -0
- package/node_modules/@deepseek-ai/node-addon-system/README.zh.md +15 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/flock.d.ts +13 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/flock.js +51 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/index.d.ts +73 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/index.js +98 -0
- package/node_modules/@deepseek-ai/node-addon-system/package.json +45 -0
- package/node_modules/@deepseek-ai/node-addon-system/src/flock.c +164 -0
- package/node_modules/@deepseek-ai/node-addon-system/src/main.c +298 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.zh.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/bin/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/prebuilds.json +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.zh.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/bin/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/prebuilds.json +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.zh.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/glibc/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/landlock-run +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/musl/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/prebuilds.json +24 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.zh.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/glibc/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/landlock-run +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/musl/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/prebuilds.json +24 -0
- package/package.json +156 -4
- package/plugins/account/index.mjs +178 -0
- package/plugins/account/state.mjs +123 -0
- package/plugins/auto-review/audit.mjs +24 -0
- package/plugins/auto-review/index.mjs +267 -0
- package/plugins/auto-review/policy.mjs +92 -0
- package/plugins/browser/SKILL.md +158 -0
- package/plugins/browser/access.mjs +143 -0
- package/plugins/browser/config.mjs +60 -0
- package/plugins/browser/connection.mjs +385 -0
- package/plugins/browser/desktop-client.mjs +282 -0
- package/plugins/browser/desktop-host.mjs +74 -0
- package/plugins/browser/document-identity.mjs +57 -0
- package/plugins/browser/extension-relay.mjs +66 -0
- package/plugins/browser/files.mjs +32 -0
- package/plugins/browser/index.mjs +235 -0
- package/plugins/browser/mcp-entry.mjs +18 -0
- package/plugins/browser/mcp-tools.mjs +21 -0
- package/plugins/browser/presentation.mjs +45 -0
- package/plugins/browser/preview.mjs +77 -0
- package/plugins/browser/review.mjs +20 -0
- package/plugins/browser/screenshots.mjs +35 -0
- package/plugins/clipboard-image/clipboard-image.swift +56 -0
- package/plugins/clipboard-image/index.mjs +70 -0
- package/plugins/code-review/baseline.mjs +143 -0
- package/plugins/code-review/git.mjs +163 -0
- package/plugins/code-review/index.mjs +236 -0
- package/plugins/compaction/engine.mjs +304 -0
- package/plugins/compaction/tetris.mjs +65 -0
- package/plugins/compaction/threshold.mjs +98 -0
- package/plugins/computer-use/DESKTOP-SKILL.md +64 -0
- package/plugins/computer-use/desktop-host.mjs +75 -0
- package/plugins/computer-use/desktop-skill.mjs +28 -0
- package/plugins/computer-use/desktop-upstream.mjs +3 -0
- package/plugins/computer-use/index.mjs +37 -0
- package/plugins/cordis-config/plain.mjs +31 -0
- package/plugins/credentials/index.mjs +73 -0
- package/plugins/custom/adapter.mjs +110 -0
- package/plugins/custom/config.mjs +85 -0
- package/plugins/custom/desktop-client.mjs +150 -0
- package/plugins/custom/desktop-host.mjs +78 -0
- package/plugins/custom/images.mjs +32 -0
- package/plugins/custom/index.mjs +145 -0
- package/plugins/custom/wire.mjs +179 -0
- package/plugins/desktop/client.mjs +1041 -0
- package/plugins/desktop/index.mjs +10 -0
- package/plugins/desktop/shell-environment.mjs +9 -0
- package/plugins/desktop-workspace/hooks.mjs +29 -0
- package/plugins/desktop-workspace/index.mjs +37 -0
- package/plugins/dscode/board.mjs +260 -0
- package/plugins/dscode/child-target.mjs +11 -0
- package/plugins/dscode/control.mjs +17 -0
- package/plugins/dscode/desktop-client.mjs +55 -0
- package/plugins/dscode/desktop-host.mjs +37 -0
- package/plugins/dscode/index.mjs +270 -0
- package/plugins/email/cli.mjs +32 -0
- package/plugins/email/contacts.mjs +36 -0
- package/plugins/email/desktop-client.mjs +117 -0
- package/plugins/email/desktop-host.mjs +54 -0
- package/plugins/email/desktop-service.mjs +106 -0
- package/plugins/email/gmail-oauth.mjs +69 -0
- package/plugins/email/gmail-store.mjs +2 -0
- package/plugins/email/gmail.mjs +194 -0
- package/plugins/email/imap.mjs +136 -0
- package/plugins/email/inbox.d.mts +25 -0
- package/plugins/email/inbox.mjs +76 -0
- package/plugins/email/smtp.mjs +70 -0
- package/plugins/email/store.mjs +32 -0
- package/plugins/email-tools/index.mjs +46 -0
- package/plugins/exec/cli.mjs +64 -0
- package/plugins/exec/index.mjs +112 -0
- package/plugins/grok/adapter.mjs +114 -0
- package/plugins/grok/auth.mjs +76 -0
- package/plugins/grok/billing.mjs +146 -0
- package/plugins/grok/index.mjs +122 -0
- package/plugins/grok/models.mjs +129 -0
- package/plugins/grok/status.mjs +28 -0
- package/plugins/grok/wire.mjs +268 -0
- package/plugins/hub/catalog.mjs +82 -0
- package/plugins/hub/desktop-client.mjs +114 -0
- package/plugins/hub/desktop-host.mjs +129 -0
- package/plugins/i18n/messages.d.mts +21 -0
- package/plugins/i18n/messages.mjs +537 -0
- package/plugins/jev/approval.mjs +131 -0
- package/plugins/jev/client.mjs +74 -0
- package/plugins/jev/index.mjs +99 -0
- package/plugins/memory/content.mjs +57 -0
- package/plugins/memory/desktop-host.mjs +3 -0
- package/plugins/memory/index.mjs +168 -0
- package/plugins/memory/pipeline.mjs +79 -0
- package/plugins/memory/store.mjs +93 -0
- package/plugins/message-source/kind.mjs +20 -0
- package/plugins/opencode-go/adapter.mjs +96 -0
- package/plugins/opencode-go/command.mjs +128 -0
- package/plugins/opencode-go/index.mjs +120 -0
- package/plugins/opencode-go/models.mjs +58 -0
- package/plugins/opencode-go/oauth.mjs +194 -0
- package/plugins/opencode-go/search.mjs +86 -0
- package/plugins/opencode-go/usage.mjs +119 -0
- package/plugins/opencode-go/version.mjs +10 -0
- package/plugins/opencode-go/wire.mjs +73 -0
- package/plugins/openrouter/adapter.mjs +232 -0
- package/plugins/openrouter/index.mjs +123 -0
- package/plugins/openrouter/models.mjs +157 -0
- package/plugins/openrouter/search.mjs +113 -0
- package/plugins/openrouter/wire.mjs +101 -0
- package/plugins/providers/catalog.mjs +160 -0
- package/plugins/providers/chat-messages.mjs +120 -0
- package/plugins/providers/chat-stream.mjs +174 -0
- package/plugins/providers/desktop-client.mjs +84 -0
- package/plugins/providers/desktop-host.mjs +63 -0
- package/plugins/providers/effort.mjs +35 -0
- package/plugins/providers/http-errors.mjs +50 -0
- package/plugins/providers/openrouter-account.mjs +171 -0
- package/plugins/session-bridge/client.mjs +106 -0
- package/plugins/session-bridge/communication.mjs +260 -0
- package/plugins/session-bridge/index.mjs +68 -0
- package/plugins/session-bridge/mailbox.mjs +267 -0
- package/plugins/session-bridge/paths.mjs +21 -0
- package/plugins/session-bridge/server.mjs +172 -0
- package/plugins/session-bridge/tasks.mjs +229 -0
- package/plugins/session-cards/content.mjs +64 -0
- package/plugins/session-cards/index.mjs +38 -0
- package/plugins/session-cards/manager.mjs +140 -0
- package/plugins/session-metrics/attribution.mjs +30 -0
- package/plugins/session-metrics/balance.mjs +81 -0
- package/plugins/session-metrics/desktop-client.mjs +62 -0
- package/plugins/session-metrics/desktop-host.mjs +46 -0
- package/plugins/session-metrics/index.mjs +96 -0
- package/plugins/session-metrics/pricing.mjs +84 -0
- package/plugins/session-metrics/rate.mjs +59 -0
- package/plugins/session-metrics/store.mjs +75 -0
- package/plugins/session-metrics/turns.mjs +134 -0
- package/plugins/session-metrics/view.mjs +271 -0
- package/plugins/time-marks/desktop-host.mjs +2 -0
- package/plugins/time-marks/index.mjs +116 -0
- package/plugins/time-marks/marks.mjs +152 -0
- package/plugins/triggers/cli.mjs +558 -0
- package/plugins/triggers/commands.mjs +143 -0
- package/plugins/triggers/config.mjs +264 -0
- package/plugins/triggers/desktop-client.mjs +155 -0
- package/plugins/triggers/desktop-host.mjs +88 -0
- package/plugins/triggers/desktop-management.mjs +97 -0
- package/plugins/triggers/desktop-scheduler.mjs +125 -0
- package/plugins/triggers/host.mjs +24 -0
- package/plugins/triggers/index.mjs +27 -0
- package/plugins/triggers/job-cli.mjs +110 -0
- package/plugins/triggers/jobs.mjs +156 -0
- package/plugins/triggers/launchd.mjs +101 -0
- package/plugins/triggers/lease.mjs +24 -0
- package/plugins/triggers/log.mjs +104 -0
- package/plugins/triggers/management.mjs +181 -0
- package/plugins/triggers/options.mjs +117 -0
- package/plugins/triggers/overlay.mjs +7 -0
- package/plugins/triggers/poll.mjs +65 -0
- package/plugins/triggers/run.mjs +157 -0
- package/plugins/triggers/schedule.mjs +40 -0
- package/plugins/triggers/scheduler-service.mjs +46 -0
- package/plugins/triggers/scheduler.mjs +92 -0
- package/plugins/triggers/session-run.mjs +125 -0
- package/plugins/triggers/session.mjs +48 -0
- package/plugins/triggers/source-emit.mjs +19 -0
- package/plugins/triggers/source-host.mjs +78 -0
- package/plugins/triggers/source-ingress.mjs +70 -0
- package/plugins/triggers/source-sandbox.mjs +35 -0
- package/plugins/triggers/sources.mjs +45 -0
- package/plugins/triggers/spool.mjs +145 -0
- package/plugins/triggers/tools.mjs +67 -0
- package/plugins/triggers/unattended.mjs +18 -0
- package/plugins/tui-tools/composition.mjs +28 -0
- package/plugins/tui-tools/desktop-host.mjs +2 -0
- package/plugins/tui-tools/doctor-cli.mjs +22 -0
- package/plugins/tui-tools/doctor.mjs +148 -0
- package/plugins/tui-tools/hook-sources.mjs +113 -0
- package/plugins/tui-tools/hooks.mjs +23 -0
- package/plugins/tui-tools/index.mjs +268 -0
- package/plugins/tui-tools/sandbox-runner.mjs +123 -0
- package/plugins/tui-tools/shell.mjs +27 -0
- package/plugins/tui-tools/update.mjs +111 -0
- package/plugins/tui-tools/workspace-discovery.mjs +129 -0
- package/plugins/ultra/policy.mjs +42 -0
- package/plugins/worktree-subagent/worktree.mjs +56 -0
- package/runtime-sources.json +94 -0
- package/vendor/bash/LICENSE +21 -0
- package/vendor/bash/index.js +717 -0
- package/vendor/bash/types/background.d.ts +50 -0
- package/vendor/bash/types/index.d.ts +38 -0
- package/vendor/bash/types/render.d.ts +57 -0
- package/vendor/command-goal/LICENSE +21 -0
- package/vendor/command-goal/index.js +210 -0
- package/vendor/command-goal/types/index.d.ts +10 -0
- package/vendor/computer-use/LICENSE +21 -0
- package/vendor/computer-use/lib/approval-policy.js +12 -0
- package/vendor/computer-use/lib/approval-policy.js.map +1 -0
- package/vendor/computer-use/lib/artifacts.js +79 -0
- package/vendor/computer-use/lib/artifacts.js.map +1 -0
- package/vendor/computer-use/lib/backend.js +3 -0
- package/vendor/computer-use/lib/backend.js.map +1 -0
- package/vendor/computer-use/lib/client.js +369 -0
- package/vendor/computer-use/lib/client.js.map +1 -0
- package/vendor/computer-use/lib/config.js +159 -0
- package/vendor/computer-use/lib/config.js.map +1 -0
- package/vendor/computer-use/lib/confirmations.js +99 -0
- package/vendor/computer-use/lib/confirmations.js.map +1 -0
- package/vendor/computer-use/lib/diff.js +58 -0
- package/vendor/computer-use/lib/diff.js.map +1 -0
- package/vendor/computer-use/lib/errors.js +22 -0
- package/vendor/computer-use/lib/errors.js.map +1 -0
- package/vendor/computer-use/lib/exposure.js +244 -0
- package/vendor/computer-use/lib/exposure.js.map +1 -0
- package/vendor/computer-use/lib/index.js +66 -0
- package/vendor/computer-use/lib/index.js.map +1 -0
- package/vendor/computer-use/lib/leases.js +262 -0
- package/vendor/computer-use/lib/leases.js.map +1 -0
- package/vendor/computer-use/lib/providers/macos.js +243 -0
- package/vendor/computer-use/lib/providers/macos.js.map +1 -0
- package/vendor/computer-use/lib/providers/native-helper.js +726 -0
- package/vendor/computer-use/lib/providers/native-helper.js.map +1 -0
- package/vendor/computer-use/lib/providers/unsupported.js +51 -0
- package/vendor/computer-use/lib/providers/unsupported.js.map +1 -0
- package/vendor/computer-use/lib/service.js +608 -0
- package/vendor/computer-use/lib/service.js.map +1 -0
- package/vendor/computer-use/lib/skill.js +136 -0
- package/vendor/computer-use/lib/skill.js.map +1 -0
- package/vendor/computer-use/lib/target-resolver.js +180 -0
- package/vendor/computer-use/lib/target-resolver.js.map +1 -0
- package/vendor/computer-use/lib/tools.js +511 -0
- package/vendor/computer-use/lib/tools.js.map +1 -0
- package/vendor/computer-use/lib/types/approval-policy.d.ts +13 -0
- package/vendor/computer-use/lib/types/approval-policy.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/artifacts.d.ts +10 -0
- package/vendor/computer-use/lib/types/artifacts.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/backend.d.ts +124 -0
- package/vendor/computer-use/lib/types/backend.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/client/index.d.ts +83 -0
- package/vendor/computer-use/lib/types/client/index.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/config.d.ts +94 -0
- package/vendor/computer-use/lib/types/config.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/confirmations.d.ts +23 -0
- package/vendor/computer-use/lib/types/confirmations.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/diff.d.ts +5 -0
- package/vendor/computer-use/lib/types/diff.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/errors.d.ts +15 -0
- package/vendor/computer-use/lib/types/errors.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/exposure.d.ts +30 -0
- package/vendor/computer-use/lib/types/exposure.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/index.d.ts +21 -0
- package/vendor/computer-use/lib/types/index.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/leases.d.ts +81 -0
- package/vendor/computer-use/lib/types/leases.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/providers/macos.d.ts +39 -0
- package/vendor/computer-use/lib/types/providers/macos.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/providers/native-helper.d.ts +48 -0
- package/vendor/computer-use/lib/types/providers/native-helper.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/providers/unsupported.d.ts +23 -0
- package/vendor/computer-use/lib/types/providers/unsupported.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/service.d.ts +58 -0
- package/vendor/computer-use/lib/types/service.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/skill.d.ts +14 -0
- package/vendor/computer-use/lib/types/skill.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/target-resolver.d.ts +38 -0
- package/vendor/computer-use/lib/types/target-resolver.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/tools.d.ts +6 -0
- package/vendor/computer-use/lib/types/tools.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/types.d.ts +270 -0
- package/vendor/computer-use/lib/types/types.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/web.d.ts +33 -0
- package/vendor/computer-use/lib/types/web.d.ts.map +1 -0
- package/vendor/computer-use/lib/types.js +9 -0
- package/vendor/computer-use/lib/types.js.map +1 -0
- package/vendor/computer-use/lib/web.js +188 -0
- package/vendor/computer-use/lib/web.js.map +1 -0
- package/vendor/computer-use/native/macos/Sources/Fixture/main.swift +412 -0
- package/vendor/computer-use/native/macos/Sources/Helper/CursorImage.swift +11 -0
- package/vendor/computer-use/native/macos/Sources/Helper/CursorMotion.swift +67 -0
- package/vendor/computer-use/native/macos/Sources/Helper/CursorOverlay.swift +840 -0
- package/vendor/computer-use/native/macos/Sources/Helper/TargetedPointer.swift +327 -0
- package/vendor/computer-use/native/macos/Sources/Helper/WindowNumberMatcher.swift +29 -0
- package/vendor/computer-use/native/macos/Sources/Helper/main.swift +1244 -0
- package/vendor/computer-use/native/macos/Sources/Monitor/main.swift +153 -0
- package/vendor/computer-use/native/macos/bin/dsh-computer-use-helper +0 -0
- package/vendor/computer-use/native/macos/manifest.json +14 -0
- package/vendor/persistent/LICENSE +21 -0
- package/vendor/persistent/index.js +411 -0
- package/vendor/persistent/types/index.d.ts +24 -0
- package/vendor/subagent/LICENSE +21 -0
- package/vendor/subagent/index.js +694 -0
- package/vendor/subagent/invariant.js +52 -0
- package/vendor/subagent/model-selection-settings.js +68 -0
- package/vendor/subagent/types/index.d.ts +82 -0
- package/vendor/subagent/types/invariant.d.ts +16 -0
- package/vendor/subagent/types/list-models.d.ts +10 -0
- package/vendor/subagent/types/model-selection-settings.d.ts +45 -0
- package/vendor/subagent/types/model-selection-state.d.ts +48 -0
- package/vendor/subagent/types/model-selection.d.ts +81 -0
- package/vendor/subagent-core/LICENSE +21 -0
- package/vendor/subagent-core/index.js +3202 -0
- package/vendor/subagent-core/invariant.js +76 -0
- package/vendor/subagent-core/typert.host.d.ts +3 -0
- package/vendor/subagent-core/typert.host.js +978 -0
- package/vendor/subagent-core/typert.remote-client.d.ts +25 -0
- package/vendor/subagent-core/typert.remote-client.js +114 -0
- package/vendor/subagent-core/types/archive-admission.d.ts +16 -0
- package/vendor/subagent-core/types/archive-admission.js +151 -0
- package/vendor/subagent-core/types/assistant-output.d.ts +48 -0
- package/vendor/subagent-core/types/assistant-output.js +73 -0
- package/vendor/subagent-core/types/catalog.d.ts +84 -0
- package/vendor/subagent-core/types/catalog.js +109 -0
- package/vendor/subagent-core/types/child-agent.d.ts +156 -0
- package/vendor/subagent-core/types/child-agent.js +213 -0
- package/vendor/subagent-core/types/client.d.ts +8 -0
- package/vendor/subagent-core/types/client.js +7 -0
- package/vendor/subagent-core/types/continuation-activation.d.ts +267 -0
- package/vendor/subagent-core/types/continuation-activation.js +700 -0
- package/vendor/subagent-core/types/continuation-messages.d.ts +62 -0
- package/vendor/subagent-core/types/continuation-messages.js +106 -0
- package/vendor/subagent-core/types/continuation.d.ts +124 -0
- package/vendor/subagent-core/types/continuation.js +455 -0
- package/vendor/subagent-core/types/control-types.d.ts +135 -0
- package/vendor/subagent-core/types/control-types.js +8 -0
- package/vendor/subagent-core/types/control.d.ts +45 -0
- package/vendor/subagent-core/types/control.js +79 -0
- package/vendor/subagent-core/types/depth.d.ts +31 -0
- package/vendor/subagent-core/types/depth.js +39 -0
- package/vendor/subagent-core/types/descriptor.d.ts +144 -0
- package/vendor/subagent-core/types/descriptor.js +193 -0
- package/vendor/subagent-core/types/error.d.ts +11 -0
- package/vendor/subagent-core/types/error.js +14 -0
- package/vendor/subagent-core/types/inbox.d.ts +43 -0
- package/vendor/subagent-core/types/inbox.js +61 -0
- package/vendor/subagent-core/types/index.d.ts +320 -0
- package/vendor/subagent-core/types/index.js +475 -0
- package/vendor/subagent-core/types/internal.d.ts +58 -0
- package/vendor/subagent-core/types/internal.js +58 -0
- package/vendor/subagent-core/types/invariant.d.ts +13 -0
- package/vendor/subagent-core/types/invariant.js +91 -0
- package/vendor/subagent-core/types/lifecycle.d.ts +113 -0
- package/vendor/subagent-core/types/lifecycle.js +180 -0
- package/vendor/subagent-core/types/list-children.d.ts +36 -0
- package/vendor/subagent-core/types/list-children.js +166 -0
- package/vendor/subagent-core/types/out-of-process.d.ts +118 -0
- package/vendor/subagent-core/types/out-of-process.js +219 -0
- package/vendor/subagent-core/types/projection-types.d.ts +82 -0
- package/vendor/subagent-core/types/projection-types.js +7 -0
- package/vendor/subagent-core/types/projection.d.ts +100 -0
- package/vendor/subagent-core/types/projection.js +157 -0
- package/vendor/subagent-core/types/run-settlement.d.ts +17 -0
- package/vendor/subagent-core/types/run-settlement.js +70 -0
- package/vendor/subagent-core/types/types.d.ts +377 -0
- package/vendor/subagent-core/types/types.js +19 -0
- package/vendor/subagent-driver/LICENSE +21 -0
- package/vendor/subagent-driver/index.js +255 -0
- package/vendor/subagent-driver/types/index.d.ts +33 -0
- package/vendor/subagent-driver/types/structured.d.ts +42 -0
- package/vendor/subagent-fork/LICENSE +21 -0
- package/vendor/subagent-fork/index.js +61 -0
- package/vendor/subagent-fork/types/index.d.ts +20 -0
- package/vendor/subagent-spawn/LICENSE +21 -0
- package/vendor/subagent-spawn/index.js +45 -0
- package/vendor/subagent-spawn/types/index.d.ts +19 -0
- package/vendor/terminal/LICENSE +21 -0
- package/vendor/terminal/index.js +1093 -0
- package/vendor/terminal/types/config.d.ts +82 -0
- package/vendor/terminal/types/index.d.ts +36 -0
- package/vendor/terminal/types/sanitize.d.ts +47 -0
- package/vendor/terminal/types/session.d.ts +87 -0
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Continuable-subagent orchestration behind `ctx.subagents`: stable child ids,
|
|
3
|
+
* descriptor persistence, provider preparation, cold resume, authorization,
|
|
4
|
+
* and message routing. {@link ContinuableActivationRegistry} owns the mutable
|
|
5
|
+
* process-local Activation graph and its settlement and disposal lifecycle.
|
|
6
|
+
*
|
|
7
|
+
* A continuable child has one durable Session and at most one process-local
|
|
8
|
+
* Activation. The Agent inbox is the only turn queue, so this manager owns
|
|
9
|
+
* durable orchestration while the Agent loop owns all turn ordering and
|
|
10
|
+
* execution. No continuable path creates a Task or an intermediate
|
|
11
|
+
* result-bearing wrapper.
|
|
12
|
+
*
|
|
13
|
+
* @module @deepseek-ai/dsh-subagent
|
|
14
|
+
*/
|
|
15
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
16
|
+
if (value !== null && value !== void 0) {
|
|
17
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18
|
+
var dispose, inner;
|
|
19
|
+
if (async) {
|
|
20
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
21
|
+
dispose = value[Symbol.asyncDispose];
|
|
22
|
+
}
|
|
23
|
+
if (dispose === void 0) {
|
|
24
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
25
|
+
dispose = value[Symbol.dispose];
|
|
26
|
+
if (async) inner = dispose;
|
|
27
|
+
}
|
|
28
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
29
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
30
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
31
|
+
}
|
|
32
|
+
else if (async) {
|
|
33
|
+
env.stack.push({ async: true });
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
};
|
|
37
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
38
|
+
return function (env) {
|
|
39
|
+
function fail(e) {
|
|
40
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
41
|
+
env.hasError = true;
|
|
42
|
+
}
|
|
43
|
+
var r, s = 0;
|
|
44
|
+
function next() {
|
|
45
|
+
while (r = env.stack.pop()) {
|
|
46
|
+
try {
|
|
47
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
48
|
+
if (r.dispose) {
|
|
49
|
+
var result = r.dispose.call(r.value);
|
|
50
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
51
|
+
}
|
|
52
|
+
else s |= 1;
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
fail(e);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
59
|
+
if (env.hasError) throw env.error;
|
|
60
|
+
}
|
|
61
|
+
return next();
|
|
62
|
+
};
|
|
63
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
64
|
+
var e = new Error(message);
|
|
65
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
66
|
+
});
|
|
67
|
+
import { randomUUID } from 'node:crypto';
|
|
68
|
+
import { brandString } from '@deepseek-ai/dsh-brand';
|
|
69
|
+
import { ReasoningEffortId, contentHasImage, createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
70
|
+
import { SessionLogOffset } from '@deepseek-ai/dsh-session';
|
|
71
|
+
import { childSessionMeta, captureDelegatedPolicyOverrides, resolveChildAgentOptions, resolveChildDepth, } from "./child-agent.js";
|
|
72
|
+
import { ContinuableActivationRegistry, } from "./continuation-activation.js";
|
|
73
|
+
import { createAgentMessage, withContinuableReturnGuidance, } from "./continuation-messages.js";
|
|
74
|
+
import { assertSubagentMaxDepth } from "./depth.js";
|
|
75
|
+
import { foldSubagentDescriptor, snapshotSubagentDescriptor } from "./descriptor.js";
|
|
76
|
+
import { establishCatalogChild } from "./catalog.js";
|
|
77
|
+
import { SubagentError } from "./error.js";
|
|
78
|
+
import { isAdjacentAgentSendMessageTool } from "./internal.js";
|
|
79
|
+
/**
|
|
80
|
+
* The continuable-subagent orchestration service behind `ctx.subagents`. Tool
|
|
81
|
+
* schema and host adapters are consumers of this one contract; foreground
|
|
82
|
+
* one-shot delegation keeps calling `ctx.subagents.start()` and never enters
|
|
83
|
+
* this lifecycle.
|
|
84
|
+
*/
|
|
85
|
+
export class SubagentContinuationManager {
|
|
86
|
+
ctx;
|
|
87
|
+
host;
|
|
88
|
+
activations;
|
|
89
|
+
constructor(ctx, host, maxActiveSubagents) {
|
|
90
|
+
this.ctx = ctx;
|
|
91
|
+
this.host = host;
|
|
92
|
+
this.activations = new ContinuableActivationRegistry(ctx, (provider, childId, parent) => host.observeActivation(provider, childId, parent), maxActiveSubagents);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Start one continuable background child and resolve at initial inbox acceptance.
|
|
96
|
+
* Every earlier failure disposes any created handle and rolls back Activation
|
|
97
|
+
* and parent ownership without returning either id.
|
|
98
|
+
* @param spec - provider, delegation request, and caller cancellation.
|
|
99
|
+
* @returns the durable child id and accepted initial prompt message id.
|
|
100
|
+
*/
|
|
101
|
+
async startContinuable(spec) {
|
|
102
|
+
const request = spec.request;
|
|
103
|
+
const parent = request.parent;
|
|
104
|
+
this.activations.assertAdmitting(parent);
|
|
105
|
+
const persistence = this.requirePersistence();
|
|
106
|
+
assertSubagentMaxDepth(request.maxDepth);
|
|
107
|
+
const childId = spec.childId ?? brandString(randomUUID());
|
|
108
|
+
this.activations.assertChildIdAvailable(childId);
|
|
109
|
+
const childDepth = resolveChildDepth(parent, request.maxDepth);
|
|
110
|
+
// Snapshot before any await: invalid descriptor JSON rejects the call
|
|
111
|
+
// before a child exists, and the detached value is what reaches the log.
|
|
112
|
+
const agentOptions = resolveChildAgentOptions(parent, request.agentOptions, childDepth);
|
|
113
|
+
const agentProvider = agentOptions.provider;
|
|
114
|
+
const agentModel = agentOptions.model;
|
|
115
|
+
const agentReasoningEffort = agentOptions.reasoningEffort;
|
|
116
|
+
const descriptor = snapshotSubagentDescriptor({
|
|
117
|
+
mode: 'continuable',
|
|
118
|
+
provider: spec.provider,
|
|
119
|
+
label: spec.label,
|
|
120
|
+
...agentProvider !== undefined ? { agentProvider } : {},
|
|
121
|
+
...agentModel !== undefined ? { agentModel } : {},
|
|
122
|
+
...agentReasoningEffort !== undefined ? { agentReasoningEffort } : {},
|
|
123
|
+
...request.persona !== undefined ? { persona: request.persona } : {},
|
|
124
|
+
...request.toolFilter !== undefined ? { toolFilter: request.toolFilter } : {},
|
|
125
|
+
});
|
|
126
|
+
// Capture before the first await: a later parent switch belongs to the
|
|
127
|
+
// parent's future, not to this child.
|
|
128
|
+
const delegatedPolicies = captureDelegatedPolicyOverrides(parent);
|
|
129
|
+
// An idle continuation-managed parent must not settle while a caller is
|
|
130
|
+
// still creating its child. A turn-scoped delegation does not need this,
|
|
131
|
+
// but the service is also callable outside a turn.
|
|
132
|
+
const releaseHold = this.activations.holdOwnership(parent, childId);
|
|
133
|
+
try {
|
|
134
|
+
const prepared = await this.host.prepareContinuable(spec.provider, {
|
|
135
|
+
sessionId: childId,
|
|
136
|
+
parent,
|
|
137
|
+
signal: spec.signal,
|
|
138
|
+
});
|
|
139
|
+
spec.signal.throwIfAborted();
|
|
140
|
+
this.activations.assertAdmitting(parent);
|
|
141
|
+
const inheritedEventCount = SessionLogOffset(prepared.seed?.length ?? 0);
|
|
142
|
+
const seed = prepared.seed;
|
|
143
|
+
const messageId = await this.activations.locks.run(childId, async () => {
|
|
144
|
+
spec.signal.throwIfAborted();
|
|
145
|
+
this.activations.assertAdmitting(parent);
|
|
146
|
+
this.activations.assertChildIdAvailable(childId);
|
|
147
|
+
if (spec.childId !== undefined) {
|
|
148
|
+
const persisted = await persistence.stat(childId, { signal: spec.signal });
|
|
149
|
+
spec.signal.throwIfAborted();
|
|
150
|
+
this.activations.assertAdmitting(parent);
|
|
151
|
+
this.activations.assertChildIdAvailable(childId);
|
|
152
|
+
if (persisted !== undefined) {
|
|
153
|
+
throw new SubagentError(`subagent "${childId}" already exists`, 'DUPLICATE_CHILD');
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const activation = await this.activations.materialize({
|
|
157
|
+
childId,
|
|
158
|
+
provider: spec.provider,
|
|
159
|
+
parent,
|
|
160
|
+
create: {
|
|
161
|
+
seed,
|
|
162
|
+
meta: childSessionMeta(parent, childDepth, prepared.seed !== undefined),
|
|
163
|
+
inheritedEventCount,
|
|
164
|
+
delegatedPolicies,
|
|
165
|
+
descriptor,
|
|
166
|
+
},
|
|
167
|
+
agentOptions,
|
|
168
|
+
composition: { persona: request.persona, toolFilter: request.toolFilter },
|
|
169
|
+
signal: spec.signal,
|
|
170
|
+
});
|
|
171
|
+
const childHeader = activation.handle.agent.session.header;
|
|
172
|
+
return await this.submitMaterialized(activation, isAdjacentAgentSendMessageTool(this.ctx.get('tools')?.get('send_message', activation.handle.agent))
|
|
173
|
+
? withContinuableReturnGuidance(parent.id, request.prompt)
|
|
174
|
+
: request.prompt, { source: { kind: 'user' }, signal: spec.signal, delivery: 'queue' }, parent, () => { establishCatalogChild(parent.session, childHeader, descriptor); });
|
|
175
|
+
});
|
|
176
|
+
return { childId, messageId };
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
releaseHold();
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Deliver one model-authored message to a direct continuable child or to the
|
|
185
|
+
* sender's direct parent. A missing direct child cold-resumes through the
|
|
186
|
+
* ordinary continuation lifecycle.
|
|
187
|
+
* @param sender - exact live Agent authorizing and originating the message.
|
|
188
|
+
* @param targetId - durable direct-parent or direct-child session id.
|
|
189
|
+
* @param content - model-authored content to deliver.
|
|
190
|
+
* @param options - caller cancellation before acceptance.
|
|
191
|
+
* @returns the accepted message's inbox id.
|
|
192
|
+
*/
|
|
193
|
+
async sendMessage(sender, targetId, content, options) {
|
|
194
|
+
if (this.ctx.agents.get(sender.id) !== sender) {
|
|
195
|
+
throw new SubagentError('message delivery requires the exact live sender agent', 'UNAUTHORIZED');
|
|
196
|
+
}
|
|
197
|
+
this.activations.assertAdmitting(sender);
|
|
198
|
+
const senderActivation = this.activations.get(sender.id);
|
|
199
|
+
if (senderActivation !== undefined
|
|
200
|
+
&& senderActivation.handle.agent === sender
|
|
201
|
+
&& senderActivation.parentSession === targetId) {
|
|
202
|
+
options.signal.throwIfAborted();
|
|
203
|
+
return this.sendToParent(senderActivation, sender, content);
|
|
204
|
+
}
|
|
205
|
+
if (sender.session.header.parentSession === targetId) {
|
|
206
|
+
throw new SubagentError(`agent "${sender.id}" is not a resident continuable child and cannot send to parent "${targetId}"`, 'UNAUTHORIZED');
|
|
207
|
+
}
|
|
208
|
+
return this.deliverToChild(sender, targetId, content, {
|
|
209
|
+
signal: options.signal,
|
|
210
|
+
delivery: 'steer',
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Queue one human-authored prompt as a distinct direct-child turn.
|
|
215
|
+
* @param parent - exact live direct parent authorizing delivery.
|
|
216
|
+
* @param childId - durable direct-child session id.
|
|
217
|
+
* @param content - model-visible prompt blocks.
|
|
218
|
+
* @param source - durable attribution for the human prompt.
|
|
219
|
+
* @param signal - caller cancellation before inbox acceptance.
|
|
220
|
+
* @returns the accepted durable message id.
|
|
221
|
+
*/
|
|
222
|
+
async queuePrompt(parent, childId, content, source, signal) {
|
|
223
|
+
return this.deliverToChild(parent, childId, content, { source, signal, delivery: 'queue' });
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Steer one host-authored prompt to a direct continuable child.
|
|
227
|
+
* @param parent - exact live direct parent authorizing delivery.
|
|
228
|
+
* @param childId - durable direct-child session id.
|
|
229
|
+
* @param content - model-visible prompt blocks.
|
|
230
|
+
* @param source - durable attribution for the host prompt.
|
|
231
|
+
* @param signal - caller cancellation before inbox acceptance.
|
|
232
|
+
* @returns the accepted durable message id.
|
|
233
|
+
*/
|
|
234
|
+
async steerPrompt(parent, childId, content, source, signal) {
|
|
235
|
+
return this.deliverToChild(parent, childId, content, { source, signal, delivery: 'steer' });
|
|
236
|
+
}
|
|
237
|
+
/** Route one parent-originated delivery through residency and cold resume. */
|
|
238
|
+
async deliverToChild(parent, childId, content, options) {
|
|
239
|
+
this.activations.assertAdmitting(parent);
|
|
240
|
+
const releaseHold = this.activations.holdOwnership(parent, childId);
|
|
241
|
+
try {
|
|
242
|
+
return await this.deliverFollowup(parent, childId, content, options);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
releaseHold();
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/** The delivery loop behind {@link deliverToChild}, run under the parent hold. */
|
|
250
|
+
async deliverFollowup(parent, childId, content, options) {
|
|
251
|
+
while (true) {
|
|
252
|
+
const live = await this.activations.locks.run(childId, async () => {
|
|
253
|
+
const activation = this.activations.get(childId);
|
|
254
|
+
if (activation === undefined)
|
|
255
|
+
return this.coldResume(parent, childId, content, options);
|
|
256
|
+
const disposal = activation.inbox.closing;
|
|
257
|
+
/* v8 ignore next 3 -- the send-versus-dispose cutoff needs a delivery to
|
|
258
|
+
* observe the transaction inside the same critical section that opened it. */
|
|
259
|
+
if (disposal !== undefined) {
|
|
260
|
+
return disposal.then(() => undefined, () => undefined);
|
|
261
|
+
}
|
|
262
|
+
if (contentHasImage(content)) {
|
|
263
|
+
await this.assertImageCapable(activation.handle.agent, options.signal);
|
|
264
|
+
if (activation.inbox.closing !== undefined) {
|
|
265
|
+
await Promise.allSettled([activation.inbox.closing]);
|
|
266
|
+
return undefined;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const messageId = this.submitAdmitted(activation, content, options, parent);
|
|
270
|
+
activation.announced = true;
|
|
271
|
+
return messageId;
|
|
272
|
+
});
|
|
273
|
+
/* v8 ignore start -- only a delivery that lost the disposal cutoff retries. */
|
|
274
|
+
if (live !== undefined)
|
|
275
|
+
return live;
|
|
276
|
+
this.activations.assertAdmitting(parent);
|
|
277
|
+
options.signal.throwIfAborted();
|
|
278
|
+
/* v8 ignore stop */
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Interrupt one live continuable child's current turn. Admission is
|
|
283
|
+
* synchronous and the cancellation effect is asynchronous. An absent or
|
|
284
|
+
* already-closing target is an accepted no-op after authority checks.
|
|
285
|
+
* @param targetSessionId - the durable child session id to interrupt.
|
|
286
|
+
* @param authority - the human parent address or exact live ancestor Agent.
|
|
287
|
+
*/
|
|
288
|
+
interrupt(targetSessionId, authority) {
|
|
289
|
+
this.activations.interrupt(targetSessionId, authority);
|
|
290
|
+
}
|
|
291
|
+
/** Deliver one resident continuable child's message to its live direct parent. */
|
|
292
|
+
sendToParent(activation, sender, content) {
|
|
293
|
+
/* v8 ignore next 6 -- only synchronous re-entrant teardown can open this
|
|
294
|
+
* transaction between exact-agent authorization and this no-await span. */
|
|
295
|
+
if (activation.inbox.closing !== undefined) {
|
|
296
|
+
throw new SubagentError(`subagent "${sender.id}" activation is being disposed; the message was not delivered`, 'ACTIVATION_CLOSING');
|
|
297
|
+
}
|
|
298
|
+
const parent = this.ctx.agents.get(activation.parentSession);
|
|
299
|
+
if (parent === undefined) {
|
|
300
|
+
throw new SubagentError('direct parent is not live; the message was not delivered', 'PARENT_UNAVAILABLE');
|
|
301
|
+
}
|
|
302
|
+
const message = createAgentMessage(sender, content);
|
|
303
|
+
this.sendAgentMessage(parent, message);
|
|
304
|
+
return message.id;
|
|
305
|
+
}
|
|
306
|
+
/** Send one Agent message while translating only the target's own rejection. */
|
|
307
|
+
sendAgentMessage(parent, message) {
|
|
308
|
+
try {
|
|
309
|
+
this.activations.sendWaking(parent, message, 'steer');
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
throw new SubagentError('direct parent is not live; the message was not delivered', 'PARENT_UNAVAILABLE', { cause: error });
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
/** Close manager-wide admission and release every live Activation. */
|
|
316
|
+
async drain() {
|
|
317
|
+
await this.activations.drain();
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Stop only the continuable descendants of exact live host-owned parents.
|
|
321
|
+
* @param parents - exact live roots whose continuable descendants must stop.
|
|
322
|
+
*/
|
|
323
|
+
async drainDescendants(parents) {
|
|
324
|
+
await this.activations.drainDescendants(parents);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Release selected resident direct children of one exact live parent.
|
|
328
|
+
* @param parent - exact live direct parent authorizing the selected release.
|
|
329
|
+
* @param childIds - durable direct-child ids to release when resident.
|
|
330
|
+
*/
|
|
331
|
+
async drainChildren(parent, childIds) {
|
|
332
|
+
await this.activations.drainChildren(parent, childIds);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Cold-resume a persisted child and submit the waiting turn. The descriptor
|
|
336
|
+
* supplies every reconstruction input; no subagent provider is dispatched.
|
|
337
|
+
*/
|
|
338
|
+
async coldResume(parent, childId, content, options) {
|
|
339
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
340
|
+
try {
|
|
341
|
+
const query = this.requireSessionQuery();
|
|
342
|
+
let observation;
|
|
343
|
+
try {
|
|
344
|
+
observation = await query.observeSession(childId, {
|
|
345
|
+
signal: options.signal,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
options.signal.throwIfAborted();
|
|
350
|
+
throw new SubagentError(`subagent "${childId}" is unavailable`, 'NOT_RESUMABLE', { cause: error });
|
|
351
|
+
}
|
|
352
|
+
const source = __addDisposableResource(env_1, observation, false);
|
|
353
|
+
this.activations.assertAdmitting(parent);
|
|
354
|
+
this.activations.authorizeLineage(parent, childId, source.header.parentSession);
|
|
355
|
+
const descriptor = foldSubagentDescriptor(source.events.slice(source.inheritedEventCount));
|
|
356
|
+
if (descriptor === undefined || descriptor.mode !== 'continuable') {
|
|
357
|
+
throw new SubagentError(`subagent "${childId}" has no supported continuation state and cannot be resumed; choose a different target`, 'NOT_RESUMABLE');
|
|
358
|
+
}
|
|
359
|
+
let activation;
|
|
360
|
+
try {
|
|
361
|
+
activation = await this.activations.materialize({
|
|
362
|
+
childId,
|
|
363
|
+
provider: descriptor.provider,
|
|
364
|
+
parent,
|
|
365
|
+
agentOptions: {
|
|
366
|
+
...descriptor.agentProvider !== undefined ? { provider: descriptor.agentProvider } : {},
|
|
367
|
+
...descriptor.agentModel !== undefined ? { model: descriptor.agentModel } : {},
|
|
368
|
+
...descriptor.agentReasoningEffort !== undefined
|
|
369
|
+
? { reasoningEffort: ReasoningEffortId(descriptor.agentReasoningEffort) }
|
|
370
|
+
: {},
|
|
371
|
+
},
|
|
372
|
+
composition: { persona: descriptor.persona, toolFilter: descriptor.toolFilter },
|
|
373
|
+
signal: options.signal,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
options.signal.throwIfAborted();
|
|
378
|
+
if (error instanceof SubagentError)
|
|
379
|
+
throw error;
|
|
380
|
+
throw new SubagentError(`subagent "${childId}" is unavailable`, 'NOT_RESUMABLE', { cause: error });
|
|
381
|
+
}
|
|
382
|
+
return await this.submitMaterialized(activation, content, options, parent);
|
|
383
|
+
}
|
|
384
|
+
catch (e_1) {
|
|
385
|
+
env_1.error = e_1;
|
|
386
|
+
env_1.hasError = true;
|
|
387
|
+
}
|
|
388
|
+
finally {
|
|
389
|
+
__disposeResources(env_1);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/** Admit a materialized child, commit its creation fact, and release it on failure. */
|
|
393
|
+
async submitMaterialized(activation, content, options, parent, commit) {
|
|
394
|
+
try {
|
|
395
|
+
if (contentHasImage(content)) {
|
|
396
|
+
await this.assertImageCapable(activation.handle.agent, options.signal);
|
|
397
|
+
if (activation.inbox.closing !== undefined) {
|
|
398
|
+
throw new SubagentError(`subagent "${activation.childId}" is closing`, 'ACTIVATION_CLOSING');
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
const messageId = this.submitAdmitted(activation, content, options, parent);
|
|
402
|
+
commit?.();
|
|
403
|
+
activation.announced = true;
|
|
404
|
+
return messageId;
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
try {
|
|
408
|
+
await this.activations.dispose(activation);
|
|
409
|
+
}
|
|
410
|
+
catch (cleanupError) {
|
|
411
|
+
this.ctx.logger.warn(`subagent continuation: disposal after admission or catalog append failure also failed: ${String(cleanupError)}`);
|
|
412
|
+
}
|
|
413
|
+
throw error;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/** Build and submit one message across the final synchronous admission cutoff. */
|
|
417
|
+
submitAdmitted(activation, content, options, parent) {
|
|
418
|
+
const message = options.source === undefined
|
|
419
|
+
? createAgentMessage(parent, content)
|
|
420
|
+
: createUserMessage({ content, source: options.source });
|
|
421
|
+
return this.activations.submitAdmitted(activation, message, options.delivery, parent, options.signal);
|
|
422
|
+
}
|
|
423
|
+
/** Refuse image content for a child whose fixed model accepts text only. */
|
|
424
|
+
async assertImageCapable(agent, signal) {
|
|
425
|
+
const { provider, model } = agent.options;
|
|
426
|
+
if (provider === undefined || model === undefined)
|
|
427
|
+
return;
|
|
428
|
+
const llm = this.ctx.get('llm');
|
|
429
|
+
/* v8 ignore next -- without an LLM registry, delivery defers to projection. */
|
|
430
|
+
if (llm === undefined)
|
|
431
|
+
return;
|
|
432
|
+
const info = await llm.resolveModelInfo(provider, model, signal);
|
|
433
|
+
if (info.inputModalities !== undefined && !info.inputModalities.includes('image')) {
|
|
434
|
+
throw new SubagentError(`Model "${model}" does not support image input.`, 'MODEL_DOES_NOT_SUPPORT_IMAGES');
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/** Resolve the persistence service continuable children require, or fail loud. */
|
|
438
|
+
requirePersistence() {
|
|
439
|
+
const persistence = this.ctx.get('sessionPersistence');
|
|
440
|
+
if (persistence === undefined) {
|
|
441
|
+
throw new SubagentError('continuable subagents require session persistence (load a dsh-session-persistence backend)', 'PERSISTENCE_UNAVAILABLE');
|
|
442
|
+
}
|
|
443
|
+
return persistence;
|
|
444
|
+
}
|
|
445
|
+
/** Resolve the Session query service used for cold child observations. */
|
|
446
|
+
requireSessionQuery() {
|
|
447
|
+
const query = this.ctx.get('sessionQuery');
|
|
448
|
+
if (query === undefined) {
|
|
449
|
+
throw new SubagentError('continuable subagents require session query (load @deepseek-ai/dsh-session-query)', 'CONTINUATION_UNAVAILABLE');
|
|
450
|
+
}
|
|
451
|
+
return query;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
export default SubagentContinuationManager;
|
|
455
|
+
//# sourceMappingURL=continuation.js.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-safe recursive catalog rows and browser continuation requests,
|
|
3
|
+
* receipts, and failures.
|
|
4
|
+
*
|
|
5
|
+
* @module @deepseek-ai/dsh-subagent/control-types
|
|
6
|
+
*/
|
|
7
|
+
import type { PromptContentPart } from '@deepseek-ai/dsh-attachment/types';
|
|
8
|
+
import type { Branded } from '@deepseek-ai/dsh-brand';
|
|
9
|
+
import type { MessageId } from '@deepseek-ai/dsh-llm/brand';
|
|
10
|
+
import type { SessionId } from '@deepseek-ai/dsh-session/types';
|
|
11
|
+
/**
|
|
12
|
+
* Client-minted identity of one browser prompt, persisted on the exact accepted
|
|
13
|
+
* message. It carries the Session Controller's `session-request-id` brand so a
|
|
14
|
+
* subagent prompt and an ordinary Session prompt share one identity
|
|
15
|
+
* vocabulary; that package depends on this one, so the brand is spelled here
|
|
16
|
+
* rather than imported.
|
|
17
|
+
*/
|
|
18
|
+
export type SubagentPromptRequestId = Branded<'session-request-id'>;
|
|
19
|
+
/** Shared child fields for recursive catalog listing. */
|
|
20
|
+
export type SubagentCatalogRow = {
|
|
21
|
+
/** The durable child session id, stable across Activations. */
|
|
22
|
+
readonly id: SessionId;
|
|
23
|
+
/**
|
|
24
|
+
* Whether recursive catalog listing observed a resident Session. This
|
|
25
|
+
* does not encode a durable outcome or guarantee continuation delivery.
|
|
26
|
+
*/
|
|
27
|
+
readonly activity: 'running' | 'inactive';
|
|
28
|
+
} & ({
|
|
29
|
+
/** A terminal one-shot child. */
|
|
30
|
+
readonly mode: 'one-shot';
|
|
31
|
+
/** Optional durable creation label from the parent catalog. */
|
|
32
|
+
readonly label?: string;
|
|
33
|
+
} | {
|
|
34
|
+
/** A resumable conversation. */
|
|
35
|
+
readonly mode: 'continuable';
|
|
36
|
+
/** Durable creation label from the parent catalog. */
|
|
37
|
+
readonly label: string;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* One recursive catalog row. Traversal may also return diagnostics for
|
|
41
|
+
* unknown catalog modes or unreadable child catalogs.
|
|
42
|
+
*/
|
|
43
|
+
export type SubagentListEntry = SubagentCatalogRow & {
|
|
44
|
+
readonly kind: 'child';
|
|
45
|
+
/** Whether the child catalog contains a direct child. */
|
|
46
|
+
readonly hasChildren: boolean;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: 'diagnostic';
|
|
49
|
+
/** The candidate's session id. */
|
|
50
|
+
readonly id: SessionId;
|
|
51
|
+
/**
|
|
52
|
+
* `corrupt` means the child catalog read found invalid or conflicting
|
|
53
|
+
* Session data; `unavailable` means it could not be read. Either failure
|
|
54
|
+
* stops that branch. `unsupported` means the parent catalog records an
|
|
55
|
+
* unknown child mode; its readable catalog is still traversed.
|
|
56
|
+
*/
|
|
57
|
+
readonly reason: 'corrupt' | 'unsupported' | 'unavailable';
|
|
58
|
+
};
|
|
59
|
+
/** Durable parent/child browsing address; unknown mode is resolved when child history is read. */
|
|
60
|
+
export type SubagentAddress = {
|
|
61
|
+
readonly parentSessionId: SessionId;
|
|
62
|
+
readonly childSessionId: SessionId;
|
|
63
|
+
} & ({
|
|
64
|
+
readonly mode: 'one-shot';
|
|
65
|
+
} | {
|
|
66
|
+
readonly mode: 'continuable';
|
|
67
|
+
} | {
|
|
68
|
+
readonly mode: 'unknown';
|
|
69
|
+
});
|
|
70
|
+
/** One human message addressed to a continuable direct child. */
|
|
71
|
+
export interface SubagentPromptRequest {
|
|
72
|
+
/** Identity persisted on the accepted message, minted before the call. */
|
|
73
|
+
readonly requestId: SubagentPromptRequestId;
|
|
74
|
+
readonly parentSessionId: SessionId;
|
|
75
|
+
readonly childSessionId: SessionId;
|
|
76
|
+
/** Required discriminator retained from the browser control address. */
|
|
77
|
+
readonly mode: 'continuable';
|
|
78
|
+
/** Whether this message queues a later turn or targets the nearest step. */
|
|
79
|
+
readonly delivery: 'queue' | 'steer';
|
|
80
|
+
/**
|
|
81
|
+
* Browser prompt parts delivered as the child's user message. The Host
|
|
82
|
+
* admits and persists image parts before delivery, so the wire never
|
|
83
|
+
* carries a durable attachment reference the caller could fabricate.
|
|
84
|
+
*/
|
|
85
|
+
readonly content: readonly PromptContentPart[];
|
|
86
|
+
/** Optional browser zone sampled for this exact human prompt. */
|
|
87
|
+
readonly clientTimeZone?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Inbox identity returned once the continuation accepts one human message. */
|
|
90
|
+
export interface SubagentPromptReceipt {
|
|
91
|
+
readonly messageId: MessageId;
|
|
92
|
+
}
|
|
93
|
+
/** Uniform acknowledgement that one interrupt request was admitted. */
|
|
94
|
+
export interface SubagentInterruptReceipt {
|
|
95
|
+
readonly accepted: true;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Failure details the control surface answers with. Prompts and interrupts
|
|
99
|
+
* share these failures with the Client Remote result.
|
|
100
|
+
*/
|
|
101
|
+
declare module '@deepseek-ai/dsh-workspace/types' {
|
|
102
|
+
interface SessionActivityKindMap {
|
|
103
|
+
/** A subagent session delegated from this session (at any depth) is inside a turn. */
|
|
104
|
+
subagent: true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
108
|
+
interface RemoteErrorDetailsMap {
|
|
109
|
+
/** A browser-supplied zone is neither UTC nor a canonical IANA name. */
|
|
110
|
+
'subagent/invalid-time-zone': {
|
|
111
|
+
readonly value: string;
|
|
112
|
+
};
|
|
113
|
+
/** No live Agent carries the addressed parent session. */
|
|
114
|
+
'subagent/parent-unavailable': {
|
|
115
|
+
readonly parentSessionId: SessionId;
|
|
116
|
+
};
|
|
117
|
+
/** The addressed child cannot take a continuation. */
|
|
118
|
+
'subagent/not-resumable': {
|
|
119
|
+
readonly childSessionId: SessionId;
|
|
120
|
+
};
|
|
121
|
+
/** The claimed parent does not own the addressed child. */
|
|
122
|
+
'subagent/unauthorized': {
|
|
123
|
+
readonly childSessionId: SessionId;
|
|
124
|
+
};
|
|
125
|
+
/** Image admission or model image-capability refusal. */
|
|
126
|
+
'subagent/attachment-invalid': {
|
|
127
|
+
readonly reason: string;
|
|
128
|
+
};
|
|
129
|
+
/** The child exists but its inbox cannot admit the message now. */
|
|
130
|
+
'subagent/delivery-unavailable': {
|
|
131
|
+
readonly childSessionId: SessionId;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=control-types.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-facing subagent prompt and interrupt request validation plus the
|
|
3
|
+
* stable prompt failure codes returned by the Remote surface.
|
|
4
|
+
*
|
|
5
|
+
* @module @deepseek-ai/dsh-subagent
|
|
6
|
+
*/
|
|
7
|
+
import type { SessionId } from '@deepseek-ai/dsh-session';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
declare const CONTROL_ID_SCHEMAS: {
|
|
10
|
+
readonly 'subagent.prompt': z.ZodObject<{
|
|
11
|
+
parentSessionId: z.ZodString;
|
|
12
|
+
childSessionId: z.ZodString;
|
|
13
|
+
mode: z.ZodLiteral<"continuable">;
|
|
14
|
+
delivery: z.ZodEnum<{
|
|
15
|
+
queue: "queue";
|
|
16
|
+
steer: "steer";
|
|
17
|
+
}>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
readonly 'subagent.interrupt': z.ZodObject<{
|
|
20
|
+
parentSessionId: z.ZodString;
|
|
21
|
+
childSessionId: z.ZodString;
|
|
22
|
+
mode: z.ZodLiteral<"continuable">;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Apply the subagent payload checks that are stricter than generated
|
|
27
|
+
* branded-string codecs.
|
|
28
|
+
* @param method - method name carried in the failure message.
|
|
29
|
+
* @param payload - decoded control fields to validate.
|
|
30
|
+
* @throws {RemoteError} `gateway/bad-request` with the original Zod issues.
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateControlRequest(method: keyof typeof CONTROL_ID_SCHEMAS, payload: unknown): void;
|
|
33
|
+
/**
|
|
34
|
+
* Refuse one continuation prompt without exposing provider detail: admission
|
|
35
|
+
* failures the caller can act on keep their own code, everything else is
|
|
36
|
+
* internal.
|
|
37
|
+
* @param error - the thrown value.
|
|
38
|
+
* @param childSessionId - the addressed child.
|
|
39
|
+
* @param signal - the caller's cancellation.
|
|
40
|
+
* @returns Never — the refusal is thrown.
|
|
41
|
+
* @throws {RemoteError} always.
|
|
42
|
+
*/
|
|
43
|
+
export declare function rejectPrompt(error: unknown, childSessionId: SessionId, signal: AbortSignal): never;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=control.d.ts.map
|