somora 2026.1001.4 → 2026.1007.2

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 (123) hide show
  1. package/README.md +31 -24
  2. package/config.example.yaml +37 -1
  3. package/docs/agents.md +714 -584
  4. package/docs/api.md +2327 -2546
  5. package/docs/browser.md +450 -265
  6. package/docs/builder.md +408 -282
  7. package/docs/cache-strategy.md +249 -301
  8. package/docs/compaction.md +378 -232
  9. package/docs/display.md +363 -130
  10. package/docs/dream-phases.md +598 -789
  11. package/docs/files.md +509 -333
  12. package/docs/imagegen.md +421 -302
  13. package/docs/images/somora-hero.png +0 -0
  14. package/docs/index.md +139 -174
  15. package/docs/lsp.md +142 -60
  16. package/docs/mcp.md +365 -273
  17. package/docs/memory.md +315 -356
  18. package/docs/mobile.md +283 -282
  19. package/docs/models.md +440 -197
  20. package/docs/projects.md +297 -316
  21. package/docs/realtime-voice.md +358 -234
  22. package/docs/resources.md +268 -176
  23. package/docs/sampling.md +141 -78
  24. package/docs/security.md +413 -169
  25. package/docs/sentinel.md +268 -208
  26. package/docs/setup.md +786 -1115
  27. package/docs/skills.md +415 -430
  28. package/docs/team.md +268 -143
  29. package/docs/thinking.md +415 -387
  30. package/docs/tmux.md +384 -334
  31. package/docs/tools.md +492 -109
  32. package/docs/videogen.md +319 -146
  33. package/docs/voice.md +335 -220
  34. package/docs/web.md +633 -835
  35. package/docs/wiki.md +442 -482
  36. package/package.json +2 -1
  37. package/src/attachments/store.ts +19 -1
  38. package/src/browser/session.ts +2 -2
  39. package/src/cli/auth.ts +22 -0
  40. package/src/cli/banner.ts +56 -0
  41. package/src/cli/claude-bin.ts +48 -0
  42. package/src/cli/config.ts +47 -0
  43. package/src/cli/server-call.ts +65 -0
  44. package/src/cli/setup.ts +26 -8
  45. package/src/cli/somora.ts +36 -4
  46. package/src/cli/team.ts +13 -6
  47. package/src/cli/tui/api.ts +44 -2
  48. package/src/cli/tui/app.tsx +77 -8
  49. package/src/cli/tui/commands.ts +111 -14
  50. package/src/cli/tui/header.tsx +20 -0
  51. package/src/cli/tui/stream.ts +3 -0
  52. package/src/cli/tui/turn-views.tsx +22 -0
  53. package/src/cli/tui/types.ts +14 -3
  54. package/src/compaction/summarize.ts +12 -3
  55. package/src/compaction/template.ts +15 -0
  56. package/src/compaction/types.ts +3 -0
  57. package/src/config/loader.ts +75 -10
  58. package/src/config/types.ts +59 -20
  59. package/src/dream/deep-llm.ts +83 -3
  60. package/src/dream/deep-runner.ts +8 -2
  61. package/src/dream/deep-worker.ts +1 -0
  62. package/src/dream/lucid-runner.ts +7 -3
  63. package/src/dream/lucid-types.ts +3 -0
  64. package/src/dream/rem-extract.ts +99 -69
  65. package/src/dream/worker-model.ts +31 -0
  66. package/src/engine/a2a.ts +1 -1
  67. package/src/engine/claude-cli.ts +136 -4
  68. package/src/engine/codex-cli.ts +74 -0
  69. package/src/engine/engine-meta-labels.ts +2 -0
  70. package/src/engine/openai-compatible.ts +142 -29
  71. package/src/engine/types.ts +7 -0
  72. package/src/imagegen/generate.ts +30 -5
  73. package/src/imagegen/types.ts +6 -0
  74. package/src/media/capabilities.ts +8 -0
  75. package/src/memory/inject.ts +66 -7
  76. package/src/multimodal/blocks.ts +14 -0
  77. package/src/multimodal/load.ts +21 -2
  78. package/src/multimodal/model-image.ts +127 -0
  79. package/src/persona/loader.ts +2 -2
  80. package/src/server/index.ts +275 -62
  81. package/src/server/restart-intent.ts +138 -0
  82. package/src/server/restart-reconcile.ts +6 -2
  83. package/src/server/run-turn.ts +66 -17
  84. package/src/server/session-compact.ts +138 -0
  85. package/src/server/thinking-resolve.ts +30 -0
  86. package/src/server/turn-origin-kind.ts +2 -2
  87. package/src/ssh/exec.ts +55 -22
  88. package/src/ssh/known-hosts.ts +17 -2
  89. package/src/ssh/pool.ts +7 -1
  90. package/src/storage/sessions.ts +40 -15
  91. package/src/tools/dream/tools.ts +2 -2
  92. package/src/tools/exec/tools.ts +19 -2
  93. package/src/tools/file/analyze.ts +46 -7
  94. package/src/tools/file/remote.ts +31 -10
  95. package/src/tools/file/tools.ts +86 -19
  96. package/src/tools/image/tools.ts +6 -0
  97. package/src/tools/registry.ts +14 -0
  98. package/src/types/events.ts +25 -4
  99. package/src/types/turn-origin.ts +6 -2
  100. package/web/dist/apple-touch-icon.png +0 -0
  101. package/web/dist/assets/{index-CrkkIfd9.js → index-40x__Izy.js} +168 -163
  102. package/web/dist/assets/index-40x__Izy.js.map +1 -0
  103. package/web/dist/assets/index-CZFgQRsq.css +32 -0
  104. package/web/dist/favicon-48.png +0 -0
  105. package/web/dist/favicon.ico +0 -0
  106. package/web/dist/favicon.svg +1 -8
  107. package/web/dist/index.html +6 -2
  108. package/web-mobile/dist/apple-touch-icon.png +0 -0
  109. package/web-mobile/dist/assets/index-CxILeHfe.js +88 -0
  110. package/web-mobile/dist/assets/index-CxILeHfe.js.map +1 -0
  111. package/web-mobile/dist/assets/index-Cyr13VGR.css +1 -0
  112. package/web-mobile/dist/favicon-48.png +0 -0
  113. package/web-mobile/dist/favicon.ico +0 -0
  114. package/web-mobile/dist/favicon.svg +1 -8
  115. package/web-mobile/dist/icon-192.png +0 -0
  116. package/web-mobile/dist/icon-512.png +0 -0
  117. package/web-mobile/dist/index.html +5 -3
  118. package/web-mobile/dist/manifest.webmanifest +2 -2
  119. package/web/dist/assets/index-BA5mmiV0.css +0 -32
  120. package/web/dist/assets/index-CrkkIfd9.js.map +0 -1
  121. package/web-mobile/dist/assets/index-BqKt7IMx.css +0 -1
  122. package/web-mobile/dist/assets/index-X_vRr6cd.js +0 -88
  123. package/web-mobile/dist/assets/index-X_vRr6cd.js.map +0 -1
