0
Fork 0
mirror of https://github.com/zeronsh/comet.git synced 2026-11-16 18:57:19 +00:00

Compare commits

...

118 commits

Author SHA1 Message Date
Wing
8f362f494d zgx: chat switches repaint what changed; shortcuts act before later input (b7a0154a0)
zgx#zeron/a11-switch, on the menu-shortcut commit zeron/fast-open-2 held
back (c0140541d: a shortcut's frame drawn at once, the GPU woken; A8 typing
lag on a quiet M5 Max, 3 runs each: p50 17.2 ms perf, 17.5 ms with it):
- a large subtree taken out (a chat's transcript as another opens)
  damages its ink, not the whole window: the sidebar and title bar stay;
- a shortcut (⌘N), through the native menu or the window's own keymap,
  is carried out before input queued behind its key: a key typed 1 ms
  after ⌘N reached the old chat's composer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:36:46 -07:00
Wing
e737faf46a Warm start: the agent waits in the background until its run takes it
A new chat's agent, started from its first key (start-early), did its
startup at normal priority while the person was still typing: a Node/Bun
CLI's burst of several threads beside the window being typed into, on a
Mac with few cores (an M1) the same cores. It's speculative work, so it now
starts in macOS's background state (CPU, disk and network priority lowered,
the efficiency cores), and so does all it starts meanwhile. Its run taking
it (Enter) puts it back to normal at once, before its first message, and
what it started just after. Nothing changes off macOS (Linux lets no
process raise a priority again).

Checked live in the rig: the parked Claude CLI ran at priority 4 while the
draft was typed and at 31 once sent, the same process answering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:36:43 -07:00
Wing
7384f84166 ⌘N gives the new chat's composer the keys in its own handling
The composer took the keys on arriving at a chat a tick later (ui.after),
so a key typed straight after ⌘N reached whatever had them before. ⌘N's
command now bumps the composer's focus as it opens the new chat: one
composer, its draft already the new chat's, so that key is the new
chat's. The other half of the same bug is zgx's: a native menu item now
acts before the input that came after it.

Test: after ⌘N's handling alone, the composer has the keys and the new
chat's empty draft; typed into, it's the new chat's, and the chat left
keeps its draft, with and without the keys before. (The test runner runs
a tick's timers as it settles, so the tick this saves is proven in the
app, by the rig that posts ⌘N and a key 1 ms apart.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 19:36:43 -07:00
Wing
09118a331a Opening a session: the chat opens in the same step as the route moves
The route moved first, and the chat page's store opened the chat a step
later, from the page's effect: everything that follows both (the
composer, its chips, the page) ran once for the route, seeing the old
chat with the new route, and again as the chat followed. route.open_session
now tells the store (route.opening) inside one batch with the move, so
they change together and each runs once. The page still opens what its
route says, so a route reached another way (Back, a link) opens its chat
a step later, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 18:55:45 -07:00
Wing
7aaa7064db Chat page: the transcript stays across switches, only its rows are each chat's
Switching chats made the session page's transcript anew (keyed by the
chat shown): its scrollbar, way back to the latest, selection bar,
lightbox host, its states and effects, every switch. The transcript now
stays, one for the page, and only its list of rows is made for each chat
shown (Transcript's `session`); what was the last chat's own (where it
opens, runway, a glide under way, hover, the selection's bar, the reading
place and row sizes) starts again for the next, as a transcript made for
it would. A send's glide still under way as another chat opens sends its
prompt and leaves the next chat's view alone. The scrollbar, staying,
is told each chat's rows place themselves (Rail's `settle`), so a switch
isn't taken for a scroll (it lit and faded over ~60 frames after each).

One page, nothing kept per chat: memory is what it was.

