Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,15 @@ When the site you need is not yet covered, use the `opencli-adapter-author` skil
| `OPENCLI_DAEMON_PORT` | `19825` | HTTP port for the daemon-extension bridge |
| `OPENCLI_PROFILE` | — | Browser Bridge profile alias/contextId to use when multiple Chrome profiles are connected |
| `OPENCLI_WINDOW` | command default | Set to `foreground` or `background` to override Browser Bridge window placement. Browser-backed commands also accept `--window <foreground\|background>`. |
| `OPENCLI_TAB_PLACEMENT` | `owned-container` | Set to `existing-window` to create regular tabs in an already-open normal Chrome profile window instead of OpenCLI-managed windows/tab groups. |
| `OPENCLI_BROWSER_CONNECT_TIMEOUT` | `30` | Seconds to wait for browser connection |
| `OPENCLI_BROWSER_COMMAND_TIMEOUT` | `60` | Seconds to wait for a single browser command |
| `OPENCLI_CDP_ENDPOINT` | — | Chrome DevTools Protocol endpoint for remote browser or Electron apps |
| `OPENCLI_CDP_TARGET` | — | Filter CDP targets by URL substring (e.g. `detail.1688.com`) |
| `OPENCLI_VERBOSE` | `false` | Enable verbose logging (`-v` flag also works) |
| `DEBUG_SNAPSHOT` | — | Set to `1` for DOM snapshot debug output |

`opencli browser *` requires an explicit `<session>` positional, uses a foreground browser window by default, and keeps that session's tab lease until `opencli browser <session> close` or idle cleanup. Browser-backed adapters use a background adapter window and release one-shot tab leases by default. Interactive adapters can declare `siteSession: 'persistent'` to keep a stable site tab for continuity; pass `--site-session ephemeral` for a one-shot tab.
`opencli browser *` requires an explicit `<session>` positional, uses a foreground browser window by default, and keeps that session's tab lease until `opencli browser <session> close` or idle cleanup. Browser-backed adapters use a background adapter window and release one-shot tab leases by default. Interactive adapters can declare `siteSession: 'persistent'` to keep a stable site tab for continuity; pass `--site-session ephemeral` for a one-shot tab. Set `OPENCLI_TAB_PLACEMENT=existing-window` to keep owned tabs in already-open Chrome profile windows without creating OpenCLI windows or tab groups.

## Built-in Commands

Expand Down
3 changes: 2 additions & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,15 @@ Agent 在内部自动处理所有 `opencli browser` 命令——你只需用自
|------|--------|------|
| `OPENCLI_DAEMON_PORT` | `19825` | daemon-extension 通信端口 |
| `OPENCLI_WINDOW` | 命令默认值 | 设为 `foreground` 或 `background` 来覆盖 Browser Bridge 窗口位置。浏览器型命令也支持 `--window <foreground\|background>` |
| `OPENCLI_TAB_PLACEMENT` | `owned-container` | 设为 `existing-window` 时,在已经打开的 Chrome Profile 普通窗口里创建普通标签页,不创建 OpenCLI 管理的窗口或 tab group |
| `OPENCLI_BROWSER_CONNECT_TIMEOUT` | `30` | 浏览器连接超时(秒) |
| `OPENCLI_BROWSER_COMMAND_TIMEOUT` | `60` | 单个浏览器命令超时(秒) |
| `OPENCLI_CDP_ENDPOINT` | — | Chrome DevTools Protocol 端点,用于远程浏览器或 Electron 应用 |
| `OPENCLI_CDP_TARGET` | — | 按 URL 子串过滤 CDP target(如 `detail.1688.com`) |
| `OPENCLI_VERBOSE` | `false` | 启用详细日志(`-v` 也可以) |
| `DEBUG_SNAPSHOT` | — | 设为 `1` 输出 DOM 快照调试信息 |

`opencli browser *` 必须紧跟一个 `<session>` 位置参数,默认使用前台窗口,并保留该 session 的 tab lease,直到你手动执行 `opencli browser <session> close` 或等空闲超时。浏览器型 adapter 默认使用后台 adapter 窗口并在命令结束后释放一次性 tab lease;如果需要调试最终页面,可以传 `--window foreground --keep-tab true`。
`opencli browser *` 必须紧跟一个 `<session>` 位置参数,默认使用前台窗口,并保留该 session 的 tab lease,直到你手动执行 `opencli browser <session> close` 或等空闲超时。浏览器型 adapter 默认使用后台 adapter 窗口并在命令结束后释放一次性 tab lease;如果需要调试最终页面,可以传 `--window foreground --keep-tab true`。如果希望只在已打开的 Chrome Profile 窗口里创建普通标签页,可以设置 `OPENCLI_TAB_PLACEMENT=existing-window`。

## 内置命令

Expand Down
2 changes: 2 additions & 0 deletions docs/guide/browser-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ Use `opencli browser <session> bind` when you want to attach OpenCLI to a Chrome

The `OpenCLI Browser` and `OpenCLI Adapter` tab groups are extension-managed automation containers; avoid putting your own long-lived tabs in them or renaming them.

Set `OPENCLI_TAB_PLACEMENT=existing-window` when you want owned Browser Bridge sessions to create regular tabs in an already-open normal Chrome profile window. This mode does not create Chrome windows and does not create, move, or rename OpenCLI tab groups. If the selected profile has no normal window open, the command fails and asks you to open that profile window first.

## How It Works

```
Expand Down
2 changes: 2 additions & 0 deletions docs/zh/guide/browser-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ opencli browser my-session close

`OpenCLI Browser` 和 `OpenCLI Adapter` tab group 是扩展管理的自动化容器;请不要把自己的长期 tab 放进去,也不要重命名。

如果希望 OpenCLI 拥有的 Browser Bridge session 只在已经打开的 Chrome Profile 普通窗口里创建普通标签页,可以设置 `OPENCLI_TAB_PLACEMENT=existing-window`。这个模式不会创建 Chrome 窗口,也不会创建、移动或重命名 OpenCLI tab group;如果所选 Profile 没有打开的普通窗口,命令会失败并提示你先打开该 Profile 窗口。

## Daemon 生命周期

Daemon 在首次运行浏览器命令时自动启动,之后保持常驻运行。
Expand Down
15 changes: 13 additions & 2 deletions extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ commands.
## Permission Notes

- `debugger`: sends CDP commands to OpenCLI-controlled or bound tabs.
- `tabs` / `tabGroups`: manages the dedicated OpenCLI automation container and
reports selected tab metadata back to the CLI.
- `tabs` / `tabGroups`: manages the dedicated OpenCLI automation container by
default and reports selected tab metadata back to the CLI. When
`OPENCLI_TAB_PLACEMENT=existing-window` is set, owned sessions create regular
tabs in an already-open Chrome profile window and do not create or manage tab
groups.
- `cookies`: reads cookies for browser-backed adapters that need authenticated
fetches.
- `downloads`: surfaces download lifecycle to `opencli browser wait download`.
Expand All @@ -24,3 +27,11 @@ Suggested Chrome Web Store justification for `downloads`:
> so agents can wait for downloads triggered during an automation workflow. The
> command filters by a user-provided filename or URL pattern and timeout. We do
> not modify, redirect, or persist user download history.

## Tab Placement

By default, owned Browser Bridge sessions use OpenCLI-managed windows and tab
groups. Set `OPENCLI_TAB_PLACEMENT=existing-window` to create regular tabs in an
already-open normal Chrome profile window instead. This opt-in mode never
creates Chrome windows or OpenCLI tab groups; open the target Chrome profile
window before running the command.
Loading