feat(agents): AgentDispatchPort domain interface #514

Closed
opened 2026-04-28 09:24:12 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a flow-graph or webhook author, I want a single domain port to dispatch agent work, so that I can request an agent without knowing about Docker, the Claude SDK, or MCP server wiring.

Acceptance criteria

Port shape

  • New file apps/server/src/domain/ports/agent-dispatch-port.ts exports AgentDispatchPort interface
  • Methods (minimum):
    • dispatch(req: AgentDispatchRequest): Promise<AgentDispatchHandle>
    • steer(taskId: string, message: string): Promise<void>
    • kill(taskId: string, reason?: string): Promise<void>
    • status(taskId: string): Promise<AgentDispatchStatus | null>
  • AgentDispatchRequest carries: agentType, repo (forge+owner+name), issueOrPr, prompt, forgeToken?, resumeSessionKey?, metadata
  • AgentDispatchHandle carries: taskId, worker, containerId?, sessionKey
  • No SDK types (SDKMessage, Options) in the port file
  • No Docker types (DockerExecArgs, container names) in the port file

Tests

  • Type-only tests: import the port, build a fake adapter, assert call shapes compile
  • No runtime tests yet — concrete impl is in a later issue

Out of scope

  • Concrete implementation (DefaultAgentDispatch) — separate issue
  • Adapter wiring for ContainerLifecyclePort / McpRegistryPort — separate issues
  • Migrating callsites — separate issue

References

  • Tracking: [Meta] Hexagonal: AgentDispatchPort migration
  • domain/ports/forge-port.ts is the analogue precedent
  • domain/agent/claude-port.ts shape we are wrapping
## User story As a flow-graph or webhook author, I want a single domain port to dispatch agent work, so that I can request an agent without knowing about Docker, the Claude SDK, or MCP server wiring. ## Acceptance criteria ### Port shape - [ ] New file `apps/server/src/domain/ports/agent-dispatch-port.ts` exports `AgentDispatchPort` interface - [ ] Methods (minimum): - [ ] `dispatch(req: AgentDispatchRequest): Promise<AgentDispatchHandle>` - [ ] `steer(taskId: string, message: string): Promise<void>` - [ ] `kill(taskId: string, reason?: string): Promise<void>` - [ ] `status(taskId: string): Promise<AgentDispatchStatus | null>` - [ ] `AgentDispatchRequest` carries: `agentType`, `repo` (forge+owner+name), `issueOrPr`, `prompt`, `forgeToken?`, `resumeSessionKey?`, `metadata` - [ ] `AgentDispatchHandle` carries: `taskId`, `worker`, `containerId?`, `sessionKey` - [ ] No SDK types (`SDKMessage`, `Options`) in the port file - [ ] No Docker types (`DockerExecArgs`, container names) in the port file ### Tests - [ ] Type-only tests: import the port, build a fake adapter, assert call shapes compile - [ ] No runtime tests yet — concrete impl is in a later issue ## Out of scope - Concrete implementation (`DefaultAgentDispatch`) — separate issue - Adapter wiring for ContainerLifecyclePort / McpRegistryPort — separate issues - Migrating callsites — separate issue ## References - Tracking: `[Meta] Hexagonal: AgentDispatchPort migration` - `domain/ports/forge-port.ts` is the analogue precedent - `domain/agent/claude-port.ts` shape we are wrapping
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#514
No description provided.