v2.0.1: ACP dispatch + PTY fallback + worktree management

Phase 5 of v2.0. External agent dispatch via SSH to host.

ACP dispatch (acp-dispatch.ts): spawns agent via SSH with JSON-RPC
stdio pipe. Wraps opencode/goose in ACP mode. Captures structured
events (file operations, tool calls) mapped to parts taxonomy.
Falls back to PTY if ACP handshake fails.

PTY dispatch (pty-dispatch.ts): raw SSH spawn for agents without ACP
support (claude, pi). Captures stdout/stderr as plain text. Simpler
but less structured than ACP.

SSH helper (ssh.ts): shared spawn wrapper for SSH commands to
samkintop@100.114.205.53 (Tailscale IP, same as booterm). Uses
openssh-client installed in the runtime Dockerfile stage.

Worktree management (worktrees.ts): createWorktree (git worktree add
via SSH), diffWorktree (git diff HEAD...task-branch), cleanupWorktree
(git worktree remove --force). One worktree per task at
/tmp/booworktrees/<taskId>.

Dispatcher updated: checks available_agents.supports_acp to pick
transport. Path B flow: create worktree → dispatch agent → diff
worktree → queue diff into pending_changes → cleanup worktree →
mark task complete.

Agent probe updated: probes via SSH to find host-installed agents
(which opencode && opencode --version over SSH).

Dockerfile: openssh-client added to runtime stage.
Config: SSH_HOST env var (default 100.114.205.53).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-25 04:10:46 +00:00
parent 752ea74f43
commit 3d6055518b
10 changed files with 891 additions and 25 deletions

12
pnpm-lock.yaml generated
View File

@@ -48,6 +48,9 @@ importers:
apps/coder:
dependencies:
'@agentclientprotocol/sdk':
specifier: ^0.22.1
version: 0.22.1(zod@3.25.76)
'@boocode/server':
specifier: workspace:*
version: link:../server
@@ -268,6 +271,11 @@ importers:
packages:
'@agentclientprotocol/sdk@0.22.1':
resolution: {integrity: sha512-DfqXtl/8gO9NImq094MTaCXEU2vkhh6v7q/kT+9UjZxUqj8hYaya2OjLVIqn16MzNHcXEpShTR2RIauLSYeDQQ==}
peerDependencies:
zod: ^3.25.0 || ^4.0.0
'@ai-sdk/gateway@3.0.119':
resolution: {integrity: sha512-VAhfRWC+JexZakkVfmjaJKaTj00x7/UHdE8kMWL3NhuQAlf8oXtg9r4dfvFZrByXxchGRBvYE3biEUyibkg0xg==}
engines: {node: '>=18'}
@@ -4097,6 +4105,10 @@ packages:
snapshots:
'@agentclientprotocol/sdk@0.22.1(zod@3.25.76)':
dependencies:
zod: 3.25.76
'@ai-sdk/gateway@3.0.119(zod@3.25.76)':
dependencies:
'@ai-sdk/provider': 3.0.10