Repository navigation
feat(cursor)!: run cursor through the official @cursor/sdk - #96
Merged
Merged
Conversation
The cursor runtime now embeds Cursor's own SDK (`@cursor/sdk` 1.0.35, a dependency of this package) and runs the agent in the host process, the way pi does; the cursor-agent ACP path is gone. - A session is one local SDK agent (`agent-<uuid>`); a turn is one run, from `send` to `run.wait()`'s status. Every onDelta update is one frame. - Steer is `run.steer`, accepted once cursor took the text; a hand back or a run that ends first leaves the input with the caller. The echo is a `user_message` event. - Abort is `run.cancel`; queue is held here and sent as the next run. - Per-run token usage (cache reads and writes counted as input). - A subagent's updates arrive inside its `task` call and carry `agentPath = [taskCallId]` (tier `attributed`). - Models from `Cursor.models.list()`; effort is the model's own reasoning parameter, checked against its menu because the SDK passes unknown values through. Resume without a model reopens the latest run's model. - systemPrompt and SessionOptions.env are refused: the SDK breaks the first and has no channel for the second. - OAR points the SDK at its native companion package, which it cannot find under pnpm or in a bundle. - Shared ACP code that only served cursor-agent (vendor requests, carried session updates, client capability meta, the switch versus menu effort rule) is removed. Live contract on a real login: 12 of 12 applicable scenarios pass. BREAKING CHANGE: cursor sessions opened through cursor-agent cannot be resumed, cursor needs `CURSOR_API_KEY` or `Cursor.auth.login()`, and cursor has no update check or upgrade. Co-Authored-By: Claude Opus 5.5 <[email protected]>
xxchan
force-pushed
the
feat/cursor-sdk
branch
from
October 3, 2026 10:32
2b59e54 to
bce593b
Compare
Review of #96, verified live where it touches the SDK: - A resumed agent whose store still holds an unfinished run (a process that died mid run, a session closed before its first prompt) refused every send with "already has active run". The first send after a resume now passes the SDK's `local.force`; probed both cases, both answer. - `send` has a 60 second deadline, and dispose gives up a send still on its way; a run the SDK returns after either is cancelled and its end recorded. - Each send is its own launch object, so a run that ends at once can no longer let one start clear another's pending send or held abort. - An effort keeps the model's other parameters from the catalog's default variant (a `thinking` switch stays on beside an `effort` level; probed on claude-opus-5). - A shell exit with a signal is `exitCode: null`; a shell that printed nothing reports one empty text part. - The SDK is pinned exactly: its behavior here is pinned by probes. - Docs: resume takeover, send deadline, nesting the SDK schema forbids, run usage on the root, cursor in the exit code, effort, evidence and steer delivery tables, crew children need `env` (cursor cannot be one). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
xxchan
added a commit
that referenced
this pull request
Oct 3, 2026
Minor release, version bump only. - #96: cursor runs through the official `@cursor/sdk` 1.0.35 in process. Breaking for cursor: sessions opened through cursor-agent cannot be resumed, cursor signs in with `CURSOR_API_KEY` or `Cursor.auth.login()`, and cursor has no update check or upgrade. `SessionOptions.systemPrompt` and `env` are refused for cursor. - #95: `classifyTool` reads codex `sleep` as the new `wait` kind with its `durationMs`; hosts that switch exhaustively on `ToolActionKind` need a `wait` case. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: exe.dev user <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
cursornow runs through Cursor's official SDK,@cursor/sdk1.0.35, inside the host process (the way pi runs). The cursor-agent ACP path is removed, along with the shared ACP code that only it used. Owner decision: in Raft #new-runtimes ("switch directly"), with downstream switching at the same time and no compatibility with the old adapter.What changes
agent-<uuid>);resumeisAgent.resumein the samecwd. Resume without a model reopens the model of the agent's latest run (the SDK does not restore it, and refuses a send without one).send, ended byrun.wait()'s status (finished, cancelled, error). EveryonDeltaupdate is one frame (text-delta,thinking-delta,tool-call-started/completed,user-message-appended,turn-endedwith usage, bookkeeping kinds with no events).run.steer. It is accepted once cursor took the text. If cursor hands it back, or the run ends first, it is rejected and the caller keeps the input. The echo is auser_message(evidenceconversation, no input id).run.cancel, including an abort that lands beforesendreturned the run.tool-call-delta {callId, taskUpdate}is the child's update, recorded withagentPath = [taskCallId], one level per nested task (tierattributed).Cursor.models.list(). Effort is the model's own reasoning parameter (effort,reasoning,reasoning_effort, else thethinkingswitch). It is checked against that menu, because the SDK passes unknown values through unchecked.systemPromptandappendSystemPrompt(a local agent's run fails withunknown option '--system-prompt'), andenv(no per-agent environment; so cursor cannot be a crew child yet).@cursor/sdk-<platform>-<arch>. The SDK looks for that package by walking up from the host's entry script, which fails under pnpm and in bundles, and it then warns that tree-sitter is unavailable.bundledand versionless; there is no check or upgrade.classifyToollearns cursor's tool names. The auth classifier readsInvalid User API Key.runtime-versions.tsreads the SDK's npm version.extensionRequests,vendorSessionUpdatesandvendor-updates.ts,clientCapabilitiesMeta, the switch versus menu effort rule, and the effort re-read after a model switch. Grok, kimi and antigravity are unchanged.Breaking
CURSOR_API_KEYorCursor.auth.login(), not the CLI login.checkUpdateorupgrade.Evidence
experiments/live-contract.ts cursor(gpt-5.4-nano, linux x64): basic, multi-turn, tool-detail, busy-and-late-control, steer, queue, abort, dispose-mid-turn, cursor, resume, subagent and bad-model pass; kill-runtime does not apply (in process).tests/cursor/(a stand-in SDK for the session, plus recorded updates for the projection and models).pnpm run typecheck,pnpm run lintandnpx vitest runpass (546 passed).🤖 Generated with Claude Code