@sideboard-ai/core 0.1.111 → 0.1.115

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.
Files changed (43) hide show
  1. package/dist/agents/cursor-runner.cjs +29 -20
  2. package/dist/agents/cursor-runner.js +3 -3
  3. package/dist/{agents-NN22A4G5.js → agents-3X3EFCQY.js} +7 -7
  4. package/dist/{agents-GH3FWDW2.js → agents-AHAFC6FR.js} +10 -10
  5. package/dist/{chunk-4EWPKYOU.js → chunk-4OJMZ6P2.js} +2 -2
  6. package/dist/{chunk-KVFNTWFG.js → chunk-66XTXHR3.js} +244 -36
  7. package/dist/{chunk-KQBI5HNT.js → chunk-7WC5UWEB.js} +2 -2
  8. package/dist/{chunk-WIHKHR5R.js → chunk-AXQ4ZWHK.js} +5 -0
  9. package/dist/{chunk-NC3U42ZP.js → chunk-C6OBY6IC.js} +268 -27
  10. package/dist/{chunk-DMJKOFTO.js → chunk-DCNR7NAL.js} +39 -31
  11. package/dist/{chunk-LGXBYZZA.js → chunk-DVM4ID64.js} +69 -13
  12. package/dist/{chunk-2GO3YKBA.js → chunk-EKIDHL2T.js} +4 -4
  13. package/dist/{chunk-C4KHDW3U.js → chunk-FZCIQYNQ.js} +1 -1
  14. package/dist/{chunk-7KWYXGIU.js → chunk-K3TIQXOH.js} +2 -2
  15. package/dist/{chunk-3KETJKYA.js → chunk-KPIYENTF.js} +69 -13
  16. package/dist/{chunk-JTQQPJAU.js → chunk-MZ6HJ7VL.js} +47 -34
  17. package/dist/{chunk-363Z34PY.js → chunk-SLU5JVKD.js} +251 -217
  18. package/dist/{chunk-VOD3HFLP.js → chunk-XOYQ7LNQ.js} +2 -2
  19. package/dist/{chunk-7YKXHBIW.js → chunk-YMRT2DU6.js} +3 -3
  20. package/dist/{chunk-YXDR43ZC.js → chunk-ZMROW673.js} +5 -5
  21. package/dist/{chunk-YFAXVUY2.js → chunk-ZRCX43LS.js} +2 -2
  22. package/dist/{chunk-AROMOP3C.js → chunk-ZYEFCSZJ.js} +2 -2
  23. package/dist/{connected-teams-M5XNXRI5.js → connected-teams-O6D4PM7A.js} +2 -2
  24. package/dist/{connected-teams-J4I5AKMR.js → connected-teams-ZCOU6KCD.js} +2 -2
  25. package/dist/{coordinator-prompt-AR66L3N4.js → coordinator-prompt-4KCALEKD.js} +3 -3
  26. package/dist/{coordinator-prompt-BHMLWL64.js → coordinator-prompt-FML4I5AR.js} +3 -3
  27. package/dist/{global-workspace-XSUFEIAQ.js → global-workspace-CSWABOG5.js} +4 -4
  28. package/dist/{global-workspace-SKFODUQQ.js → global-workspace-H4YNASM6.js} +4 -4
  29. package/dist/index.cjs +787 -427
  30. package/dist/index.d.cts +53 -1
  31. package/dist/index.d.ts +53 -1
  32. package/dist/index.js +33 -15
  33. package/dist/mcp/run-stdio.cjs +906 -625
  34. package/dist/mcp/run-stdio.js +18 -14
  35. package/dist/{orchestrator-4T2SXDZ7.js → orchestrator-GKLYKLRC.js} +8 -8
  36. package/dist/{orchestrator-EP57AB5W.js → orchestrator-TXASYNHT.js} +10 -10
  37. package/dist/{run-XKTAJRWF.js → run-USF6FRKV.js} +3 -1
  38. package/dist/{run-CFKZPY7F.js → run-XQKGHQZ2.js} +3 -1
  39. package/dist/{workspaces-XAQVKTLO.js → workspaces-HJ3EVATC.js} +5 -5
  40. package/dist/{workspaces-HV3J4TTW.js → workspaces-QG6PGFQR.js} +5 -5
  41. package/dist/{worktree-XFJED3VU.js → worktree-IW3BX26B.js} +2 -2
  42. package/dist/{worktree-N2EV24EE.js → worktree-OTFQO2W7.js} +2 -2
  43. package/package.json +1 -1
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-4TR3HZFT.js";
5
5
  import {
6
6
  run
7
- } from "./chunk-LGXBYZZA.js";
7
+ } from "./chunk-DVM4ID64.js";
8
8
 