package/docs/browser.md CHANGED
@@ -1,100 +1,79 @@
1
1
  # Shared browser
2
2
 
3
- A real Chromium on the somora host that an agent drives with the
4
- `browser` tool — and that you can watch and take over in the web
5
- client, so a login with credentials the agent does not have, a 2FA
6
- code or a passkey is yours to do and the agent continues in the same,
7
- now signed-in tab. Everything else it does on its own — a captcha or
8
- image puzzle included: it screenshots, reads the picture with a vision
9
- model and tries, and asks for you only when that keeps failing.
3
+ A real Chromium on the somora host that your agents drive with the
4
+ `browser` tool. You can watch it live in the web client and take it
5
+ over, for example to sign in. The agent then continues in the same,
6
+ now signed-in tab.
10
7
 
11
- The web client includes the live picture, manual control, browser list,
12
- a chat notice with **Open browser** when an agent asks for you, and a
13
- taskbar marker for pending requests. Chat, taskbar and list share one
14
- change stream; reconnecting restores the current state automatically.
8
+ ## What you get
15
9
 
16
- ## Setup
10
+ - **Agents that use real websites.** They open pages, read them, click,
11
+ fill forms and take screenshots.
12
+ - **Logins that stay.** Each agent has its own browser profile. Cookies
13
+ and logins survive between turns and restarts.
14
+ - **You do the login, the agent does the rest.** When a page needs a
15
+ password, a 2FA code or your decision, the agent asks for you and
16
+ waits. You hand the browser back and it carries on.
17
+ - **A live picture.** Watch any agent's browser in the web client
18
+ without interrupting it.
19
+ - **Shared logins when you want them.** Put several agents on one named
20
+ profile. Each still gets its own window and tabs.
21
+ - **Your network stays closed.** Private addresses are blocked unless
22
+ you list them.
17
23
 
18
- ```yaml
19
- browser:
20
- enabled: true
21
- # executablePath: /usr/bin/chromium # auto-detected when unset
22
- headed: false # true = Chromium with a window, see "Headed mode"
23
- extraArgs: [] # extra Chromium flags, e.g. ["--proxy-server=http://proxy:3128"]
24
- maxTabsPerAgent: 8
25
- idleStopMinutes: 30
26
- viewport: { width: 1280, height: 800 }
27
- allowPrivate: [] # LAN hosts/CIDRs agents may open
28
- deny: [] # hostnames never opened
29
- profiles: {} # shared profiles, see below
30
- ```
24
+ ## Set it up
31
25
 
32
- somora looks for `chromium`, `chromium-browser`, `google-chrome` and
33
- the macOS app bundles; set `executablePath` for anything else. Without a
34
- browser the tool is still listed but every op answers with what was
35
- tried. `playwright-core` (no bundled browser) drives it.
26
+ 1. Install Chromium or Chrome on the somora host, for example
27
+ `sudo apt install chromium`.
28
+ 2. Switch the browser on in `config.yaml`:
36
29
 
37
- The tool appears only when `browser.enabled` is true, and can be denied
38
- per agent like any other toolset (`tools.deny: ['toolset:browser']` in
39
- agent.yaml, or the Abilities window).
30
+ ```yaml
31
+ browser:
32
+ enabled: true
33
+ ```
40
34
 
41
- ## Headed mode
35
+ 3. Restart somora.
36
+ 4. Ask an agent: "Open example.com and tell me what the page says."
42
37
 
43
- Headless Chromium tells every server and every page what it is: the
44
- user agent reads `HeadlessChrome/151…` and `navigator.webdriver` is
45
- true. Services with any bot filtering see that on the first request.
46
- `headed: true` starts Chromium with a window instead, without the
47
- automation flag and without Blink's `AutomationControlled` feature —
48
- the user agent is the normal `Chrome/151…` and `navigator.webdriver`
49
- is false, like a browser a person opened.
50
-
51
- On a desktop the window goes to `$DISPLAY`. On a server without a
52
- display somora starts a virtual X server per browser — **Xvfb**, a
53
- system package you install once (Debian/Ubuntu `sudo apt install
54
- xvfb`, Fedora `sudo dnf install xorg-x11-server-Xvfb`, Arch `sudo
55
- pacman -S xorg-server-xvfb`; macOS needs nothing). It is stopped with
56
- the browser. Nobody looks at that screen; the web client's live view
57
- keeps working, it streams over CDP either way.
58
-
59
- Without a display and without Xvfb the browser **refuses to start**
60
- and says so — in the tool result, in `browser status`, in the browser
61
- list of the web client and as `browser.headed_unavailable` in the log.
62
- It does not fall back to headless, because that would silently bring
63
- back the signals you switched headed on to avoid. Headed rendering
64
- costs some CPU and memory more per browser.
65
-
66
- What headed does not do: TLS fingerprints, canvas and behaviour
67
- analysis, Turnstile-style challenges. A service with serious bot
68
- protection may still tell.
69
-
70
- `extraArgs` appends Chromium launch flags verbatim (proxy, window
71
- size, sandbox flags). Both settings are per process: they apply to
72
- every profile and take effect on the next browser start.
73
-
74
- ## Per-tab device and locale
75
-
76
- An agent can open a tab as a phone or in another language, the way
77
- the device mode in Chrome DevTools does:
38
+ A **browser** tile appears on the web client's desktop. Open it to see
39
+ the agent's browser and watch it work.
78
40
 
