Skip to content

feat(agents): add opencode CLI agent plugin#62

Open
Meirtz wants to merge 2 commits into
Agentix-Project:masterfrom
Meirtz:feat/agent-opencode
Open

feat(agents): add opencode CLI agent plugin#62
Meirtz wants to merge 2 commits into
Agentix-Project:masterfrom
Meirtz:feat/agent-opencode

Conversation

@Meirtz
Copy link
Copy Markdown
Collaborator

@Meirtz Meirtz commented May 29, 2026

What

plugins/agents/opencodeagentix.agents.opencode, a sandbox-side wrapper around the opencode terminal coding agent, following the claude-code plugin shape.

  • 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 (e.g. an OpenAI-compatible base URL from the in-sandbox bridge), per the integrate-an-agent guide.
  • 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 → stock autoPatchelfHook, and libstdc++ placed on LD_LIBRARY_PATH for opencode's dlopen'd @parcel/watcher native 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 check
  • pyright (0 errors, full include set; opencode wired into [tool.pyright])
  • uv lock — additive only (Added agentix-agent-opencode, no downgrades)
  • default.nix build validated end-to-end: agentix build plugins/agents/opencode --platform linux/arm64 builds the bundle (nix builds the derivation, fetches + autoPatchelfs the binary).
  • ⚠️ unit test — present (tests/test_opencode.py: argv/env/timeout) but not run in CI: the agentix.agents.* namespace only imports from a built bundle, not the editable venv (same as the existing agent plugins).

Wired into [tool.uv.workspace] (via the plugins/agents/* glob) and [tool.pyright].

Meirtz and others added 2 commits May 30, 2026 03:03
`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>
@Meirtz Meirtz marked this pull request as ready for review May 29, 2026 19:38
@Meirtz
Copy link
Copy Markdown
Collaborator Author

Meirtz commented May 29, 2026

Validated: agentix build plugins/agents/opencode --platform linux/arm64 completed successfully (exit 0) — nix builds the derivation, fetches + autoPatchelf's the opencode binary, and the bundle exports cleanly. Marking ready for review.

@Meirtz Meirtz changed the title feat(agents): add opencode CLI agent plugin (draft — needs nix-build validation) feat(agents): add opencode CLI agent plugin May 29, 2026
@FatPigeorz
Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts in this pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants