feat(#93): implement agent spawn via federation

Implements FED-010: Agent Spawn via Federation feature that enables
spawning and managing Claude agents on remote federated Mosaic Stack
instances via COMMAND message type.

Features:
- Federation agent command types (spawn, status, kill)
- FederationAgentService for handling agent operations
- Integration with orchestrator's agent spawner/lifecycle services
- API endpoints for spawning, querying status, and killing agents
- Full command routing through federation COMMAND infrastructure
- Comprehensive test coverage (12/12 tests passing)

Architecture:
- Hub → Spoke: Spawn agents on remote instances
- Command flow: FederationController → FederationAgentService →
  CommandService → Remote Orchestrator
- Response handling: Remote orchestrator returns agent status/results
- Security: Connection validation, signature verification

Files created:
- apps/api/src/federation/types/federation-agent.types.ts
- apps/api/src/federation/federation-agent.service.ts
- apps/api/src/federation/federation-agent.service.spec.ts

Files modified:
- apps/api/src/federation/command.service.ts (agent command routing)
- apps/api/src/federation/federation.controller.ts (agent endpoints)
- apps/api/src/federation/federation.module.ts (service registration)
- apps/orchestrator/src/api/agents/agents.controller.ts (status endpoint)
- apps/orchestrator/src/api/agents/agents.module.ts (lifecycle integration)

Testing:
- 12/12 tests passing for FederationAgentService
- All command service tests passing
- TypeScript compilation successful
- Linting passed

Refs #93

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-03 14:37:06 -06:00
parent a8c8af21e5
commit 12abdfe81d
405 changed files with 13545 additions and 2153 deletions

View File

@@ -25,7 +25,7 @@ Developer guides for contributing to Mosaic Stack.
- [Branching Strategy](2-development/1-workflow/1-branching.md)
- [Testing Requirements](2-development/1-workflow/2-testing.md)
- **[Database](2-development/2-database/)**
- Schema, migrations, and Prisma guides *(to be added)*
- Schema, migrations, and Prisma guides _(to be added)_
- **[Type Sharing](2-development/3-type-sharing/)**
- [Type Sharing Strategy](2-development/3-type-sharing/1-strategy.md)
@@ -33,8 +33,8 @@ Developer guides for contributing to Mosaic Stack.
Technical architecture and design decisions.
- **[Overview](3-architecture/1-overview/)** — System design *(to be added)*
- **[Authentication](3-architecture/2-authentication/)** — BetterAuth and OIDC *(to be added)*
- **[Overview](3-architecture/1-overview/)** — System design _(to be added)_
- **[Authentication](3-architecture/2-authentication/)** — BetterAuth and OIDC _(to be added)_
- **[Design Principles](3-architecture/3-design-principles/)**
- [PDA-Friendly Patterns](3-architecture/3-design-principles/1-pda-friendly.md)
@@ -59,21 +59,25 @@ Development notes and implementation details for specific issues:
## 🔍 Quick Links
### For New Users
1. [Quick Start](1-getting-started/1-quick-start/1-overview.md)
2. [Local Setup](1-getting-started/2-installation/2-local-setup.md)
3. [Environment Configuration](1-getting-started/3-configuration/1-environment.md)
### For Developers
1. [Branching Strategy](2-development/1-workflow/1-branching.md)
2. [Testing Requirements](2-development/1-workflow/2-testing.md)
3. [Type Sharing](2-development/3-type-sharing/1-strategy.md)
### For Architects
1. [PDA-Friendly Design](3-architecture/3-design-principles/1-pda-friendly.md)
2. [Authentication Flow](3-architecture/2-authentication/) *(to be added)*
3. [System Overview](3-architecture/1-overview/) *(to be added)*
2. [Authentication Flow](3-architecture/2-authentication/) _(to be added)_
3. [System Overview](3-architecture/1-overview/) _(to be added)_
### For API Consumers
1. [API Conventions](4-api/1-conventions/1-endpoints.md)
2. [Authentication Endpoints](4-api/2-authentication/1-endpoints.md)
@@ -112,6 +116,7 @@ Numbers maintain order in file systems and Bookstack.
### Code Examples
Always include:
- Language identifier for syntax highlighting
- Complete, runnable examples
- Expected output when relevant
@@ -143,14 +148,15 @@ Always include:
## 📊 Documentation Status
| Book | Completion |
|------|------------|
| Book | Completion |
| --------------- | ----------- |
| Getting Started | 🟢 Complete |
| Development | 🟡 Partial |
| Architecture | 🟡 Partial |
| API Reference | 🟡 Partial |
| Development | 🟡 Partial |
| Architecture | 🟡 Partial |
| API Reference | 🟡 Partial |
**Legend:**
- 🟢 Complete
- 🟡 Partial
- 🔵 Planned