Skip to content

Move chats between paired computers by blind pass-through while sync storage is off - #2812

Merged
AbirAbbas merged 16 commits into
devfrom
feat/passthrough-transfer
Nov 19, 2026
Merged

AbirAbbas merged 16 commits into
devfrom
feat/passthrough-transfer

Conversation

@AbirAbbas

@AbirAbbas AbirAbbas commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Chats move between a person's own paired computers through the hosted relay's blind pipe while hosted sync storage is off. Nothing is stored except a small record per chat (below). It is on by default and needs nothing beyond pairing. If the computer that has a chat is off, nothing can move until codeaf runs there again.

What it does

Today, with hosted storage off (the default until an account is approved), paired computers can see each other and drive each other with --at, but a chat cannot move: it stays on the computer that made it.

With this change, while storage is off:

  • The computer that has a chat keeps its encrypted frames in a local store (<home>/v3/sync/live-store/) instead of uploading them.
  • Another of the person's computers takes the chat by asking the holder directly, through the relay's existing blind pipe (the one --at and remote tasks already use). The relay forwards ciphertext and writes none of it.
  • The frames are sealed exactly as today, with keys only the person's computers have. The relay never holds a key.
  • A computer that has taken a chat becomes a source for it too, so a third computer can take it while the first is off.
  • The chat's secret files (.env* and files that look like they hold secrets, which codeaf keeps out of a chat's saved history) move with it over the same encrypted pipe, sealed with the chat's key, and are stored nowhere but the two folders.

Only ordinary chats, their files and their secret files move this way. Saved provider keys and credentials, memories, teams, shared preferences, idle handoff, task copies and the desktop app's messages to a chat on another computer still wait for storage approval.

Approved accounts and self-hosted relays are unchanged. CODEAF_PASSTHROUGH=off (also 0, false, no) restores today's behaviour.

What the hosted relay still stores

No chat content, files, secret files, titles, folder names or message text reach the relay. For the other computer to know a chat exists and who has it, the relay keeps a directory record per chat. Today a storage-off account writes no directory record for a new chat, so this is new. The record holds: the chat id, kind, parent chat, head and frame ids (ids, not content), saved time and size in bytes, and a hold naming which computer has it with its expiry, pending count, upload progress and whether a turn is running there; the chat-keys field is empty. It never holds the title or folder, not even sealed: Sync.publishInfo builds every record without them and the directory client strips them from every create and publish as a second guard. The cost is that the other computer's Home lists such a chat as untitled until it is taken.

An independent audit of every request and of what the hosted Worker persists found two leaks before merge, both fixed here with tests that fail without the fix: a take that kept local edits sent a sealed title, and the desktop app's message to a chat on another computer left sealed text in the relay's outbox (that verb is now absent while storage is off). Already true before this PR and unchanged: device records (name sealed; OS and architecture readable), stats counters, and the caller's IP for about a day on first contact.

Every relay write during one move (from TestLiveTransferC18EverythingTheRelayKeeps):

