Per RFC §9 Fleet Mode: device pairing + SSE-with-poll-fallback +
heartbeat + status reporting now wired.
Lands:
* pkg/agentic/fleet_login.go — `core login CODE` POSTs /v1/device/pair
with the 6-digit code; writes {agent_api_key, agent_id, expires_at}
to ~/.core/agent.key (mode 0600). Errors clean (no panic) on invalid
code / network fail.
* pkg/agentic/fleet_connect.go — Connect(ctx) opens SSE to
/v1/fleet/events with Bearer auth; reconnect backoff 1s→2s→4s→8s→
16s→30s. PollFallback via /v1/fleet/task/next every 30s when SSE
keeps failing. Heartbeat goroutine POSTs /v1/fleet/heartbeat every
60s with {agent_id, status}. Persists last-known fleet snapshot to
~/.core/fleet.status.json so fleet/status survives restart.
* pkg/agentic/fleet_mode.go — `core fleet` top-level + `fleet/nodes`
(lists registered nodes) + `fleet/status` (connection state, last
heartbeat, last task). All exit cleanly on API-unreachable.
* commands.go — registerFleetCommands wired into registerCommands.
* AX-10 tests + CLI Taskfiles for login + nodes (unreachable-API
asserted clean-exit, no panic).
Sandbox blocked from go test by go.work + private-module-graph
(pre-existing); gofmt clean.
Co-authored-by: Codex <noreply@openai.com>
Closes tasks.lthn.sh/view.php?id=539
|
||
|---|---|---|
| .. | ||
| cli | ||
| .DS_Store | ||
| test_openbrain_context.py | ||
| test_openbrain_memory.py | ||