Skip to content

feat(bridge): the local bridge, and long jobs that outlive the tab - #319

Open
ivanmkc wants to merge 2 commits into
lifeboard/07-calendar-mailfrom
lifeboard/08-bridge-jobs
Open

feat(bridge): the local bridge, and long jobs that outlive the tab#319
ivanmkc wants to merge 2 commits into
lifeboard/07-calendar-mailfrom
lifeboard/08-bridge-jobs

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Sep 2, 2026

Copy link
Copy Markdown
Owner

The stack

# PR What it adds Tests at this point
1 #311 A real localStorage for the test suite on Node 25 viewer 747
2 #312 @ivanmkc/termchart-canvas; injectable interact transport canvas 473 · viewer 278
3 #313 lifeboard PWA: fact log, boards, service worker lifeboard 36
4 #314 Shell, family profiles, tap layer lifeboard 82
5 #315 The agent turn, four providers, Connections lifeboard 142
6 #316 Packs, recipes, shopping-list arithmetic lifeboard 231
7 #317 Provenance and lineage lifeboard 257
8 #318 Calendar, Gmail, mail triage lifeboard 301
9 #319 The bridge and long jobs cli 314 · lifeboard 320
10 #310 Proactivity, scheduled boards, Google sign-in cli 320 · lifeboard 343
11 #320 Persistence audit fixes: multi-tab, stale builds, no-storage boot lifeboard 350
12 #321 User guide, bridge setup, QA guide, persistence audit lifeboard 350
13 #322 A plan for third-party integrations (docs only) unchanged
14 #323 A practice drill a board can define: audio + Q&A canvas 485 · lifeboard 372
15 #325 Export and restore lifeboard 389
16 #326 Draft a message, approve it, then send lifeboard 399
17 #327 Hand long work to the Mac lifeboard 406
18 #328 A Packs screen, and authoring one by describing it lifeboard 418
19 #329 Activity — what changed, who changed it, undo lifeboard 428
20 #330 Four defects found reviewing the stack cli 323 · lifeboard 431

Every branch in the stack was checked out on its own and verified independently: npm install, tsc --noEmit for every package, npm test across the workspace, and the offline e2e where it exists. All twenty are green — no branch depends on a later one to build or pass. Full viewer e2e (11 suites, 106 assertions) was run on #312 as the behaviour-preservation evidence for the extraction.


Stack position: 9 of 10. Base: lifeboard/07-calendar-mail.

The optional local process, and with it the AI subscriptions the family already pays for — plus long jobs that outlive the tab.

Security comes first because a process that can run someone's authenticated AI agents is worth breaking into. Loopback bind, not 0.0.0.0 — a bridge on café wifi is a remote shell with extra steps. A per-run token, printed once, compared in constant time. Origin validation on everything that changes state, because any page you visit can POST to 127.0.0.1; a token alone is not enough, since a page in the family's browser could have been given one. CORS is echoed only for origins already trusted, never *.

Driver detection is a version probe rather than a PATH lookup. A binary that cannot run is not an installed agent, and "installed but signed out" is the most common state and the one worth naming — the fix is a command the person can run rather than an error they have to interpret. Prompts go on stdin, never in argv.

Jobs are owned entirely by the bridge. No client-side runner, no checkpointing in the browser, no resume logic on the iPad: an iPad that sleeps must not be able to lose someone's research, and the only way to guarantee that is for it never to have been responsible. The step budget is not a nicety — an agent asked to research trips can loop, and every loop spends someone's subscription. The client mirrors, renders a card from the moment a job is queued so the screen is never blank, and falls back from the event stream to polling: a difference in latency, never in correctness.

Discovery is opt-in. Probing a port nothing is listening on logs a console error in every browser and costs a request on every start, so the automatic probe happens only for someone who has used a bridge before. The offline e2e now also asserts that nothing but that probe ever leaves the app's own origin.

Also here: a test-stability commit. Three tests waited on a 20 ms sleep and failed intermittently once the suite grew large enough to contend for CPU. Store.settled() resolves once every queued write has landed, and the tests wait on the condition instead.

Verified: CLI 314 tests (33 new, covering origin rejection, signed-out drivers, the step budget and cancellation), lifeboard 320, offline e2e 17/17.

🤖 Generated with Claude Code

ivanmkc and others added 2 commits September 2, 2026 07:50
…the tab

Security comes first because a process that can run someone's authenticated AI
agents is worth breaking into. Loopback bind, not 0.0.0.0 -- a bridge on café
wifi is a remote shell with extra steps. A per-run token, printed once, compared
in constant time. Origin validation on everything that changes state, because
any page you visit can POST to 127.0.0.1; a token alone is not enough, since a
page in the family's browser could have been given one. CORS is echoed only for
origins already trusted, never "*".

Driver detection is a version probe rather than a PATH lookup: a binary that
cannot run is not an installed agent, and "installed but signed out" is the most
common state and the one worth naming, because the fix is a command rather than
an error to interpret. Prompts go on stdin, never in argv.

Jobs are owned entirely by the bridge. No client-side runner, no checkpointing
in the browser, no resume logic on the iPad -- an iPad that sleeps must not be
able to lose someone's research, and the only way to guarantee that is for it
never to have been responsible. The step budget is not a nicety: an agent asked
to research trips can loop, and every loop spends someone's subscription. The
client mirrors, renders a card from the moment a job is queued so the screen is
never blank, and falls back from the event stream to polling -- a difference in
latency, never in correctness.

Discovery is opt-in. Probing a port nothing is listening on logs a console error
in every browser and costs a request on every start, so the automatic probe
happens only for someone who has used a bridge before; everyone else asks once
from Connections. The offline e2e now asserts that nothing but that probe ever
leaves the app's own origin.

A message the bridge sends goes through the same approval shape as Gmail's send,
and the iMessage path puts the body on stdin -- an apostrophe in "don't forget"
would otherwise end the AppleScript string, and worse is possible.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three tests waited on a 20ms sleep and failed intermittently once the suite grew
large enough to contend for CPU. A flaky test is a defect in the suite: it
teaches people to re-run rather than to read.

Adds Store.settled(), which resolves once every queued write has landed, and
switches the affected tests to waiting on the actual condition. The seam is
worth having beyond the tests -- the app can await it before closing, so a tick
made on the way out is not lost.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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