Repository navigation
fix(cursor): the server runs without @cursor/sdk installed - #162
Merged
Merged
Conversation
@cursor/sdk is proprietary ("All rights reserved"), so apps that bundle
the Lecturn server need to be able to leave it out. sdk.ts required it at
module load, so the server crashed at startup when it was missing.
The CursorSdk service now loads the SDK on first use. Only
MODULE_NOT_FOUND for @cursor/sdk itself becomes CursorSdkNotInstalledError;
any other load failure still surfaces as a defect. The status check reports
Cursor as not installed through the normal provider status path, and the
runner, text generation, sign-in and catalog fail with the same message.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The runner wrapped CursorSdkNotInstalledError in its generic "agent.create failed" error, and turn start recorded that instead of the reason. The adapter now unwraps it, so the recorded message names the missing SDK. Sign-in and text generation use the fixed not-installed text for `detail` instead of copying cause.message. A subprocess test makes @cursor/sdk unresolvable before the provider loads, so an eager SDK import or require anywhere in the provider fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
packages/provider-cursor/src/server/sdk.tsrequired@cursor/sdkwhen the module loaded, and the server imports it statically, so the server crashed at startup whenever the package was missing.@cursor/sdkis proprietary ("All rights reserved", use subject to Cursor's ToS), so apps that bundle the Lecturn server, such as RocketWright's sidecar, need to be able to leave it out of their release builds.Fix
CursorSdkservice now exposesload, whichrequires the SDK the first time Cursor is actually used and caches it.sdk.tsis gone; type-only imports are unchanged.MODULE_NOT_FOUNDfor@cursor/sdkitself becomesCursorSdkNotInstalledError. A missing dependency inside an installed SDK, or any other load failure, still surfaces as a defect.checkCursorProviderStatusreports Cursor asinstalled: false,status: "error"with "Cursor SDK (@cursor/sdk) is not installed with this Lecturn server.", the same way a provider with a missing CLI reports. The runner, text generation, browser sign-in and catalog fail with that message instead of crashing.ConfigurationErrorby thenamethe SDK sets, because the class is no longer imported up front. Sign-in and text generation use the same fixed text fordetail.Lecturn still depends on and ships
@cursor/sdk, so nothing changes when it is installed. There is no feature flag.Verification
CursorSdk.test.tsmakes@cursor/sdkunresolvable before the provider loads, imports the provider entry, and checks that the real loader reports not installed. It fails if an eager require or import comes back.adapter.test.tschecks that a turn start without the SDK records the not-installed message.CursorSdk.test.tsalso checks that only a missing@cursor/sdkcounts as not installed and a missing nested dependency dies.status.test.tschecks that the provider reports not installed through an injected loader that throwsMODULE_NOT_FOUND.ProviderInstanceRegistry.test.tschecks that with the SDK absent, Cursor reports not installed while a Codex instance beside it still probesready.CursorSdk.test.tsneed that cwd, unchanged by this PR).ProviderInstanceRegistry.test.ts11/11 andscripts/lib/cursor-sdk-packaging.test.tspass. The packaging test's probe now loads throughCursorSdk.layer.tsc-rs --noEmitis clean forpackages/provider-cursor,apps/serverandscripts.vp linton the touched files raises no new warnings.knip --exportsfor provider-cursor and apps/server is clean.packages/provider-cursor/node_modules/@cursor/sdk.apps/server/src/server.tsthen imports cleanly, and the liveCursorSdk.layerreturnsCursorSdkNotInstalledErrorusing Node's realCannot find module '@cursor/sdk'error. With the same setup, origin/main'ssdk.tsthrows on import.Written by Claude Opus 5.5 (claude-opus-5-5) in Claude Code.
🤖 Generated with Claude Code


Confidence Score: 5/5 
The PR appears safe to merge; all previous findings are addressed and no new actionable issues remain.Summary
Defers loading
@cursor/sdkuntil Cursor is used, so leaving it out no longer breaks server imports.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Import Cursor provider"] --> B["Define services without loading SDK"] C["Use Cursor"] --> D["CursorSdk.load"] D --> E{"Load result"} E -->|Installed| F["Cache SDK and continue"] E -->|SDK package missing| G["Return CursorSdkNotInstalledError"] E -->|Other load failure| H["Keep original defect"]Reviews (2) · Last reviewed commit: "fix(cursor): keep the missing-SDK messag..." · Reviewed by Greptile