@obtoai/agent-bridge 0.1.0-beta.4 → 0.1.0-beta.5

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.
Files changed (2) hide show
  1. package/README.md +40 -29
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @obtoai/agent-bridge
2
2
 
3
- A local daemon that lets a coding agent — [Claude Code](https://claude.ai/code) or [OpenAI Codex](https://developers.openai.com/codex) — running on your machine be driven from the [OBTO Agent Bridge](https://obto.co) web UI, even when you're away from the keyboard.
3
+ A local daemon that lets coding agents — [Claude Code](https://claude.ai/code), [OpenAI Codex](https://developers.openai.com/codex), or [opencode](https://opencode.ai) — running on your machine be driven from the [OBTO Agent Bridge](https://obto.co) web UI, even when you're away from the keyboard.
4
4
 
5
- You post a message on a thread from your phone or laptop. The daemon (running on your machine, no port forwarding required) receives it over a long-lived HTTPS stream, spawns or resumes an agent session in your project directory, and the response posts back to the bridge thread within seconds.
5
+ You post a message on a thread from your phone or laptop. The daemon (running on your machine, no port forwarding required) receives it over a long-lived HTTPS stream, spawns or resumes a session for the agent that thread is bound to, and the response posts back to the bridge thread within seconds.
6
6
 
7
7
  ## Status
8
8
 
@@ -11,10 +11,11 @@ You post a message on a thread from your phone or laptop. The daemon (running on
11
11
  ## What you'll need
12
12
 
13
13
  - macOS, Linux, or Windows, **Node.js 18.17+**
14
- - One coding agent installed, with your own auth:
15
- - **Claude** — Claude Code / the Claude Agent SDK, billed to your Anthropic account; or
16
- - **Codex** — the `codex` CLI (`npm i -g @openai/codex`), signed in to your OpenAI/ChatGPT account
17
- - An invite from `support@obto.co` (gives you an `accountId`, browser username/password, and an API token)
14
+ - At least one coding agent installed on the machine (the daemon drives whichever ones it finds, with your own auth):
15
+ - **Claude** — Claude Code / the Claude Agent SDK, billed to your Anthropic account.
16
+ - **Codex** — the `codex` CLI (`npm i -g @openai/codex`), signed in to your OpenAI/ChatGPT account.
17
+ - **opencode** `npm i -g opencode-ai` (the `opencode` CLI; the daemon bundles the `@opencode-ai/sdk`). Auth is your own provider key (Anthropic by default; override with env vars below).
18
+ - An invite from `support@obto.co` (gives you an `accountId`, browser username/password, and an API token).
18
19
 
19
20
  ## Install
20
21
 
@@ -34,18 +35,25 @@ npx @obtoai/agent-bridge <command>
34
35
  obto-bridge init
35
36
  ```
36
37
 
37
- Walks you through a few questions: your account ID, API token, an agent name (to distinguish multiple machines on one account), which coding agent to drive (`claude` or `codex`), the project directory to work in, and whether to relay tool-permission requests via the bridge. (The server URL is a built-in default; advanced / self-hosted users can override it with the `BRIDGE_BASE_URL` env var.)
38
+ Walks you through a few questions: your account ID, API token, an agent name (to distinguish multiple machines on one account), a *fallback* agent (`claude`, `codex`, or `opencode` — used only for legacy events without an explicit agent), the project directory to work in, and whether to relay tool-permission requests via the bridge. (The server URL is a built-in default; advanced / self-hosted users can override it with the `BRIDGE_BASE_URL` env var.)
38
39
 
39
40
  Config lands at `~/.obto-bridge/config.json` (mode 0600). Safe to commit your account ID; **never commit the `apiToken`**.
40
41
 
41
- ### claude vs codex
42
+ ### Agents (claude / codex / opencode)
42
43
 
43
- Both drive real coding work on your machine; they differ in how they report back:
44
+ v1.1 makes the daemon **agent-agnostic per event**: at startup it detects which of `claude`, `codex`, and `opencode` are installed on the machine, advertises that to the bridge, and routes each incoming reply to the right driver based on what the thread is bound to in the UI. You can switch a thread's agent live from the thread header; each engine keeps its own session for that thread, so flipping claude→codex→claude resumes each side's context.
44
45
 
45
- - **claude** — the fuller integration. Posts status updates, questions, and results as it works (via an in-process MCP tool), and supports the human-in-the-loop tool-permission relay.
46
- - **codex** — runs the task and delivers one final answer per turn. No mid-task updates and no per-tool relay (the Codex SDK exposes neither); it runs unattended inside a sandbox (`workspace-write` by default, override with `BRIDGE_CODEX_SANDBOX`).
46
+ How the three differ in how they report back:
47
47
 
48
- One daemon drives one agent. To run both, use two daemons on two accounts.
48
+ - **claude** the fullest integration. Posts status updates, mid-task questions, and final results as it works (via an in-process MCP tool), and supports the human-in-the-loop tool-permission relay.
49
+ - **codex** — runs the turn and delivers one final answer per turn. No mid-task updates and no per-tool relay (the Codex SDK exposes neither). Runs unattended inside a sandbox (`workspace-write` by default, override with `BRIDGE_CODEX_SANDBOX`).
50
+ - **opencode** — same capture-model shape as codex: one final answer per turn, no mid-task chatter. Defaults to provider `anthropic` and model `claude-sonnet-4-5`; override with `BRIDGE_OPENCODE_PROVIDER` and `BRIDGE_OPENCODE_MODEL`.
51
+
52
+ Picking a model is done in the bridge UI's **+ New thread** dialog and the thread-header switcher — not in the daemon config.
53
+
54
+ ### Multi-daemon (running across more than one machine)
55
+
56
+ You can run the same account's daemon on more than one machine (e.g. a Mac and a Windows box). Each daemon advertises its `agentId` (machine name) + capabilities on connect; threads are atomically **first-touch claimed** by whichever daemon gets the event first, and every other daemon skips the event cleanly. No duplicate replies, no special configuration — just install + start the daemon on each machine.
49
57
 
50
58
  ## Run
51
59
 
@@ -56,14 +64,16 @@ obto-bridge start
56
64
  You'll see two log lines and then the daemon waits silently:
57
65
 
58
66
  ```
59
- {"msg":"starting daemon","data":{"accountId":"acc_...","agentId":"my-mac",...}}
67
+ {"msg":"starting daemon","data":{"accountId":"acc_...","agentId":"my-mac","capabilities":["claude","codex"],...}}
60
68
  {"msg":"sse stream connected","data":{"status":200}}
61
69
  ```
62
70
 
71
+ `capabilities` is the list of agents this daemon will accept — the bridge UI offers exactly the union across your connected machines.
72
+
63
73
  Now open the bridge UI in any browser, log in with the browser credentials from your invite, and either:
64
74
 
65
- - Reply on an existing thread — daemon resumes the session bound to that thread
66
- - Start a new thread via the **+ New thread** button — daemon spawns a fresh session in your project directory
75
+ - Reply on an existing thread — daemon resumes the session bound to that thread (and to whichever agent the thread currently uses).
76
+ - Start a new thread via the **+ New thread** button — pick Claude, Codex, or Opencode; the daemon spawns a fresh session in your project directory.
67
77
 
68
78
  Within ~5–10 seconds you should see the agent's reply appear back on the thread.
69
79
 
@@ -72,40 +82,41 @@ Within ~5–10 seconds you should see the agent's reply appear back on the threa
72
82
  | Command | What it does |
73
83
  |---|---|
74
84
  | `obto-bridge whoami` | Verify your token works + show your account info |
75
- | `obto-bridge status` | List active thread→session bindings |
85
+ | `obto-bridge status` | List bindings per (thread, agent) — one row per engine that's ever driven a thread |
76
86
  | `obto-bridge logout` | Wipe `~/.obto-bridge/config.json` |
77
87
 
78
88
  ## How it actually works
79
89
 
80
90
  ```
81
- Your phone OBTO server Your machine
82
- ───────── ─────────── ────────────
91
+ Your phone OBTO server Your machine(s)
92
+ ───────── ─────────── ───────────────
83
93
  [reply form] ──► /api/reply ─► Mongo (durable)
84
- └─► RabbitMQ (publish bridge.<acct>.reply.<thread>)
94
+ └─► RabbitMQ (publish bridge.<acct>.reply.<thread>,
95
+ payload carries agent + agentId)
85
96
  ◄── /api/bridge/stream (SSE, Bearer auth)
86
- └─► daemon process
87
- └─► Claude Agent SDK
88
- └─► session JSONL in
89
- ~/.claude/projects/...
90
- /api/message ◄──── bridge_post (in-process MCP tool from daemon)
97
+ └─► daemon (dispatches per payload.agent)
98
+ ├─► Claude Agent SDK → ~/.claude/projects/...
99
+ ├─► @openai/codex-sdk → ~/.codex/sessions/...
100
+ └─► @opencode-ai/sdk → opencode server
101
+ /api/message ◄──── bridge_post (in-process MCP tool, Claude only)
91
102
  [poll: /api/messages] ◄──── (4s loop)
92
103
  ```
93
104
 
94
105
  Key bits:
95
106
 
96
107
  - The daemon **never** holds RabbitMQ credentials; broker access stays server-side. Per-account routing key isolation enforced by `BridgeAuth`.
97
- - The daemon's spawned Claude session uses an **in-process MCP server** (`mcp__bridge__bridge_post`) — not the platform's hosted MCP, so the daemon's tools don't depend on a long-lived OBTO MCP proxy session.
98
- - Each bridge **thread** binds to its own agent **session ID** at first message. Subsequent messages on the same thread resume the same session, so the agent keeps full context. Your interactive sessions are unaffected — they live in separate session stores.
108
+ - For the **claude** driver, the spawned Claude session uses an **in-process MCP server** (`mcp__bridge__bridge_post`) — not the platform's hosted MCP, so the daemon's tools don't depend on a long-lived OBTO MCP proxy session. For **codex** and **opencode**, the SDKs can't auto-approve a write tool when run unattended, so the daemon captures the final response and posts it to the thread on the agent's behalf.
109
+ - Each bridge **thread** binds to its own session ID **per agent**. Subsequent messages on the same thread + same agent resume the same engine-specific session, so the agent keeps full context. Switching the thread's agent in the UI starts (or resumes) the other engine's session — each side's state stays intact. Your interactive sessions are unaffected — they live in separate session stores.
99
110
  - Per-thread serialization means rapid bursts on the same thread are handled in order, never racing the same session.
100
- - With **codex**, there is no in-process MCP tool the Codex SDK can't auto-approve a write tool when run unattended, so the daemon captures Codex's final response and posts it to the thread on the agent's behalf.
111
+ - Multi-daemon races are killed by atomic first-touch claim against the thread record on the bridge.
101
112
 
102
113
  ## Agent costs
103
114
 
104
- The daemon runs your chosen agent on your machine with **your** credentials — Anthropic for `claude` (whatever Claude Code uses: `ANTHROPIC_API_KEY` or your Claude.ai session), or your OpenAI/ChatGPT account for `codex`. Every bridge-driven turn is a normal API call billed to you. We don't proxy.
115
+ The daemon runs your chosen agent on your machine with **your** credentials — Anthropic for `claude` (whatever Claude Code uses: `ANTHROPIC_API_KEY` or your Claude.ai session); your OpenAI/ChatGPT account for `codex`; whichever provider you've configured `opencode` to call (Anthropic by default for this daemon). Every bridge-driven turn is a normal API call billed to you. We don't proxy.
105
116
 
106
117
  ## Data handling
107
118
 
108
- **Your model traffic never touches us.** The daemon runs on your machine and calls Anthropic or OpenAI with *your own* credentials. Your prompts, your code, and the model's responses pass directly between your machine and the model provider, under your own API account and its terms. OBTO does not proxy, route, or see that traffic.
119
+ **Your model traffic never touches us.** The daemon runs on your machine and calls Anthropic, OpenAI, or whichever provider opencode is configured for, with *your own* credentials. Your prompts, your code, and the model's responses pass directly between your machine and the model provider, under your own API account and its terms. OBTO does not proxy, route, or see that traffic.
109
120
 
110
121
  **What the bridge stores.** For threads to work, the messages you and the agent post are saved in OBTO's database — that's what makes a thread durable and readable from your phone. Threads are strictly scoped to your account; one tenant can never see another's. Your daemon's API token is stored server-side only as a SHA-256 hash; the plaintext token never leaves your local config file.
111
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obtoai/agent-bridge",
3
- "version": "0.1.0-beta.4",
3
+ "version": "0.1.0-beta.5",
4
4
  "description": "Local consumer for the OBTO Agent Bridge. Receives bridge events over SSE and drives a coding agent (Claude Code or OpenAI Codex) on your machine.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "OBTO Inc.",