opencode: add the OpenCode sidecar (step 1 — serve lifecycle + port report)

New officer-opencode sidecar (same philosophy as officer-claude): a singleton that owns
an `opencode serve` running from DATA_PATH/opencode-sidecar (created if missing) on a
random port, registers with the API as capability 'opencode', and reports its port via a
new `opencode:server` protocol event. The API stores it (sidecar-server.ts, wired in
server.tsx via getOpenCodeServerUrl). ecosystem.config.cjs runs the sidecar instead of a
bare pm2 serve. Turn-running + API rewiring come in later steps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 13:43:57 +00:00
co-authored by Claude Opus 4.8
parent 6fb48af402
commit 203a8b0708
5 changed files with 141 additions and 11 deletions
+2
View File
@@ -41,6 +41,8 @@ export type SidecarEvent =
| { type: 'vnc:error'; id: string; error: string }
// Email
| { type: 'email:new'; userEmail: string }
// OpenCode — the sidecar reports where its `opencode serve` is listening (random port) on connect
| { type: 'opencode:server'; port: number }
// Generic
| { type: 'error'; id?: string; error: string };