79
- ```
80
- browser { op: "open", url: "https://example.com", device: "iPhone 15", locale: "de-AT" }
81
- ```
41
+ The `browser` tool exists only while `browser.enabled` is true. To keep
42
+ it from one agent, add `tools.deny: ['toolset:browser']` to its
43
+ `agent.yaml`, or switch it off in the Abilities window.
44
+
45
+ ## How an agent browses
46
+
47
+ The agent repeats four steps: `open` a page, take a `snapshot`, `act`
48
+ on an element, take a `snapshot` again.
49
+
50
+ A snapshot is a compact text outline of the page. Every element the
51
+ agent can use carries a reference such as `[ref=e12]`. The agent passes
52
+ that reference to `act` to click, fill, press a key, scroll or select.
53
+
54
+ References are valid until the next snapshot or navigation of that tab.
55
+ Each tab has a `generation` that counts up on every navigation. `act`
56
+ refuses a reference or generation from an older page state, so a click
57
+ never lands on an element that only looks the same.
82
58
 
83
- `device` is a Playwright device name (`iPhone 15`, `Pixel 7`, `iPad
84
- Pro 11`, …; an unknown name is refused with examples) and sets user
85
- agent, viewport, pixel ratio and touch of that one tab. `locale` is a
86
- BCP-47 tag and sets `Accept-Language` and `navigator.language`. Other
87
- tabs of the same browser are untouched; the tab's `emulation` field
88
- in `tabs`/`status` shows what is active. Ask an agent "open the mobile
89
- version" and it uses this.
59
+ A captcha or image puzzle is not handed to you right away. The agent
60
+ takes a screenshot, reads it with a vision model and tries. It asks for
61
+ you only when that keeps failing.
62
+
63
+ > **Note:** Text in a snapshot comes from a website. The tool tells the
64
+ > model to treat it as data, never as an instruction.
90
65
 
91
66
  ## Profiles and windows
92
67
 
93
- A Chromium profile is a cookie jar. Every agent gets its own under
68
+ A profile is a cookie jar. Every agent has its own under
94
69
  `~/.somora/browser/profiles/<agent>/`, so one agent being signed in to
95
- a site does not sign another in. A profile is one Chromium process; it
96
- starts on the first `open` and stops after `idleStopMinutes` without a
97
- tool call or viewer — the profile, and with it the logins, stays on disk.
70
+ a site does not sign another in.
71
+
72
+ A profile is one Chromium process. It starts on the first `open` and
73
+ stops after `idleStopMinutes` without a tool call or viewer activity.
74
+ The profile, and with it the logins, stays on disk.
75
+
76
+ ### Shared profiles
98
77
 
99
78
  Agents that should share logins get a named profile:
100
79
 
@@ -102,216 +81,422 @@ Agents that should share logins get a named profile:
102
81
  browser:
103
82
  profiles:
104
83
  shared:
