Repository navigation
Conversation
Introduce an opt-in Bun sidecar for discovering, loading, and invoking OpenCode-style plugins while keeping failures isolated from the Rust application. Add regression coverage for ordering, errors, timeouts, stdout isolation, and process cleanup.\n\nRefs Blankeos#24
…bility # Conflicts: # src/ui/components/chat.rs
Hi @Blankeos i need your help to try out this PR, since it's successfully load opencode plugin like ponytail in my local build |
|
Thanks @yan-ad will definitely review it this week, thank you! Update (Sept4, 2026): Sorry it's taking some time, scope is kind of big and decisive, so I'm still planning some more. |
|
Resolved conflicts with upstream
Validation:
GitHub now reports this PR as |
|
Confidence: 2/5It builds, the new tests pass, and it merges cleanly. But I ran it end to end and found that the installer and the loader don't connect, one bad plugin disables all plugins, and the new hook API is never called by the app. It also rewrites the user's shared OpenCode config and has no trust model yet. Checks run (worktree of PR head
Confidence bumps:
SummaryThis adds opt-in OpenCode plugin support. Behind
The sidecar protocol and its regression tests are solid. The Rust side handles timeouts, hung plugins, exit mid-call and stdout isolation, and the tests prove those. The integration around it is not finished. Because it is a draft-style foundation, I'd treat it as an RFC rather than something to merge now. Mapflowchart TD
CLI["main.rs: 'plugin' subcommand + opt-in startup/shutdown"] --> INST["plugin/installer.rs: bun add + rewrite global opencode.jsonc"]
CLI --> HOST["plugin/mod.rs: PluginHost (JSON-lines RPC, timeouts)"]
HOST --> SIDE["plugin/sidecar.mjs: Bun sidecar loads plugins"]
HOST --> PROTO["plugin/protocol.rs"]
CFG["config/configuration.rs: plugin key, .opencode/plugin(s) discovery, plugin-shipped commands"] --> CLI
CFG --> APP["app.rs: plugin_specs, project_root"]
APP --> CLI
TESTS["tests/plugin_host_regression.rs"] -.-> HOST
FLAKY["test-only fixes: discovery, ollama, chat, question_dialog, mutation, remote"]
Start at Regressions
MigrationsNone needed. No DB, schema or config-format changes, but the PR adds a runtime dependency on Bun. The installer shells out to Before merging
|


Summary
.opencode/pluginand.opencode/pluginsCloses #24 once the remaining trust and production hook integration work is completed.
Current scope
This is intentionally opened as a draft. The host lifecycle is opt-in through:
The draft establishes the compatibility/runtime foundation and an end-to-end generic hook path. Before marking it ready, I plan to align with maintainer feedback on:
Architecture
Crabcode remains responsible for orchestration, permissions, UI, and process supervision. OpenCode-style Node plugins run in one persistent Bun sidecar per application lifecycle. The sidecar is loaded once and communicates with Rust over versioned JSON-lines RPC on stdio.
This avoids spawning a runtime per hook while keeping JavaScript crashes and hangs outside the Rust process.
Validation
cargo fmt --all -- --checkcargo checkcargo test— 1,155 passed, 0 failedcargo test config::configuration::tests:: -- --test-threads=1— 29 passedcargo test --test plugin_host_regression -- --test-threads=1— 6 passedcargo clippy --tests— succeeds (existing repository warnings remain)cargo clippy --test plugin_host_regression -- -D warningsFull-suite stability
The draft also removes pre-existing test nondeterminism encountered while validating the adapter:
The complete local suite is now fully green and remained green across three consecutive parallel runs.
Refs #24