Skip to content
Merged
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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

AgentOnWeb brings your coding workspace onto the page you already have open. Watch a video, browse documentation, or keep a website in view while working with your agent—then switch back to the page without leaving your conversation.

**Use Codex or Claude Code right on the page.** Open your project in the built-in terminal, follow running sessions, and get notified when a task finishes or needs approval. Click a session to return to its terminal. AgentOnWeb also supports the complete **DeepSeek Harness (DSH)** workspace, including conversations, tools, approvals, models and plugins.
**Use Codex, Claude Code or Pi right on the page.** Open your project in the built-in terminal, follow running sessions, and get notified when a task finishes or needs approval. Click a session to return to its terminal. AgentOnWeb also supports the complete **DeepSeek Harness (DSH)** workspace, including conversations, tools, approvals, models and plugins.

| Mode | What it does |
| --- | --- |
Expand Down Expand Up @@ -38,9 +38,9 @@ A 100-second walkthrough of DSH setup, Chrome Web Store installation, Connect au
| Firefox | [Install from Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/agentonweb/) |
| Safari | Coming soon — Mac App Store link will be added after approval. |

## Use Codex and Claude Code
## Use Codex, Claude Code and Pi

For **macOS + Chrome**. Have [Node.js 22.19+](https://nodejs.org/en/download) and your preferred CLI (Codex or Claude Code) installed and signed in.
For **macOS + Chrome**. Have [Node.js 22.19+](https://nodejs.org/en/download) and your preferred CLI (Codex, Claude Code or Pi 1.1+) installed and signed in.

### 1. Set up your terminal

Expand All @@ -50,7 +50,7 @@ Run this once in your Mac's Terminal:
curl -fsSL https://raw.githubusercontent.com/HeftyKoo/AgentOnWeb/main/scripts/install.sh | bash
```

The installer sets up the local terminal, automatic startup, Chrome connection and Codex/Claude Code notifications. Existing CLI settings are preserved.
The installer sets up the local terminal, automatic startup, Chrome connection and Codex/Claude Code/Pi notifications. Existing CLI settings are preserved.

The install command works from zsh, bash and fish. When Node's command directory is writable and already on PATH, the installer adds an `aow` entry there, so the same terminal can run `aow service` immediately without sourcing a profile. New zsh/bash windows and detected fish installations also get `aow` on their PATH. If that directory is protected or has an unrelated `aow` command, use `"$HOME/.local/bin/aow" service` directly.

Expand All @@ -67,6 +67,8 @@ For session notifications, open `/hooks` in Codex, review and trust **AgentOnWeb

For Claude Code, run `claude` in the same terminal. Setup installs observational hooks in `CLAUDE_CONFIG_DIR/settings.json` (default `~/.claude/settings.json`). Review **AgentOnWeb session status** in Claude Code `/hooks`, then start a new session. To repair or remove only this integration, use `aow claude-hooks install` or `aow claude-hooks uninstall`. Models, permissions, other hooks and history are preserved.

For Pi 1.1+, run `pi` in the same terminal. Setup adds `extensions/agentonweb.ts` under `PI_CODING_AGENT_DIR` (default `~/.pi/agent`), preserving settings and other extensions. Start a new Pi process or use `/reload` to load it. To repair or remove only this integration, use `aow pi-extension install` or `aow pi-extension uninstall`, then `/reload`. Completion waits for Pi's final settlement, and blocking extension dialogs request attention in the browser.

Use **+** in the terminal tab bar to open another project, click a tab to switch, double-click its name to rename it, or click **×** to close it. Hiding the workspace or refreshing the page keeps your sessions running.

[Setup and troubleshooting](docs/one-command-setup.md) · [Terminal guide](packages/terminal-host/README.md)
Expand Down
10 changes: 6 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

AgentOnWeb 将你的编程工作区带到你当前打开的页面上。一边看视频、查阅文档,或保持某个网站在视野中,一边与你的助手协作——然后无需离开对话即可切回原页面。

**直接在网页上使用 Codex 或 Claude Code。** 在内置终端中打开项目,查看正在运行的会话,在任务完成或需要审批时收到提醒。点击会话即可回到对应终端。AgentOnWeb 也支持完整的 **DeepSeek Harness (DSH)** 工作区,保留会话、工具、审批、模型及插件。
**直接在网页上使用 Codex、Claude Code 或 Pi。** 在内置终端中打开项目,查看正在运行的会话,在任务完成或需要审批时收到提醒。点击会话即可回到对应终端。AgentOnWeb 也支持完整的 **DeepSeek Harness (DSH)** 工作区,保留会话、工具、审批、模型及插件。

| 模式 | 功能 |
| --- | --- |
Expand Down Expand Up @@ -38,9 +38,9 @@ AgentOnWeb 将你的编程工作区带到你当前打开的页面上。一边看
| Firefox | [从 Firefox 附加组件安装](https://addons.mozilla.org/en-US/firefox/addon/agentonweb/) |
| Safari | 即将上线——Mac App Store 链接将在审核通过后添加。 |

## 使用 Codex 和 Claude Code
## 使用 Codex、Claude Code 和 Pi

适用于 **macOS + Chrome**。请先安装 [Node.js 22.19+](https://nodejs.org/en/download),并安装、登录你要使用的 CLI(Codex 或 Claude Code)。
适用于 **macOS + Chrome**。请先安装 [Node.js 22.19+](https://nodejs.org/en/download),并安装、登录你要使用的 CLI(Codex、Claude Code 或 Pi 1.1+)。

### 1. 一键配置终端

Expand All @@ -50,7 +50,7 @@ AgentOnWeb 将你的编程工作区带到你当前打开的页面上。一边看
curl -fsSL https://raw.githubusercontent.com/HeftyKoo/AgentOnWeb/main/scripts/install.sh | bash
```

安装器会配置本机终端、登录自动启动、Chrome 连接和 Codex / Claude Code 通知,并保留已有的 CLI 设置。
安装器会配置本机终端、登录自动启动、Chrome 连接和 Codex / Claude Code / Pi 通知,并保留已有的 CLI 设置。

安装命令兼容 zsh、bash 和 fish。如果 Node 命令目录已在 PATH 中且可写,安装器会在其中创建 `aow` 入口,同一个终端安装后即可运行 `aow service`,无需 source。新开的 zsh/bash 窗口及检测到的 fish 也会配置 `aow` 路径。如果该目录受保护或已有其他程序的 `aow` 命令,可直接运行 `"$HOME/.local/bin/aow" service`。

Expand All @@ -67,6 +67,8 @@ codex

使用 Claude Code 时,在同一终端运行 `claude`。安装器会在 `CLAUDE_CONFIG_DIR/settings.json`(默认 `~/.claude/settings.json`)中添加观察性 hooks。在 Claude Code `/hooks` 中查看 **AgentOnWeb session status**,然后启动新会话。单独修复或移除该集成可运行 `aow claude-hooks install` 或 `aow claude-hooks uninstall`;模型、权限、其他 hooks 和历史记录都会保留。

使用 Pi 1.1+ 时,在同一终端运行 `pi`。配置会在 `PI_CODING_AGENT_DIR`(默认 `~/.pi/agent`)下添加 `extensions/agentonweb.ts`,保留设置和其他 extensions。重新启动 Pi 或运行 `/reload` 加载。单独修复或移除可运行 `aow pi-extension install` 或 `aow pi-extension uninstall`,然后 `/reload`。完成通知会等待 Pi 的最终结束事件;extension 弹出确认或输入对话框时,浏览器会提示你回到终端处理。

点击终端标签栏的 **+** 打开另一个项目,点击标签切换,双击名称重命名,点击 **×** 关闭。隐藏工作区或刷新网页不会中断正在运行的会话。

[安装与常见问题](docs/one-command-setup.md) · [终端指南](packages/terminal-host/README.md)
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/src/agent-activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function createAgentActivity(activate: (session: AgentSession) => void, r
if (!current) advance();
if (!sorted.length) {
const empty = document.createElement("p"); empty.className = "agent-empty";
empty.textContent = "No agent sessions yet. Run aow setup, review AgentOnWeb session status in your CLI's /hooks, then launch Codex or Claude Code in a local terminal.";
empty.textContent = "No agent sessions yet. Run aow setup, then launch Codex, Claude Code or Pi in a local terminal. For Codex and Claude Code, review AgentOnWeb session status in /hooks.";
element.append(empty);
}
return { count: sorted.filter(item => item.status === "running" || item.status === "approval").length,
Expand Down
16 changes: 13 additions & 3 deletions docs/agent-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ A project or profile that overrides `notify`, disabled/untrusted hooks, or launc

Claude Code has no universal user-interrupt hook. An interruption or permission denial that emits no supported event can leave the displayed status approximate until the next prompt or session end; an idle notification clears an otherwise running indicator. A separate Stop hook can continue the turn after our observational hook reports completion; subsequent activity restores Working. The native TUI is authoritative. Disabled hooks, managed policy restrictions or a process that drops the inherited event environment prevent reporting. The integration never changes `disableAllHooks`, permission rules or hook trust.

## Pi

`aow setup` also installs an observational extension for Pi 1.1+. Use `aow pi-extension install|uninstall` to manage it separately. The installer adds `extensions/agentonweb.ts` under `PI_CODING_AGENT_DIR` (default `~/.pi/agent`), preserves settings and other extensions, backs up replaced AgentOnWeb entries, and refuses to overwrite an unrelated file with that name. It resolves the packaged lightweight `pi-extension.js` through the module URL, including npm bin-symlink installs. Start Pi or use `/reload` after installing/removing it. It registers no handlers outside a host-owned terminal.

Pi lifecycle events reach the same authenticated per-terminal ingress, ordered and with the same bounded presentation fields and network deadline. `session_start` creates Ready; `before_agent_start` creates a fresh turn and prompt title; `agent_start` and tool execution events show Working. Blocking extension `ui_prompt_start` events show Needs approval; `ui_prompt_end` restores Working or Ready. Tool activity cannot clear a still-open dialog. Confirmation/input decisions stay in Pi; this adapter never returns tool, prompt, context or permission changes.

Completion uses `agent_settled`, after retries, compaction recovery and queued work finish. `agent_end` alone does not complete a task. Aborted settlement or the last turn's error outcome shows Interrupted without a completion notification. `session_shutdown` ends the old session when Pi quits, reloads, starts a new session, resumes or forks; the following `session_start` binds the new runtime. Pi session IDs are independent of Codex and Claude Code. Provider errors, model responses, tool arguments/results and session files are not forwarded.

This integration requires Pi's 1.1+ settlement and UI-prompt events. Force-killing Pi without a shutdown event can leave a snapshot until that host terminal closes. Disabled extensions and shells that drop the inherited event environment prevent reporting.

## Event flow

1. Each host-owned PTY receives its own `AOW_AGENT_ENDPOINT` and `AOW_AGENT_TOKEN`.
Expand Down Expand Up @@ -53,16 +63,16 @@ The registry is host-memory scoped; it does not reconstruct history after a host

## Extending to other agents

The connector contract `AgentSession` and `SurfaceAdapter.agentSessions` contain no Codex hook names. Another runtime can publish its own normalized sessions through that interface. The Claude Code terminal adapter normalizes its official events in the host. Future adapters should reuse the per-terminal binding and public status contract, not parse colored PTY text or make the frontend know agent-specific hook payloads.
The connector contract `AgentSession` and `SurfaceAdapter.agentSessions` contain no Codex hook names. Another runtime can publish its own normalized sessions through that interface. The Claude Code and Pi terminal adapters normalize their official events in the host. Future adapters should reuse the per-terminal binding and public status contract, not parse colored PTY text or make the frontend know agent-specific hook payloads.

## Verification

`pnpm test` includes real host/PTY tests that run the hook reporter and official notify payload through the packaged CLI, close the viewer, verify running/approval/completion push, reconnect, then close the terminal. It also covers config preservation, notification deduplication, text escaping, cross-frame trust checks, cold-load activation races and stale/missing targets.

For the interactive UI fixture: `pnpm build:preview`, `pnpm preview`, then open `http://127.0.0.1:4173/?activity`. The fixture explicitly labels its events as simulated.

Official schemas: [Claude Code hooks](https://code.claude.com/docs/en/hooks), [Claude Code settings](https://code.claude.com/docs/en/settings), [Codex hooks](https://learn.chatgpt.com/docs/hooks), [Codex notify](https://learn.chatgpt.com/docs/config-file/config-advanced#notifications).
Official schemas: [Pi extensions](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/extensions.md), [Pi event types](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/extensions/types.ts), [Claude Code hooks](https://code.claude.com/docs/en/hooks), [Claude Code settings](https://code.claude.com/docs/en/settings), [Codex hooks](https://learn.chatgpt.com/docs/hooks), [Codex notify](https://learn.chatgpt.com/docs/config-file/config-advanced#notifications).

## One-command setup (macOS + Chrome)

The new `aow setup` entry configures the service, Chrome native pairing and Codex/Claude Code notifications together. Global npm installs run it when lifecycle scripts are permitted; the release shell installer calls it explicitly. Codex hook trust remains a first-use user action. Use matching 0.2.0 host and extension builds; release availability is tracked separately. See [One-command setup (macOS + Chrome)](one-command-setup.md).
The new `aow setup` entry configures the service, Chrome native pairing and Codex/Claude Code/Pi notifications together. Global npm installs run it when lifecycle scripts are permitted; the release shell installer calls it explicitly. Codex hook trust remains a first-use user action. Use matching host and extension builds; release availability is tracked separately. See [One-command setup (macOS + Chrome)](one-command-setup.md).
14 changes: 9 additions & 5 deletions docs/one-command-setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Set up AgentOnWeb for Codex and Claude Code
# Set up AgentOnWeb for Codex, Claude Code and Pi

Use **macOS + Chrome**, with Node.js 22.19+ and Codex or Claude Code installed and signed in.
Use **macOS + Chrome**, with Node.js 22.19+ and Codex, Claude Code or Pi 1.1+ installed and signed in.

1. Install [AgentOnWeb from the Chrome Web Store](https://chromewebstore.google.com/detail/agentonweb/lhbmeokjjcmklamnepcechnpcdjgkcoe).
2. Run this command in your Mac's Terminal:
Expand All @@ -9,10 +9,10 @@ Use **macOS + Chrome**, with Node.js 22.19+ and Codex or Claude Code installed a
curl -fsSL https://raw.githubusercontent.com/HeftyKoo/AgentOnWeb/main/scripts/install.sh | bash
```

3. Open a website, click AgentOnWeb and run `codex` or `claude` in its terminal.
3. Open a website, click AgentOnWeb and run `codex`, `claude` or `pi` in its terminal.
4. For session notifications, open Codex `/hooks`, review and trust **AgentOnWeb session status**, then start a new Codex session.

The installer configures your terminal service, automatic startup, Chrome connection and Codex/Claude Code notifications. It installs the terminal package under `~/.local`, adds its command directory to your shell profile, and preserves existing CLI settings with backups. Run it as your own user, without sudo.
The installer configures your terminal service, automatic startup, Chrome connection and Codex/Claude Code/Pi notifications. It installs the terminal package under `~/.local`, adds its command directory to your shell profile, and preserves existing CLI settings with backups. Run it as your own user, without sudo.

The command works from zsh, bash and fish. The installer configures both login and interactive zsh/bash windows, including editor terminals, and uses fish's own PATH syntax when fish is installed or selected as your login shell. It respects exported `ZDOTDIR` and `XDG_CONFIG_HOME` settings and preserves the Bash login profile you already use.

Expand Down Expand Up @@ -48,6 +48,10 @@ Notifications link back to the relevant terminal. Approval decisions stay in Cod

Run `aow claude-hooks install`, review **AgentOnWeb session status** in Claude Code `/hooks`, then start a new session inside AgentOnWeb. Use the same `CLAUDE_CONFIG_DIR` as your CLI. The installer backs up `settings.json` and preserves existing hooks, models, permissions and `disableAllHooks`; disabled or policy-restricted hooks remain disabled. Approval decisions stay in Claude Code.

## Pi notifications are missing

Run `aow pi-extension install`, then start Pi 1.1+ in an AgentOnWeb terminal or run `/reload` in Pi. Use the same `PI_CODING_AGENT_DIR` as your CLI (default `~/.pi/agent`). Check that `extensions/agentonweb.ts` is enabled; `--no-extensions` and excluded resources prevent automatic loading. The extension leaves settings and other extensions intact and stays inactive outside host-owned terminals. Pi's native confirmation and input dialogs stay in the terminal.

## Update or repair

Rerun the installation command to install the current AgentOnWeb terminal package and repair its configuration. Installation leaves active terminal sessions running. To load an updated service, finish your work, then run:
Expand All @@ -70,6 +74,6 @@ npm uninstall --global --prefix "$HOME/.local" @agentonweb/terminal-host

This stops the terminal service, removes Chrome pairing registration and AgentOnWeb hooks, and restores your previous Codex notify command. User settings, history and backups remain. If you installed through npm directly instead of the shell installer, uninstall from the npm prefix you originally used.

If cleanup reports an error, correct it and rerun `aow uninstall` before removing the package. To remove only notifications, use `aow codex-hooks uninstall` or `aow claude-hooks uninstall`.
If cleanup reports an error, correct it and rerun `aow uninstall` before removing the package. To remove only notifications, use `aow codex-hooks uninstall`, `aow claude-hooks uninstall` or `aow pi-extension uninstall`. Use `/reload` in Pi to unload the removed extension.

[Back to AgentOnWeb](../README.md) · [Development setup](development.md)
Loading
Loading