feat: rebuild the Cursor adapter for OpenCode V2 - #35
Open
CasualDeveloper wants to merge 2 commits into
Open
Conversation
CasualDeveloper
marked this pull request as draft
September 10, 2026 13:03
Reconstruct structured roles, tool outcomes, images, and reasoning from OpenCode's authoritative history. Preserve exact private-model selections while OpenCode owns tools, permissions, steering, persistence, and compaction. - Remove the previous-generation adapter, proxy, exports, dependencies, transport, tests, and documentation from the V2 compatibility channel. - Use bounded unary and per-Run HTTP/2 workers with validated Connect completion, cancellation, terminal checkpoint draining, and scoped cleanup. - Observe host tool lifecycles while forwarding results only from the next authoritative model invocation; retain bounded dependent-tool handoffs. - Keep aggregate Run usage in durable metadata and report per-call usage as unknown when a Run spans multiple host invocations. - Preserve signed and anchored opaque reasoning through forks and restart replay, retaining exact opaque data and placement without a second history. - Reinforce ordered global host instructions with an explicit host contract; full prompt replacement remains disabled and precedence is best effort. - Add pinned-host acceptance, offline live-runner checks, bounded opt-in probes, failure exports, and current release-acceptance documentation. Verified with npm run verify: 72 tests / 227 assertions, 11 capability tests, source and fixture typechecks, build, pinned-host acceptance, three offline runner cases, packed-package validation, and loader smoke. Live validation of instruction reinforcement, opaque replay, and sustained post-compaction work remains pending. This commit does not approve release. Refs otto-assistant#31
CasualDeveloper
force-pushed
the
feat/opencode-v2-host-owned-cursor
branch
from
September 10, 2026 18:11
4faffe5 to
341c781
Compare
CasualDeveloper
marked this pull request as ready for review
September 10, 2026 18:17
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.
Hey, @makeittech - was excited to try out Astra and I think it did a great job with our plugin!
Issue for this PR
Refs #31. Please keep it open through publication and release checks.
This branch includes #34, which should merge first. The adapter changes are in
341c781; I may need to rebase afterward.Type of change
What does this PR do?
I rebuilt the Cursor adapter for OpenCode V2 and removed the old proxy and compatibility code. It keeps private models and exact variants while OpenCode manages history, tools, permissions, and compaction.
Each new Cursor Run is built from OpenCode's messages and tool results, including images and reasoning data. This lets the host recover after a lost connection or restart without a second conversation store.
It also fixes usage reporting that could trigger compaction too early. Cursor Run totals are saved separately from per-call usage. Where per-call counts are unavailable, OpenCode's displayed token and cost totals remain incomplete.
How did you verify your code works?
Run
npm run verify. CI passed for341c781: 72 tests, 227 assertions, 11 offline capability tests, plus typechecks, build, package, and loader checks.The integration tests run OpenCode
0.0.0-beta-18050against a fake Cursor server. They exercise real tools, permissions, interruption, images, forks, reasoning replay after restart, and tool work after automatic compaction.Earlier live tests passed private-model tool use, images, and signed-reasoning restart. Composer did fail a conflicting-instruction test. The new priority rule, opaque-reasoning replay, and continued work after automatic compaction still need live verification. Instruction priority remains best effort.
The test report records the remaining limits and protocol results.
Checklist