Promote OpenCode to first-class ContextRelay peer#123
Open
nillo wants to merge 4 commits into
Open
Conversation
Add OpenCode (headless-cli) as a coordinator-eligible peer alongside Claude and Codex, with full parity across type system, daemon routing, MCP tools, CLI commands, session lifecycle, backup system, and instructions. New files: - src/opencode-mcp.ts: MCP server with 16 tools for OpenCode - src/opencode-instructions.ts: coordinator-aware MCP instructions builder - src/opencode-adapter.ts: daemon WS transport adapter - src/cli/opencode.ts: ctxrelay opencode command - src/cli/opencode-mcp.ts: ctxrelay opencode-mcp install/remove/status/server - src/cli/trio.ts: ctxrelay trio (Claude + Codex + OpenCode launcher) - src/unit-test/opencode-mcp.test.ts, opencode-instructions.test.ts Modified (24 files): types, agents, config, agent-descriptors, agent-routing, control-protocol, daemon, claude-adapter (+3 tools), instructions, backup/triggers, session-participants, session/registry/policy/escalation, cli.ts, cli/coordinator/idle-eval/tui, 6 test files. tsc --noEmit: 0 errors bun test: 1074/1079 pass (5 pre-existing cli.test flag-check failures)
| const line = `[${new Date().toISOString()}] [${DISPLAY_NAME}OpenCode] ${msg}\n`; | ||
| process.stderr.write(line); | ||
| try { | ||
| appendFileSync(this.logFile, line); |
| @@ -0,0 +1,101 @@ | |||
| import { spawn } from "node:child_process"; | |||
| import { DISPLAY_NAME, PRIMARY_BIN } from "../branding"; | |||
| @@ -0,0 +1,187 @@ | |||
| import { execFileSync } from "node:child_process"; | |||
| import { randomUUID } from "node:crypto"; | |||
| import { buildInstanceEnv, resolveProjectInstance, type ProjectInstance } from "../instance"; | ||
| import { envValue } from "../env"; | ||
| import { StateDirResolver } from "../state-dir"; | ||
| import { SessionLedger } from "../session/ledger"; |
| @@ -0,0 +1,243 @@ | |||
| import { spawn, type ChildProcess } from "node:child_process"; | |||
| @@ -0,0 +1,243 @@ | |||
| import { spawn, type ChildProcess } from "node:child_process"; | |||
| import { createInterface } from "node:readline"; | |||
| import { appendFileSync } from "node:fs"; | ||
| import { StateDirResolver } from "./state-dir"; | ||
| import type { BridgeMessage } from "./types"; | ||
| import { createInstanceId, type ProjectInstance } from "./instance"; |
| import { DaemonLifecycle } from "./daemon-lifecycle"; | ||
| import { ConfigService } from "./config-service"; | ||
| import { DISPLAY_NAME } from "./branding"; | ||
| import { envInt, envValue } from "./env"; |
| stateDir: StateDirResolver, | ||
| ) { | ||
| super(); | ||
| const config = new ConfigService().loadOrDefault(); |
| @@ -0,0 +1,250 @@ | |||
| import { describe, expect, test } from "bun:test"; | |||
| import { OPENCODE_MCP_TOOLS, createOpenCodeMcpServer } from "../opencode-mcp"; | |||
| import { buildOpencodeMcpInstructions } from "../opencode-instructions"; | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Promotes OpenCode to a first-class ContextRelay peer alongside Claude and Codex. This wires OpenCode through CLI launch, MCP registration, daemon routing, named sessions, docs, instructions, and verifier coverage.
Changes
ctxrelay opencodeandctxrelay trio --session, and runtime-session-scoped backup state.shell-quoteto patched1.8.4so dependency audit does not pull the vulnerable1.8.3copy.Testing
bun run checkpassed after changelog and dependency override updates.tsc --noEmit1088source tests passed3example tests passedbun audit --audit-level=highpassed.git diff --checkpassed.opencodeConnected: true,opencodeReady: true, and OpenCode participantonlineNotes