Skip to content

feat: Phase 1 + Phase 2 - Registry, Discovery, Tasks, Routing, Streaming - #1

Merged
mmdverse merged 1 commit into
mainfrom
feat/phase1-registry
Sep 24, 2026
Merged

mmdverse merged 1 commit into
mainfrom
feat/phase1-registry

Conversation

@mmdverse

Copy link
Copy Markdown
Owner

Phase 1 + Phase 2 Implementation

Phase 1 - Agent Registry & A2A Discovery

  • SSRF protection in @agentmesh/core (security.ts) - blocks private IPs, metadata endpoints
  • Agent Card fetcher in @agentmesh/a2a-protocol (fetcher.ts) with timeout, validation, discovery URLs (direct, well-known, fallback)
  • Postgres initial migration (0000_phase0_init.sql) with full schema for all phases
  • Registry module: repository (InMemory default, Postgres when USE_POSTGRES=true), cache (Redis with in-memory fallback), service (CRUD, card fetch, health, heartbeat)
  • Discovery: LocalRegistry, DirectUrl, WellKnown, Manual, Composite providers
  • Control Plane routes: real CRUD for /v1/agents, /v1/agents/discover?skill=, /v1/agents/:id/card, heartbeat, health update
  • Gateway: registry-client (Redis + HTTP fallback), a2a-proxy with SSRF protection, /v1/agents discovery, /v1/route preview, /v1/a2a/:id/* proxy
  • Health-checker worker (TTL 120s, marks unhealthy if not seen)
  • Fix Redis adapter to fallback gracefully when Redis unavailable (no max retries error)

Phase 2 - Task Orchestration & Routing & Streaming

  • Task module: repository (InMemory + Postgres), service (create, get, list, transition, cancel, complete, fail, retry, history, delegation graph)
  • Task lifecycle: SUBMITTED -> WORKING -> COMPLETED/FAILED/CANCELED with append-only history
  • Control Plane tasks routes: real CRUD, /v1/tasks/:id/history, /v1/tasks/:id/graph, SSE streaming via /v1/tasks/:id/stream with event bus + polling fallback
  • Gateway tasks routes: proxy to control-plane, routing integration (create task with skill -> auto route via routing engine), SSE streaming proxy
  • Routing engine integration: gateway /v1/route and /v1/tasks with skill-based routing (capability_match, round_robin, etc.)
  • Tested: agent registration, discovery by skill, task creation, task lifecycle (SUBMITTED->WORKING->COMPLETED), gateway skill-based routing, delegation graph reconstruction

Build & Test

  • Build: 18 packages successful (turbo build)
  • Tested locally:
    • Control Plane: POST /v1/agents, GET /v1/agents, GET /v1/agents/discover?skill=code-review, GET /v1/agents/:id/card
    • Tasks: POST /v1/tasks, GET /v1/tasks/:id, POST /v1/tasks/:id/complete, GET /v1/tasks/:id/history, GET /v1/tasks/:id/graph
    • Gateway: GET /v1/agents (proxies to control-plane), POST /v1/route with skill, POST /v1/tasks with skill routing (auto selects agent)
    • SSE streaming endpoint ready (proxies to control-plane)

Notes

  • No LICENSE file per project policy - completely free for personal and commercial
  • Donation and final README deferred to v1.0 per request
  • InMemory repos default for Phase 1/2 to keep CI simple without requiring Postgres/Redis running, Postgres will be used in Phase 3+ with migrations
  • SSRF protection implemented in both control-plane and gateway
  • Event bus currently InMemory, will upgrade to NATS JetStream in Phase 3

Ready for review and merge to main.

Phase 1 - Agent Registry & A2A Discovery:
- Add SSRF protection in @agentmesh/core (security.ts) - blocks private IPs, metadata, etc.
- Add Agent Card fetcher in @agentmesh/a2a-protocol (fetcher.ts) with timeout, validation, discovery URLs
- Add Postgres initial migration (0000_phase0_init.sql) with full schema
- Implement Registry module: repository (InMemory + Postgres), cache (Redis with fallback), service (CRUD, card fetch, health)
- Implement Discovery: LocalRegistry, DirectUrl, WellKnown, Manual, Composite providers
- Implement Control Plane routes: real CRUD for /v1/agents, /v1/agents/discover, /v1/agents/:id/card, heartbeat, health
- Implement Gateway: registry-client (Redis + HTTP fallback), a2a-proxy with SSRF, /v1/agents discovery, /v1/route preview, /v1/a2a/:id/* proxy
- Add health-checker worker (TTL, marks unhealthy)
- Fix Redis adapter to fallback to in-memory when Redis unavailable (no max retries error)

Phase 2 - Task Orchestration & Routing & Streaming:
- Implement Task module: repository (InMemory + Postgres), service (create, get, list, transition, cancel, complete, fail, retry, history, delegation graph)
- Task lifecycle: SUBMITTED -> WORKING -> COMPLETED/FAILED/CANCELED with history append-only
- Implement Control Plane tasks routes: real CRUD, /v1/tasks/:id/history, /v1/tasks/:id/graph, SSE streaming via /v1/tasks/:id/stream
- Implement Gateway tasks routes: proxy to control-plane, routing integration (create task with skill -> auto route via routing engine), SSE streaming proxy
- Routing engine integration: gateway /v1/route and /v1/tasks with skill routing
- Tested: agent registration, discovery by skill, task creation, task lifecycle, gateway skill-based routing, delegation graph

Build: 18 packages successful, health endpoints ok, registry and tasks flow verified
@mmdverse
mmdverse merged commit 8273be0 into main Sep 24, 2026
1 of 2 checks passed
@mmdverse
mmdverse deleted the feat/phase1-registry branch September 24, 2026 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant