Smalldy/godot-bridge
关于
DSH (DeepSeek Harness) plugin that launches and drives a running Godot 4.x game through its in-game TCP interaction server — replaces the godot-mcp MCP server with native agent tools.
游戏与模拟器实测星标增长
- 24小时
- -1
- 7天
- 0
- 15天
- +3
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.zh-CN.md
原文English | 中文
godot-bridge
这是什么
GodotBridge 是一个原生 DeepSeek Harness (DSH) 插件,用于 AI 辅助游戏开发。它包含两个组件:
- GodotBridge 通过游戏内置的 TCP 交互服务器连接运行中的 Godot 4.x 游戏,让 Agent 查看当前画面、操作游戏并验证改动;同时也能创建和修改项目里的脚本、场景、资源、设置,并执行 headless 导出等操作。
- 任务中心 基于 DSH 原生的智能体团队能力,把需求对齐、代码开发、独立评审、独立测试和合并串成一条流水线。每张任务卡在自己的 git worktree 中执行,按依赖排队,并用文件锁隔离写入;不相关的任务可以并行,不会互相覆盖。
在对话中使用:
/godot-bridge-task-center-init
激活任务中心后,可以直接和当前对话里的 Agent 对齐需求,创建“开发”或“调查”任务卡。任务完成后会经过独立评审和测试,再由宿主合并;如果 target 移动或出现合并冲突,会重建候选并重测,而不是合并过期结果。
GodotBridge 已在 GitHub 开源,并已收录于 DSH 插件市场。任务中心本身也是在任务中心里持续迭代的。
技术形态
原生 DeepSeek Harness (DSH) 插件:通过游戏内置的 TCP 交互服务器,启动并操控运行中的 Godot 4.x 游戏——以原生 Agent 工具取代 godot-mcp MCP 服务器。
无需 MCP 协议、无需 Python 服务器、无需编辑器插件。游戏侧零改动:McpInteractionServer(mcp_interaction_server.gd autoload)本就在 127.0.0.1:9090 监听,采用换行分隔的 JSON 协议——godot-bridge 在 DSH host 内部原生使用同一种协议。
工具
| 工具 | 取代 (godot-mcp) | 用途 |
|---|---|---|
godot_run_project |
run_project |
启动项目(默认不带本地调试器,eval 可直接用;debug:true 为诊断模式),等待 9090 就绪 |
godot_stop_project |
stop_project |
终止游戏进程(tree-scoped kill) |
godot_get_debug_output |
get_debug_output |
增量读取已启动进程的 stdout/stderr |
godot_command |
全部 game_*(约 105 个) |
发送任意交互服务器命令:get_scene_tree、get_ui_elements、eval、get/set_property、call_method、click、key_press、screenshot、raycast、serialize_state、ui_*…… |
godot_screenshot |
game_screenshot |
视口截图(base64 PNG) |
godot_ping |
— | 探测游戏是否在 9090 应答(并报告已装/最新插件版本) |
godot_set_engine_path |
— | 把 Godot 引擎可执行文件路径写入插件配置(模型向用户索要路径后据此保存,热重载;返回 persisted: 'profile-patch') |
godot_headless_op |
read_scene、modify_scene_node、remove_scene_node、attach_script、create_resource、save_scene、create_scene、add_node、get_uid、manage_scene_signals…… |
headless 静态操作(godot --headless --script godot_operations.gd):16 个操作,无需运行游戏 |
godot_run_headless |
— | 非交互地有界运行项目、场景或测试脚本(godot --headless --path … [--quit-after N] [--script …]),经不受沙箱约束的 subprocess 服务启动;返回 stdout/stderr,并在命中时给出 sandbox-crash 诊断 |
godot_validate_script |
validate_script |
headless GDScript 编译检查(validate_script.gd)→ {valid, errors} |
godot_set_project_setting |
modify_project_settings、set_main_scene、manage_layers、manage_plugins、manage_translations |
在任意 project.godot 段设置类型化键值(PackedStringArray(...) / Vector2i(...) / bool 等) |
godot_manage_autoloads |
manage_autoloads |
列出/增删 autoload 单例(Name="*res://…") |
godot_manage_input_map |
manage_input_map |
列出/增删输入动作——正确的 Godot 4 键码(修复 godot-mcp 的 Godot 3 基线 bug) |
godot_manage_export_presets |
manage_export_presets |
列出/增删导出预设(export_presets.cfg) |
godot_create_script |
create_script |
GDScript 模板(extends / class_name / 方法桩 / 自定义源码) |
godot_create_project |
create_project / create_csharp_script |
项目脚手架,可选 Godot .NET .csproj |
godot_export_project |
export_project |
headless 导出(--export-release / --export-debug <预设> <输出>) |
其余 godot-mcp 工具是在 MCP 服务器自己的 Node 进程里实现的:纯文件/编辑器操作由 DSH 原生文件工具覆盖;少数几个带 Godot 特有写逻辑(manage_input_map、manage_export_presets、modify_project_settings、项目/脚本模板生成等),通用编辑只能配合格式知识替代——完整对照见 COVERAGE.md。
任务中心(task-center)
任务中心是插件面向用户的那一半。你不需要自己调用 task_center;这些调用由 Agent 完成。 你的使用流程是:
- 在对话中输入
/godot-bridge-task-center-init激活。 - 说清目标、验收标准和涉及的文件或模块。
- 让 Agent 创建开发或调查任务卡。
- 看到 start 申请时批准;然后在面板里跟踪。评审、测试和合并会自动完成。
开发卡在自己的 git worktree 中工作,按依赖排队,并用文件锁隔离写入,所以不相关的卡可以并行且不会互相覆盖。调查卡交付的是报告,不是代码。如果 target 移动或出现合并冲突,会重建候选并重测,而不是合并过期结果。
进入方式(Agent 侧)
面板的“当前项目”按会话绑定:/state、/task、/list 和所有 action 都携带 ?session=<id>,宿主只读取该会话的绑定(state.sessionRootOf(id) 是唯一读取入口,不存在进程全局的项目槽位)。没有会话标识的请求处于未绑定态,绝不会借用其他会话的项目。
同一个包还会挂载第二个组件行 godot-bridge/task-center:项目级任务板 + 阶段驱动的派发器(含独立评审与测试)+ 文件锁 + 角色系统,以及中栏 GUI 面板(左侧栏「任务」)。
Agent 进入项目时会自己调用 task_center { action: "onboard" }。这个调用会解析项目根(显式 path,否则把会话工作区向上找到项目)、检查 git/Godot 标记、绑定看板、缺团队时自动补,最后返回一段简报和一个 next 步骤。新项目(只有 project.godot、还没 git init)和老项目(已有看板、卡住或待批准)都能自适应;找不到项目就请你给路径,绝不猜,也不会建卡或开启派发。
// Agent 侧调用,用户不需要输入。
task_center { action: "onboard" }
怎么运行
开发卡在自己的 git worktree 中工作,遵循 dependsOn,并锁定声明的写入文件。不相关的卡可以并行;有依赖的卡要等前一张完成并合并。评审和测试是独立角色,宿主只合并通过测试的候选。测试后 target 若移动,会重建候选并重测。调查卡交付报告,不交付代码。
完整状态机、看板 schema、动作 API、角色系统和 harness 细节见任务中心深入实现。
已知限制
- 状态页的会话行只提供「复制会话 ID」。要打开对话,请用侧栏的**「打开对话」动作(或打开卡片的侧栏 tab,再点其中的「打开对话」**);这两种方式都会切换到宿主会话。
- Godot 必须通过
godot_*工具启动,不能走 shell 工具;见故障排查。 - 只有 target ref 真的前进了才记录 merge;不一致时任务停在 testing 并返回
target-not-advanced,需要 reopen 或修复。 - 上一任执行者仍活着且拒绝被中断的卡会停在
pending等人工处理;already-dispatched既不消耗 attempt 也不增加 interruption。 - 历史测试事件里的 exit 与耗时取自任务最新一条测试记录(板子只保留当前轮),所以较早的失败行可能显示后来那一轮的数字;裁决标签和失败轮的 note 仍属于该事件。
运行 npm test 覆盖 board / service / locks / dispatch / git / harness / routes / tool / activation / target 历史 与浏览器半侧。
环境要求
- DSH 0.2.2-rc.2 或更新版本的桌面版 / 网页版(最低要求是具名子代理 / AgentTeam 重构版);CLI-only 会话不支持
- 注册了
McpInteractionServerautoload 的 Godot 4.x 项目。若项目还没有,把plugin/mcp_interaction_server.gd复制到项目根,并以McpInteractionServer命名注册为 autoload(godot-mcp 项目已具备)。godot_run_project也会在缺失时自动安装(把随包文件复制进autoload/并在project.godot注册)——无需手动处理;非 Godot 项目完全不受影响。 node在 PATH 中- DSH Agent Teams 服务(worker / reviewer / tester 的 provision 能力)。缺少时任务卡保持 pending,并明确报告缺少服务。
- Godot 可执行文件——按此顺序解析:每次调用的
godot_path参数 →godotPath插件设置(tool-godot-bridge行的配置:godot-bridge 卡片页上的Godot engine path字段,或godot_set_engine_path工具)→ PATH 上的godot命令。godot已在 PATH 时无需任何配置;否则填你的引擎路径(插件作者不预设路径——Godot 是便携 exe,可能位于任意位置)。务必用真实 exe 完整路径,不要用版本管理器的 shim;见故障排查。
安装
GodotBridge 支持 DSH 桌面版 和 DSH 网页版;不支持 CLI-only 会话。
桌面版
打开 DSH 插件市场,搜索 godot-bridge,安装后重启 DSH。不需要命令行。
DSH 网页版
把 bundle 加入 Web profile:
dsh plugin --profile web add github:Smalldy/godot-bridge
这是 Web profile 命令,不是通用 CLI 安装方式。dsh plugin 是 pnpm 转发器:把包装进 profile 的 node_modules,并因包内声明 dsh.bundle(其 cordis.patch.yml 插入 tool-godot-bridge 行)而把它追加进该 profile 的 dsh.profile.bundles 层列表。web 就是 Web 应用启动所用的标准 profile——这条命令把工具加进标准模式,不会新建 profile。重启后该 profile 的会话都有 17 个 godot_* 工具。已收录于 awesome-dsh-plugin 社区清单(topic:dsh-plugin)。
在网页版上,这条命令也可安装本地 checkout 或 tarball(dsh plugin --profile web add ./path/to/godot-bridge)。
插件是标准 DSH bundle 模块:
import { defineTool } from '@deepseek-ai/dsh-tools'并经ctx.tools.register注册。它必须通过上面的 bundle 机制安装。DSH 通过 launcher 的 runtime resolution 从自己的安装里提供@deepseek-ai/*:装进 profile 的包会自动解析;而link:/符号链接的 checkout 只有在插件自己的peerDependencies里声明了这些包名时才会被路由(godot-bridge ≥ 0.1.8 已声明——见 DSH 0.2+ 兼容性与故障排查)。不要把文件复制进用户 agent 预设(~/.dsh/.agent-presets/...);那个位置不在任何解析范围内,解析不到@deepseek-ai/dsh-tools。
移除
- 桌面版:在 DSH 插件市场移除
godot-bridge。 - DSH 网页版:
dsh plugin --profile web remove godot-bridge
从 profile 中删除该包及其 godot-bridge bundle 层——重启后该 profile 的会话不再有 17 个 godot_* 工具。标准 web profile 本身不受影响(这条命令从不创建或删除 profile)。先 godot_stop_project 停掉运行中的游戏;插件卸载清理也会终止它启动的 Godot 子进程。任何时候可从桌面版插件市场重新安装,或在网页版用上面的 add 命令。
DSH 0.2.2+ 兼容性与故障排查
最低版本是 DSH 0.2.2-rc.2:这一版引入具名、多层子代理和按会话启用的 AgentTeam,任务中心依赖这套模型。DSH 0.2 用进程内的 runtime resolution 取代了旧的物理 module-fallback 层:launcher 把它装进 Node 的 ESM 与 CommonJS 解析器。解析器会针对「哪个模块在 import」决定是否把裸 @deepseek-ai/* 说明符路由到安装版自己的副本——这正是依赖 harness 包的插件能否加载的前提:
- 装在 profile 内(
dsh plugin add github:…、tarball,或任何位于$DSH_HOME/profiles/<name>/node_modules下的副本):harness 包自动从安装版解析,无需任何声明。 - 以
link:安装(符号链接指向本地 checkout):插件真实路径落在 profiles 树之外,而 Node 的 ESM loader 会先 realpath 再 import。这种 linked root 只有在插件自己的peerDependencies里声明了该包名时才会被路由——解析器读的是peerDependencies的键,不是dependencies。godot-bridge 0.3.0 声明了@deepseek-ai/dsh-tools与@deepseek-ai/schemastery,并标记 optional,避免 pnpm 去 registry 安装 harness 包。
症状
| 症状 | 含义 | 处理 |
|---|---|---|
17 个 godot_* 工具全部消失,launcher 日志出现 ERR_MODULE_NOT_FOUND: Cannot find package '@deepseek-ai/dsh-tools' imported from …/godot-bridge.mjs |
harness 包没有被路由到安装版副本。对 link: 安装而言就是 peerDependencies 缺声明 |
改用非符号链接安装,或确保 peerDependencies 包含 harness 包 |
launcher 打印 dsh: skipping profile bundle "godot-bridge": …,插件页显示错误 |
声明的 DSH peer 范围与当前运行时版本不匹配。未声明 peer 不构成约束,因此不会产生这条信息 | 升级插件;或显式接受风险:dsh plugin --profile <profile> allow-version godot-bridge@<version> --dsh-version <runtime> --accept-risk |
godot-bridge 卡片上看不到 Godot engine path 字段 |
注册本组合包配置区(keyed slot plugins.bundle.config,以包名为键)的浏览器半侧没有加载:本组合包唯一那行被关闭、更新后没有重启宿主、或安装的副本早于浏览器半侧 |
升级并重启 DSH;若该行是关闭状态请打开;否则用 godot_set_engine_path 设置,或给该行加 config: 块(见安装文档) |
升级说明:0.2 之前的 godot-bridge: 设置段不会按 entry id 迁移;如果 tool-godot-bridge 行的 godotPath 为空且旧文件仍存在,插件会写回一次,否则用 godot_set_engine_path 重新设置。
验证
npm run check # 静态契约检查——不需要 DSH
node scripts/diagnose-dsh-resolution.mjs --profile <profile> --expect ok # 需要已安装的 DSH 应用
npm run check 会在「裸 @deepseek-ai/* import 未在 manifest 声明」「bundle patch 缺失或未引用本包」「入口丢命名导出」,或「浏览器半侧破坏自身契约」时失败:宿主不读的 dsh.client 成员、不是 web 的 platform、缺失或未被 files 覆盖的 exports["./client"] 目标、不等于包名的 __ModuleLoader__ id、落在平台种子模块表之外的 require()、不等于本包名的 plugins.bundle.config 键、以及指向本包 patch 未声明行的 plugins.row.config 键。诊断脚本会打印 profile 的 bundle 层、被 skip 的 bundle、识别到的 linked root,以及插件每个 harness import 的解析结果——修复前后各跑一次,或在 DSH 再次改动解析规则时用来定位。
随后重启 DSH(或在插件页重新加载 profile),确认新会话里出现 17 个 godot_* 工具。
更新提示
插件加载时会做一次尽力而为的版本检查:抓取仓库 main 分支的 package.json(raw.githubusercontent.com,5 秒超时,失败/离线时静默跳过),与已安装版本比较。存在更新时注册一条系统提示(system-prompt section),让模型在每个会话里转达 "godot-bridge 有可用更新:已装 X,最新 Y",直到插件更新(dsh plugin --profile web update godot-bridge,然后重启 DSH)为止。godot_ping 也会额外返回 plugin_version / latest_version / update_available,可随时按需查询。
发布更新:在 package.json 里递增 version(这是发布标记)并推送——版本没变就不会触发提示。fork 场景:设置 package.json 的 repository 后,检查会自动跟随你的 fork。
已知限制:提示是系统提示 section,所以 persona 为 complete/抑制型(如极简模式 minimal)的预设不会显示;检查需要启动时能联网。
用法
godot_run_project # 启动游戏(默认当前 workspace)
godot_ping # 确认 9090 应答
godot_command get_scene_tree # 查看场景图
godot_command get_ui_elements
godot_command eval {code: "return get_tree().current_scene.name"}
godot_command click {x: 576, y: 300}
godot_screenshot # 查看游戏画面
godot_get_debug_output # 读取启动日志
godot_stop_project # 结束
Godot 可执行文件解析顺序:每次调用的 godot_path 参数 → godotPath 插件设置(tool-godot-bridge 行的配置:godot-bridge 卡片页上的 Godot engine path 字段,或 godot_set_engine_path 工具)→ PATH 上的 godot 命令。godot 已在 PATH 时无需配置;否则填引擎路径,务必指向真实 exe,别用 shim。
延伸阅读
项目结构
plugin/godot-bridge.mjs # 插件入口(标准 DSH 模块,命名导出 name/inject/apply)
plugin/task-center/ # 任务中心宿主半侧(schema / board / service / locks / dispatch / merge / git / api / state / tool / routes / skill / harness / index)
client/client.js # 浏览器半侧:引擎路径配置 + 任务中心面板(dsh.client)
plugin/mcp_interaction_server.gd # 取自 godot-mcp(MIT)——游戏内 TCP 服务器 autoload
plugin/godot_operations.gd # 取自 godot-mcp(MIT)——headless 操作脚本
plugin/validate_script.gd # 取自 godot-mcp(MIT)——GDScript 编译检查
package.json # dsh.bundle + dsh.client manifest(供 `dsh plugin add` 安装)
cordis.patch.yml # bundle patch 层(插入工具行)
install.md / install.zh-CN.md # 详细安装与维护说明
ARCHITECTURE.md / ARCHITECTURE.zh-CN.md # 如何取代 godot-mcp + 协议细节
COVERAGE.md / COVERAGE.zh-CN.md # 与 godot-mcp 的逐工具对比
CHANGELOG.md / CHANGELOG.zh-CN.md # 版本发布记录
scripts/check-plugin-contract.mjs # 静态依赖契约检查(`npm run check`)
scripts/check-target-history.mjs # 分支保护历史守卫(`npm run check:target`)
scripts/setup-hooks.mjs # 安装 pre-commit target 守卫(`npm run hooks:install`)
scripts/diagnose-dsh-resolution.mjs # 可重跑的 DSH 运行时解析诊断(仅开发用)
任务中心会在 <项目>/.agents/ 下写项目级运行态文件:tasks.json(任务板)、roles.json(角色 profile),以及可选的 test-harness.json(机器本地的 harness 路径)。它们是运行态而非源码——请加入 .gitignore。
mcp_interaction_server.gd、godot_operations.gd 与 validate_script.gd 取自 godot-mcp(MIT,随包内置)。插件通过模块相对路径定位这些脚本(import.meta.url);传显式 ops_script / validate_script 参数可覆盖。
许可证
MIT
探索相关项目
加载中…