Add opencode2 support (dual-host plugin + sidebar status) - #3
prestonlogan wants to merge 1 commit into
Conversation
Single package entry dual-exports V1 server() and V2 setup(); the V1 pipeline runs unchanged via a V1-client shim (src/v2/). V2 adaptations: registry-based discovery, sessionless extraction via generate.text, helper sessions released (not deleted), explicit extract/consolidation models, both agents ship (extract hidden). Adds a Memory sidebar section and /memory-status via the ./tui entry and a read-only status RPC. 37 v2 tests, contract:v2 check, docs/opencode2.md.
|
Thanks for the thorough dual-host work — the shim-over-unchanged-pipeline approach, deny-first agents, and the honest I’m going to close this for now rather than merge it. That is not a reject of the approach. OpenCode 2 is still beta, with no public GA date, and I don’t want the PR sitting open indefinitely. This plugin is tightly coupled to host surfaces we don’t have stable V2 equivalents for yet: session list/discovery, session delete, config, and a pre-persist citation hook. The adapter has to fill those gaps with a process-local session list, helper sessions that cannot be deleted, and fallback to the session’s default models. Citations also stay in saved history, because V2 has no hook to strip them before persist. That’s reasonable against a frozen API; it’s expensive against On this tree it also isn’t V1-neutral, which is a merge blocker even aside from host churn:
I’d rather not ship that risk to existing 1.x users for a host that’s still moving. Please reopen when you think the V2 plugin API is stable enough to target (non-beta SDK; list/delete or a documented helper-session lifecycle; config; persist/citation hook). That’s your call. At that point the bar is:
|
|
@prestonlogan I revisited this after #4, checked the V2 implementation, and tested a small server plugin against Official non-beta I also need to qualify my earlier API assessment. Session listing, deletion and configuration reads exist in the public HTTP client, but they are not exposed directly through the server-plugin context. The restricted There is a workable path, but the updated PR needs to address the following:
Please test the packed artifact on supported V1 versions and a pinned V2 release. I’m no longer treating V2’s release status alone as a reason to keep this closed. The shared-pipeline approach still makes sense, provided its supported scope and remaining limitations are explicit. I also will point @jensenojs at this from #4 so the migration work is not duplicated. Keep in mind that this is still early days for V2 Plugins and not everything I wrote is set in stone. I am happy to be proven otherwise if you find faults with my assessments. |
Ports the plugin to opencode2 while keeping opencode 1.x support intact — no V1 behavior changes.
Dual-host design
server()and V2setup(); onlysrc/index.tstouched (4-line additive edit).src/v2/shim.ts).V2 adaptations (
docs/opencode2.md)parentIDbackfill keeps excluding subagent children.generate.text; consolidation via helper sessions switched to the memorize agent.codex-memory-*history.extract_model/consolidation_modelfall back to the session default — set them explicitly.memorize-extracthidden/unused, same as V1's skip-when-unused).Sidebar status
./tuientry: Memory section in the session sidebar (activity, global scope, last success, Codex import) +/memory-statuscommand, served by a read-only status RPC from the same snapshots asmemory_inspect.setup()must only claim slots (keymap.layerbelongs in slot components), no<Show>with element children directly under<box>, and the TUI bundle may import only@opencode/plugin/tui+solid-js+@opentui/solid.Verification
tests/v2-*.test.ts); full suite 385 pass,typecheck,build, V1smoke+contract, newcontract:v2— all green on this tree.