Tests (ui/tests/chat_switch.test.luau): the scrollbar stays one node and
the list is each chat's; three chats' places and ways back hold over six
rounds of switching; drafts, models and sends stay each chat's, back and
forth; a chat left mid-glide; a switch doesn't show the scrollbar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 18:55:45 -07:00
Wing
d9213d8599 Chat switch: an entry's sum and size are worked out once, not on every switch
Opening a chat kept here again tells the engine what it holds by each
entry's sum, and letting one go weighs what it holds: both went over the
whole json of every entry still holding it, on every switch. A long
reply's json is hundreds of kilobytes (ademark's A11 thread: one entry of
2,000 parts, ~450 KB), so each switch hashed it byte by byte or wrote it
out again (~0.7 ms of a switch's main thread on an M5 Max, sampled). Each
entry now keeps its sum and size until its json changes (json_mut: words
appended, a part patched), and settling takes the sum it kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 17:14:39 -07:00
Wing
f558b51af3 Agents die with their engine, whatever way it dies
A SIGKILLed or crashed engine runs no teardown, and its agent CLIs kept
running, adopted by init (the bench found five `claude --print` still
running eight minutes after killing the engine).

- Linux: agents get PR_SET_PDEATHSIG(SIGTERM), forked from one
  process-lifetime thread (the signal follows the forking thread, and a
  retired blocking-pool thread would take its agents with it). SIGTERM,
  not SIGKILL: Claude Code saves an in-flight login refresh on SIGTERM.
- Windows: unchanged; each agent already lives in a kill-on-close job.
- macOS, and the Unix backstop: the engine records each agent (pid, start
  time, image, program, group, cwd, Claude config dir) in
  <data dir>/agent-processes/<pid>-<start>.json, written atomically and
  pruned as agents exit. The next engine on that data dir ends what a dead
  engine left: only a process with the same pid and start time, still
  running what was launched, whose engine is gone; its whole tree and
  groups, SIGTERM then SIGKILL; never while its Claude login refresh lock
  is held (waited out first).

Every agent spawn (runs, probes, ACP/Codex/Cursor/OpenCode/Pi/Muse, login
children) goes through process::spawn_agent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:20:26 -07:00
Wing
20dadc8101 Engine: freed memory goes back to the system as it's freed
mimalloc hands freed pages back purge_delay (10 ms) after they're freed,
but only the next time that thread allocates or collects. An engine at
rest seldom does since its timers sleep: after agents streamed, what they
freed stayed counted against it until some later work. purge_delay 0
hands it back as it's freed.

Five replay streams on ademark's arena, the engine sampled each second:
peak 52 -> 43 MB, 4 min after 42 -> 33 MB, CPU while streaming 2.04% ->
2.08% (the same).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:19:06 -07:00
Wing
3287f1b328 Warm start: only from the first key typed in a new chat, not its opening
Opening a new chat (⌘N, New chat, the sidebar's +, the palette) started
its agent at once, held ~100 MB for the minute's lease, though most new
chats are opened and left, or opened well before anything is written.
Typing a message takes longer than the agent's start, so starting it at
the first key still has it ready by Enter. The open trigger (`intend`
and its callers) is gone; the rest (stops on clear, leaving, another
chat's draft, quit; the signed-out gate) is unchanged. Zeron v2's copy of
the shell follows, re-recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 02:09:03 -07:00
Wing
9e44ed8f5a Warm start: none for an agent known to be signed out
Opening a new chat with no agent logged in started the chosen agent's CLI
anyway (Claude Code parked ~100 MB for the 60 s lease, on every new chat),
for a runtime that could only wait for a sign-in; found on Windows with an
empty profile.

WarmStart now does nothing when the agents' last listing has no live
login for that agent and the engine's environment holds none of the
variables its CLI signs in with (ANTHROPIC_API_KEY and kin, OPENAI_API_KEY
/ CODEX_API_KEY). Unknown stays allowed: agents never listed yet, and the
ones whose logins aren't tracked here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:34:00 -07:00
Wing
186e71fc96 Plugins: signed out with a directory, no rescan every 30 s either
A production engine signed out still has a key directory (attach_auth
sets the edge it would sign in against), so the previous change didn't
park it: with no account, check_keys found nothing to do, and the loop
rescanned and hashed every plugin folder each half minute anyway (about
35 ms of CPU each time: the engine's largest cost at rest after the git
polling). The loop now waits while there is no directory or no account;
setting either, and every sign-in change, wakes it.

Test: a signed-out engine (directory, no account) scans no plugin
folder over two and a half minutes once settled (12 scans before).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
7c8fa5edca Changes pane: the repair tick runs Git only for checkouts not watched whole
Every 120 s the diff sync re-captured each open chat's checkout (seven
git processes: rev-parse, branch, two diffs, the patch, status) to find
the same diff. A checkout watched whole and live (its root within the
watch budget, and its git dir) has told of every change already, and a
lost event comes as the hub's rescan; the tick now leaves it to them.
One too large to watch live, or whose watch isn't installed, is still
captured each tick, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
b696f5356a Corners' times: the clock moves as a label would change, not every 30 s
ds/status's clock ("now", "5m", "3h" in every row's corner, card and
lane) moved every 30 s, waking the window and re-running every reader to
find the same labels most of the time. Each age read now says when its
label next steps (a minute while minutes, an hour while hours, a day, a
week), and the clock moves at the soonest of those, on the same
half-minute grid (labels due together move together, never later than
the old tick moved them). Corners an hour old wake the window once an
hour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
bd579e57d7 rustfmt the idle beat and peer link lines
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
fdb2b03e13 New project: a page's loading rows stop breathing when they go
Each loading row of the palette's pages (five per page: a device's
places, a folder's folders) started a breathing loop on a state, which
is the script's, not the row's: the loop outlived the row, the page and
the palette. Adding a project as ademark does left nine to fifteen of
them, each wanting every frame of the display, so an idle window in
front kept its display link running and woke ~120 times a second
(0.7% of a core on an M5 Max, 1.3% on Wing's M1) until it quit. They go
with the row now (its cleanup cancels the loop, or the wait before it).

Test: the shell fixture's engine can be slow to list folders; the
palette's pages load, close, and nothing asks for frames.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
357cf2813e Engine: install changes and system wakes, heard, not looked for each minute
- The uninstall check looked for the app every 30 s. File-system events
  on the installation (its folder and the one holding it) now say when
  it moves, goes or is replaced; it looks every 30 s only once the app
  is gone and work still runs, or if the folders can't be watched.
- The updater woke every 60 s to re-read the wall clock (a monotonic
  sleep stops while the machine sleeps) and, as the background engine's
  service, to see whether a newer version was installed. The engine now
  hands it the system's wake events (follow_wakes) and pokes it as the
  installation changes (follow_installs): it sleeps until the next
  check is due. While a newer installed version waits for quiet it
  still looks each minute, and without either source it looks each
  minute as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
9237a03900 Terminals and search indexes: reapers sleep while there is nothing to reap
- The terminal reaper swept exited sessions every 60 s even with no
  terminal ever opened. With none, it sleeps until one opens.
- The workspace search reaper (a thread, started by the first search,
  e.g. the New project picker's Home search) slept 60 s at a time
  forever. With no index held, it parks until one is used again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:42 -07:00
Wing
025bec869c Doc host: a local profile's connectivity and transcript recovery sleep
- Connectivity: the monitor looked every 5 s (every second for the first
  few) from engine start. A local profile's posture is the default for
  good, so once its workspace (no edge either) is wired it no longer
  looks. Signed in, its settled look is on the beat grid, with the
  sockets' pings, rather than between them.
- Transcript recovery: the salvage loop queried for owed recovery jobs
  every 30 s forever. With none owed it now waits for one to be
  scheduled (watch_sync_jobs); one owed is still tried 30 s apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
a094115f71 Plugins: signed out, no key checks or rescans every 30 s
With no key directory (no edge), the signing-key loop found nothing to
ask, then rescanned and hashed every plugin folder, every 30 s. It now
waits for a directory to be set; the folders are watched for changes
already.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
c19d45922b Presence: no beat for a local profile
Signed out (no edge), the workspace task still woke every 15 s to send a
heartbeat to no room and republish a device list that can't go stale.
With no edge it no longer arms that beat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
0ae3e2426c Plugin services: a service's looker sleeps until something is due
Each plugin with a service (the built-in Git plugin has one) had a looker
waking every 5 s for as long as the plugin was on, even with its VM
stopped and no timers. It now sleeps until its next timer, or until its
running VM would be idle long enough to stop (a busy one is looked at
each tick, as before), and with neither until a VM starts or the slot
goes (Slot::wake).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
a881538ca5 Session activity: the 5 s check runs only while a terminal holds a lease
The projection looked every 5 s, from engine start, for terminal leases
to refresh. Only an active terminal report's lease moves with the clock;
everything else in it changes by the watches it already selects on. With
no such lease it now sleeps until one of them changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
18fc4b0868 Checkout badges: Git runs when a checkout's Git files change, not every 15 s
Each watched checkout (every sidebar row's, the GitHub plugin's) was
inspected every 15 s: eight `git` processes (rev-parse, branch, upstream,
config twice, remote, get-url, symbolic-ref) per working directory. Five
chats in their own worktrees, left alone, spawned about 2.6 git processes
a second, which cost ~2.4% of a core in the children alone and most of
the engine's 4.5 wakeups a second at rest (M5 Max, A6 state).

A subscription now watches its checkout's git dir, common dir and refs
(FsWatchHub) and inspects again only when those files say Git's answer
could have changed: HEAD, the configs (local, worktree, global, system),
packed-refs and the remote-tracking refs (a fingerprint of stats, read
before Git runs). An index write, `git status` or a commit runs nothing.
A burst of events is one look, 250 ms after it. A checkout whose
folders can't be watched is inspected every 15 s, as before.

The provider (GitHub) is still asked on its own TTLs; a remote GitHub
can't be asked about (none, another host) is no longer retried on a
backoff timer: only a change to the checkout's Git files asks again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
7654168e6f idle_rig: forwarded calls, reachability and peer watches
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
ebb7dd048d Keep running: the quit-when-idle watcher sleeps until the app quits
It checked once a second, from engine start, whether the app had asked
it to stop when idle: about two wakeups a second (the timer and a worker)
on every engine, nearly all of them finding it hadn't. It now waits on
the request itself and checks each second only once armed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
413382fc79 Peer links close after 5 minutes unused, and dial again on demand
A link to another device (opened by a forwarded call or stream) stayed
open until the network or the process went: a 10 s socket ping and a
10 s end-to-end echo on both devices, for good, per peer ever reached.

The link cache now closes a link with no call awaiting a reply, no open
stream and no RPC frame either way for 5 minutes (checked each minute,
and not at all while no link is open). An open stream (the app following
a device's updates) keeps its link. The next call dials again: one
connect and the readiness round trip, the same as any first call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
98924b8234 Presence: relay probes back off for devices that have been gone a while
Every 30 s the engine asked the edge about every device whose heartbeat
was stale, forever: one HTTPS request per offline device per 30 s. An
account collects devices (Wing's has ~17, many of them Cloud machines
asleep for weeks), so most of that was asking about devices that had
been gone for days.

A device is now asked every 30 s for its first 10 minutes of quiet (the
starved-heartbeat case the probe exists for; one the probe finds alive
stays at 30 s), every 2 min up to an hour, every 5 min up to a day, and
every 10 min after. Its coming back is heard from its own heartbeat and
boot stamp, which reset this. Deleted devices (retired Cloud machines)
were already never asked: they aren't listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
39277756e5 Engine: periodic beats share one wall-clock grid, so they wake it together
Each socket kept its own ping timer, started whenever it connected: the
registry and chat sockets (15 s), the device room's host socket and every
peer link (10 s, plus each link's 10 s echo), preview signaling (10 s),
the presence beat (15 s), session activity (5 s), and the relay probe,
reaper, repair and uninstall checks (30–120 s). Every one woke the engine
at its own instant.

`zeron_sync::wake::beat_interval` ticks on whole multiples of its period
of wall-clock time, so all of these now land on the same instants: with
the 5 s activity check on the grid, the engine wakes at most every 5 s for
all of them (a 10 s and a 15 s beat meet every 30 s). No interval or
lease changes, so nothing the edge expects changes: device-room hosts
still ping inside HOST_LIVENESS_MS (75 s), preview sockets inside the
coordinator's 45 s, presence every 15 s. A socket's first ping now comes
at the next beat (within one period) instead of a full period after it
connected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:02:41 -07:00
Wing
38042ae02a Engine connection: no byte-order mark at the top of src/engine/mod.rs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:28:08 -07:00
Wing
3002bd2b05 Merge zeron/windows-start: the engine starts with the window, the interface is laid down in parallel (#1459)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 00:28:02 -07:00
Wing
32d49a147b Windows start: the engine up with the window, the interface laid down in parallel
On Windows a launch with no engine running (after a restart, or an update)
dialled the engine's port before starting it, and Windows says a loopback
port nobody listens on is refused only after 2 s of retries. The engine
started once that refusal came, and the connection followed ~3 s after
launch. Now:

- The engine is started as the launch begins when none holds its data dir
  (`engine::start_ahead`), and the supervisor starts one before dialling
  when none does. Its process is made on a thread of its own: Defender scans
  a new version's 209 MB executable as it's mapped, and the first frame no
  longer waits for that. One spawner serves both, so never two engines.
- A loopback dial gives up after 250 ms (an engine that listens connects in
  a millisecond or two); a dial that times out reads as refused.
- The plugin preload dials only an engine that was already running.

The first launch of a version laid `.zeron` and `.live` down one file at a
time, ~2,500 new files on the window's path, each scanned by Defender as it
was written: 6 s before the first frame. Now:

- `mirror` reads and writes on up to 8 threads, and `.zeron`'s hashes come
  from the bytes its copy read (`ui/` read once).
- `ui/`'s and `.live`'s stamps take each file's size and time from its
  folder listing: on Windows, asking each file opened and closed it, about
  120 ms of every launch.
- Windows' installed `ui/` (`beta\<version>\ui`) isn't watched, as a macOS
  bundle's isn't: an update installs the next version beside it.

zgx pinned to 5a6a43963 (zgx#2223): 69ce8e184 didn't build on Windows or
Linux (`acted_since` was macOS's alone).

First frame on screen, ms from process start, RTX 4090 / i7-12700KF, three runs:
- first launch (fresh install): 6140-9233 -> 2694-2793
- after an update: 830-849 -> 428-575
- warm, no engine running: 508-527 -> 353-367
Engine connected: 3034-3082 -> 353-367 (warm), 3822-4401 -> 745-1169 (update).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:20:29 -08:00
Wing
db0fe4a3c5 Composer: start a new chat's agent as the person opens it or types
A new chat the person opens (⌘N, New chat, the palette's, a sidebar "+")
asks this device's engine for a warm start once its page's first frames
are out, and the first key in a new chat's draft does too; the send creates
the chat with that id, so its first message goes into the agent already up.
Never an existing chat, a launch, a window put back, a draft restored with
its page, a chat on another device or Cloud, or a worktree made as it's
sent. The warm request is the send's own (`run_request`).

It stops when the person leaves the new chat with its draft empty, keeps
it empty for 10 s, writes in another chat (one per window), closes the
window or quits, or when a send's chat isn't made; the engine's leases do
the rest. A change of agent, model, effort, folder or access starts
another. Typing renews it at most every 10 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:52:46 -07:00
Wing
7661575d4c Engine: start a new chat's agent while its first message is written
`WarmStart {chatId, request, typed}` starts the runtime a new chat's first
run would start, parked with no prompt, under the id the chat will be
created with: nothing of the chat is made (no row, doc, title or
transcript). Only for a new chat: an id the workspace knows, one with a
run, a worktree made as it's sent, or a chat on another device (a warm
start there would outlive this app's quit) starts nothing. It gets the
run's own MCP token (for that chat alone, dead when it stops), the
plugins' servers and the host's credentials, and holds its CLI's
execution lease, as a run does.

The chat's first run takes it (`drive_run`), waiting for one still
launching; nothing else ever does. It is not used, and ended, when the run
is another agent's, launched otherwise, on another credential or CLI
binary, with native subagents switched, or behind a CLI update. A run that
never launches ends it.

It lives on a lease: 60 s after the open with nothing typed, then the idle
stop (2 min) after each keystroke the app reports. `WarmStop`, the app
quitting and the engine shutting down end it sooner. It is no run, so the
idle reaper never sees it, and never work in progress. At most 4 per
engine. `ZERON_WARM_START=0` turns it off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:52:46 -07:00
Wing
4941b7b90b Harness: warm starts, an agent launched before its chat's first message
`Harness::prewarm(key, request)` launches the runtime a run of `request`
would launch and parks it under `key`, asking no model anything;
`run_warm(key, …)` runs in it when it launched identically, else ends it
and starts afresh as `run` would; `discard_warm(key)` ends it and returns
once it has. Drivers opt in with `prewarms`. Nothing else ever ends a warm
runtime: its owner (the engine) does.

Claude: the CLI is launched and sent `initialize`, then waits on stdin for
its first user line. Its arguments, folder, environment and MCP servers
(the run's own token among them) must match, and its release too (a CLI
that updated itself since is another runtime). It is retired as the
discovery probe is: never mid login refresh (`refresh_lock::settle` before
its stdin closes and it is signalled). Codex: the app-server is launched
and answers `initialize` (bounded: 30 s) before the first message; the
thread still starts with it, so only the binary, folder and environment
must match. ACP agents: the process is launched; the handshake and any
sign-in stay the run's.

Tests: the message reaches the warm process as typed, with its images and
mentions, and a steer after it; each launch setting changed (model,
effort, context, Fast, access, plan, folder, MCP, environment), a replaced
CLI or a dead process starts afresh; a discard waits out a refresh lock;
a warm process ends with its engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 23:52:46 -07:00
Wing
445f70a00d Home search: no privacy prompt for opening New project
Opening New project warmed a walk of the whole home folder, and on a Mac
that asked for access to Desktop, Documents, Downloads, Photos and Music at
once (5 prompts in ademark's warm-up), before anyone had searched for
anything.

- ~/Pictures, ~/Music and ~/Movies (media libraries, never projects) are
  never walked.
- Desktop, Documents and Downloads are read only by a walk someone's search
  asks for: the picker opening (an empty query) and a chat in home warming
  read the rest of home; the first real query starts a walk with them,
  waits for it as a search does, and answers as still indexing until it
  has them. A refresh keeps what the index read.
- Other platforms walk as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 22:19:04 -07:00
Wing
1d82a5c164 Home search bench: macOS only (it reads the footprint with proc_pid_rusage)
Linux CI couldn't compile the engine's tests with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 19:33:11 -07:00
Wing
5706db07ce Merge zeron/fast-open: threads open and switch with less work
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 19:11:21 -07:00
Wing
be456757df Tests: a folded row opens to the row built whole while compact shows
A folded row opens laid out compact either way (it can't be built again
as compact turns on); one built whole has it only while compact shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:31:50 -07:00
Wing
96d66d3019 Panel (Zeron v2's layout): a shut panel makes no home either
The single-page layout keeps its own copy of the panel; the same change
as the default's, recorded (ZERON_V2_BLESS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:31:50 -07:00
Wing
ad0b92fa16 Long replies: their blocks stay the host's; the transcript asks for a run as it builds it
A script is handed a table for every value of a row it reads, so opening
ademark's 1,000-step reply converted its 2,000 blocks and 1,000 tools
(about 3 ms of an M5 Max's long-thread open, more than all it builds),
though the transcript only builds its end (windowed runs). A long settled
reply's row built for a view now says its runs instead (each its first
block's id, count, height guess and a sum of what it holds, cut by the
same rule ds/transcript cuts them), and its blocks and tools stay in
src/chat.rs (Built.aside); the transcript asks for a run's blocks as it
builds that run (chat.reply_run), a find for all of them
(chat.reply_blocks), and a find's current match for the run that holds it
(chat.reply_run_of). A reply being written, a short one, or a folded row
keeps its blocks in its row as before; one settling moves between the two.

long_thread_tests, 1,000 steps opened: values handed the scripts 19,108 ->
1,886 (100 steps: 4,587 -> 3,350). Rig (M5 Max, zgx inspect frames), long
thread opened: script 63.9M -> 34.2M instructions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:19:26 -07:00
Wing
7eae72a025 Chat rows: a reply is laid out compact only while that shows
Every settled reply's row carried its compact layout too (Settings'
compact transcript, off by default): for a long reply, its whole work
again, built in Rust and handed to the scripts each time the chat opened
(ademark's 1,000-step reply: a second copy of its 2,000 blocks and 1,000
tools). Now only while compact shows; turning it on builds the rows kept
whole again (open chats and kept ones). A folded row opening (scrolled
to) is laid out compact too either way, as it can't be built again.

Long thread opened (long_thread_tests' 1,000 steps): values converted for
the scripts 22,117 -> 19,108.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 18:11:10 -07:00
Wing
1a57c001fa Panel: a shut panel makes no home for each chat switched to
Every chat switch (and ⌘N) made the right panel's home for the new chat
while the panel was shut: about 1.8 ms of script, 4.5M instructions of
update, of a short switch's ~5 ms (rig profile, zgx inspect frames). The
home is now made only while the panel shows; a tab still stays made shut,
as before. Short switch: script 22.6M -> 15.5M instructions, update
11.1M -> 6.6M; long thread open 73.9M -> 66.8M, 25.1M -> 20.4M.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:48:27 -07:00
Wing
5bd822456a zgx: pin 69ce8e184 (a lone wake gives its GPU queue back at its trim)
An idle window redraws once every 30 s or so (a relative time ticking),
and each frame brought back ~200 MB of Metal driver memory for 11 s. The
pin is the current one (d0dc793b0) plus that change alone (zgx #2210).
App at rest, 1 s samples over 3 min: p90 316 -> 114 MB, seconds ~200 MB
high 21% -> 5%, median and CPU unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 17:33:04 -07:00
Wing
69768a5129 Home search: a packed index, handed back when the picker closes
The New project picker's home index held each path as two strings (as
typed and lowercased): 400,000 small blocks for a 200k-entry home, ~45 MB
in the engine, and none of it went back when the picker closed. The walk's
thread built it and had exited, so mimalloc kept its pages abandoned until
a forced collect: every use of New project left the engine ~45 MB larger,
and ademark's A5 (memory at rest after adding a project) read 330-351 MB
once the bench Mac allowed the walk into Documents.

- The index is two allocations: every path in one string and where each
  ends (its top bit marking a folder), matched without case as it's
  searched (ASCII in place, anything else lowercased).
- Search computes each match's depth once and orders only the first
  `limit` (select, then sort): a file query matching 22k paths took 27 ms,
  now 10 ms; a folder query 0.35 ms, now 0.27.
- `zeron_engine::heap`: the app binaries hand in mimalloc's forced collect,
  run after a walk ends and after its index is dropped.

Engine on a 200k-entry home (release, rig): before 11 MB, picker open 58,
closed 56-58 (never returned); now 12, 22, 12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 15:25:25 -07:00
Wing
5c56fd5a65 Merge zeron/idle-mem-cpu: a chat changing elsewhere costs the idle window a third as much
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 11:27:37 -07:00
Wing
3a5d87287e Idle window: a chat changing elsewhere costs a third as much
Each change to the chat list (a chat working on another device moves its
row every few seconds) re-ran work for UI nobody could see:

- The folded-away sidebar glided its rows to their new places: about 30
  frames of the list's heights recomputed on the display link, per change.
  Folded away, it now takes each new shape at once (its order, which
  ⌘1–9 and the next/previous session read, still follows). Zeron v2's
  copy too.
- The composer's `@` list made a row for every chat on every change,
  open or not. Its chats are made only while the draft holds an `@`
  (draft_text.holds, read in place).

On the overnight perf build with 432 chats, sidebar closed, composer
focused, one chat touched every 3 s: the window's main thread spent
~18-20 ms per change (over two 250 ms windows, the display link running);
now ~7 ms in one, no display link. Idle with nothing changing: unchanged
(0.045% vs 0.048% of a core, the caret's two wakes a second).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 11:23:42 -07:00
Wing
f1ecad2867 Home search: a bounded walk whose idle workers sleep
Opening New project warms a names-only walk of the whole home folder. It
ran on the `ignore` crate's parallel walker, whose idle workers wake every
millisecond until every worker is done. On the bench Mac a few workers
never returned from open() on Desktop and Documents (a privacy prompt for
an ad-hoc-signed build that nobody could answer), so the rest polled for
good: ~4,800 wakeups a second and ~4% of a core in every phase, after quit
too. The cancel flag was read only between entries, so closing the picker
never stopped it.

The walk now has its own pool: workers share a queue of folders and wait
on a condition variable while it's empty. It answers with what it has at
20 s, a cancel (the picker closing) ends it at once, and a folder still
being read when a walk ends is skipped by later walks until that read
returns, so a stuck folder holds one blocked thread, not one per walk.
Home's own folders and theirs are listed one by one so the workers share
the work; a repository or anything deeper is walked whole with its ignore
files, as before.

On ~/.zeron/worktrees (40 checkouts, 250k-entry cap) the walk takes 160 ms
warm, against 215 ms before. A test holds one folder's read open: the walk
answers at its deadline with the rest, idle workers don't wake (mutation:
a 1 ms poll fails it), and the next walk doesn't enter that folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 11:09:22 -07:00
Wing
7e11ae17dc Merge zeron/perf-fixes: security audit and review fixes
# Conflicts:
#	crates/engine/src/sessions.rs
2026-11-14 08:25:19 -07:00
Wing
e8d14d96f1 New chat: a switched agent's config lands before its first message, and a refusal is shown
A new side chat that switches from its parent's agent sent its config and first
message in one poll; the engine could start the run first and refuse the
switch, logged only. Now a switch awaits the config, a refusal fails the send
visibly, and a same-agent first message still goes out in one poll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 08:24:22 -07:00
Wing
509857e4fe MCP endpoint: cap connections and time out slow request headers
The agent MCP listener accepted any number of connections and, with no
timer set, hyper's header_read_timeout never applied, so a local client
could hold connections open forever by trickling (or never sending)
headers. Connections now take one of MAX_CONNECTIONS (128) slots before
they are accepted (more wait in the backlog until one ends), and the
connection builder gets a TokioTimer with a 10 s header read timeout. The
cap sits above 64 because every warm agent can keep a listen stream open
and its long calls one connection each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 04:05:39 -07:00
Wing
4f95a9bd6e MCP endpoint: a run's listen streams end with its token
subscriptions/listen streams weren't among a grant's calls in flight, so
one a client kept open outlived its run's token, holding the run's tools
and their engine connection (and sending keep-alives) for as long as the
client stayed connected. Each grant now registers its listen streams and
aborts them when the grant drops; a stream the client closes leaves the
grant's set. listens_open() counts them for tests and diagnostics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 04:05:35 -07:00
Wing
f2ffc0a0c5 Merge zeron/new-thread 2026-11-14 04:04:07 -07:00
Wing
f5409318f7 Merge zeron/idle-window 2026-11-14 04:04:07 -07:00
Wing
7c6f3e6b81 Sessions: a chat open nowhere stops its idle agent after 30 s
The idle window now follows whether anyone is looking at the chat:

- open anywhere (this device's app, or another device's transcript
  watch): AGENT_IDLE_STOP, two minutes, as before — its person is likely
  to reply;
- open nowhere: UNWATCHED_IDLE_STOP, 30 s, counted from the later of the
  turn's end and the moment its last viewer left, so switching away from a
  chat gives it 30 s from then.

Viewers are the WatchDocMessages streams of anyone but an agent (the
windowed one included); each holds a guard for its life, the last to
leave stamps the time, and parked runs re-work their window as viewers
come and go. Every hold is unchanged and still wins (background work, the
process-tree backstop, wake-ups, crons, questions, the version gate), and
other harnesses keep their windows. The old "another device has it open"
hold is gone: being open is the two-minute window now.

Measured (ademark A5's shape: 5 chats seeded through turns, the last left
open, then at rest): 5 agents / 598 MB until two minutes before; 1 agent /
108 MB from 45 s after. The next message to a chat stopped this way leaves
in 0.23 s (resumed, context kept), against 0.03 s warm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 04:03:15 -07:00
Wing
74cd87f162 Idle stop: track a wake-up by its time and a cron by its id
The reaper counted ScheduleWakeup calls and reset the count on any wake
turn, and counted CronCreate less CronDelete. But a /loop's ScheduleWakeup
replaces the last one (and `stop: true` ends the loop), and a background
task ending starts a wake turn too: a loop rescheduled twice and stopped
held the agent forever, and a background wake turn before the wake-up's
time let the agent be stopped two minutes later, killing the loop. A
duplicate CronDelete released the other cron's hold.

The CLI doesn't say which wake-up a wake turn fired, so SelfScheduled
(self_schedule.rs) keeps the loop's one pending wake-up with its time
(delaySeconds, clamped to [60, 3600] as the CLI does): a wake turn from
its time on is its firing, and past a minute's grace it holds nothing; a
call that fails restores the one before; a call with no delay seen keeps
the old behavior (pending until a wake turn). A cron counts from a
successful CronCreate until a successful CronDelete of its id (matched in
the create's result), each id once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 04:02:49 -07:00
Wing
d37e3b6c61 New chat: its draft's last keystrokes survive a quit, and a sent one never returns
The new-chat page's draft is saved at most every 250 ms; what was typed
since the last save waited on a ui.after timer, and a timer never fires
once the window has closed, so quitting (or closing the window) within
250 ms of a keystroke lost it. Sending was worse: the cleared draft's save
waited its turn too, and a quit in between left the sent message saved as
the draft, back at the next launch.

The main window now sets the shared `app.closing` in its on_closed, just
before host.save() writes what the scripts saved; the page's draft saves
at once when it changes (setting a shared value runs what follows it
synchronously). And take(), which empties the draft to send it, saves the
new page's emptied draft at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 04:01:00 -07:00
Wing
73ed0423b7 Journal: write events left waiting after a turn's last append
Batching kept appended lines in memory until the next append or read, so
what a turn appended after its Done (its usage) stayed out of the file
until the chat's next turn, and was lost if the engine died first. A
flusher thread now writes anything that has waited IDLE_FLUSH (1 s) with
no append to take it along; it sleeps on a condvar while nothing waits,
so an idle engine pays nothing. Appends still batch as before.

A failed write no longer drops what waits: write_pending writes what it
can, keeps the unwritten rest (continuing the line it stopped in, so
nothing is torn or written twice) and retries it with the next append,
flush or the flusher. Only past MAX_PENDING (8 MiB per chat) is it
dropped, logged as an error with the number of events lost, and returned
as an error to the append that hit it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:52:01 -07:00
Wing
289411595f Composer: a trigger after a long closed code block opens its list again
draft_text.token looked for the token in the 1 KB either side of the
caret first and gave up when that found none. A closed code block opened
more than 1 KB above the caret shows that window only its closing fence,
which mention_tokens counts as a block still open, so `@file`, `/cmd` and
`$skill` after it showed no list. When the window finds nothing and holds
a fence before the caret, the whole draft now decides; a window without
one still answers alone, so the common keystroke reads no more than before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:51:41 -07:00
Wing
a7b203a55b Tests: keys typed right after ⌘N land in the new chat, shown in its first frame
ademark's A3 times ⌘N to the first frame whose new-chat composer reads the
probe keys, with the old chat gone. Measured on zeron/perf (rig, 12 runs,
the app's own key and present logs): ⌘N reaches the app ~50 ms after t0,
the new page is presented 11.6 ms later, the session's page is gone in that
frame, the composer already rests where it stays (it snaps; nothing glides),
and each probe key is presented 2.5 ms after it arrives. The test pins that
down: from a session whose composer has the keys, "ad" typed with no frame
after ⌘N is the new chat's draft and not the session's; the first frame
shows #chat-home with #chat-session gone; the composer's box in that frame
is its box 30 frames later. From focus elsewhere, the first frame gives the
composer the keys. Mutation-checked: no snap on the route switch, a route
one frame late, and no focus on arrival each fail it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:51:32 -07:00
Wing
5b5d6a04bc Claude: never fall back to the MCP token on the command line
When the owner-only file for a run's MCP config couldn't be made,
build_command_with_config passed the config inline, putting the run's MCP
token (an HTTP bearer header or the token env) on argv, readable by every
local user in ps. It now fails closed: the servers carrying a token are
left out with a warning, the rest are still passed, and the chat goes on
without Zeron's tools (and without the wait_on_background note that names
one of them). The decision lives in mcp_config_args, tested with a writer
that fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:47:59 -07:00
Wing
94bb839337 Idle reaper: log a lingering child's name, never its command line
The reaper logged each unreported child of the agent as "<pid> <argv>" at
info level, and a command line can hold anything (tokens, URLs with
credentials). unexpected_descendants now describes each as "<pid> <name>",
the name being the kernel's process name (pbi_name/pbi_comm on macOS,
/proc/<pid>/comm on Linux), falling back to argv[0]'s file name. argv is
still read, only to recognise configured MCP servers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:46:43 -07:00
Wing
89b6f7baa7 Idle stop: an orphan left in the agent's process group holds it
unexpected_descendants counted only the agent's direct children, but a
stop signals the agent's whole process group. A shell that ran `cmd &`
and exited leaves cmd re-parented to init yet still in that group, so the
idle stop SIGTERMed it two minutes in. When the agent leads its own group
(every agent started through owned::configure), every live member of the
group that is no longer under the agent now counts too, unless it is a
configured MCP server. The process table carries each process's group
(pbi_pgid on macOS, /proc/<pid>/stat's pgrp on Linux, pgid from ps).

Verified with the real Claude Code 2.1.322 against a replay server: its
Bash tool runs every command in a session and group of its own (setsid),
so `cmd &` from a foreground command lands outside Claude's group: the
stop never signals it, and it outlives the agent as it did before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:45:52 -07:00
Wing
7a456f8323 Merge zeron/no-launch-agents: a launch starts no agents for parked chats (tests) 2026-11-14 03:44:04 -07:00
Wing
8815fb2352 Config reads: refuse a FIFO, device or runaway file on the open handle
A cloned repo whose .mcp.json (or .claude/settings.json) is a symlink to
/dev/zero made the MCP config reader check the path's size (0) and then
read forever; a FIFO there blocked the open. Every file the Claude MCP
config reader reads now goes through bounded_file::read: opened with
O_NONBLOCK, checked as a regular file on the open handle, and read through
take(max + 1), refusing anything over the limit.

The same reader now backs the other files read from places someone else
may control: the model-discovery hash of a project's opencode.json up its
tree (it had no check at all), Hermes's models.dev cache and .env (checked
by path, then opened), and the engine's background.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:39:03 -07:00
Wing
6191678a6d Tests: a launch over parked chats starts no agent; a cut-off turn still recovers
ademark A5 counted 5 agents (741 MB) "at rest after launch". Measured with
a private rig (real claude 2.1.322 against the replay server, data in
<home>/.zeron/profiles/local, the app's opening calls made over IPC), the
engine starts none at launch, on zeron/perf and on v0.2.136 alike,
after a graceful stop or a kill: only short probes (`claude doctor`, the
catalog/commands `initialize` probe) that are gone within seconds. The 5
agents are the seed threads' own, parked after the seed turns that
ademark's runbook sends right before A5 (§7.1 steps 8-9).

These tests hold the launch side to that: five parked chats restart with
no agent after a shutdown or a crash, the next message resumes its own
session, and a turn cut off mid-way is the one thing revived.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:39:00 -07:00
Wing
644ce729d3 Merge zeron/tokens: no CLI session-title request, shorter zeron MCP instructions 2026-11-14 03:27:22 -07:00
Wing
f38065825b Tokens: no CLI session titles, shorter MCP instructions
Every new Claude chat sent Haiku requests Zeron never reads: the CLI
names any stream-json session whose first prompt is 10+ characters, so
both the titling run and a real chat's run asked for a title of their
own (~4.3 KB each). CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 latches the
CLI's titling as done; Zeron still titles chats itself.

The zeron server's instructions ride every request whole (its tools are
deferred behind tool search), and most of them repeated the tools' own
descriptions. They now say only what an agent needs to reach for a
tool; kinds, hosts, Cloud, the one-level rule and the visual style stay
in create_chat's and show_visual's descriptions.

Replay rig (claude 2.1.322), bytes per new chat:
- "hi": 93,192 -> 86,456 (main request -2,393, CLI title request gone)
- a 120-character prompt with one tool call: 184,597 -> 171,173
Tool results (whoami, show_visual valid and invalid, send_message,
wait_on_background) are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 03:24:03 -07:00
Wing
d50d967456 Merge zeron/window-cpu: a split pane's draft is followed by its length, not copied each key 2026-11-14 02:33:00 -07:00
Wing
30735587e5 Split panes: a pane's draft is mirrored without reading it back
A split pane keeps its chat's draft in step with the window's (shared
`draft_of`) both ways, and each side read the whole draft and compared it
at every keystroke, the echo of its own write included, and the picks'
mirror read the whole draft for its picks: a key in a pane's draft of
30,000 lines cost 1,025M instructions (32 ms), against 17M at 20 lines.

Each side now tells the other the length it wrote, and skips that echo by
it; the chat's draft is followed by its length (`Shared.track_draft_of`,
`draft_size_of`), and read only for a change made elsewhere; the picks'
mirror reads the picks alone (`chosen_of`); a pane's Cloud link reads
whether its draft is blank with ds/draft_text, here and in v2's copy
(recorded in step). The new-chat save follows the kept drafts by `len`.
A key at 30,000 lines: 41M instructions (16M at 20 lines); what's left is
the one copy into the focused pane's hidden composer, which keeps it the
draft the window's composer types into.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 02:23:57 -07:00
Wing
9418628024 Merge zeron/first-word: the engine's pre-spawn work off the critical path, title after first output 2026-11-14 02:18:18 -07:00
Wing
ab0d3603f8 zgx: pin zeronsh/zgx main d0dc793b0: long strings read once, state:len/sub without copying (zgx#2184)
Full suite at this pin: app 718, zgx UI 1409, engine 1153, harness 544, proto/rpc 173,
engine integration 39, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 02:18:15 -07:00
Wing
fdeb8010b0 Merge zeron/window-cpu: typing costs the same at any draft length 2026-11-14 01:58:30 -07:00
Wing
18057fdc96 Composer: a new chat's first message goes out with its config
`chat.send` awaited the new chat's setChatConfig answer before queueing
its first message, and that answer is read only once the frame that
builds the new chat's page is done. Both now go out in the same poll,
the config first. The message carries the same agent and model, and the
engine stamps them on a chat whose config hasn't landed yet, so the two
may land in either order; a config that fails is logged (the run goes
with its own agent and model all the same).

Through the app (beta build, inspector-driven Enter, a project chat,
24 reps each, M5 Max under load): createChat -> QueueCommand at the
engine 7.7 -> 5.4 ms. Small here; the page's frame costs more on slower
Macs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:52:49 -07:00
Wing
14123b7e57 Merge zeron/engine-idle: an idle engine sleeps (event-driven run loop and wake, paced monitors and scans, batched journal, lighter relay upkeep) 2026-11-14 01:42:18 -07:00
Wing
e068e04a74 Trace a new chat's createChat and setChatConfig (first_word)
With them a rig reads the app's side of a send from the engine's log:
Enter to createChat, and createChat to the run's command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:36:51 -07:00
Wing
82ce7506f2 Titles: wait for the agent's output, not its startup reports
Claude reports its context usage and commands at init, before its
request: counted as output, they released the title run ~100 ms before
the first request (seen through the app). Only what the agent says or
does now releases it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:34:25 -07:00
Wing
d954527eb9 Merge zeron/idle-backstop: an idle agent with unreported children, or an old CLI, is never stopped 2026-11-14 01:27:01 -07:00
Wing
e6a8570916 zgx: pin zeronsh/zgx main 7dcf08e3a: a launch's first-frame pipelines made off the main thread (zgx#2183)
App suite 718 passed, zgx UI suite 1406 tests, 0 failed at this pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:27:01 -07:00
Wing
039e10c222 Runs: stamp the source context on a task of its own
Joined with the dispatch, the stamp still held the drain: a command was
resolved (Applied) only once its `git` processes were done, so a fast
run could finish while its command still read Pending (e2e's
queued_run_command_executes_end_to_end and
interrupt_stamps_streaming_entry_aborted caught it). The stamp now runs
on a worker of its own and the command resolves as soon as the run is
dispatched, as it did before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:23:49 -07:00
Wing
ed0f2729d9 Sessions: recognise the MCP servers Claude starts from its user's own config
Claude runs without --strict-mcp-config, so it also starts the stdio
servers of its user's MCP scopes, and the idle-stop process check counted
them as unexplained children: anyone with servers of their own was never
stopped. The Claude driver now reads those scopes once per run, the way
the CLI does (crates/harness/src/claude/mcp_config.rs):

- user and local: `.claude.json` (in $CLAUDE_CONFIG_DIR, else ~),
  top-level `mcpServers` and `projects[<project>].mcpServers`
- project: `.mcp.json` in the run's directory or its repository root,
  less what a settings file's `disabledMcpjsonServers` turns down
  (`claude -p` loads the rest without asking)
- plugins: enabled ones (`enabledPlugins`) from installed_plugins.json,
  their `.mcp.json` or plugin.json `mcpServers`, ${CLAUDE_PLUGIN_ROOT}
  expanded
- managed: managed-mcp.json in the OS's system location

Only command and args are taken (`${VAR}` expanded); an entry's env is
never read into anything kept or logged. Files are size-bounded; a
missing or malformed one adds nothing, so its servers stay unrecognised
and hold the stop. The engine reads them at launch, off the runtime's
threads (Harness::configured_mcp_servers), and joins them into the known
children when the reaper first looks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:18:28 -07:00
Wing
dd48d0360e Sessions: an idle stop no longer trusts the agent's own report alone
Two backstops for the 2-minute idle stop, neither relying on what the CLI
says about its background work:

- Process check: right before the reaper stops a runtime, it reads the
  agent process's live children (libproc + KERN_PROCARGS2 on macOS,
  /proc on Linux; Windows not traced). Any child that isn't one of the MCP
  servers the run was configured with (Zeron's, the plugins') holds the
  runtime for another full window, and is logged: a background shell or
  dev server the agent never reported. Zombies don't count; an unreadable
  process table holds. (zeron_harness::process::unexpected_descendants;
  drivers say which pid is the agent: TurnControl::set_agent_pid.)
- Version gate: Claude takes the 2-minute window only from CLI 2.1.312,
  the first live-verified to report every background task
  (background_tasks_changed); an older or unknown version keeps the
  30-minute window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:06:28 -07:00
Wing
f0ab203f63 Mock agent: /stream N, ademark's A7 reply at its pace
One reply of text, code blocks and a diff block, 16 characters every 50 ms
(80 tokens a second in 50 ms chunks, as A7's replay streams) for N seconds
(180 when bare): what the window spends while agents stream, measured with
the replay's shape rather than the scripted turn's many short parts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:06:13 -07:00
Wing
c68f519d95 Zeron v2: its composer reads whether the draft is blank where it's held
v2's own copy of screens/chat/composer read the whole draft for its send
intent and Cloud link at every keystroke, as the default's did; it reads
ds/draft_text's `has_text` now too, and the copy is recorded in step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:04:53 -07:00
Wing
1b0bf2400e Merge zeron/cold-start (round two): pipelines before the first frame (via zgx), no plugin reload on relaunch 2026-11-14 00:55:30 -07:00
Wing
e3af43389d New chat: its draft is saved at most every 250 ms as it's typed
Each keystroke in a new chat copied the whole draft into a table and the
saved state (whose file zgx writes 250 ms later anyway). It's now saved at
the first change after a pause and then every 250 ms while typing goes
on, the last keystroke's once it has waited that long.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:52:54 -07:00
Wing
84c7edd7c9 Composer: its bindings read the draft where it's held
A dozen bindings and effects read the whole draft at every keystroke
(`get`, a copy of it into the script each): the send button and intent
(whether it's blank), the layout (whether it has a break), the metrics
request (which carried the draft itself, copied in and out again at each
of its reads), the mention list, its references and dictation. In a draft
of 30,000 lines that was 5 ms of copies a key.

ds/draft_text reads what each needs where the draft is held: `len` to
follow its edits, a plain `find` for a break or a reference, the line at
the caret for a token, its first bytes for whether it's blank. With zgx's
`state:sub` (zeronsh/zgx#2184) nothing copies the draft; on the pinned zgx
the reads that still need it fall back to `get`. A key at 30,000 lines:
5.8 ms on the pin (17.3 before), 2.5 ms with #2184, as at 20 lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:52:54 -07:00
Wing
3117cbb2dc Composer: a line break reads its own line, not the draft above
A break (Shift-Enter, or Enter where it breaks lines) walked every line
before the caret to find its own, then matched them all for fences,
before knowing the line was a list item at all: 40 ms and 1G instructions
of a break in a draft of 30,000 lines. The line's start is found back
from the caret, and fences are counted (by a plain search) only for a list
item's line: 2 ms, 15M instructions. Tests for what a break does, which
none covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:52:54 -07:00
Wing
e858c7db0f Composer: a mention token is looked for on the caret's line alone
Every keystroke looked for a `/` command across the whole draft with an
unanchored pattern (and for fences across all of it), twice for the
completions and once for the composer: 9 ms of a keystroke in a draft of
30,000 lines. A token never crosses a line, so only the caret's line (its
last 1,024 bytes at most) is read; fences above it are found with a plain
search, and only where a trigger is. 343M instructions a key at 30,000
lines down to 68M; the same tokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:50:19 -07:00
Wing
6a4f0aa7b1 zgx: a relaunch loads the engine's plugins with the window, not by a reload
The plugins came with the engine's connection, after the first frame, and
loading them reloaded every script in the window: on an M5 Max 176 ms of
the main thread, as the first keys were typed. The engine outlives the app,
so a relaunch usually finds it running: the launch now asks it which
plugins it allows (`WatchPlugins`' first word, read on the spot within
150 ms, engine::rpc::ask_now) before the window's first load, which loads
them with it (+33 ms there). The list the connection then brings is the
one loaded and changes nothing. Only what the engine says is loaded, as
ever; with no engine running (a cold start) the dial is refused at once
and nothing changes.

Rig, engine left running, 6 relaunches each: the post-connect reload gone
(sampled), typed text read 818 -> 750 ms (worst 1303 -> 841). Cold
launches unchanged (716 vs 727 ms, 8 each).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:32:28 -07:00
Wing
a15414aadf zgx: Zeron v2's base recorded again on the new main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:32:28 -07:00
Wing
8a8cdc607b rpc: idle_rig example for measuring an engine's idle and streaming cost
Seeds mock chats, holds the watches the app holds at rest, streams mock
runs, and times QueueCommand to a client's first frame and one device's
write to another's view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:32:11 -07:00
Wing
a9b4790e10 Sync: idle relayed chats rest, and streaming stops waking the scheduler
- Relay maintenance looked at each admitted chat every second, reading
  every pending outbox row's bytes from SQLite each time. It now rests
  (until its 10 s mode refresh) once the room has answered, the doc has
  caught up, nothing is left to retire or heal and no commit came since
  the last look; a commit or a peer's kept update wakes it at once.
  Leftover rows are adopted when relaying begins and with each mode
  refresh, not every second: a relaying host relays its own commits as
  it makes them.
- Retired outbox rows are deleted in one transaction per look, not one
  store call (and block_in_place) each.
- The store now notes which docs' outbox rows changed. The sync
  scheduler skips the pass an outbox change would wake when every such
  doc is a started chat whose client sends its own rows. While agents
  streamed, those passes (each several store reads, each through
  block_in_place) ran ten times a second, and the blocking pool's lock
  they contended on was the largest cost of a signed-in streaming engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:32:11 -07:00
Wing
e51676b299 Run journal: write each chat's events in batches
Every agent event was its own write(), under the one lock all chats'
appends share: with 5 agents streaming, workers spent more time waiting
on that lock than anything else in the engine.

Appended lines now wait in memory and are written when 100 ms old (at
the next append), at 64 KiB, at a turn's Done, with each doc commit of
the run (so the journal never trails its transcript), before any read of
the journal, when its file is evicted, and at shutdown. A line is
serialized from a borrowed event rather than a clone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:32:11 -07:00
Wing
8f8f39cffe Previews: discovery slows down while only warm processes keep it scanning
Discovery scanned every 2 s while anything a chat started was alive. An
engine at rest keeps a warm agent process for every recent chat, so it
scanned forever: every process on the machine (a KERN_PROC_ALL sysctl)
plus every socket of each chat's processes. With 20 parked agents that
was ~0.8 ms of CPU a second, most of an idle engine's work.

It still scans every 2 s while a run works or a terminal is open, and
whenever what a chat left running changes (a process starting or exiting,
a new listener). While nothing about those processes changes, each scan
waits twice as long as the last, up to 30 s; a run or terminal starting,
the chats changing, or a preview losing its process wakes it at once. A
server that a process left running starts listening on later can take up
to 30 s to be listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:32:11 -07:00
Wing
45b79a8f18 Engine: the connectivity monitor looks every 5 s once nothing changes
The monitor (started at assembly by desktop banners, and never stopped)
recomputed every second, walking every open chat. It still looks every
second while the posture is changing, degraded, or timing a degradation's
grace; once it has held healthy or local for 3 s it looks every 5 s. A
fresh outage is reported up to 4 s later than before (on top of the 4 s
grace it already waited); recovery from one is still seen within 1 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:31:57 -07:00
Wing
9a11f98d70 Background engine: sleep on its main thread, and hear wake from the OS
The background engine's main thread ran a CoreFoundation loop with a 1 s
repeating timer and a 1 s run-mode timeout, and the clock-comparing wake
detector (zeron_sync::wake) woke a tokio worker every second as well: two
or more wakeups a second with nothing happening.

- The main run loop now waits on a run-loop source that `finish` signals
  (race-free: a source signaled before the wait is served when it starts).
- It also registers for IOKit power notifications and broadcasts each
  wake (kIOMessageSystemHasPoweredOn) through `wake::notify_wake`,
  answering sleep requests at once. `wake::use_os_wake_events` keeps the
  polling detector from starting (or stops it); other processes keep it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:31:57 -07:00
Wing
dd460b304a Titles: start a new chat's title once its agent answers
The title run is a second agent process (the cheapest model). Started
with the chat's own run, both CLIs booted side by side, and the title's
claude spawned first and reached its request first. It now starts at
the agent's first output (anything after its session start), or when
the run ends without any, so it never competes with the startup that
stands between Enter and the first word.

Rig (M5 Max under load, 24 reps each, alternated): first request
377 -> 300 ms median with the source-context change; the title lands
365 -> 601 ms after Enter against an instant replay model (it trails the
first word by about one title run instead of racing it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:26:35 -07:00
Wing
fafbf7435c Runs: read the checkout beside the agent's start, not before it
Every fresh dispatch stamped the conversation's source context first:
three `git` processes one after another, ~25 ms (M5 Max, rig median)
before the agent was even spawned, on a new chat's first message and on
each next message alike. They now run side by side, and beside the
dispatch: the agent spawns 2.5 ms after the command lands instead of
34 ms. The stamp still records the checkout the agent observes; the
agent reads nothing of it for ~250 ms (its own startup).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:26:29 -07:00
Wing
4b0f499ef9 Claude: write a run's MCP config without a full fsync
The owner-only file holding a run's MCP token lives only as long as the
run that reads it at once. `sync_all` on macOS is `F_FULLFSYNC`, a
disk-cache flush, and it held every agent start: 4 ms on an M5 Max,
6 ms with builds running (spawn moved from 6.6 ms to 0.3 ms after the
run was prepared, in the first-word rig).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:26:29 -07:00
Wing
9c80a0e1c2 Trace an agent's road to its first word (first_word target)
Debug-level marks, off unless RUST_LOG names `first_word`: the command
queued and picked by the drain, the fresh dispatch, the run prepared,
the CLI spawned and its first stdout lines, the title run, and the first
segment commit. With them a rig joins the engine's side of a send with
the replay server's request time, stage by stage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 00:26:24 -07:00
Wing
ba2bc40011 Merge zeron/agent-lifecycle: one MCP endpoint in the engine, idle agents stopped, keep-running setting 2026-11-13 23:53:39 -07:00
Wing
519fec2491 Sessions: say what the idle-stop window was measured at
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:52:17 -07:00
Wing
98f978f2ff Merge zeron/cold-start: the composer has the keys as the window opens; faster template stamp
# Conflicts:
#	apps/zgx/ui/templates/zeron-v2/.base.json
2026-11-13 23:27:27 -07:00
Wing
cdffd274cc zgx: the launch's keys survive the plugins loading, and nothing steals them later
Two ways the composer's arrival went wrong at launch:

- An arrival was marked before its keys were given (the next turn). With
  an engine already running (a relaunch), its plugins came in as the window
  opened and loaded the window's scripts again in between: that turn's
  callback went with the old scripts, and the new ones found the arrival
  marked. It's marked now as the keys are given. (Rig, engine left
  running: main timed out 5/5, this 0/5 at 0.72 s.)
- A session's project, known once the engine lists the chat, counted as a
  move, so the keys jumped to the composer whenever the list came in,
  from whatever had them by then (a dialog opened at launch). For a
  session the project is the chat's own and no longer part of the
  arrival; on a new chat it still is.

Zeron v2's copy follows; its base is recorded again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:27:15 -07:00
Wing
f1cadd6f9a zgx: Settings → Plugins settles before it's published
publish_page walks every element of the window and wrote Settings →
Plugins on each ask: before the first frame (the view known) and twice
more as the engine answered, a tenth of a second of a launch's main
thread that nothing a launch shows reads. Asks in a row now make one
publish, 1.5 s after the launch's first ask and 200 ms after any later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:27:12 -07:00
Wing
00a34173ef zgx: a launch runs the templates as the last one left them
Every launch copied Zeron's interface into <data>/templates/.zeron and laid
.live down again (sync_zeron, compose), reading every file of Zeron's at
least twice to write none: about a quarter of a second on the main thread
before the window on an M5 Max, warm, and more from a cold disk.

The launch now keeps a stamp of what it laid down (.launch-stamp.json:
this Zeron's version, ui/, the active template and .live as it left them,
each by path, size and time written, nothing read). The next launch that
finds the same runs .live as it is; anything changed (an update, a
template switched or edited, .live written by anyone, a file gone) lays
everything down as before. prepare_live: ~250 ms to ~10 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:27:12 -07:00
Wing
2cc39f0360 zgx: the composer has the keys as the window opens
Since c865bf3be the composer took the keys on arriving at a chat, but the
window opening was left out on purpose, so a launch gave the keys to
nothing. They only reached the composer by accident: a restored session's
project resolving once the engine's chat list came in counted as an
arrival. A launch onto a new chat, or a session the engine was slow to
list, never had them, and ademark's A1 (which types from the launch with
no click) timed out on every run.

The window opening on a chat is now an arrival too; a reload still isn't.
Zeron v2's copy follows, and its base is recorded again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:27:12 -07:00
Wing
3c349d65d4 Merge zeron/long-thread-open: a long reply builds its blocks in runs near the view 2026-11-13 23:15:28 -07:00
Wing
44d833bc8a zgx: the launch's keys survive the plugins loading, and nothing steals them later
Two ways the composer's arrival went wrong at launch:

- An arrival was marked before its keys were given (the next turn). With
  an engine already running (a relaunch), its plugins came in as the window
  opened and loaded the window's scripts again in between: that turn's
  callback went with the old scripts, and the new ones found the arrival
  marked. It's marked now as the keys are given. (Rig, engine left
  running: main timed out 5/5, this 0/5 at 0.72 s.)
- A session's project, known once the engine lists the chat, counted as a
  move, so the keys jumped to the composer whenever the list came in,
  from whatever had them by then (a dialog opened at launch). For a
  session the project is the chat's own and no longer part of the
  arrival; on a new chat it still is.

Zeron v2's copy follows; its base is recorded again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:10:39 -07:00
Wing
758e7a7a1b Settings: "Keep Zeron running after you quit"
On (the default) quitting the app leaves the engine running, as before,
now with idle agents stopped. Off: the app asks its engine as it quits
(QuitCheck) and tells it (AppQuitting), and the engine stops once nothing
is pending — turns, questions, background work — after 5 quiet seconds.
Work still running is never ended silently: the app asks "N chats are
still working. Keep running in the background until they finish, or stop
them now?" and only "Stop them now" stops them (each chat's own Stop).
Any later call from this device's app calls the stop off; a relaunch
doesn't ask.

- engine: crates/engine/src/keep_running.rs (setting in
  {data_dir}/background.json, the quiet wait), the background engine's
  ManagedRpc serves Get/SetBackgroundSettings, QuitCheck, AppQuitting
  (local-only methods)
- app: Settings → General row (engine switch), the quit question as a
  native alert after the run loop ends (src/quit_prompt.rs) in the
  language shown (words handed over from the scripts), en + zh-Hans

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:06:32 -07:00
Wing
c987be092f Sessions: stop an idle agent process after two minutes, never one with work pending
A runtime parked between turns used to keep its agent CLI for 30 minutes
(each Claude ~120-200 MB plus its MCP servers). Drivers whose resume brings
the session back whole (`Harness::stops_when_idle`: Claude, via --resume)
now stop it after `AGENT_IDLE_STOP` (2 minutes); the next message resumes
the session. The others keep the 30-minute window.

Never stopped, whatever the window:
- a turn running (the reaper only arms between turns)
- background work or a subagent (the driver's own report; a silent
  subagent is presumed lost only after 4 hours, as before)
- the agent said it waits on background work (`wait_on_background`)
- a wake-up or session cron it scheduled (ScheduleWakeup / CronCreate,
  until the wake turn starts or CronDelete)
- a question waiting on the person
- another device has the chat's transcript open (a peer's
  WatchDocMessages holds a guard for the stream's life)
- a voice call, an accepted agent update (unchanged)

Claude teardown already waits out a live .oauth_refresh.lock before any
signal or EOF (refresh_lock::settle), so a stop never lands mid refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 23:06:26 -07:00
Wing
f37aaf4b15 Tests: a long thread's open budget, scroll, find and paint
- long_thread_tests: ademark's A11 thread built by src/chat.rs; its
  open holds fewer nodes than a tenth of it (782 vs 18,340 before) and
  stays under budgets of 2,000 nodes and 2,500 script calls (962 vs
  43,091 before), with LONGTHREAD-END in view; scrolled up a step a
  frame it moves by each step through to its first, and Jump to latest
  takes it back to its end.
- transcript_paint_tests: the same thread opened and scrolled draws what
  a whole repaint draws.
- chat_find: a match far up its one reply is found, its run built and
  scrolled into view.
- chat_fixture `long_thread`: the thread as Tall replies (s7).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:55:07 -07:00
Wing
01b42ec3d7 Transcript: window a long reply's blocks in runs
A reply's blocks were all built whenever its chat opened: ademark's A11
thread (one reply of 1,000 steps, ~2,000 blocks) took one frame of
~44,000 script runs and ~32,000 node layouts (1.1G script, 1.1G update,
0.28G layout instructions), ~230 ms on an M5 Max and 380 ms on an M1,
though only its end shows. Switching back cost the same each time.

A reply of more than 48 blocks, or one being written, now holds its
blocks in runs of about 32, as a long text's are (ds/markdown's window):
a run is built while it's within 600 pt of the view and is a box of its
last height (a guess until laid out) away from it. Run boundaries come
from block ids alone, so the engine's opening tail and then the whole
reply, or a reply being written, keep the runs they don't reach. The
runs within a view and its overscan of the end are built as it's made,
and kept until the view has been near them and gone, so the reply opens
whole in its first frame with no frame after it. A run built above the
view moves the view by its difference, as markdown runs do; a find's
current match and a streaming reply's last run are always built.

A11 at 1600x1000 pt (cmd+1/cmd+2): open and switch 228-259 ms -> 20-28
ms to settled on an M5 Max, no frame after the first paint; 3,371 runs
and 95M/43M/25M instructions. CPU while a reply streams into the long
thread: 2.6 s -> 1.0 s over 8 s. Footprint with it open: 540-580 MB ->
310-360 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:55:07 -07:00
Wing
9a6c3d9e3f Mock agent: /longthread N, ademark's A11 thread
A prompt of `/longthread [N]` (1,000 when bare) answers as ademark's A11
replay does: N steps, each a short text (one in five with a code block)
and a call reading a small file, the last text holding LONGTHREAD-END,
streamed unpaced. One reply of 2N+1 parts, for timing a long thread's
open, switch and scroll against a private engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:55:07 -07:00
Wing
c48876c380 MCP: serve agents' Zeron tools from the engine, not a process per agent
Every agent run used to start the whole engine binary as its own `zeron
mcp` stdio server (10 engine processes for 5 streaming chats). The engine
now serves those tools itself over loopback Streamable HTTP
(crates/mcp/src/http.rs), stateless per the 2026-07-28 revision with
2025-era clients still answered:

- no per-connection state: each request carries its run's bearer token
  and stands alone; `initialize` (2025) is answered without a session id,
  `server/discover` and `subscriptions/listen` (2026) are served, the
  MCP-Protocol-Version / Mcp-Method / Mcp-Name headers are checked against
  the body (400 + HeaderMismatch), GET/DELETE answer 405
- long calls answer within their own POST (SSE with progress and
  keep-alives); closing the stream, or a 2025 `notifications/cancelled`,
  stops the call
- each run gets its own token (32 random bytes), naming its chat and
  revoked when the run ends; the calls behind it reach the engine as that
  agent (agent_allowed methods only), with the calling-chat methods
  pinned to the token's chat (zeron_rpc::agent_service)
- 127.0.0.1 only, on a port of its own; Origin present → 403, a Host that
  isn't loopback → 403 (DNS rebinding), no token → 401

Claude gets `{"type":"http"}` in an owner-only (0600, in a 0700 dir)
--mcp-config file instead of inline JSON on argv; Codex gets url +
http_headers in its thread/start overrides; ACP agents that advertise
mcpCapabilities.http get the http form. Everything else gets
`zeron-engine mcp-proxy` (crates/mcp/src/proxy.rs): std only, no engine
setup, a stdio-to-HTTP forwarder of ~2 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:47:41 -07:00
Wing
40d6232940 zgx: Settings → Plugins settles before it's published
publish_page walks every element of the window and wrote Settings →
Plugins on each ask: before the first frame (the view known) and twice
more as the engine answered, a tenth of a second of a launch's main
thread that nothing a launch shows reads. Asks in a row now make one
publish, 1.5 s after the launch's first ask and 200 ms after any later.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:19:03 -07:00
Wing
6ee4f77768 zgx: a launch runs the templates as the last one left them
Every launch copied Zeron's interface into <data>/templates/.zeron and laid
.live down again (sync_zeron, compose), reading every file of Zeron's at
least twice to write none: about a quarter of a second on the main thread
before the window on an M5 Max, warm, and more from a cold disk.

The launch now keeps a stamp of what it laid down (.launch-stamp.json:
this Zeron's version, ui/, the active template and .live as it left them,
each by path, size and time written, nothing read). The next launch that
finds the same runs .live as it is; anything changed (an update, a
template switched or edited, .live written by anyone, a file gone) lays
everything down as before. prepare_live: ~250 ms to ~10 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:13:48 -07:00
Wing
b5fe2a9d66 zgx: the composer has the keys as the window opens
Since c865bf3be the composer took the keys on arriving at a chat, but the
window opening was left out on purpose, so a launch gave the keys to
nothing. They only reached the composer by accident: a restored session's
project resolving once the engine's chat list came in counted as an
arrival. A launch onto a new chat, or a session the engine was slow to
list, never had them, and ademark's A1 (which types from the launch with
no click) timed out on every run.

The window opening on a chat is now an arrival too; a reload still isn't.
Zeron v2's copy follows, and its base is recorded again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:10:50 -07:00
157 changed files with 18043 additions and 962 deletions

5
Cargo.lock generated

Some files were not shown because too many files have changed in this diff Show more