105
- agents: [<agent-a>, <agent-b>]
84
+ agents: [ada, bea]
106
85
  ```
107
86
 
108
- Shared means shared cookies and one Chromium process — Chromium allows
109
- only one process per profile directory. It does **not** mean shared
110
- tabs: every agent gets its own **window** on that process.
87
+ Sign in once in one agent's window and the other agent is signed in
88
+ too. Shared means shared cookies and one Chromium process. It does not
89
+ mean shared tabs: every agent gets its own window on that process. An
90
+ agent that is not listed cannot use the profile.
91
+
92
+ ### One window per agent
93
+
94
+ A window has the id `<browser id>@<agent>`, for example
95
+ `profile:shared@ada` or `agent:cleo@cleo`. Everything you and the
96
+ agents touch is per window:
97
+
98
+ | What | How it behaves |
99
+ |---|---|
100
+ | Tabs | An agent lists and drives only its own tabs. A tab in another agent's window is out of reach. |
101
+ | Tab limit | `maxTabsPerAgent` counts per window, not per process. |
102
+ | Control | Take-over and handoff apply to one window. The other agent keeps working in its own. |
103
+ | `stop` | Closes the agent's own window. The process ends when the last window is gone. |
104
+
105
+ ### Throw-away profile
106
+
107
+ `open` with `ephemeral: true` uses a temporary profile next to the
108
+ agent's own, for "look at this without my logins". It is deleted when
109
+ that browser stops. The browser list shows it as `<agent> (temporary)`.
110
+
111
+ ## Handing the browser over
111
112
 
112
- A window is `<browser id>@<agent>`, for example `profile:shared@<agent-a>`
113
- or `agent:<your-agent>@<your-agent>`. It is the unit for everything you
114
- and the agents touch:
113
+ When a page needs you, the agent calls `request_handoff` with a reason
114
+ and ends its turn. Its window is now waiting for you:
115
115
 
116
- - Each window lists and drives only its own tabs. An agent cannot
117
- snapshot or click a tab in another agent's window, and `stop` closes
118
- its own window; the process ends when the last window is gone.
119
- - `maxTabsPerAgent` counts per window, not per process.
120
- - Control, handoff and take-over are per window. While you drive one
121
- agent's window, the other keeps working in its own, on the same Chromium.
122
- - A login is still shared, because the cookie jar is. That is the point
123
- of a shared profile: sign in once in one agent's window and the other
124
- agent is signed in too.
116
+ 1. A notice with the reason and an **Open browser** button appears in
117
+ the chat the agent asked from. The taskbar shows
118
+ `Browser · 1 waiting for you`.
119
+ 2. You open the window, press **Take over** and do your part.
120
+ 3. You press **Hand back**. The agent is woken once, in the session it
121
+ asked from.
125
122
 
126
- An agent not listed on a profile cannot touch it.
123
+ While the window waits or you control it, every agent operation on the
124
+ page is refused with `BROWSER_HUMAN_CONTROL`. Only `tabs` and `status`
125
+ still answer. The tool tells the model not to retry.
127
126
 
128
- `open` with `ephemeral: true` uses a throw-away profile next to the
129
- agent's own — for "look at this without my logins" — deleted on `stop`.
127
+ The wake reads:
128
+
129
+ ```
130
+ [browser] The user handed browser '<window>' back to you (handoff <id>).
131
+ Reason you asked for it: <reason>. Your note: <resume note>.
132
+ ```
130
133
 
131
- ## The `browser` tool
134
+ Beside that text the turn carries the advice to take a fresh snapshot
135
+ first, because the page may have changed.
132
136
 
133
- One tool, `op`-variants:
137
+ Good to know:
134
138
 
135
- | op | what |
139
+ - The notice shows the current state. It appears when you open the chat
140
+ later and disappears once you hand back.
141
+ - A handoff belongs to one window. Another agent on the same profile
142
+ sees neither the request nor the hand-back.
143
+ - A pending handoff survives a server restart.
144
+ - Waking is tied to the handoff id, so handing back twice wakes once.
145
+
146
+ ### Taking over without being asked
147
+
148
+ You can take over any window at any time. What happens on **Hand back**
149
+ depends on what you did:
150
+
151
+ | You did | Result |
136
152
  |---|---|
137
- | `open` | `url`, optional `tab` to navigate an existing tab, `ephemeral`, `device` / `locale` (per-tab emulation, see above). Returns `tab`, `generation`. |
138
- | `snapshot` | Compact accessibility tree of a tab; interactive elements carry `[ref=e12]`. `full: true` for the raw tree. |
139
- | `act` | `action` `click` / `fill` / `press` / `scroll` / `select` on a `ref` (`press`/`scroll` also without one), optional `value`, optional `generation`. |
140
- | `screenshot` | PNG into `<workspace>/browser/<agent>/`, path returned. |
141
- | `tabs`, `status` | What is open in **your** window; whether the browser runs, which profile and window (`view_id`), who controls it, the headed plan (`headless` / `display` / `xvfb` / `unavailable` with reason) and operator warnings. |
142
- | `request_handoff` | `reason`, optional `resume_note`. Marks the browser as waiting for you. |
143
- | `close_tab`, `stop` | Clean up. `stop` closes your window and keeps the profile; the Chromium stays up for other agents that still have one. |
144
-
145
- The loop an agent runs is `open` → `snapshot` → `act` → `snapshot`.
146
- Refs are valid until the next snapshot or navigation of that tab; the
147
- tab's `generation` bumps on every navigation and `act` refuses a ref or
148
- generation from an older page state, so a click never lands on an
149
- element that happens to be new. Snapshot text is data from a website —
150
- the tool description says so to the model.
151
-
152
- ## Navigation policy
153
-
154
- Public http(s) hosts are allowed unless on `deny`. Private networks
155
- (RFC1918, loopback, link-local, ULA) are blocked unless the host or CIDR
156
- is on `allowPrivate` — a page an agent reads could otherwise send it to
157
- an internal service. Hostnames are resolved before the check. `file:`,
158
- `chrome:` and everything else never load.
159
-
160
- Checked before every `open`, on every document request the browser
161
- makes (route interception) and after every navigation: a redirect into
162
- a forbidden host cannot be intercepted before Chromium follows it, so
163
- the tab is reset to `about:blank` right after and the next op reports
164
- where it was sent. That first request has been made by then — same
165
- limit OpenClaw documents; not a network firewall.
153
+ | Only looked | Nobody is woken. |
154
+ | Navigated, clicked, typed, opened or closed a tab | The window's agent is woken in the session of the tab it used last. |
155
+
156
+ The wake reads:
157
+
158
+ ```
159
+ [browser] The user took over browser '<window>', did something there
160
+ (navigation, clicks or typing) and handed it back to you.
161
+ ```
162
+
163
+ In the chat a wake shows as a centered divider, `browser · <agent> ·
164
+ handed back` or `browser · <agent> · activity`. Messages carry
165
+ `from_system: 'browser'`, like tmux and sentinel wakes.
166
166
 
167
167
  ## In the web client
168
168
 
169
- A **browser** tile appears on the desktop once `browser.enabled` is
170
- true. It opens the **browser sessions** list: one row per open window,
171
- named by the agent that owns it, with its profile, tab count, the
172
- active tab's title and the control state — *agent controls*, *waiting
173
- for you*, *human controls*. Two agents on a shared profile are two
174
- rows. A row opens that window.
175
-
176
- Only running windows are listed, the way the tmux session list only
177
- shows live sessions. The single exception is a stopped browser that
178
- still holds an unanswered handoff: it stays, with **Reopen browser**,
179
- because it is the only trail back to that request.
180
-
181
- The window streams the active tab live (JPEG screencast over a
182
- WebSocket, paced so a slow viewer drops frames instead of buffering
183
- them), with a tab bar, URL bar, back/forward/reload and the two
184
- buttons that matter:
185
-
186
- - **Take over** — you take control of this window: clicks, wheel,
187
- typing (umlauts, dead keys and paste included) and the URL bar go to
188
- the page, the remote viewport follows your window size, and this
189
- agent's operations are refused until you hand back. Another agent
190
- sharing the profile keeps working in its own window. Other viewers of
191
- the same window keep watching. A tab you open here belongs to this
192
- window, so the agent can use it afterwards.
193
- - **Hand back** — hands control back. If the agent had asked for
194
- you (`request_handoff`), it is woken once in the session it asked
195
- from: `[browser] The user handed browser '<view>' back to you
196
- (handoff <id>). Reason you asked for it: …` plus its own resume
197
- note, and the advice to take a fresh snapshot first accompanies the
198
- turn beside that text. If you took over on your own
199
- and did something (navigated, clicked, typed), the owner of this
200
- window is woken, in the session of the last tab it used here:
201
- `[browser] The user took over browser '<view>', did something there
202
- (navigation, clicks or typing) and handed it back to you.`
203
- The window you worked in decides who is woken, never the busiest
204
- agent on the process. Looking and handing back unchanged wakes nobody. The wake shows up
205
- in the chat as a centered *browser · <agent> · handed back* divider
206
- (`from_system: 'browser'`), like tmux and sentinel wakes.
207
-
208
- Watching needs no take-over. Closing the window stops the stream, not
209
- the browser and not the agent's work. Control is per window, not per
210
- tab: while you hold it, none of that agent's tabs move. The footer shows the streamed tab, the viewport size, the page
211
- generation and the frame counter — useful when a picture looks stale
212
- right after a navigation.
169
+ The **browser** tile appears on the desktop once `browser.enabled` is
170
+ true. It turns to the warning colour while a handoff is waiting.
213
171
 
214
- ## Handing the browser over
172
+ ### The browser list
173
+
174
+ The tile opens the **browser sessions** list, with one row per open
175
+ window. Two agents on a shared profile are two rows. Click a row to
176
+ open that window.
177
+
178
+ | In a row | Meaning |
179
+ |---|---|
180
+ | Name | The agent that owns the window. |
181
+ | Profile | `own profile` or `shared profile <name>`. |
182
+ | Tabs | Tab count and the title of the first tab. |
183
+ | State | `agent controls`, `waiting for you`, `human controls`, `paused` or `stopped`. |
184
+
185
+ Only running windows are listed. The one exception is a stopped browser
186
+ that still holds an unanswered handoff. It stays in the list as
187
+ `stopped · reopen`, because it is the only way back to that request.
188
+
189
+ Warnings, such as a missing Chromium, are shown at the top of the list.
190
+
191
+ ### The browser window
192
+
193
+ The window streams the active tab live. It has a tab bar, a URL bar,
194
+ back, forward and reload, and two buttons:
195
+
196
+ - **Take over.** Clicks, the mouse wheel, typing and the URL bar now go
197
+ to the page. Umlauts, dead keys and paste work. The remote page
198
+ follows your window size. This agent's operations are refused until
199
+ you hand back.
200
+ - **Hand back.** Returns control to the agent and wakes it as described
201
+ above.
202
+
203
+ Good to know:
204
+
205
+ - Watching needs no take-over. Other viewers of the same window keep
206
+ watching while you control it.
207
+ - Control is per window, not per tab. While you hold it, none of that
208
+ agent's tabs move.
209
+ - A tab you open belongs to this window. The agent can use it
210
+ afterwards.
211
+ - Closing the window stops the stream. The browser and the agent's work
212
+ go on.
213
+ - The footer shows the viewport size, the page generation and a frame
214
+ counter.
215
+
216
+ ## Where the browser may go
217
+
218
+ | Target | Allowed |
219
+ |---|---|
220
+ | Public `http` and `https` hosts | Yes, unless listed in `deny`. |
221
+ | Private networks | No, unless the host or range is in `allowPrivate`. |
222
+ | `file:`, `chrome:` and every other scheme | Never. |
223
+
224
+ Private means loopback, the private IPv4 ranges, link-local addresses,
225
+ `100.64.0.0/10` (Tailscale addresses fall in it) and the IPv6 local
226
+ ranges. Hostnames are resolved first, so a public-looking name that
227
+ points into your LAN is caught. The reason: a page the agent reads could
228
+ otherwise send it to an internal service.
229
+
230
+ An entry in `allowPrivate` or `deny` is a hostname, a `*.suffix`
231
+ pattern, an IP address or an IPv4 range such as `192.0.2.0/24`.
232
+
233
+ The rule is checked at three points:
234
+
235
+ 1. Before every `open`.
236
+ 2. On every page request the browser makes, which covers links and
237
+ pop-ups.
238
+ 3. After every navigation. A redirect into a forbidden host cannot be
239
+ stopped before Chromium follows it, so the tab is reset to
240
+ `about:blank` and the next operation reports where it was sent.
241
+
242
+ The URL bar in the browser window follows the same rule.
215
243
 
216
- When a page needs you, the agent calls `request_handoff` and ends its
217
- turn. The browser is now `handoff_requested`: every agent op is refused
218
- with `BROWSER_HUMAN_CONTROL`, and the tool description tells the model
219
- not to retry. The take-over buttons live in the browser window; the same
220
- switch is an HTTP route:
244
+ > **Warning:** This is not a network firewall. Images, scripts and
245
+ > background requests of a page are not checked, and in the redirect
246
+ > case the first request to the forbidden host has already been made.
247
+
248
+ ## Headed mode
249
+
250
+ Headless Chromium tells every server what it is. The user agent reads
251
+ `HeadlessChrome` and `navigator.webdriver` is true. Services with bot
252
+ filtering see that on the first request.
253
+
254
+ `headed: true` starts Chromium with a window and without the automation
255
+ flags. The user agent is the normal `Chrome` one and
256
+ `navigator.webdriver` is false, like a browser a person opened.
257
+
258
+ | Host | Where the window goes |
259
+ |---|---|
260
+ | Desktop session, macOS | The existing display. |
261
+ | Linux server without a display | A virtual screen, **Xvfb**, started per browser and stopped with it. |
262
+ | No display and no Xvfb | The browser refuses to start. |
263
+
264
+ Xvfb is a system package you install once:
265
+
266
+ | System | Command |
267
+ |---|---|
268
+ | Debian, Ubuntu | `sudo apt install xvfb` |
269
+ | Fedora | `sudo dnf install xorg-x11-server-Xvfb` |
270
+ | Arch | `sudo pacman -S xorg-server-xvfb` |
271
+
272
+ somora looks for `Xvfb` on the `PATH`. The environment variable
273
+ `SOMORA_XVFB_PATH` points it to another location.
274
+
275
+ somora never falls back to headless. That would silently bring back the
276
+ signals you switched headed mode on to avoid. The refusal is reported in
277
+ the tool result, in `status`, in the browser list and in the log.
278
+
279
+ Headed mode costs some more CPU and memory per browser. The live view
280
+ works the same in both modes.
281
+
282
+ > **Note:** Headed mode hides two signals. It does not change TLS
283
+ > fingerprints, canvas or behaviour analysis, and it does not solve
284
+ > challenge pages. A service with serious bot protection may still
285
+ > tell.
286
+
287
+ ## Phone view and language
288
+
289
+ An agent can open a tab as a phone or in another language, the way the
290
+ device mode in Chrome DevTools does:
291
+
292
+ ```
293
+ browser { op: "open", url: "https://example.com", device: "iPhone 15", locale: "de-AT" }
294
+ ```
295
+
296
+ | Parameter | Value | Sets |
297
+ |---|---|---|
298
+ | `device` | A Playwright device name: `iPhone 15`, `Pixel 7`, `iPad Pro 11` and more | User agent, viewport, pixel ratio and touch |
299
+ | `locale` | A BCP-47 tag such as `de-AT` | `Accept-Language` and `navigator.language` |
300
+
301
+ Both apply to that one tab only. An unknown device name is refused with
302
+ examples. The tab's `emulation` field in `tabs` and `status` shows what
303
+ is active.
304
+
305
+ ## After a crash or restart
306
+
307
+ | Situation | What happens |
308
+ |---|---|
309
+ | Viewer connection drops | The window reconnects by itself and keeps its tab and its control. A disconnect never hands control back to the agent. |
310
+ | Browser crashed or stopped idle | Cookies and logins remain. Tabs, forms and clicks are not replayed. Temporary profiles lose their data. |
311
+ | Handoff was pending | It stays visible. **Reopen browser** starts a blank page in the same profile. You still have to hand back. |
312
+ | No handoff pending | The agent's next `open` starts the browser again. |
313
+ | Server restarted | Same as a crash. Pending handoffs are restored from disk. |
314
+
315
+ The idle stop never closes a browser with a pending handoff, with you
316
+ in control or with an operation running.
317
+
318
+ There is no stored wake queue. If the server dies in the moment between
319
+ your hand-back and the wake, or the wake fails, continue the chat
320
+ yourself. A wake into a session that was deleted or archived is refused.
321
+ No new conversation is created in its place.
322
+
323
+ ## What it does not do
324
+
325
+ - No upload or download through the browser.
326
+ - No passkeys or hardware keys. The remote browser cannot see your
327
+ devices.
328
+ - No audio or video.
329
+ - No free JavaScript evaluation by the agent.
330
+ - No evasion of bot detection. A site that blocks automation blocks
331
+ this too.
332
+
333
+ ## Settings
334
+
335
+ ```yaml
336
+ browser:
337
+ enabled: false
338
+ # executablePath: /usr/bin/chromium
339
+ headed: false
340
+ extraArgs: []
341
+ maxTabsPerAgent: 8
342
+ idleStopMinutes: 30
343
+ viewport: { width: 1280, height: 800 }
344
+ stream: { quality: 60, maxFps: 15 }
345
+ allowPrivate: []
346
+ deny: []
347
+ profiles: {}
348
+ ```
349
+
350
+ | Setting | Default | Meaning |
351
+ |---|---|---|
352
+ | `browser.enabled` | `false` | Switches the tool, the routes and the desktop tile on. |
353
+ | `browser.executablePath` | auto-detect | Path of the Chromium or Chrome binary. |
354
+ | `browser.headed` | `false` | Run Chromium with a window. See "Headed mode". |
355
+ | `browser.extraArgs` | `[]` | Extra Chromium launch flags, passed as written, for example `["--proxy-server=http://proxy:3128"]`. |
356
+ | `browser.maxTabsPerAgent` | `8` | Open tabs per window, 1 to 32. The next `open` is refused. |
357
+ | `browser.idleStopMinutes` | `30` | Stop an unused browser after this many minutes. Logins stay. |
358
+ | `browser.viewport` | `1280` x `800` | Page size. Minimum 320 x 240. |
359
+ | `browser.stream.quality` | `60` | JPEG quality of the live picture, 10 to 100. |
360
+ | `browser.stream.maxFps` | `15` | Frames per second of the live picture, 1 to 30. The stream never sends more than 20. |
361
+ | `browser.allowPrivate` | `[]` | Private hosts or ranges agents may open, for example `["192.0.2.0/24", "nas.local"]`. |
362
+ | `browser.deny` | `[]` | Hosts never opened, for example `["*.exampleco.com"]`. |
363
+ | `browser.profiles` | `{}` | Shared profiles: `<name>: { agents: [...] }`. Names use lowercase letters, digits, `-` and `_`. |
364
+
365
+ `headed` and `extraArgs` apply to every profile and take effect when a
366
+ browser next starts.
367
+
368
+ Without `executablePath` somora checks these locations in order:
369
+ `/usr/bin/chromium`, `/usr/bin/chromium-browser`,
370
+ `/usr/bin/google-chrome`, `/usr/bin/google-chrome-stable`,
371
+ `/snap/bin/chromium`, `/opt/homebrew/bin/chromium` and the Chromium and
372
+ Google Chrome apps under `/Applications`. somora drives the browser
373
+ with `playwright-core`, which brings no browser of its own.
374
+
375
+ Files on disk:
376
+
377
+ | Path | Content |
378
+ |---|---|
379
+ | `~/.somora/browser/profiles/<agent>/` | An agent's own profile. |
380
+ | `~/.somora/browser/profiles/shared-<name>/` | A shared profile. |
381
+ | `~/.somora/browser/state.json` | Control state and pending handoffs. |
382
+ | `<workspace>/browser/<agent>/` | Screenshots. |
383
+
384
+ ## The browser tool
385
+
386
+ One tool, `browser`, with an `op` parameter:
387
+
388
+ | op | Parameters | What it does |
389
+ |---|---|---|
390
+ | `open` | `url`, optional `tab`, `ephemeral`, `device`, `locale` | Opens the URL in a new tab, or navigates the given `tab`. Returns `tab`, `generation` and `view_id`. |
391
+ | `snapshot` | `tab`, optional `full`, `max_chars` | Compact outline of the page with `[ref=e12]` references. `full: true` returns the raw tree. Default cap 20,000 characters. |
392
+ | `act` | `tab`, `action`, optional `ref`, `value`, `generation` | `action` is `click`, `fill`, `press`, `scroll` or `select`. `press` and `scroll` also work without a `ref`. |
393
+ | `screenshot` | `tab` | Saves a PNG to `<workspace>/browser/<agent>/` and returns the path. |
394
+ | `tabs` | none | The tabs in your window. |
395
+ | `status` | none | Whether the browser runs, profile, window (`view_id`), who controls it, the headed plan and warnings. |
396
+ | `request_handoff` | `reason`, optional `resume_note` | Marks the window as waiting for the user. Returns `handoff_id`. |
397
+ | `close_tab` | `tab` | Closes one tab. |
398
+ | `stop` | none | Closes your window and keeps the profile. |
399
+
400
+ `value` means text for `fill`, a key name such as `Enter` for `press`,
401
+ pixels for `scroll` (default 600) and the option for `select`. The
402
+ headed plan in `status` is `headless`, `display`, `xvfb`, or
403
+ `unavailable` with the reason. `control` is `agent_control`,
404
+ `handoff_requested`, `human_control` or `paused`.
405
+
406
+ A failed operation returns `ok: false` and an error that starts with
407
+ one of these codes:
408
+
409
+ | Code | Meaning |
410
+ |---|---|
411
+ | `BROWSER_DISABLED` | `browser.enabled` is false. |
412
+ | `BROWSER_NOT_ALLOWED` | The agent lacks the browser ability or is not on that profile. |
413
+ | `BROWSER_LAUNCH_FAILED` | No Chromium found, or headed mode without a display. The message lists what was tried. |
414
+ | `BROWSER_NOT_FOUND` | No running browser. Start with `open`. |
415
+ | `BROWSER_TAB_NOT_FOUND` | Unknown tab, or a tab in another agent's window. |
416
+ | `BROWSER_TAB_LIMIT` | The window is at `maxTabsPerAgent`. |
417
+ | `BROWSER_NAVIGATION_DENIED` | The URL is forbidden. Do not retry it. |
418
+ | `BROWSER_STALE_REF` | The reference is from an older page state. Take a new snapshot. |
419
+ | `BROWSER_HUMAN_CONTROL` | The window waits for the user or the user controls it. |
420
+ | `BROWSER_ACTION_FAILED` | Anything else: the element did not respond, the page did not load. |
421
+
422
+ ## Routes
423
+
424
+ In every route `:id` is the window id. A bare browser id such as
425
+ `agent:<your-agent>` also works while only one agent has a window on
426
+ that process.
427
+
428
+ | Route | What it does |
429
+ |---|---|
430
+ | `GET /browser/status` | `enabled`, the headed plan, warnings and the list of windows, including stopped ones with a pending handoff. |
431
+ | `GET /browser/stream` | The same list as server-sent events. A `browsers` event at once and on every change. |
432
+ | `POST /browser/:id/control` | Body `{"mode":"human"}` takes over. `{"mode":"agent"}` hands back. Optional `handoffId` and `by`. |
433
+ | `POST /browser/:id/restart` | Starts a stopped browser again with a blank page. |
434
+ | `POST /browser/op` | Runs a tool operation. Body `{agent, session, input}`. |
435
+ | `GET /browser/attach` | WebSocket for the live picture and input. Query `view`, optional `tab` and `viewer`. |
436
+
437
+ With `browser.enabled` off, `GET /browser/status` answers
438
+ `enabled: false` and the others answer 503. `POST /browser/op` also
439
+ checks the agent's browser ability.
440
+
441
+ Taking over and handing back from the command line:
221
442
 
222
443
  ```bash
