dsh-gemini-web 0.0.0-stage → 0.2.2-beta.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.en.md +317 -0
- package/README.md +315 -2
- package/SKILL.md +94 -0
- package/SKILL.zh-CN.md +94 -0
- package/client.js +1805 -0
- package/cordis.patch.yml +8 -0
- package/index.js +1437 -0
- package/locale/en-US.json +65 -0
- package/locale/en.json +65 -0
- package/locale/zh-CN.json +65 -0
- package/locale/zh.json +65 -0
- package/package.json +56 -3
- package/references/agentlimb.md +164 -0
- package/references/director_prompt.md +67 -0
- package/references/models.md +38 -0
- package/references/playbooks/academic_deep_research.md +20 -0
- package/references/playbooks/content_video_media.md +21 -0
- package/references/playbooks/data_office_automation.md +22 -0
- package/references/playbooks/interactive_game_studio.md +20 -0
- package/references/playbooks/web_fullstack_app.md +23 -0
- package/requirements.txt +2 -0
- package/scripts/agentlimb_client.py +119 -0
- package/scripts/dsh_sprite_slicer.py +140 -0
- package/scripts/gemini_agentlimb.py +1696 -0
- package/scripts/gemini_web.py +4281 -0
- package/scripts/inspect_antigravity.py +1663 -0
- package/scripts/platform_utils.py +822 -0
- package/scripts/setup_skill.py +707 -0
- package/scripts/sync_upstream.py +148 -0
package/README.md
CHANGED
|
@@ -1,3 +1,316 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-gemini-web
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](README.md) | [English](README.en.md)
|
|
4
|
+
|
|
5
|
+
[](package.json)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://github.com/stJL/dsh-gemini-web/actions/workflows/sync-upstream.yml)
|
|
8
|
+
[](https://github.com/stJL/dsh-gemini-web)
|
|
9
|
+
[](https://python.org)
|
|
10
|
+
[](https://aistudio.google.com)
|
|
11
|
+
|
|
12
|
+
> **DeepSeek Harness (DSH) 原生调度插件**:专为接入 [@582835293/gemini-web-agent](https://github.com/582835293/gemini-web-agent) 多渠道网页额度生态而设计的 GUI 管理器与 Agent 工具适配器。
|
|
13
|
+
|
|
14
|
+
<!-- [图片 1 - 顶部效果预览 / Hero Banner] -->
|
|
15
|
+
<!-- 截图提示:DSH 聊天室中调用 Gemini Web Agent 的完整界面截图(含指令、先问后用确认卡与代码落地结果) -->
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🙏 致谢与开源声明 (Credits & Attribution)
|
|
21
|
+
|
|
22
|
+
本项目诞生于开源社区的深度协同与热爱,特此向所有贡献者致以最诚挚的感谢:
|
|
23
|
+
|
|
24
|
+
* 🌟 **底层核心自动化与架构探索**:[@582835293](https://github.com/582835293)
|
|
25
|
+
- 本插件底层核心浏览器自动化规则、DOM 选择器精准调校、多渠道调度逻辑与风控防护策略**100% 传承并致敬原作者 [@582835293](https://github.com/582835293) 的开源项目 [gemini-web-agent](https://github.com/582835293/gemini-web-agent)**。向原作的开拓性贡献致敬!❤️
|
|
26
|
+
* 🚀 **DSH 插件整合与维护**:[@stJL](https://github.com/stJL) (我)
|
|
27
|
+
- 提出 DSH 整合想法,负责插件适配、全流程功能实测与开源维护。
|
|
28
|
+
* 🤖 **AI 协同编程**:Google DeepMind Antigravity (Gemini-3.8-flash)
|
|
29
|
+
- 协助编写插件适配代码、封装路由、构建 GUI 设置面板与文档整理。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 📊 功能分工与特性对照表
|
|
34
|
+
|
|
35
|
+
本项目基于原作者 [@582835293/gemini-web-agent](https://github.com/582835293/gemini-web-agent) 的底层浏览器自动化能力,为 DeepSeek Harness (DSH) 桌面端进行适配与功能扩展:
|
|
36
|
+
|
|
37
|
+
| 功能模块 | 原作者基础 (`gemini-web-agent`) | 本插件扩展 (`dsh-gemini-web`) |
|
|
38
|
+
| :--- | :--- | :--- |
|
|
39
|
+
| **操作界面** | Python 命令行(CLI)执行 | DSH 桌面端可视化设置面板、状态指示灯与实时额度显示 |
|
|
40
|
+
| **通信通道** | CDP(9222 端口)连接 | 整合 AgentLimb 零弹窗通道,支持 Chrome/Edge/Brave 等多浏览器探测 |
|
|
41
|
+
| **模型阶梯** | 固定的模型降级链 | GUI 自定义 1~5 阶模型排序(`↑`/`↓`)、切换智能阶梯或严格模式 |
|
|
42
|
+
| **AI Studio** | 网页对话与代码生成调度 | 停用 Extra High 防 403 假死、过滤 Paid 付费标签模型 |
|
|
43
|
+
| **Google Flow** | 网页自动化生图 | 默认底栏画布生图(0 点数消耗)、适配每日点数重置检测 |
|
|
44
|
+
| **本地文件分析** | 基础文本输入 | 支持本地代码/日志/PDF 直接挂载至网页端 1M 窗口分析 |
|
|
45
|
+
| **文件保存与交付**| 文本输出于终端 | 代码与媒体文件自动存档至 `downloads/`,生成本地超链接 |
|
|
46
|
+
| **调度流程** | 脚本直接发包 | 「先问后用」确认卡机制,并在提示词中加入抗历史惯性约束 |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🚨 核心召唤规范(必读)
|
|
51
|
+
|
|
52
|
+
> [!IMPORTANT]
|
|
53
|
+
> **必须在提示词开头输入 `/gemini-web-agent` 斜杠指令!**
|
|
54
|
+
>
|
|
55
|
+
> DSH 宿主 AI(如 DeepSeek、Claude、GPT 等)本身具备通用的代码与文本生成能力。**若不加上 `/gemini-web-agent`,AI 会倾向于在本地直接作答,直接忽略外部工具**。
|
|
56
|
+
>
|
|
57
|
+
> 只要在提示词开头加上 `/gemini-web-agent`,宿主 AI 就会立刻触发调度协议,严格执行流程,将任务委派给外部 Google 网页端执行!
|
|
58
|
+
|
|
59
|
+
### 💬 召唤指令范例
|
|
60
|
+
* **调用 Hydrogen 极限代码生成与架构设计**:
|
|
61
|
+
> `/gemini-web-agent 用 Gemini 4 Hydrogen 帮我实现高性能无锁队列 (Lock-free Queue),并附带完整中文注释与单元测试`
|
|
62
|
+
* **Google Flow 画布 0 点数高清生图**:
|
|
63
|
+
> `/gemini-web-agent 在 Google Flow 用 Nano Banana 2.1 生一张极简日式枯山水庭园 2K 壁纸`
|
|
64
|
+
* **巨型日志分析与论文 PDF 跨模态解读**:
|
|
65
|
+
> `/gemini-web-agent 用 Google AI Studio 帮我分析 logs/system.log 的崩溃瓶颈,并对比 docs/paper.pdf 的架构提出优化方案`
|
|
66
|
+
* **极限算法推导与系统架构规划**:
|
|
67
|
+
> `/gemini-web-agent 用 Google AI Studio 帮我推导分布式 Raft 共识算法在网络分区时的极限容错证明,并输出架构图`
|
|
68
|
+
* **时效性深度联网调研**:
|
|
69
|
+
> `/gemini-web-agent 在 Gemini 官网切换至 task 模式,联网调研最新 AI 芯片架构进展并做成对比表格`
|
|
70
|
+
|
|
71
|
+
> [!TIP]
|
|
72
|
+
> **📁 文件挂载特性亮点**:
|
|
73
|
+
> 本插件已完整打通「本机文件免弹窗挂载 (File Attachment)」!在提示词中指定本地日志、代码、图片或论文 PDF,宿主 AI 会在提案卡中自动标记 `- 📁 挂载文件`,并自动通过 DataTransfer / CDP 注入 Google AI Studio 1M 超大上下文进行推演,不耗费本机宿主模型的输入 Token!
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 🌟 核心特性与架构
|
|
78
|
+
|
|
79
|
+
```mermaid
|
|
80
|
+
flowchart TD
|
|
81
|
+
User["人类用户 (User)"] -- "/gemini-web-agent <任务>" --> DSH["DSH 宿主 AI (DeepSeek / Claude)"]
|
|
82
|
+
DSH -- "第 1 步:先问后用确认卡 (Proposal)" --> User
|
|
83
|
+
User -- "回复「1」或「确认」" --> DSH
|
|
84
|
+
DSH -- "第 2 步:发包执行" --> Core["gemini_web_agent 核心引擎"]
|
|
85
|
+
|
|
86
|
+
subgraph Bridges ["双通道通信架构 (Dual-Channel Bridge)"]
|
|
87
|
+
AL["通道 A:AgentLimb (首选・100% 免弹窗)"]
|
|
88
|
+
CDP["通道 B:Chromium CDP (备用・自动探测端口)"]
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
Core --> AL
|
|
92
|
+
Core -. 备援 .-> CDP
|
|
93
|
+
|
|
94
|
+
subgraph GoogleSites ["三大 Google 外部算力站点"]
|
|
95
|
+
AIS["Google AI Studio\n• key_off 免费层级\n• 1M Token 超长上下文\n• Hydrogen / Argon / Flash\n• 思考等级 (封印 Extra High)"]
|
|
96
|
+
Flow["Google Flow\n• 独立点数池 (50点/日)\n• 底部画布生图 0 点数特权\n• Nano Banana 2.1 2K 生图"]
|
|
97
|
+
Web["Gemini 官网\n• 5 小时滚动免费对话池\n• Chat 对话 & Task 联网模式"]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
AL --> GoogleSites
|
|
101
|
+
CDP -.-> GoogleSites
|
|
102
|
+
|
|
103
|
+
GoogleSites --> Delivery["成果自动落地交付\n• 代码自动提取保存至 downloads/\n• 可点击 file:/// 超链接回传"]
|
|
104
|
+
Delivery --> DSH
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 1. 零 Token 外部免费算力池
|
|
108
|
+
* 充分利用本机浏览器已登录之 Google 账号网页端免费用量,不耗费本机任何 API Token 配额。
|
|
109
|
+
* 支持 Google AI Studio 1M 超大上下文、Google Flow 画布高清生图与 Gemini 官网联网任务。
|
|
110
|
+
|
|
111
|
+
### 2. 双通道智能路由架构 (Dual-Channel Smart Bridge)
|
|
112
|
+
* **通道 A (AgentLimb - 推荐首选)**:
|
|
113
|
+
- ⚡ **100% 免弹窗**:基于本机配对协议直接操控已开启之浏览器,彻底告别传统 CDP 连接时频繁跳出的「Allow」授权弹窗。
|
|
114
|
+
- 🛡️ **无感休眠唤醒**:自动启用标签页防冻结与唤醒机制,任务结束自动释放。
|
|
115
|
+
* **通道 B (Chromium CDP - 备用模式)**:
|
|
116
|
+
- 免装扩展程序,自动探测遍历 Chrome、Edge、Brave、Vivaldi 等浏览器的 DevToolsActivePort,具备多实例防冲突机制。
|
|
117
|
+
|
|
118
|
+
### 3. 三大站点深度支持与免扣费安全锁
|
|
119
|
+
* **Google AI Studio (`aistudio.google.com`)**:
|
|
120
|
+
- 默认工作于 **`key_off` 免费无限轮询层级**(左上角未绑定付费 API Key),享受 1M Token 超长上下文输出。
|
|
121
|
+
- **防 Paid 扣费铁律**:插件强制过滤并锁定所有标记为 `Paid` 的付费模型(如 `gemini-4-carbon`),非用户显式指定绝不调用。
|
|
122
|
+
- **Extra High 安全锁**:免费层级若开启 `Extra High` 思考会引发 Google 403 错误与排队假死。本插件在前端 GUI 与底层调度中将 `Extra High` 上锁。
|
|
123
|
+
* **Google Flow (`flow.google.com`)**:
|
|
124
|
+
- **点数重置机制**:免费账号每日定期自动补满 50 点,进阶账号每月享有专属点数池。
|
|
125
|
+
- **🎨 画布 0 点数生图特权(重要!)**:在底部标准画布(Canvas)提示词框使用 Nano Banana 2.1 / Pro 生成 2K 高清图片时,**完全不扣除点数(Generating will use 0 credits)**,等同无限免费生图!
|
|
126
|
+
- **⚠️ 扣点避坑提醒**:点开右侧 Conversational Agent 对话面板(Agent 模式)或点击生成视频(Omni / Veo)时会扣除点数,日常纯生图请认准底栏画布生成。
|
|
127
|
+
* **Gemini 官网 (`gemini.google.com`)**:
|
|
128
|
+
- 独立 5 小时滚动免费对话池,支持日常对话与 Task 联网任务,任务完成自动关闭标签页。
|
|
129
|
+
|
|
130
|
+
### 4. 严格「先问后用」工作流 (Ask-Before-Dispatch)
|
|
131
|
+
为确保透明、可控与零意外花费,插件严格遵循规范的「先问后用」交互流程:
|
|
132
|
+
1. **第 1 步:呈现调度提案卡**
|
|
133
|
+
AI 接收到任务后,严禁直接发包或偷开本地 subagent,必须先输出结构化确认卡,并立即结束当次回显等待用户指令:
|
|
134
|
+
```markdown
|
|
135
|
+
### 🌐 Gemini Web Agent
|
|
136
|
+
检测到您欲调用外部 Google 网页端实现并发任务,相关配置如下:
|
|
137
|
+
|
|
138
|
+
- 🎯 执行渠道:Google AI Studio(可选择:Google AI Studio / Gemini Web)
|
|
139
|
+
- 🚪 入口模式:chat
|
|
140
|
+
- 🧠 执行模型:(智能/定时模式)
|
|
141
|
+
- gemini-4-hydrogen -> gemini-3.8-flash -> gemini-3.5-flash-lite -> gemini.google.com
|
|
142
|
+
- ⚙️ 推演配置:Thinking 设为 high
|
|
143
|
+
- 🔄 话题隔离:new_chat: true(默认开启全新独立对话)
|
|
144
|
+
|
|
145
|
+
👉 请确认是否发包执行?
|
|
146
|
+
- 回复 「确认」 或 「1」:立即调用外部 Chrome 自动化发包执行
|
|
147
|
+
- 回复 调整参数(如「改用 Flash Lite」、「改用 Argon」等):按您的要求调整后直接发包
|
|
148
|
+
- 回复 「取消」:中止外部调度,改由本地作答
|
|
149
|
+
```
|
|
150
|
+
2. **第 2 步:用户授权发包**
|
|
151
|
+
- 回复 `1` 或 `确认`:立即调用外部 Chrome 执行发包。
|
|
152
|
+
- 回复 调整参数:AI 立即按最新参数直接发包。
|
|
153
|
+
- 回复 `取消`:中止外部调度,改由本地直接回答。
|
|
154
|
+
|
|
155
|
+
### 5. 阶梯备援降级机制 (Sequential Fallback Ladder)
|
|
156
|
+
* **智能模式**:在 AI Studio 遭遇尖峰拥堵、限流或超时时,自动沿着梯队平滑降级:
|
|
157
|
+
$$\text{Tier 1 (Hydrogen)} \longrightarrow \text{Tier 2 (Flash)} \longrightarrow \text{Tier 3 (Flash Lite)} \longrightarrow \text{Gemini 官网}$$
|
|
158
|
+
* **严格模式**:若用户在设置中切换为「🛑 严格模式」,则锁定单一模型,不进行任何降级。
|
|
159
|
+
* **GUI 自由调整**:在设置面板中可自由增删 1~5 阶模型,并通过 `↑` / `↓` 按钮直观调整模型优先级顺序。
|
|
160
|
+
|
|
161
|
+
### 6. 代码自动落地与点击式超链接交付
|
|
162
|
+
* 网页端生成的代码块与生成的媒体文件(PNG 图片、MP4 视频、MP3 音乐、项目 ZIP 包)由后台程序自动提取并落地保存至 DSH 工作区的 `downloads/` 目录。
|
|
163
|
+
* 输出标准可点击的本地绝对路径 Markdown 超链接:
|
|
164
|
+
```markdown
|
|
165
|
+
- [lru_cache.py](file:///home/user/.../downloads/lru_cache.py)
|
|
166
|
+
- [gemini_flow_1732000000.png](file:///home/user/.../downloads/gemini_flow_1732000000.png)
|
|
167
|
+
```
|
|
168
|
+
* 避免全量长代码在聊天窗口大量重抄导致小模型 SSE 流截断(Incomplete JSON segment)。
|
|
169
|
+
|
|
170
|
+
### 7. 本机文件、日志与论文 PDF 免弹窗挂载分析 (Multi-modal File Attachment)
|
|
171
|
+
* **1M Token 零开销吞吐**:通过底层 `DataTransfer`(通道 A)与 Chromium 原生 `DOM.setFileInputFiles`(通道 B),直接将本机的 `.txt`、`.log`、`.pdf`、`.py`、`.cpp` 或图片免弹窗上传至 Google AI Studio 进行端到端多模态解析。
|
|
172
|
+
* **彻底规避本机 Context 溢出**:本机宿主模型无需在聊天对话框中重抄或吞吐十万行日志文本,只需传入文件路径,由 Google AI Studio 免费层级(100 万 Token 窗口)全权推演分析并回传结论!
|
|
173
|
+
* **多文件并行挂载**:支持一次性挂载多份参考文档或对比文件。
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## ⚙️ GUI 设置大盘功能
|
|
178
|
+
|
|
179
|
+
在 DSH 桌面端的插件设置页面中提供了一站式仪表盘:
|
|
180
|
+
1. **浏览器通信状态灯**:实时检测 AgentLimb(🟢 绿灯)与 CDP 备用通道连接状态、调试端口与浏览器类型。
|
|
181
|
+
2. **实时额度大盘**:
|
|
182
|
+
- Google AI Studio:显示 `key_off` 免费层级状态。
|
|
183
|
+
- Gemini 官网:显示 5 小时滚动池已用量与重置周期。
|
|
184
|
+
- Google Flow:显示当前剩余点数与每日/每月重置倒计时。
|
|
185
|
+
3. **调度与模型梯队配置**:
|
|
186
|
+
- 梯队自由排序:支持 1~5 阶模型上下移动(`↑` / `↓`)。
|
|
187
|
+
- 模式切换:智能阶梯模式 vs 严格模式。
|
|
188
|
+
- 思考等级配置:`high` / `medium` / `low`。
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 🛠️ 安装与部署指南
|
|
193
|
+
|
|
194
|
+
### 1. 插件安装
|
|
195
|
+
|
|
196
|
+
* **方式一:Git Clone 本地软链接(目前推荐)**:
|
|
197
|
+
```bash
|
|
198
|
+
git clone https://github.com/stJL/dsh-gemini-web.git
|
|
199
|
+
ln -s $(pwd)/dsh-gemini-web ~/.dsh/profiles/desktop/node_modules/dsh-gemini-web
|
|
200
|
+
```
|
|
201
|
+
* **方式二:NPM 官方源一键安装(即将推出 / Roadmap 规划中)**:
|
|
202
|
+
> 🚧 **待实现目标**:本项目正筹备发布至 npm 官方源 `registry.npmjs.org`。发布完成后,届时将支持直接在 DSH 桌面端插件市场搜索一键安装,或通过命令行安装:
|
|
203
|
+
> ```bash
|
|
204
|
+
> # 即将支持 (Upcoming)
|
|
205
|
+
> pnpm add dsh-gemini-web
|
|
206
|
+
> ```
|
|
207
|
+
|
|
208
|
+
### 2. Python 环境与依赖
|
|
209
|
+
插件依赖 Python 3.10+ 与 Playwright 驱动:
|
|
210
|
+
```bash
|
|
211
|
+
cd /path/to/dsh-gemini-web
|
|
212
|
+
python3 -m venv .venv
|
|
213
|
+
source .venv/bin/activate
|
|
214
|
+
pip install -r requirements.txt
|
|
215
|
+
playwright install chromium
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### 3. 浏览器准备(二选一)
|
|
219
|
+
* **方案 A(推荐)**:安装并启用 AgentLimb 浏览器扩展,享受 100% 免弹窗静默通信。
|
|
220
|
+
* **方案 B**:以调试模式启动本机 Chrome / Edge:
|
|
221
|
+
```bash
|
|
222
|
+
google-chrome --remote-debugging-port=9222
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### 4. 部署 Skill(AI 指导规范)
|
|
226
|
+
执行内置部署脚本,自动将 Skill 注册至 DSH 与 Antigravity:
|
|
227
|
+
```bash
|
|
228
|
+
python scripts/setup_skill.py --auto
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 💡 使用建议与最佳实践 (Best Practices & Account Safety)
|
|
234
|
+
|
|
235
|
+
为确保您获得最稳定、流畅且安全的自动化调度体验,强烈建议遵循以下实践原则:
|
|
236
|
+
|
|
237
|
+
### 1. 建议优先开启全新独立对话 (Prefer New Chat)
|
|
238
|
+
* **规避长上下文与注意力衰减**:当前聊天室的历史轮次累积过长时(尤其是超过数万 Token),轻量级宿主模型(如 8B 级别的小模型)极易受到上一轮历史助手的输出惯性吸引(In-Context Few-Shot Bias),进而可能忽略顶部最新动态提示词。
|
|
239
|
+
* **确保实时配置百分之百生效**:在 DSH 左侧随时点击 **「新建对话(New Chat)」**,能彻底清除历史对话的干扰,确保宿主 AI 100% 严格以您在 GUI 面板中设置的最新模型降级顺序、思考等级与挂载参数进行输出。
|
|
240
|
+
|
|
241
|
+
### 2. 账号安全:强烈建议使用专用/备用 Google 账号 (Use Secondary Accounts)
|
|
242
|
+
> [!WARNING]
|
|
243
|
+
> **切勿使用绑定了重要个人隐私、公司业务、核心 Gmail 邮箱或 Google Drive 关键文件的日常主力账号!**
|
|
244
|
+
* **自动化行为与风控机制**:本插件本质上属于浏览器自动化辅助工具(通过 AgentLimb 或 CDP 驱动)。若在短时间内触发大量并发调度、极高频发包或密集挂载超大文件,Google 服务器的安全风控机制可能会触发临时人机验证(CAPTCHA)、请求频率限制(Rate Limit),甚至可能导致账号在网页端暂时无法使用。
|
|
245
|
+
* **专用测试账号隔离**:强烈建议专门注册一个或多个**独立的备用/测试 Google 账号(Secondary / Disposable Account)**登录 Chrome 浏览器来进行插件调度。这样即便遇到临时频率风控,也不会对您的日常生活与工作产生任何不良影响。
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
<details>
|
|
250
|
+
<summary>🛠️ <b>维护者指南:上游同步与 CI/CD (Maintainer Guide)</b></summary>
|
|
251
|
+
|
|
252
|
+
> [!NOTE]
|
|
253
|
+
> 本节内容仅供插件维护者开发使用,普通用户无需执行。
|
|
254
|
+
|
|
255
|
+
本插件采用**模块化分离架构**,让底层自动化脚本能无痛跟进原作者 [@582835293/gemini-web-agent](https://github.com/582835293/gemini-web-agent) 的更新,同时保证 DSH GUI 与插件核心不受影响。
|
|
256
|
+
|
|
257
|
+
### 架构分离设计
|
|
258
|
+
* **底层自动化脚本 (`scripts/`)**:源自原作者仓库(`gemini_web.py`、`gemini_agentlimb.py`、`platform_utils.py` 等),负责 DOM 选择器与网页交互。
|
|
259
|
+
* **DSH 插件专属层 (`src/`, `client.js`, `index.js`, `cordis.patch.yml`)**:负责 DSH GUI 面板、MCP 服务注册、动态 Prompt 注入与阶梯降级逻辑。
|
|
260
|
+
|
|
261
|
+
### 一键同步指令
|
|
262
|
+
我们在项目中提供了自动化同步脚本,随时拉取原作者最新选择器修复:
|
|
263
|
+
```bash
|
|
264
|
+
# 执行一键同步脚本
|
|
265
|
+
npm run sync:upstream
|
|
266
|
+
# 或
|
|
267
|
+
python scripts/sync_upstream.py
|
|
268
|
+
```
|
|
269
|
+
同步脚本会自动完成:
|
|
270
|
+
1. 从原作者 GitHub 上游仓库获取最新代码。
|
|
271
|
+
2. 比对并更新 `scripts/` 下的自动化脚本与最新选择器。
|
|
272
|
+
3. 自动保留 DSH 增强特性(如 Flow 每日点数重置正则适配)。
|
|
273
|
+
4. 重新构建插件产物(`bun build`)。
|
|
274
|
+
|
|
275
|
+
### GitHub Actions 自动同步
|
|
276
|
+
本项目已配置 `.github/workflows/sync-upstream.yml`,每周自动检查上游更新并产生 PR,维护者可直接在 GitHub 线上审核合并。详细的本地兼容性测试流程请参阅 [docs/UPSTREAM_SYNC_GUIDE.md](docs/UPSTREAM_SYNC_GUIDE.md)。
|
|
277
|
+
</details>
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## 🤝 欢迎参与测试、反馈与贡献 (Feedback & Contribution)
|
|
282
|
+
|
|
283
|
+
> [!NOTE]
|
|
284
|
+
> 💡 **项目状态与测试声明**:
|
|
285
|
+
> 本插件目前处于**公开测试阶段(Public Beta)**。由于 Google 各大网页端(AI Studio、Gemini 官网、Google Flow)的前端界面与 DOM 结构会不定期进行 A/B 测试或静默更新,加上不同操作系统的使用者(Linux / macOS / Windows)、浏览器版本、网络环境及代理策略各不相同,**目前仅由维护者在有限的本地环境进行实测,代码中难免存在尚未被发现的边界情况(Edge Cases)或潜在问题**。
|
|
286
|
+
|
|
287
|
+
> [!TIP]
|
|
288
|
+
> 🌱 **写给开源社区的一封信(关于 Vibe Coding)**:
|
|
289
|
+
> 本项目是作者人生中**第一个真正意义上的「Vibe Coding」项目**——在与 AI(Antigravity / Gemini-3.8-flash)高频协同结对的过程中,以纯粹的直觉、热爱与工程探索驱动,一行行跨越了 Chromium 底层协议、DSH 生态适配、成果自动落盘交付与动态提示词工程。
|
|
290
|
+
> 由于作者与 AI 在这场探索中仍处于不断学习与成长之中,若代码架构或实现细节中存在不够优雅、稚嫩或考虑不周之处,**恳请 GitHub 上的各路技术大神多多包涵、高抬贵手,更诚挚期盼您的指点与赐教**!无论是指出架构缺陷、提出重构建议,还是提交微小的修复 PR,我们都满怀敬畏与感激!🙏
|
|
291
|
+
|
|
292
|
+
📢 **我们非常渴望听见社区的声音,期待您的参与:**
|
|
293
|
+
* 🐛 **遇到 Bug 或调度失败?** 非常欢迎至 [GitHub Issues](https://github.com/stJL/dsh-gemini-web/issues) 提交反馈!请尽量附上错误日志或截图,我们会以最快速度排查与修复。
|
|
294
|
+
* 💡 **有更好的点子或优化建议?** 无论是调度策略、确认卡排版、UI 仪表盘交互,欢迎随时开启 Discussion 或发起 Issue 畅所欲言!
|
|
295
|
+
* 🛠️ **想一起完善代码?** 我们极度欢迎各路好手提交 [Pull Request](https://github.com/stJL/dsh-gemini-web/pulls)!无论是修复微小拼写、改善路径解析容错、优化 DOM 选择器适配,还是新增跨平台测试用例,每一个 PR 都是对开源社区巨大的帮助!
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## ⚠️ 免责声明 (Disclaimer)
|
|
300
|
+
|
|
301
|
+
在安装、部署或使用本插件(`dsh-gemini-web`)之前,请务必仔细阅读本免责声明:
|
|
302
|
+
|
|
303
|
+
1. **用途声明**:本项目仅供个人技术学习、自动化整合研究与学术交流使用,切勿用于任何违反法律法规或恶意破坏服务的场景。
|
|
304
|
+
2. **非官方关联**:本插件为独立的第三方开源软件,与 Google LLC 及其母公司 Alphabet Inc. 不存在任何形式的官方关联、授权或背书。文中所提及的 Google、Gemini、AI Studio、Google Flow 等商标均归属于其各自的商标所有权人。
|
|
305
|
+
3. **服务条款与账号风险**:用户应自行遵守 Google 的《服务条款》(Terms of Service)、各项网页产品政策及所在国家/地区的法律规范。使用本工具进行浏览器自动化操作可能面临 Google 网页端的风控检测、人机验证挑战(CAPTCHA)、速率限制(Rate Limit)、功能降级或账号暂时/永久受限等风险。**所有因自动化调度行为引发的账号状态变更或服务中断风险,均由使用者本人完全自行承担。**
|
|
306
|
+
4. **数据安全与隐私**:在调度外部网页端或挂载本地文件时,请确保上传的文件不包含任何敏感商业机密、个人隐私数据、API 密钥或关键凭证。本项目不对上传至外部服务器的任何数据安全性承担责任。
|
|
307
|
+
5. **责任免除**:在适用法律允许的最大范围内,本项目的作者、维护者及社区贡献者概不对因使用、误用或无法使用本软件所引起的任何直接、间接、附带、衍生、惩罚性或特殊损失(包括但不限于账号封禁、数据丢失、业务中断、利润损失或计算机系统故障)承担任何法律责任。
|
|
308
|
+
|
|
309
|
+
一旦您安装、复制、修改或使用本项目,即表示您已完整阅读、理解并完全接受上述免责条款。
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## 📄 授权条款 (License)
|
|
314
|
+
|
|
315
|
+
本项目遵循 MIT License。
|
|
316
|
+
核心自动化逻辑版权归原作者 [@582835293](https://github.com/582835293) 所有,DSH 插件整合层归 DeepSeek Harness 社区所有。
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gemini-web-agent
|
|
3
|
+
description: >-
|
|
4
|
+
[HIGH PRIORITY • ASK BEFORE DISPATCH] Must be loaded as Step 1 whenever the user mentions AI Studio, Google Flow, Gemini Web, specifies Hydrogen/Flash/Flash-Lite/Neon/Nano Banana/Omni/Lyria, or uses `/gemini-web-agent`!
|
|
5
|
+
1. Single Gateway Rule: The ONLY valid dispatch command is `/gemini-web-agent`.
|
|
6
|
+
2. Ask Before Dispatch (Must Invoke gemini_preview & ask_user_question): Whether user sends `/gemini-web-agent` or natural language, never answer locally! Must invoke `gemini_preview` for deterministic card, and immediately invoke `ask_user_question` for interactive choice buttons.
|
|
7
|
+
3. Dispatch on Confirmation: Upon user confirmation (button click or "1" / "confirm"), invoke `gemini_web_agent`.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Gemini Web Agent (Deterministic Tool Workflow & Single Gateway)
|
|
11
|
+
|
|
12
|
+
> [!IMPORTANT]
|
|
13
|
+
> **Four Core Golden Rules**:
|
|
14
|
+
> 1. **Single Command Gateway**: The ONLY valid dispatch command is `/gemini-web-agent`.
|
|
15
|
+
> 2. **Zero Local Overhead & No Hijacking**: Never answer locally. Never call `subagent` (paid APIs). Never use local tools (`read`, `cat`, `bash`) to inspect `@file` mentions—pass file paths to the web agent!
|
|
16
|
+
> 3. **Step 1 Ask-Before-Dispatch (Must Invoke `gemini_preview` & `ask_user_question`)**:
|
|
17
|
+
> - NEVER manually draft or hallucinate cards! You MUST invoke `gemini_preview(task: "...")` to obtain the 100% deterministic proposal card.
|
|
18
|
+
> - Output the received card markdown in chat.
|
|
19
|
+
> - **Immediately invoke `ask_user_question`** to present interactive choice buttons:
|
|
20
|
+
> ```json
|
|
21
|
+
> {
|
|
22
|
+
> "questions": [
|
|
23
|
+
> {
|
|
24
|
+
> "id": "gemini_confirm",
|
|
25
|
+
> "question": "👉 请确认是否发包执行?",
|
|
26
|
+
> "options": [
|
|
27
|
+
> { "label": "(Recommended) 确认发包执行" },
|
|
28
|
+
> { "label": "调整参数" },
|
|
29
|
+
> { "label": "取消调度(本地作答)" }
|
|
30
|
+
> ]
|
|
31
|
+
> }
|
|
32
|
+
> ]
|
|
33
|
+
> }
|
|
34
|
+
> ```
|
|
35
|
+
> - **HALT immediately** after invoking the question tool, waiting for user click!
|
|
36
|
+
> 4. **Per-Task Reset (Anti-Inertia)**: The confirmation cycle applies to **EVERY SINGLE TASK INDEPENDENTLY**, NOT once per session! Every new request MUST reset to Step 1.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 💡 Channel & Model Reference
|
|
41
|
+
|
|
42
|
+
| Channel | Supported Target Models | Notes |
|
|
43
|
+
| :--- | :--- | :--- |
|
|
44
|
+
| **Google AI Studio** | `Hydrogen` (`gemini-4-hydrogen`)<br>`Flash` (`gemini-3.8-flash`)<br>`Flash Lite` (`gemini-3.5-flash-lite`)<br>`Neon` (`gemini-4-neon`) | • Best for code & reasoning: `Hydrogen`<br>• Best for rapid tasks: `Flash Lite`<br>• ⚠️ **Note**: Legacy `Argon` has been upgraded/merged into `Hydrogen`; specifying Argon will automatically map to `gemini-4-hydrogen`. |
|
|
45
|
+
| **Gemini Web** | `Auto` (Native Web Model) | Managed automatically by Google official web model; no individual model alias needed. |
|
|
46
|
+
| **Google Flow** | `Nano Banana 2.1`<br>`Omni 1.2 / Veo` | • 0-credit image generation: `Nano Banana 2.1`<br>• Video generation: `Omni 1.2` or `Veo` |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 1. Step 1: Proposal Card & Interactive Choice Bar
|
|
51
|
+
|
|
52
|
+
When receiving any user instruction, you **MUST ONLY execute these two steps**:
|
|
53
|
+
|
|
54
|
+
1. **Invoke `gemini_preview`**:
|
|
55
|
+
- Parameter: `{ "task": "<user prompt>" }`
|
|
56
|
+
- Backend code deterministically resolves target site, entry mode, model fallback ladder, and mounted files.
|
|
57
|
+
2. **Output card & invoke `ask_user_question`**:
|
|
58
|
+
- Print the card Markdown returned by `gemini_preview`.
|
|
59
|
+
- Invoke `ask_user_question` with the options below so the UI presents clickable buttons:
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"questions": [
|
|
63
|
+
{
|
|
64
|
+
"id": "gemini_confirm",
|
|
65
|
+
"question": "👉 请确认是否发包执行?",
|
|
66
|
+
"options": [
|
|
67
|
+
{ "label": "(Recommended) 确认发包执行" },
|
|
68
|
+
{ "label": "调整参数" },
|
|
69
|
+
{ "label": "取消调度(本地作答)" }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
- Stop and wait for user action.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 2. Step 2: Dispatch and Parameters
|
|
80
|
+
|
|
81
|
+
When confirmed (interactive button clicked, or `1` / `confirm` sent), invoke `gemini_web_agent`:
|
|
82
|
+
|
|
83
|
+
| Parameter | Specification |
|
|
84
|
+
| :--- | :--- |
|
|
85
|
+
| `task` | Full user task prompt and requirements |
|
|
86
|
+
| `files` | Array of local file paths (auto-extracted from task if omitted) |
|
|
87
|
+
| `model` | User-specified model alias; omit in smart fallback mode |
|
|
88
|
+
| `site` | Target site: `aistudio` (default), `flow`, or `gemini` |
|
|
89
|
+
| `entry` | `chat` (default), `task`, or `canvas` |
|
|
90
|
+
| `thinking_level` | `high` (default), `medium`, or `low` |
|
|
91
|
+
| `thinking_policy` | `adaptive` (default), `strict`, or `custom` |
|
|
92
|
+
| `new_chat` | `true` (default: isolated new session) |
|
|
93
|
+
|
|
94
|
+
**Deliverable Requirements**: Upon completion, present the fallback status notice, clickable `file://` hyperlinks to saved files, and key architectural highlights. Never reprint full long code.
|
package/SKILL.zh-CN.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gemini-web-agent
|
|
3
|
+
description: >-
|
|
4
|
+
【必须最优先加载・一律先问后用】当用户提到 AI Studio, Google Flow, Gemini 网页端, 指定 Hydrogen/Flash/Flash-Lite/Neon/Nano Banana/Omni/Lyria, 或输入 `/gemini-web-agent` 时必须调用!
|
|
5
|
+
1. 单一门禁铁律:唯一合法指令为 `/gemini-web-agent`。
|
|
6
|
+
2. 先问后用(调用 gemini_preview 与 ask_user_question):无论用户带命令或日常聊天,宿主 AI 严禁本地直接作答,必须调用 `gemini_preview` 获取确定性提案卡,并立即调用 `ask_user_question` 弹出交互选择栏供用户点击,严禁擅自发包或本地代劳!
|
|
7
|
+
3. 确认后发包:待用户在选择栏点击确认或回复「1」/「确认」后,调用 `gemini_web_agent` 正式发包。
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Gemini Web Agent(确定性工具流与单一门禁架构)
|
|
11
|
+
|
|
12
|
+
> [!IMPORTANT]
|
|
13
|
+
> **四大核心调度铁律**:
|
|
14
|
+
> 1. **唯一合法命令门禁**:外部 Google 算力调度的唯一合法指令是 `/gemini-web-agent`。
|
|
15
|
+
> 2. **零本地开销与严禁代劳**:严禁本地直接作答,严禁调用 `subagent`(消耗付费 API),严禁使用本地 `read`/`cat`/`bash` 预读取 `@文件`——直接将文件路径交由外部网页端解析!
|
|
16
|
+
> 3. **第 1 步先问后用(必须调用 `gemini_preview` 与 `ask_user_question`)**:
|
|
17
|
+
> - 严禁自行脑补排版确认卡!必须调用 `gemini_preview(task: "...")` 获得 100% 确定性解析的提案卡;
|
|
18
|
+
> - 在聊天中原样输出卡片 Markdown;
|
|
19
|
+
> - **必须立即调用交互提问工具 `ask_user_question`** 弹出交互选项胶囊:
|
|
20
|
+
> ```json
|
|
21
|
+
> {
|
|
22
|
+
> "questions": [
|
|
23
|
+
> {
|
|
24
|
+
> "id": "gemini_confirm",
|
|
25
|
+
> "question": "👉 请确认是否发包执行?",
|
|
26
|
+
> "options": [
|
|
27
|
+
> { "label": "(Recommended) 确认发包执行" },
|
|
28
|
+
> { "label": "调整参数" },
|
|
29
|
+
> { "label": "取消调度(本地作答)" }
|
|
30
|
+
> ]
|
|
31
|
+
> }
|
|
32
|
+
> ]
|
|
33
|
+
> }
|
|
34
|
+
> ```
|
|
35
|
+
> - **调用完提问工具后立即停步**,等待用户点击确认!
|
|
36
|
+
> 4. **多轮任务循环重置(抗历史惯性)**:确认流程是针对【每一个独立任务】的循环,绝非整场对话只出现一次!每轮新任务都必须执行确认流程,绝不可跳过确认直接作答!
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 💡 渠道与受支持模型速查
|
|
41
|
+
|
|
42
|
+
| 渠道 | 支持指定之模型代号 | 说明 |
|
|
43
|
+
| :--- | :--- | :--- |
|
|
44
|
+
| **Google AI Studio** | `Hydrogen` (`gemini-4-hydrogen`)<br>`Flash` (`gemini-3.8-flash`)<br>`Flash Lite` (`gemini-3.5-flash-lite`)<br>`Neon` (`gemini-4-neon`) | • 深度推理与长文本首选 `Hydrogen`;<br>• 日常极速首选 `Flash Lite`;<br>• ⚠️ **提示**:旧版实验代号 `Argon` 已被 Google 官方升级合并入 `Hydrogen`,若指定 Argon 将自动映射为 Hydrogen。 |
|
|
45
|
+
| **Gemini 官网** | `Auto` (官方原生模型) | 官网由 Google 原生大模型自动作答与联网增强,无需且无法指定单独模型代号。 |
|
|
46
|
+
| **Google Flow** | `Nano Banana 2.1`<br>`Omni 1.2 / Veo` | • 生图默认享受 0 扣点特权 (`Nano Banana 2.1`);<br>• 视频生成请指定 `Omni 1.2` 或 `Veo`。 |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 一、 第 1 步:生成提案并弹出交互选择栏
|
|
51
|
+
|
|
52
|
+
收到用户任务指令后,**必须且只能执行以下两步**:
|
|
53
|
+
|
|
54
|
+
1. **调用 `gemini_preview` 工具**:
|
|
55
|
+
- 传入参数:`{ "task": "用户的原始完整指令" }`
|
|
56
|
+
- `gemini_preview` 将由后端代码 100% 确定性解析目标渠道、入口模式、模型阶梯与挂载文件,杜绝任何模型幻觉!
|
|
57
|
+
2. **在聊天中输出卡片,并立即调用 `ask_user_question`**:
|
|
58
|
+
- 原样输出 `gemini_preview` 返回的卡片 Markdown;
|
|
59
|
+
- 立即调用 `ask_user_question`(参数同下方模板),聊天界面将自动弹出可点击的选择按钮:
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"questions": [
|
|
63
|
+
{
|
|
64
|
+
"id": "gemini_confirm",
|
|
65
|
+
"question": "👉 请确认是否发包执行?",
|
|
66
|
+
"options": [
|
|
67
|
+
{ "label": "(Recommended) 确认发包执行" },
|
|
68
|
+
{ "label": "调整参数" },
|
|
69
|
+
{ "label": "取消调度(本地作答)" }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
- 结束当前轮次回显,等待用户点击!
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 二、 第 2 步:授权发包与工具参数
|
|
80
|
+
|
|
81
|
+
当用户确认(点击选择栏「确认发包执行」或回复 `1` / `确认`)后,正式调用 `gemini_web_agent`:
|
|
82
|
+
|
|
83
|
+
| 工具参数 | 说明与传参规范 |
|
|
84
|
+
| :--- | :--- |
|
|
85
|
+
| `task` | 用户的完整需求提示词与任务描述 |
|
|
86
|
+
| `files` | 待上传的本地文件路径数组(若留空,插件将自动从 task 中提取兜底) |
|
|
87
|
+
| `model` | 用户指定的具体模型别名;智能降级模式下留空 |
|
|
88
|
+
| `site` | 目标渠道:`aistudio`(默认)、`flow` 或 `gemini` |
|
|
89
|
+
| `entry` | `chat`(默认)、`task` 或 `canvas` |
|
|
90
|
+
| `thinking_level` | `high`(默认)、`medium` 或 `low` |
|
|
91
|
+
| `thinking_policy` | `adaptive`(默认)、`strict` 或 `custom` |
|
|
92
|
+
| `new_chat` | `true`(默认开启独立新会话) |
|
|
93
|
+
|
|
94
|
+
**交付规范**:调用完成后,在最终回复中呈现降级通知、可点击的 `file://` 落地文件超链接以及核心架构说明,切忌全量重抄超长代码。
|