Skip to content

Feat/agon everywhere#229

Merged
cukas merged 3 commits into
mainfrom
feat/agon-everywhere
Jun 22, 2026
Merged

Feat/agon everywhere#229
cukas merged 3 commits into
mainfrom
feat/agon-everywhere

Conversation

@cukas

@cukas cukas commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

No description provided.

KERN-Agon and others added 3 commits June 22, 2026 12:12
…desktop attaches to

The Agon Everywhere backbone (BrainClient contract + HeadlessTurnBrainClient +
AgonServe) was three libraries nothing instantiated. `agon serve` is the runnable
seam: build the engine registry, validate + open the single-engine brain, mint +
seed a fresh `serve-<ts>` session, bind the loopback bridge, write a 0600
connection file + print the URL/token banner, and hold until Ctrl+C with ordered
teardown (serve.close → brain.close → flush).

Infrastructure like `daemon`/`attach` (not a Cesar mode): KERN command + facade +
one subCommands entry.

Design validated by a 6-engine brainstorm (0.90 on all 4 forks): fresh-session
only (--session reserved + refused — an existing-session write would be answered
by the single-engine brain, not that session's live Cesar = split-brain);
foreground (daemon owns detachment); deny-by-default --origin; cesarEngine default
with fail-fast on unknown --engine; a startup provenance frame so a client can
verify which brain answers. One reasoned deviation: empty --origin starts with a
loud warning (not exit 2) so a token-holding local client (curl/Electron) still
works.

6-engine agon review: fixed the blocking finding — start()/post-bind steps were
unguarded, so a bind failure (EADDRINUSE on a pinned --port) crashed instead of
exiting 2 and leaked the opened brain. Now wrapped: tear down serve + brain +
flush + remove the handoff file, fail closed. Regression-tested.

14 tests: pure helpers, engine fail-fast, session seed + ready frame, 0600
connection file, runtime-wiring integration, bind-failure-fails-closed.

⚔️ Forged by [Agon](https://github.com/KERNlang/agon)

Co-Authored-By: agon (KERN) <292465531+KERN-Agon@users.noreply.github.com>
The unit tests prove the bridge works on the happy path; this proves the four
adversarial wire properties a browser/Electron client will inflict on it — the
Agon-Everywhere council's gate #2, before any GUI is built on the wire:

  • fan-out      — N concurrent subscribers get identical, ordered streams
  • reconnect    — resume from a cursor: no missed events, no duplicates
  • dup/order    — replay→LIVE-subscribe handoff delivers each seq exactly once
  • backpressure — a wedged consumer never blocks LIVE delivery to a healthy one

Driven by a deterministic counting brain over real loopback HTTP + SSE (the same
fetch/ReadableStream API a browser extension uses); each test owns a fresh session
+ ephemeral port. The live tests (dup, backpressure) send the second turn only
after the subscriber confirms it is connected, so they exercise the LIVE subscribe
path, not replay.

6-engine agon review: the harness now surfaces protocol regressions LOUDLY rather
than masking them as timeouts — non-2xx /events, a missing body, or a malformed
complete SSE frame all throw; live dup/backpressure no longer pass via replay-only;
temp AGON_HOME is cleaned up; the wedged raw socket has a persistent error handler.

⚔️ Forged by [Agon](https://github.com/KERNlang/agon)

Co-Authored-By: agon (KERN) <292465531+KERN-Agon@users.noreply.github.com>
@cukas cukas merged commit 1739e99 into main Jun 22, 2026
2 checks passed
@cukas cukas deleted the feat/agon-everywhere branch June 22, 2026 16:46
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.

2 participants