diff --git a/README.md b/README.md index 9109192..cf22a96 100644 --- a/README.md +++ b/README.md @@ -163,16 +163,77 @@ is saved to `~/.sovereign_browser/session.txt`. See [`plans/browser-tabs.md`](plans/browser-tabs.md) for the full implementation plan. +### Agent tools + +The browser embeds a WebSocket server (using libsoup) that allows external +AI agents to control the browser programmatically. Connect to +`ws://localhost:17777/agent` and send JSON tool commands. + +The server starts **before** the login dialog, so an agent can authenticate +without human interaction. If no agent logs in within a timeout (default +30s, configurable in Settings), the GTK login dialog appears as fallback. + +**Login tools** (available before login): + +- `login_status` — check if logged in +- `login` — authenticate with method: `local` (nsec), `seed` (BIP-39 + mnemonic), `readonly` (npub), `nip46` (bunker:// URL), or `nsigner` + (hardware signer via serial/unix/tcp/qrexec transport) +- `logout` — clear signer and reset state +- `switch_identity` — change identity (same params as login) + +**Browser tools** (available after login): + +- Navigation: `open`, `back`, `forward`, `reload`, `get_url`, `get_title` +- Inspection: `snapshot` (accessibility tree with element refs), `get_text`, + `get_html`, `get_attr`, `eval` (run JavaScript) +- Interaction: `click`, `fill`, `type`, `press`, `scroll`, `hover`, + `focus`, `close` +- Tabs: `tab_list`, `tab_new`, `tab_switch`, `tab_close` +- Wait: `wait` (ms), `wait_for` (selector) + +**Snapshot + ref workflow** (same pattern as agent-browser): + +```bash +# Using websocat (cargo install websocat) +# 1. Login +echo '{"id":1,"tool":"login","params":{"method":"readonly","npub":"npub1..."}}' | websocat ws://localhost:17777/agent + +# 2. Open a page +echo '{"id":2,"tool":"open","params":{"url":"https://example.com"}}' | websocat ws://localhost:17777/agent + +# 3. Snapshot — get accessibility tree with refs +echo '{"id":3,"tool":"snapshot","params":{"interactive":true}}' | websocat ws://localhost:17777/agent + +# 4. Click by ref +echo '{"id":4,"tool":"click","params":{"ref":"@e2"}}' | websocat ws://localhost:17777/agent +``` + +**HTTP status endpoint:** `curl http://localhost:17777/` returns server +status (running, port, client count, logged in). + +**Agent settings** (in Settings dialog or `~/.sovereign_browser/settings.conf`): + +- `agent_server_enabled` (default: true) +- `agent_server_port` (default: 17777) +- `agent_allowed_origins` (default: `*`) +- `agent_login_timeout_ms` (default: 30000) + +See [`plans/agent-tools.md`](plans/agent-tools.md) for the full +implementation plan and tool comparison with agent-browser. + ## Roadmap 1. ✅ Base browser (WebKitGTK + C99, loads pages) 2. ✅ Browser tabs (GtkNotebook, per-tab toolbar, session restore, settings) -3. ⏳ Nostr login (GTK dialog → nostr_core_lib → nostr_signer_t) -4. ⏳ `window.nostr` injection (`sovereign://` URI scheme bridge) -5. ⏳ Security strip (disable SOP/CORS, accept any cert, shared context) -6. ⏳ FIPS URI scheme (`fips://` / `*.fips` via WebKitGTK scheme handler) -7. ⏳ `nostr://` content scheme -8. Future: agent runtime (didactyl hosting), multi-window, FIPS-distributed +3. ✅ Agent tools Phase 1 (WebSocket server, login tools, 31 browser automation tools) +4. ⏳ Nostr login (GTK dialog → nostr_core_lib → nostr_signer_t) +5. ⏳ `window.nostr` injection (`sovereign://` URI scheme bridge) +6. ⏳ Security strip (disable SOP/CORS, accept any cert, shared context) +7. ⏳ FIPS URI scheme (`fips://` / `*.fips` via WebKitGTK scheme handler) +8. ⏳ `nostr://` content scheme +9. ⏳ Agent tools Phase 2 (refinements) and Phase 3 (extended tool catalog) +10. Future: agent runtime (didactyl hosting), multi-window, FIPS-distributed ## License diff --git a/VERSION b/VERSION index bbdeab6..1750564 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.5 +0.0.6 diff --git a/src/version.h b/src/version.h index 6bda567..2a47b33 100644 --- a/src/version.h +++ b/src/version.h @@ -11,9 +11,9 @@ #ifndef SOVEREIGN_BROWSER_VERSION_H #define SOVEREIGN_BROWSER_VERSION_H -#define SB_VERSION "v0.0.5" +#define SB_VERSION "v0.0.6" #define SB_VERSION_MAJOR 0 #define SB_VERSION_MINOR 0 -#define SB_VERSION_PATCH 5 +#define SB_VERSION_PATCH 6 #endif /* SOVEREIGN_BROWSER_VERSION_H */