@sideboard-ai/core 0.1.83 → 0.1.85
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 +88 -53
- package/dist/agents/cursor-runner.js +93 -56
- package/dist/{agents-4KRD46KG.js → agents-FD77JUOP.js} +10 -10
- package/dist/{agents-3YPUZME7.js → agents-YAYNNJWC.js} +9 -9
- package/dist/{app-settings-MQXL7OUF.js → app-settings-K6RFCRF6.js} +2 -2
- package/dist/{app-settings-GVSOIJLZ.js → app-settings-PEXK5VEX.js} +1 -1
- package/dist/{chunk-LVTNWH7B.js → chunk-2N5DVTGH.js} +2 -2
- package/dist/{chunk-JMRJ4F5B.js → chunk-3CCRD6WS.js} +69 -20
- package/dist/{chunk-AE5VBOFE.js → chunk-3KETJKYA.js} +9 -2
- package/dist/{chunk-IZ7RPF54.js → chunk-5KLC2MWZ.js} +5 -1
- package/dist/{chunk-DJFGX4RT.js → chunk-6GKDYUTJ.js} +3 -3
- package/dist/{chunk-VROPG6QF.js → chunk-6K5VAPVR.js} +3 -3
- package/dist/{chunk-HBBXS2FR.js → chunk-6WQAYBVE.js} +89 -21
- package/dist/{chunk-UHGN4KCL.js → chunk-AY53MPDE.js} +4 -0
- package/dist/{chunk-SEOICVGB.js → chunk-CBJSPTBG.js} +30 -6
- package/dist/{chunk-BTL7EMGT.js → chunk-HHTHF5BQ.js} +4 -4
- package/dist/{chunk-YO3CYL6B.js → chunk-I3FRXL7J.js} +1 -1
- package/dist/{chunk-RS54WYYH.js → chunk-JFQ2M6NQ.js} +2 -2
- package/dist/{chunk-NXXT5SE3.js → chunk-JTHWVYSD.js} +3 -3
- package/dist/{chunk-GD2FM6FN.js → chunk-KRAUS3RF.js} +87 -17
- package/dist/{chunk-D4DPQ552.js → chunk-LGXBYZZA.js} +9 -2
- package/dist/{chunk-E2MIA7DO.js → chunk-SH75CXJR.js} +2 -2
- package/dist/{chunk-JW6YFPQE.js → chunk-WGI6KXKJ.js} +36 -11
- package/dist/{chunk-ERJS3ZDP.js → chunk-XVFV56JG.js} +2 -2
- package/dist/{connected-teams-ZRS53OAT.js → connected-teams-BNBM7OIC.js} +2 -2
- package/dist/{connected-teams-35EIRJCP.js → connected-teams-LSQ5TAZP.js} +2 -2
- package/dist/{coordinator-prompt-46JE4NQR.js → coordinator-prompt-VN7FF76K.js} +5 -5
- package/dist/{coordinator-prompt-6ICA54JR.js → coordinator-prompt-YYQSPLIP.js} +4 -4
- package/dist/{global-workspace-GSLCEB5E.js → global-workspace-BRIDCBMY.js} +6 -6
- package/dist/{global-workspace-OBRWUPZG.js → global-workspace-U3XVTQLL.js} +5 -5
- package/dist/index.cjs +235 -94
- package/dist/index.d.cts +32 -6
- package/dist/index.d.ts +32 -6
- package/dist/index.js +47 -33
- package/dist/mcp/run-stdio.cjs +532 -399
- package/dist/mcp/run-stdio.js +43 -36
- package/dist/{run-V2WZUMJA.js → run-CFKZPY7F.js} +1 -1
- package/dist/{run-A4RHY7HH.js → run-XKTAJRWF.js} +1 -1
- package/dist/{workspaces-RJIWQB6J.js → workspaces-AIZDG6PS.js} +6 -6
- package/dist/{workspaces-7B3PTEF4.js → workspaces-IWQIWAMQ.js} +7 -7
- package/dist/{worktree-U3UIID2K.js → worktree-6ZALJUWG.js} +3 -3
- package/dist/{worktree-HSN5LWY6.js → worktree-7Y22WHR7.js} +4 -4
- package/package.json +1 -1
|
@@ -44,6 +44,32 @@ function appDataDir() {
|
|
|
44
44
|
return base;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
// src/agents/cursor-session.ts
|
|
48
|
+
function cursorErrorMessage(err) {
|
|
49
|
+
if (err instanceof Error) return err.message.trim();
|
|
50
|
+
return String(err).trim();
|
|
51
|
+
}
|
|
52
|
+
function isAgentBusyError(err) {
|
|
53
|
+
const name = err instanceof Error ? err.name : "";
|
|
54
|
+
if (name === "AgentBusyError") return true;
|
|
55
|
+
return /already has active run/i.test(cursorErrorMessage(err));
|
|
56
|
+
}
|
|
57
|
+
function isUnresumableCursorSession(err) {
|
|
58
|
+
const name = err instanceof Error ? err.name : "";
|
|
59
|
+
if (name === "AgentNotFoundError") return true;
|
|
60
|
+
const lower = cursorErrorMessage(err).toLowerCase();
|
|
61
|
+
if (!lower) return false;
|
|
62
|
+
return /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /cannot resume/.test(lower);
|
|
63
|
+
}
|
|
64
|
+
function cursorSessionRecoveryMessage(err, agentId) {
|
|
65
|
+
const detail = cursorErrorMessage(err) || "unresumable session";
|
|
66
|
+
const id = (agentId ?? "").trim();
|
|
67
|
+
if (id) {
|
|
68
|
+
return `Cursor agent ${id} is unresumable (${detail}) \u2014 starting a new session`;
|
|
69
|
+
}
|
|
70
|
+
return `Cursor session is unresumable (${detail}) \u2014 starting a new session`;
|
|
71
|
+
}
|
|
72
|
+
|
|
47
73
|
// src/agents/error-detail.ts
|
|
48
74
|
function formatUnknownDetail(err) {
|
|
49
75
|
if (err == null) return "";
|
|
@@ -265,11 +291,6 @@ function localAgentStore() {
|
|
|
265
291
|
(0, import_node_fs3.mkdirSync)(root, { recursive: true });
|
|
266
292
|
return new import_sdk.JsonlLocalAgentStore(root);
|
|
267
293
|
}
|
|
268
|
-
function isAgentBusyError(err) {
|
|
269
|
-
if (err instanceof import_sdk.AgentBusyError) return true;
|
|
270
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
271
|
-
return /already has active run/i.test(message);
|
|
272
|
-
}
|
|
273
294
|
async function cancelStaleLocalRuns(agentId, opts) {
|
|
274
295
|
const listed = await import_sdk.Agent.listRuns(agentId, {
|
|
275
296
|
runtime: "local",
|
|
@@ -328,75 +349,89 @@ async function main() {
|
|
|
328
349
|
const store = localAgentStore();
|
|
329
350
|
const local = { cwd: req.cwd, store };
|
|
330
351
|
const mcpServers = req.mcpServers && Object.keys(req.mcpServers).length > 0 ? req.mcpServers : void 0;
|
|
331
|
-
|
|
332
|
-
|
|
352
|
+
const createOpts = {
|
|
353
|
+
apiKey,
|
|
354
|
+
model,
|
|
355
|
+
mode,
|
|
356
|
+
local,
|
|
357
|
+
name: "Sideboard",
|
|
358
|
+
...mcpServers ? { mcpServers } : {}
|
|
359
|
+
};
|
|
360
|
+
async function createAgent() {
|
|
361
|
+
return import_sdk.Agent.create(createOpts);
|
|
362
|
+
}
|
|
363
|
+
async function openAgent() {
|
|
333
364
|
try {
|
|
334
|
-
|
|
335
|
-
apiKey,
|
|
336
|
-
model,
|
|
337
|
-
mode,
|
|
338
|
-
local,
|
|
339
|
-
...mcpServers ? { mcpServers } : {}
|
|
340
|
-
}) : await import_sdk.Agent.create({
|
|
365
|
+
return req.agentId ? await import_sdk.Agent.resume(req.agentId, {
|
|
341
366
|
apiKey,
|
|
342
367
|
model,
|
|
343
368
|
mode,
|
|
344
369
|
local,
|
|
345
|
-
name: "Sideboard",
|
|
346
370
|
...mcpServers ? { mcpServers } : {}
|
|
371
|
+
}) : await createAgent();
|
|
372
|
+
} catch (err) {
|
|
373
|
+
if (!isUnresumableCursorSession(err)) throw err;
|
|
374
|
+
emit({
|
|
375
|
+
type: "stderr",
|
|
376
|
+
data: cursorSessionRecoveryMessage(err, req.agentId)
|
|
347
377
|
});
|
|
378
|
+
return createAgent();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
async function sendPrompt(agent) {
|
|
382
|
+
const sendOpts = mcpServers ? { mcpServers } : void 0;
|
|
383
|
+
try {
|
|
384
|
+
return await agent.send(req.prompt, sendOpts);
|
|
348
385
|
} catch (err) {
|
|
349
|
-
|
|
350
|
-
|
|
386
|
+
if (!isAgentBusyError(err)) throw err;
|
|
387
|
+
const n = await cancelStaleLocalRuns(agent.agentId, {
|
|
388
|
+
cwd: req.cwd,
|
|
389
|
+
store
|
|
390
|
+
});
|
|
351
391
|
emit({
|
|
352
392
|
type: "stderr",
|
|
353
|
-
data: `Cursor agent ${
|
|
393
|
+
data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
|
|
354
394
|
});
|
|
355
|
-
agent
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
395
|
+
return agent.send(req.prompt, sendOpts);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
async function runTurn(agent) {
|
|
399
|
+
emit({ type: "session_id", data: agent.agentId });
|
|
400
|
+
const run = await sendPrompt(agent);
|
|
401
|
+
for await (const msg of run.stream()) {
|
|
402
|
+
for (const event of cursorSdkMessageToEvents(msg)) {
|
|
403
|
+
emit(event);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const result = await run.wait();
|
|
407
|
+
if (result.status === "error") {
|
|
408
|
+
const detail = formatUnknownDetail(result.error);
|
|
409
|
+
emit({
|
|
410
|
+
type: "stderr",
|
|
411
|
+
data: detail ? `Cursor run failed (${result.id}): ${detail}` : `Cursor run failed (${result.id})`
|
|
362
412
|
});
|
|
413
|
+
return 2;
|
|
363
414
|
}
|
|
415
|
+
if (result.status === "cancelled") return 0;
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
try {
|
|
419
|
+
let agent = await openAgent();
|
|
364
420
|
try {
|
|
365
|
-
emit({ type: "session_id", data: agent.agentId });
|
|
366
|
-
const sendOpts = mcpServers ? { mcpServers } : void 0;
|
|
367
|
-
let run;
|
|
368
421
|
try {
|
|
369
|
-
|
|
422
|
+
return await runTurn(agent);
|
|
370
423
|
} catch (err) {
|
|
371
|
-
if (!
|
|
372
|
-
const n = await cancelStaleLocalRuns(agent.agentId, {
|
|
373
|
-
cwd: req.cwd,
|
|
374
|
-
store
|
|
375
|
-
});
|
|
376
|
-
emit({
|
|
377
|
-
type: "stderr",
|
|
378
|
-
data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
|
|
379
|
-
});
|
|
380
|
-
run = await agent.send(req.prompt, sendOpts);
|
|
381
|
-
}
|
|
382
|
-
for await (const msg of run.stream()) {
|
|
383
|
-
for (const event of cursorSdkMessageToEvents(msg)) {
|
|
384
|
-
emit(event);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
const result = await run.wait();
|
|
388
|
-
if (result.status === "error") {
|
|
389
|
-
const detail = formatUnknownDetail(result.error);
|
|
424
|
+
if (!isUnresumableCursorSession(err)) throw err;
|
|
390
425
|
emit({
|
|
391
426
|
type: "stderr",
|
|
392
|
-
data:
|
|
427
|
+
data: cursorSessionRecoveryMessage(err, agent.agentId)
|
|
393
428
|
});
|
|
394
|
-
|
|
429
|
+
await agent[Symbol.asyncDispose]().catch(() => void 0);
|
|
430
|
+
agent = await createAgent();
|
|
431
|
+
return await runTurn(agent);
|
|
395
432
|
}
|
|
396
|
-
if (result.status === "cancelled") return 0;
|
|
397
|
-
return 0;
|
|
398
433
|
} finally {
|
|
399
|
-
await agent[Symbol.asyncDispose]();
|
|
434
|
+
await agent[Symbol.asyncDispose]().catch(() => void 0);
|
|
400
435
|
}
|
|
401
436
|
} catch (err) {
|
|
402
437
|
if (err instanceof import_sdk.CursorAgentError) {
|
|
@@ -2,19 +2,47 @@
|
|
|
2
2
|
import {
|
|
3
3
|
cursorSdkMessageToEvents,
|
|
4
4
|
formatUnknownDetail
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-CBJSPTBG.js";
|
|
6
6
|
import {
|
|
7
7
|
dropNestedElectronEnvFromProcess
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-5KLC2MWZ.js";
|
|
9
9
|
import {
|
|
10
10
|
appDataDir
|
|
11
11
|
} from "../chunk-M37RITA6.js";
|
|
12
12
|
|
|
13
13
|
// src/agents/cursor-runner.ts
|
|
14
|
-
import { Agent,
|
|
14
|
+
import { Agent, CursorAgentError, JsonlLocalAgentStore } from "@cursor/sdk";
|
|
15
15
|
import { mkdirSync } from "fs";
|
|
16
16
|
import { join } from "path";
|
|
17
17
|
import { createInterface } from "readline";
|
|
18
|
+
|
|
19
|
+
// src/agents/cursor-session.ts
|
|
20
|
+
function cursorErrorMessage(err) {
|
|
21
|
+
if (err instanceof Error) return err.message.trim();
|
|
22
|
+
return String(err).trim();
|
|
23
|
+
}
|
|
24
|
+
function isAgentBusyError(err) {
|
|
25
|
+
const name = err instanceof Error ? err.name : "";
|
|
26
|
+
if (name === "AgentBusyError") return true;
|
|
27
|
+
return /already has active run/i.test(cursorErrorMessage(err));
|
|
28
|
+
}
|
|
29
|
+
function isUnresumableCursorSession(err) {
|
|
30
|
+
const name = err instanceof Error ? err.name : "";
|
|
31
|
+
if (name === "AgentNotFoundError") return true;
|
|
32
|
+
const lower = cursorErrorMessage(err).toLowerCase();
|
|
33
|
+
if (!lower) return false;
|
|
34
|
+
return /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /cannot resume/.test(lower);
|
|
35
|
+
}
|
|
36
|
+
function cursorSessionRecoveryMessage(err, agentId) {
|
|
37
|
+
const detail = cursorErrorMessage(err) || "unresumable session";
|
|
38
|
+
const id = (agentId ?? "").trim();
|
|
39
|
+
if (id) {
|
|
40
|
+
return `Cursor agent ${id} is unresumable (${detail}) \u2014 starting a new session`;
|
|
41
|
+
}
|
|
42
|
+
return `Cursor session is unresumable (${detail}) \u2014 starting a new session`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/agents/cursor-runner.ts
|
|
18
46
|
dropNestedElectronEnvFromProcess();
|
|
19
47
|
function emit(event) {
|
|
20
48
|
process.stdout.write(`${JSON.stringify(event)}
|
|
@@ -39,11 +67,6 @@ function localAgentStore() {
|
|
|
39
67
|
mkdirSync(root, { recursive: true });
|
|
40
68
|
return new JsonlLocalAgentStore(root);
|
|
41
69
|
}
|
|
42
|
-
function isAgentBusyError(err) {
|
|
43
|
-
if (err instanceof AgentBusyError) return true;
|
|
44
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
45
|
-
return /already has active run/i.test(message);
|
|
46
|
-
}
|
|
47
70
|
async function cancelStaleLocalRuns(agentId, opts) {
|
|
48
71
|
const listed = await Agent.listRuns(agentId, {
|
|
49
72
|
runtime: "local",
|
|
@@ -102,75 +125,89 @@ async function main() {
|
|
|
102
125
|
const store = localAgentStore();
|
|
103
126
|
const local = { cwd: req.cwd, store };
|
|
104
127
|
const mcpServers = req.mcpServers && Object.keys(req.mcpServers).length > 0 ? req.mcpServers : void 0;
|
|
105
|
-
|
|
106
|
-
|
|
128
|
+
const createOpts = {
|
|
129
|
+
apiKey,
|
|
130
|
+
model,
|
|
131
|
+
mode,
|
|
132
|
+
local,
|
|
133
|
+
name: "Sideboard",
|
|
134
|
+
...mcpServers ? { mcpServers } : {}
|
|
135
|
+
};
|
|
136
|
+
async function createAgent() {
|
|
137
|
+
return Agent.create(createOpts);
|
|
138
|
+
}
|
|
139
|
+
async function openAgent() {
|
|
107
140
|
try {
|
|
108
|
-
|
|
141
|
+
return req.agentId ? await Agent.resume(req.agentId, {
|
|
109
142
|
apiKey,
|
|
110
143
|
model,
|
|
111
144
|
mode,
|
|
112
145
|
local,
|
|
113
146
|
...mcpServers ? { mcpServers } : {}
|
|
114
|
-
}) : await
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
...mcpServers ? { mcpServers } : {}
|
|
147
|
+
}) : await createAgent();
|
|
148
|
+
} catch (err) {
|
|
149
|
+
if (!isUnresumableCursorSession(err)) throw err;
|
|
150
|
+
emit({
|
|
151
|
+
type: "stderr",
|
|
152
|
+
data: cursorSessionRecoveryMessage(err, req.agentId)
|
|
121
153
|
});
|
|
154
|
+
return createAgent();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function sendPrompt(agent) {
|
|
158
|
+
const sendOpts = mcpServers ? { mcpServers } : void 0;
|
|
159
|
+
try {
|
|
160
|
+
return await agent.send(req.prompt, sendOpts);
|
|
122
161
|
} catch (err) {
|
|
123
|
-
|
|
124
|
-
|
|
162
|
+
if (!isAgentBusyError(err)) throw err;
|
|
163
|
+
const n = await cancelStaleLocalRuns(agent.agentId, {
|
|
164
|
+
cwd: req.cwd,
|
|
165
|
+
store
|
|
166
|
+
});
|
|
125
167
|
emit({
|
|
126
168
|
type: "stderr",
|
|
127
|
-
data: `Cursor agent ${
|
|
169
|
+
data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
|
|
128
170
|
});
|
|
129
|
-
agent
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
171
|
+
return agent.send(req.prompt, sendOpts);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
async function runTurn(agent) {
|
|
175
|
+
emit({ type: "session_id", data: agent.agentId });
|
|
176
|
+
const run = await sendPrompt(agent);
|
|
177
|
+
for await (const msg of run.stream()) {
|
|
178
|
+
for (const event of cursorSdkMessageToEvents(msg)) {
|
|
179
|
+
emit(event);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const result = await run.wait();
|
|
183
|
+
if (result.status === "error") {
|
|
184
|
+
const detail = formatUnknownDetail(result.error);
|
|
185
|
+
emit({
|
|
186
|
+
type: "stderr",
|
|
187
|
+
data: detail ? `Cursor run failed (${result.id}): ${detail}` : `Cursor run failed (${result.id})`
|
|
136
188
|
});
|
|
189
|
+
return 2;
|
|
137
190
|
}
|
|
191
|
+
if (result.status === "cancelled") return 0;
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
try {
|
|
195
|
+
let agent = await openAgent();
|
|
138
196
|
try {
|
|
139
|
-
emit({ type: "session_id", data: agent.agentId });
|
|
140
|
-
const sendOpts = mcpServers ? { mcpServers } : void 0;
|
|
141
|
-
let run;
|
|
142
197
|
try {
|
|
143
|
-
|
|
198
|
+
return await runTurn(agent);
|
|
144
199
|
} catch (err) {
|
|
145
|
-
if (!
|
|
146
|
-
const n = await cancelStaleLocalRuns(agent.agentId, {
|
|
147
|
-
cwd: req.cwd,
|
|
148
|
-
store
|
|
149
|
-
});
|
|
150
|
-
emit({
|
|
151
|
-
type: "stderr",
|
|
152
|
-
data: n > 0 ? `Cursor agent had ${n} stale active run(s) \u2014 cancelled and retrying` : "Cursor agent busy \u2014 retrying send"
|
|
153
|
-
});
|
|
154
|
-
run = await agent.send(req.prompt, sendOpts);
|
|
155
|
-
}
|
|
156
|
-
for await (const msg of run.stream()) {
|
|
157
|
-
for (const event of cursorSdkMessageToEvents(msg)) {
|
|
158
|
-
emit(event);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const result = await run.wait();
|
|
162
|
-
if (result.status === "error") {
|
|
163
|
-
const detail = formatUnknownDetail(result.error);
|
|
200
|
+
if (!isUnresumableCursorSession(err)) throw err;
|
|
164
201
|
emit({
|
|
165
202
|
type: "stderr",
|
|
166
|
-
data:
|
|
203
|
+
data: cursorSessionRecoveryMessage(err, agent.agentId)
|
|
167
204
|
});
|
|
168
|
-
|
|
205
|
+
await agent[Symbol.asyncDispose]().catch(() => void 0);
|
|
206
|
+
agent = await createAgent();
|
|
207
|
+
return await runTurn(agent);
|
|
169
208
|
}
|
|
170
|
-
if (result.status === "cancelled") return 0;
|
|
171
|
-
return 0;
|
|
172
209
|
} finally {
|
|
173
|
-
await agent[Symbol.asyncDispose]();
|
|
210
|
+
await agent[Symbol.asyncDispose]().catch(() => void 0);
|
|
174
211
|
}
|
|
175
212
|
} catch (err) {
|
|
176
213
|
if (err instanceof CursorAgentError) {
|
|
@@ -32,18 +32,22 @@ import {
|
|
|
32
32
|
resolveCursorModelId,
|
|
33
33
|
resolveLoginCommand,
|
|
34
34
|
resolveQuotaFallbackAgent
|
|
35
|
-
} from "./chunk-
|
|
36
|
-
import "./chunk-
|
|
35
|
+
} from "./chunk-3CCRD6WS.js";
|
|
36
|
+
import "./chunk-6K5VAPVR.js";
|
|
37
37
|
import {
|
|
38
38
|
ORCHESTRATOR_AGENT_KINDS,
|
|
39
39
|
assertOrchestratorCapableAgent,
|
|
40
40
|
coerceOrchestratorAgent,
|
|
41
41
|
isOrchestratorCapableAgent
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
42
|
+
} from "./chunk-6GKDYUTJ.js";
|
|
43
|
+
import "./chunk-XVFV56JG.js";
|
|
44
|
+
import "./chunk-6WQAYBVE.js";
|
|
45
45
|
import "./chunk-B3SJXYIJ.js";
|
|
46
46
|
import "./chunk-7FD7COKE.js";
|
|
47
|
+
import "./chunk-AY53MPDE.js";
|
|
48
|
+
import "./chunk-NSTQ6QKD.js";
|
|
49
|
+
import "./chunk-KGZBYWZ3.js";
|
|
50
|
+
import "./chunk-7MV3RXSC.js";
|
|
47
51
|
import {
|
|
48
52
|
conductorBundledBinDir,
|
|
49
53
|
enrichPathWithNpmGlobalBin,
|
|
@@ -52,11 +56,7 @@ import {
|
|
|
52
56
|
posixShellSingleQuote,
|
|
53
57
|
resolveCommandBinarySync,
|
|
54
58
|
withExportedPath
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-UHGN4KCL.js";
|
|
57
|
-
import "./chunk-NSTQ6QKD.js";
|
|
58
|
-
import "./chunk-KGZBYWZ3.js";
|
|
59
|
-
import "./chunk-7MV3RXSC.js";
|
|
59
|
+
} from "./chunk-3KETJKYA.js";
|
|
60
60
|
export {
|
|
61
61
|
CLAUDE_MODEL_CATALOG,
|
|
62
62
|
ORCHESTRATOR_AGENT_KINDS,
|
|
@@ -28,23 +28,23 @@ import {
|
|
|
28
28
|
resolveCursorModelId,
|
|
29
29
|
resolveLoginCommand,
|
|
30
30
|
resolveQuotaFallbackAgent
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-WGI6KXKJ.js";
|
|
32
32
|
import {
|
|
33
33
|
ORCHESTRATOR_AGENT_KINDS,
|
|
34
34
|
assertOrchestratorCapableAgent,
|
|
35
35
|
coerceOrchestratorAgent,
|
|
36
36
|
isOrchestratorCapableAgent
|
|
37
|
-
} from "./chunk-
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
37
|
+
} from "./chunk-JTHWVYSD.js";
|
|
38
|
+
import "./chunk-SH75CXJR.js";
|
|
39
|
+
import "./chunk-HHTHF5BQ.js";
|
|
40
40
|
import {
|
|
41
41
|
cursorSdkMessageToEvents,
|
|
42
42
|
parseCursorRunnerLine
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-CBJSPTBG.js";
|
|
44
|
+
import "./chunk-KRAUS3RF.js";
|
|
45
45
|
import "./chunk-FKOIHGKV.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
import "./chunk-I3FRXL7J.js";
|
|
47
|
+
import "./chunk-5KLC2MWZ.js";
|
|
48
48
|
import "./chunk-JT7R45JB.js";
|
|
49
49
|
import "./chunk-FWJYLBO6.js";
|
|
50
50
|
import "./chunk-77WWLBCI.js";
|
|
@@ -57,7 +57,7 @@ import {
|
|
|
57
57
|
posixShellSingleQuote,
|
|
58
58
|
resolveCommandBinarySync,
|
|
59
59
|
withExportedPath
|
|
60
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-LGXBYZZA.js";
|
|
61
61
|
export {
|
|
62
62
|
CLAUDE_MODEL_CATALOG,
|
|
63
63
|
ORCHESTRATOR_AGENT_KINDS,
|
|
@@ -52,8 +52,8 @@ import {
|
|
|
52
52
|
updateDefaultsSettings,
|
|
53
53
|
updateIntegrationsSettings,
|
|
54
54
|
updateOpencodeSettings
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import "./chunk-
|
|
55
|
+
} from "./chunk-I3FRXL7J.js";
|
|
56
|
+
import "./chunk-5KLC2MWZ.js";
|
|
57
57
|
import "./chunk-JT7R45JB.js";
|
|
58
58
|
import "./chunk-77WWLBCI.js";
|
|
59
59
|
import "./chunk-M37RITA6.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isGlobalRepoPath
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JTHWVYSD.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureGhPreferOrigin,
|
|
6
6
|
resolveRepoRoot
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KRAUS3RF.js";
|
|
8
8
|
import {
|
|
9
9
|
appDataDir
|
|
10
10
|
} from "./chunk-M37RITA6.js";
|
|
@@ -6,27 +6,32 @@ import {
|
|
|
6
6
|
ensureCliTeamTracked,
|
|
7
7
|
ensureConnectedBrightsyTeamTokens,
|
|
8
8
|
loadBrightsyConfig
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6K5VAPVR.js";
|
|
10
10
|
import {
|
|
11
11
|
isOrchestratorThread
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6GKDYUTJ.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
run,
|
|
18
|
-
withExportedPath
|
|
19
|
-
} from "./chunk-AE5VBOFE.js";
|
|
14
|
+
codexUnattendedGitConfigArgs,
|
|
15
|
+
resolveAgentGitAuthEnv
|
|
16
|
+
} from "./chunk-6WQAYBVE.js";
|
|
20
17
|
import {
|
|
21
18
|
claudeChromeEnabled,
|
|
19
|
+
isStrippedElectronLaunch,
|
|
22
20
|
loadAppSettings,
|
|
23
21
|
resolveAgentExecutable,
|
|
24
22
|
resolveClaudeExecutable,
|
|
25
23
|
wrapElectronAsNodeLaunch
|
|
26
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-AY53MPDE.js";
|
|
27
25
|
import {
|
|
28
26
|
appDataDir
|
|
29
27
|
} from "./chunk-7MV3RXSC.js";
|
|
28
|
+
import {
|
|
29
|
+
enrichPathWithNpmGlobalBin,
|
|
30
|
+
isConductorBundledCli,
|
|
31
|
+
resolveCommandBinarySync,
|
|
32
|
+
run,
|
|
33
|
+
withExportedPath
|
|
34
|
+
} from "./chunk-3KETJKYA.js";
|
|
30
35
|
|
|
31
36
|
// src/agents/brightsy.ts
|
|
32
37
|
import { existsSync } from "fs";
|
|
@@ -153,20 +158,38 @@ function pushTurnStderr(tail, line, maxLines = 12) {
|
|
|
153
158
|
tail.push(trimmed);
|
|
154
159
|
while (tail.length > maxLines) tail.shift();
|
|
155
160
|
}
|
|
161
|
+
function looksLikeMinifiedJsDump(line) {
|
|
162
|
+
if (line.length < 200) return false;
|
|
163
|
+
return /yield Promise\.all/.test(line) || /\(0,[A-Za-z$]\.\w+\)/.test(line) || /CURSOR_RIPGREP_PATH/.test(line);
|
|
164
|
+
}
|
|
165
|
+
function looksLikeNestedElectronCrash(line) {
|
|
166
|
+
return /HasCustomHostObject|ElectronInitializeICUandStartNode/i.test(line);
|
|
167
|
+
}
|
|
168
|
+
var NESTED_ELECTRON_SUMMARY = "Cursor local agent crashed at Electron startup (nested Chromium / HasCustomHostObject)";
|
|
169
|
+
var MINIFIED_DUMP_SUMMARY = "Cursor local agent crashed during startup (truncated crash dump)";
|
|
170
|
+
function clipStderr(text, maxChars) {
|
|
171
|
+
const trimmed = text.trim();
|
|
172
|
+
if (trimmed.length <= maxChars) return trimmed;
|
|
173
|
+
return trimmed.slice(0, maxChars);
|
|
174
|
+
}
|
|
156
175
|
function summarizeTurnStderr(tail, maxChars = 500) {
|
|
157
176
|
if (tail.length === 0) return "";
|
|
177
|
+
const cursorStartup = [...tail].reverse().find((line) => /cursor startup failed:/i.test(line));
|
|
178
|
+
if (cursorStartup) return clipStderr(cursorStartup, maxChars);
|
|
179
|
+
if (tail.some(looksLikeNestedElectronCrash)) return NESTED_ELECTRON_SUMMARY;
|
|
158
180
|
const moduleMissing = [...tail].reverse().find((line) => /cannot find module/i.test(line));
|
|
159
|
-
if (moduleMissing)
|
|
160
|
-
|
|
181
|
+
if (moduleMissing) return clipStderr(moduleMissing, maxChars);
|
|
182
|
+
const useful = tail.filter((line) => !looksLikeMinifiedJsDump(line));
|
|
183
|
+
if (useful.length === 0 && tail.some(looksLikeMinifiedJsDump)) {
|
|
184
|
+
return MINIFIED_DUMP_SUMMARY;
|
|
161
185
|
}
|
|
162
|
-
const joined = tail.slice(-6).join("\n").trim();
|
|
163
|
-
|
|
164
|
-
return joined.slice(joined.length - maxChars);
|
|
186
|
+
const joined = (useful.length ? useful : tail).slice(-6).join("\n").trim();
|
|
187
|
+
return clipStderr(joined, maxChars);
|
|
165
188
|
}
|
|
166
189
|
function looksLikeInvalidAgentSession(text) {
|
|
167
190
|
const lower = text.trim().toLowerCase();
|
|
168
191
|
if (!lower) return false;
|
|
169
|
-
return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower);
|
|
192
|
+
return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower);
|
|
170
193
|
}
|
|
171
194
|
function looksLikeAgentFailureMessage(text) {
|
|
172
195
|
const lower = text.trim().toLowerCase();
|
|
@@ -206,6 +229,12 @@ function humanizeAgentFailDetail(detail) {
|
|
|
206
229
|
if (/context.*(too long|exceed)|prompt is too long|conversation too long/.test(lower)) {
|
|
207
230
|
return `${raw} \u2014 start a new chat or compact context, then retry.`;
|
|
208
231
|
}
|
|
232
|
+
if (/hascustomhostobject|electroninitializeicuandstartnode|nested chromium/i.test(lower)) {
|
|
233
|
+
return `${raw} \u2014 retry the turn; if it keeps failing, pick another agent.`;
|
|
234
|
+
}
|
|
235
|
+
if (/corrupt local agent checkpoint|missing root blob|truncated crash dump/.test(lower)) {
|
|
236
|
+
return `${raw} \u2014 retry the turn (Sideboard will start a fresh Cursor session).`;
|
|
237
|
+
}
|
|
209
238
|
return raw;
|
|
210
239
|
}
|
|
211
240
|
function formatTurnExitError(exitCode, stderrSummary) {
|
|
@@ -594,7 +623,12 @@ function applyNodeLaunch(launch, args) {
|
|
|
594
623
|
return { file: launch.file, args, env: launch.env };
|
|
595
624
|
}
|
|
596
625
|
const wrapped = wrapElectronAsNodeLaunch(launch.file, args);
|
|
597
|
-
|
|
626
|
+
if (process.platform === "win32") {
|
|
627
|
+
return { file: wrapped.file, args: wrapped.args, env: launch.env };
|
|
628
|
+
}
|
|
629
|
+
const env = { ...launch.env };
|
|
630
|
+
delete env.ELECTRON_RUN_AS_NODE;
|
|
631
|
+
return { file: wrapped.file, args: wrapped.args, env };
|
|
598
632
|
}
|
|
599
633
|
async function resolveNodeLaunch(scriptPath) {
|
|
600
634
|
if (isAsarPath(scriptPath)) {
|
|
@@ -784,6 +818,10 @@ async function buildInjectedMcpServers(opts) {
|
|
|
784
818
|
if (orchId) {
|
|
785
819
|
sideboard.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID = orchId;
|
|
786
820
|
}
|
|
821
|
+
try {
|
|
822
|
+
Object.assign(sideboard.env, await resolveAgentGitAuthEnv(sideboard.env));
|
|
823
|
+
} catch {
|
|
824
|
+
}
|
|
787
825
|
servers.push(sideboard);
|
|
788
826
|
}
|
|
789
827
|
if (opts.includeBrightsy && isBrightsyConnected()) {
|
|
@@ -806,10 +844,19 @@ async function buildInjectedMcpServers(opts) {
|
|
|
806
844
|
function toCursorMcpServers(servers) {
|
|
807
845
|
const out = {};
|
|
808
846
|
for (const s of servers) {
|
|
847
|
+
const env = s.env ? { ...s.env } : void 0;
|
|
848
|
+
if (env) delete env.ELECTRON_RUN_AS_NODE;
|
|
849
|
+
let command = s.command;
|
|
850
|
+
let args = s.args;
|
|
851
|
+
if (process.platform !== "win32" && !isStrippedElectronLaunch(command, args)) {
|
|
852
|
+
const wrapped = wrapElectronAsNodeLaunch(command, args ?? []);
|
|
853
|
+
command = wrapped.file;
|
|
854
|
+
args = wrapped.args;
|
|
855
|
+
}
|
|
809
856
|
out[s.name] = {
|
|
810
|
-
command
|
|
811
|
-
...
|
|
812
|
-
...
|
|
857
|
+
command,
|
|
858
|
+
...args && args.length > 0 ? { args } : {},
|
|
859
|
+
...env && Object.keys(env).length > 0 ? { env } : {}
|
|
813
860
|
};
|
|
814
861
|
}
|
|
815
862
|
return out;
|
|
@@ -1053,7 +1100,7 @@ var claudeAdapter = {
|
|
|
1053
1100
|
);
|
|
1054
1101
|
}
|
|
1055
1102
|
const mode = permissionMode(thread);
|
|
1056
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
1103
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-U3XVTQLL.js");
|
|
1057
1104
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
1058
1105
|
const injectedServers = await buildInjectedMcpServers({
|
|
1059
1106
|
includeSideboard: true,
|
|
@@ -1435,6 +1482,8 @@ var codexAdapter = {
|
|
|
1435
1482
|
// `codex exec` rejects `--ask-for-approval` (global-only on newer CLIs).
|
|
1436
1483
|
"-c",
|
|
1437
1484
|
'approval_policy="never"',
|
|
1485
|
+
// Seatbelt cannot use the login Keychain; default policy also strips GH_TOKEN.
|
|
1486
|
+
...codexUnattendedGitConfigArgs(mode.codexSandbox),
|
|
1438
1487
|
...model ? ["--model", model] : [],
|
|
1439
1488
|
...mcpOverrides
|
|
1440
1489
|
];
|