feat(host,panel): the automations list and an automation's runs are pushed to the pages that draw them
Merged
CH
9d ago+904+904+012345678901234567890123456789-155-155-012345678901234567890123456789
Part of the automations' move onto the central live layer (with Realtime off, LUKE_REALTIME unset). It stacks on #3289, which adds the service's live reads live.automations and live.automationRuns.
What changes
The Automations pages stop reading their list and runs every minute. Instead, the host follows what a page draws and pushes it.
- Host follow (
packages/host/src/automation-follow.ts)- Follows a workspace's automations, or one automation's runs, through
liveRows: held polls while Realtime is off, a subscription when it's on. - Each read names the account that was signed in when the follow started.
- Builds the list or history from the rows. Builds it again at the one moment the clock alone moves a run's agent (a grace ending, via
statusClockEdge). - Signed out: the follow ends quietly. Not found: it says so and ends. Any other failure: says unanswered and retries after 5 s.
- Follows a workspace's automations, or one automation's runs, through
- Composer and gateway
automations.followandautomations.unfollowgateway methods, plus anautomations.changedevent, as the transcript follow has.- Following again starts over, so a second window gets the current list at once.
- A sign-out (
closeCapabilities) resets every follow.
- Act port
automations.followis aneventIteratorprocedure, the same pattern ascodingAgents.transcript(#4175).- It's built on
main's sharedfollowedStream: two pages on one list share one host follow, a later stream gets the last change straight away, and the last stream to close lets the follow go.
- Panel
useAutomationsanduseAutomationRunshold the stream open while their page stands (use-followed-automations.ts). Retry reopens it.- Removed:
useMinute, the generation counter, the re-read after every write, and the re-read after Run now. - A write's answer still lands in place at once, until the next push replaces it.
Not included
- No txid waits and no web-tab bridge. A web tab gets the same act-port stream.
- The one-shot
automations.listandautomations.runsacts stay. The workspace settings page still counts automations with one read.
Checks
- Typecheck is clean for host, features, panel and service.
- Tests: the full host suite (524), the service suites (89), and the panel suites that use automations (477), including (new composer and act-port stream tests).
- The page tests answer the follow with a stream that takes pushes.
- The fake act port answers a follow from a suite's list or runs stub when the suite doesn't stub the follow itself.
- oxlint, repository checks and knip pass (knip shows only the findings already on
main).