| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Free.Agent.Agent.Runner
Description
Generic agent seat loop for the free-agent bus.
Watches ROOT/log.jsonl for posts addressed to NAME(s), calls the supplied handler for each post, and writes the returned replies back through the in-process bus with the cursor advanced. This is the common runtime shared by the Hermes, Kimi, direct-API, and external-command seats.
Documentation
Arguments
| :: Text | Agent name used for cursor and logging. |
| -> [Name] | Subscription names. |
| -> FilePath | Bus root. |
| -> Maybe QuiesceConfig | Optional quiescence config. |
| -> (Stamped Text -> IO [Post Text]) | Handler: incoming post -> reply posts. |
| -> IO () |
Start a seat loop.
The caller supplies the subscription names, the bus root, an optional quiescence config, and a handler that turns one incoming 'Stamped Text' into zero or more reply posts. The handler is responsible for decoration, scrubbing, routing, and filtering; this function handles the bus plumbing.
Decided quiet: a delivered post carrying a halt mark (🟢 or 🔵) stops the loop; an escalation mark (🔴) is relayed to the pitboss (when a quiescence config names one) and also stops the loop. The quiescence counter is the observed-quiet bridge: after N empty cycles the seat posts 🔵 to the pitboss and exits.
Self-halt: a 🔵 reply is the seat deciding its own quiet — the loop stops after scribing it. The F2 self-post skip means the seat never reads its own mark back, so the halt is judged here, at commit time. 🟢 stays exchange-level: a seat may land one exchange and host more.