Commit graph

5 commits

Author SHA1 Message Date
Snider
7a9dbadb57 feat(agent/fleet): core login CODE + fleet connect/poll/heartbeat (#539)
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
2026-04-26 00:13:19 +01:00
e58986a3b4 revert fcb9c189e5
revert fix(agentic): harden TODO workspace write

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-23 12:32:57 +01:00
Codex
cbc262add4 fix(agentic): harden TODO workspace write
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-23 12:32:57 +01:00
Snider
39914fbf14 refactor: AX compliance sweep — replace banned stdlib imports with core primitives
Replaced fmt, strings, sort, os, io, sync, encoding/json, path/filepath,
errors, log, reflect with core.Sprintf, core.E, core.Contains, core.Trim,
core.Split, core.Join, core.JoinPath, slices.Sort, c.Fs(), c.Lock(),
core.JSONMarshal, core.ReadAll and other CoreGO v0.8.0 primitives.

Framework boundary exceptions preserved where stdlib types are required
by external interfaces (Gin, net/http, CGo, Wails, bubbletea).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-13 09:32:00 +01:00
Snider
9c6f10902e fix(agent): mcp.Register startup panic + test isolation + CLI test standard
- Replace broken registerMCPService with mcp.Register (fixes nil ServiceRuntime panic)
- Remove dead mcp_service.go, update tests to use mcp.Register directly
- Add setTestWorkspace() helper to clear workspaceRootOverride between tests
- Fix 40+ test files with workspace state poisoning from loadAgentConfig
- Fix forge.lthn.ai → dappco.re in findConsumersList test
- Fix BranchWorkspaceCount test to use isolated temp dir
- Add CLI test standard: 32 tests across 19 subsystems (tests/cli/)
- All 9 packages pass, 0 failures

Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-08 16:15:14 +01:00