Repository navigation
Resolve client version at runtime - #1
Merged
Merged
Conversation
oakimov
approved these changes
Jul 13, 2026
oakimov
left a comment
Owner
There was a problem hiding this comment.
Approving. Independently verified the test plan in a clean worktree: bun run typecheck clean, bun test → 214 pass / 0 fail, bun run build → exit 0.
What I checked beyond the plan:
- All references to the old
CURSOR_CLIENT_VERSIONare removed; bothbuildBaseHeaderscall sites are updated. - Every version source (env, cache, remote) is regex-validated before becoming a header, which blocks CRLF/header injection (covered by a test).
- The remote
cursor.com/installfetch sends no auth token — no secret leakage — and is bounded by a 5s abort. - The cache dir matches the existing
resolveModelCacheDir()convention, so the version cache lands next tocursor-models.json.
Minor notes (non-blocking, all documented behavior):
- Local installed build takes priority over the remote installer; fine today while there's no server-side currency check.
- Resolution is memoized for the process lifetime, so a long-lived provider won't re-resolve mid-session (acceptable; providers restart).
Nice, clean change. Thanks!
3 tasks done
nkoynov
added a commit
to nkoynov/cursor-opencode-provider
that referenced
this pull request
Oct 5, 2026
OpenCode moves the images an MCP tool returns into a trailing `Attached media from tool result:` user message. Since oakimov#34 that message no longer forces a fresh Run, so the held Run got the MCP result as text only and the model saw the image at the earliest after the next user message. The README gave the reason as "Cursor's exec-result channel has no image field", but agent.v1 has one: Cursor CLI 2026.10.01 declares `McpImageContent|1 data 12|2 mime_type 9` and `McpToolResultContentItem|1 text #0 content|2 image oakimov#1 content` in `agent/v1/mcp_exec_pb.js`, and its MCP executor appends every MCP `image` item as `{content: {case: "image", value: McpImageContent{data, mimeType}}}`. Declare the type and the oneof case, and append the images attributed to an `mcp_result` (the trailing-media path from the read-image change) as image items after the text, as the CLI does. Update the README and AGENTS.md: only results without an image field (shell, write) still wait for the history path.
oakimov
pushed a commit
to nkoynov/cursor-opencode-provider
that referenced
this pull request
Oct 7, 2026
OpenCode moves the images an MCP tool returns into a trailing `Attached media from tool result:` user message. Since oakimov#34 that message no longer forces a fresh Run, so the held Run got the MCP result as text only and the model saw the image at the earliest after the next user message. The README gave the reason as "Cursor's exec-result channel has no image field", but agent.v1 has one: Cursor CLI 2026.10.01 declares `McpImageContent|1 data 12|2 mime_type 9` and `McpToolResultContentItem|1 text #0 content|2 image oakimov#1 content` in `agent/v1/mcp_exec_pb.js`, and its MCP executor appends every MCP `image` item as `{content: {case: "image", value: McpImageContent{data, mimeType}}}`. Declare the type and the oneof case, and append the images attributed to an `mcp_result` (the trailing-media path from the read-image change) as image items after the text, as the CLI does. Update the README and AGENTS.md: only results without an image field (shell, write) still wait for the history path.
oakimov
pushed a commit
to nkoynov/cursor-opencode-provider
that referenced
this pull request
Oct 8, 2026
OpenCode moves the images an MCP tool returns into a trailing `Attached media from tool result:` user message. Since oakimov#34 that message no longer forces a fresh Run, so the held Run got the MCP result as text only and the model saw the image at the earliest after the next user message. The README gave the reason as "Cursor's exec-result channel has no image field", but agent.v1 has one: Cursor CLI 2026.10.01 declares `McpImageContent|1 data 12|2 mime_type 9` and `McpToolResultContentItem|1 text #0 content|2 image oakimov#1 content` in `agent/v1/mcp_exec_pb.js`, and its MCP executor appends every MCP `image` item as `{content: {case: "image", value: McpImageContent{data, mimeType}}}`. Declare the type and the oneof case, and append the images attributed to an `mcp_result` (the trailing-media path from the read-image change) as image items after the text, as the CLI does. Update the README and AGENTS.md: only results without an image field (shell, write) still wait for the history path.
oakimov
added a commit
that referenced
this pull request
Oct 8, 2026
* fix: deliver MCP tool images on the held Run as McpImageContent OpenCode moves the images an MCP tool returns into a trailing `Attached media from tool result:` user message. Since #34 that message no longer forces a fresh Run, so the held Run got the MCP result as text only and the model saw the image at the earliest after the next user message. The README gave the reason as "Cursor's exec-result channel has no image field", but agent.v1 has one: Cursor CLI 2026.10.01 declares `McpImageContent|1 data 12|2 mime_type 9` and `McpToolResultContentItem|1 text #0 content|2 image #1 content` in `agent/v1/mcp_exec_pb.js`, and its MCP executor appends every MCP `image` item as `{content: {case: "image", value: McpImageContent{data, mimeType}}}`. Declare the type and the oneof case, and append the images attributed to an `mcp_result` (the trailing-media path from the read-image change) as image items after the text, as the CLI does. Update the README and AGENTS.md: only results without an image field (shell, write) still wait for the history path. * fix: recognize OpenCode MCP media part shapes on held Runs Normalize host mime/uri and OpenCode 1 type:media tool parts before ReadSuccess/McpImageContent decode, and log continuation prompt-tail media counts for cache/live diagnosis. * fix: harden held-Run image attribution and result delivery --------- Co-authored-by: oakimov <[email protected]>
This was referenced Oct 17, 2026
oakimov
added a commit
that referenced
this pull request
Nov 6, 2026
analyzeReplayFrame reads an echo only from a frame validInteractionUpdateWire accepted, which already proved update #6 holds exactly one length-delimited user_message #1. appendedEcho checked that again, and its fallback branch could never run (Codecov: the one uncovered patch line). State the precondition instead, and cover an empty user_message.
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.
Problem
The provider sends a hardcoded
x-cursor-client-versionvalue. On 2026-07-14, Cursor's live endpoint required thecli-prefix and did not check build currency. The pinned value passed that gate. A future currency check would force users to wait for a provider release.Change
CURSOR_CLIENT_VERSION, installed cursor-agent builds, Cursor's installer, then the fallback constant.The resolver aborts installer requests after five seconds. Linux and macOS use
~/.local/share/cursor-agent/versions/for local discovery. Windows uses the environment, remote, cache, and fallback paths until Cursor documents a local versions directory.Follow-up
Live endpoint checks accepted requests without checksum and device-id headers. This PR leaves those headers unchanged; I can send that cleanup if useful.
Test plan
bun run typecheckbun test(214 pass)bun run build