Skip to content

Claude/review details 01 l eu yz2 h9o x1 ncj vj bbm7 we - #2

Merged
dundas merged 3 commits into
mainfrom
claude/review-details-01LEuYz2H9oX1NCJVjBbm7We
Nov 15, 2025
Merged

Claude/review details 01 l eu yz2 h9o x1 ncj vj bbm7 we#2
dundas merged 3 commits into
mainfrom
claude/review-details-01LEuYz2H9oX1NCJVjBbm7We

Conversation

@dundas

@dundas dundas commented Nov 15, 2025

Copy link
Copy Markdown
Owner

No description provided.

…tions

Implemented complete ADMP (Agent Dispatch Messaging Protocol) backend server
ready for Teleportation integration.

Features:
- Agent registration with Ed25519 keypair generation
- Heartbeat-based session management (60s interval, 5min timeout)
- Inbox operations (SEND, PULL, ACK, NACK, REPLY)
- Message leasing with visibility timeouts
- Signature verification for authenticated messaging
- Trust management (allowlist-based authorization)
- Background jobs for lease reclaim and message expiry
- Production-ready with Docker, health checks, structured logging

Architecture:
- src/utils/crypto.js - Ed25519 signing and verification
- src/storage/memory.js - In-memory storage (swappable with DB)
- src/services/agent.service.js - Agent lifecycle management
- src/services/inbox.service.js - Message delivery and processing
- src/middleware/auth.js - Authentication middleware
- src/routes/agents.js - Agent registration and heartbeat endpoints
- src/routes/inbox.js - Inbox operations endpoints
- src/server.js - Main server with background jobs

API Endpoints:
- POST /api/agents/register - Register new agent
- POST /api/agents/:id/heartbeat - Update heartbeat
- POST /api/agents/:id/messages - Send message (SEND)
- POST /api/agents/:id/inbox/pull - Pull message with lease (PULL)
- POST /api/agents/:id/messages/:mid/ack - Acknowledge (ACK)
- POST /api/agents/:id/messages/:mid/nack - Negative ack (NACK)
- POST /api/agents/:id/messages/:mid/reply - Reply to message
- GET /api/messages/:id/status - Get message status
- GET /api/agents/:id/inbox/stats - Get inbox statistics
- GET /api/stats - System-wide statistics

Deployment:
- Docker and docker-compose.yml for containerized deployment
- .env.example with all configuration options
- Health check endpoint at /health
- Graceful shutdown handling

Documentation:
- README.md with complete API documentation and examples
- examples/basic-usage.js demonstrating agent messaging workflow
- discovery/teleportation-mvp.md - Integration plan for Teleportation

Ready for:
- Teleportation session-to-agent mapping
- External agent messaging with handshake protocol
- Edge agent pattern for message filtering
- Production deployment

Refs: #1
Added webhook support so agents can receive messages via HTTP push instead
of polling, reducing latency and server load.

Features:
- Webhook URL registration during agent registration or via dedicated endpoint
- Automatic webhook delivery when messages arrive
- HMAC-SHA256 signature verification for webhook security
- Exponential backoff retry (3 attempts: 0s, 1s, 2s)
- Graceful fallback to polling if webhook delivery fails
- Webhook configuration endpoints (POST/GET/DELETE)

Implementation:
- src/services/webhook.service.js - Webhook delivery with retry logic
- src/services/agent.service.js - Webhook configuration methods
- src/services/inbox.service.js - Trigger webhook on message arrival
- src/routes/agents.js - Webhook configuration endpoints

API Endpoints:
- POST /api/agents/register - Now accepts webhook_url and webhook_secret
- POST /api/agents/:id/webhook - Configure webhook
- GET /api/agents/:id/webhook - Get webhook config
- DELETE /api/agents/:id/webhook - Remove webhook

Webhook Behavior:
- Messages pushed immediately to webhook URL (< 100ms latency)
- Payload includes message envelope and HMAC signature
- Retry with exponential backoff: 1s, 2s, 4s delays
- After 3 failed attempts, message stays queued for polling
- Non-blocking: webhook failures don't block message acceptance

Examples:
- examples/webhook-receiver.js - Complete webhook receiver implementation
- examples/webhook-push.js - Demo of webhook registration and push delivery

Documentation:
- README.md updated with:
  - Webhook configuration in agent registration
  - Webhook endpoints documentation
  - Complete webhook section with examples
  - Webhook payload format and headers
  - Retry behavior table
  - Webhook vs polling comparison
  - Best practices

Benefits:
⚡ Instant delivery (<100ms vs up to 60s polling)
📉 Lower latency for real-time agent communication
🔋 Reduced server load (no constant polling)
♻️ Automatic retry with exponential backoff
🛡️ Fallback to polling if webhook unavailable

Perfect for Teleportation integration - sessions can register webhook URLs
for instant message delivery instead of 60s polling interval.

Refs: #2
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.

2 participants