gemini-agent-bridge 0.0.0-stage → 0.1.0
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 +69 -2
- package/dist/cli.js +4492 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +687 -0
- package/dist/index.js +4338 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 gemini-agent-bridge contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,70 @@
|
|
|
1
|
-
#
|
|
1
|
+
# gemini-agent-bridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](#english) | [中文说明](#中文说明)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 中文说明
|
|
8
|
+
|
|
9
|
+
**`gemini-agent-bridge`** 是一个打包为标准 npm 可执行包(零原生 C++ 依赖、纯 TypeScript ESM)的 **Model Context Protocol (MCP) Server**,专为 **Gemini Mac 桌面版(`Gemini.app`)**、**Antigravity** 与 **Gemini CLI** 设计。
|
|
10
|
+
|
|
11
|
+
它让 Gemini 扮演 **Tech Lead / 验收审查官**,在隔离工作区中指挥本机开源 AI Coding Agent(**`pi`** 与 **`opencode`**)完成编码与分析任务,并将可验证的结构化交付包交回 Gemini 进行检验、打回返工、核准合入或安全废弃。
|
|
12
|
+
|
|
13
|
+
### 核心特性
|
|
14
|
+
|
|
15
|
+
- **工作区强制隔离**:
|
|
16
|
+
- Git 仓库默认创建外置 `git worktree`(存放在 `~/.local/share/gemini-agent-bridge/worktrees/...`)与独立分支 `agent/<agent>/<taskId>`,核准前绝不污染主工作区;
|
|
17
|
+
- 非 Git 目录自动支持 `staging`(隔离拷贝 -> 真实 diff -> 冲突检查回写)与 `direct`(SHA-256 变更追踪)以及 `readonly`。
|
|
18
|
+
- **双 Agent 深度原生驱动**:
|
|
19
|
+
- **`pi`(原生 `--mode rpc` 双向 JSONL)**:支持中途纠偏 (`steer`)、追加 (`follow_up`)、扩展交互弹窗透传 (`extension_ui_request` -> `needs_input` -> `respond_task_input`)、Session 断点续跑及精确 token/费用统计;内置 **LF-only 字节流 JSONL 解析器**(规避 Node `readline` 对 `U+2028/U+2029` 误断行问题)。
|
|
20
|
+
- **`opencode`(`opencode run --format json --standalone --archived`)**:零端口稳定运行,支持 `--session` 多轮返工续跑、`--agent build|plan` 角色切换与 token/费用统计。
|
|
21
|
+
- **完整指挥与验收闭环(16 个 MCP 工具)**:
|
|
22
|
+
- 发现与自检:`list_agents`、`doctor`
|
|
23
|
+
- 派发与控制:`dispatch_task`、`wait_task`(支持 MCP `notifications/progress`)、`steer_task`、`respond_task_input`、`cancel_task`
|
|
24
|
+
- 检验与审阅:`list_tasks`、`get_task_deliverable`、`get_task_diff`(含新增文件 patch)、`read_task_file`、`get_task_logs`
|
|
25
|
+
- 验证与裁决:`verify_task`、`request_changes`(同 Session + 同 Worktree 多轮返工)、`approve_task`(默认 `apply_patch` 冲突预检落盘,亦支持 `merge_commit`/`squash_merge`/`fast_forward`/`keep_branch`)、`reject_task`
|
|
26
|
+
- **macOS GUI 沙箱与 PATH 深度适配**:
|
|
27
|
+
- 配置文件默认存于 `~/.local/share/gemini-agent-bridge/config.json`(无需在 Gemini Mac Local MCP 表单填写环境变量);
|
|
28
|
+
- 内置 `BinaryResolver` 自动探测 `~/Library/pnpm/bin`、`~/.opencode/bin`、`/opt/homebrew/bin`、`~/.npm-global/bin`、`~/.nvm` 等路径。
|
|
29
|
+
|
|
30
|
+
### 快速安装与挂载(Gemini Mac 版)
|
|
31
|
+
|
|
32
|
+
1. **初始化本机配置(自动记录 `pi` / `opencode` 路径)**:
|
|
33
|
+
```bash
|
|
34
|
+
npx -y gemini-agent-bridge init
|
|
35
|
+
# 或本地克隆构建后执行:
|
|
36
|
+
# npm install && npm run build && node dist/cli.js init
|
|
37
|
+
```
|
|
38
|
+
2. **在 Gemini Mac 版中挂载 Local MCP**:
|
|
39
|
+
- 打开 **`Gemini.app`** → **More** → **Connectors** → **+ Custom** → **Local MCP**
|
|
40
|
+
- **Server Name**:`Gemini Agent Bridge`
|
|
41
|
+
- **Description**:`Delegate coding tasks to local pi & opencode in isolated worktrees, verify & approve deliverables.`
|
|
42
|
+
- **Command**:`npx -y gemini-agent-bridge`(若使用本地安装或全局安装可填 `gemini-agent-bridge` 或 `node /abs/path/to/dist/cli.js`)
|
|
43
|
+
- **Customize Sandbox**:放行 **网络访问**、目标项目根目录(如 `~/Documents`),以及 Agent 二进制/配置目录(`~/Library/pnpm`、`~/.opencode`、`~/.pi`、`~/.config/opencode`、`~/.local/share/opencode`)。
|
|
44
|
+
3. **验证**:在 Gemini 中发送「调用 `doctor` 和 `list_agents` 检查状态」。
|
|
45
|
+
|
|
46
|
+
也可以运行 `gemini-agent-bridge setup --gemini-mac`(或 `--gemini-cli`、`--antigravity`)查看对应平台的详细配置片段。
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## English
|
|
51
|
+
|
|
52
|
+
**`gemini-agent-bridge`** is a zero-native-dependency TypeScript ESM **Model Context Protocol (MCP)** server packaged for `npm` / `npx`. It enables **Gemini for Mac (`Gemini.app`)**, **Antigravity**, and **Gemini CLI** to act as an engineering orchestrator & reviewer over local open-source AI coding agents (**`pi`** and **`opencode`**).
|
|
53
|
+
|
|
54
|
+
### Highlights
|
|
55
|
+
|
|
56
|
+
- **Isolated Execution**: Git repositories default to externalized `git worktree` branches (`agent/<agent>/<taskId>`); non-Git folders support `staging` (isolated copy with `git diff --no-index` previews & drift checking) and `direct`/`readonly` modes.
|
|
57
|
+
- **Native Protocol Drivers**:
|
|
58
|
+
- `pi --mode rpc` bidirectional JSONL (LF-only byte-stream parser safe against `U+2028`/`U+2029`), supporting `steer`, `follow_up`, `extension_ui_request` forwarding (`needs_input`), session resume, and exact usage/cost reporting.
|
|
59
|
+
- `opencode run --format json --standalone --archived` NDJSON driver with multi-round `--session` continuation and token/cost aggregation.
|
|
60
|
+
- **16 Orthogonal MCP Tools** with accurate `ToolAnnotations` and `notifications/progress` streaming for long-running tasks.
|
|
61
|
+
- **macOS GUI Friendly**: Reads settings from `~/.local/share/gemini-agent-bridge/config.json` (important because Gemini Mac's Local MCP form has no env-var fields) and augments `PATH` for `pnpm`, `opencode`, `homebrew`, `nvm`, etc.
|
|
62
|
+
|
|
63
|
+
### Development
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install
|
|
67
|
+
npm run typecheck
|
|
68
|
+
npm run build
|
|
69
|
+
npm test
|
|
70
|
+
```
|