Discover MCPs & agents
Loading MCPs and agents…
Loading MCPs and agents…
Tauri 2 (Rust) port of Buddy — a macOS desktop app for dual-AI-agent collaborative coding (Claude Code / Codex / Cursor CLI / OpenCode / Kimi Code). Research experiment in AI-assisted stack migration from Electron to Tauri. 研究性实验项目。
Jump to setup instructionsFetched from the repository for this visit.
⚠️ 项目说明:研究性实验,非稳定项目
本仓库是为了**研究「用 AI 编程切换开发方案」**而产生的实验项目——即探索如何让 AI Agent 将一个完整的 Electron 应用移植到 Tauri 2(Rust 后端)。它不是一个面向生产环境的稳定项目,功能与质量不做保证。
如果你希望更好地体验和使用 Buddy,请使用原项目:
Buddy 是一个双 AI Agent 协作编码的 macOS 桌面应用(两个 AI Actor 轮流工作,双确认结束)。本仓库是它的 Tauri 2 移植实验版:后端由 Node.js 主进程重写为 Rust,前端渲染代码原样复用,数据目录与原版兼容。
type=break 才结束任务,单方 break 不终止rustup)、Node.js >= 18、pnpm 11从源码构建:
pnpm install
pnpm dist
DMG 输出在 src-tauri/target/release/bundle/dmg/ 目录。
pnpm install # 安装依赖
pnpm dev # 前端开发模式(仅 vite HMR,无后端)
pnpm tauri:dev # 完整开发模式(Rust 后端 + 前端 HMR)
pnpm test # 前端单元测试 (vitest)
pnpm test:rust # Rust 单元测试 (cargo test --manifest-path src-tauri/Cargo.toml)
pnpm typecheck # 类型检查
pnpm dist # 构建 .app + DMG,成功后自动清理中间文件,只保留产物
pnpm tauri build # 原始 tauri build,不自动清理
pnpm clean # 预演清理构建残留;加 --yes 才真正删除
pnpm dist / pnpm tauri:build 构建成功后会删除 target/debug、release 中间目录、临时 rw.*.dmg 和 dist/,因此下次构建、pnpm tauri:dev 或 cargo test 需要全量编译;设置 BUDDY_KEEP_BUILD_CACHE=1 可跳过清理。构建失败时不清理,便于排查。
Tauri 2 架构:Rust 后端承担原 Electron 主进程的全部职责,前端渲染代码与原版一致。桥接层 src/lib/tauri-bridge.ts 在 window 上挂出与原版 preload 同名同形的 window.buddy / window.api,内部走 @tauri-apps/api 的 invoke/listen。
┌──────────────────────────────────────────────┐
│ Rust Core (src-tauri) │
│ BuddyCoreService │
│ ├── BuddyStore (原子写入持久层) │
│ ├── BuddyRunner (状态机 + 子进程调度) │
│ ├── BuddyEventBus (事件发布/订阅) │
│ └── QueueCoordinator (指令队列协调) │
│ │
│ Launchers → Claude / Codex / Cursor / OpenCode / Kimi │
│ Git Integration → diff / status / commit │
└──────────────────┬───────────────────────────┘
│ Tauri IPC (buddy_* commands)
│ 事件推送 buddy:event
┌──────────────────┴───────────────────────────┐
│ Webview (前端) │
│ React 18 + TanStack React Query 5 │
│ tauri-bridge.ts → window.buddy / window.api │
│ ┌────────┬──────────────┬──────────────┐ │
│ │Sidebar │ Chat │ Right Panel │ │
│ │ 260px │ (flex) │ 400px │ │
│ └────────┴──────────────┴──────────────┘ │
└──────────────────────────────────────────────┘
READY → RUNNING_{ACTOR} → (READY | PAUSED | DONE)
↓
FAILED (recoverable)
↓
PAUSED
type=break → DONERUNNING_* 状态的任务自动重置为 PAUSED纯文件系统,无数据库。与 Electron 版共享同一数据目录 ~/Library/Application Support/buddy/,JSON 字段名逐字节兼容(由 src-tauri/src/buddy/types.rs 保证),任务可在两版之间无缝切换。
buddy/
├── global/
│ └── settings.json # 全局设置
└── workspaces/
└── {project-hash}/
├── workspace.json
└── tasks/
└── {task_id}/
├── state.json # 任务状态
├── settings.json # 任务设置
├── task.md # 任务目标
├── context.md # 上下文
├── events.jsonl # 事件流
├── transcript.jsonl # 对话记录
└── artifacts/ # 产物文件
所有 JSON 写入均为原子操作(.tmp → rename),schema 在读取时校验(前向兼容)。
invoke('buddy_xxx') ↔ Rust #[tauri::command] buddy_xxx。原 Electron 的 buddy:xxx channel 一一对应 snake_case command buddy_xxx,参数以单个 camelCase 对象传递app.emit('buddy:event', ...) → 前端 listen('buddy:event'),由 BuddyEventBus(tokio broadcast)转发| Actor | 调用方式 | Session 复用 |
|---|---|---|
| Claude | {cmd} -p --output-format stream-json --input-format text [--resume SID] | --resume |
| Codex | {cmd} exec --json -C REPO -o OUTPUT [resume SID] | exec resume |
| Cursor | {cmd} --print --force --output-format stream-json [--resume SID] PROMPT | --resume |
| OpenCode | {cmd} run --format json [--session SID] | --session |
| Kimi | {cmd} --print --output-format stream-json --input-format text [--session SID] | --session |
| DeepSeek Harness | {cmd} --profile headless --json [--session-id SID](prompt 经 stdin) | --session-id |
| CodeBuddy | {cmd} -p --output-format stream-json --input-format text [--resume SID] | --resume |
非原生命令使用契约模式,传递 BUDDY_ACTOR、BUDDY_MODE 等环境变量。
| 层面 | 选型 |
|---|---|
| 运行时 | Tauri 2(Rust 后端 + 系统 Webview) |
| 后端语言 | Rust(src-tauri/src/buddy/) |
| 前端语言 | TypeScript 5 |
| UI | React 18 + Tailwind CSS 3 |
| 构建 | Vite 7 + tauri-cli |
| 包管理 | pnpm |
| 打包 | tauri bundler (DMG) |
| PTY | portable-pty crate |
| Schema | serde + 读时校验(schemas.rs) |
| 自动更新 | tauri-plugin-updater |
| 图标 | lucide-react |
| i18n | 自定义 hook,CJK 自动检测 |
.tmp → rename,不做直接写入src-tauri/src/buddy/schemas.rs,读取时校验redact.rs)useI18n hook 国际化buddy:xxx ↔ buddy_xxx,与 tauri-bridge.ts 逐一对应MIT
GitHub checked 16h ago - refresh overdue. Recently viewed repositories target hourly refresh.
Find a documented setup for your client. No sign-in, installation, or tool execution.
If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.