Fleet node structured logging: capabilities registered and actions invoked
Merged
WI
3mo ago+303+303+012345678901234567890123456789-19-19-01234567890123456789
What
A served fleet node (relay node up [--config node.ts]) now emits structured logs of what it does: each capability it registers and every action that hits it — invoked / completed / failed, each with a duration and structured fields ({ node, capability, kind, action, invocationId, ms, error }).
Turning it on:
relay node up --config ./scout.node.ts --log-file ./node.log # write to a file
relay node up --config ./scout.node.ts --log-level debug # include per-capability lines
relay node up --config ./scout.node.ts --log-json # one JSON object per line
Levels: capability registration → debug, action invoked/completed → info, failures → warn. With no --log-* flag (and no --verbose) the node stays quiet, surfacing only warnings — unchanged from today.
How
@agent-relay/fleet(serve-node.ts) — aFleetLoggerseam (shape-compatible with@agent-relay/utilscreateLogger) carries lifecycle and per-invocation events with a structuredextrabag.serveNode/startServeNodeacceptlogger?; the existinglog/warncallbacks still work, adapted onto it.handleInvokelogs invoked → completed/failed with elapsed ms; registration logs each capability then the summary.- CLI (
node up) —--log-file/--log-level/--log-jsonmap onto theAGENT_RELAY_LOG_*env the shared logger already reads;--verboseraises the floor todebug. When any is set,createLogger('fleet')is injected into the served node instead of the quiet warn-only callback.
The logger is injected (not imported by fleet), so @agent-relay/fleet stays dependency-free at its seam — a host can supply any sink (stdout, file, a JSON collector).
Verification
packages/fleettests (13, +3 new) — assert per-capability, invoked/completed (withms), and failed (warn+ error) events flow through an injected logger against an in-process broker.- CLI + fleet typecheck clean;
broker-lifecycle(21) andnode/corecommand tests pass (2 pre-existing failures onorigin/main, unrelated: a 5s node-delivery timeout and a SIGINT test). - End-to-end: injected
createLogger('fleet')writes the exact events to a file in both text and--log-jsonform.
Follow-ups (separate)
createLogger→ pluggable adapters (stdout + file simultaneously, custom sinks): #1238- Stale
agent-relay fleet servereferences in thescoutrepo →relay node up: AgentWorkforce/scout#4 - Docs for the new
--log-*flags: AgentWorkforce/agentrelay.com#20
🤖 Generated with Claude Code