@sideboard-ai/core 0.1.37 → 0.1.39

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.
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  cursorSdkMessageToEvents,
4
4
  formatUnknownDetail
5
- } from "../chunk-BSZX63TV.js";
5
+ } from "../chunk-PU27NUO4.js";
6
6
  import {
7
7
  appDataDir
8
8
  } from "../chunk-M37RITA6.js";
@@ -21,12 +21,12 @@ import {
21
21
  opencodeAdapter,
22
22
  permissionMode,
23
23
  resolveCursorModelId
24
- } from "./chunk-5KZLWNBS.js";
24
+ } from "./chunk-BEXVE7LX.js";
25
25
  import "./chunk-ILQK4P5R.js";
26
26
  import {
27
27
  cursorSdkMessageToEvents,
28
28
  parseCursorRunnerLine
29
- } from "./chunk-BSZX63TV.js";
29
+ } from "./chunk-PU27NUO4.js";
30
30
  import "./chunk-YZ23S32T.js";
31
31
  import "./chunk-M37RITA6.js";
32
32
  import {
@@ -25,14 +25,14 @@ import {
25
25
  allAdapters,
26
26
  getAdapter,
27
27
  parseBrightsyCliLine
28
- } from "./chunk-5KZLWNBS.js";
28
+ } from "./chunk-BEXVE7LX.js";
29
29
  import {
30
30
  fallbackTurnFailDetail,
31
31
  formatTurnExitError,
32
32
  looksLikeAgentFailureMessage,
33
33
  pushTurnStderr,
34
34
  summarizeTurnStderr
35
- } from "./chunk-BSZX63TV.js";
35
+ } from "./chunk-PU27NUO4.js";
36
36
  import {
37
37
  childEnvWithAppSettings,
38
38
  getLinearApiKey,
@@ -311,12 +311,20 @@ function diffFromInput(input) {
311
311
  }
312
312
  function parseDiffStat(result) {
313
313
  if (!result) return {};
314
- const plus = result.match(/\+(\d+)/);
315
- const minus = result.match(/-(\d+)/);
316
- if (plus || minus) {
314
+ const paired = result.match(/\+(\d+)\s+-(\d+)/);
315
+ if (paired) {
317
316
  return {
318
- additions: plus ? Number(plus[1]) : void 0,
319
- deletions: minus ? Number(minus[1]) : void 0
317
+ additions: Number(paired[1]),
318
+ deletions: Number(paired[2])
319
+ };
320
+ }
321
+ const verbose = result.match(
322
+ /(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
323
+ );
324
+ if (verbose) {
325
+ return {
326
+ additions: Number(verbose[1]),
327
+ deletions: verbose[2] != null ? Number(verbose[2]) : void 0
320
328
  };
321
329
  }
322
330
  return {};
@@ -388,8 +396,8 @@ function applyAgentEvent(parts, event) {
388
396
  ...p,
389
397
  status: event.isError ? "error" : "done",
390
398
  result: event.content,
391
- additions: fromResult.additions ?? p.additions,
392
- deletions: fromResult.deletions ?? p.deletions
399
+ ...fromResult.additions != null ? { additions: fromResult.additions } : {},
400
+ ...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
393
401
  };
394
402
  });
395
403
  return next;
@@ -2606,7 +2614,7 @@ async function createThread(input, onSetupLine) {
2606
2614
  return readThread(thread.id) ?? thread;
2607
2615
  }
2608
2616
  async function listLinearIssues(agent, repoPath) {
2609
- const { getAdapter: getAdapter2 } = await import("./agents-3CD7GH2V.js");
2617
+ const { getAdapter: getAdapter2 } = await import("./agents-DDW4NBBW.js");
2610
2618
  await requireAgent(agent, { requireLinear: true });
2611
2619
  const adapter = getAdapter2(agent);
2612
2620
  if (!adapter.listLinearIssues) {
@@ -10,7 +10,7 @@ import {
10
10
  formatUnknownDetail,
11
11
  looksLikeAgentFailureMessage,
12
12
  parseCursorRunnerLine
13
- } from "./chunk-BSZX63TV.js";
13
+ } from "./chunk-PU27NUO4.js";
14
14
  import {
15
15
  claudeChromeEnabled,
16
16
  loadAppSettings,
@@ -434,6 +434,30 @@ import { createRequire } from "module";
434
434
  import { tmpdir } from "os";
435
435
  import { dirname, join } from "path";
436
436
  import { fileURLToPath } from "url";
437
+
438
+ // src/agents/node-launch.ts
439
+ function isAsarPath(filePath) {
440
+ return /\.asar([/\\]|$)/.test(filePath);
441
+ }
442
+ async function resolveNodeLaunch(scriptPath) {
443
+ if (isAsarPath(scriptPath)) {
444
+ return {
445
+ file: process.execPath,
446
+ env: { ELECTRON_RUN_AS_NODE: "1" }
447
+ };
448
+ }
449
+ const whichNode = await run("which", ["node"], { reject: false });
450
+ const nodeBin = whichNode.exitCode === 0 && whichNode.stdout.trim() ? whichNode.stdout.trim() : null;
451
+ if (nodeBin) {
452
+ return { file: nodeBin, env: {} };
453
+ }
454
+ return {
455
+ file: process.execPath,
456
+ env: { ELECTRON_RUN_AS_NODE: "1" }
457
+ };
458
+ }
459
+
460
+ // src/agents/injected-mcp.ts
437
461
  var SIDEBOARD_MCP_ALLOWED_TOOLS = [
438
462
  "mcp__sideboard",
439
463
  "mcp__sideboard__*"
@@ -536,11 +560,13 @@ async function resolveSideboardMcpServer() {
536
560
  const entry = findSideboardMcpJsEntry();
537
561
  if (entry) {
538
562
  const isCli = /[/\\]cli[/\\]dist[/\\]index\.js$/.test(entry);
563
+ const scriptArgs = isCli ? [entry, "mcp"] : [entry];
564
+ const launch = await resolveNodeLaunch(entry);
539
565
  return {
540
566
  name: "sideboard",
541
- // Use `node` (not process.execPath) — under Electron execPath is Electron itself.
542
- command: "node",
543
- args: isCli ? [entry, "mcp"] : [entry]
567
+ command: launch.file,
568
+ args: scriptArgs,
569
+ ...Object.keys(launch.env).length > 0 ? { env: launch.env } : {}
544
570
  };
545
571
  }
546
572
  const which = await run("which", ["sideboard"], { reject: false });
@@ -1324,16 +1350,14 @@ var cursorAdapter = {
1324
1350
  };
1325
1351
  const runner = cursorRunnerPath();
1326
1352
  const isTs = runner.endsWith(".ts");
1327
- const whichNode = await run("which", ["node"], { reject: false });
1328
- const nodeBin = whichNode.exitCode === 0 && whichNode.stdout.trim() ? whichNode.stdout.trim() : null;
1329
- const file = nodeBin || process.execPath;
1353
+ const launch = await resolveNodeLaunch(runner);
1330
1354
  return {
1331
- file,
1355
+ file: launch.file,
1332
1356
  args: isTs ? ["--import", "tsx", runner] : [runner],
1333
1357
  cwd: thread.worktreePath,
1334
1358
  stdin: JSON.stringify(req),
1335
1359
  env: {
1336
- ...nodeBin ? {} : { ELECTRON_RUN_AS_NODE: "1" },
1360
+ ...launch.env,
1337
1361
  ...apiKey ? { CURSOR_API_KEY: apiKey } : {}
1338
1362
  }
1339
1363
  };
@@ -52,6 +52,10 @@ function pushTurnStderr(tail, line, maxLines = 12) {
52
52
  }
53
53
  function summarizeTurnStderr(tail, maxChars = 500) {
54
54
  if (tail.length === 0) return "";
55
+ const moduleMissing = [...tail].reverse().find((line) => /cannot find module/i.test(line));
56
+ if (moduleMissing) {
57
+ return moduleMissing.length <= maxChars ? moduleMissing : moduleMissing.slice(0, maxChars);
58
+ }
55
59
  const joined = tail.slice(-6).join("\n").trim();
56
60
  if (joined.length <= maxChars) return joined;
57
61
  return joined.slice(joined.length - maxChars);
package/dist/index.cjs CHANGED
@@ -3797,6 +3797,10 @@ function pushTurnStderr(tail, line, maxLines = 12) {
3797
3797
  }
3798
3798
  function summarizeTurnStderr(tail, maxChars = 500) {
3799
3799
  if (tail.length === 0) return "";
3800
+ const moduleMissing = [...tail].reverse().find((line) => /cannot find module/i.test(line));
3801
+ if (moduleMissing) {
3802
+ return moduleMissing.length <= maxChars ? moduleMissing : moduleMissing.slice(0, maxChars);
3803
+ }
3800
3804
  const joined = tail.slice(-6).join("\n").trim();
3801
3805
  if (joined.length <= maxChars) return joined;
3802
3806
  return joined.slice(joined.length - maxChars);
@@ -4256,6 +4260,34 @@ var init_claude_mcp = __esm({
4256
4260
  }
4257
4261
  });
4258
4262
 
4263
+ // src/agents/node-launch.ts
4264
+ function isAsarPath(filePath) {
4265
+ return /\.asar([/\\]|$)/.test(filePath);
4266
+ }
4267
+ async function resolveNodeLaunch(scriptPath) {
4268
+ if (isAsarPath(scriptPath)) {
4269
+ return {
4270
+ file: process.execPath,
4271
+ env: { ELECTRON_RUN_AS_NODE: "1" }
4272
+ };
4273
+ }
4274
+ const whichNode = await run("which", ["node"], { reject: false });
4275
+ const nodeBin = whichNode.exitCode === 0 && whichNode.stdout.trim() ? whichNode.stdout.trim() : null;
4276
+ if (nodeBin) {
4277
+ return { file: nodeBin, env: {} };
4278
+ }
4279
+ return {
4280
+ file: process.execPath,
4281
+ env: { ELECTRON_RUN_AS_NODE: "1" }
4282
+ };
4283
+ }
4284
+ var init_node_launch = __esm({
4285
+ "src/agents/node-launch.ts"() {
4286
+ "use strict";
4287
+ init_run();
4288
+ }
4289
+ });
4290
+
4259
4291
  // src/agents/injected-mcp.ts
4260
4292
  async function resolveBrightsyMcpCommand() {
4261
4293
  const now = Date.now();
@@ -4345,11 +4377,13 @@ async function resolveSideboardMcpServer() {
4345
4377
  const entry = findSideboardMcpJsEntry();
4346
4378
  if (entry) {
4347
4379
  const isCli = /[/\\]cli[/\\]dist[/\\]index\.js$/.test(entry);
4380
+ const scriptArgs = isCli ? [entry, "mcp"] : [entry];
4381
+ const launch = await resolveNodeLaunch(entry);
4348
4382
  return {
4349
4383
  name: "sideboard",
4350
- // Use `node` (not process.execPath) — under Electron execPath is Electron itself.
4351
- command: "node",
4352
- args: isCli ? [entry, "mcp"] : [entry]
4384
+ command: launch.file,
4385
+ args: scriptArgs,
4386
+ ...Object.keys(launch.env).length > 0 ? { env: launch.env } : {}
4353
4387
  };
4354
4388
  }
4355
4389
  const which = await run("which", ["sideboard"], { reject: false });
@@ -4410,6 +4444,7 @@ var init_injected_mcp = __esm({
4410
4444
  init_run();
4411
4445
  init_config();
4412
4446
  init_connected_teams();
4447
+ init_node_launch();
4413
4448
  import_meta = {};
4414
4449
  SIDEBOARD_MCP_ALLOWED_TOOLS = [
4415
4450
  "mcp__sideboard",
@@ -5241,6 +5276,7 @@ var init_cursor = __esm({
5241
5276
  init_run();
5242
5277
  init_app_settings();
5243
5278
  init_cursor_events();
5279
+ init_node_launch();
5244
5280
  init_turn_input();
5245
5281
  init_cursor_events();
5246
5282
  import_meta2 = {};
@@ -5301,16 +5337,14 @@ var init_cursor = __esm({
5301
5337
  };
5302
5338
  const runner = cursorRunnerPath();
5303
5339
  const isTs = runner.endsWith(".ts");
5304
- const whichNode = await run("which", ["node"], { reject: false });
5305
- const nodeBin = whichNode.exitCode === 0 && whichNode.stdout.trim() ? whichNode.stdout.trim() : null;
5306
- const file = nodeBin || process.execPath;
5340
+ const launch = await resolveNodeLaunch(runner);
5307
5341
  return {
5308
- file,
5342
+ file: launch.file,
5309
5343
  args: isTs ? ["--import", "tsx", runner] : [runner],
5310
5344
  cwd: thread.worktreePath,
5311
5345
  stdin: JSON.stringify(req),
5312
5346
  env: {
5313
- ...nodeBin ? {} : { ELECTRON_RUN_AS_NODE: "1" },
5347
+ ...launch.env,
5314
5348
  ...apiKey ? { CURSOR_API_KEY: apiKey } : {}
5315
5349
  }
5316
5350
  };
@@ -5873,6 +5907,8 @@ __export(index_exports, {
5873
5907
  HARNESS_ENV_KEYS: () => HARNESS_ENV_KEYS,
5874
5908
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS: () => MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
5875
5909
  Orchestrator: () => Orchestrator,
5910
+ PASTE_ATTACH_MIN_CHARS: () => PASTE_ATTACH_MIN_CHARS,
5911
+ PASTE_ATTACH_MIN_LINES: () => PASTE_ATTACH_MIN_LINES,
5876
5912
  PLAN_MODE_INSTRUCTION: () => PLAN_MODE_INSTRUCTION,
5877
5913
  SIDEBOARD_FORCE_STOP: () => SIDEBOARD_FORCE_STOP,
5878
5914
  SIDEBOARD_MCP_ALLOWED_TOOLS: () => SIDEBOARD_MCP_ALLOWED_TOOLS,
@@ -5907,6 +5943,7 @@ __export(index_exports, {
5907
5943
  buildClaudeStreamJsonUserMessage: () => buildClaudeStreamJsonUserMessage,
5908
5944
  buildDiffCommentAttachment: () => buildDiffCommentAttachment,
5909
5945
  buildForkTranscriptAttachment: () => buildForkTranscriptAttachment,
5946
+ buildPastedTextAttachment: () => buildPastedTextAttachment,
5910
5947
  buildSessionSeed: () => buildSessionSeed,
5911
5948
  buildWorkspaceScriptEnv: () => buildWorkspaceScriptEnv,
5912
5949
  caffeinateWhileCloudConnectEnabled: () => caffeinateWhileCloudConnectEnabled,
@@ -6060,6 +6097,7 @@ __export(index_exports, {
6060
6097
  mcpAuthWarnings: () => mcpAuthWarnings,
6061
6098
  mergePr: () => mergePr,
6062
6099
  mergeUsage: () => mergeUsage,
6100
+ nextPastedTextName: () => nextPastedTextName,
6063
6101
  normalizeParseResult: () => normalizeParseResult,
6064
6102
  normalizeThread: () => normalizeThread,
6065
6103
  normalizeTurnInput: () => normalizeTurnInput,
@@ -6074,6 +6112,7 @@ __export(index_exports, {
6074
6112
  parseGithubSlugFromRemoteUrl: () => parseGithubSlugFromRemoteUrl,
6075
6113
  parseMcpList: () => parseMcpList,
6076
6114
  partsToAssistantText: () => partsToAssistantText,
6115
+ pastedTextStats: () => pastedTextStats,
6077
6116
  permissionMode: () => permissionMode,
6078
6117
  previewLand: () => previewLand,
6079
6118
  pushBranch: () => pushBranch,
@@ -6109,6 +6148,7 @@ __export(index_exports, {
6109
6148
  saveAppSettings: () => saveAppSettings,
6110
6149
  setStatus: () => setStatus,
6111
6150
  settingsSourceLabel: () => settingsSourceLabel,
6151
+ shouldAttachPastedText: () => shouldAttachPastedText,
6112
6152
  shouldCompactContext: () => shouldCompactContext,
6113
6153
  shouldRunWorktreeCleanup: () => shouldRunWorktreeCleanup,
6114
6154
  sideboardHomeDir: () => sideboardHomeDir,
@@ -6445,12 +6485,20 @@ function diffFromInput(input) {
6445
6485
  }
6446
6486
  function parseDiffStat(result) {
6447
6487
  if (!result) return {};
6448
- const plus = result.match(/\+(\d+)/);
6449
- const minus = result.match(/-(\d+)/);
6450
- if (plus || minus) {
6488
+ const paired = result.match(/\+(\d+)\s+-(\d+)/);
6489
+ if (paired) {
6451
6490
  return {
6452
- additions: plus ? Number(plus[1]) : void 0,
6453
- deletions: minus ? Number(minus[1]) : void 0
6491
+ additions: Number(paired[1]),
6492
+ deletions: Number(paired[2])
6493
+ };
6494
+ }
6495
+ const verbose = result.match(
6496
+ /(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
6497
+ );
6498
+ if (verbose) {
6499
+ return {
6500
+ additions: Number(verbose[1]),
6501
+ deletions: verbose[2] != null ? Number(verbose[2]) : void 0
6454
6502
  };
6455
6503
  }
6456
6504
  return {};
@@ -6522,8 +6570,8 @@ function applyAgentEvent(parts, event) {
6522
6570
  ...p,
6523
6571
  status: event.isError ? "error" : "done",
6524
6572
  result: event.content,
6525
- additions: fromResult.additions ?? p.additions,
6526
- deletions: fromResult.deletions ?? p.deletions
6573
+ ...fromResult.additions != null ? { additions: fromResult.additions } : {},
6574
+ ...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
6527
6575
  };
6528
6576
  });
6529
6577
  return next;
@@ -8289,6 +8337,42 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
8289
8337
  return out;
8290
8338
  }
8291
8339
 
8340
+ // src/composer/pasted-text.ts
8341
+ var import_node_crypto3 = require("crypto");
8342
+ var PASTE_ATTACH_MIN_CHARS = 1200;
8343
+ var PASTE_ATTACH_MIN_LINES = 15;
8344
+ var PASTED_NAME_RE = /^Pasted text #(\d+)\.txt$/i;
8345
+ var PASTED_NAME_ALT_RE = /^pasted-(\d+)\.txt$/i;
8346
+ function pastedTextStats(text) {
8347
+ const chars = text.length;
8348
+ if (chars === 0) return { chars: 0, lines: 0 };
8349
+ const lines = text.split(/\r\n|\r|\n/).length;
8350
+ return { chars, lines };
8351
+ }
8352
+ function shouldAttachPastedText(text) {
8353
+ const trimmed = text.trim();
8354
+ if (!trimmed) return false;
8355
+ const { chars, lines } = pastedTextStats(text);
8356
+ return chars >= PASTE_ATTACH_MIN_CHARS || lines >= PASTE_ATTACH_MIN_LINES;
8357
+ }
8358
+ function nextPastedTextName(existing) {
8359
+ let max = 0;
8360
+ for (const a of existing) {
8361
+ const m = PASTED_NAME_RE.exec(a.name) ?? PASTED_NAME_ALT_RE.exec(a.name);
8362
+ if (m?.[1]) max = Math.max(max, Number(m[1]));
8363
+ }
8364
+ return `Pasted text #${max + 1}.txt`;
8365
+ }
8366
+ function buildPastedTextAttachment(text, opts) {
8367
+ return {
8368
+ id: opts?.id ?? (0, import_node_crypto3.randomUUID)(),
8369
+ name: opts?.name ?? "Pasted text #1.txt",
8370
+ kind: "file",
8371
+ path: opts?.path,
8372
+ content: text
8373
+ };
8374
+ }
8375
+
8292
8376
  // src/composer/summarize.ts
8293
8377
  init_run();
8294
8378
  init_path();
@@ -8817,7 +8901,7 @@ async function listLinearIssues(agent, repoPath) {
8817
8901
  }
8818
8902
 
8819
8903
  // src/threads/chat-tabs.ts
8820
- var import_node_crypto3 = require("crypto");
8904
+ var import_node_crypto4 = require("crypto");
8821
8905
  init_teams();
8822
8906
  init_worktree_labels();
8823
8907
  init_global_workspace();
@@ -8873,7 +8957,7 @@ function forkMessageSlice(from, throughIndex) {
8873
8957
  function buildForkTranscriptAttachment(baseTitle, messages) {
8874
8958
  const title = baseTitle || "Chat";
8875
8959
  return {
8876
- id: (0, import_node_crypto3.randomUUID)(),
8960
+ id: (0, import_node_crypto4.randomUUID)(),
8877
8961
  name: `Transcript of ${title}.md`,
8878
8962
  kind: "transcript",
8879
8963
  content: formatTranscriptMarkdown(title, messages)
@@ -11597,6 +11681,8 @@ init_injected_mcp();
11597
11681
  HARNESS_ENV_KEYS,
11598
11682
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
11599
11683
  Orchestrator,
11684
+ PASTE_ATTACH_MIN_CHARS,
11685
+ PASTE_ATTACH_MIN_LINES,
11600
11686
  PLAN_MODE_INSTRUCTION,
11601
11687
  SIDEBOARD_FORCE_STOP,
11602
11688
  SIDEBOARD_MCP_ALLOWED_TOOLS,
@@ -11631,6 +11717,7 @@ init_injected_mcp();
11631
11717
  buildClaudeStreamJsonUserMessage,
11632
11718
  buildDiffCommentAttachment,
11633
11719
  buildForkTranscriptAttachment,
11720
+ buildPastedTextAttachment,
11634
11721
  buildSessionSeed,
11635
11722
  buildWorkspaceScriptEnv,
11636
11723
  caffeinateWhileCloudConnectEnabled,
@@ -11784,6 +11871,7 @@ init_injected_mcp();
11784
11871
  mcpAuthWarnings,
11785
11872
  mergePr,
11786
11873
  mergeUsage,
11874
+ nextPastedTextName,
11787
11875
  normalizeParseResult,
11788
11876
  normalizeThread,
11789
11877
  normalizeTurnInput,
@@ -11798,6 +11886,7 @@ init_injected_mcp();
11798
11886
  parseGithubSlugFromRemoteUrl,
11799
11887
  parseMcpList,
11800
11888
  partsToAssistantText,
11889
+ pastedTextStats,
11801
11890
  permissionMode,
11802
11891
  previewLand,
11803
11892
  pushBranch,
@@ -11833,6 +11922,7 @@ init_injected_mcp();
11833
11922
  saveAppSettings,
11834
11923
  setStatus,
11835
11924
  settingsSourceLabel,
11925
+ shouldAttachPastedText,
11836
11926
  shouldCompactContext,
11837
11927
  shouldRunWorktreeCleanup,
11838
11928
  sideboardHomeDir,
package/dist/index.d.cts CHANGED
@@ -1637,6 +1637,33 @@ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAt
1637
1637
  */
1638
1638
  declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
1639
1639
 
1640
+ /** Paste this large → attach as a doc chip instead of flooding the composer. */
1641
+ declare const PASTE_ATTACH_MIN_CHARS = 1200;
1642
+ /** Or this many lines (whichever hits first). */
1643
+ declare const PASTE_ATTACH_MIN_LINES = 15;
1644
+ declare function pastedTextStats(text: string): {
1645
+ chars: number;
1646
+ lines: number;
1647
+ };
1648
+ /**
1649
+ * True when clipboard text is large enough that Claude-style doc attachment
1650
+ * is preferable to dumping it into the message input.
1651
+ */
1652
+ declare function shouldAttachPastedText(text: string): boolean;
1653
+ /** Next `Pasted text #N.txt` name given existing composer attachments. */
1654
+ declare function nextPastedTextName(existing: Array<{
1655
+ name: string;
1656
+ }>): string;
1657
+ /**
1658
+ * Build a file-kind attachment for a large paste. Content is expanded into the
1659
+ * agent prompt via `expandComposerPrompt` like other composer attachments.
1660
+ */
1661
+ declare function buildPastedTextAttachment(text: string, opts?: {
1662
+ name?: string;
1663
+ id?: string;
1664
+ path?: string;
1665
+ }): ThreadAttachment;
1666
+
1640
1667
  interface SummarizeResult {
1641
1668
  summary: string;
1642
1669
  method: 'claude' | 'extractive';
@@ -2636,4 +2663,4 @@ declare function writeInjectedMcpConfig(opts: {
2636
2663
  includeBrightsy?: boolean;
2637
2664
  }): Promise<string | null>;
2638
2665
 
2639
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2666
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.d.ts CHANGED
@@ -1637,6 +1637,33 @@ declare function attachmentsFromBuffers(buffers: ComposerFileBuffer[]): ThreadAt
1637
1637
  */
1638
1638
  declare function attachmentsFromWorktreePaths(worktreePath: string, relativePaths: string[]): ThreadAttachment[];
1639
1639
 
1640
+ /** Paste this large → attach as a doc chip instead of flooding the composer. */
1641
+ declare const PASTE_ATTACH_MIN_CHARS = 1200;
1642
+ /** Or this many lines (whichever hits first). */
1643
+ declare const PASTE_ATTACH_MIN_LINES = 15;
1644
+ declare function pastedTextStats(text: string): {
1645
+ chars: number;
1646
+ lines: number;
1647
+ };
1648
+ /**
1649
+ * True when clipboard text is large enough that Claude-style doc attachment
1650
+ * is preferable to dumping it into the message input.
1651
+ */
1652
+ declare function shouldAttachPastedText(text: string): boolean;
1653
+ /** Next `Pasted text #N.txt` name given existing composer attachments. */
1654
+ declare function nextPastedTextName(existing: Array<{
1655
+ name: string;
1656
+ }>): string;
1657
+ /**
1658
+ * Build a file-kind attachment for a large paste. Content is expanded into the
1659
+ * agent prompt via `expandComposerPrompt` like other composer attachments.
1660
+ */
1661
+ declare function buildPastedTextAttachment(text: string, opts?: {
1662
+ name?: string;
1663
+ id?: string;
1664
+ path?: string;
1665
+ }): ThreadAttachment;
1666
+
1640
1667
  interface SummarizeResult {
1641
1668
  summary: string;
1642
1669
  method: 'claude' | 'extractive';
@@ -2636,4 +2663,4 @@ declare function writeInjectedMcpConfig(opts: {
2636
2663
  includeBrightsy?: boolean;
2637
2664
  }): Promise<string | null>;
2638
2665
 
2639
- export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
2666
+ export { type ActiveRun, type AdoptInput, type AdvancedAppSettings, type AgentAdapter, type AgentEvent, type AgentInstructionFile, type AgentKind, type AgentModelInfo, type AgentSetupActionResult, type AgentSetupInfo, type AgentSetupKind, type AgentStatus, type AgentTurnInput, type AnthropicCacheControl, type AppSettings, type ApplyIntoMainResult, type AttachCommand, type Autonomy, BRIGHTSY_MCP_ALLOWED_TOOLS, type BranchInfo, type BrightsyAccount, type BrightsyChatTarget, type BrightsyChatTargets, type BrightsyCloudConnectAgent, type BrightsyHarnessSettings, type BrightsySession, BrightsySideboardApi, type BrightsyTeamTargets, CLOUD_COORDINATOR_BUSY_REPLY, CLOUD_COORDINATOR_STOPPED_REPLY, CLOUD_COORDINATOR_TIMEOUT_REPLY, CLOUD_ORCHESTRATOR_GOAL, CONTEXT_COMPACT_CHARS, CONTEXT_KEEP_RECENT_CHARS, CONTEXT_KEEP_RECENT_MESSAGES, CONTEXT_MIN_MESSAGES, COORDINATOR_TOOL_PLAYBOOK, type ClaudeHarnessSettings, type CleanupOrphansResult, type CloudConnectAgent, type CloudConnectOptions, type CloudConnectStatus, type CompactResult, type CompactThresholds, type ComposerFileBuffer, type ConductorSettings, type ConductorWorkspace, type ConnectedBrightsyTeamInfo, type CreateChatTabInput, type CreateGlobalChatOpts, type CreateThreadInput, type CreateWorktreeResult, type CursorModelInfo, type CursorSdkStreamMessage, type CursorTurnRequest, type CursorWorktreesConfig, type DefaultsAppSettings, type DevServerHandle, type DiffCommentInput, type DiffCommentLine, type DiffCommit, type DiffFile, type DiffResult, type DiffScope, type DiffScopeStat, type ExpandResult, FAMOUS_SOCCER_TEAMS, type ForkChatTabInput, type ForkThreadWorktreeInput, type FormatGhLandErrorOptions, GLOBAL_WORKSPACE_ID, type GetDiffOptions, type GitHubStatus, type GitWorktreeStatus, HARNESS_ENV_KEYS, type HarnessId, type IntegrationsSettings, type IpcApi, type IssueInfo, type IssueSource, type LandPreview, type LandResult, type ListIssuesResult, MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS, type McpServerStatus, type MessagePart, Orchestrator, type OrchestratorEvent, type OrchestratorRuntime, type OrphanWorktree, PASTE_ATTACH_MIN_CHARS, PASTE_ATTACH_MIN_LINES, PLAN_MODE_INSTRUCTION, type PrActor, type PrCheckRun, type PrCommentInfo, type PrCommitInfo, type PrDetails, type PrInfo, type PrMeta, type PrReviewInfo, type RepoSettings, type RepoSetupInfo, type RunMode, type RunScript, SIDEBOARD_FORCE_STOP, SIDEBOARD_MCP_ALLOWED_TOOLS, type ScriptHandle, type SkillInfo, type SourceType, type SpawnTurnHandle, type SummarizeResult, type TeamName, type Thread, type ThreadAttachment, type ThreadMessage, type ThreadOptionsPatch, type ThreadStatus, type TokenUsage, type TranscriptToolDetail, type TurnCommand, type Workspace, type WorkspaceInventoryEntry, type WorkspaceScriptEnvOpts, addWorkspace, adoptThread, allAdapters, allocatePort, allocatePortRange, allocateTeamName, allocateTeamSlug, appDataDir, appSettingsPath, appendMessage, applyAgentEvent, applyAppEnvironment, applyCompaction, applyThreadIntoMain, attachmentFromAbsolutePath, attachmentsFromBuffers, attachmentsFromWorktreePaths, autoCleanupOrphansEnabled, autoRenameBranchEnabled, autoRunAfterSetupEnabled, branchDisplayLabel, brightsyAdapter, brightsyCloudConnectAgent, brightsyCloudConnectEnabled, brightsyConfigPath, brightsyMcpAllowedTools, brightsyMcpServerName, buildCachedUserContent, buildClaudeStreamJsonUserMessage, buildDiffCommentAttachment, buildForkTranscriptAttachment, buildPastedTextAttachment, buildSessionSeed, buildWorkspaceScriptEnv, caffeinateWhileCloudConnectEnabled, caffeinateWhileRunningEnabled, captureLoginEnv, captureTurnBaseline, childEnvWithAppSettings, claudeAdapter, claudeChromeEnabled, claudeUserSettingsPath, cleanupOrphanWorktrees, cloneRepoIntoSideboard, codexAdapter, collectTakenTeamSlugs, commitAll, conductorDbPath, confirmLand, connectBrightsyTeam, coordinatorSystemPrompt, coordinatorTurnReminder, copyConfiguredFiles, countCacheControlBlocks, createChatTab, createEmptyThread, createGlobalChat, createOrUpdatePr, createThread, createThreadWorktree, currentBranch, cursorAdapter, cursorSdkMessageToEvents, decodeBrightsyTarget, deleteBranchOnPurgeEnabled, deleteThreadRecord, detectAgents, detectLocalMergeConflicts, disconnectBrightsyTeam, discoverSkills, encodeBrightsyTarget, enrichWorkspacesWithGithub, ensureAgentPath, ensureCloudCoordinator, ensureGhPreferOrigin, ensureGlobalCoordinatorCwd, ensureWorkspace, estimateMessageChars, estimateThreadChars, expandComposerPrompt, extractGhErrorDetail, extractiveSummary, fetchPrHead, finalizeParts, findInvalidCacheControlTtlOrder, findOrphanWorktrees, findThreadByRef, flattenTurnInput, forkChatTab, forkMessageSlice, forkThreadWorktree, formatAgentInstructions, formatArtifactDirective, formatBrightsyFetchError, formatGhLandError, formatIpcInvokeError, formatMessagesAsTranscript, formatRateLimitResetHint, formatRenameBranchDirective, formatTranscriptMarkdown, formatWorkspaceInventory, formatWorktreeDirective, getAdapter, getAgentSetupInfo, getBrightsySession, getDefaultAgent, getDefaultModel, getDefaultRunScript, getDiff, getDiffSummary, getGitHubStatus, getIssueSource, getLinearApiKey, getOrchestrator, getPr, getPrChecks, getPrDetails, getPrMeta, getRepoSetupInfo, getRunMode, getRunScript, gh, ghHeadRef, ghRepoSelectArgs, git, globalAgentCwd, harnessEnvKey, hasConductorHook, hasCursorWorktreeSetup, hasRepoHook, hasWorkspaceHook, healOrchestrationSoccerTitles, importConductorWorkspace, importConductorWorkspaceAsync, initializeGitRepository, inspectGitWorktree, installAgent, isBrightsyConnected, isBrightsyNdjsonLine, isCloudCoordinatorThread, isCursorAutoModel, isDirty, isGhRateLimitError, isGlobalRepoPath, isGlobalThread, isImageFilePath, isLinearConnected, isOrchestratorThread, isPlaceholderBranch, listAgentSetupInfo, listBranchCommits, listBranches, listBrightsyAccounts, listBrightsyChatTargets, listCodexModels, listConductorWorkspaces, listConnectedBrightsyTeams, listCursorModels, listGitHubIssues, listGlobalThreads, listIssues, listLinearIssues, listLinearIssuesDirect, listOpencodeModels, listPrs, listRunScripts, listThreads, listWorkspaces, listWorktreeFiles, listWorktrees, loadAgentInstructions, loadAppSettings, loadBrightsyConfig, loadConductorSettings, loadRepoSettings, loadWorkspaceSettings, locksDir, loginAgent, lookupSoccerTeam, maxConcurrentAgents, maybeCompactContext, mcpAllowTools, mcpAuthWarnings, mergePr, mergeUsage, nextPastedTextName, normalizeParseResult, normalizeThread, normalizeTurnInput, normalizeWorktreePath, openInSystemTerminal, opencodeAdapter, orchestrationTitleNeedsSoccerNickname, orchestratorSessionPoisonedByBuiltins, originGhRepoEnv, parseCursorRunnerLine, parseForceStopMessage, parseGithubSlugFromRemoteUrl, parseMcpList, partsToAssistantText, pastedTextStats, permissionMode, previewLand, pushBranch, readSkillBody, readThread, readWorktreeFile, readWorktreeFileForUpload, readWorktreeInclude, refreshGitHubAuth, removeWorkspace, removeWorktree, repoSlug, requireAgent, resolveClaudeExecutable, resolveConductorCursorAgentId, resolveCursorModelId, resolveDefaultBranch, resolveDiffBaseRef, resolveEffectiveIssueSource, resolveFilesToCopy, resolveGithubRepoSlug, resolvePrSelector, resolveRepoRoot, resolveThreadDefaults, resolveWorktreeStartPoint, run, runArchiveScript, runCloudConnect, runCursorWorktreeSetup, runSetupScript, sameWorktreePath, sanitizeMcpServerName, saveAppSettings, setStatus, settingsSourceLabel, shouldAttachPastedText, shouldCompactContext, shouldRunWorktreeCleanup, sideboardHomeDir, sideboardReposDir, sideboardWorkspacesDir, slugify, spawnAgentTurn, splitForCompaction, stageAbsolutePathsAsAttachments, stageBuffersAsAttachments, startDevServer, startMcpServer, startOrchestration, stripBrightsyNdjsonNoise, suggestSlug, summarizeConversation, switchBrightsyAccount, syncWorkspacesFromThreads, takenTeamSlugsForChatTab, takenTeamSlugsForOrchestration, taskMessageText, threadDisplayLabel, threadFilePath, threadLockPath, threadsDir, threadsSharingWorktree, toolDescription, toolDetail, toolFilePath, totalTokens, updateAdvancedSettings, updateAppEnvironment, updateBrightsySettings, updateClaudeSettings, updateDefaultsSettings, updateIntegrationsSettings, updateThread, validateLinearApiKey, withAgentInstructions, withThreadLock, workspaceSettingsSourceLabel, worktreeCleanupSettings, worktreeDisplayLabel, worktreeDisplayLabelForGroup, worktreeNameFromPath, worktreesRoot, writeInjectedMcpConfig, writeThread, writeWorktreeFile };
package/dist/index.js CHANGED
@@ -101,7 +101,7 @@ import {
101
101
  withAgentInstructions,
102
102
  worktreeCleanupSettings,
103
103
  writeWorktreeFile
104
- } from "./chunk-E4TRCRKH.js";
104
+ } from "./chunk-2YFQNL3O.js";
105
105
  import {
106
106
  addWorkspace,
107
107
  ensureWorkspace,
@@ -176,7 +176,7 @@ import {
176
176
  resolveCursorModelId,
177
177
  sanitizeMcpServerName,
178
178
  writeInjectedMcpConfig
179
- } from "./chunk-5KZLWNBS.js";
179
+ } from "./chunk-BEXVE7LX.js";
180
180
  import {
181
181
  brightsyConfigPath,
182
182
  brightsyMcpServerName,
@@ -192,7 +192,7 @@ import {
192
192
  import {
193
193
  cursorSdkMessageToEvents,
194
194
  parseCursorRunnerLine
195
- } from "./chunk-BSZX63TV.js";
195
+ } from "./chunk-PU27NUO4.js";
196
196
  import {
197
197
  HARNESS_ENV_KEYS,
198
198
  appSettingsPath,
@@ -413,6 +413,42 @@ function buildDiffCommentAttachment(input) {
413
413
  };
414
414
  }
415
415
 
416
+ // src/composer/pasted-text.ts
417
+ import { randomUUID } from "crypto";
418
+ var PASTE_ATTACH_MIN_CHARS = 1200;
419
+ var PASTE_ATTACH_MIN_LINES = 15;
420
+ var PASTED_NAME_RE = /^Pasted text #(\d+)\.txt$/i;
421
+ var PASTED_NAME_ALT_RE = /^pasted-(\d+)\.txt$/i;
422
+ function pastedTextStats(text) {
423
+ const chars = text.length;
424
+ if (chars === 0) return { chars: 0, lines: 0 };
425
+ const lines = text.split(/\r\n|\r|\n/).length;
426
+ return { chars, lines };
427
+ }
428
+ function shouldAttachPastedText(text) {
429
+ const trimmed = text.trim();
430
+ if (!trimmed) return false;
431
+ const { chars, lines } = pastedTextStats(text);
432
+ return chars >= PASTE_ATTACH_MIN_CHARS || lines >= PASTE_ATTACH_MIN_LINES;
433
+ }
434
+ function nextPastedTextName(existing) {
435
+ let max = 0;
436
+ for (const a of existing) {
437
+ const m = PASTED_NAME_RE.exec(a.name) ?? PASTED_NAME_ALT_RE.exec(a.name);
438
+ if (m?.[1]) max = Math.max(max, Number(m[1]));
439
+ }
440
+ return `Pasted text #${max + 1}.txt`;
441
+ }
442
+ function buildPastedTextAttachment(text, opts) {
443
+ return {
444
+ id: opts?.id ?? randomUUID(),
445
+ name: opts?.name ?? "Pasted text #1.txt",
446
+ kind: "file",
447
+ path: opts?.path,
448
+ content: text
449
+ };
450
+ }
451
+
416
452
  // src/brightsy/api.ts
417
453
  function formatBrightsyFetchError(err, url) {
418
454
  if (!(err instanceof Error)) return `${String(err)} (${url})`;
@@ -756,6 +792,8 @@ export {
756
792
  HARNESS_ENV_KEYS,
757
793
  MAX_ANTHROPIC_CACHE_CONTROL_BLOCKS,
758
794
  Orchestrator,
795
+ PASTE_ATTACH_MIN_CHARS,
796
+ PASTE_ATTACH_MIN_LINES,
759
797
  PLAN_MODE_INSTRUCTION,
760
798
  SIDEBOARD_FORCE_STOP,
761
799
  SIDEBOARD_MCP_ALLOWED_TOOLS,
@@ -790,6 +828,7 @@ export {
790
828
  buildClaudeStreamJsonUserMessage,
791
829
  buildDiffCommentAttachment,
792
830
  buildForkTranscriptAttachment,
831
+ buildPastedTextAttachment,
793
832
  buildSessionSeed,
794
833
  buildWorkspaceScriptEnv,
795
834
  caffeinateWhileCloudConnectEnabled,
@@ -943,6 +982,7 @@ export {
943
982
  mcpAuthWarnings,
944
983
  mergePr,
945
984
  mergeUsage,
985
+ nextPastedTextName,
946
986
  normalizeParseResult,
947
987
  normalizeThread,
948
988
  normalizeTurnInput,
@@ -957,6 +997,7 @@ export {
957
997
  parseGithubSlugFromRemoteUrl,
958
998
  parseMcpList,
959
999
  partsToAssistantText,
1000
+ pastedTextStats,
960
1001
  permissionMode,
961
1002
  previewLand,
962
1003
  pushBranch,
@@ -992,6 +1033,7 @@ export {
992
1033
  saveAppSettings,
993
1034
  setStatus,
994
1035
  settingsSourceLabel,
1036
+ shouldAttachPastedText,
995
1037
  shouldCompactContext,
996
1038
  shouldRunWorktreeCleanup,
997
1039
  sideboardHomeDir,
@@ -83,6 +83,10 @@ function pushTurnStderr(tail, line, maxLines = 12) {
83
83
  }
84
84
  function summarizeTurnStderr(tail, maxChars = 500) {
85
85
  if (tail.length === 0) return "";
86
+ const moduleMissing = [...tail].reverse().find((line) => /cannot find module/i.test(line));
87
+ if (moduleMissing) {
88
+ return moduleMissing.length <= maxChars ? moduleMissing : moduleMissing.slice(0, maxChars);
89
+ }
86
90
  const joined = tail.slice(-6).join("\n").trim();
87
91
  if (joined.length <= maxChars) return joined;
88
92
  return joined.slice(joined.length - maxChars);
@@ -3902,6 +3906,34 @@ var init_claude_mcp = __esm({
3902
3906
  }
3903
3907
  });
3904
3908
 
3909
+ // src/agents/node-launch.ts
3910
+ function isAsarPath(filePath) {
3911
+ return /\.asar([/\\]|$)/.test(filePath);
3912
+ }
3913
+ async function resolveNodeLaunch(scriptPath) {
3914
+ if (isAsarPath(scriptPath)) {
3915
+ return {
3916
+ file: process.execPath,
3917
+ env: { ELECTRON_RUN_AS_NODE: "1" }
3918
+ };
3919
+ }
3920
+ const whichNode = await run("which", ["node"], { reject: false });
3921
+ const nodeBin = whichNode.exitCode === 0 && whichNode.stdout.trim() ? whichNode.stdout.trim() : null;
3922
+ if (nodeBin) {
3923
+ return { file: nodeBin, env: {} };
3924
+ }
3925
+ return {
3926
+ file: process.execPath,
3927
+ env: { ELECTRON_RUN_AS_NODE: "1" }
3928
+ };
3929
+ }
3930
+ var init_node_launch = __esm({
3931
+ "src/agents/node-launch.ts"() {
3932
+ "use strict";
3933
+ init_run();
3934
+ }
3935
+ });
3936
+
3905
3937
  // src/agents/injected-mcp.ts
3906
3938
  async function resolveBrightsyMcpCommand() {
3907
3939
  const now = Date.now();
@@ -3991,11 +4023,13 @@ async function resolveSideboardMcpServer() {
3991
4023
  const entry = findSideboardMcpJsEntry();
3992
4024
  if (entry) {
3993
4025
  const isCli = /[/\\]cli[/\\]dist[/\\]index\.js$/.test(entry);
4026
+ const scriptArgs = isCli ? [entry, "mcp"] : [entry];
4027
+ const launch = await resolveNodeLaunch(entry);
3994
4028
  return {
3995
4029
  name: "sideboard",
3996
- // Use `node` (not process.execPath) — under Electron execPath is Electron itself.
3997
- command: "node",
3998
- args: isCli ? [entry, "mcp"] : [entry]
4030
+ command: launch.file,
4031
+ args: scriptArgs,
4032
+ ...Object.keys(launch.env).length > 0 ? { env: launch.env } : {}
3999
4033
  };
4000
4034
  }
4001
4035
  const which = await run("which", ["sideboard"], { reject: false });
@@ -4053,6 +4087,7 @@ var init_injected_mcp = __esm({
4053
4087
  init_run();
4054
4088
  init_config();
4055
4089
  init_connected_teams();
4090
+ init_node_launch();
4056
4091
  import_meta = {};
4057
4092
  SIDEBOARD_MCP_ALLOWED_TOOLS = [
4058
4093
  "mcp__sideboard",
@@ -4880,6 +4915,7 @@ var init_cursor = __esm({
4880
4915
  init_run();
4881
4916
  init_app_settings();
4882
4917
  init_cursor_events();
4918
+ init_node_launch();
4883
4919
  init_turn_input();
4884
4920
  init_cursor_events();
4885
4921
  import_meta2 = {};
@@ -4940,16 +4976,14 @@ var init_cursor = __esm({
4940
4976
  };
4941
4977
  const runner = cursorRunnerPath();
4942
4978
  const isTs = runner.endsWith(".ts");
4943
- const whichNode = await run("which", ["node"], { reject: false });
4944
- const nodeBin = whichNode.exitCode === 0 && whichNode.stdout.trim() ? whichNode.stdout.trim() : null;
4945
- const file = nodeBin || process.execPath;
4979
+ const launch = await resolveNodeLaunch(runner);
4946
4980
  return {
4947
- file,
4981
+ file: launch.file,
4948
4982
  args: isTs ? ["--import", "tsx", runner] : [runner],
4949
4983
  cwd: thread.worktreePath,
4950
4984
  stdin: JSON.stringify(req),
4951
4985
  env: {
4952
- ...nodeBin ? {} : { ELECTRON_RUN_AS_NODE: "1" },
4986
+ ...launch.env,
4953
4987
  ...apiKey ? { CURSOR_API_KEY: apiKey } : {}
4954
4988
  }
4955
4989
  };
@@ -5690,12 +5724,20 @@ function diffFromInput(input) {
5690
5724
  }
5691
5725
  function parseDiffStat(result) {
5692
5726
  if (!result) return {};
5693
- const plus = result.match(/\+(\d+)/);
5694
- const minus = result.match(/-(\d+)/);
5695
- if (plus || minus) {
5727
+ const paired = result.match(/\+(\d+)\s+-(\d+)/);
5728
+ if (paired) {
5729
+ return {
5730
+ additions: Number(paired[1]),
5731
+ deletions: Number(paired[2])
5732
+ };
5733
+ }
5734
+ const verbose = result.match(
5735
+ /(\d+)\s+insertions?(?:,\s*(\d+)\s+deletions?)?/i
5736
+ );
5737
+ if (verbose) {
5696
5738
  return {
5697
- additions: plus ? Number(plus[1]) : void 0,
5698
- deletions: minus ? Number(minus[1]) : void 0
5739
+ additions: Number(verbose[1]),
5740
+ deletions: verbose[2] != null ? Number(verbose[2]) : void 0
5699
5741
  };
5700
5742
  }
5701
5743
  return {};
@@ -5767,8 +5809,8 @@ function applyAgentEvent(parts, event) {
5767
5809
  ...p,
5768
5810
  status: event.isError ? "error" : "done",
5769
5811
  result: event.content,
5770
- additions: fromResult.additions ?? p.additions,
5771
- deletions: fromResult.deletions ?? p.deletions
5812
+ ...fromResult.additions != null ? { additions: fromResult.additions } : {},
5813
+ ...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
5772
5814
  };
5773
5815
  });
5774
5816
  return next;
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startMcpServer
4
- } from "../chunk-E4TRCRKH.js";
4
+ } from "../chunk-2YFQNL3O.js";
5
5
  import "../chunk-FVGRUZHI.js";
6
6
  import "../chunk-IS3AGU33.js";
7
7
  import "../chunk-PTASB7SJ.js";
8
- import "../chunk-5KZLWNBS.js";
8
+ import "../chunk-BEXVE7LX.js";
9
9
  import "../chunk-ILQK4P5R.js";
10
- import "../chunk-BSZX63TV.js";
10
+ import "../chunk-PU27NUO4.js";
11
11
  import "../chunk-YZ23S32T.js";
12
12
  import "../chunk-XBEQI5H4.js";
13
13
  import "../chunk-HYRHI3QU.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideboard-ai/core",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Sideboard core — orchestration, agents, git worktrees, MCP server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",