Request Count Size
GET /v1/dial/{door} (pipe) 1 stream, not stored
GET /v1/engine (door registration) 2 not stored
POST /v1/dir/cells/{id} 1 ≤ 299 B
POST /v1/dir/cells/{id}/acquire 1 83 B
POST /v1/dir/cells/{id}/publish 1 379 B
PUT /v1/dir/devices/{id} 2 256 B
any /v1/store/* (content, existence checks) 0

TestLiveTransferNothingReachesTheRelaysStoreFromLaunchThroughTheFirstPublish pins the last row from a fresh pairing through the first publish, including the background pass over older chats.

Limits

  • Both computers must be running codeaf (a terminal, the app or the background engine). If the holder is off, continue says <computer> has this chat and is not on right now; open codeaf there, then continue here within a few seconds (about 4 s on the PC, 6 s on the Mac) and leaves the chat where it was.
  • Secret files: the newest whole file wins (by file time), a deletion on one computer is not carried to the other, files over about 768 KiB stay put, and a secret file created since the holder's last saved turn can miss the move until the next one.
  • If the holder drops mid-transfer: before the chat opens, nothing is taken and nothing is half-installed; after it opens, the chat stays and its files finish on a later open (Opening a chat this computer already holds never restarts files that failed to arrive, so its tools and saves stay refused until the chat is taken again #2781's restart road).
  • An older chat (made before pairing) moves once it is opened on its computer, or once storage is approved.
  • When an account is approved later, a background pass uploads what only lived on computers; until it finishes, the computer road still answers.
  • The local store is a second copy of each shared chat on disk, with no clean-up yet.
  • A take whose holder is off, or with the switch off, still reads the relay store for the chat (a lookup and an existence check that send object ids; nothing is written), because a chat stored before the account's storage closed can still be there. The refusal comes after those empty answers.
  • The transfer stats count relay requests only, so door traffic does not show in them yet.

Validation

The contract (C1–C21) is in internal/syncsetup/live_transfer_test.go, one test per item, on two real Sync homes, a real engine, a relay that refuses uploads as the hosted service does with storage off, and a request log on the relay. It covers moving between running computers with zero store writes, ciphertext-only on the wire, only the person's own computers opening the door, the holder-off sentence, fetching only what is missing, approved and self-hosted unchanged, the off switch, a 105 MB chat in 13 responses, the chat showing before its files, cuts before and after the open, approval later, the door moving between processes, three computers, the relay-write table, a computer removed mid-stream, and edits surviving a round trip. Added in the merge-ready wave: secret files move with the chat (V1–V9 in live_secrets_test.go: byte-identical arrival, a marker inside a .env never on the wire or in the relay log, only paired computers, holder off installs nothing, the off switch, approved storage unchanged, round trip, passing on to a third computer, only the chat's files and not the vault), no title or folder in any request body on any road (passthrough_names_test.go), no message text left on the relay, a failed take leaves the record as it was, the holder-off sentence within the short window, the words-in-the-box tail only with a typed draft, a finished pairing counting the other computer before any roster read, and the background pass asking nothing of a closed store.

  • internal/filesdoor: -race clean. internal/blobstore: Disk under many concurrent writers.
  • Manual: every page that said moving a chat needs approval is corrected; the mode is named blind pass-through with probes in a person's own words.
  • make test-quick and make test-laws green; the internal/syncsetup blind pass-through subset green with the switch unset and with CODEAF_PASSTHROUGH=off; GOOS=windows and GOOS=darwin builds; gofmt clean.

Hand test (brand-new identity, storage off, hosted dev relay)

Three computers (a Linux PC and two homes on a Mac, each a separate computer), on the final build:

Step Result
168 MB folder, PC → mac-a shown 7.4 s, files 69.8 s, 2,530 files
mac-a's edits → PC shown 5.7 s, files 10.7 s
PC off, mac-a → mac-b (third computer, from the second) shown 2.4 s, files 68.8 s, 2,531 files, hashes match
mac-b fully off → mac-a mac-b has this chat and is not on right now; open codeaf there, then continue here in 5.8 s, no typed words so no words tail, nothing acquired
a failed take the chat's card still named the computer that had it
CODEAF_PASSTHROUGH=off on mac-a refused in 3.7 s with this chat is only on the computer that shares it, and blind pass-through is switched off here; …; nothing changed on mac-b
mac-b back → mac-a shown 2.4 s, files 4.5 s; mac-b said mac-a continued this chat; this window now only shows it 2.6 s later; mac-a's README edit and new file survived mac-a → mac-b → mac-a
first launch after pairing (two fresh homes on the PC) no storage-off sentence on either home; zero relay store requests (puts, gets, existence checks) on both from launch through the first publish, with a chat made before pairing in a 320 KB folder and the background pass running; a chat made after pairing moved, shown 3.5 s, files 7.0 s
secret files (same two homes, a git folder with a committed .env.example, an uncommitted .env and config/.env.local) all arrived byte-identical (sha256 match) with the same times; git status on the second computer matches the first, no deletions; the marker inside .env appears nowhere under either home except the second computer's copy of .env; zero relay store writes

The earlier two-computer round (PC and Mac) found the off switch ignored on a computer that had already shared a chat, the start page still saying chats stay put, a failed take re-recording the taker as holder, a 12 s holder-off wait and a stray words-in-the-box tail; all are fixed here. The final round found the first launch after pairing still using the old sentence and the background pass over older chats sending existence checks (object ids, no content) to the relay's store; both are fixed here.

Seen, not fixed here (existing, separate):

  • An edit made in place outside a tool call does not move (every road). A file appended to with >> keeps its folder's modified time, and the turn's seal only re-reads a folder whose stamp changed, so the next take writes the sealed version and the edit is lost (internal/cellstore change index).
  • The continue card clips long sentences (the full text is under the box).
  • Quitting a window that only shows a chat moved elsewhere can print codeaf could not save this chat; …, and the cause is never logged.
  • A bare launch takes another computer's chat by itself (Proposal: a bare launch should move another computer's chat here by itself only when it belongs to the launch folder #2783); the footer can show the chat title in the project slot; a taken copy's folder name nests the original's; the engine crashed once with concurrent map iteration and map write in internal/lane.

🤖 Generated with Claude Code

AbirAbbas added a commit that referenced this pull request Nov 18, 2026
AbirAbbas and others added 11 commits November 19, 2026 08:28
A second kind of identity door (the files door) needs the same Noise_IK
handshake as the task door without ever completing against it. The prologue
is now a parameter; the task door's calls are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ny writers

TrafficFrom lets a store that is not the HTTP client report progress and
honour the same idle limit. A new test writes one Disk folder from many
writers at once, because the live store is shared by every codeaf process
on a computer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A read-only door over the relay's blind pipe: a key derived from the
identity with its own salt, Noise_IK with its own prologue, a Hello bound to
the channel and checked against the roster, then length-prefixed Locate,
GetFrame, GetMany and Has requests with bounded responses. One process per
home registers it, under a lock. The Source side is a blobstore.Store that
dials the holder first, then other online computers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…age is off

While the relay gates storage and it is off, an ordinary chat publishes into a
local store and its directory record leaves the title and folder empty; a take
on another computer reads the frames through the holder's files door, then
other online computers, then the relay store. Everything else that waits for
storage approval still does. When storage is approved later, a background pass
uploads what only lived on computers. CODEAF_LIVE_TRANSFER=off restores the
earlier behaviour, and the old storage-off tests pin it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…older

The window, the engine host and the app start the files door while they run,
so a chat stays reachable after the terminal quits with the host still up.
Continue here on a chat whose computer is off names that computer and keeps
the words in the box.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Twenty-three pages said moving a chat needs storage approval; they now say it
moves live while both computers run codeaf, what the relay keeps, and what
still waits for approval. Ten probes reach the new sections.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…at live

A computer that published live keeps a pending-backfill marker, and the live
composite and files door read the marker alone, so CODEAF_LIVE_TRANSFER=off
still took a chat through another computer's door (found in the PC/Mac hand
test). liveCarries() now honours the switch first. Adds C8 for that case and
C20/C21, the full round trip of a file changed on the second computer, on the
live and the storage roads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
While live transfer carries chats, the start page no longer says chats stay
on this computer; it says they move live between paired computers while both
run codeaf, and that keys, memories, teams and preferences wait for sync
storage. The old sentence stays when live transfer is off or unavailable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The holder-off sentence ended with "; your words are still in the box" even
on a launch that carried no draft (found in the PC/Mac hand test). The tail
now rides only with a real typed draft.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ecord, a quick holder-off answer

The mode is called blind pass-through everywhere a person reads it (manual,
help, refusals, change entry), and the switch is CODEAF_PASSTHROUGH; the code
keeps its live identifiers. Two fixes from the PC/Mac hand test:
- a take that fails because the holder is off no longer leaves the record
  naming the taker; while pass-through carries chats the lease is asked for
  after the frames are in hand, not beside the fetch;
- a dial the relay answers with no machine registered retries for 2 s instead
  of 10 s, so the holder-off sentence comes in about two seconds; a door
  moving between processes of a running computer is still found.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AbirAbbas
AbirAbbas force-pushed the feat/passthrough-transfer branch from 0cc601a to 732a845 Compare November 19, 2026 14:09
AbirAbbas and others added 2 commits November 19, 2026 09:42
The first launch after pairing had read no roster yet, so it knew of nobody
to send a chat to: chats stayed put and the start page said they would, until
something listed the devices. A finished pairing (code, link, approval, the
app's pairing) now records that another computer is paired, the next roster
read still has the last word, and a storage-off sentence already on screen is
replaced when that answer changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tore

With hosted storage off, PublishLocalChats still packed each older chat and
asked the relay's store whether it held every object id of the chat's folder
before the local permission check refused the upload, and again at each
retry. It now returns at once while storage is off; an older chat moves when
it is opened on its computer (blind pass-through) or once storage is
approved. Approved storage still publishes, pinned by a test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AbirAbbas AbirAbbas changed the title Draft: move chats live between paired computers while hosted storage is off Move chats between paired computers by blind pass-through while sync storage is off Nov 19, 2026
AbirAbbas and others added 3 commits November 19, 2026 10:56
The files the seal guard keeps out of a chat's history (.env* and files that
look like they hold secrets) travelled only through the key vault, which waits
for storage, so a chat taken by blind pass-through arrived without them and
git showed them as deleted. The taking computer now asks the holder for that
chat's kept-out files over the files door's Noise tunnel the fetch already
opened; the holder reads them from the chat's folder and seals each page under
a key derived from the chat key, and the taker writes them through the vault's
confined restore road once the chat's files are down. Newest whole file wins;
deletions are not carried. Nothing new reaches the relay, the vault itself
(provider keys, credentials, preferences, memories, teams) still waits for
storage, and approved storage, self-hosted relays and CODEAF_PASSTHROUGH=off
are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An audit of what the hosted relay keeps found two leaks while storage is off.
A take that kept local edits branched with a record built outside the drive,
so the chat's sealed title went to the relay; Sync.publishInfo now withholds
the title and folder for every caller, and the directory client strips both
from every create and publish as a second guard. The desktop app's message to
a chat on another computer left sealed text in the relay's outbox; that verb
is now absent while storage is off (hello no longer offers chats.send) and
SendNote refuses before sealing anything. Approved storage and self-hosted
relays are unchanged and pinned by tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The change entry now lists every field of the per-chat record and the
desktop app's message verb that waits for storage, and the relay page says
secret files move sealed with the chat by blind pass-through and that synced
provider keys still wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AbirAbbas
AbirAbbas marked this pull request as ready for review November 19, 2026 16:32
@AbirAbbas
AbirAbbas merged commit c4ce12c into dev Nov 19, 2026
7 checks passed
@AbirAbbas
AbirAbbas deleted the feat/passthrough-transfer branch November 19, 2026 16:32
AbirAbbas added a commit that referenced this pull request Nov 26, 2026
…unning, over the relay or directly (#2965)

* Say "Move here" and "relay" in every string a person reads

One act has one verb: the Home card, its buttons and hints, the first-run
and pairing lines, the refusals and --help said "Continue here" (and, for
the same act, "Continue this chat here?", "continuing here" and "bring work
here"), and they now say "Move here". alt+m stays the key and alt+c stays the
resume key. The settings search keeps "continue here" as an alias so the old
words still find the row.

The server is "the relay" everywhere a string named it "the sync service",
with no change to any code identifier, flag, environment variable, wire name
or persisted key. Comments change only where they quote a respelled string.
One line, the pass-through door's "paused" notice, names no server at all: a
standing test keeps "relay" out of the door's sentences, so it says the
computers cannot reach each other.

Tests that assert the old strings assert the new ones, and the pinned
takeover card frames are re-ruled for the shorter words.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Add the words law: no string a person reads says "Continue here" or "sync service"

Reads every string literal in cmd and internal and fails naming the file and
line when one carries a retired spelling. The settings search alias for the
old label is the one kept exception, because a person types it and never
sees it drawn.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Call the relay's storage switch "relay storage", and keep the old name findable

The Settings row, /status, the help text and the refusals that named the switch
"sync storage" say "relay storage", which is what the design's one rule for the
word asks: "relay" names the server and its storage switch and nothing else.
Searching Settings for the old name still finds the row, and a test pins that.

The access-request text sent to the operators and wireauth's own prefixed error
keep their wording: neither is a screen, and the first is pinned by what the
operators read.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: say "Move here" and "relay", and keep the old label findable

The chat manual spelled the act of carrying a chat to this computer two ways,
"Move here" and "Continue here". It now says "Move here" throughout, and the
quoted sentences match the strings the program shows: the card's question, the
resume offer, the devices row hint, the refusals and the notices.

One section of the page that explains the act answers by the old label. Its
heading reads "Move here (it used to say Continue here)", so a person who
remembers the old word, or searches for it, lands there.

"sync service" is "relay" wherever the manual named the server, and the few
sentences that used "relay" as a verb about the factory's messages now say
what is meant: passes on. The factory pages' "relays" and the coordination
page's "relay watch" no longer read as a feature a person turns on.

Two tests state the contract in the manual's own terms: no page offers the old
label outside that one section, none says "sync service", and none uses "relay"
for a feature or an act; and a question in the old words reaches the section
that answers it. The pinned tests that quoted the changed sentences quote the
new ones.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: call the storage switch "relay storage", and keep the old name findable

The chat manual says "relay storage" wherever it said "sync storage", matching
the Settings row, /status and the refusals. The two sections a person looks in
for the switch, the access request and the Devices settings, name both
spellings in their headings, as does the blind pass-through section, so a
question in the old words still reaches them. A test pins that.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* chatlist: the words of a live view, in one place

A chat that keeps running on another of a person's computers and is read or
typed into from this one needs a handful of sentences: why it closed, that it
went offline, that this computer may watch but not type, who has the keyboard.
Two surfaces draw them, so they are spelled once here and every surface asks
for them by close reason.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Say "relay storage" in the access request and the wire error, and keep the old name in one list

The row, /status and the refusals already said "relay storage". Two strings
still said "sync storage": the pre-filled GitHub issue a person files to ask
for access (title "relay storage access: <id>", body "Please turn on relay
storage for my account.") and wireauth.ErrStorageOff.

The old name stays findable in Settings search. It was a private constant in
the Devices tab; it now lives with the "continue here" alias in one list,
config.LegacyWords, which is matched and never drawn, and which internal/wordlaw
will name as its one exception.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* Move here is the only verb: delete ContinueVerb, and name the card's words for what they say

The devices row offered "Move here" for a chat another computer was running and
"Continue here" for one it had let go of; both read "Move here" since the words
pass, so the second name goes. chatlist.ContinueVerb and VerbFor are deleted
(VerbFrom always says MoveHere) and OfferContinue is OfferMove.

In the Home card's own file the constants a person reads were named for the old
word: continueAsk, continueStay, continueRetry, continueAlreadyRunning,
continueFails, continueStoreBusy, continueUnreachable, continueCheckFails and
continuing are moveAsk ... and movingHere, so the next respelling happens once.
Home's note while one chat is arriving and another is chosen said "continuing X
next; Y is still on its way here"; it says "moving X next".

Strings only. The OfferKind chatlist.ContinueHere and the card's state names are
not touched.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* atlas: the pairing map says "move" for the act, and names the vault symbol it really has

The map's own description, the first machine's summary and the title of the
take-over scenario said "continue". They are "move a chat to the other", "pick
them up" and "Move chat".

TestEveryFilePathExists was red on the base: the map names pullVault in
internal/syncsetup/take.go, which the file spells pullVaultVia (renamed in
#2812). The symbol list now says pullVaultVia.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* factory: stop telling the model to "relay" an answer

"relay" names the server and its storage switch and nothing else, and these three
instructions used it as a plain verb: the foreman's "pass them on with tell and
relay what it answers", the press reply's "Relay that to the person", and the
follow-up prompt's "These messages are relayed to the job conversation". They are
"report", "Tell the person that" and "passed on", matching the Factory manual
pages, which already say "passes on".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* e2e: the card's question is one needle, moveAsk, in the table

Seven tmux scenarios waited for the Home card's head as a raw string, which is
how the suite stopped noticing when a respelling moved it. They now ask the
table (say(t, "moveAsk")), where the untagged gate reads internal/tui3's own
sources and fails the moment the surface stops spelling "Move this chat here?".

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: one heading answers the old words, and the last "continue" variants are "move"

The Move page's one old-words section is now headed exactly
`Move here: also called "continue here", "take over" or "continue on this
machine"`, and its body no longer spells the label at all: it says what happened
to the continue button and where it went, so a question in the old words still
reaches it by the heading and by the body's ordinary words.

The first pass matched line by line and missed three places where the manual wraps
a sentence: desktop-sync.md ("every Continue / here" and "Continuing here stops
new work"), relay-what-it-stores-and-sees.md ("Continue the chat here instead")
and "If another computer continues/has continued a chat". All are "move" now, and
desktop-sync.md no longer quotes a desktop line ("Continuing here runs your N
waiting messages") that neither repo spells. Home's arrival note is quoted as
"moving <Y> next".

internal/wordlaw reads the pages for the old spellings now, so this file's own
test keeps only the half the law cannot test: that the old words still reach the
page.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* wordlaw: three laws and two ledgers for the words this pass retired

TestSyncServiceIsGone, TestContinueHereSurvivesOnlyInOneManualHeading and
TestNoPersonFacingStringNamesRelayAsAFeature, as SPEC-P1 §3.9 asks, plus the
manual's relay ratchet and a test that the patterns catch what they should (a
sentence the manual wraps over two lines) and nothing else (a task that "cannot be
continued here").

- Go strings in cmd and internal, both manual corpora (read as text, wrapped
  lines and all) and the hosted relay's JavaScript may not say "sync service" or
  "sync storage"; the one exception is config.LegacyWords, and three manual
  headings that name both "relay storage" and the old name so probes in the old
  words still find their page.
- "continue here" and its variants live only in the one mandated manual heading,
  which must still exist exactly once.
- relay_words.golden lists every non-test Go string that says "relay" with a
  class: server, storage, other-feature (model pool files only) or model-prompt
  (the plain verb in internal/session instructions, to be reworded). A new string
  fails until a person classes it; `go test ./internal/wordlaw -run Relay -update`
  rewrites the ledger. relay_manual.golden is per-page relay counts for the chat
  manual: they may fall and may not rise, and a page with no baseline must be new.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tui3: the device pages may say "relay" now, and may spell the old names in one heading

TestTheDevicePagesKeepTheVocabularyLaw banned "relay" on the three device pages
because they called the server "the sync service". The server is "the relay" in
every sentence a person reads since the words pass, and the refusals these pages
quote verbatim (TestEverySentenceOfTheDeviceScreensIsOnItsPage) say it, so the
two tests could not both hold. The contract that changed is the first one: what
"relay" may name is fenced by internal/wordlaw now (the server and its storage
switch). node, lease, manifest, takeover and take over stay banned, except in the
one heading that spells the old names of Move here, so a person who asks in them
reaches the page.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* relay: the API a live dial is written against (DialDoor, the two classes, LiveStreams, Jitter)

Adds the names the live door codes against, with no behaviour change to
any relay or any existing caller:

- relay.DoorLive and relay.DoorMove, the class a dial may claim in the
  Codeaf-Door request header (HeaderDoor), and relay.LiveStreams (14)
  beside MaxStreams (16).
- relay.DialDoor(ctx, service, name, class), Dial plus that header. The
  empty class sends nothing, which is what Dial now calls it with, so
  every existing dial is byte for byte what it was. A class that is
  neither known value is refused before anything is sent.
- relay.FirstRetry (1 s plus a draw from [0, 5 s)) and relay.Jitter (a
  wait times a draw from [0.75, 1.25)), over a package variable so a
  test pins the random source.

Each has its unit test: the class crosses both the WebSocket and the raw
carrier, an unclassified dial sends no header, and the real random
source stays in range and does spread.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* relay: hold a live dial to 14 streams, keep 2 for Move, cut a live stream that floods, say when to retry

The self-hosted relay now reads the class a dial claims in Codeaf-Door.

- A live dial is refused (429) once the machine has 14 streams attached,
  counted against the machine's TOTAL, so live dials can never take the
  last two, which stay free for a move. A dial that says nothing, a
  class this relay does not know, and a move are held to 16 exactly as
  before: an older client behaves as it always did.
- A LIVE stream that sustains more than 4 MiB/s over 5 s in either
  direction is closed (WebSocket close code 1008, a plain close on the
  raw carrier) and the machine is told, as for any close. The count is
  a leaky bucket taken when a chunk arrives: no timer, no goroutine.
  Streams with no live class are copied exactly as they were.
- Both rate-limit refusals (30 dials and 10 registrations a minute) now
  carry Retry-After: the seconds left in the minute they are counted in,
  never under one. The stream-ceiling 429 has no window and carries none.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* relay worker: the same class gate, breaker and Retry-After on the hosted relay, and a law that the two agree

The hosted Worker's machine object reads the Codeaf-Door class the way
the self-hosted relay does: a live dial stops at 14 streams against the
machine's total and a move keeps the last two; a dial with no class, or a
class that is not exactly live or move, is held to 16 as before.

A live stream carries its class in its own socket attachment, which
survives hibernation, and is held to the same 4 MiB/s over 5 s breaker in
each direction. The count is taken when a message arrives; the object
still schedules no timer and no alarm, so an idle live view lets it
hibernate, and a test pins that along with the fact that a whole live
session writes only the stream-id counter. Both rate-limit refusals
(the front door's and the machine object's) carry Retry-After.

The numbers the Worker states in carrier.js are held to relay.go's by a
Go test, and relay.go's to carrier.js's by a Worker test, so a limit
cannot be changed on one side only. The Worker suite is not run by any
pull-request job, so its pass line is recorded by hand.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair, taskdoor: spread the redial after a drop so a relay restart does not bring every computer back in step

The pairing host and the task door redialled after exactly 1 s, 2 s, 4 s,
so a relay restart or deploy, which drops every carrier in the same
instant, brought every computer back in the same seconds into a relay
that counts registrations per minute. The first wait after a drop is now
relay.FirstRetry (1 s plus a draw from [0, 5 s)) and each later wait is
the doubling schedule scaled by relay.Jitter (0.75 to 1.25). The caps
and the reset after a stable minute are unchanged.

Tests that asserted the exact waits now assert the bands. The three that
watch a real relay come and go in real time either inject a wait capped at
a second or allow the longest first retry, because six seconds is now a
correct first wait.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair: keep a host-local book of what each paired device may do here

Remote control needs one answer to "may this computer watch, may it type":
a 0600 permits.json beside the pairing records, written whole through a
temp file and a rename. A device the book has never heard of reads as
legacy (watch on, drive off) so a missing, torn or foreign file can only
narrow what a viewer may do, never widen it.

The book takes a one-time snapshot of the devices that were already paired
when it first looked: those stay watch-only until the person says
otherwise, and a device paired after the snapshot starts with both on. A
computer that finishes Join or JoinByLink stamps an empty snapshot so
every device it meets later is new.

Nothing reads the book yet, so no behaviour changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair: the approval line says a new computer can also control chats here

A computer paired after remote control ships starts with watch and drive
both on, so the line the approving computer prints says so and where to
change it: "<name> can also see and control your chats here. Change that
in /devices." It is one constant, PairedControlLine, so the terminal card,
the link path and the desk question can all say the same sentence.

The three manual pages that quote the approval line are updated in the
same change, as the manual law demands.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* wordlaw: classify the relay's dial-class refusal as the server's word

The relay's new DialDoor names its own refusal for an unknown dial class,
which says "relay" the way every other server refusal does. The ledger
regeneration also settles the lines into the order the writer sorts them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* chatlist: the words of a live view, in one place

A chat that keeps running on another of a person's computers and is read or
typed into from this one needs a handful of sentences: why it closed, that it
went offline, that this computer may watch but not type, who has the keyboard.
Two surfaces draw them, so they are spelled once here and every surface asks
for them by close reason.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* viewcache: keep the last-seen copy of a chat another computer runs, on this computer only

A live view leaves nothing on the relay, so when the other computer goes away
there was nothing to show. The viewer now keeps the newest stretch of the chat
(200 entries, 1 MiB, 40 chats) in its own home, private to the person, and
reads it back read-only. PERF.md carries the same bounds.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: name the stamp a door puts on a viewer, and the paged transcript read

A viewer that reaches a chat through another computer's door is not the
person at that computer's keyboard, so the Hello and the Welcome gain an
optional Remote: who the viewer is, the label to show, whether it may watch
and whether it may type. Both are omitted when absent, so a local window's
bytes do not change. The stamp is written by the door, never trusted from
a surface.

Also declares Transcript.Page and its argument and reply types, so the
guest allow-list can name the one read a remote viewer is given. Nothing
serves it yet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: a remote viewer is a guest of the holder, default-deny

The holder now honours the stamp. A connection that carries Hello.Remote
may only join a chat that is already open (it can never start one), arrives
without the keyboard and without telling anyone it moved, and is named in
every "the keyboard is on ..." line by the label the door stamped rather
than by anything the viewer typed. Whether it watches or types is decided
here from the stamp, so a viewer cannot talk its way out of watch-only or
into drive.

What a guest may call is an allow-list that refuses everything it has not
heard of: the reads a watcher has today plus the paged transcript, and for a
drive guest the doors that type, steer, stop and answer once. Shell, setup,
images, files, posture, remembering a permission and session lifecycle are
off both lists. The refusal is one sentence that names the computer.

A local window's Welcome is byte-identical to before, pinned by a golden
test captured on the untouched tree.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* session: an answer from another computer cannot settle an irreversible ask

An Answer now says whether it came through a door from another computer.
The door that carried it sets that, never the surface, and it is dropped
before anything is recorded, so no decision or answer file ever holds it.

When it is set, ResolveQuestion refuses before it takes anything off the
book: a question graded irreversible stays open for the computer the chat
runs on, with any answer (allow, deny or put away), and a permission
answer that would be remembered, or that banks a rule, is refused too.
Allowing or denying once on a costly ask, words that only ask for more
context, and an answer to a reversible question go through as before. A
revision of an irreversible decision is refused the same way. Nothing is
decided by a refusal: the question is still on screen everywhere.

ResolveConsentFrom is the same refusal for the older consent door; a call
with remote unset is exactly ResolveConsent.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: the holder stamps answers from a guest and refuses what only it may settle

A question answer that arrives on a remote connection is stamped as such by
the holder, overwriting whatever the viewer sent, and a local window's
answer is stamped as not. The two refusals the session returns reach the
viewer as one sentence naming the computer, and the connection stays up.

A guest's consent goes through the door that can tell whether the ask is
irreversible; an engine without that door refuses it rather than settling
it on the plain road. Posture and remembered permissions were already off
both allow-lists, and a test now pins that against a real server.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tui3: a chat another computer runs can be shown as a live view

A conversation that carries a live seam is drawn as a view of a chat another of
this person's computers keeps running: the box says Message <computer>, the seam
line says it is live, and one dim sentence stands in the box's place while the
view went offline, sat idle, was revoked, ran out of its allowance, may only
watch, or the keyboard is elsewhere. Words already typed are kept and come back
when the sentence goes. Enter reconnects an idle view and takes the keyboard
back, and sends nothing in the other states.

Nothing here is reachable until a door supplies a live seam, and with none every
line of the surface behaves as it did: no live seam, no hint, no bar, no road row,
no ownership check skipped.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: a page for working in a chat that another of your computers runs

remote-control.md answers the questions a person asks with a live view in front
of them: what watch only means, who has the keyboard, what went offline and the
last seen copy say, whether it needs relay storage, how to turn it off for one
computer, why a view closed, and that it is off until turned on. Every sentence a
live view can say is on the page word for word, pinned by a test, and the
seventeen questions people ask are probes that must reach it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: the pages that said storage off meant no way into another computer's chat

With relay storage off a chat on another computer can now be opened live while
both computers run codeaf, so the paragraphs that said there was no way in say
what is still true: a message for an offline computer still needs storage, and a
live view does not. The older pages that described Enter on another computer's
chat as always asking to move it say that remote control, when turned on, opens
it live first.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tui3: Enter on another computer's chat opens it live, and a live chat can be moved here

With remote control wired, Enter on a Home row for a chat another online
computer holds opens it as a live view instead of asking to move it; nothing
moves and no hold is written. A door that fails says why on Home's foot and the
Move card is asked as before, and a door with nothing to open asks the card in
silence. The move chords (alt+m, alt+c and a local row found held elsewhere)
still ask the card.

alt+m inside a live view opens Home on the Move card for that chat. While the
move runs both Home and the live view say Moving here, a failed move puts the
person back in the live view with the failure said once and nothing typed lost,
and a successful one retires the live view. The window that held the chat
follows it to a live view of the new holder, opened off the update loop, and a
refusal says the Superseded note as it always did.

With no live seam every one of these paths is the code it was.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* config: a Remote control setting, off until the person turns it on

Another computer opening this computer's running chats is new, so it ships
behind one switch: the `remote_control` row in Settings, or
CODEAF_REMOTE_CONTROL for a script. The environment wins when it holds a
boolean word and is ignored otherwise; with neither, remote control is off.
RemoteControlOn reads it for this computer's profile.

The settings page says what the row does, as the manual law demands.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: codeaf devices permit shows and changes what a paired computer may do

`codeaf devices permit <name> [--watch on|off] [--drive on|off]` prints the
named computer's permit as one sentence (watch on, type off) and whether it
is the default for how it was paired or one the person set, and with a flag
changes it. The name resolves the way `revoke` resolves it, duplicates and
unknown names included. It edits only this computer's own permit book: a
law test keeps `internal/remote` from importing the pairing package, so no
wire method can ever write it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair: every approving screen says the new computer can also control chats here

The person who approves a pairing is told, before they answer, what the new
computer will be able to do and where to change it: the terminal code and
link paths, the /pair card, the approve screen under its check number and
the desk question for both. The "is now paired" toast now takes its words
from pair.ApprovedLine instead of a second spelling of them. Every surface
calls pair.PairedControlLine, so the sentence cannot drift.

The manual's approve-screen example and its account of what an earlier
pairing may do are updated in the same change.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tui3: older pages of a live chat, per-computer watch and type switches, a one-time question

Scrolling to the top of a live view asks the other computer for the page before
it, off the update loop and one request at a time, and draws it above what was
there without moving the line being read. An error is said once and is not
retried until the next scroll to the top.

The devices card and the Devices tab of Settings show what another computer may
do with the chats on this one (watch and type, watch only, not shared) and offer
w and t on its row. Turning type on asks first; any key but y keeps it off.
Where a door does not offer the switches, the rows and keys are as they were.

Home asks once whether computers paired before remote control may type into
chats here, through the card Move uses, never over another card and never again
after an answer. An offline computer's Home row says when it was last seen, only
when that is known.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: the sentences of the live view, the watch and type keys and the one-time question

The remote control page now quotes every sentence the terminal spells for a live
view, the access words and keys of the devices rows, the type confirmation and
the question Home asks once, and a test per page reads each one out of the code
that draws it so a respelling fails. alt+m in a live view is on the keys page.
The heading that answers "why can't I type in this chat" keeps the question it
always answered, and the new section is worded so it does not take its place.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: the terminal's door for live views, absent until a road to another computer is installed

OpenLive is set only when remote control is switched on, the window is not a
hosted one and a road to the other computer exists. A held chat on an online
computer opens through remote.Roam so a drop redials and resumes; an offline one
opens the last-seen copy this computer kept, read-only, or nothing at all. The
live agent pages older entries through the road, keeps the viewer's copy on quiet
beats and when the view is let go, and leaving a live view closes only this
computer's connection: the chat goes on where it runs.

The road is one small interface and one injection point, so this builds and tests
without the engine packages; with none installed every build behaves as it did.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: the credential law lists Hello.Remote among the reviewed fields

Hello's fields are pinned by an allowlist so nothing that carries a key or
an address can be added without a review. Remote is a device id, a label,
two booleans and the name of the road, so it joins the list with its
reason beside it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: a guest cannot stall the holder or flood a viewer with one line

Three bounds, all on the remote road and none on a local window:

- Every frame to a remote guest is written under a two-second deadline. A
  guest that stops reading is marked lagging and its connection is closed,
  and the room is left on the ordinary hang-up road; the conversation, the
  turn and every other window carry on.
- A frame whose line, after inflating, is over 256 KiB is not sent to a
  guest. A result becomes an error on the same call id that points at the
  paged read, an event becomes a short notice on the same stream and
  sequence number so replay stays exact, and anything else is dropped and
  counted. A line at exactly the cap goes through, and the ring and local
  windows still hold the original.
- A client can be built with a line limit (WithMaxLine, or Roaming.MaxLine
  for a client that redials). It reads through a bounded buffer and ends the
  connection with a sentence when the host sends a line over it. With no
  limit the reader is the unbounded one it always was.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: the live-view endings heading stops outranking the closing-a-chat page

The heading of the section listing why a live view ended said "close" and
"chat" twice, and it pushed the closing-a-chat page out of the first eight
results for its own name. It now says "end"; the sentences are unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* e2e: the keyless remote control scenarios, written and vetted, not yet run

TestRemoteControlE2E drives two real binaries through tmux against throwaway
homes: opening a chat live, watch only, who holds the keyboard, the host going
offline, Move here from a live view, and the pairing screen's words. The needles
come out of the tuiwords table.

The file needs rc/engine merged to build with -tags e2e (pair.PermitsAt), and the
untagged needle pairedControlLine waits for the same merge. Vetted with a stub
for rcGrant only.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: read a chat's transcript a page at a time

A viewer on a slow link cannot be handed the whole transcript at once, so
Transcript.Page returns the entries that end before an absolute index, in
pages of 40 by default and never more than 200, and never more than 192 KiB
of text: a page is cut from the newest end until it fits, and the older
entries come on the next call. One entry too big to fit alone is returned
shortened, with a visible mark, instead of being dropped. The reply says
where the page starts, how many entries there are, and whether older ones
remain, so a viewer can count entries by the same absolute index the rest
of the chat does.

The remote client gains TranscriptPage. An older host that has never heard
of the method answers "no such method", which comes back unchanged so the
caller can fall back. A guest is refused the whole-transcript read and is
given this one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* relay: the API a live dial is written against (DialDoor, the two classes, LiveStreams, Jitter)

Adds the names the live door codes against, with no behaviour change to
any relay or any existing caller:

- relay.DoorLive and relay.DoorMove, the class a dial may claim in the
  Codeaf-Door request header (HeaderDoor), and relay.LiveStreams (14)
  beside MaxStreams (16).
- relay.DialDoor(ctx, service, name, class), Dial plus that header. The
  empty class sends nothing, which is what Dial now calls it with, so
  every existing dial is byte for byte what it was. A class that is
  neither known value is refused before anything is sent.
- relay.FirstRetry (1 s plus a draw from [0, 5 s)) and relay.Jitter (a
  wait times a draw from [0.75, 1.25)), over a package variable so a
  test pins the random source.

Each has its unit test: the class crosses both the WebSocket and the raw
carrier, an unclassified dial sends no header, and the real random
source stays in range and does spread.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: a message resent after a dropped link is never applied twice

A phone that loses its link right after pressing send cannot know whether
the words arrived. The viewer now resends the unanswered Submit, FollowUp or
Steer on the new pipe under the same id, and the holder recognises a repeat
by (device, id): it answers the original stream and delivers nothing a
second time, from a bounded in-memory table or, after a holder restart, from
the persisted transcript tail. The holder says it does this in
Welcome.MessageRepeat, so a viewer talking to an older holder fails the send
instead of risking a double delivery. Only a connection a door has stamped
as a remote viewer is deduplicated; local windows keep sending exactly as
before.

The replay ring is now also bounded by bytes, and when a resuming surface
asks for events the ring has already dropped it is told with one "gap" frame
instead of silently skipping them; a reader that does not know the frame
ignores it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: a dropped link comes back at a different moment on every computer

When a relay restarts it drops every socket at once, and every roaming
viewer used to come back one second later, together. The first retry now
waits one second plus a random spread of up to five, and each later wait is
scaled by a random 0.75 to 1.25, so the returns arrive spread out. The
ceiling and the doubling are unchanged. A test that sets the first pause
itself still gets exactly that pause, so no test sleeps for real.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* remote: the engine folds streamed text into 33 ms runs only when remote control is on

Remote viewers are billed per message, so text that arrives a few
milliseconds apart should travel as one event, one sequence number and one
replay entry; resuming still replays the folded run exactly. The daemon's
engine now sets that window from the home's remote-control setting. With the
setting off it stays at zero, one frame per event, exactly as it was.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair: a registration can carry a second kind of connection, chosen by its first byte

The files door's registration already starts every stream with one byte that
says what the connection is for. This names that byte for files and adds a
second, for a live view of a chat, and lets the accepting side hold a prologue
per byte and a gate that can refuse one before anything is written back, so a
stream made for one door can never complete against the other. The existing
connect and accept calls are now thin wrappers and send and accept exactly
the bytes they did.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* filesdoor: the same door can hand a live view to the process that holds the chat

A host that gives it a live handler now admits the live connection byte
alongside the files byte, runs the same certificate and channel-binding hello
for both, and hands the authenticated device to the handler. The door counts
live streams itself and closes the fifteenth before the handshake so a viewer
can never crowd out moving a chat; a door with no live handler behaves as one
from before this feature. A live link is not cut by the files watchdog, ends
with its registration so the door can always register again, and ends the
moment its device is removed, both when a removal is pushed and when a
periodic roster check finds it; a roster that cannot be reached past its
lifetime closes the link instead of extending it. The files path keeps
exactly the context it had, so a transfer under way when a registration
drops is still left to finish.

The viewer side dials the live class with its own prologue; moving a chat
dials the move class. The registrar's waits are spread with jitter.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: the caps and the clock a live view runs on

A new package for the door that lets one computer open another's running
chats. It starts with the two things everything else leans on: one file
that holds every limit (line, window, queue, rate, daily budget, live
count, ping, idle) so a number never lives in two places, and a Clock with
a fake whose timers fire in deadline order, so no test sleeps and an idle
link can be proved to schedule nothing.

Nothing imports the package yet.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: many chats over one tunnel, with credit and pacing

One Noise tunnel per viewer carries every chat it has open, so the
multiplexer is small and bounded: a frame is an op, a channel number and up
to 16 KiB of payload; each channel has a 256 KiB credit window and the whole
link 1 MiB, returned when the reader drains and never from a timer, so an
unread chat stalls only itself; a single writer takes channels in turn and
control frames first; one link is paced to 1 MiB/s on the injected clock.
A refusal and a reset carry a reason from a closed set, closing wakes every
blocked caller once, an unknown op is skipped so a later build can add one,
and an idle link writes nothing at all.

The transport seam is a Unix socket with the 103-byte path limit checked up
front, with a Windows build.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: the fake clock's order is proved by stepping, not by racing goroutines

The test recorded the firing order from three goroutines, which a loaded
scheduler under the race detector could run in any order, so it failed on
a correct clock. It now advances to each deadline in turn and reads the
timer channels directly, so an early firing shows up as a value on a
channel that should still be empty.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: find the process that is running a chat, and never start one

A viewer asks for a chat by its folder name. The resolver reads which chats
are running from the presence files (one directory read per two seconds, not
one per channel, and concurrent asks share it), requires the chat's
transcript to be held open by a live process (presence is only a hint), and
dials either the workspace's engine daemon, when its pid is the one the row
names, or the holder's own live socket from the registry. It has no way to
start anything: no spawn, no attach that boots. A stale row, a dead socket or
a holder that is going away all answer "nobody is running that chat". A
name that is not a plain folder name is refused before presence is read.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: a process that holds chats itself says so, and serves them without booting

The desk and other in-process holders have no daemon to dial, so they bind
a short socket under the home's live folder and write a small registry file
beside it (mode 0600, the socket named relative to the folder, no absolute
path persisted). Every accepted connection is served as a viewer of a chat
the process already holds; a chat it does not hold gets a plain sentence and
never a boot. Closing removes both files, closing twice is harmless, and the
next start sweeps the files of a holder that is gone, but never those of a
holder that merely answered slowly.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: a daily byte budget for what a viewer may pull through this computer

A phone left open on a chat is billed by the byte at the relay, so the host
counts what crosses every live tunnel it serves. The count is kept per UTC
day in a small file under the home (mode 0600, written lazily, never faster
than every thirty seconds), survives a restart, and rolls over at UTC
midnight. Past the limit every viewer is told why and becomes watch-only;
CODEAF_REMOTE_DAILY_MB overrides the limit. A budget nobody is using
schedules nothing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: one table of the open tunnels, so removal and permit edits reach them at once

Open live tunnels register under the viewer's device. Removing a device
closes all of its tunnels with the reason "removed"; a permit edit tells them
to re-read it; a third tunnel from one device closes the oldest. No lock is
held while a tunnel is told, so one slow tunnel cannot hold up the rest.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: read a chat's lines with a hard bound, and let a viewer say only what it may

The host reads every line a viewer sends and every line a holder answers
through a scanner that never allocates more than the line cap plus one byte,
so an endless line costs a reset rather than memory. A viewer's line is
forwarded only if it is a call whose method that viewer may use right now;
anything else is dropped, and a call it may not make gets the host's own
sentence back instead of silence.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: the host opens a viewer's chats from the process that is running them

One authenticated tunnel from a viewer becomes one channel per chat. For each
channel the host finds the process running that chat (never starting one),
rewrites the viewer's first line from what it knows about the viewer rather
than what the viewer claimed (which chat, join not start, watch or drive from
the permit, and a stamp naming the device), and then sends the holder nothing
more until the holder's welcome echoes that stamp. A holder from before this
feature ignores the stamp and would treat the viewer as an ordinary window
with the keyboard, so no echo means the viewer is told the other computer
needs a restart and never receives a byte. After that each direction runs
through a bounded scanner, the holder's output waits in a bounded queue so a
viewer that stops reading is reset instead of slowing anyone else, and a link
silent for the idle limit plus a minute is closed.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: the states a live view can be in, and the reasons it ends

A viewer's surface needs to say one true thing about a live view: connecting,
live, watch-only, reconnecting, the other computer went offline, idle,
removed, or past its daily budget. This names those states and gives every
refusal a reason that survives being wrapped, so a surface can read why a
view ended without parsing a sentence.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: one link to another computer that carries every chat open there

A viewer holds one tunnel per host, opens a channel per chat on demand, and
hands each surface a plain opener it can give its reconnecting client. While
nothing is on screen it costs nothing: with no running turn and nobody
touching the view it sends no pings, and after ten idle minutes it closes
with a single close and writes nothing else; any action reconnects. While a
turn runs or someone is typing it checks the link every three seconds and
says the other computer is gone after six. A dropped tunnel comes back at a
spread-out moment with doubling waits; "lagging" and "permit changed" come
straight back; an offline host is retried slowly; removal and a revoked watch
permit stop it for good. Every state change is reported once, outside the
link's lock.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: a removed device is told it was removed, not that it lagged

Closing a tunnel for revocation stopped each chat's output queue before it
told the viewer why, and the code that moves a holder's lines treated any
refusal from a stopped queue as the viewer being too slow. A device removed
while its chat was streaming could therefore be told "lagging" and retry
instead of learning it was removed. The reason is now sent first, and only a
queue that actually overflowed resets a viewer as lagging.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: tests that read their result when it has happened, not when the clock moved

Repeated runs failed one in four, and more under the race detector, because
the fake clock lets goroutines run only a few scheduler yields after it
fires a timer and the tests then read state at once. The assertions are
unchanged; each now waits, in bounded real time and without sleeping, for
the thing it checks to have happened. The healthy-viewer test now keeps its
producer a few lines ahead of the reader instead of racing it, and the
credit test counts frames at the transport before delivery, where the count
cannot lag the receiver.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: reach an engine host through the program's own inspect and dial

The live door starts from the sync package and the engine-host package
imports the sync package, so the live door cannot import the engine host.
The resolver now takes its two calls (who holds a workspace, and a way in)
from an injection seam that cmd/codeaf fills with the engine host's own
inspect and dial, so a held chat is found by exactly the rule that decides
which daemon holds a workspace. With no seam installed the resolver finds
nothing holding, which is the safe answer.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* syncsetup: serve the live door from the files door, and hand a viewer one link

When remote_control is on (or a live transfer is carried), the files-door
registration also serves the live door: the router stamps each connection,
and a removed or revoked device is cut off at once, with a pull backstop on
the permit file for a removal made by another process. The first full
roster read snapshots the devices already trusted as legacy, so turning
the setting on never silently widens or narrows who may look. Sync.LiveLink
gives the surface one link to a host with the state it reports.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* devices: a revoked device is told so and its permit is forgotten

After a successful revoke, from the command line or from the app, the
removal is announced to every live connection that device holds and its
permit is dropped from the host's permit book, so it cannot come back on
the same pairing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* perf: write the live door's limits into the performance laws

The live door's caps (line, chunk, queue, rate, daily budget, live count,
tunnels per device, ping and dead times, idle detach) are named in one
place in the code; PERF.md now lists them so changing one changes the doc
in the same commit.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* config: name the readers the remote control row and the live door's allowance have

The whole-package config laws were red for two things the remote control
work added and the focused runs never reached: the remote_control key was
not in the profile-key ledger or in the table of who reads each row, and
the live door's CODEAF_REMOTE_DAILY_MB variable was neither a row nor
registered operator plumbing. The row now names RemoteControlOn as its
reader, the key is in the ledger, and the variable is plumbing like its
neighbours, because it sizes a safety rail and is not a preference.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: hold it to the goroutine law and pin that the program wires its doors

internal/livedoor joins the trees the guard sweep reads, so a bare go
statement there fails the build. DaemonDoorsInstalled lets cmd/codeaf pin
that its entry point handed the resolver the engine host's inspect and
dial; without that call a chat held by a daemon is never found and nothing
else would say so.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: move the front-page line cap by the two lines the permit door adds

codeaf devices permit adds its form and one description line to the
usage table, which put `codeaf --help` two lines past the cap. The cap
moves by exactly those two lines, with the comment every earlier door
left, as the repository does for each door a person is meant to find;
unrelated help growth still fails.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: read the daily allowance variable through the environment door

The environment law requires an owned CODEAF_ variable to be read through
internal/env so its legacy spelling keeps working; the allowance override
used os.Getenv.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* appwire: name the calls and facts of a live view and of per-computer permits

chats.open_live and chats.live_keyboard, the chats.live feature, ChatRow.can_live
and Location.live; devices.permit, the devices.permit feature and Device.Permit.
Each feature is advertised only by an engine that says it is on, so a client that
never sees it never sends the call. PROTOCOL.md names every one; nothing is
added to turn.delta or turn.thinking and CONTRACT is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* tui3: a remote control switch on the Devices tab of Settings

The row is a registry row placed on the Devices tab (its presentation category
moves from General to Devices), drawn after the computers and the add row so the
cursor still starts on this computer. It appears once the computer list has
loaded and is absent when devices cannot work here. The model's settings listing
and the category law learn the Devices category. The one keys-line test that
assumed the add row was alone now expects two walkable rows.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* viewcache: forget one chat's last-seen copy on every computer

Moving a chat here does not know which computer the copy was last seen on, and a
copy of a chat that now runs on this computer is only a stale picture of it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: the real road for live views, per-computer permits on /devices, and the one-time question

syncLiveRoads gives the live door a road over one livedoor.Link per computer
(held state only on the draw path, touches coalesced off the update loop), the
agent pages older entries through its own connection, and remoteControlWanted
reads config.RemoteControlOn. The device list carries each other computer's
permit with remote control on, SetPermit writes the host's own book, and the
older pairings are asked about once from memory. Removing a computer, in the
terminal as in the app and the command, closes its live views and forgets its
permit and its last-seen copies; moving a chat here forgets its copy everywhere.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* wordlaw: classify the live road's name as the server's word

The road word a live view says (`live · relay`) is the server's, in the router's
default and in the files door's registration.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* e2e: the relay answers storage off the way the hosted service does, and the rig stamps its pairing

The audit proxy forwarded the stats reading to a self-hosted relay, which answered
that storage was on, so every computer tried an upload, was refused, and tried again
865 times in a minute. It now answers the reading itself, and counts only an upload
as a store write (a Has asks what the relay holds and writes nothing).

The rig also stamps the join in every home, as a real join does, so no Home in the
suite sits under the one-time question about older pairings.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* wordlaw: count the relay's word in the remote control page

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* e2e: finish one turn on the host before the scenarios that hold a slow one

A chat reaches the other computers' Home once its first turn is written down, so a
chat whose first turn is still running has no row to open. The two scenarios that
hold a turn at the model now hold the second turn of a chat.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* config: read the direct road's two operator variables through the environment door

CODEAF_REMOTE_ROAD=relay keeps every remote view on the relay on the computer
that sets it, and CODEAF_REMOTE_STUN replaces the public STUN servers a direct
connection asks for this computer's address (a comma list, or "off" for none).
RemoteRoadRelayOnly and RemoteSTUN read them through env.Get. STUN defaults to
Cloudflare then Google, and a turn: entry is never accepted. Both names go on
the registry's operator-plumbing list with their reasons; neither is a Settings
row, so there is no ledger line and no reader-table entry.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair: IntentDirect, and a record is one write

IntentDirect ('D') is the first byte a viewer writes on a peer-to-peer data
channel, so the files door's prologue map can select the direct road's own
prologue and a stream made for the relay never completes against it.

writeRecord now sends the two-byte length and the body in ONE write. The bytes
on the wire are unchanged, so builds that wrote two read this one and the other
way round; a message-oriented carrier now bills and sends one message per
record instead of two (TestARecordIsOneWrite).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* appwire: tell the engine of each agents call before it runs, and name a refused live open

An engine that keeps a connection open for an agent needs to know the person
touched it, so an optional door hears each agents.* call and the agent it names
before the call is run; it must not block. A refused chats.open_live carries a
typed detail with the closed reason, so a client can act on it without reading
the sentence.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: devices.permit sets what a paired computer may do in this computer's chats

The permit row appears on every computer but this one's own, only while remote
control is on, and devices.permit edits this computer's own permit book and
nothing else: only the switches named change, the relay is never asked, and
devices.changed follows. A computer the roster does not name, this computer
itself and a call that names no switch are refused with nothing written.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: the desktop opens a chat another computer is running as a live view

chats.open_live dials the holder's live door and serves the chat as an ordinary
app agent, so the chat page, its composer, asks, steer, queue and stop work
unchanged: a live send is agents.send and never chats.send, and needs no stored
copy anywhere. The agent carries Location.live (live, reconnecting, offline,
idle or watching, who has the keyboard, the road, the host's own words for a
view that may not type), its history is read over the live door with entry ids
counted from the first message, and the link closes when the last view on a
host goes. A quiet spell lets the connection go and the next call to the agent
reconnects. Its model, posture, budget and client tools are the other
computer's to set, so those doors refuse with that sentence. A window that was
viewing a chat this computer held, and saw another computer take it, now views
the new holder live. Everything is behind remote control, which is off by
default: with it off the desktop is told of none of this and the rows say
nothing.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* manual: the desktop pages say a live send needs no storage and a continued chat opens live

A chat another computer is running opens live from the desktop and takes
messages directly, so the pages that said the desktop offers no message box
while sync storage is off now say that is only the waiting message for a
computer that is off, and a new section says what a live view shows, when it
detaches, what watching means and who has the keyboard.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: a live view redials with resend, the line bound and a gap note

A message typed just before the link dropped was lost, because no caller set
ResendUnanswered. The live opener now asks for the policy the live door needs: resend
once, lines bounded to the live door's own limit, thirty minutes of trying for a
laptop that comes back from sleep, and a note when the host's replay lost events.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* filesdoor: admit a direct tunnel, and dial one

A second way into the live door. The viewer's peer-to-peer stream carries the
same Noise_IK as a relay tunnel, but opens with the direct intent byte and
completes a prologue of its own, so a record cut for the relay road can never
complete a direct handshake and the other way round.

The door gains AcceptStream, which runs the whole admission (intent, noise,
device hello, roster check) on a stream the caller already has, and the live
handler is told which road it came from. DialDirect is the viewer half, and
DialLive is rebuilt on the same helper so the relay path is the one it was.

A direct stream is not tied to the relay registration it was signalled over: it
survives that registration ending, and it ends with Serve. The door counts
direct streams on its own and refuses the fifteenth before any Noise work.
Removing a device closes its direct stream and refuses its next one.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: a signalling op, the direct road's limits, and its interfaces

OpSignal (11) carries the offer, answer and candidates of a direct attempt on
channel 0 of a relay tunnel that is already open, so the relay moves only
ciphertext and learns that a few records crossed. A build that does not know the
op still skips it, which is how an older build ignores signalling. A signal on
any other channel, one over SignalMax, or more than SignalRate in a minute ends
the link; the sender refuses all three before the receiver has to.

HelloAck gains Direct, which a host sets only when it can answer an offer, and
the limits gain the direct road's own numbers: 64 MiB/s pacing, a one-second
ping with a two-second dead line, and the host's cap of fourteen direct tunnels.

direct.go holds the Signal codec and the two interfaces a direct road is
implemented through, so this package imports no peer-to-peer library.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: serve a direct tunnel, and answer an offer

The router now knows the road a tunnel arrived on. A direct tunnel is served
with no daily budget and the direct pacing, because the budget exists for the
relay's cost; the registry caps tunnels per road, so a relay reconnect never
evicts a healthy direct tunnel and the reverse, and a spent budget resets relay
channels only. Revoking a device or editing its permit reaches both roads at
once, with the same reasons.

An offer on a relay tunnel is handed to the host's direct half with the
authenticated peer. Later candidates reach that attempt in order, a newer offer
replaces it, and the attempt closes with its tunnel. With no direct half, a
full host, or a direct tunnel, the host answers refuse before it has allocated
anything.

While a device holds a direct tunnel, its relay tunnel may be silent, because
that is the design; the host's silence backstop is excused for it, derived from
the registry and ending the next minute after the direct tunnel is gone.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* pair: the first computer a person pairs is a new pairing and types out of the box

A computer that offered its first pairing read its roster for the first time after the
other computer had joined, took that computer for an older pairing, and left it
watching and unable to type, with a question waiting on Home. The offering side now
records, as the joining side already did, that every computer it meets after it stops
being alone is a new one. A computer that already had a fleet is left as it was.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* e2e: freeze the whole host, wait for it to know its others, read serve's own code

pauseHost stopped only the engine, so a move (which goes through the window) was
answered anyway; it now stops every process of the host's home. A host that finishes
its first turn before it has read the roster keeps the chat, so the scenarios wait for
that. codeaf serve shows its code as two groups of three digits.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* syncsetup: serve the direct road when a program installs one

The door now takes a direct host half through a seam the program fills, the
same way the live door is handed its engine host, so the peer-to-peer library is
not imported by every package that links the door. When remote control is on,
the road is not pinned to the relay and the program installed an
implementation, the door builds one host half with the configured STUN servers,
hands it the door's acceptor, and serves every live tunnel through the
road-aware handler: a relay tunnel advertises the host half, a direct tunnel
does not.

In every other case nothing here builds a peer connection, so no STUN request
can be made, no direct road is advertised and a direct intent is refused before
Noise. The door's own bookkeeping now counts either live handler as remote
control being on, so the permit watcher still runs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* directroad: a WebRTC data channel as a plain byte stream

Two of a person's computers can open a peer-to-peer path and get back an
ordinary io.ReadWriteCloser. The viewer always offers and the host always
answers; one data channel is negotiated in advance (id 0, label codeaf-live,
ordered and reliable) and detached, so there is no in-band open handshake.
Offers, answers and candidates travel as livedoor signals over a relay tunnel
the caller already authenticated; nothing in this package knows about Noise or
the intent byte, which run above the stream.

Data-channel messages are not record aligned, so the stream adapter serves a
continuous byte stream from them, never a short-buffer error, and cuts writes
into messages of at most 16 KiB. ICE servers are STUN only: TURN is never
configured, an empty list sends no STUN packet at all, mDNS and ICE-TCP are off,
container and VM bridges are dropped, and the library's logger writes nowhere
because a terminal surface owns the screen. The certificate fingerprint check is
left on, and a test fails the build if it is ever disabled.

The host answers on its own guarded goroutine, keeps one pending attempt per
device (a new offer supersedes the old one), caps attempts host-wide, lets one go
after its time to live, and closes every attempt and stream when its owner's
context ends. Everything runs on keyless in-memory networks; the package is on
the goroutine guard's sweep. Adds the pion modules.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* livedoor: refuse an offer from a peer whose watching was taken away

The permit watcher runs on a timer, so for a moment after an edit a tunnel can
still be open for a device the host no longer lets watch. A direct attempt is
real work (a peer connection, candidate gathering), so the router now reads the
permit again when an offer arrives and answers refuse before the host's direct
half is asked anything.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* cmd: install the direct road, and pay for it in the size budget

The program hands the sync package its direct road at start, the one place that
wants the peer-to-peer library, and a test pins that it did: without the call
no computer would ever offer or answer a direct connection and nothing else
would notice. Remote control off, or CODEAF_REMOTE_ROAD=relay, leaves it
installed and unused.

The binary grows by the pion stack, so the notices are regenerated and SIZE-BUDGET
moves by a provisional 4,700,000 bytes, with PERF.md saying so, naming the CGO-off
build and the idle cost (bytes, never time), and listing the direct road's
limits beside the live door's.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* e2e: open a viewer only once the host's ch…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant