Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

dsh-gui-turn

Latest version: v1.0.0

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
npm package Publisher: suranxu
0 Stars
0 Forks
2 Versions
JavaScript Repo language

Scan summary

dsh-gui-turn was last scanned on 28 Nov 2026 at version 1.0.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 2 versions, all published on 28 Nov 2026.
  • Findings: No rules fired in version 1.0.0.

Versions

2 versions published
Versions and the rules that fired in each
VersionPublishedStatus
1.0.0 LATEST 28 Nov 2026 No rules fired
0.0.0-stage 28 Nov 2026 Not shown

No rules fired in 1.0.0

Findings

Findings for v1.0.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 1.0.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

dsh-gui-turn

dsh-gui-turn 是一个 DeepSeek Harness(DSH)桌面端插件:它把「跑一整轮 agent 对话」暴露成一条本机 loopback HTTP 接口,让 QQ 机器人、定时脚本、CLI 工具等外部进程,直接借用桌面端已经配好的模型、人设和 MCP 工具跑一轮,回答同时出现在桌面界面里并以 JSON 返回。

English one-liner: dsh-gui-turn is a DeepSeek Harness desktop plugin that exposes one full agent turn as a loopback HTTP route, so any local process can reuse the app's model, persona and MCP tools without the page token that /api/* requires.

外部进程  ──POST /gui-turn/turn──▶  dsh-gui-turn(在桌面端进程内)
                                     ├─ 注入本轮人设(systemPrompt)
                                     ├─ 起本轮 MCP 服务
                                     ├─ 工具白名单(默认只放行本轮 MCP)
                                     ├─ sessionController.prompt() → wait()
                                     └─ finally 全部释放
                                     ▼
                          回答显示在桌面界面 + 作为 finalText 返回
类型 DeepSeek Harness / DSH 插件(cordis 插件)
解决的问题 外部进程调桌面端 /api/* 一律 401,拿不到页面 token
对外接口 POST http://127.0.0.1:<port>/gui-turn/turn
运行环境 DSH 桌面端(Electron),需要 webServer 服务
语言 / 依赖 JavaScript(ESM),无第三方依赖
许可证 MIT

什么时候用这个插件

  • 你有一个 QQ / Discord / Telegram 机器人,想用桌面端那套已经调好的模型和提示词来回答,而不是另起一套 headless 实例。
  • 桌面端 App 开着的时候,headless 子进程抢不到会话(already owned by an active write handle),你需要一个「让桌面端自己跑一轮」的入口。
  • 你想让机器人临时拥有几个 MCP 工具,用完即走,不想污染全局工具集。
  • 你需要「回答既进界面、又能被程序读到」——用户看得到,脚本也拿得到。

什么时候别用

  • 只想要一个单纯的 MCP server:直接用 @modelcontextprotocol/sdk,不需要这个。
  • 没有桌面端(只用 CLI / headless profile):webServer 不存在,路由不会注册。
  • 想把它暴露到公网给远端调用:它只认 loopback,反代出去也仍然会拒。

和相邻方案的差别

方案 能复用桌面端的模型/人设/工具 回答进界面 外部进程能调 需要页面 token
直接调 /api/* ✅ ✅ ❌ 401 ✅ 需要(拿不到)
另起 headless 实例 ❌ 配置要重来 ❌ ✅ ❌
包一个独立 MCP server ❌ ❌ ✅ ❌
dsh-gui-turn ✅ ✅ ✅ ❌ 不需要

特性

  • 一轮一清理:人设段落、MCP 连接、工具白名单都挂在同一个 agent context 上,finally 里反向 dispose,超时和异常路径也不例外。
  • 工具默认不放行:不给 allowedTools 时,只有本轮 mcpServers 注册的工具可见,桌面端全局工具(shell、文件、插件管理)一律被 restrict() 屏蔽。
  • 人设按轮注入:systemPrompt 作为 order 120 的系统提示段落加入,interpolate: false。
  • MCP 即插即用:每个 mcpServers 项映射成 dsh-mcp-client 配置(stdio 或 URL),本轮结束连接即关。
  • 端点自动发现:把 {origin, pid, at} 写进 $DSH_HOME/gui-turn.endpoint.json,App 换端口重启也不用改配置。
  • 只认 loopback:非 127.0.0.1 / ::1 直接 403;Origin 头与 App 不同源的跨站请求同样拒绝。

安装

  1. 克隆到任意目录:

    git clone https://github.com/SuRanHF/dsh-gui-turn.git
  2. 在你的 DSH profile 的 cordis.patch.yml 里挂上它(绝对路径):

    - insert:
        - id: dsh-gui-turn
          name: "file:///C:/path/to/dsh-gui-turn/index.js"

    也可以放进 profile 的 node_modules 后用包名 dsh-gui-turn 引用。

  3. 重启桌面端,确认端点文件生成:

    // $DSH_HOME/gui-turn.endpoint.json
    { "origin": "http://127.0.0.1:49213", "pid": 12345, "at": "2026-01-01T00:00:00.000Z" }

API

POST /gui-turn/turn

请求体上限 4 MiB,必须是 JSON。

字段 类型 必填 说明
prompt string ✅ 本轮用户输入,空白字符串会被拒
sessionId string 指定已有会话;不传则新建(响应 created: true)
cwd string 新建会话时匹配已注册 Workspace;匹配不到则作为 cwd
agentPreset string 新建会话使用的 agent preset
systemPrompt string 本轮人设,作为系统提示段落注入
mcpServers array 本轮临时挂载的 MCP 服务
allowedTools string[] 全局工具白名单,支持 * / prefix* / 精确名;默认只放行本轮 MCP 工具
timeoutMs number 等待时长,1000–1800000,默认 600000

mcpServers[] 每项映射到 dsh-mcp-client 配置:

字段 说明
serverName ✅ 服务名,工具名形如 mcp__<serverName>__<tool>
transport stdio 或 HTTP 传输名
command / args stdio 启动命令
url 远程 MCP 端点
env 子进程环境变量
toolCallTimeoutMs 单次工具调用超时
响应
{
  "ok": true,
  "value": {
    "sessionId": "...",
    "created": false,
    "personaApplied": "system",      // system | none
    "allowedToolsApplied": ["mcp__sing__sing"],
    "restrictDebug": { "globalCount": 21, "allowedCount": 1, "visibleAfter": ["..."] },
    "toolsApplied": ["sing"],
    "toolsFailed": [],
    "toolErrors": [],
    "reason": "completed",
    "truncated": false,
    "finalText": "本轮最后一条 assistant 文本"
  }
}

失败时返回 { "ok": false, "error": { "code": "...", "message": "..." } }:

code HTTP 触发条件
bad-request 400 体过大 / 非 JSON / prompt 为空
forbidden 400 非 loopback 调用或跨源请求
method-not-allowed 405 非 POST
session/agent-unavailable 400 会话拿不到 agent context
gateway/internal 500 其他内部异常

例子

最小调用:

ORIGIN=$(node -p "require(process.env.DSH_HOME + '/gui-turn.endpoint.json').origin")
curl -s "$ORIGIN/gui-turn/turn" \
  -H 'content-type: application/json' \
  -d '{"prompt":"用一句话说明这个仓库干什么"}'

带人设 + 一个 MCP 工具 + 白名单(典型机器人用法):

{
  "prompt": "帮我把这句话改得更自然一点",
  "cwd": "C:/Users/me/Documents/work",
  "systemPrompt": "你是这个工作区里的助手,回答简短,不要客套。",
  "mcpServers": [
    {
      "serverName": "memory",
      "transport": "stdio",
      "command": "node",
      "args": ["C:/tools/memory-mcp.js"],
      "env": { "DATA_DIR": "C:/data/memory" },
      "toolCallTimeoutMs": 30000
    }
  ],
  "allowedTools": ["mcp__memory__*"],
  "timeoutMs": 120000
}

完整示例见 examples/:node-turn.mjs(Node 调用 + 端点发现)、curl.ps1。

安全模型

  • 只有本机:remoteAddress 必须是 127.0.0.1 / ::1,否则 403。不要反代到公网。
  • 跨站拒绝:请求带 Origin 且不等于 App 自身 origin 时拒绝,避免浏览器页面顺手打一枪。
  • 工具最小可见:不传 allowedTools 就只给本轮 MCP 工具;能执行命令、读文件、改插件的全局工具不会因为一条 curl 就交出去。
  • 无残留:本轮注入的一切都在 finally 里释放,异常与超时路径同样释放。

常见问题(FAQ)

dsh-gui-turn 是什么? 一个 DeepSeek Harness 桌面端插件,把「跑一整轮 agent 对话」暴露成本机 loopback HTTP 接口 POST /gui-turn/turn,让外部进程借用桌面端的模型、人设和 MCP 工具。

它和 DeepSeek Harness 官方的 HTTP API 有什么区别? 官方 /api/* 命名空间对外部进程返回 401,因为页面 token 是启动时注入 renderer 的。这个插件在 App 进程内部注册路由,走进程内的 sessionController,不需要 token。

*为什么不能直接在外部调 `/api/?** 因为拿不到页面 token,且/api/*` 对非页面来源一律拒绝。这是设计使然,不是配置问题。

支持 QQ 机器人吗? 支持,这也是它最初的用途:机器人进程通过 localhost 发一轮请求,人设和 MCP 工具按轮传入,用完即弃,桌面端的全局工具不会暴露给群聊。

回答会不会出现在桌面界面里? 会。走的是真实的 session(会话),回答既渲染在界面上,也作为 finalText 返回给调用方。

会不会污染我已经配好的人设和工具? 不会。人设是 order 120 的临时系统提示段落,MCP 连接是本轮临时实例,工具白名单是本轮 restrict(),全部在 finally 释放。

能同时跑多轮吗? 同一会话用 mode: 'queue',并发请求排队;不同会话互不影响。

需要 Node 环境吗? 不需要单独装。插件跑在桌面端主进程里,MCP 客户端从安装目录的 app.asar 动态加载。

在 headless / CLI profile 上能用吗? 不能。它依赖 webServer,headless profile 没有这个服务,路由不会注册。

DSH 升级会不会坏? 有可能。它用到 sessionController.resolveAgent、tools.restrict、systemPrompt.section 等非公开接口,大版本变动时需要跟着改,README 会同步更新。

兼容性

项 要求
宿主 DeepSeek Harness 桌面端(Electron),含 webServer / sessionController / workspaceRegistry
Node >= 22(宿主自带运行时)
平台 Windows / macOS / Linux(跟宿主一致)
协议 HTTP/1.1,JSON body,4 MiB 上限

已知限制

  • 只适用于桌面端,headless / CLI 不行。
  • 紧跟 DSH 内部 API,大版本升级可能需要跟着改。
  • MCP 客户端从安装目录加载;自定义安装路径需要设 DSH_INSTALL_DIR。
  • 一次一轮:同一会话并发会排队。

License

MIT © 2026 SuRanHF

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm dsh-gui-turn

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Ethersphere Hijacked With Crypto Stealing Malware (1)
npm

Ethersphere Hijacked With Crypto Stealing Malware Via Github & npm

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Frame 2085668439 (1)
Group 1261154229