Repository navigation
Conversation
…he account's devices The server can sign in to an Atomic Chat account (email one-time code or RFC 8628 device code) and act as a remote access host: devices of the same account pair once (code, QR link, or "Allow" with a check code), get their own key for the public API, and keep a sealed copy of the server's current tunnel and LAN addresses through api.atomic.chat, which never sees either. - src/account: session (single-flight refresh, no sign-in over a live one), sign-in flows, and the remote host (protocol checked against the backend's reference vectors, HPKE via hpke-js, host plan, long-poll loop). - Device keys join the keyring through publicApiKeys only while sharing is on for the signed-in account; revoking is immediate. - account.* workspace operations (all secret for agents), snapshot field, config account.enabled (version 7, off by default), hidden commands atc login|logout|account and atc remote share|add-device|devices|allow|deny|revoke. - Hardened after a security review: a request gets a key only with a local allow record for its device and key, memory-first writes, logout through a fresh token, refresh races, clamped service numbers, cleaned device names. - New dependencies @hpke/core, @hpke/dhkem-x25519, @hpke/chacha20poly1305 and uqr; ADRs 2026-11-12 sign-in and sharing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings -> Account signs the server in by an emailed code or a device code and signs it out behind a warning. Server -> Remote access gets "Your devices": the share switch, where devices can reach the server, Add a device (code, link, QR code and countdown), requests with their check code and Allow/Deny, and devices with Revoke. The status line announces a new request; the last setup step points at atc login. Nothing shows while account.enabled is off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings -> Account (email code, device code page in a new tab, sign-out), the "Share with your devices" card on Server -> Remote access with the Add a device dialog (lifted from the desktop app; the QR code is the server's SVG shown as an image), an access-request toast that shares one stack with the update notice, and the atc login hint on the last setup step. Hidden while account.enabled is off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A smoke run on a Mac with a VPN app published its tunnel interface (198.18.0.1, the fake-IP range such apps use) as the first LAN address, so a device would wait on a dead address before the real one. Loopback, link-local (169.254/16, fe80::/10, which would also need this machine's zone id) and 198.18/15 are no longer offered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Account leaves Settings and becomes its own rail item above Help in the terminal UI and the web admin, shown only while account.enabled, with the account's initial once signed in. Its tabs come from ACCOUNT_SECTIONS: Overview signs the server in and out, and Remote models holds sharing with the account's devices (the switch, Add a device, requests, devices with access), moved off Server -> Remote access. Remote models shows the sign-in while nobody is signed in. Server -> Remote access keeps the tunnel and the local network and ends with one line on how sharing stands. The access request notice opens Account -> Remote models. Turning accounts off while the page is open falls back to Server. ADR 2026-11-13 "Give the account its own section, as the desktop app does". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nects Turning sharing off used to pause it: the keys stopped working here, but the grants stayed active on the account service, so the desktop kept showing "Connected". Now off drops the keys, allowed requests and the pairing code from the file first, then denies every pending request and revokes every approved or active grant (from the service's own list when it answers, else from what this server knew). The host record stays, so sharing again sends no new "new computer" email; devices pair again. --forget also removes the server from the account's computers. The CLI, the terminal UI and the web admin ask first while devices have access. A key a sync drops because its grant ended elsewhere (the device disconnected, another device revoked it, it signed out) is listed in snapshot account.remote.ended for five minutes, at most five. The terminal says "<device> disconnected from this server" once in its status line; the web admin shows a toast until dismissed. ADR 2026-11-13 "End every device's access when sharing stops" supersedes the "off pauses" part of ADR 2026-11-12. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR CI failed on Windows and macOS: - Windows has no POSIX modes, so the 0600 checks now run off Windows only (the data folder's owner-only ACL guards the files there). - The host loop ran as a fire-and-forget promise: a failure after it gave up, such as a write into a test folder already removed, became an unhandled rejection. It now reports that failure like any other, and settled() lets a caller wait for the loop and the last write before the folder goes. - The fake account service let a host deny an active grant; the service allows deny only on a pending or approved grant, and approve only on a pending one. A stop that raced the loop turned an active grant "denied". - The disconnect test waited for the key to go, then read the notice written right after it; it now waits for the notice itself. Six runs of the account tests under full CPU load pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Atomic Server can sign in to an Atomic Chat account and share its OpenAI-compatible API with the devices of that account — the desktop app today (its client role is in AtomicBot-ai/Atomic-Chat#410), a phone later. This is the server side of accounts part 3 (remote access); the backend is already live on
api.atomic.chat.account.json, 0600); signing in over a live session is refused, because it would end every device's access./v1(inference only) and a sealed copy of the server's current tunnel and LAN addresses, refreshed after restarts and tunnel URL changes. The backend never sees keys or addresses.remote-access.json(0600) and join the keyring throughpublicApiKeysonly while sharing is on for the signed-in account; they never touchclient-keys.json. Revoking is immediate.2026-11-13-end-every-device-when-sharing-stops, superseding the "off pauses" part of the 2026-11-12 ADR): the keys go here first, then every request is denied and every approved or active grant revoked on the account service, so the desktop shows "access ended" instead of "Connected". The host record stays (no second "new computer" email); devices pair again.--forgetalso removes the server from the account's computers. Every client asks first while devices have access.account.remote.endedfor five minutes; the terminal says " disconnected from this server" once in its status line, the web admin shows a toast until dismissed. The person's own Revoke or stop lists nothing.account.*workspace operations (allsecretfor agents), the snapshot'saccount,atc login | logout | accountandatc remote share | add-device | devices | allow | deny | revoke(hidden from help for now), an Account section in the terminal UI and the web admin — as in the desktop app, a rail item above Help (the account's initial once signed in) with Overview (sign in, who, sign out) and Remote models (the share switch, Add a device, requests, devices with access); Server → Remote access keeps the tunnel and the LAN (ADR2026-11-13-give-the-account-its-own-section) — an access-request notice, and anatc loginhint at the end of setup.account.enabled(config version 7). Flip it in a later release once accounts ship in the desktop app.Design notes
tests/remote_protocol.pyvectors (the same ones the desktop uses). HPKE via hpke-js (@hpke/core1.9.0,@hpke/dhkem-x25519/@hpke/chacha20poly13051.8.0,@hpke/commonheld at 1.10.1); HMAC/HKDF/SHA-256 and the X25519 public key vianode:crypto; QR codes viauqr0.1.3. Versions are the newest at least two weeks old. The owner approved the dependencies; see ADR2026-11-12-share-the-server-with-account-devices.PUT /server/client-keysis not used: the core ignores it when the embedder has a keyring, as atc does.account.*, so there is never a second copy of the session.2026-11-12-sign-in-to-an-atomic-chat-account,2026-11-12-share-the-server-with-account-devices,2026-11-13-give-the-account-its-own-section,2026-11-13-end-every-device-when-sharing-stops.Security review
An independent review ran before the first commit. Its findings are fixed and have regression tests:
approvedthat the backend reports by itself, a changed key, or an unknown method is denied.account.statusis hidden from agents, because a waiting device code would let whoever approves it first own the server.The same allow-record issue exists in the desktop host. Its fix is a separate change on AtomicBot-ai/Atomic-Chat#410.
Testing
npm run verifyon macOS arm64:build:binsucceed (Bun 1.4.4);bun test1.4.4;tui-editors-tools"URL refusal" can fail on a dev machine where the installed Atomic Chat app listens on port 1337 (the test's config v5 migrates to that port); it passed in this run and passes onmainCI.0600mode asserted where Windows reports0666) and on macOS/Windows (anENOENTrename race when a remote-host test's temporary folder is removed under a pending write). Not fixed here yet.test/contract/daemon-account.test.tsruns against a real core with the account service in memory. It goes throughatc login→atc remote share on→ a device asks →atc remote allow <check code>. The device key then gets 200 on/v1/models, and 401 afteratc remote revoke. A third case: a device that disconnects on its side shows up inremote.ended;atc remote share offasks first, and with--yesrevokes the remaining grant on the service, the key gets 401, and the host stays registered.api.atomic.chataccount with a real desktop client over a tunnel.Follow-ups
account.enabledand unhide the commands once accounts ship.🤖 Generated with Claude Code