theseus/README.md
Dev a920737c3c Claude connector 0.2.0: connect Claude Code and Claude Desktop from the panel
Setting the connector up meant copying a command with a token into a
terminal, and since 0.3.107 the token rotates whenever the connector
stops, so a configured client silently lost access after any extension
toggle and had to be set up again.

The panel now has a Connect button per app. Claude Code is registered
through its own CLI (claude mcp add-json, user scope), so its config is
written by Claude Code itself; Claude Desktop gets only the theseus entry
in claude_desktop_config.json, with a backup and no write to a file that
does not parse. Apps connected this way are re-registered after every
start and every Revoke when the address or token no longer matches. The
panel opens by itself the first time the extension is turned on. The
copy-a-command route stays under "Set up by hand".
2026-10-24 00:32:06 +03:00

94 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Theseus Navigator
The browser — the consumer face of the stack. Native `.bch` support with the
resolver built in, so a user installs **one app** instead of modifying their
operating system. Named for the thread through the labyrinth: the chain is the
thread.
## Scope
- Electron shell (Chromium engine, no forking): tabs, address bar, history.
- **In-process `.bch` resolution** — no system daemon, no NRPT, no OS
trust-store changes; reuses `bns.js` from the BNS repo as a library.
- Record handling: `h` render, `ip` connect, `p`/`s3` via in-app gateway,
`u` redirect.
- **TLS via cert-verify hook** (Electron `setCertificateVerifyProc`) against the
BNS root / on-chain `tls` fingerprints — no OS store touched.
- **Provenance indicator**: shows whether a page came from the chain / Sia / a
direct server, with NFT category and record type — the decentralized padlock.
## Status: not started
Build it in its own session/repo. The ready-to-paste brief is
**`BROWSER-PROMPT.md`** (a reference copy in this folder; canonical source is
`D:\Dev\NameCoin\BROWSER-PROMPT.md` — if they diverge, NameCoin wins). It points
here and reuses the resolver core. `theseus.bch` is registered and should
eventually serve the browser's own homepage over the protocol it implements.
## Roadmap
[BUILD-ROADMAP.md](../BUILD-ROADMAP.md) Stage 5.
## Claude connector (MCP)
A built-in extension, **off by default**, that lets Claude Code or Claude
Desktop on the same computer work in your signed-in Theseus tabs: open and
read pages, click, type into rich editors, paste formatted text, upload
files. Design: [DESIGN-claude-connector.md](DESIGN-claude-connector.md).
**Turn it on.** Settings › Extensions › Claude connector. Its panel opens by
itself the first time; later it is the connector icon in the toolbar dock.
It shows the address, the token, the approved sites, the upload folders and
a live log of every action.
**Connect Claude.** In the panel, click **Connect** next to Claude Code or
Claude Desktop. Theseus registers itself in that app's own configuration
(Claude Code through its `claude mcp` command, user scope; Claude Desktop in
`claude_desktop_config.json`, backup kept beside it) and keeps the entry
current: the token changes whenever the connector stops or is revoked, and
the entry follows. **Remove** takes it out again. Claude Desktop needs a
restart after a change; a running Claude Code session picks it up with `/mcp`.
**By hand**, if you prefer (panel › *Set up by hand*), the same entry for
Claude Code is (once; `--scope user` makes it available in every project):
```bash
claude mcp add --scope user --transport http theseus http://127.0.0.1:47800/mcp --header "Authorization: Bearer <token from the panel>"
```
Check it with `claude mcp list`. **Claude Desktop** speaks stdio only; the
panel's *Claude Desktop* entry is a ready `claude_desktop_config.json` entry
that runs `stdio-shim.cjs` through the Theseus executable itself
(`ELECTRON_RUN_AS_NODE=1`), so nothing else needs installing.
**What protects you**
- Listens on `127.0.0.1` only, behind a random 256-bit token. Requests from
web pages (any `Origin` header) and foreign `Host` headers are refused.
No `--remote-debugging-port`: each tab is driven through its own
`webContents.debugger`.
- Theseus asks the first time Claude acts on each site (*Allow*, *Until
Theseus restarts*, *Don't allow*). Approved sites are listed in the panel.
- Never types or pastes into password or one-time-code fields.
- Uploads only from folders you add in the panel (none by default).
- `evaluate` (arbitrary page JavaScript) is a separate switch, off by default.
- A **Claude** chip in the toolbar shows while a client is connected, and the
tabs it controls get a dashed outline. The chip's ✕ stops the connector at
once; *Revoke token* in the panel issues a new token, cutting off every
configured client.
**Tools:** `list_tabs`, `open_tab`, `navigate`, `activate_tab`, `close_tab`,
`screenshot`, `read_page_text`, `snapshot` (accessibility tree with element
refs), `click`, `type`, `press_key`, `paste_html`, `paste_text`,
`upload_file`, `wait_for`, and `evaluate` while allowed.
**Tests**
```bash
node tests/claude-connector-unit.test.mjs
```
```bash
node tests/claude-connector.test.mjs
```
The second starts this checkout on a throwaway profile (`THESEUS_USER_DATA`,
`THESEUS_NO_UPDATE_CHECK`) and drives a local test page over MCP: typing into
a contenteditable editor, `paste_html` with a heading and a link, a PNG upload,
and the refusals (password fields, a file outside the upload folder, no token,
a browser origin).