-
Notifications
You must be signed in to change notification settings - Fork 16
feat: OpenCode agent component (ENG-100) #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: OpenCode agent component (ENG-100) #236
Conversation
Adds the new OpenCode agent component with configurable 'providerConfig'. Refactors common gateway token logic into a shared 'utils.ts' used by both AI Agent and OpenCode. Signed-off-by: betterclever <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a03de01336
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
worker/src/components/ai/opencode.ts
Outdated
| env: { | ||
| // OpenCode might need API keys. | ||
| // If the definition includes an API Key in the 'model' contract, we should pass it. | ||
| ...(model?.apiKey | ||
| ? { OPENAI_API_KEY: model.apiKey, ANTHROPIC_API_KEY: model.apiKey } | ||
| : {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forward API keys for non-OpenAI providers
The component accepts the shared LLMProviderSchema, which includes gemini and openrouter providers, but the container environment only forwards OPENAI_API_KEY/ANTHROPIC_API_KEY. When a user selects gemini or openrouter and supplies an API key in the model input, no provider-specific key is passed into the OpenCode container, so authentication will fail unless they manually duplicate it via providerConfig. This makes those providers effectively unusable despite being allowed by the contract.
Useful? React with 👍 / 👎.
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
- Add zai-coding-plan to LLMProviderSchema with apiKey and modelId support - Fix OpenCode component to use proper model format (provider/modelId) - Configure Z.AI provider with apiKey in provider.options - Fix MCP server config to use type: "remote" instead of transport: "http" - Remove unused env var API key handling in favor of provider config Co-Authored-By: Claude <[email protected]> Signed-off-by: betterclever <[email protected]>
- Use sh -c with properly quoted prompt string to handle multi-word prompts - Escape single quotes in prompt to prevent shell injection - Add current-state.md documenting investigation and findings - Add opencode E2E test Co-Authored-By: Claude <[email protected]> Signed-off-by: betterclever <[email protected]>
…er script - Remove --quiet flag (doesn't exist in opencode 1.1.34), use --log-level ERROR - Use wrapper script approach to handle prompt file reading inside container - Set entrypoint to /bin/sh to override default opencode entrypoint - Fix test assertions to check outputSummary.report instead of output.report - Update current-state.md with resolution details E2E tests now passing: 2 pass, 0 fail Co-Authored-By: Claude <[email protected]> Signed-off-by: betterclever <[email protected]>
…ided
When a custom systemPrompt is provided, the task was not being included
because the {{TASK}} placeholder only exists in the default template.
Now the task is always appended to ensure OpenCode receives the full prompt.
Co-Authored-By: Claude <[email protected]>
Signed-off-by: betterclever <[email protected]>
- Add optional baseUrl and headers properties to zai-coding-plan provider - Add zai-coding-plan to ModelProvider type in ai-agent.ts - This fixes TypeScript build errors when using the new provider Co-Authored-By: Claude <[email protected]> Signed-off-by: betterclever <[email protected]>
… d.ts files - Remove emitDeclarationOnly: true from worker/tsconfig.json - This allows TypeScript to emit both .js and .d.ts files - Fixes backend typecheck errors when importing from @shipsec/studio-worker/workflows - The worker still uses source files directly via bun, so .js files don't interfere Co-Authored-By: Claude <[email protected]> Signed-off-by: betterclever <[email protected]>
- Rename unused 'error' to '_error' in catch block to satisfy ESLint - Apply code formatting from linter to opencode.ts Co-Authored-By: Claude <[email protected]> Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
Signed-off-by: betterclever <[email protected]>
feat: MCP AWS servers and proxy (ENG-103) Consolidating the work in 1 PR from the stack
…nt-ui feat: tool mode UI + agent orchestration (ENG-101/102) Consolidating the work in one PR
561512b
into
eng-132/tool-mode-orchestration
ENG-100 — OpenCode Agent Component
Summary
What changed
worker/src/components/ai/opencode.ts.How it works (high level)
Testing
Notes
Refs: ENG-100