feat(agents): add opencode CLI agent plugin#62
Open
Meirtz wants to merge 2 commits into
Open
Conversation
`plugins/agents/opencode` → `agentix.agents.opencode`, a sandbox-side wrapper around the opencode terminal coding agent (mirrors `agentix.agents.claude_code`): - `run(instruction, *, workdir, timeout, model, extra_args, env) -> Result` invokes `opencode run` non-interactively and returns exit_code/stdout/stderr. Provider-agnostic — the caller wires the LLM endpoint via `env`/`extra_args`. - `default.nix` ships the `opencode` binary on `/nix/runtime/bin`. The derivation is lifted from numtide/llm-agents.nix (packages/opencode, v1.15.12) and adapted to plain nixpkgs (wrapBuddy -> autoPatchelfHook; libstdc++ on LD_LIBRARY_PATH for the dlopen'd @parcel/watcher addon). - deps = `agentixx` only (binary via Nix), so the workspace lock gains one additive entry and no version changes. Verified: ruff, pyright (0 errors), `uv lock` additive-only. NOT verified locally: the `default.nix` build (no nix in my env) and the unit test (the `agentix.agents.*` namespace only imports from a real bundle, not the editable workspace) — hence draft; please validate the build in your nix environment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Select x86_64-linux / aarch64-linux from a platformMap (both hashes from upstream llm-agents.nix). Validated end-to-end: `agentix build plugins/agents/opencode --platform linux/arm64` builds the bundle (nix builds the derivation, fetches + autoPatchelf's the binary) — so the nix caveat in the previous commit is resolved. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Validated: |
Collaborator
|
@copilot resolve the merge conflicts in this pull request |
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.
What
plugins/agents/opencode→agentix.agents.opencode, a sandbox-side wrapper around the opencode terminal coding agent, following theclaude-codeplugin shape.run(instruction, *, workdir, timeout, model, extra_args, env) -> Resultinvokesopencode runnon-interactively and returnsexit_code/stdout/stderr. Provider-agnostic — the caller wires the LLM endpoint viaenv/extra_args(e.g. an OpenAI-compatible base URL from the in-sandbox bridge), per the integrate-an-agent guide.default.nixships theopencodebinary on/nix/runtime/bin. The derivation is lifted fromnumtide/llm-agents.nix(packages/opencode, v1.15.12) and adapted to plain nixpkgs:wrapBuddy→ stockautoPatchelfHook, andlibstdc++placed onLD_LIBRARY_PATHfor opencode's dlopen'd@parcel/watchernative addon. Multi-platform (x86_64 + aarch64), both hashes from upstream.dependencies = ["agentixx"]only — the binary comes via Nix, so the workspace lock gains one additive entry with zero version changes (no pollution).Verification
ruff checkpyright(0 errors, full include set; opencode wired into[tool.pyright])uv lock— additive only (Added agentix-agent-opencode, no downgrades)default.nixbuild validated end-to-end:agentix build plugins/agents/opencode --platform linux/arm64builds the bundle (nix builds the derivation, fetches +autoPatchelfs the binary).tests/test_opencode.py: argv/env/timeout) but not run in CI: theagentix.agents.*namespace only imports from a built bundle, not the editable venv (same as the existing agent plugins).Wired into
[tool.uv.workspace](via theplugins/agents/*glob) and[tool.pyright].