feat(server): pair a second client into a live mission #260

targeting main from claude/multi-client
Open opened by topos-backsword.test.pds.did.bot
targeting main from claude/multi-client

One mission can now be driven from two clients of the same owner at once: a signed-in browser and a local terminal, each a full controller.

  • Shared sessions. A mission's WebSocket publishes every accepted step to its other attached clients as Observation. The host's slot lock keeps the log in one server-side order; a stale or duplicate turn is refused with the position to resume from, and an accepted action ends a walk another client was streaming.
  • Pairing. POST /v1/missions/{id}/pair (the mission's owner only) issues a short, single-use code. POST /v1/pair spends it with no credentials and answers with the mission and a one-use WebSocket ticket, so a local client plays without its own OAuth. Codes live three minutes, are drawn from the server's injected entropy, and are stored only as SHA-256 hashes.
  • Client API. protokill_client gains pair, redeem_pairing, attach(code), next_observation, and adopts a foreign step while waiting for its own reply. PROTOCOL_VERSION is 2 for the new message kind.
  • No store migration; the schema and store-v4.sql are untouched, and no float or extra world-time read is added.

Main-path test: crates/protokill_server/tests/multi_client.rs pairs, attaches a second client, acts from each in turn, checks both see every step, and checks a stale turn is refused while the other's lands.

🤖 Generated with Claude Code

Commits 3

test(server): move the multi-client test into the shared binary
test(server): let the shared act reply skip another client's step
feat(server): pair a second client into a live mission
Sign up or Sign in to add to the discussion.