feat(cli): extend the OpenCode plugin to every documented context surface - #1487
Open
JCVIDev wants to merge 1 commit into
Open
feat(cli): extend the OpenCode plugin to every documented context surface#1487JCVIDev wants to merge 1 commit into
JCVIDev wants to merge 1 commit into
Conversation
…face The generated OpenCode adapter covered only the grep/glob graph lookup, so OpenCode sessions missed the read-coverage and lifecycle context other clients get through their hook configuration. Extend the plugin to the surfaces OpenCode documents: - unwrap hook-augment's additionalContext envelope so plain text, not raw JSON, lands in the tool output - post-read index-coverage notes via tool.execute.after, mapping OpenCode's filePath argument to the file_path key the default dialect reads - session-start tier routing injected once per sessionID on the first tool result, since OpenCode documents no context-output lifecycle hook - post-compaction reinjection through the documented experimental session.compacting surface (output.context) Every failure path resolves to the empty string: the adapter can degrade to a no-op but never blocks a tool call. Pin the new surfaces in test_agent_clients (31/31 pass; the DeusData#616 payload guard stays green) and record the wider surface in the README client matrix. Signed-off-by: jc <jcvi007@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
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.
Summary
OpenCode is the closest client to Claude-parity for models CBM has no first-party hook dialect for (DeepSeek, etc.): it already gets MCP + the skill + the three read-only agents, but its generated plugin only covered one of the four context surfaces other clients get through hook configuration. This PR extends
cbm_client_adapter_opencode()so the generatedcbm-augment.tscovers every surface OpenCode documents — and nothing it doesn't:hook-augmentand unwrapshookSpecificOutput.additionalContextinstead of pasting the raw Claude JSON envelope into the tool output.readindex-coverage notes:tool.execute.afterforreadmaps OpenCode'sfilePatharg to thePostToolUse/Readeventhook-augmentalready accepts.SessionStartnote is carried on the first tool result of each session (deduped persessionID).experimental.session.compactinghook, appending to the mutableoutput.contextarray.Every path stays fail-open (all failures resolve to
''; context is only ever appended), consistent with the hook-augment contract, and the plugin body remains marker-free socbm_text_upsert_managed_blockowns the lifecycle (regenerated on install/update, per the #616 lesson).Why only these surfaces
Checked against the published OpenCode plugin docs:
tool.execute.before/after, theeventbus, andexperimental.session.compactingare the documented context-capable hooks; there is nochat.message-style hook. Per CBM policy the generator does not invent undocumented vendor surfaces, so session-start context rides on the first tool result rather than a fabricated lifecycle hook.Testing
client_adapter_opencode_covers_lifecycle_read_and_compactionpins the four surfaces (SessionStart lifecycle, PostToolUse/Read withfile_pathmapping, compaction hook,additionalContextunwrap, per-session dedup).client_adapter_opencode_sends_the_required_hook_eventstill passes unchanged (PreToolUse event,tool.execute.after, noregisterTool, no markers in the body).agent_clientssuite: 31/31 inside a fullscripts/test.shrun; the emitted JS also validated standalone withnode --check.mainwithout this change.README's OpenCode matrix row updated to describe the four surfaces.
🤖 Generated with Claude Code