9
9
  // src/agents/error-detail.ts
10
10
  function formatUnknownDetail(err) {
@@ -90,7 +90,7 @@ function looksLikeHomebrewLibuvCrash(text) {
90
90
  var NESTED_ELECTRON_SUMMARY = "Cursor local agent crashed at Electron startup (nested Chromium / HasCustomHostObject)";
91
91
  var HOMEBREW_LIBUV_SUMMARY = "Cursor runner crashed in Node (Homebrew Node + shared libuv). Install Node 22 LTS (`brew install node@22`) and retry.";
92
92
  var BUNDLED_NODE_CRASH_SUMMARY = "Cursor runner crashed in Node. Retry the turn.";
93
- var V8_OOM_SUMMARY = "Cursor runner ran out of memory (JavaScript heap). Retry; if it keeps happening, exclude large files from the project folder or start a new chat.";
93
+ var V8_OOM_SUMMARY = "Agent ran out of memory (JavaScript heap). If it keeps happening, exclude large files from the project folder.";
94
94
  var MINIFIED_DUMP_SUMMARY = "Cursor local agent crashed during startup (truncated crash dump)";
95
95
  function clipStderr(text, maxChars) {
96
96
  const trimmed = text.trim();
@@ -145,6 +145,7 @@ function looksLikeRetryableRunnerCrash(text) {
145
145
  }
146
146
  function shouldRetryFailedAgentTurn(detail, opts) {
147
147
  if (looksLikeInvalidAgentSession(detail) && opts.hasSession) return true;
148
+ if (looksLikeV8Oom(detail) && opts.hasSession) return true;
148
149
  return looksLikeRetryableRunnerCrash(detail);
149
150
  }
150
151
  function looksLikeAgentFailureMessage(text) {
@@ -230,6 +231,250 @@ function formatTurnExitError(exitCode, stderrSummary) {
230
231
  return `exit ${code}: ${detail}`;
231
232
  }
232
233
 
234
+ // src/agents/node-launch.ts
235
+ import { existsSync as existsSync2, readdirSync, realpathSync } from "fs";
236
+ import { homedir } from "os";
237
+ import { join as join2 } from "path";
238
+
239
+ // src/agents/packaged-runtime.ts
240
+ import { existsSync } from "fs";
241
+ import { join } from "path";
242
+ function electronResourcesPath() {
243
+ const resources = process.resourcesPath;
244
+ if (typeof resources !== "string" || !resources) return null;
245
+ return resources;
246
+ }
247
+ function packagedCursorRuntimeDir() {
248
+ const resources = electronResourcesPath();
249
+ if (!resources) return null;
250
+ const dir = join(resources, "cursor-runtime");
251
+ if (!existsSync(join(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
252
+ return dir;
253
+ }
254
+ function packagedCursorRunnerPath() {
255
+ const dir = packagedCursorRuntimeDir();
256
+ return dir ? join(dir, "core-dist", "agents", "cursor-runner.js") : null;
257
+ }
258
+ function packagedMcpDir() {
259
+ const resources = electronResourcesPath();
260
+ if (!resources) return null;
261
+ const dir = join(resources, "sideboard-mcp");
262
+ if (!existsSync(join(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
263
+ return dir;
264
+ }
265
+ function packagedMcpStdioPath() {
266
+ const dir = packagedMcpDir();
267
+ return dir ? join(dir, "core-dist", "mcp", "run-stdio.js") : null;
268
+ }
269
+ function packagedBundledNodePath() {
270
+ const resources = electronResourcesPath();
271
+ if (!resources) return null;
272
+ const bin = join(resources, "node", "bin", "node");
273
+ if (!existsSync(bin)) return null;
274
+ return bin;
275
+ }
276
+ function packagedCursorRipgrepCandidate(platformPkg, binName) {
277
+ const dir = packagedCursorRuntimeDir();
278
+ if (!dir) return null;
279
+ return join(dir, "node_modules", platformPkg, "bin", binName);
280
+ }
281
+
282
+ // src/agents/node-launch.ts
283
+ var AGENT_RUNNER_MAX_OLD_SPACE_MB = 8192;
284
+ var MAX_OLD_SPACE_FLAG = /(?:^|\s)(--max[-_]old[-_]space[-_]size)(?:[= ](\d+))?(?=\s|$)/;
285
+ function withMaxOldSpaceSize(nodeOptions, heapMb) {
286
+ const existing = (nodeOptions ?? "").trim();
287
+ const match = MAX_OLD_SPACE_FLAG.exec(existing);
288
+ if (match) {
289
+ const current = match[2] ? Number(match[2]) : 0;
290
+ if (Number.isFinite(current) && current >= heapMb) return existing;
291
+ return existing.replace(MAX_OLD_SPACE_FLAG, ` --max-old-space-size=${heapMb}`).trim();
292
+ }
293
+ return existing ? `${existing} --max-old-space-size=${heapMb}` : `--max-old-space-size=${heapMb}`;
294
+ }
295
+ function applyAgentRunnerHeapEnv(env) {
296
+ env.NODE_OPTIONS = withMaxOldSpaceSize(
297
+ env.NODE_OPTIONS,
298
+ AGENT_RUNNER_MAX_OLD_SPACE_MB
299
+ );
300
+ }
301
+ function envWithAgentHeap(env) {
302
+ const next = { ...env };
303
+ applyAgentRunnerHeapEnv(next);
304
+ return next;
305
+ }
306
+ function isAsarPath(filePath) {
307
+ if (/\.asar\.unpacked([/\\]|$)/.test(filePath)) return false;
308
+ return /\.asar([/\\]|$)/.test(filePath);
309
+ }
310
+ function unpackedAsarPath(filePath) {
311
+ if (!isAsarPath(filePath)) return null;
312
+ const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
313
+ if (unpacked === filePath) return null;
314
+ return existsSync2(unpacked) ? unpacked : null;
315
+ }
316
+ function nodeReadableScriptPath(scriptPath) {
317
+ return unpackedAsarPath(scriptPath) ?? scriptPath;
318
+ }
319
+ var PREFERRED_LTS_MAJORS = [24, 22, 20];
320
+ function parseNodeMajor(version) {
321
+ const match = /^v?(\d+)/.exec(version.trim());
322
+ if (!match) return null;
323
+ const major = Number(match[1]);
324
+ return Number.isInteger(major) ? major : null;
325
+ }
326
+ function scoreNodeForAgentRuntime(candidate) {
327
+ const major = parseNodeMajor(candidate.version);
328
+ if (major == null) return Number.NEGATIVE_INFINITY;
329
+ if (major < 20) return major - 100;
330
+ const posix = candidate.path.replace(/\\/g, "/");
331
+ let score = 0;
332
+ if (major % 2 === 0) {
333
+ score += 1e3 + major * 10;
334
+ } else {
335
+ score += major;
336
+ }
337
+ if (/\/Cellar\/node\/\d/.test(posix) && !/\/Cellar\/node@\d+/.test(posix)) {
338
+ score -= 50;
339
+ }
340
+ return score;
341
+ }
342
+ function pickPreferredNode(candidates) {
343
+ let best = null;
344
+ let bestScore = Number.NEGATIVE_INFINITY;
345
+ for (const candidate of candidates) {
346
+ const score = scoreNodeForAgentRuntime(candidate);
347
+ if (score > bestScore) {
348
+ bestScore = score;
349
+ best = candidate;
350
+ }
351
+ }
352
+ return best;
353
+ }
354
+ function versionDirNodeBins(root, toBin) {
355
+ if (!existsSync2(root)) return [];
356
+ try {
357
+ return readdirSync(root).map(toBin);
358
+ } catch {
359
+ return [];
360
+ }
361
+ }
362
+ function defaultNodeBinCandidates(home = homedir()) {
363
+ const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
364
+ (prefix) => PREFERRED_LTS_MAJORS.map((major) => join2(prefix, "opt", `node@${major}`, "bin", "node"))
365
+ );
366
+ return [
367
+ ...kegs,
368
+ "/opt/homebrew/bin/node",
369
+ "/usr/local/bin/node",
370
+ join2(home, ".local/share/fnm/aliases/default/bin/node"),
371
+ join2(home, ".nvm/current/bin/node"),
372
+ join2(home, ".volta/bin/node"),
373
+ join2(home, ".asdf/shims/node"),
374
+ join2(home, ".local/share/mise/shims/node"),
375
+ ...versionDirNodeBins(
376
+ join2(home, ".nvm", "versions", "node"),
377
+ (name) => join2(home, ".nvm", "versions", "node", name, "bin", "node")
378
+ ),
379
+ ...versionDirNodeBins(
380
+ join2(home, ".local/share/fnm", "node-versions"),
381
+ (name) => join2(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
382
+ ),
383
+ ...versionDirNodeBins(
384
+ join2(home, ".volta", "tools", "image", "node"),
385
+ (name) => join2(home, ".volta", "tools", "image", "node", name, "bin", "node")
386
+ )
387
+ ];
388
+ }
389
+ function uniqueExistingNodeBins(paths) {
390
+ const seen = /* @__PURE__ */ new Set();
391
+ const out = [];
392
+ for (const raw of paths) {
393
+ const p = raw.trim();
394
+ if (!p || !existsSync2(p) || isElectronLikeCommand(p)) continue;
395
+ let key = p;
396
+ try {
397
+ key = realpathSync(p);
398
+ } catch {
399
+ continue;
400
+ }
401
+ if (seen.has(key)) continue;
402
+ seen.add(key);
403
+ out.push(p);
404
+ }
405
+ return out;
406
+ }
407
+ async function whichAllNode() {
408
+ if (process.platform === "win32") {
409
+ const located = await run("where", ["node"], { reject: false, timeoutMs: 5e3 });
410
+ if (located.exitCode !== 0) return [];
411
+ return located.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
412
+ }
413
+ const all = await run("which", ["-a", "node"], { reject: false, timeoutMs: 5e3 });
414
+ if (all.exitCode === 0 && all.stdout.trim()) {
415
+ return all.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
416
+ }
417
+ const single = await run("which", ["node"], { reject: false, timeoutMs: 5e3 });
418
+ if (single.exitCode !== 0 || !single.stdout.trim()) return [];
419
+ return [single.stdout.trim()];
420
+ }
421
+ async function probeNodeVersion(bin) {
422
+ const probed = await run(bin, ["-v"], { reject: false, timeoutMs: 4e3 });
423
+ if (probed.exitCode !== 0) return null;
424
+ const version = probed.stdout.trim().split(/\r?\n/).find(Boolean);
425
+ return version || null;
426
+ }
427
+ async function findSystemNode() {
428
+ const fromPath = await whichAllNode();
429
+ const bins = uniqueExistingNodeBins([...fromPath, ...defaultNodeBinCandidates()]);
430
+ if (bins.length === 0) return null;
431
+ const probed = await Promise.all(
432
+ bins.map(async (path) => {
433
+ const version = await probeNodeVersion(path);
434
+ return version ? { path, version } : null;
435
+ })
436
+ );
437
+ return pickPreferredNode(probed.filter((c) => c != null));
438
+ }
439
+ function applyNodeLaunch(launch, args) {
440
+ const readableArgs = args.map(nodeReadableScriptPath);
441
+ if (!launch.env.ELECTRON_RUN_AS_NODE) {
442
+ return {
443
+ file: launch.file,
444
+ args: readableArgs,
445
+ env: envWithAgentHeap(launch.env)
446
+ };
447
+ }
448
+ const wrapped = wrapElectronAsNodeLaunch(launch.file, readableArgs);
449
+ if (process.platform === "win32") {
450
+ return {
451
+ file: wrapped.file,
452
+ args: wrapped.args,
453
+ env: envWithAgentHeap(launch.env)
454
+ };
455
+ }
456
+ const env = envWithAgentHeap(launch.env);
457
+ delete env.ELECTRON_RUN_AS_NODE;
458
+ return { file: wrapped.file, args: wrapped.args, env };
459
+ }
460
+ async function resolveNodeLaunch(scriptPath) {
461
+ const script = nodeReadableScriptPath(scriptPath);
462
+ if (!isAsarPath(script)) {
463
+ const bundled = packagedBundledNodePath();
464
+ if (bundled && !isElectronLikeCommand(bundled)) {
465
+ return { file: bundled, env: {} };
466
+ }
467
+ const node = await findSystemNode();
468
+ if (node) {
469
+ return { file: node.path, env: {}, nodeVersion: node.version };
470
+ }
471
+ }
472
+ return {
473
+ file: process.execPath,
474
+ env: { ELECTRON_RUN_AS_NODE: "1" }
475
+ };
476
+ }
477
+
233
478
  // src/agents/cursor-events.ts
234
479
  function usageFromCursor(usage) {
235
480
  if (!usage) return null;
@@ -442,221 +687,6 @@ function parseCursorRunnerLine(line) {
442
687
  import { existsSync as existsSync3 } from "fs";
443
688
  import { createRequire } from "module";
444
689
  import { dirname, isAbsolute, join as join3, parse, resolve as resolvePath } from "path";
445
-
446
- // src/agents/node-launch.ts
447
- import { existsSync as existsSync2, readdirSync, realpathSync } from "fs";
448
- import { homedir } from "os";
449
- import { join as join2 } from "path";
450
-
451
- // src/agents/packaged-runtime.ts
452
- import { existsSync } from "fs";
453
- import { join } from "path";
454
- function electronResourcesPath() {
455
- const resources = process.resourcesPath;
456
- if (typeof resources !== "string" || !resources) return null;
457
- return resources;
458
- }
459
- function packagedCursorRuntimeDir() {
460
- const resources = electronResourcesPath();
461
- if (!resources) return null;
462
- const dir = join(resources, "cursor-runtime");
463
- if (!existsSync(join(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
464
- return dir;
465
- }
466
- function packagedCursorRunnerPath() {
467
- const dir = packagedCursorRuntimeDir();
468
- return dir ? join(dir, "core-dist", "agents", "cursor-runner.js") : null;
469
- }
470
- function packagedMcpDir() {
471
- const resources = electronResourcesPath();
472
- if (!resources) return null;
473
- const dir = join(resources, "sideboard-mcp");
474
- if (!existsSync(join(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
475
- return dir;
476
- }
477
- function packagedMcpStdioPath() {
478
- const dir = packagedMcpDir();
479
- return dir ? join(dir, "core-dist", "mcp", "run-stdio.js") : null;
480
- }
481
- function packagedBundledNodePath() {
482
- const resources = electronResourcesPath();
483
- if (!resources) return null;
484
- const bin = join(resources, "node", "bin", "node");
485
- if (!existsSync(bin)) return null;
486
- return bin;
487
- }
488
- function packagedCursorRipgrepCandidate(platformPkg, binName) {
489
- const dir = packagedCursorRuntimeDir();
490
- if (!dir) return null;
491
- return join(dir, "node_modules", platformPkg, "bin", binName);
492
- }
493
-
494
- // src/agents/node-launch.ts
495
- function isAsarPath(filePath) {
496
- if (/\.asar\.unpacked([/\\]|$)/.test(filePath)) return false;
497
- return /\.asar([/\\]|$)/.test(filePath);
498
- }
499
- function unpackedAsarPath(filePath) {
500
- if (!isAsarPath(filePath)) return null;
501
- const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
502
- if (unpacked === filePath) return null;
503
- return existsSync2(unpacked) ? unpacked : null;
504
- }
505
- function nodeReadableScriptPath(scriptPath) {
506
- return unpackedAsarPath(scriptPath) ?? scriptPath;
507
- }
508
- var PREFERRED_LTS_MAJORS = [24, 22, 20];
509
- function parseNodeMajor(version) {
510
- const match = /^v?(\d+)/.exec(version.trim());
511
- if (!match) return null;
512
- const major = Number(match[1]);
513
- return Number.isInteger(major) ? major : null;
514
- }
515
- function scoreNodeForAgentRuntime(candidate) {
516
- const major = parseNodeMajor(candidate.version);
517
- if (major == null) return Number.NEGATIVE_INFINITY;
518
- if (major < 20) return major - 100;
519
- const posix = candidate.path.replace(/\\/g, "/");
520
- let score = 0;
521
- if (major % 2 === 0) {
522
- score += 1e3 + major * 10;
523
- } else {
524
- score += major;
525
- }
526
- if (/\/Cellar\/node\/\d/.test(posix) && !/\/Cellar\/node@\d+/.test(posix)) {
527
- score -= 50;
528
- }
529
- return score;
530
- }
531
- function pickPreferredNode(candidates) {
532
- let best = null;
533
- let bestScore = Number.NEGATIVE_INFINITY;
534
- for (const candidate of candidates) {
535
- const score = scoreNodeForAgentRuntime(candidate);
536
- if (score > bestScore) {
537
- bestScore = score;
538
- best = candidate;
539
- }
540
- }
541
- return best;
542
- }
543
- function versionDirNodeBins(root, toBin) {
544
- if (!existsSync2(root)) return [];
545
- try {
546
- return readdirSync(root).map(toBin);
547
- } catch {
548
- return [];
549
- }
550
- }
551
- function defaultNodeBinCandidates(home = homedir()) {
552
- const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
553
- (prefix) => PREFERRED_LTS_MAJORS.map((major) => join2(prefix, "opt", `node@${major}`, "bin", "node"))
554
- );
555
- return [
556
- ...kegs,
557
- "/opt/homebrew/bin/node",
558
- "/usr/local/bin/node",
559
- join2(home, ".local/share/fnm/aliases/default/bin/node"),
560
- join2(home, ".nvm/current/bin/node"),
561
- join2(home, ".volta/bin/node"),
562
- join2(home, ".asdf/shims/node"),
563
- join2(home, ".local/share/mise/shims/node"),
564
- ...versionDirNodeBins(
565
- join2(home, ".nvm", "versions", "node"),
566
- (name) => join2(home, ".nvm", "versions", "node", name, "bin", "node")
567
- ),
568
- ...versionDirNodeBins(
569
- join2(home, ".local/share/fnm", "node-versions"),
570
- (name) => join2(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
571
- ),
572
- ...versionDirNodeBins(
573
- join2(home, ".volta", "tools", "image", "node"),
574
- (name) => join2(home, ".volta", "tools", "image", "node", name, "bin", "node")
575
- )
576
- ];
577
- }
578
- function uniqueExistingNodeBins(paths) {
579
- const seen = /* @__PURE__ */ new Set();
580
- const out = [];
581
- for (const raw of paths) {
582
- const p = raw.trim();
583
- if (!p || !existsSync2(p) || isElectronLikeCommand(p)) continue;
584
- let key = p;
585
- try {
586
- key = realpathSync(p);
587
- } catch {
588
- continue;
589
- }
590
- if (seen.has(key)) continue;
591
- seen.add(key);
592
- out.push(p);
593
- }
594
- return out;
595
- }
596
- async function whichAllNode() {
597
- if (process.platform === "win32") {
598
- const located = await run("where", ["node"], { reject: false, timeoutMs: 5e3 });
599
- if (located.exitCode !== 0) return [];
600
- return located.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
601
- }
602
- const all = await run("which", ["-a", "node"], { reject: false, timeoutMs: 5e3 });
603
- if (all.exitCode === 0 && all.stdout.trim()) {
604
- return all.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
605
- }
606
- const single = await run("which", ["node"], { reject: false, timeoutMs: 5e3 });
607
- if (single.exitCode !== 0 || !single.stdout.trim()) return [];
608
- return [single.stdout.trim()];
609
- }
610
- async function probeNodeVersion(bin) {
611
- const probed = await run(bin, ["-v"], { reject: false, timeoutMs: 4e3 });
612
- if (probed.exitCode !== 0) return null;
613
- const version = probed.stdout.trim().split(/\r?\n/).find(Boolean);
614
- return version || null;
615
- }
616
- async function findSystemNode() {
617
- const fromPath = await whichAllNode();
618
- const bins = uniqueExistingNodeBins([...fromPath, ...defaultNodeBinCandidates()]);
619
- if (bins.length === 0) return null;
620
- const probed = await Promise.all(
621
- bins.map(async (path) => {
622
- const version = await probeNodeVersion(path);
623
- return version ? { path, version } : null;
624
- })
625
- );
626
- return pickPreferredNode(probed.filter((c) => c != null));
627
- }
628
- function applyNodeLaunch(launch, args) {
629
- const readableArgs = args.map(nodeReadableScriptPath);
630
- if (!launch.env.ELECTRON_RUN_AS_NODE) {
631
- return { file: launch.file, args: readableArgs, env: launch.env };
632
- }
633
- const wrapped = wrapElectronAsNodeLaunch(launch.file, readableArgs);
634
- if (process.platform === "win32") {
635
- return { file: wrapped.file, args: wrapped.args, env: launch.env };
636
- }
637
- const env = { ...launch.env };
638
- delete env.ELECTRON_RUN_AS_NODE;
639
- return { file: wrapped.file, args: wrapped.args, env };
640
- }
641
- async function resolveNodeLaunch(scriptPath) {
642
- const script = nodeReadableScriptPath(scriptPath);
643
- if (!isAsarPath(script)) {
644
- const bundled = packagedBundledNodePath();
645
- if (bundled && !isElectronLikeCommand(bundled)) {
646
- return { file: bundled, env: {} };
647
- }
648
- const node = await findSystemNode();
649
- if (node) {
650
- return { file: node.path, env: {}, nodeVersion: node.version };
651
- }
652
- }
653
- return {
654
- file: process.execPath,
655
- env: { ELECTRON_RUN_AS_NODE: "1" }
656
- };
657
- }
658
-
659
- // src/agents/cursor-ripgrep.ts
660
690
  var RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
661
691
  function rgBinaryName() {
662
692
  return process.platform === "win32" ? "rg.exe" : "rg";
@@ -723,6 +753,7 @@ export {
723
753
  formatUnknownDetail,
724
754
  extractJsonErrorMessage,
725
755
  pushTurnStderr,
756
+ looksLikeV8Oom,
726
757
  summarizeTurnStderr,
727
758
  looksLikeInvalidAgentSession,
728
759
  shouldRetryFailedAgentTurn,
@@ -732,6 +763,9 @@ export {
732
763
  formatTurnExitError,
733
764
  packagedCursorRunnerPath,
734
765
  packagedMcpStdioPath,
766
+ AGENT_RUNNER_MAX_OLD_SPACE_MB,
767
+ withMaxOldSpaceSize,
768
+ applyAgentRunnerHeapEnv,
735
769
  isAsarPath,
736
770
  applyNodeLaunch,
737
771
  resolveNodeLaunch,
@@ -2,12 +2,12 @@
2
2
 
3
3
  import {
4
4
  ensureGlobalCoordinatorCwd
5
- } from "./chunk-AROMOP3C.js";
5
+ } from "./chunk-ZYEFCSZJ.js";
6
6
  import {
7
7
  allocateTeamName,
8
8
  takenSlugsFromThread,
9
9
  teamSlugFromName
10
- } from "./chunk-YXDR43ZC.js";
10
+ } from "./chunk-ZMROW673.js";
11
11
  import {
12
12
  createEmptyThread,
13
13
  listThreads,
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import {
4
+ run
5
+ } from "./chunk-KPIYENTF.js";
3
6
  import {
4
7
  appDataDir
5
8
  } from "./chunk-BD2ICC4D.js";
6
- import {
7
- run
8
- } from "./chunk-3KETJKYA.js";
9
9
 
10
10
  // src/brightsy/connected-teams.ts
11
11
  import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
@@ -6,6 +6,11 @@ import {
6
6
  import {
7
7
  listThreads
8
8
  } from "./chunk-KYOTBZ6S.js";
9
+ import {
10
+ gh,
11
+ git,
12
+ resolveGhAuthToken
13
+ } from "./chunk-KPIYENTF.js";
9
14
  import {
10
15
  getGithubGitAuthMode,
11
16
  getGithubPat
@@ -13,11 +18,6 @@ import {
13
18
  import {
14
19
  worktreesRoot
15
20
  } from "./chunk-BD2ICC4D.js";
16
- import {
17
- gh,
18
- git,
19
- resolveGhAuthToken
20
- } from "./chunk-3KETJKYA.js";
21
21
 
22
22
  // src/git/worktree.ts
23
23
  import { existsSync as existsSync2, readdirSync } from "fs";
@@ -2,11 +2,11 @@
2
2
 
3
3
  import {
4
4
  isGlobalRepoPath
5
- } from "./chunk-VOD3HFLP.js";
5
+ } from "./chunk-XOYQ7LNQ.js";
6
6
  import {
7
7
  ensureGhPreferOrigin,
8
8
  resolveRepoRoot
9
- } from "./chunk-YXDR43ZC.js";
9
+ } from "./chunk-ZMROW673.js";
10
10
  import {
11
11
  appDataDir
12
12
  } from "./chunk-BD2ICC4D.js";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  resolveGithubRepoSlug
5
- } from "./chunk-YXDR43ZC.js";
5
+ } from "./chunk-ZMROW673.js";
6
6
  import {
7
7
  resolveThreadDefaults
8
8
  } from "./chunk-SGEVS5SY.js";
@@ -63,7 +63,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
63
63
  "- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
64
64
  "- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
65
65
  "- send_to_thread \u2014 queue a prompt (start/continue a chat turn); pass force_stop: true to interrupt mid-turn / clear stale queued prompts before replacing with a new request",
66
- "- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply. wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). If stillRunning is true, progress is a live snapshot of tools/thinking \u2014 call wait_for_turn again. Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent. On status error, lastError (and text) is the failure \u2014 switch agent, tell the user, or retry; do not treat empty text as success.",
66
+ "- wait_for_turn / get_turn_result \u2014 wait for and read the agent reply. wait_for_turn returns within ~45s even if the child is still working (MCP clients kill longer tool calls). If stillRunning is true, progress is a live snapshot of tools/thinking \u2014 call wait_for_turn again. status=queued with no lastActivityAt means the child has not started yet (concurrency cap) \u2014 keep waiting; do not force_stop or send a check-in. Do not send \u201Care you stuck?\u201D or assume a hang while lastActivityAt is recent. On status error, lastError (and text) is the failure \u2014 switch agent, tell the user, or retry; do not treat empty text as success.",
67
67
  "- stop_thread \u2014 force-stop: kill in-flight turn AND clear queued prompts (do not leave stale queue after an interrupt)",
68
68
  "- archive_thread / restore_thread \u2014 archive (tears down worktree when last tab) or restore",
69
69
  "Setup / run:",
@@ -9,9 +9,9 @@ import {
9
9
  ensureConnectedBrightsyTeamTokens,
10
10
  getConnectedBrightsyTeamsRaw,
11
11
  listConnectedBrightsyTeams
12
- } from "./chunk-7YKXHBIW.js";
12
+ } from "./chunk-YMRT2DU6.js";
13
+ import "./chunk-KPIYENTF.js";
13
14
  import "./chunk-BD2ICC4D.js";
14
- import "./chunk-3KETJKYA.js";
15
15
  export {
16
16
  applyConnectedTeamToCli,
17
17
  brightsyMcpServerName,
@@ -7,9 +7,9 @@ import {
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  getConnectedBrightsyTeamsRaw,
9
9
  listConnectedBrightsyTeams
10
- } from "./chunk-2GO3YKBA.js";
10
+ } from "./chunk-EKIDHL2T.js";
11
11
  import "./chunk-QZQEXME2.js";
12
- import "./chunk-LGXBYZZA.js";
12
+ import "./chunk-DVM4ID64.js";
13
13
  export {
14
14
  applyConnectedTeamToCli,
15
15
  brightsyMcpServerName,
@@ -7,8 +7,8 @@ import {
7
7
  enrichWorkspacesWithGithub,
8
8
  ensureGlobalCoordinatorCwd,
9
9
  formatWorkspaceInventory
10
- } from "./chunk-KQBI5HNT.js";
11
- import "./chunk-C4KHDW3U.js";
10
+ } from "./chunk-7WC5UWEB.js";
11
+ import "./chunk-FZCIQYNQ.js";
12
12
  import "./chunk-FKOIHGKV.js";
13
13
  import "./chunk-4NR5FL46.js";
14
14
  import "./chunk-4TR3HZFT.js";
@@ -16,7 +16,7 @@ import "./chunk-JT7R45JB.js";
16
16
  import "./chunk-A4VZXJEJ.js";
17
17
  import "./chunk-77WWLBCI.js";
18
18
  import "./chunk-QZQEXME2.js";
19
- import "./chunk-LGXBYZZA.js";
19
+ import "./chunk-DVM4ID64.js";
20
20
  export {
21
21
  COORDINATOR_TOOL_PLAYBOOK,
22
22
  SLACK_REPLY_FORMATTING,
@@ -9,15 +9,15 @@ import {
9
9
  enrichWorkspacesWithGithub,
10
10
  ensureGlobalCoordinatorCwd,
11
11
  formatWorkspaceInventory
12
- } from "./chunk-AROMOP3C.js";
13
- import "./chunk-YXDR43ZC.js";
12
+ } from "./chunk-ZYEFCSZJ.js";
13
+ import "./chunk-ZMROW673.js";
14
14
  import "./chunk-B3SJXYIJ.js";
15
15
  import "./chunk-KYOTBZ6S.js";
16
+ import "./chunk-KPIYENTF.js";
16
17
  import "./chunk-SGEVS5SY.js";
17
18
  import "./chunk-NSTQ6QKD.js";
18
19
  import "./chunk-KGZBYWZ3.js";
19
20
  import "./chunk-BD2ICC4D.js";
20
- import "./chunk-3KETJKYA.js";
21
21
  export {
22
22
  COORDINATOR_TOOL_PLAYBOOK,
23
23
  SLACK_REPLY_FORMATTING,