feat(0128): HTTP API REST+SSE para agents_and_robots #1
Reference in New Issue
Block a user
Delete Branch "auto/0128-http-api-sse"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
feat(0128): HTTP API REST+SSE para gestion remota de agentes
task_run_id: task_b19cccf68791cc34
branch: auto/0128-http-api-sse
issue: 0128
Que incluye este PR
Nuevo paquete
internal/api:server.go— HTTP server stdlib, auth Bearer subtle.ConstantTimeComparehandlers.go— REST endpoints: /health, /agents, /agents/{id}, /{id}/{start,stop,restart,logs}pubsub.go— Bus in-memory para SSE broadcast (TODO NATS si llega 2do cliente)poller.go— goroutine StatusAll cada 2s, publica StatusDiff al bustail.go— tail -f logfiles con poll 200ms para SSE streamingserver_test.go— 12 tests unitarioscmd/launcher/main.go:--api-porty--api-keyapi.Servercomo goroutine si apiPort > 0 y hay clavesystemd/agents_and_robots.service:Restart=always(no on-failure)app.mdv0.2.0:Checks verificados
Pendiente humano (fuera de scope)
Nuevo paquete internal/api con servidor HTTP stdlib (sin gin/echo): - Auth Bearer via AGENTS_API_KEY con subtle.ConstantTimeCompare - REST: GET /health (sin auth), GET/POST /agents, /agents/{id}, /{id}/{start,stop,restart,logs} - SSE: /sse/status (broadcast diffs cada 2s) y /sse/agents/{id}/logs (tail -f) - Pubsub in-memory (TODO: NATS cuando haya 2do cliente) - Tail de logfiles: retroalimenta ultimos 50KB + poll 200ms para streaming Integracion en cmd/launcher/main.go: - Flag --api-port (0=desactivado, 8487 en produccion) - Flag --api-key (override de AGENTS_API_KEY env var) - Si apiPort>0 y sin clave, WARN y deshabilita en vez de fallar Systemd unit en systemd/agents_and_robots.service: - Restart=always (no on-failure — evita que exit limpio mate el service) - EnvironmentFile para AGENTS_API_KEY y demas tokens - WorkingDirectory=/home/ubuntu/CodeProyects/agents_and_robots app.md v0.2.0: - port: 8487, health_endpoint: /health (fix drift anterior donde era null) - e2e_checks: build, tests, smoke_health, smoke_auth - Documentacion Traefik+DNS pendiente humano post-merge Tests: 12 tests unitarios en internal/api (auth, health, bus, agents, logs) Smoke: /health 200, /agents sin auth 401, /agents con key 200 — verificado local Co-Authored-By: fn-constructor (agent)View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.