@sideboard-ai/core 0.1.233 → 0.1.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/cursor-runner.cjs +43 -3
- package/dist/agents/cursor-runner.js +9 -2
- package/dist/{agents-LDYMFW6N.js → agents-37JCAVSC.js} +2 -2
- package/dist/{agents-J2CUJHPC.js → agents-MOMMKSYV.js} +1 -1
- package/dist/{chunk-BGHDWCAV.js → chunk-7366AB7E.js} +16 -6
- package/dist/{chunk-PZQNE5X4.js → chunk-D4VKJO5C.js} +3 -2
- package/dist/{chunk-TXMFBL3X.js → chunk-EAYXD2IC.js} +34 -4
- package/dist/{chunk-NLETJP7Z.js → chunk-LJWF3VA3.js} +14 -4
- package/dist/{chunk-26T43LBM.js → chunk-WPD7BR6C.js} +41 -3
- package/dist/index.cjs +45 -5
- package/dist/index.js +3 -3
- package/dist/mcp/run-stdio.cjs +43 -4
- package/dist/mcp/run-stdio.js +2 -2
- package/dist/{orchestrator-NLZMHTLX.js → orchestrator-6NPBOBNA.js} +2 -2
- package/dist/{orchestrator-BXALNM4M.js → orchestrator-RKWRI3PJ.js} +3 -3
- package/package.json +1 -1
|
@@ -125,13 +125,49 @@ function resolveCursorSdkRoot(opts) {
|
|
|
125
125
|
const cwdPkg = (0, import_node_path2.join)(process.cwd(), "package.json");
|
|
126
126
|
return resolvedPackageRoot(thisModuleFile()) ?? resolvedPackageRoot(cwdPkg);
|
|
127
127
|
}
|
|
128
|
+
function exportTarget(value) {
|
|
129
|
+
if (typeof value === "string") return value;
|
|
130
|
+
if (value && typeof value === "object") {
|
|
131
|
+
const v = value;
|
|
132
|
+
return exportTarget(v.import) ?? exportTarget(v.default);
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
function cursorSdkEsmEntry(root) {
|
|
137
|
+
try {
|
|
138
|
+
const pkg = JSON.parse((0, import_node_fs2.readFileSync)((0, import_node_path2.join)(root, "package.json"), "utf8"));
|
|
139
|
+
const exp = pkg.exports;
|
|
140
|
+
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
141
|
+
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
142
|
+
if (!rel) return null;
|
|
143
|
+
const entry = (0, import_node_path2.join)(root, rel);
|
|
144
|
+
return (0, import_node_fs2.existsSync)(entry) ? entry : null;
|
|
145
|
+
} catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function unwrapCursorSdkModule(mod) {
|
|
150
|
+
const m = mod;
|
|
151
|
+
if (m && !m.Agent && m.default?.Agent) return m.default;
|
|
152
|
+
return m;
|
|
153
|
+
}
|
|
154
|
+
function cursorSdkHasExpectedExports(mod) {
|
|
155
|
+
const m = mod;
|
|
156
|
+
return typeof m?.Agent === "function" && typeof m?.JsonlLocalAgentStore === "function";
|
|
157
|
+
}
|
|
158
|
+
function cursorSdkMissingExportsMessage(root) {
|
|
159
|
+
return `Cursor SDK at ${root ?? "(unknown)"} is missing expected exports (Agent, JsonlLocalAgentStore) \u2014 reinstall with \`npm i -g @cursor/sdk\`.`;
|
|
160
|
+
}
|
|
128
161
|
async function importCursorSdk(opts) {
|
|
129
162
|
const root = resolveCursorSdkRoot(opts);
|
|
130
163
|
if (!root) return null;
|
|
131
164
|
try {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
165
|
+
let entry = cursorSdkEsmEntry(root);
|
|
166
|
+
if (!entry) {
|
|
167
|
+
const req = (0, import_node_module.createRequire)((0, import_node_path2.join)(root, "package.json"));
|
|
168
|
+
entry = req.resolve("@cursor/sdk");
|
|
169
|
+
}
|
|
170
|
+
return unwrapCursorSdkModule(await import((0, import_node_url.pathToFileURL)(entry).href));
|
|
135
171
|
} catch {
|
|
136
172
|
return null;
|
|
137
173
|
}
|
|
@@ -900,6 +936,10 @@ async function main() {
|
|
|
900
936
|
emit({ type: "stderr", data: CURSOR_SDK_INSTALL_HINT });
|
|
901
937
|
return 1;
|
|
902
938
|
}
|
|
939
|
+
if (!cursorSdkHasExpectedExports(sdk)) {
|
|
940
|
+
emit({ type: "stderr", data: cursorSdkMissingExportsMessage(resolveCursorSdkRoot()) });
|
|
941
|
+
return 1;
|
|
942
|
+
}
|
|
903
943
|
const { Agent, CursorAgentError, JsonlLocalAgentStore } = sdk;
|
|
904
944
|
ensureCursorRipgrepPath();
|
|
905
945
|
const apiKey = (req.apiKey || process.env.CURSOR_API_KEY || "").trim() || void 0;
|
|
@@ -6,13 +6,16 @@ import {
|
|
|
6
6
|
CURSOR_SDK_INSTALL_HINT,
|
|
7
7
|
cursorCostOnlyUsageEvent,
|
|
8
8
|
cursorDeltaToEvents,
|
|
9
|
+
cursorSdkHasExpectedExports,
|
|
9
10
|
cursorSdkMessageToEvents,
|
|
11
|
+
cursorSdkMissingExportsMessage,
|
|
10
12
|
ensureCursorRipgrepPath,
|
|
11
13
|
fetchCursorTurnCostUsd,
|
|
12
14
|
formatUnknownDetail,
|
|
13
15
|
importCursorSdk,
|
|
14
|
-
looksLikeCursorHttp2StreamClose
|
|
15
|
-
|
|
16
|
+
looksLikeCursorHttp2StreamClose,
|
|
17
|
+
resolveCursorSdkRoot
|
|
18
|
+
} from "../chunk-WPD7BR6C.js";
|
|
16
19
|
import {
|
|
17
20
|
cursorSdkStoreDir
|
|
18
21
|
} from "../chunk-7J72QJOM.js";
|
|
@@ -210,6 +213,10 @@ async function main() {
|
|
|
210
213
|
emit({ type: "stderr", data: CURSOR_SDK_INSTALL_HINT });
|
|
211
214
|
return 1;
|
|
212
215
|
}
|
|
216
|
+
if (!cursorSdkHasExpectedExports(sdk)) {
|
|
217
|
+
emit({ type: "stderr", data: cursorSdkMissingExportsMessage(resolveCursorSdkRoot()) });
|
|
218
|
+
return 1;
|
|
219
|
+
}
|
|
213
220
|
const { Agent, CursorAgentError, JsonlLocalAgentStore } = sdk;
|
|
214
221
|
ensureCursorRipgrepPath();
|
|
215
222
|
const apiKey = (req.apiKey || process.env.CURSOR_API_KEY || "").trim() || void 0;
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
resolveLoginCommand,
|
|
45
45
|
resolveQuotaFallbackAgent,
|
|
46
46
|
whichOnPath
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-D4VKJO5C.js";
|
|
48
48
|
import "./chunk-S2OEFXST.js";
|
|
49
49
|
import "./chunk-7H2CVVLF.js";
|
|
50
50
|
import "./chunk-6K64FJDD.js";
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
preferredCursorCostCents,
|
|
61
61
|
resolveCursorSdkRoot,
|
|
62
62
|
turnCostUsdFromCursorUsage
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-WPD7BR6C.js";
|
|
64
64
|
import {
|
|
65
65
|
ORCHESTRATOR_AGENT_KINDS,
|
|
66
66
|
assertOrchestratorCapableAgent,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
resolveQuotaFallbackAgent,
|
|
25
25
|
stripBrightsyNdjsonNoise,
|
|
26
26
|
toolDescription
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-D4VKJO5C.js";
|
|
28
28
|
import {
|
|
29
29
|
SLACK_REPLY_FORMATTING,
|
|
30
30
|
addWorkspace,
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
shouldRetryFailedAgentTurn,
|
|
129
129
|
summarizeTurnStderr,
|
|
130
130
|
turnFailChatText
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-WPD7BR6C.js";
|
|
132
132
|
import {
|
|
133
133
|
HISTORY_CLEANUP_INTERVAL_HOURS_DEFAULT,
|
|
134
134
|
applyTurnUsage,
|
|
@@ -482,7 +482,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
482
482
|
await continueOnReply(threadId, prompt);
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
485
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-RKWRI3PJ.js");
|
|
486
486
|
await getOrchestrator2().send(threadId, prompt);
|
|
487
487
|
} catch {
|
|
488
488
|
}
|
|
@@ -4266,7 +4266,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
4266
4266
|
return readThread(thread.id) ?? thread;
|
|
4267
4267
|
}
|
|
4268
4268
|
async function listLinearIssues(agent, repoPath) {
|
|
4269
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
4269
|
+
const { getAdapter: getAdapter2 } = await import("./agents-37JCAVSC.js");
|
|
4270
4270
|
await requireAgent(agent, { requireLinear: true });
|
|
4271
4271
|
const adapter = getAdapter2(agent);
|
|
4272
4272
|
if (!adapter.listLinearIssues) {
|
|
@@ -7421,7 +7421,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
7421
7421
|
${prompt}`;
|
|
7422
7422
|
}
|
|
7423
7423
|
async function defaultDeps() {
|
|
7424
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
7424
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-RKWRI3PJ.js");
|
|
7425
7425
|
const orch = getOrchestrator2();
|
|
7426
7426
|
return {
|
|
7427
7427
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -9039,7 +9039,8 @@ var Orchestrator = class {
|
|
|
9039
9039
|
}
|
|
9040
9040
|
return this.waitForDesktopRunScript(thread.id, request, op, scriptName);
|
|
9041
9041
|
}
|
|
9042
|
-
async waitForDesktopRunScript(threadId,
|
|
9042
|
+
async waitForDesktopRunScript(threadId, initialRequest, op, scriptName) {
|
|
9043
|
+
let request = initialRequest;
|
|
9043
9044
|
const deadline = Date.now() + this.runScriptAdoptTimeoutMs;
|
|
9044
9045
|
while (Date.now() < deadline) {
|
|
9045
9046
|
const latest = readThread(threadId);
|
|
@@ -9063,6 +9064,15 @@ var Orchestrator = class {
|
|
|
9063
9064
|
}
|
|
9064
9065
|
} else if (fulfilled) {
|
|
9065
9066
|
return null;
|
|
9067
|
+
} else if (requestGone) {
|
|
9068
|
+
const coversThisStop = req?.op === "stop" && (req.scriptName == null || req.scriptName === (scriptName ?? null));
|
|
9069
|
+
if (req && coversThisStop) {
|
|
9070
|
+
request = req;
|
|
9071
|
+
continue;
|
|
9072
|
+
}
|
|
9073
|
+
throw new Error(
|
|
9074
|
+
req?.op === "start" ? "Stop was replaced by a newer start request before desktop applied it." : "Stop was replaced by another run-script request before desktop applied it."
|
|
9075
|
+
);
|
|
9066
9076
|
}
|
|
9067
9077
|
await new Promise((r) => setTimeout(r, 40));
|
|
9068
9078
|
}
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
packagedMcpStdioPath,
|
|
37
37
|
parseCursorRunnerLine,
|
|
38
38
|
resolveNodeLaunch
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-WPD7BR6C.js";
|
|
40
40
|
import {
|
|
41
41
|
claudeChromeEnabled,
|
|
42
42
|
fromInclusiveInputUsage,
|
|
@@ -3998,7 +3998,8 @@ async function installNpmGlobalPackage(opts) {
|
|
|
3998
3998
|
exitCode: 0,
|
|
3999
3999
|
stdout: result.stdout,
|
|
4000
4000
|
stderr: result.stderr,
|
|
4001
|
-
|
|
4001
|
+
// Library-only packages (`@cursor/sdk`) have no CLI to look for.
|
|
4002
|
+
message: !opts.cliBin ? `Installed ${opts.npmPackage}` : binPath ? `Installed ${opts.npmPackage} \u2192 ${binPath}` : `Installed ${opts.npmPackage} (CLI not yet on PATH)`
|
|
4002
4003
|
};
|
|
4003
4004
|
}
|
|
4004
4005
|
async function resolveExistingCli(agent) {
|
|
@@ -3218,13 +3218,42 @@ function resolveCursorSdkRoot(opts) {
|
|
|
3218
3218
|
function isCursorSdkInstalled(opts) {
|
|
3219
3219
|
return Boolean(resolveCursorSdkRoot(opts));
|
|
3220
3220
|
}
|
|
3221
|
+
function exportTarget(value) {
|
|
3222
|
+
if (typeof value === "string") return value;
|
|
3223
|
+
if (value && typeof value === "object") {
|
|
3224
|
+
const v = value;
|
|
3225
|
+
return exportTarget(v.import) ?? exportTarget(v.default);
|
|
3226
|
+
}
|
|
3227
|
+
return null;
|
|
3228
|
+
}
|
|
3229
|
+
function cursorSdkEsmEntry(root) {
|
|
3230
|
+
try {
|
|
3231
|
+
const pkg = JSON.parse(readFileSync5(join8(root, "package.json"), "utf8"));
|
|
3232
|
+
const exp = pkg.exports;
|
|
3233
|
+
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
3234
|
+
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
3235
|
+
if (!rel) return null;
|
|
3236
|
+
const entry = join8(root, rel);
|
|
3237
|
+
return existsSync10(entry) ? entry : null;
|
|
3238
|
+
} catch {
|
|
3239
|
+
return null;
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
function unwrapCursorSdkModule(mod) {
|
|
3243
|
+
const m = mod;
|
|
3244
|
+
if (m && !m.Agent && m.default?.Agent) return m.default;
|
|
3245
|
+
return m;
|
|
3246
|
+
}
|
|
3221
3247
|
async function importCursorSdk(opts) {
|
|
3222
3248
|
const root = resolveCursorSdkRoot(opts);
|
|
3223
3249
|
if (!root) return null;
|
|
3224
3250
|
try {
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3251
|
+
let entry = cursorSdkEsmEntry(root);
|
|
3252
|
+
if (!entry) {
|
|
3253
|
+
const req = createRequire2(join8(root, "package.json"));
|
|
3254
|
+
entry = req.resolve("@cursor/sdk");
|
|
3255
|
+
}
|
|
3256
|
+
return unwrapCursorSdkModule(await import(pathToFileURL(entry).href));
|
|
3228
3257
|
} catch {
|
|
3229
3258
|
return null;
|
|
3230
3259
|
}
|
|
@@ -4781,7 +4810,8 @@ async function installNpmGlobalPackage(opts) {
|
|
|
4781
4810
|
exitCode: 0,
|
|
4782
4811
|
stdout: result.stdout,
|
|
4783
4812
|
stderr: result.stderr,
|
|
4784
|
-
|
|
4813
|
+
// Library-only packages (`@cursor/sdk`) have no CLI to look for.
|
|
4814
|
+
message: !opts.cliBin ? `Installed ${opts.npmPackage}` : binPath ? `Installed ${opts.npmPackage} \u2192 ${binPath}` : `Installed ${opts.npmPackage} (CLI not yet on PATH)`
|
|
4785
4815
|
};
|
|
4786
4816
|
}
|
|
4787
4817
|
async function resolveExistingCli(agent) {
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
summarizeTurnStderr,
|
|
43
43
|
toolDescription,
|
|
44
44
|
turnFailChatText
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-EAYXD2IC.js";
|
|
46
46
|
import {
|
|
47
47
|
SLACK_REPLY_FORMATTING,
|
|
48
48
|
addWorkspace,
|
|
@@ -418,7 +418,7 @@ async function continueSourceThread(threadId, prompt) {
|
|
|
418
418
|
await continueOnReply(threadId, prompt);
|
|
419
419
|
return;
|
|
420
420
|
}
|
|
421
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
421
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-6NPBOBNA.js");
|
|
422
422
|
await getOrchestrator2().send(threadId, prompt);
|
|
423
423
|
} catch {
|
|
424
424
|
}
|
|
@@ -7032,7 +7032,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
7032
7032
|
${prompt}`;
|
|
7033
7033
|
}
|
|
7034
7034
|
async function defaultDeps() {
|
|
7035
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
7035
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-6NPBOBNA.js");
|
|
7036
7036
|
const orch = getOrchestrator2();
|
|
7037
7037
|
return {
|
|
7038
7038
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -8650,7 +8650,8 @@ var Orchestrator = class {
|
|
|
8650
8650
|
}
|
|
8651
8651
|
return this.waitForDesktopRunScript(thread.id, request, op, scriptName);
|
|
8652
8652
|
}
|
|
8653
|
-
async waitForDesktopRunScript(threadId,
|
|
8653
|
+
async waitForDesktopRunScript(threadId, initialRequest, op, scriptName) {
|
|
8654
|
+
let request = initialRequest;
|
|
8654
8655
|
const deadline = Date.now() + this.runScriptAdoptTimeoutMs;
|
|
8655
8656
|
while (Date.now() < deadline) {
|
|
8656
8657
|
const latest = readThread(threadId);
|
|
@@ -8674,6 +8675,15 @@ var Orchestrator = class {
|
|
|
8674
8675
|
}
|
|
8675
8676
|
} else if (fulfilled) {
|
|
8676
8677
|
return null;
|
|
8678
|
+
} else if (requestGone) {
|
|
8679
|
+
const coversThisStop = req?.op === "stop" && (req.scriptName == null || req.scriptName === (scriptName ?? null));
|
|
8680
|
+
if (req && coversThisStop) {
|
|
8681
|
+
request = req;
|
|
8682
|
+
continue;
|
|
8683
|
+
}
|
|
8684
|
+
throw new Error(
|
|
8685
|
+
req?.op === "start" ? "Stop was replaced by a newer start request before desktop applied it." : "Stop was replaced by another run-script request before desktop applied it."
|
|
8686
|
+
);
|
|
8677
8687
|
}
|
|
8678
8688
|
await new Promise((r) => setTimeout(r, 40));
|
|
8679
8689
|
}
|
|
@@ -802,13 +802,49 @@ function resolveCursorSdkRoot(opts) {
|
|
|
802
802
|
function isCursorSdkInstalled(opts) {
|
|
803
803
|
return Boolean(resolveCursorSdkRoot(opts));
|
|
804
804
|
}
|
|
805
|
+
function exportTarget(value) {
|
|
806
|
+
if (typeof value === "string") return value;
|
|
807
|
+
if (value && typeof value === "object") {
|
|
808
|
+
const v = value;
|
|
809
|
+
return exportTarget(v.import) ?? exportTarget(v.default);
|
|
810
|
+
}
|
|
811
|
+
return null;
|
|
812
|
+
}
|
|
813
|
+
function cursorSdkEsmEntry(root) {
|
|
814
|
+
try {
|
|
815
|
+
const pkg = JSON.parse(readFileSync2(join4(root, "package.json"), "utf8"));
|
|
816
|
+
const exp = pkg.exports;
|
|
817
|
+
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
818
|
+
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
819
|
+
if (!rel) return null;
|
|
820
|
+
const entry = join4(root, rel);
|
|
821
|
+
return existsSync4(entry) ? entry : null;
|
|
822
|
+
} catch {
|
|
823
|
+
return null;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
function unwrapCursorSdkModule(mod) {
|
|
827
|
+
const m = mod;
|
|
828
|
+
if (m && !m.Agent && m.default?.Agent) return m.default;
|
|
829
|
+
return m;
|
|
830
|
+
}
|
|
831
|
+
function cursorSdkHasExpectedExports(mod) {
|
|
832
|
+
const m = mod;
|
|
833
|
+
return typeof m?.Agent === "function" && typeof m?.JsonlLocalAgentStore === "function";
|
|
834
|
+
}
|
|
835
|
+
function cursorSdkMissingExportsMessage(root) {
|
|
836
|
+
return `Cursor SDK at ${root ?? "(unknown)"} is missing expected exports (Agent, JsonlLocalAgentStore) \u2014 reinstall with \`npm i -g @cursor/sdk\`.`;
|
|
837
|
+
}
|
|
805
838
|
async function importCursorSdk(opts) {
|
|
806
839
|
const root = resolveCursorSdkRoot(opts);
|
|
807
840
|
if (!root) return null;
|
|
808
841
|
try {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
842
|
+
let entry = cursorSdkEsmEntry(root);
|
|
843
|
+
if (!entry) {
|
|
844
|
+
const req = createRequire(join4(root, "package.json"));
|
|
845
|
+
entry = req.resolve("@cursor/sdk");
|
|
846
|
+
}
|
|
847
|
+
return unwrapCursorSdkModule(await import(pathToFileURL(entry).href));
|
|
812
848
|
} catch {
|
|
813
849
|
return null;
|
|
814
850
|
}
|
|
@@ -1239,6 +1275,8 @@ export {
|
|
|
1239
1275
|
CURSOR_SDK_INSTALL_HINT,
|
|
1240
1276
|
resolveCursorSdkRoot,
|
|
1241
1277
|
isCursorSdkInstalled,
|
|
1278
|
+
cursorSdkHasExpectedExports,
|
|
1279
|
+
cursorSdkMissingExportsMessage,
|
|
1242
1280
|
importCursorSdk,
|
|
1243
1281
|
preferredCursorCostCents,
|
|
1244
1282
|
turnCostUsdFromCursorUsage,
|
package/dist/index.cjs
CHANGED
|
@@ -13971,13 +13971,42 @@ function resolveCursorSdkRoot(opts) {
|
|
|
13971
13971
|
function isCursorSdkInstalled(opts) {
|
|
13972
13972
|
return Boolean(resolveCursorSdkRoot(opts));
|
|
13973
13973
|
}
|
|
13974
|
+
function exportTarget(value) {
|
|
13975
|
+
if (typeof value === "string") return value;
|
|
13976
|
+
if (value && typeof value === "object") {
|
|
13977
|
+
const v = value;
|
|
13978
|
+
return exportTarget(v.import) ?? exportTarget(v.default);
|
|
13979
|
+
}
|
|
13980
|
+
return null;
|
|
13981
|
+
}
|
|
13982
|
+
function cursorSdkEsmEntry(root) {
|
|
13983
|
+
try {
|
|
13984
|
+
const pkg = JSON.parse((0, import_node_fs36.readFileSync)((0, import_node_path38.join)(root, "package.json"), "utf8"));
|
|
13985
|
+
const exp = pkg.exports;
|
|
13986
|
+
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
13987
|
+
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
13988
|
+
if (!rel) return null;
|
|
13989
|
+
const entry = (0, import_node_path38.join)(root, rel);
|
|
13990
|
+
return (0, import_node_fs36.existsSync)(entry) ? entry : null;
|
|
13991
|
+
} catch {
|
|
13992
|
+
return null;
|
|
13993
|
+
}
|
|
13994
|
+
}
|
|
13995
|
+
function unwrapCursorSdkModule(mod) {
|
|
13996
|
+
const m = mod;
|
|
13997
|
+
if (m && !m.Agent && m.default?.Agent) return m.default;
|
|
13998
|
+
return m;
|
|
13999
|
+
}
|
|
13974
14000
|
async function importCursorSdk(opts) {
|
|
13975
14001
|
const root = resolveCursorSdkRoot(opts);
|
|
13976
14002
|
if (!root) return null;
|
|
13977
14003
|
try {
|
|
13978
|
-
|
|
13979
|
-
|
|
13980
|
-
|
|
14004
|
+
let entry = cursorSdkEsmEntry(root);
|
|
14005
|
+
if (!entry) {
|
|
14006
|
+
const req = (0, import_node_module2.createRequire)((0, import_node_path38.join)(root, "package.json"));
|
|
14007
|
+
entry = req.resolve("@cursor/sdk");
|
|
14008
|
+
}
|
|
14009
|
+
return unwrapCursorSdkModule(await import((0, import_node_url2.pathToFileURL)(entry).href));
|
|
13981
14010
|
} catch {
|
|
13982
14011
|
return null;
|
|
13983
14012
|
}
|
|
@@ -15568,7 +15597,8 @@ async function installNpmGlobalPackage(opts) {
|
|
|
15568
15597
|
exitCode: 0,
|
|
15569
15598
|
stdout: result.stdout,
|
|
15570
15599
|
stderr: result.stderr,
|
|
15571
|
-
|
|
15600
|
+
// Library-only packages (`@cursor/sdk`) have no CLI to look for.
|
|
15601
|
+
message: !opts.cliBin ? `Installed ${opts.npmPackage}` : binPath ? `Installed ${opts.npmPackage} \u2192 ${binPath}` : `Installed ${opts.npmPackage} (CLI not yet on PATH)`
|
|
15572
15602
|
};
|
|
15573
15603
|
}
|
|
15574
15604
|
async function resolveExistingCli(agent) {
|
|
@@ -25175,7 +25205,8 @@ var init_orchestrator = __esm({
|
|
|
25175
25205
|
}
|
|
25176
25206
|
return this.waitForDesktopRunScript(thread.id, request, op, scriptName);
|
|
25177
25207
|
}
|
|
25178
|
-
async waitForDesktopRunScript(threadId,
|
|
25208
|
+
async waitForDesktopRunScript(threadId, initialRequest, op, scriptName) {
|
|
25209
|
+
let request = initialRequest;
|
|
25179
25210
|
const deadline = Date.now() + this.runScriptAdoptTimeoutMs;
|
|
25180
25211
|
while (Date.now() < deadline) {
|
|
25181
25212
|
const latest = readThread(threadId);
|
|
@@ -25199,6 +25230,15 @@ var init_orchestrator = __esm({
|
|
|
25199
25230
|
}
|
|
25200
25231
|
} else if (fulfilled) {
|
|
25201
25232
|
return null;
|
|
25233
|
+
} else if (requestGone) {
|
|
25234
|
+
const coversThisStop = req?.op === "stop" && (req.scriptName == null || req.scriptName === (scriptName ?? null));
|
|
25235
|
+
if (req && coversThisStop) {
|
|
25236
|
+
request = req;
|
|
25237
|
+
continue;
|
|
25238
|
+
}
|
|
25239
|
+
throw new Error(
|
|
25240
|
+
req?.op === "start" ? "Stop was replaced by a newer start request before desktop applied it." : "Stop was replaced by another run-script request before desktop applied it."
|
|
25241
|
+
);
|
|
25202
25242
|
}
|
|
25203
25243
|
await new Promise((r) => setTimeout(r, 40));
|
|
25204
25244
|
}
|
package/dist/index.js
CHANGED
|
@@ -325,7 +325,7 @@ import {
|
|
|
325
325
|
worktreeCleanupSettings,
|
|
326
326
|
wrapReviewSkillMarkdown,
|
|
327
327
|
writeWorktreeFile
|
|
328
|
-
} from "./chunk-
|
|
328
|
+
} from "./chunk-7366AB7E.js";
|
|
329
329
|
import {
|
|
330
330
|
LEGACY_PLAN_FILE_REL,
|
|
331
331
|
PLAN_FILE_NAME,
|
|
@@ -442,7 +442,7 @@ import {
|
|
|
442
442
|
withEventParentId,
|
|
443
443
|
withEventsParentId,
|
|
444
444
|
writeInjectedMcpConfig
|
|
445
|
-
} from "./chunk-
|
|
445
|
+
} from "./chunk-D4VKJO5C.js";
|
|
446
446
|
import {
|
|
447
447
|
CLOUD_COORDINATOR_BUSY_REPLY,
|
|
448
448
|
CLOUD_COORDINATOR_STOPPED_REPLY,
|
|
@@ -638,7 +638,7 @@ import {
|
|
|
638
638
|
trustSystemCertificates,
|
|
639
639
|
turnCostUsdFromCursorUsage,
|
|
640
640
|
withMaxOldSpaceSize
|
|
641
|
-
} from "./chunk-
|
|
641
|
+
} from "./chunk-WPD7BR6C.js";
|
|
642
642
|
import {
|
|
643
643
|
AGENT_DONE_SOUNDS,
|
|
644
644
|
FOLLOW_UP_BEHAVIORS,
|
package/dist/mcp/run-stdio.cjs
CHANGED
|
@@ -12062,13 +12062,42 @@ function resolveCursorSdkRoot(opts) {
|
|
|
12062
12062
|
function isCursorSdkInstalled(opts) {
|
|
12063
12063
|
return Boolean(resolveCursorSdkRoot(opts));
|
|
12064
12064
|
}
|
|
12065
|
+
function exportTarget(value) {
|
|
12066
|
+
if (typeof value === "string") return value;
|
|
12067
|
+
if (value && typeof value === "object") {
|
|
12068
|
+
const v = value;
|
|
12069
|
+
return exportTarget(v.import) ?? exportTarget(v.default);
|
|
12070
|
+
}
|
|
12071
|
+
return null;
|
|
12072
|
+
}
|
|
12073
|
+
function cursorSdkEsmEntry(root) {
|
|
12074
|
+
try {
|
|
12075
|
+
const pkg = JSON.parse((0, import_node_fs31.readFileSync)((0, import_node_path33.join)(root, "package.json"), "utf8"));
|
|
12076
|
+
const exp = pkg.exports;
|
|
12077
|
+
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
12078
|
+
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
12079
|
+
if (!rel) return null;
|
|
12080
|
+
const entry = (0, import_node_path33.join)(root, rel);
|
|
12081
|
+
return (0, import_node_fs31.existsSync)(entry) ? entry : null;
|
|
12082
|
+
} catch {
|
|
12083
|
+
return null;
|
|
12084
|
+
}
|
|
12085
|
+
}
|
|
12086
|
+
function unwrapCursorSdkModule(mod) {
|
|
12087
|
+
const m = mod;
|
|
12088
|
+
if (m && !m.Agent && m.default?.Agent) return m.default;
|
|
12089
|
+
return m;
|
|
12090
|
+
}
|
|
12065
12091
|
async function importCursorSdk(opts) {
|
|
12066
12092
|
const root = resolveCursorSdkRoot(opts);
|
|
12067
12093
|
if (!root) return null;
|
|
12068
12094
|
try {
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12095
|
+
let entry = cursorSdkEsmEntry(root);
|
|
12096
|
+
if (!entry) {
|
|
12097
|
+
const req = (0, import_node_module2.createRequire)((0, import_node_path33.join)(root, "package.json"));
|
|
12098
|
+
entry = req.resolve("@cursor/sdk");
|
|
12099
|
+
}
|
|
12100
|
+
return unwrapCursorSdkModule(await import((0, import_node_url2.pathToFileURL)(entry).href));
|
|
12072
12101
|
} catch {
|
|
12073
12102
|
return null;
|
|
12074
12103
|
}
|
|
@@ -23336,7 +23365,8 @@ var init_orchestrator = __esm({
|
|
|
23336
23365
|
}
|
|
23337
23366
|
return this.waitForDesktopRunScript(thread.id, request, op, scriptName);
|
|
23338
23367
|
}
|
|
23339
|
-
async waitForDesktopRunScript(threadId,
|
|
23368
|
+
async waitForDesktopRunScript(threadId, initialRequest, op, scriptName) {
|
|
23369
|
+
let request = initialRequest;
|
|
23340
23370
|
const deadline = Date.now() + this.runScriptAdoptTimeoutMs;
|
|
23341
23371
|
while (Date.now() < deadline) {
|
|
23342
23372
|
const latest = readThread(threadId);
|
|
@@ -23360,6 +23390,15 @@ var init_orchestrator = __esm({
|
|
|
23360
23390
|
}
|
|
23361
23391
|
} else if (fulfilled) {
|
|
23362
23392
|
return null;
|
|
23393
|
+
} else if (requestGone) {
|
|
23394
|
+
const coversThisStop = req?.op === "stop" && (req.scriptName == null || req.scriptName === (scriptName ?? null));
|
|
23395
|
+
if (req && coversThisStop) {
|
|
23396
|
+
request = req;
|
|
23397
|
+
continue;
|
|
23398
|
+
}
|
|
23399
|
+
throw new Error(
|
|
23400
|
+
req?.op === "start" ? "Stop was replaced by a newer start request before desktop applied it." : "Stop was replaced by another run-script request before desktop applied it."
|
|
23401
|
+
);
|
|
23363
23402
|
}
|
|
23364
23403
|
await new Promise((r) => setTimeout(r, 40));
|
|
23365
23404
|
}
|
package/dist/mcp/run-stdio.js
CHANGED
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
threadsSharingWorktree,
|
|
52
52
|
updateSchedule,
|
|
53
53
|
waitForDetachedJob
|
|
54
|
-
} from "../chunk-
|
|
54
|
+
} from "../chunk-LJWF3VA3.js";
|
|
55
55
|
import "../chunk-JFOPOMK7.js";
|
|
56
56
|
import "../chunk-YWI3IBP2.js";
|
|
57
57
|
import {
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
materializeSystemCaBundle,
|
|
63
63
|
sideboardMcpProfile,
|
|
64
64
|
trustSystemCertificates
|
|
65
|
-
} from "../chunk-
|
|
65
|
+
} from "../chunk-EAYXD2IC.js";
|
|
66
66
|
import {
|
|
67
67
|
GLOBAL_WORKSPACE_ID,
|
|
68
68
|
isCloudCoordinatorThread,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
resolveSendFollowUp,
|
|
12
12
|
startOrchestration,
|
|
13
13
|
waitForPidExit
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LJWF3VA3.js";
|
|
15
15
|
import "./chunk-JFOPOMK7.js";
|
|
16
16
|
import "./chunk-YWI3IBP2.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-EAYXD2IC.js";
|
|
18
18
|
import "./chunk-TWXSZYR2.js";
|
|
19
19
|
import "./chunk-SPAMHHJH.js";
|
|
20
20
|
import "./chunk-P2BSMNHB.js";
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
resolveSendFollowUp,
|
|
10
10
|
startOrchestration,
|
|
11
11
|
waitForPidExit
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7366AB7E.js";
|
|
13
13
|
import "./chunk-DJU54RYW.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-D4VKJO5C.js";
|
|
15
15
|
import "./chunk-S2OEFXST.js";
|
|
16
16
|
import "./chunk-7H2CVVLF.js";
|
|
17
17
|
import "./chunk-6K64FJDD.js";
|
|
@@ -20,7 +20,7 @@ import "./chunk-TNVJPFHM.js";
|
|
|
20
20
|
import "./chunk-ROPGQRPU.js";
|
|
21
21
|
import "./chunk-N7WZ6NIN.js";
|
|
22
22
|
import "./chunk-AXQ4ZWHK.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-WPD7BR6C.js";
|
|
24
24
|
import "./chunk-I5NC7DWO.js";
|
|
25
25
|
import "./chunk-WDRMZKVB.js";
|
|
26
26
|
import "./chunk-4TYXWPAJ.js";
|