Google Flow UI Client
Generate images in Google Flow through Chrome CDP + browser UI automation.
Important constraints:
- - Project creation is UI-only
- Prompt submission is UI-only
- Do not use or describe any API-based project creation path
- Images are considered complete once the base images are visible in the browser
Script Directory
Resolve:
- 1.
{baseDir} = directory containing this INLINECODE1 - Script path = INLINECODE2
- INLINECODE3 =
bun if installed, else INLINECODE5
Consent Check (REQUIRED)
Before first use, verify user consent for reverse-engineered API usage.
Consent file locations:
- - macOS: INLINECODE6
- Linux: INLINECODE7
- Windows: INLINECODE8
Flow:
- 1. Check if consent file exists with
accepted: true and INLINECODE10 - If valid consent exists → print warning with
acceptedAt date, 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
- 4. Consent file format: INLINECODE13
Preferences (EXTEND.md)
Check EXTEND.md existence (priority order):
CODEBLOCK0
EXTEND.md Supports: Default model | Default aspect ratio | Custom data directory
Execution Envelope (REQUIRED)
Before any pre-flight check or main.ts invocation, decide one shell environment and reuse it for every command in the run.
- - Use the same INLINECODE15
- Use the same proxy variables
- Use the same CDP / Chrome profile variables
If you set any of these once, keep them identical for all later commands in the turn:
- - INLINECODE16
- INLINECODE17
- INLINECODE18 / INLINECODE19
- INLINECODE20
- INLINECODE21 / INLINECODE22
- INLINECODE23
- INLINECODE24
- INLINECODE25
- INLINECODE26
Never run pre-flight checks in one environment and main.ts in another.
Preferred proxy setup:
CODEBLOCK1
Usage
Before running any generation command, complete the Pre-flight Checks below.
CODEBLOCK2
Batch mode rules:
- - Use one command with repeated INLINECODE28
- The first prompt creates a new project through the UI unless
--project-id is supplied - Later prompts reuse that same project
- Do not run multiple separate
main.ts commands for a multi-prompt batch
Pre-flight Checks
Run these checks in order. Each step must pass before moving to the next.
Step 1: Runtime Prerequisites (BLOCKING)
Check the Bun runtime and Python:
CODEBLOCK3
If any required command is missing, stop.
If running under WSL, also verify the Windows bridge and Chrome path assumptions:
CODEBLOCK4
If not running under WSL, ensure FLOW_WEB_CHROME_PATH is set before continuing.
Step 2: Browser Profile Check (AUTO-RESOLVE)
Check if the Chrome debug user data directory exists. Default WSL-visible path:
- - INLINECODE32
- env override: INLINECODE33
CODEBLOCK5
- -
EXISTS → proceed - INLINECODE35 → proceed, but tell the user a fresh browser profile will be created
Step 3: Network Connectivity Check (WARN + WAIT)
Test Google reachability using the same environment you will use for main.ts:
CODEBLOCK6
- -
200/301/302 → proceed - INLINECODE38 → stop and fix proxy settings first
Do not continue into main.ts while shell networking and browser proxy settings disagree.
Step 4: Login State Check (WARN + GUIDE)
Check if cached credentials exist:
Linux default cookie file:
CODEBLOCK7
- -
EXISTS → proceed - INLINECODE42 → run:
${BUN_X} {baseDir}/scripts/main.ts --login --verbose
Then wait for the user to finish Google login in the browser.
Generation Rules
The skill supports exactly two generation entry modes:
- - New project: omit
--project-id; the script creates a project through the Flow UI - Existing project: provide INLINECODE44
Do not invent any third path.
Explicitly forbidden:
- - API-based project creation
- Describing API project creation as a fallback
- Mixing one failed path with a different project-creation mechanism mid-run
If automatic UI project creation fails:
- 1. Inspect the Flow listing page in the browser
- Fix the UI state only
- Retry the same UI path
- If needed, manually click
新建项目 in the browser, capture the resulting project id from the URL, then rerun main.ts with INLINECODE47
The fallback is still UI-only.
Task Completion (IMPORTANT)
INLINECODE48 only automates the UI. It fills the prompt, clicks Create, then exits immediately. Actual image generation continues asynchronously in the browser.
After main.ts exits with code 0:
- 1. The script has successfully submitted all prompts. Images are now generating in the browser.
- You MUST verify generation completion by taking a browser screenshot (via CDP or screenshot tool) and visually checking whether images have appeared on the page.
- If the screenshot shows images are still loading (spinner, progress indicator, blank placeholders), wait 10-15 seconds and take another screenshot.
- Repeat until all images are visible, or until 2 minutes have passed (then report a timeout).
- Once the base images are confirmed visible, stop and report completion.
- Do NOT download, fetch, curl, or render any URLs. Images are visible in the browser.
Important completion rule:
- - If the images are visible and Flow still shows optional HD-enhancement / download / post-processing toasts, treat the task as complete anyway.
If the script exits with a non-zero code, report the error and stop.
Options
| Option | Description |
|---|
| INLINECODE50 , INLINECODE51 | Prompt text (repeat for batch mode) |
| INLINECODE52 , INLINECODE53 |
Model ID (see Models table) |
|
--aspect,
-a | Aspect ratio: 16:9 (default), 9:16 |
|
--count | Number of images: 1-4 (default: 2) |
|
--project-id | Reuse existing project |
|
--verbose | Enable debug logging |
|
--login | Authenticate and save cookies, then exit |
|
--cookie-path | Custom cookie file path |
|
--profile-dir | Chrome profile directory |
Models
| Model | Description |
|---|
| INLINECODE62 | Nano Banana 2 (default, fast) |
| INLINECODE63 |
Nano Banana Pro |
Optional Verification Helper
If /home/admin1/.openclaw/workspace/scripts/agent-browser-cdp.sh exists, it is a convenient helper for screenshots and browser inspection after generation:
CODEBLOCK9
This helper is optional. Generation must not depend on agent-browser being installed.
Environment Variables
| Variable | Description |
|---|
| INLINECODE66 | Preferred proxy for shell/API requests |
| INLINECODE67 / INLINECODE68 |
Standard proxy env vars |
|
FLOW_WEB_DATA_DIR | Data directory |
|
FLOW_WEB_COOKIE_PATH | Cookie file path |
|
FLOW_WEB_CHROME_PROFILE_DIR | Local Chrome user data dir when not on WSL |
|
FLOW_WEB_CHROME_PATH | Chrome executable path for non-WSL environments |
|
FLOW_WEB_DEBUG_PORT | Fixed Chrome debug port |
|
FLOW_WEB_CHROME_EXE_WIN | Windows Chrome path override when running from WSL |
|
FLOW_WEB_CHROME_USER_DATA_DIR_WIN | Windows Chrome user data dir override when running from WSL |
|
FLOW_WEB_CHROME_EXTRA_ARGS | Extra Chrome args |
|
AGENT_BROWSER_CHROME_PROXY_SERVER | Browser proxy used by host Chrome |
|
AGENT_BROWSER_USER_DATA_DIR_WIN | Windows-side Chrome debug profile override |
|
AGENT_BROWSER_CMD_EXE_WSL | WSL path to
cmd.exe |
|
BAOYU_CHROME_PROFILE_DIR | Shared Chrome profile override |
技能名称: auto-free-banana
详细描述:
Google Flow UI 客户端
通过 Chrome CDP + 浏览器 UI 自动化在 Google Flow 中生成图像。
重要约束:
- - 项目创建仅限 UI 操作
- 提示词提交仅限 UI 操作
- 不要使用或描述任何基于 API 的项目创建路径
- 一旦基础图像在浏览器中可见,即视为图像生成完成
脚本目录
解析:
- 1. {baseDir} = 包含此 SKILL.md 文件的目录
- 脚本路径 = {baseDir}/scripts/main.ts
- ${BUN_X} = 如果已安装则为 bun,否则为 npx -y bun
同意确认(必需)
首次使用前,请确认用户对逆向工程 API 使用的同意。
同意文件位置:
- - macOS:~/Library/Application Support/baoyu-skills/flow-web/consent.json
- Linux:~/.local/share/baoyu-skills/flow-web/consent.json
- Windows:%APPDATA%\baoyu-skills\flow-web\consent.json
流程:
- 1. 检查同意文件是否存在且包含 accepted: true 和 disclaimerVersion: 1.0
- 如果存在有效同意 → 打印包含 acceptedAt 日期的警告,继续执行
- 如果没有同意 → 显示免责声明,通过 AskUserQuestion 询问用户:
- 是,我接受 → 创建包含 ISO 时间戳的同意文件,继续执行
- 不,我拒绝 → 输出拒绝消息,停止执行
- 4. 同意文件格式:{version:1,accepted:true,acceptedAt:,disclaimerVersion:1.0}
偏好设置(EXTEND.md)
检查 EXTEND.md 是否存在(优先级顺序):
bash
test -f .baoyu-skills/auto-free-banana/EXTEND.md && echo project
test -f ${XDGCONFIGHOME:-$HOME/.config}/baoyu-skills/auto-free-banana/EXTEND.md && echo xdg
test -f $HOME/.baoyu-skills/auto-free-banana/EXTEND.md && echo user
EXTEND.md 支持:默认模型 | 默认宽高比 | 自定义数据目录
执行环境(必需)
在任何预检检查或调用 main.ts 之前,确定一个 shell 环境,并在本次运行中每个命令都重复使用该环境。
- - 使用相同的 PATH
- 使用相同的代理变量
- 使用相同的 CDP / Chrome 配置文件变量
如果你曾设置过以下任何变量,请在后续所有命令中保持它们一致:
- - PATH
- FLOWWEBPROXY
- HTTPSPROXY / HTTPPROXY
- AGENTBROWSERCHROMEPROXYSERVER
- FLOWWEBDEBUGPORT / AGENTBROWSERCDPPORT
- FLOWWEBCOOKIEPATH
- FLOWWEBCHROMEPROFILEDIR
- AGENTBROWSERUSERDATADIRWIN
- AGENTBROWSERCMDEXEWSL
绝不要在一个环境中运行预检检查,而在另一个环境中运行 main.ts。
推荐的代理设置:
bash
export FLOWWEBPROXY=http://host:port
export HTTPSPROXY=$FLOWWEB_PROXY
export HTTPPROXY=$FLOWWEB_PROXY
export AGENTBROWSERCHROMEPROXYSERVER=$FLOWWEBPROXY
使用方法
在运行任何生成命令之前,请先完成下方的预检检查。
bash
默认生成:通过 UI 创建一个新的 Flow 项目
${BUN_X} {baseDir}/scripts/main.ts --prompt 一只可爱的猫
指定模型 + 竖屏 + 2 张图像
${BUN
X} {baseDir}/scripts/main.ts --prompt 日落 --model NANOBANANA_PRO --aspect 9:16 --count 2
仅当已有项目 ID 时,重用现有的 Flow 项目
${BUN_X} {baseDir}/scripts/main.ts --project-id
--prompt 日落
仅进行身份验证
${BUN_X} {baseDir}/scripts/main.ts --login
批量模式:在同一个项目中提交多个提示词(间隔 5 秒)
${BUN_X} {baseDir}/scripts/main.ts --prompt 一只可爱的猫 --prompt 日落 --prompt 山景
批量模式规则:
- - 使用单个命令,重复使用 --prompt
- 除非提供了 --project-id,否则第一个提示词通过 UI 创建一个新项目
- 后续提示词重用同一个项目
- 不要为多提示词批次运行多个独立的 main.ts 命令
预检检查
按顺序运行这些检查。每一步必须通过才能进入下一步。
第 1 步:运行时先决条件(阻塞性)
检查 Bun 运行时和 Python:
bash
command -v bun >/dev/null && echo BUN || command -v npx >/dev/null && echo NPX_BUN || echo MISSING
command -v python3 >/dev/null && echo OK || echo MISSING
如果任何必需命令缺失,则停止。
如果在 WSL 下运行,还需验证 Windows 桥接和 Chrome 路径假设:
bash
test -x /mnt/c/Windows/System32/cmd.exe && echo OK || echo MISSING
test -f /mnt/c/Program Files/Google/Chrome/Application/chrome.exe && echo OK || echo MISSING
如果不在 WSL 下运行,请确保在继续之前设置了 FLOWWEBCHROME_PATH。
第 2 步:浏览器配置文件检查(自动解析)
检查 Chrome 调试用户数据目录是否存在。WSL 可见的默认路径:
- - /mnt/c/chrome-debug-openclaw
- 环境变量覆盖:AGENTBROWSERUSERDATADIR_WIN
bash
test -d /mnt/c/chrome-debug-openclaw && echo EXISTS || echo NEW
- - EXISTS → 继续执行
- NEW → 继续执行,但告知用户将创建一个新的浏览器配置文件
第 3 步:网络连接检查(警告 + 等待)
使用与 main.ts 相同的环境测试 Google 可达性:
bash
curl -sS --connect-timeout 5 -o /dev/null -w %{http_code} https://labs.google/fx/ 2>/dev/null || echo FAIL
- - 200/301/302 → 继续执行
- FAIL / 超时 → 先停止并修复代理设置
在 shell 网络设置和浏览器代理设置不一致时,不要继续进入 main.ts。
第 4 步:登录状态检查(警告 + 引导)
检查缓存的凭据是否存在:
Linux 默认 cookie 文件:
- - ~/.local/share/baoyu-skills/flow-web/cookies.json
bash
test -f ~/.local/share/baoyu-skills/flow-web/cookies.json && echo EXISTS || echo NONE
- - EXISTS → 继续执行
- NONE → 运行:
bash
${BUN_X} {baseDir}/scripts/main.ts --login --verbose
然后等待用户在浏览器中完成 Google 登录。
生成规则
该技能仅支持两种生成入口模式:
- - 新项目:省略 --project-id;脚本通过 Flow UI 创建项目
- 现有项目:提供 --project-id
不要发明任何第三种路径。
明确禁止:
- - 基于 API 的项目创建
- 将 API 项目创建描述为后备方案
- 在运行过程中将失败的路径与不同的项目创建机制混合使用
如果自动 UI 项目创建失败:
- 1. 在浏览器中检查 Flow 列表页面
- 仅修复 UI 状态
- 重试相同的 UI 路径
- 如有必要,在浏览器中手动点击新建项目,从 URL 中捕获生成的项目 ID,然后使用 --project-id 重新运行 main.ts
后备方案仍然是仅限 UI 操作。
任务完成(重要)
main.ts 仅自动化 UI 操作。它填写提示词,点击创建,然后立即退出。实际的图像生成在浏览器中异步继续。
在 main.ts 以退出码 0 退出后:
- 1. 脚本已成功提交所有提示词。图像现在正在浏览器中生成。
- 你必须通过截取