223
444
  curl -sk -X POST https://localhost:18737/browser/agent:<your-agent>@<your-agent>/control \
224
445
  -H 'Content-Type: application/json' -d '{"mode":"human"}'
225
- # … sign in …
446
+ # sign in, then:
226
447
  curl -sk -X POST https://localhost:18737/browser/agent:<your-agent>@<your-agent>/control \
227
448
  -H 'Content-Type: application/json' -d '{"mode":"agent","handoffId":"<id>"}'
228
449
  ```
229
450
 
230
- The path is the window id. A bare browser id still works while only one
231
- agent has a window on that process.
232
-
233
- Handing back schedules one wake for the requesting agent in the session it
234
- asked from (idempotent per handoff id). The wake's text records the
235
- hand-back with the reason and the agent's own resume note; the
236
- instruction to take a fresh snapshot before acting, because the page
237
- may have changed while the user had it, is the turn's frame beside
238
- that text (the same per-turn field that carries the memory-recall
239
- block). A pending
240
- handoff survives a server restart. It belongs to one window: another
241
- agent on the same profile neither sees the request nor the hand-back.
242
-
243
- The notice appears in the requesting chat, including when that chat is
244
- opened later. Its reason and **Open browser** button remain until the
245
- handoff is returned. The taskbar marker opens the browser list even
246
- when that chat or browser window is closed. These are current-state
247
- notices, not historical transcript messages.
248
-
249
- `GET /browser/status` lists the open windows, plus stopped ones that
250
- still hold a pending handoff.
251
- `GET /browser/stream` sends that state initially and on changes; the web
252
- client uses this stream instead of repeatedly fetching the list.
253
-
254
- ## Recovery and limits
255
-
256
- A viewer reconnects after a broken connection and keeps its selected
257
- tab and controller identity. A disconnect never gives control back to
258
- the agent. A different viewer can explicitly take over; only the current
259
- controller can send input or hand back through the viewer socket.
260
- Old-tab or old-navigation frames are discarded, and inputs based on
261
- an obsolete frame are refused. Capture replacement waits for the old
262
- CDP session to stop.
263
-
264
- After a browser crash or server restart, every window that existed
265
- comes back with its control state, and pending handoffs remain visible. **Reopen browser** launches a blank page in the
266
- same persistent profile; saved cookies remain, but old tabs, submitted
267
- forms and clicks are not replayed. Temporary profiles lose their data.
268
- A pending handoff must still be returned by the user. Without a pending
269
- handoff, a new explicit agent `open` may resume a stopped profile.
270
-
271
- State writes use an atomic file replacement. A failed control-state write
272
- refuses the transition. The wake is dispatched after the handoff is
273
- cleared; there is no durable wake queue. If the server dies between that
274
- write and dispatch, or the wake fails, the user must continue the chat
275
- manually. Missing or archived source sessions are refused rather than
276
- creating a new conversation under an arbitrary name.
277
-
278
- Capture uses `browser.stream.maxFps` (default 15, capped at 20 by ack
279
- pacing). A viewer with 2 MB buffered drops frames; a slow status reader
280
- gets coalesced snapshots. Viewer input is limited to 64 KiB per message
281
- and 64 pending commands. WebSocket ping/pong detects a dead viewer after
282
- 80 seconds. The status stream has heartbeats and bounded writes too.
283
- Idle cleanup does not stop a browser with a pending handoff, human
284
- control, or an operation in progress.
285
-
286
- The global browser switch and per-agent browser ability apply to direct
287
- `/browser/op` requests as well as tool visibility. Human viewer access
288
- uses the web application's existing access boundary.
289
-
290
- ## Verification
291
-
292
- Run `node --import tsx src/browser/service.test.mts` for real-Chromium
293
- service tests, and the `change-stream.test.mts`, `screencast.test.mts`,
294
- and `session.test.mts` files in the same directory for focused tests
295
- (use `SOMORA_HOME=/tmp/somora-browser-unit` for isolated test logs).
296
- After `npm --prefix web run build`, run:
451
+ Limits of the live view:
452
+
453
+ | Limit | Value |
454
+ |---|---|
455
+ | Slow viewer | Frames are dropped once 2 MB are buffered. |
456
+ | Input message size | 64 KiB |
457
+ | Pending input commands | 64 |
458
+ | Dead viewer detected | After 80 seconds without a pong. |
459
+ | Who may send input | Only the viewer that took over. Another viewer can take over explicitly. |
460
+
461
+ ## Troubleshooting
462
+
463
+ **The agent says no Chromium was found.** Install Chromium or set
464
+ `browser.executablePath`. The error lists the paths that were tried.
465
+
466
+ **The browser refuses to start with `headed: true`.** The host has
467
+ neither a display nor Xvfb. Install Xvfb or set `headed: false`. The
468
+ log line is `browser.headed_unavailable`.
469
+
470
+ **The agent cannot open a page in your LAN or tailnet.** Add the host
471
+ or range to `browser.allowPrivate`. The log line is
472
+ `browser.navigation_denied`.
473
+
474
+ **Clicks in the browser window do nothing.** Press **Take over** first.
475
+ If the page just changed, wait for a fresh picture.
476
+
477
+ **The agent was not woken after Hand back.** The session it asked from
478
+ was archived or deleted, or the server restarted at that moment. Send
479
+ the agent a message to continue. The log line is `browser.wake_failed`.
480
+
481
+ ## Testing from source
482
+
483
+ The tests live in `src/browser/` of the somora repository:
484
+ `service.test.mts` (real Chromium), `change-stream.test.mts`,
485
+ `screencast.test.mts` and `session.test.mts`.
297
486
 
298
487
  ```bash
