fix(cursor): preserve SDK runtime chunks and helpers in packages - #12510
juliusmarminge merged 2 commits into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This change modifies production Cursor SDK loading and desktop packaging, including external dependency resolution and platform-native resources outside asar. It also adds a static-analysis diagnostic suppression, so the packaging and tooling effects warrant human review. You can add or adjust custom eligibility rules. Learn more. |
This comment has been minimized.
This comment has been minimized.
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: unavailable · PR result: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
Cursor catalog discovery failed before checking the API key because bundling relocated the SDK's computed import of
642.jsinto T3's server dist without shipping that chunk.Upgrade
@cursor/sdkfrom 1.0.22 to 1.0.31, the npm latest release at verification. Its Node ESM/CJS exports still load computed Webpack chunks, and rebundling 1.0.31 reproduces the same missing642.jserror. The new./bundledexport statically importsbun:sqlite, so it cannot replace the Node loader. The JS dependency closure is unchanged.Ship the complete SDK and its dependency closure through the shared runtime-external policy. Catalog, agent adapter, recording helper, and text generation use one
createRequireloader, which also works in Node SEA. Desktop staging places complete platform packages outside asar underresources/node_modules/@cursor; the SDK's argv-based lookup can then pass real paths tospawnand load its newly vendored tree-sitter native modules. Both hoisted and pnpm-isolated SDK layouts are handled.Verification:
116 focused tests pass across catalog, adapter, text generation, external dependency closure, isolated package smoke, and desktop packaging.
The new package smoke bundles the real loader, copies its installed dependency graph without checkout symlinks, clears inherited credentials, and calls
models.listandmewith explicitly empty keys. Both reach the expected local configuration error.Actual server bundle build, server/scripts typechecks, targeted lint, and formatting pass. Lint reports only three existing spread warnings.
With SDK 1.0.31 on macOS arm64, the same catalog smoke passed in an offline-staged production package, a Node 26.8.2 SEA executable, and an Electron asar. Before the change, the equivalent bundled call reproduced missing
642.js; after it, both catalog chunks load and reject the empty key locally.Real staged
rg --versionsucceeds.cursorsandboxis present with executable permissions. The staged tree-sitter and tree-sitter-bash native modules load and parse a shell command under both Node and Electron. Complete platform packages are excluded from the archive so they cannot shadow the real resource paths. Staging regression coverage includes vendored JS/native files and platform package metadata.With a user-authorized API key supplied through stdin, live
models.listandmecalls passed in Node, Node SEA, and Electron asar on macOS arm64 using the packaged production loader. Each runtime returned 39 models and a valid account response. The probe used an isolated temporary home that was removed afterward; no credential or account details are included in artifacts.Coverage limits: no agent generation sessions or sandboxed agent execution were tested. No full signed desktop installer or Windows/Linux runtime was launched. The pinned SDK supplies no native Windows arm64 helper package; this change does not add one. No browsers or dev servers were used. This is backend/packaging behavior, so screenshots do not apply.
Top of the requested two-PR stack; this diff contains only Cursor changes.
Model: GPT-6. Harness: Codex.