目录:ACP 协议API 网关与控制器附件启动与插件管理客户端运行时客户端 UI 包上下文压缩上下文注入核心运行时凭据与授权交付物文档处理实验特性宿主扩展反馈通道文件系统目标与计划工具守卫Hooks 扩展宿主服务交互命令作业调度LLM 适配LSP 集成MCP 协议规划模式Agent 预设代码执行运行时运行时诊断沙箱定时调度SDK 与协议会话核心会话检索设置Shell 执行技能溢出存储SSH 远程执行存储子代理子进程终端待办类型契约框架 vendorWeb 访问Webhook工作流工作区
依赖链 · 上游(该插件依赖的前驱):
依赖链 · 下游(依赖该插件的节点):
dsh-api-job-controllerdsh-api-remotesdsh-api-session-controllerdsh-api-terminal-controllerdsh-api-workspace-controllerdsh-api-workspace-filesdsh-client-ui-open-in-appdsh-client-ui-sidebar-documentpreviewdsh-experimental-client-ui-voice-inputdsh-experimental-webworker-runtime
同一拓扑层(Layer 3,层次遍历层序):
dsh-api-gatewaydsh-commandsdsh-config-editordsh-deepseek-account-platformdsh-experimental-webworker-runtimedsh-hook-protocoldsh-host-frontend-staticdsh-host-open-in-appdsh-llm-pi-aidsh-personadsh-session-log-deepseekdsh-session-persistence-jsonldsh-session-projectiondsh-session-query-sqlitedsh-session-telemetry-oteldsh-skill-badgedsh-skill-filesystemdsh-skill-officedsh-user-approvaldsh-web-fetch-httpdsh-web-search-exadsh-web-search-perplexitydsh-webhook-githubdsh-workspace
插件信息
| 包名 | @deepseek-ai/dsh-api-gateway |
|---|---|
| 分组 | G02 · API 网关与控制器 |
| 拓扑层 | Layer 3(层次遍历:被依赖方先于依赖方) |
| 源码路径 | packages/api/gateway |
① 实现逻辑
Host 侧 TypertGatewayService 继承 Service 并实现 TypertGateway,构造时向 connection 注册 /api RPC 拦截器、向 webServer 注册 WebSocket 多路复用路由 /api/remote.mux(存在 appReady 时等待其就绪再监听)(src/index.ts:226-277)。invoke/stream 经 prepareInvocation 解析 Typert 描述符(严格定义或 SRC 回退)、校验精确参数、解析 lookup/context provider,再以 Reflect.apply 调用业务方法并把结果编码为 RPC 结果 (src/index.ts:345-410, 686-877)。registerRemoteEvents 消费应用选定的唯一事件源:emit 通知广播给各客户端,Agent 作用域 waterfall 以事件 id 关联并在收到结果后继续/取消 (src/index.ts:285-311, 463-655)。客户端侧 apply() 安装 ClientRemoteService,暴露 ctx.remote 与 $stream/$host (src/client/index.ts:140-199)。
内部结构动态 DAG(深色主题:橙色=上游依赖 · 绿色=下游依赖 · 棕色=外部seam · 蓝=本插件)
本插件
上游依赖
下游依赖
外部 seam
② 注册/提供(provides)
- ctx.typertGateway(Typert Remote Host 调度器:invoke/stream/registerRemoteEvents 与载体无关的 wireStream 适配)
- ctx.remote(客户端侧生成式 Remote 命名空间服务,以及 $stream / $host 事实)
- WebSocket 多路复用端点 /api/remote.mux 与转发事件流端点 $events / $events/result
③ 依赖(depends_on · 上游前驱)
dsh-client-connectionE1+E2
承载 /api RPC 与对等 Peer 身份
src/index.ts:14 import + src/index.ts:233 connection.rpc.intercept
dsh-host-webserverE2
注册 WebSocket upgrade 路由
src/index.ts:16 import type + src/index.ts:261 webServer.registerUpgrade
④ 被依赖(dependents · 下游消费者)
dsh-api-remotes
注册转发事件源并使用客户端 Remote 载体
src/index.ts:6 import type + src/index.ts:42 ctx.typertGateway.registerRemoteEvents
dsh-api-session-controller
客户端 Remote 载体与失败类型
src/client/scope.ts:4 import + src/client/sessions/manager.ts:15 import
dsh-experimental-client-ui-voice-input
经网关检测语音后端可用性
src/client/readiness.ts:3 import '@deepseek-ai/dsh-api-gateway/client'
dsh-experimental-webworker-runtime
把 typert 流经 tunnel 转发到页面
src/worker-host.ts:26 import type { TypertGateway }