ai-browser-bridge 0.7.0 → 0.7.1

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/README.es.md CHANGED
@@ -179,7 +179,7 @@ Flow requiere un plan **Google AI Pro/Ultra**. Como los renders de Veo tardan mi
179
179
 
180
180
  ## Soporte de Claude Design
181
181
 
182
- El bridge controla **[Claude Design](https://claude.ai/design)** desde tu Chrome del bridge con sesión iniciada. Las lecturas y los cambios de proyectos/archivos usan las propias peticiones de la app desde la pestaña ([ADR 0021](docs/adr/current/0021-claude-design-app-rpc.md)); los turnos, plantillas y modelo/esfuerzo pasan por la interfaz real, una pestaña por proyecto.
182
+ El bridge controla **[Claude Design](https://claude.ai/design)** desde tu Chrome del bridge con sesión iniciada. Las lecturas y los cambios de proyectos/archivos usan las propias peticiones de la app desde la pestaña; los turnos, plantillas y modelo/esfuerzo pasan por la interfaz real, una pestaña por proyecto.
183
183
 
184
184
  ```bash
185
185
  bridge chrome start --provider design
package/README.he.md CHANGED
@@ -211,7 +211,7 @@ bridge flow project-delete --yes # מחיקה לצמיתות של הפר
211
211
 
212
212
  ## תמיכה ב-Claude Design
213
213
 
214
- ה-bridge מפעיל את **[Claude Design](https://claude.ai/design)** מתוך ה-Chrome של ה-bridge שבו אתם מחוברים. קריאות ושינויים בפרויקטים ובקבצים עוברים דרך הבקשות של האפליקציה עצמה מתוך הלשונית ([ADR 0021](docs/adr/current/0021-claude-design-app-rpc.md)); סבבי שיחה, תבניות, מודל ורמת מאמץ עוברים דרך הממשק האמיתי, לשונית אחת לכל פרויקט.
214
+ ה-bridge מפעיל את **[Claude Design](https://claude.ai/design)** מתוך ה-Chrome של ה-bridge שבו אתם מחוברים. קריאות ושינויים בפרויקטים ובקבצים עוברים דרך הבקשות של האפליקציה עצמה מתוך הלשונית; סבבי שיחה, תבניות, מודל ורמת מאמץ עוברים דרך הממשק האמיתי, לשונית אחת לכל פרויקט.
215
215
 
216
216
  ```bash
217
217
  bridge chrome start --provider design
package/README.md CHANGED
@@ -374,7 +374,7 @@ Flow requires a **Google AI Pro/Ultra** plan. Because Veo renders take minutes,
374
374
 
375
375
  ## Claude Design support
376
376
 
377
- The bridge drives **[Claude Design](https://claude.ai/design)** — Claude's project workspace for slides, prototypes, and documents — from your signed-in bridge Chrome. Reads and project/file changes use the app's own requests from inside the tab (one call each, [ADR 0021](docs/adr/current/0021-claude-design-app-rpc.md)); turns, templates, and model/effort go through the real UI, one tab per project.
377
+ The bridge drives **[Claude Design](https://claude.ai/design)** — Claude's project workspace for slides, prototypes, and documents — from your signed-in bridge Chrome. Reads and project/file changes use the app's own requests from inside the tab (one call each); turns, templates, and model/effort go through the real UI, one tab per project.
378
378
 
379
379
  ```bash
380
380
  bridge chrome start --provider design # sign in at claude.ai
package/README.zh.md CHANGED
@@ -179,7 +179,7 @@ Flow 需要 **Google AI Pro/Ultra** 套餐。由于 Veo 渲染需要数分钟,
179
179
 
180
180
  ## Claude Design 支持
181
181
 
182
- bridge 可以在已登录的 bridge Chrome 中驱动 **[Claude Design](https://claude.ai/design)**。读取以及项目/文件的修改通过标签页内应用自身的请求完成([ADR 0021](docs/adr/current/0021-claude-design-app-rpc.md));对话轮次、模板、模型和推理强度则通过真实界面操作,每个项目一个标签页。
182
+ bridge 可以在已登录的 bridge Chrome 中驱动 **[Claude Design](https://claude.ai/design)**。读取以及项目/文件的修改通过标签页内应用自身的请求完成;对话轮次、模板、模型和推理强度则通过真实界面操作,每个项目一个标签页。
183
183
 
184
184
  ```bash
185
185
  bridge chrome start --provider design
package/SKILL.md ADDED
@@ -0,0 +1,235 @@
1
+ ---
2
+ name: ai-browser-bridge
3
+ description: Drive ChatGPT, Gemini, Claude, DeepSeek, Grok, Perplexity, Duck.ai, Arena, Google Flow, or Claude Design (claude.ai/design) through a signed-in Chrome session, either from the bridge CLI or its outbound MCP tools. Use when Claude Code, Codex, or another agent should ask a browser-hosted model, upload local files or screenshots, search, resume, or batch-organize browser conversations, fan out across providers, create or edit Claude Design projects (slides, prototypes, documents), or use bridge-managed ChatGPT and Flow capabilities.
4
+ ---
5
+
6
+ # ai-browser-bridge
7
+
8
+ Drive ChatGPT, Gemini, Claude, DeepSeek, Grok, Perplexity, Duck.ai, Arena, Google Flow, or Claude Design in a real browser from any agent — one provider or fanned out. Exposes sandboxed local repo tools to ChatGPT, Claude, and Grok over MCP, and serves outbound MCP `ask`, `search_conversations`, ChatGPT, Flow, and Claude Design tools so agents can call browser surfaces natively.
9
+
10
+ ## Prerequisites
11
+
12
+ - macOS
13
+ - Node.js ≥ 22
14
+ - Google Chrome
15
+ - `cloudflared` (optional, for ChatGPT, Claude, and Grok MCP tools)
16
+ - Signed-in providers: run `bridge chrome start --provider <name>` and sign in if needed
17
+
18
+ ## Install & setup
19
+
20
+ ```bash
21
+ npm install -g ai-browser-bridge # installs `bridge` and ships this SKILL.md
22
+ ```
23
+
24
+ The package folder is also the skill folder. Link it once into each agent's
25
+ global skills directory; every later `npm install -g ai-browser-bridge` then
26
+ updates the skill too:
27
+
28
+ ```bash
29
+ PKG="$(npm root -g)/ai-browser-bridge"
30
+ mkdir -p ~/.claude/skills ~/.agents/skills
31
+ ln -sfn "$PKG" ~/.claude/skills/ai-browser-bridge # Claude Code
32
+ ln -sfn "$PKG" ~/.agents/skills/ai-browser-bridge # Codex
33
+ ```
34
+
35
+ ## How to use as a tool
36
+
37
+ ### MCP stdio (Claude Code, Codex, Kiro, any MCP client)
38
+
39
+ ```bash
40
+ bridge serve
41
+ ```
42
+
43
+ Exposes tools over stdio:
44
+ - `ask({ prompt, providers?, timeoutSeconds? })`
45
+ - `search_conversations({ query, providers?, limit? })`
46
+ - `design_*` for Claude Design: `design_state`, `design_list_projects`, `design_catalog`,
47
+ `design_choose_model`, `design_create_project`, `design_send`, `design_read_conversation`,
48
+ `design_new_conversation`, `design_rename_conversation`, `design_list_files`,
49
+ `design_put_files`, `design_remove_files`, `design_download`, `design_share`,
50
+ `design_update_project`, `design_duplicate_project`, `design_delete_project`,
51
+ `design_open_project`. `design_delete_project` and `design_remove_files` need
52
+ `confirm: true`; `design_put_files` replaces an existing path without asking.
53
+ - `flow_*` for Google Flow: `flow_generate`, `flow_extend_clip`, `flow_reuse_clip`,
54
+ `flow_list_clips`, `flow_list_projects`, `flow_list_ingredients`, `flow_download_clips`,
55
+ `flow_rename_clip`, `flow_rename_project`, `flow_delete_clip`, `flow_delete_project`,
56
+ `flow_remove_ingredient`, `flow_clear_ingredients`
57
+ - `chatgpt_render_state` for the live ChatGPT render (streaming, image progress, limits)
58
+
59
+ ### CLI (Codex, scripts, any shell-based agent)
60
+
61
+ ```bash
62
+ # One provider
63
+ bridge ask "summarize this repo" --provider chatgpt --json
64
+
65
+ # Fan out across multiple
66
+ bridge ask "compare approaches" --provider claude,deepseek,grok --json
67
+ ```
68
+
69
+ `--json` emits machine-readable output. Never hangs in a pipe.
70
+
71
+ ## Claude Design
72
+
73
+ Claude Design (claude.ai/design) is a project workspace for slides, prototypes,
74
+ and documents. The bridge drives it in the signed-in bridge Chrome, one tab per
75
+ project. It is not a fan-out provider, so `ask` does not reach it; use the
76
+ `design_*` tools or `bridge design` instead.
77
+
78
+ 1. `bridge chrome start --provider design` and sign in at claude.ai if needed.
79
+ 2. `design_state` first: where Claude Design is, whether a turn is running, and
80
+ which actions are available.
81
+ 3. `design_catalog` for templates, models with effort levels, and design systems.
82
+ 4. New work: `design_create_project` with a prompt (and optional template, model,
83
+ effort, attachments). It waits for Claude's first reply.
84
+ 5. Follow-ups: `design_send` in the project's Conversation, then
85
+ `design_read_conversation` to read replies. For long turns pass `wait: false`
86
+ and poll `design_read_conversation`.
87
+ 6. Files: `design_list_files`, `design_put_files` (repo files only),
88
+ `design_download` into `.bridge/downloads/design`.
89
+
90
+ Same surface from a shell:
91
+
92
+ ```bash
93
+ bridge design state --json
94
+ bridge design create --template Slides --prompt "our Q3 launch" --json
95
+ bridge design send --project <id> --message "make the title bolder" --json
96
+ bridge design read --project <id> --json
97
+ ```
98
+
99
+ Left to the human in the UI: Publish as artifact, Send to Claude Code,
100
+ PNG/video/PDF/PowerPoint export, comments, and version restore.
101
+
102
+ ## Per-agent setup
103
+
104
+ ### Claude Code
105
+
106
+ ```bash
107
+ claude mcp add --transport stdio --scope user ai-browser-bridge -- bridge serve
108
+ ```
109
+
110
+ ### Codex
111
+
112
+ ```bash
113
+ codex mcp add ai-browser-bridge -- bridge serve
114
+ ```
115
+
116
+ This writes `[mcp_servers.ai-browser-bridge]` to `~/.codex/config.toml`. Codex can
117
+ also call the CLI directly, for example `bridge ask "your question" --provider chatgpt --json`.
118
+
119
+ ### Kiro
120
+
121
+ Add to your MCP config:
122
+ ```jsonc
123
+ {
124
+ "mcpServers": {
125
+ "ai-browser-bridge": { "command": "bridge", "args": ["serve"] }
126
+ }
127
+ }
128
+ ```
129
+
130
+ ### Cursor
131
+
132
+ Add to `.cursor/mcp.json`:
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "ai-browser-bridge": { "command": "bridge", "args": ["serve"] }
137
+ }
138
+ }
139
+ ```
140
+
141
+ ## Available commands
142
+
143
+ | Command | Purpose |
144
+ |---------|---------|
145
+ | `bridge` (bare) | Interactive TUI |
146
+ | `bridge ask <prompt>` | One-shot send + reply |
147
+ | `bridge chrome start --provider <name>` | Start existing Chrome profile with debug port |
148
+ | `bridge status` / `bridge chrome status` | Show Chrome debug-port status |
149
+ | `bridge cache list\|prune` | Inspect/prune safe generated Chrome cache |
150
+ | `bridge serve` | Outbound MCP ask/search tools (stdio) |
151
+ | `bridge download` | Download conversation attachments |
152
+ | `bridge sessions` | List stored sessions |
153
+ | `bridge stop` | Kill warm Chrome |
154
+ | `bridge project list\|create\|rename\|delete` | Manage ChatGPT Projects |
155
+ | `bridge chat list\|search\|move\|organize\|archive` | List, search, batch-organize & archive conversations |
156
+ | `bridge chat organize status\|pause\|resume` | Inspect or control the latest persisted organization queue |
157
+ | `bridge task list\|create` | Schedule ChatGPT Tasks |
158
+ | `bridge chatgpt` | Inspect the live ChatGPT render |
159
+ | `bridge flow` | Generate and manage Google Flow clips and ingredients |
160
+ | `bridge design` | Claude Design projects, templates, model/effort, files, Conversations, share |
161
+
162
+ ## Keep conversations organized (ChatGPT)
163
+
164
+ Before starting a **new** ChatGPT conversation, check whether it belongs in an
165
+ existing Project instead of adding one more loose chat:
166
+
167
+ 1. `bridge project list` — the Projects that already exist.
168
+ 2. `bridge chat search "<topic>"` — a related past chat (and where it lives).
169
+ 3. If a Project fits, ask/resume there, then file the chat:
170
+ `bridge chat move "<idOrTitle>" --project "<Project>"`.
171
+ 4. Only leave a chat loose when nothing fits. The first time a **second**
172
+ related chat appears, `bridge project create "<Project>"` and move both in.
173
+
174
+ For agents driving the bridge:
175
+
176
+ - One Project per topic / repo / deliverable — reuse before you create.
177
+ - `bridge chat list --orphans` shows only loose (project-less) chats; a growing list
178
+ there is the signal to file them into Projects.
179
+ - Archive dead or scratch chats with `bridge chat archive "<idOrTitle>"`
180
+ (reversible — hides from the sidebar) to keep it lean. Batch with `--id`.
181
+ - Don't spawn throwaway or test conversations in the signed-in account. Use an
182
+ isolate profile (`bridge ask --fan-out` with `isolate`) for scratch runs, and
183
+ clean up anything you create.
184
+
185
+ For a full-history cleanup, scan only loose chats with
186
+ `bridge chat list --orphans --json`, group clear recurring topics, and leave
187
+ ambiguous or uncommon chats loose. Reuse existing Projects first; create a new
188
+ Project only for a stable topic with at least two chats. Put every accepted move
189
+ into one JSON plan of `{ "conversation": "<idOrTitle>", "project": "<name>" }`
190
+ items, dry-run it, then start the persisted queue:
191
+
192
+ ```bash
193
+ bridge chat organize --plan @organization-plan.json --dry-run
194
+ bridge chat organize --plan @organization-plan.json \
195
+ --interval 60 --cooldown 600 --max-attempts 4 --json
196
+
197
+ # Later lifecycle operations do not need the plan again
198
+ bridge chat organize status --json
199
+ bridge chat organize pause
200
+ bridge chat organize resume --json
201
+ ```
202
+
203
+ The queue persists under `.bridge/chat-organization-queues/`. Running the exact
204
+ same plan again resumes pending work without replaying completed moves. Rate
205
+ limits and closed Chrome sessions are deferred without consuming a move attempt;
206
+ the queue relaunches its browser session automatically. Adaptive pacing starts at
207
+ 60 seconds, speeds up 20% after every three successful moves to a 15-second floor,
208
+ and slows 50% after each rate limit to a 180-second ceiling, in addition to the
209
+ 600-second cooldown. Pace is persisted across pause/resume; use `--no-adaptive`
210
+ only when a fixed/random interval is specifically required.
211
+
212
+ At completion, the queue automatically runs `--orphans` discovery to the proven
213
+ stable bottom of ChatGPT history and reports both intentional remaining orphans
214
+ and any planned Conversation still loose. The scanner throws rather than silently
215
+ accepting a partial inventory. Planned Conversations that remain loose are retried
216
+ automatically up to `--max-attempts`. Start the queue, confirm it acquires the lock and
217
+ processes or defers one item, then let it continue unattended—continuous agent
218
+ watching is unnecessary. Use `bridge chat organize pause` instead of killing the
219
+ process, `resume` to continue the latest queue without reconstructing its plan,
220
+ and `--restart` only when the whole plan should intentionally be replayed.
221
+
222
+ ## Constraints
223
+
224
+ - macOS only (hardcoded Chrome path, pbcopy/lsof)
225
+ - Each provider needs Chrome started with `bridge chrome start --provider <name>` and a signed-in browser session
226
+ - File operations are sandboxed to the target repo (no escape)
227
+ - No raw shell — only validated MCP tools
228
+ - Browser selectors may break when provider UIs update
229
+
230
+ ## Fan-out behavior
231
+
232
+ - `--provider a,b,c` runs all in parallel
233
+ - Partial-failure tolerant: exits non-zero only when ALL fail
234
+ - `--strict`: exit non-zero if ANY fails
235
+ - Replies keyed by provider in JSON output
package/dist/bridge.js CHANGED
@@ -75,7 +75,12 @@ var PROVIDER_CONFIG = parseConfig(ProviderConfigTableSchema, {
75
75
  defaultUrl: "https://chatgpt.com",
76
76
  defaultModel: "ChatGPT",
77
77
  selectors: {
78
- composer: '#prompt-textarea, [contenteditable="true"]',
78
+ composer: [
79
+ '[data-testid="prompt-textarea"]',
80
+ "#prompt-textarea",
81
+ 'form[data-chatgpt-composer] [data-composer-markdown][contenteditable="true"][role="textbox"]',
82
+ 'form[data-chatgpt-composer] .ProseMirror[contenteditable="true"]'
83
+ ].join(", "),
79
84
  assistant: '[data-message-author-role="assistant"]'
80
85
  }
81
86
  },
@@ -2857,11 +2862,13 @@ var injectPrompt = async (page, text) => {
2857
2862
  await runInjectPromptAttempts({ page, text });
2858
2863
  };
2859
2864
  var readComposerText = async (ctx) => {
2860
- const text = await ctx.page.evaluate(() => {
2861
- const prompt = document.querySelector("#prompt-textarea");
2862
- if (prompt === null || prompt.innerText === void 0) return "";
2863
- return prompt.innerText.trim();
2864
- });
2865
+ const text = await ctx.page.evaluate((selector) => {
2866
+ const prompt = document.querySelector(selector);
2867
+ if (prompt === null) return "";
2868
+ const value = prompt.value;
2869
+ if (typeof value === "string") return value.trim();
2870
+ return (prompt.innerText ?? prompt.textContent ?? "").trim();
2871
+ }, SELECTORS.promptInput);
2865
2872
  if (text === null || text === void 0) return "";
2866
2873
  return text;
2867
2874
  };
@@ -18722,7 +18729,7 @@ var subcommandOpts = (command) => {
18722
18729
  // src/features/terminal/registerCli.ts
18723
18730
  var PROVIDER_OPTION = `Browser provider: ${PROVIDER_IDS.join(", ")} (default: ${DEFAULT_PROVIDER})`;
18724
18731
  var registerCliCommands = (program) => {
18725
- program.name("bridge").description("Terminal CLI that bridges ChatGPT or Gemini with local tools via MCP").version("0.7.0").option("-r, --repo <path>", "Path to the target repository (default: cwd)").option("-p, --port <number>", "MCP server port (default: 8765)").option("--provider <name>", PROVIDER_OPTION).option("--no-browser", "Skip Chrome browser connection").action(async (_options, command) => {
18732
+ program.name("bridge").description("Terminal CLI that bridges ChatGPT or Gemini with local tools via MCP").version("0.7.1").option("-r, --repo <path>", "Path to the target repository (default: cwd)").option("-p, --port <number>", "MCP server port (default: 8765)").option("--provider <name>", PROVIDER_OPTION).option("--no-browser", "Skip Chrome browser connection").action(async (_options, command) => {
18726
18733
  if (process.stdin.isTTY !== true || process.stdout.isTTY !== true) {
18727
18734
  command.outputHelp({ error: true });
18728
18735
  process.exitCode = 1;