feat: Add agent field to workflow steps for OpenCode --agent flag #47
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
This PR enhances OpenCode integration in CodeMachine with two major features:
1. Agent Field for Workflow Steps
Adds
agentfield to workflow step configuration, enabling steps to specify which OpenCode agent to use via the--agentflag.2. Consolidated Server Mode (Experimental)
Enables workflow steps to share a single OpenCode server instance, avoiding MCP cold boot times between steps.
New capabilities:
startOpenCodeServer()- starts server on random port with health pollingattachToExternalServer()- connects to existing external servercheckServerHealth()/listServerAgents()- server introspection--attachflag foropencode runcommand--opencode-server/--opencode-attachCLI flags forcodemachine startCLI Usage:
Files Changed
src/workflows/templates/types.tsagent,attach,opencodeServer,opencodeAttachfieldssrc/infra/engines/core/types.tsagent,attachtoEngineRunOptionssrc/agents/runner/runner.tsagent,attachtoExecuteAgentOptionssrc/infra/engines/providers/opencode/execution/server.tssrc/infra/engines/providers/opencode/execution/commands.tsattachoption,buildOpenCodeServeCommand()src/infra/engines/providers/opencode/execution/runner.tsattachoption passthroughsrc/workflows/execution/step.tsagentandattachtoexecuteAgent()src/workflows/execution/workflow.tssrc/cli/commands/start.command.ts--opencode-serverand--opencode-attachflagstests/integration/opencode/server.test.tsTesting