Skip to content

fix: update the V2 adapter for Cursor SDK 1.4.1 - #36

Open
CasualDeveloper wants to merge 1 commit into
otto-assistant:betafrom
CasualDeveloper:fix/cursor-sdk-1.0.37-compat
Open

CasualDeveloper wants to merge 1 commit into
otto-assistant:betafrom
CasualDeveloper:fix/cursor-sdk-1.0.37-compat

Conversation

@CasualDeveloper

@CasualDeveloper CasualDeveloper commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

I updated the V2 adapter from #35 against the Cursor SDK 1.4.1 wire schema. This includes the earlier 1.0.37 compatibility changes. Both workers and the capability probes now send cli-2026.11.17-f532c45.

Issue for this PR

Refs #31.

Type of change

  • Bug fix

What does this PR do?

  • Keep Cursor notices out of conversation history. TextDeltaUpdate.is_server_notice distinguishes a server notice (such as a model fallback) from assistant text. The adapter reports it in providerMetadata.cursor.serverNotice and as a doGenerate warning without replaying it. OpenCode doesn't currently display the warning for streamed responses.
  • Finish valid Runs without mistaking metadata for output. Cursor can send presentation updates and telemetry after turnEnded. The adapter recognizes the known fields, including thinking notes, voice utterances, per-model-call usage, and time-to-first-token telemetry. Per-call counts aren't added to the turn totals. Unknown terminal updates and incomplete streams still fail.
  • Preserve tool restrictions. The adapter declines unsupported Cursor-hosted requests such as PR management and MCP authentication. If a native write requires plan mode, workspace confinement, or a check for changes since Cursor read the file, the adapter sends a rejected write result instead of forwarding a plain OpenCode write that cannot enforce the restriction.
  • Remove duplicate model aliases. When a GetUsableModels family points entirely to wire IDs already listed by AvailableModels, the picker keeps the authoritative family. This addresses the duplicate Claude Opus 4.6 1M entry with conflicting context windows.
  • Improve stream and login diagnostics. The Run worker advertises gzip. On a partial-frame EOF it reports declared and received payload sizes, completed frame count, and whether turnEnded and a final checkpoint arrived. Browser login rejects incomplete token pairs and reports the last poll outcome on timeout without logging response bodies.

How did you verify your code works?

  • npm test: 108 passed. npm run test:cursor-capability: 11 passed. npm run typecheck: passed.
  • With a User API key exchanged for an access token, I compared the January and November headers. Each returned a complete 28-model catalog. In one short Composer 2.5 Run per header, the model called a synthetic tool once, returned its exact random value, and closed the stream cleanly.
  • I repeated the November check with a fresh browser OAuth login using the plugin source. Polling went from HTTP 404 to 200; catalog discovery and the same tool check passed. The Run took 6.9 seconds.

Still open: These checks cover fresh login, not renewal of an expired browser credential. They also don't resolve the long-conversation EOF: earlier Runs closed partway through a roughly 36 KB frame before turnEnded; the new diagnostics don't treat that as success. The fallback-notice regression uses a synthetic flagged message. I haven't repeated the full npm run verify on this revision because rebuilding dist reloads the active plugin.

Checklist

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

@CasualDeveloper
CasualDeveloper force-pushed the fix/cursor-sdk-1.0.37-compat branch from e5e386d to f32d68c Compare October 15, 2026 20:48
@CasualDeveloper
CasualDeveloper force-pushed the fix/cursor-sdk-1.0.37-compat branch from f32d68c to d916d20 Compare November 18, 2026 09:04
@CasualDeveloper CasualDeveloper changed the title fix: track Cursor SDK 1.0.37 protocol and catalog fix: update the V2 adapter for Cursor SDK 1.4.1 Nov 18, 2026
Keep server notices out of assistant history, ignore known presentation
and usage updates after turnEnded, and decline hosted requests and native
writes whose restrictions the host cannot enforce. Deduplicate model
families that refer to the same wire IDs.

Use the November CLI header for Run and catalog requests and advertise
gzip for streams. Report truncated frames without accepting early EOF.
Validate browser login token pairs and include the last poll outcome on
timeout.

Refs otto-assistant#31
@CasualDeveloper
CasualDeveloper force-pushed the fix/cursor-sdk-1.0.37-compat branch from d916d20 to 7853940 Compare November 18, 2026 10:27
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