Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): honor Cursor long-context selections #15884

ClosedMatthewFeroz(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/15884/headopened View on GitHub

Showing 2 changed files with 194 additions and 8 deletions.

x
0 of 2 viewed, 2 left
158 additions and 8 deletionsapps/server/src/provider/cursorSdk.test.tsModified
View file
@@ -4,17 +4,27 @@
​
const cursorSdkUrl = new URL("./cursorSdk.ts", import.meta.url).href;
​
-// Loads cursorSdk.ts in a fresh process. @cursor/sdk is stubbed so the guard
-// can be tested without the real package. The vitest worker already has its
-// own unhandledRejection listener, which would hide the process-exit behavior.
+// Loads cursorSdk.ts in a fresh process. The send probe uses the real SDK;
+// shell guard probes stub it. The worker's own unhandledRejection listener
+// would hide the process-exit behavior.
const probeProgram = `
import { mkdtempSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { registerHooks } from "node:module";
+import { createRequire, registerHooks } from "node:module";
import { pathToFileURL } from "node:url";
import { spawn } from "node:child_process";
​
+const sdkRequire = createRequire(createRequire(${JSON.stringify(cursorSdkUrl)}).resolve("@cursor/sdk"));
+const protobufUrl = pathToFileURL(sdkRequire.resolve("@bufbuild/protobuf")).href;
+const { proto3, ScalarType } = sdkRequire("@bufbuild/protobuf");
+const mode = process.argv[1];
+if (mode === "sdk-model-requests") {
+ process.on("uncaughtException", error => {
+ console.error(error.stack);
+ process.exit(1);
+ });
+}
const dir = mkdtempSync(join(tmpdir(), "cursor-sdk-stub-"));