488
+ SOMORA_HOME=/tmp/somora-browser-unit node --import tsx src/browser/service.test.mts
489
+ npm --prefix web run build
299
490
  SOMORA_BROWSER_WEB_SMOKE=1 node --import tsx src/browser/web-smoke.test.mts
300
491
  ```
301
492
 
302
- This starts an isolated server, local OTP page and local model fixture,
303
- with two agents on one shared profile, then drives `/web` through
304
- takeover, OTP entry, reconnect and hand-back. It checks that the list
305
- shows one row per window, that the second agent keeps working while you
306
- control the first, notice removal, exactly one wake into the session
307
- that asked, and the direct ability gate. It uses
308
- temporary profiles and requires Chromium and permission to bind local
309
- ports; the running installation is not used.
493
+ The last one starts an isolated server with two agents on one shared
494
+ profile and drives the web client through take-over, reconnect and
495
+ hand-back. The running installation is not used.
310
496
 
311
- ## What it does not do
497
+ ## See also
312
498
 
313
- No upload/download UI, no passkeys or hardware keys (the remote
314
- browser cannot see your devices), no audio/video, no free JavaScript
315
- evaluation. Anti-bot detection is not evaded: a site that blocks
316
- automation blocks this too, so test with your own applications before
317
- a service like LinkedIn.
499
+ - [Security](security.md): what agents may reach on the network
500
+ - [Web client](web.md): the desktop, windows and the taskbar
501
+ - [Tools](tools.md): all tools and how to deny them per agent
502
+ - [Setup](setup.md): system packages such as Chromium and Xvfb