Skip to content

feat: rebuild the Cursor adapter for OpenCode V2 - #35

Open
CasualDeveloper wants to merge 2 commits into
otto-assistant:betafrom
CasualDeveloper:feat/opencode-v2-host-owned-cursor
Open

feat: rebuild the Cursor adapter for OpenCode V2#35
CasualDeveloper wants to merge 2 commits into
otto-assistant:betafrom
CasualDeveloper:feat/opencode-v2-host-owned-cursor

Conversation

@CasualDeveloper

@CasualDeveloper CasualDeveloper commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

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

  • New feature
  • Refactor / code improvement

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 for 341c781: 72 tests, 227 assertions, 11 offline capability tests, plus typechecks, build, package, and loader checks.

The integration tests run OpenCode 0.0.0-beta-18050 against 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

  • I have tested my changes locally.
  • I have not included unrelated changes in this PR.

@CasualDeveloper
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
CasualDeveloper force-pushed the feat/opencode-v2-host-owned-cursor branch from 4faffe5 to 341c781 Compare September 10, 2026 18:11
@CasualDeveloper CasualDeveloper changed the title feat: rebuild Cursor V2 adapter around host-owned history feat: replace beta with a V2-only host-owned Cursor adapter Sep 10, 2026
@CasualDeveloper
CasualDeveloper marked this pull request as ready for review September 10, 2026 18:17
@CasualDeveloper CasualDeveloper changed the title feat: replace beta with a V2-only host-owned Cursor adapter feat: rebuild the Cursor adapter for OpenCode V2 Sep 10, 2026
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.

1 participant