CUB-123: Integrate gateway, wire PostgreSQL repositories, add SSE streaming #37

Merged
overseer merged 2 commits from agent/dex/CUB-123-gateway-integration into dev 2026-05-08 21:55:48 -04:00
Owner

What

  • Repository layer — PostgreSQL-backed CRUD via pgx for agents, sessions, tasks, projects
  • Repository interfacesAgentRepo, SessionRepo, TaskRepo, ProjectRepo for DI
  • Handler migration — All handlers now use repository interfaces instead of in-memory stores
  • SSE endpointGET /api/events with Broker managing client connections in text/event-stream format
  • Gateway client — Polls OpenClaw gateway for agent states, syncs to DB, broadcasts via SSE
  • Demo agent seeding — 5 agents (Otto, Rex, Dex, Hex, Pip) seeded on empty DB
  • Config — New GATEWAY_URL and GATEWAY_POLL_INTERVAL env vars

Verification

✅ go build ./... → PASS
✅ go test ./... → 21/21 PASS
✅ go vet ./... → PASS

Files

  • go-backend/internal/repository/ — 5 new files (agent, session, task, project repos + interfaces)
  • go-backend/internal/gateway/client.go — Gateway polling + seeding
  • go-backend/internal/handler/sse.go — SSE broker + endpoint
  • go-backend/internal/handler/ — Updated agent, session, task, project handlers
  • go-backend/internal/router/router.go — Added SSE route, Pool refactor
  • go-backend/internal/config/config.go — Gateway config fields
  • go-backend/cmd/server/main.go — Wiring
## What - **Repository layer** — PostgreSQL-backed CRUD via pgx for agents, sessions, tasks, projects - **Repository interfaces** — `AgentRepo`, `SessionRepo`, `TaskRepo`, `ProjectRepo` for DI - **Handler migration** — All handlers now use repository interfaces instead of in-memory stores - **SSE endpoint** — `GET /api/events` with `Broker` managing client connections in `text/event-stream` format - **Gateway client** — Polls OpenClaw gateway for agent states, syncs to DB, broadcasts via SSE - **Demo agent seeding** — 5 agents (Otto, Rex, Dex, Hex, Pip) seeded on empty DB - **Config** — New `GATEWAY_URL` and `GATEWAY_POLL_INTERVAL` env vars ## Verification ``` ✅ go build ./... → PASS ✅ go test ./... → 21/21 PASS ✅ go vet ./... → PASS ``` ## Files - `go-backend/internal/repository/` — 5 new files (agent, session, task, project repos + interfaces) - `go-backend/internal/gateway/client.go` — Gateway polling + seeding - `go-backend/internal/handler/sse.go` — SSE broker + endpoint - `go-backend/internal/handler/` — Updated agent, session, task, project handlers - `go-backend/internal/router/router.go` — Added SSE route, Pool refactor - `go-backend/internal/config/config.go` — Gateway config fields - `go-backend/cmd/server/main.go` — Wiring
Dex added 1 commit 2026-05-08 19:58:46 -04:00
CUB-123: integrate gateway, wire PostgreSQL repositories, add SSE streaming
All checks were successful
Dev Build / build-test (pull_request) Successful in 2m23s
e8ced74429
- Create repository/ package with pgx-backed CRUD for agents, sessions, tasks, projects
- Define AgentRepo/SessionRepo/TaskRepo/ProjectRepo interfaces
- Update handler to use repository interfaces instead of in-memory stores
- Add SSE broker with GET /api/events endpoint (text/event-stream)
- Add gateway client that polls OpenClaw for agent states
- Add GATEWAY_URL and GATEWAY_POLL_INTERVAL config fields
- Seed 5 demo agents (Otto, Rex, Dex, Hex, Pip) on empty DB
- Update router to wire SSE broker
- All 21 handler tests pass with mock repos
overseer added 1 commit 2026-05-08 21:55:40 -04:00
Merge branch 'dev' into agent/dex/CUB-123-gateway-integration
All checks were successful
Dev Build / build-test (pull_request) Successful in 2m22s
1a50306f7d
overseer merged commit 9a802b4212 into dev 2026-05-08 21:55:48 -04:00
overseer deleted branch agent/dex/CUB-123-gateway-integration 2026-05-08 21:55:49 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/Control-Center#37