baoyu-danger-gemini-web
- 作者仓库星标 0
- 作者更新于 2026年7月4日 09:22
- 作者仓库 baoyu-skills
Gemini Web 客户端
通过 Gemini Web API 进行文本/图像生成。支持参考图像和多轮对话。
用户输入工具
当此技能提示用户时,请遵循此工具选择规则(优先级顺序):
- 优先使用当前 Agent 运行时公开的内置用户输入工具——例如
AskUserQuestion、request_user_input、clarify、ask_user或任何等效工具。 - 回退:如果不存在此类工具,则发出带编号的纯文本消息,并要求用户回复所选问题的编号/答案。
- 批处理:如果工具支持每次调用多个问题,则将所有适用问题合并到一次调用中;如果只支持单个问题,则按优先级顺序逐一提问。
下面具体的 AskUserQuestion 引用是示例——在其他运行时中请替换为本地等效项。
脚本目录
重要提示:所有脚本都位于此技能的 scripts/ 子目录中。
Agent 执行说明:
- 将此 SKILL.md 文件的目录路径确定为
{baseDir} - 脚本路径 =
{baseDir}/scripts/<script-name>.ts - 解析
${BUN_X}运行时:如果安装了bun→bun;如果npx可用 →npx -y bun;否则建议安装 bun - 将此文档中的所有
{baseDir}和${BUN_X}替换为实际值
脚本参考:
| 脚本 | 用途 |
|---|---|
scripts/main.ts |
文本/图像生成的 CLI 入口点 |
scripts/gemini-webapi/* |
gemini_webapi 的 TypeScript 移植(GeminiClient、类型、工具) |
同意检查(必需)
首次使用前,请验证用户是否同意使用逆向工程 API。
同意文件位置:
- macOS:
~/Library/Application Support/baoyu-skills/gemini-web/consent.json - Linux:
~/.local/share/baoyu-skills/gemini-web/consent.json - Windows:
%APPDATA%\baoyu-skills\gemini-web/consent.json
流程:
- 检查同意文件是否存在,且
accepted: true和disclaimerVersion: "1.0" - 如果存在有效同意 → 打印带有
acceptedAt日期的警告,继续 - 如果没有同意 → 显示免责声明,通过
AskUserQuestion询问用户:- 「是的,我接受」→ 创建带有 ISO 时间戳的同意文件,继续
- 「不,我拒绝」→ 输出拒绝消息,停止
- 同意文件格式:
{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}
首选项 (EXTEND.md)
按优先级顺序检查 EXTEND.md——找到的第一个生效:
| 优先级 | 路径 | 范围 |
|---|---|---|
| 1 | .baoyu-skills/baoyu-danger-gemini-web/EXTEND.md |
项目 |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-gemini-web/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md |
用户主目录 |
如果未找到,则使用默认值。
EXTEND.md 支持:默认模型、代理设置、自定义数据目录。
用法
# Text generation
${BUN_X} {baseDir}/scripts/main.ts "Your prompt"
${BUN_X} {baseDir}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash
# Image generation
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat" --image cat.png
${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png
# Vision input (reference images)
${BUN_X} {baseDir}/scripts/main.ts --prompt "Describe this" --reference image.png
${BUN_X} {baseDir}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png
# Multi-turn conversation
${BUN_X} {baseDir}/scripts/main.ts "Remember: 42" --sessionId session-abc
${BUN_X} {baseDir}/scripts/main.ts "What number?" --sessionId session-abc
# JSON output
${BUN_X} {baseDir}/scripts/main.ts "Hello" --json
选项
| 选项 | 描述 |
|---|---|
--prompt, -p |
提示文本 |
--promptfiles |
从文件读取提示(已连接) |
--model, -m |
模型:gemini-3-pro(默认)、gemini-3-flash、gemini-3-flash-thinking、gemini-3.1-pro-preview |
--image [path] |
生成图像(默认:generated.png) |
--reference, --ref |
视觉输入的参考图像 |
--sessionId |
多轮对话的会话 ID |
--list-sessions |
列出已保存的会话 |
--json |
以 JSON 格式输出 |
--login |
刷新 Cookie,然后退出 |
--cookie-path |
自定义 Cookie 文件路径 |
--profile-dir |
Chrome 配置文件目录 |
模型
| 模型 | 描述 |
|---|---|
gemini-3-pro |
默认,最新的 3.0 Pro |
gemini-3-flash |
快速、轻量级的 3.0 Flash |
gemini-3-flash-thinking |
带有思考功能的 3.0 Flash |
gemini-3.1-pro-preview |
3.1 Pro 预览版(空头部,自动路由) |
身份验证
首次运行会打开浏览器进行 Google 身份验证。Cookie 会自动缓存。
当未设置明确的配置文件目录时,Cookie 刷新可能会重用已运行的本地 Chrome/Chromium 调试会话,该会话绑定到标准用户数据目录。
设置 --profile-dir 或 GEMINI_WEB_CHROME_PROFILE_DIR 以强制使用专用配置文件并跳过现有会话的重用。
这是一个尽力而为的 CDP 会话重用路径,而不是 Chrome 官方文档中描述的基于 Chrome DevTools MCP 提示的 --autoConnect 流程。
支持的浏览器(自动检测):Chrome、Chrome Canary/Beta、Chromium、Edge。
强制刷新:--login 标志。覆盖浏览器:GEMINI_WEB_CHROME_PATH 环境变量。
环境变量
| 变量 | 描述 |
|---|---|
GEMINI_WEB_DATA_DIR |
数据目录 |
GEMINI_WEB_COOKIE_PATH |
Cookie 文件路径 |
GEMINI_WEB_CHROME_PROFILE_DIR |
Chrome 配置文件目录 |
GEMINI_WEB_CHROME_PATH |
Chrome 可执行文件路径 |
HTTP_PROXY, HTTPS_PROXY |
Google 访问代理(与命令内联设置) |
会话
会话文件存储在数据目录的 sessions/<id>.json 下。
包含:id、metadata(Gemini 聊天状态)、messages 数组、时间戳。
扩展支持
通过 EXTEND.md 进行自定义配置。有关路径和支持的选项,请参阅「首选项」部分。
Gemini Web Client
Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations.
User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
- Prefer built-in user-input tools exposed by the current agent runtime — e.g.,
AskUserQuestion,request_user_input,clarify,ask_user, or any equivalent. - Fallback: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
- Batching: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.
Script Directory
Important: All scripts are located in the scripts/ subdirectory of this skill.
Agent Execution Instructions:
- Determine this SKILL.md file's directory path as
{baseDir} - Script path =
{baseDir}/scripts/<script-name>.ts - Resolve
${BUN_X}runtime: ifbuninstalled →bun; ifnpxavailable →npx -y bun; else suggest installing bun - Replace all
{baseDir}and${BUN_X}in this document with actual values
Script Reference:
| Script | Purpose |
|---|---|
scripts/main.ts |
CLI entry point for text/image generation |
scripts/gemini-webapi/* |
TypeScript port of gemini_webapi (GeminiClient, types, utils) |
Consent Check (REQUIRED)
Before first use, verify user consent for reverse-engineered API usage.
Consent file locations:
- macOS:
~/Library/Application Support/baoyu-skills/gemini-web/consent.json - Linux:
~/.local/share/baoyu-skills/gemini-web/consent.json - Windows:
%APPDATA%\baoyu-skills\gemini-web\consent.json
Flow:
- Check if consent file exists with
accepted: trueanddisclaimerVersion: "1.0" - If valid consent exists → print warning with
acceptedAtdate, proceed - If no consent → show disclaimer, ask user via
AskUserQuestion:- "Yes, I accept" → create consent file with ISO timestamp, proceed
- "No, I decline" → output decline message, stop
- Consent file format:
{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}
Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|---|---|---|
| 1 | .baoyu-skills/baoyu-danger-gemini-web/EXTEND.md |
Project |
| 2 | ${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-danger-gemini-web/EXTEND.md |
XDG |
| 3 | $HOME/.baoyu-skills/baoyu-danger-gemini-web/EXTEND.md |
User home |
If none found, use defaults.
EXTEND.md supports: Default model, proxy settings, custom data directory.
Usage
# Text generation
${BUN_X} {baseDir}/scripts/main.ts "Your prompt"
${BUN_X} {baseDir}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash
# Image generation
${BUN_X} {baseDir}/scripts/main.ts --prompt "A cute cat" --image cat.png
${BUN_X} {baseDir}/scripts/main.ts --promptfiles system.md content.md --image out.png
# Vision input (reference images)
${BUN_X} {baseDir}/scripts/main.ts --prompt "Describe this" --reference image.png
${BUN_X} {baseDir}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png
# Multi-turn conversation
${BUN_X} {baseDir}/scripts/main.ts "Remember: 42" --sessionId session-abc
${BUN_X} {baseDir}/scripts/main.ts "What number?" --sessionId session-abc
# JSON output
${BUN_X} {baseDir}/scripts/main.ts "Hello" --json
Options
| Option | Description |
|---|---|
--prompt, -p |
Prompt text |
--promptfiles |
Read prompt from files (concatenated) |
--model, -m |
Model: gemini-3-pro (default), gemini-3-flash, gemini-3-flash-thinking, gemini-3.1-pro-preview |
--image [path] |
Generate image (default: generated.png) |
--reference, --ref |
Reference images for vision input |
--sessionId |
Session ID for multi-turn conversation |
--list-sessions |
List saved sessions |
--json |
Output as JSON |
--login |
Refresh cookies, then exit |
--cookie-path |
Custom cookie file path |
--profile-dir |
Chrome profile directory |
Models
| Model | Description |
|---|---|
gemini-3-pro |
Default, latest 3.0 Pro |
gemini-3-flash |
Fast, lightweight 3.0 Flash |
gemini-3-flash-thinking |
3.0 Flash with thinking |
gemini-3.1-pro-preview |
3.1 Pro preview (empty header, auto-routed) |
Authentication
First run opens browser for Google auth. Cookies cached automatically.
When no explicit profile dir is set, cookie refresh may reuse an already-running local Chrome/Chromium debugging session tied to a standard user-data dir.
Set --profile-dir or GEMINI_WEB_CHROME_PROFILE_DIR to force a dedicated profile and skip existing-session reuse.
This is a best-effort CDP session reuse path, not the Chrome DevTools MCP prompt-based --autoConnect flow described in Chrome's official docs.
Supported browsers (auto-detected): Chrome, Chrome Canary/Beta, Chromium, Edge.
Force refresh: --login flag. Override browser: GEMINI_WEB_CHROME_PATH env var.
Environment Variables
| Variable | Description |
|---|---|
GEMINI_WEB_DATA_DIR |
Data directory |
GEMINI_WEB_COOKIE_PATH |
Cookie file path |
GEMINI_WEB_CHROME_PROFILE_DIR |
Chrome profile directory |
GEMINI_WEB_CHROME_PATH |
Chrome executable path |
HTTP_PROXY, HTTPS_PROXY |
Proxy for Google access (set inline with command) |
Sessions
Session files stored in data directory under sessions/<id>.json.
Contains: id, metadata (Gemini chat state), messages array, timestamps.
Extension Support
Custom configurations via EXTEND.md. See Preferences section for paths and supported options.
- 流狐分类
- AI 智能
- 作者声明 Agent
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 92 / 100 · 启发式扫描,不代表运行安全
- 作者 / 版本 / 许可
- @JimLiu · v1.56.2 · 未声明 license
- 流狐 Token 估算
- 低消耗
- 流狐接入估算
- 需简单配置
- 是否需要外部 API Key
- 未发现要求
- 检测到的系统要求
- macOS · Linux · Windows
- 底层运行要求
- Bun
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- Shell 执行
- 读取环境变量
- 检测到的网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
档案由构建时根据 SKILL.md 与安装命令自动衍生,可能与作者实际意图存在差异。
需要注意: 未限定 allowed-tools,默认拥有全部工具权限。
作者没有在当前 SKILL.md 中定义固定输出样例。 When this skill prompts the user, follow this tool-selection rule (priority order): Prefer built-in user-input tools exposed by the current agent runtime — e.g., AskUserQuestion, requestuserinput, clarify, askuser, or any equivalent.
Important: All scripts are located in the scripts/ subdirectory of this skill. Agent Execution Instructions: Determine this SKILL.md file's directory path as {baseDir}
Before first use, verify user consent for reverse-engineered API usage. Consent file locations: macOS: ~/Library/Application Support/baoyu-skills/gemini-web/consent.json
Check EXTEND.md in priority order — the first one found wins: Priority · Path · Scope 1 · .baoyu-skills/baoyu-danger-gemini-web/EXTEND.md · Project
Usage
Option · Description --prompt, -p · Prompt text --promptfiles · Read prompt from files (concatenated)
# Gemini Web Client
Text/image generation via Gemini Web API. Supports reference images and multi-turn conversations.
## User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent.
2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question.
3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order.
Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes.
## Script Directory
**Important**: All scripts are located in the `scripts/` subdirectory of this skill.
**Agent Execution Instructions**:
1. Determine this SKILL.md file's directory path as `{baseDir}`
2. Script path = `{baseDir}/scripts/<script-name>.ts`
3. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun
4. Replace all `{baseDir}` and `${BUN_X}` in this document with actual values
**Script Reference**:
| Script | Purpose |
|--------|---------|
| `scripts/main.ts` | CLI entry point for text/image generation |
| `scripts/gemini-webapi/*` | TypeScript port of `gemini_webapi` (GeminiClient, types, utils) |
## Consent Check (REQUIRED)
Before first use, verify user consent for reverse-engineered API usage.
**Consent file locations**:
- macOS: `~/Library/Application Support/baoyu-skills/gemini-web/consent.json`
… 作者原文负责流程事实;流狐只索引当前章节、要点、文件与命令。
章节 -> User Input Tools → Script Directory → Consent Check (REQUIRED) → Preferences (EXTEND.md) → Usage → Options
要点 -> Prefer built-in user-input tools · Fallback · Batching · Important · Agent Execution Instructions · Script Reference · Consent file locations · Flow
文件/命令 -> AskUserQuestion · requestuserinput · clarify · askuser · scripts/ · {baseDir} · {baseDir}/scripts/<script-name>.ts · ${BUNX}
内容 SHA-256 -> 626dc8bd15da
原文结构
适用与边界
原文中的明确线索
AskUserQuestion、requestuserinput、clarify、askuser、scripts/、{baseDir}、{baseDir}/scripts/<script-name>.ts、${BUNX}