@sideboard-ai/core 0.1.45 → 0.1.46

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.
@@ -206,6 +206,7 @@ async function main() {
206
206
  const mode = req.planMode ? "plan" : "agent";
207
207
  const store = localAgentStore();
208
208
  const local = { cwd: req.cwd, store };
209
+ const mcpServers = req.mcpServers && Object.keys(req.mcpServers).length > 0 ? req.mcpServers : void 0;
209
210
  try {
210
211
  let agent;
211
212
  try {
@@ -213,13 +214,15 @@ async function main() {
213
214
  apiKey,
214
215
  model,
215
216
  mode,
216
- local
217
+ local,
218
+ ...mcpServers ? { mcpServers } : {}
217
219
  }) : await import_sdk.Agent.create({
218
220
  apiKey,
219
221
  model,
220
222
  mode,
221
223
  local,
222
- name: "Sideboard"
224
+ name: "Sideboard",
225
+ ...mcpServers ? { mcpServers } : {}
223
226
  });
224
227
  } catch (err) {
225
228
  const message = err instanceof Error ? err.message : String(err);
@@ -233,12 +236,16 @@ async function main() {
233
236
  model,
234
237
  mode,
235
238
  local,
236
- name: "Sideboard"
239
+ name: "Sideboard",
240
+ ...mcpServers ? { mcpServers } : {}
237
241
  });
238
242
  }
239
243
  try {
240
244
  emit({ type: "session_id", data: agent.agentId });
241
- const run = await agent.send(req.prompt);
245
+ const run = await agent.send(
246
+ req.prompt,
247
+ mcpServers ? { mcpServers } : void 0
248
+ );
242
249
  for await (const msg of run.stream()) {
243
250
  for (const event of cursorSdkMessageToEvents(msg)) {
244
251
  emit(event);
@@ -70,6 +70,7 @@ async function main() {
70
70
  const mode = req.planMode ? "plan" : "agent";
71
71
  const store = localAgentStore();
72
72
  const local = { cwd: req.cwd, store };
73
+ const mcpServers = req.mcpServers && Object.keys(req.mcpServers).length > 0 ? req.mcpServers : void 0;
73
74
  try {
74
75
  let agent;
75
76
  try {
@@ -77,13 +78,15 @@ async function main() {
77
78
  apiKey,
78
79
  model,
79
80
  mode,
80
- local
81
+ local,
82
+ ...mcpServers ? { mcpServers } : {}
81
83
  }) : await Agent.create({
82
84
  apiKey,
83
85
  model,
84
86
  mode,
85
87
  local,
86
- name: "Sideboard"
88
+ name: "Sideboard",
89
+ ...mcpServers ? { mcpServers } : {}
87
90
  });
88
91
  } catch (err) {
89
92
  const message = err instanceof Error ? err.message : String(err);
@@ -97,12 +100,16 @@ async function main() {
97
100
  model,
98
101
  mode,
99
102
  local,
100
- name: "Sideboard"
103
+ name: "Sideboard",
104
+ ...mcpServers ? { mcpServers } : {}
101
105
  });
102
106
  }
103
107
  try {
104
108
  emit({ type: "session_id", data: agent.agentId });
105
- const run = await agent.send(req.prompt);
109
+ const run = await agent.send(
110
+ req.prompt,
111
+ mcpServers ? { mcpServers } : void 0
112
+ );
106
113
  for await (const msg of run.stream()) {
107
114
  for (const event of cursorSdkMessageToEvents(msg)) {
108
115
  emit(event);
@@ -26,13 +26,19 @@ import {
26
26
  permissionMode,
27
27
  resolveCursorModelId,
28
28
  resolveQuotaFallbackAgent
29
- } from "./chunk-ANZ566Z5.js";
29
+ } from "./chunk-TQK2OYPU.js";
30
+ import {
31
+ ORCHESTRATOR_AGENT_KINDS,
32
+ assertOrchestratorCapableAgent,
33
+ coerceOrchestratorAgent,
34
+ isOrchestratorCapableAgent
35
+ } from "./chunk-GI7E5733.js";
30
36
  import "./chunk-ILQK4P5R.js";
31
37
  import {
32
38
  cursorSdkMessageToEvents,
33
39
  parseCursorRunnerLine
34
40
  } from "./chunk-J5JTEJ5O.js";
35
- import "./chunk-WYY3J7GR.js";
41
+ import "./chunk-T5QQVXK3.js";
36
42
  import "./chunk-77WWLBCI.js";
37
43
  import "./chunk-M37RITA6.js";
38
44
  import {
@@ -40,11 +46,14 @@ import {
40
46
  } from "./chunk-AJ6ROGD7.js";
41
47
  export {
42
48
  CLAUDE_MODEL_CATALOG,
49
+ ORCHESTRATOR_AGENT_KINDS,
43
50
  PLAN_MODE_INSTRUCTION,
44
51
  allAdapters,
52
+ assertOrchestratorCapableAgent,
45
53
  brightsyAdapter,
46
54
  claudeAdapter,
47
55
  codexAdapter,
56
+ coerceOrchestratorAgent,
48
57
  cursorAdapter,
49
58
  cursorSdkMessageToEvents,
50
59
  decodeBrightsyTarget,
@@ -54,6 +63,7 @@ export {
54
63
  getAgentSetupInfo,
55
64
  installAgent,
56
65
  isCursorAutoModel,
66
+ isOrchestratorCapableAgent,
57
67
  isSessionQuotaLimit,
58
68
  listAgentSetupInfo,
59
69
  listBrightsyChatTargets,
@@ -35,7 +35,7 @@ import {
35
35
  updateClaudeSettings,
36
36
  updateDefaultsSettings,
37
37
  updateIntegrationsSettings
38
- } from "./chunk-WYY3J7GR.js";
38
+ } from "./chunk-T5QQVXK3.js";
39
39
  import "./chunk-77WWLBCI.js";
40
40
  import "./chunk-M37RITA6.js";
41
41
  export {
@@ -3,7 +3,7 @@ import {
3
3
  ensureWorkspace,
4
4
  removeWorkspace,
5
5
  syncWorkspacesFromThreads
6
- } from "./chunk-U3EQKJHA.js";
6
+ } from "./chunk-SZAKJ4TR.js";
7
7
  import {
8
8
  GLOBAL_WORKSPACE_ID,
9
9
  createGlobalChat,
@@ -13,7 +13,7 @@ import {
13
13
  isGlobalThread,
14
14
  isOrchestratorThread,
15
15
  orchestratorSessionPoisonedByBuiltins
16
- } from "./chunk-ZNSM2DDD.js";
16
+ } from "./chunk-SPCU3MFY.js";
17
17
  import {
18
18
  coordinatorSystemPrompt,
19
19
  coordinatorTurnReminder,
@@ -29,7 +29,10 @@ import {
29
29
  parseBrightsyCliLine,
30
30
  parseSessionQuotaResetAt,
31
31
  resolveQuotaFallbackAgent
32
- } from "./chunk-ANZ566Z5.js";
32
+ } from "./chunk-TQK2OYPU.js";
33
+ import {
34
+ assertOrchestratorCapableAgent
35
+ } from "./chunk-GI7E5733.js";
33
36
  import {
34
37
  fallbackTurnFailDetail,
35
38
  formatTurnExitError,
@@ -47,7 +50,7 @@ import {
47
50
  orchestrationQuotaOnLimit,
48
51
  resolveEffectiveIssueSource,
49
52
  updateAdvancedSettings
50
- } from "./chunk-WYY3J7GR.js";
53
+ } from "./chunk-T5QQVXK3.js";
51
54
  import {
52
55
  allocateTeamName,
53
56
  allocateTeamSlug,
@@ -466,11 +469,14 @@ async function spawnAgentTurn(thread, input, onEvent) {
466
469
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
467
470
  );
468
471
  }
469
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-YFOQUGWD.js");
472
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-XFOXEQCP.js");
470
473
  if (isGlobalThread2(thread)) {
471
474
  const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-2XFYG3C5.js");
472
475
  ensureGlobalCoordinatorCwd2();
473
476
  }
477
+ if (isOrchestratorThread(thread)) {
478
+ assertOrchestratorCapableAgent(thread.agent);
479
+ }
474
480
  const adapter = getAdapter(thread.agent);
475
481
  const cmd = await adapter.buildTurn(thread, input);
476
482
  if (cmd.cwd !== thread.worktreePath) {
@@ -2647,7 +2653,7 @@ async function createThread(input, onSetupLine) {
2647
2653
  return readThread(thread.id) ?? thread;
2648
2654
  }
2649
2655
  async function listLinearIssues(agent, repoPath) {
2650
- const { getAdapter: getAdapter2 } = await import("./agents-JSHCAZUZ.js");
2656
+ const { getAdapter: getAdapter2 } = await import("./agents-6L6VENDT.js");
2651
2657
  await requireAgent(agent, { requireLinear: true });
2652
2658
  const adapter = getAdapter2(agent);
2653
2659
  if (!adapter.listLinearIssues) {
@@ -2719,6 +2725,10 @@ function createChatTab(input) {
2719
2725
  const binding = worktreeBindingFrom(from);
2720
2726
  const explicitTitle = input.title?.trim();
2721
2727
  const title = explicitTitle || allocateTeamName(takenTeamSlugsForChatTab(binding.worktreePath)).name;
2728
+ const nextAgent = input.agent ?? from.agent;
2729
+ if (isOrchestratorThread(from) || binding.sourceType === "orchestration") {
2730
+ assertOrchestratorCapableAgent(nextAgent);
2731
+ }
2722
2732
  const thread = createEmptyThread({
2723
2733
  title,
2724
2734
  // Chat-tab nicknames (soccer team or explicit) must stick. Post-turn
@@ -2726,7 +2736,7 @@ function createChatTab(input) {
2726
2736
  // shared worktree folder name (e.g. fork "Arsenal" → "Monaco").
2727
2737
  userSetTitle: true,
2728
2738
  ...binding,
2729
- agent: input.agent ?? from.agent,
2739
+ agent: nextAgent,
2730
2740
  model: input.model !== void 0 ? input.model : input.agent && input.agent !== from.agent ? null : from.model,
2731
2741
  effort: input.effort !== void 0 ? input.effort : from.effort,
2732
2742
  fast: input.fast !== void 0 ? Boolean(input.fast) : from.fast,
@@ -2888,7 +2898,7 @@ async function adoptThread(input) {
2888
2898
  messages: input.messages ?? []
2889
2899
  });
2890
2900
  writeThread(thread);
2891
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-TIKLNDW3.js");
2901
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-SRL2HZTB.js");
2892
2902
  await ensureWorkspace2(repoPath);
2893
2903
  return thread;
2894
2904
  }
@@ -3604,7 +3614,7 @@ var Orchestrator = class {
3604
3614
  orphans: orphans.map((o) => ({ path: o.path, repoPath: o.repoPath }))
3605
3615
  });
3606
3616
  }
3607
- const { autoCleanupOrphansEnabled } = await import("./app-settings-LYGVDGZY.js");
3617
+ const { autoCleanupOrphansEnabled } = await import("./app-settings-LZP632KI.js");
3608
3618
  if (autoCleanupOrphansEnabled() && shouldRunWorktreeCleanup() && orphans.length > 0) {
3609
3619
  await cleanupOrphanWorktrees({ repoPaths });
3610
3620
  }
@@ -3738,7 +3748,7 @@ var Orchestrator = class {
3738
3748
  });
3739
3749
  });
3740
3750
  this.emit({ type: "status_changed", threadId: thread.id, status: thread.status });
3741
- const { autoRunAfterSetupEnabled } = await import("./app-settings-LYGVDGZY.js");
3751
+ const { autoRunAfterSetupEnabled } = await import("./app-settings-LZP632KI.js");
3742
3752
  if (autoRunAfterSetupEnabled()) {
3743
3753
  try {
3744
3754
  await this.startDev(thread.id);
@@ -3984,7 +3994,7 @@ var Orchestrator = class {
3984
3994
  });
3985
3995
  const artifactDirective = isBrightsy ? null : formatArtifactDirective();
3986
3996
  const settings = loadWorkspaceSettings(fresh.worktreePath, fresh.repoPath);
3987
- const { autoRenameBranchEnabled } = await import("./app-settings-LYGVDGZY.js");
3997
+ const { autoRenameBranchEnabled } = await import("./app-settings-LZP632KI.js");
3988
3998
  const renameBranchDirective = !isBrightsy && !isOrchestration && autoRenameBranchEnabled() ? formatRenameBranchDirective(fresh, {
3989
3999
  customPrompt: settings?.prompts?.renameBranch
3990
4000
  }) : null;
@@ -4623,6 +4633,9 @@ var Orchestrator = class {
4623
4633
  `Cannot switch agent provider mid-chat (${thread.agent} \u2192 ${patch.agent}). Start a new chat tab instead.`
4624
4634
  );
4625
4635
  }
4636
+ if (isOrchestratorThread(thread)) {
4637
+ assertOrchestratorCapableAgent(patch.agent);
4638
+ }
4626
4639
  next.agent = patch.agent;
4627
4640
  if (patch.agent !== "claude" && patch.model === void 0) next.model = null;
4628
4641
  next.sessionId = null;
@@ -4714,7 +4727,7 @@ var Orchestrator = class {
4714
4727
  await runArchiveScript(thread.repoPath, thread.worktreePath);
4715
4728
  } catch {
4716
4729
  }
4717
- const { deleteBranchOnPurgeEnabled } = await import("./app-settings-LYGVDGZY.js");
4730
+ const { deleteBranchOnPurgeEnabled } = await import("./app-settings-LZP632KI.js");
4718
4731
  const deleteBranch = opts?.deleteBranch ?? deleteBranchOnPurgeEnabled();
4719
4732
  await removeWorktree(thread.repoPath, thread.worktreePath, {
4720
4733
  deleteBranch: deleteBranch ? thread.branchName : void 0
@@ -5325,7 +5338,7 @@ async function startMcpServer() {
5325
5338
  );
5326
5339
  server.tool(
5327
5340
  "fork_chat",
5328
- "Fork a chat into a NEW tab on the SAME workspace: worktree agent \u2192 same worktree tab; Global orchestration chat \u2192 new orchestration chat (same synthetic home). Seeds a transcript; optional agent override. Leave model unset for Auto unless you have a reason. Remote coordinators use this to continue an orchestration chat on another agent after session limits. Then send_to_thread / wait_for_turn on the returned id. Use fork_worktree only for worktree agents that need a new git worktree.",
5341
+ "Fork a chat into a NEW tab on the SAME workspace: worktree agent \u2192 same worktree tab; Global orchestration chat \u2192 new orchestration chat (same synthetic home). Seeds a transcript; optional agent override. Leave model unset for Auto unless you have a reason. Orchestration forks require an MCP-capable agent (claude, cursor, codex, opencode \u2014 not brightsy). Remote coordinators use this to continue an orchestration chat on another agent after session limits. Then send_to_thread / wait_for_turn on the returned id. Use fork_worktree only for worktree agents that need a new git worktree.",
5329
5342
  {
5330
5343
  ref: z.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
5331
5344
  through_index: z.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
@@ -0,0 +1,30 @@
1
+ // src/agents/orchestrator-capable.ts
2
+ var ORCHESTRATOR_AGENT_KINDS = [
3
+ "claude",
4
+ "codex",
5
+ "opencode",
6
+ "cursor"
7
+ ];
8
+ function isOrchestratorCapableAgent(agent) {
9
+ return Boolean(
10
+ agent && ORCHESTRATOR_AGENT_KINDS.includes(agent)
11
+ );
12
+ }
13
+ function assertOrchestratorCapableAgent(agent, context = "orchestration") {
14
+ if (!isOrchestratorCapableAgent(agent)) {
15
+ throw new Error(
16
+ `${agent} cannot run ${context} \u2014 it does not support Sideboard MCP. Use Claude, Cursor, Codex, or OpenCode.`
17
+ );
18
+ }
19
+ return agent;
20
+ }
21
+ function coerceOrchestratorAgent(agent, fallback = "claude") {
22
+ return isOrchestratorCapableAgent(agent) ? agent : fallback;
23
+ }
24
+
25
+ export {
26
+ ORCHESTRATOR_AGENT_KINDS,
27
+ isOrchestratorCapableAgent,
28
+ assertOrchestratorCapableAgent,
29
+ coerceOrchestratorAgent
30
+ };
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  ensureGlobalCoordinatorCwd
3
3
  } from "./chunk-6NAPN2N5.js";
4
+ import {
5
+ assertOrchestratorCapableAgent
6
+ } from "./chunk-GI7E5733.js";
4
7
  import {
5
8
  allocateTeamName,
6
9
  takenSlugsFromThread,
@@ -110,6 +113,7 @@ function createGlobalChat(opts) {
110
113
  const explicit = opts.title?.trim();
111
114
  const title = explicit && explicit !== CLOUD_ORCHESTRATOR_GOAL ? explicit : allocateTeamName(takenTeamSlugsForOrchestration()).name;
112
115
  const sourceRef = opts.sourceRef?.trim() || (isCloud ? CLOUD_ORCHESTRATOR_GOAL : title);
116
+ const agent = assertOrchestratorCapableAgent(opts.agent);
113
117
  const thread = createEmptyThread({
114
118
  title,
115
119
  // Stick nicknames the same way chat tabs do (avoid later sync overwrites).
@@ -119,7 +123,7 @@ function createGlobalChat(opts) {
119
123
  branchName: "global",
120
124
  worktreePath: globalAgentCwd(),
121
125
  repoPath: GLOBAL_WORKSPACE_ID,
122
- agent: opts.agent,
126
+ agent,
123
127
  autonomy: opts.autonomy ?? "default",
124
128
  model: opts.model ?? null,
125
129
  effort: opts.effort ?? "high",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-ZNSM2DDD.js";
3
+ } from "./chunk-SPCU3MFY.js";
4
4
  import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveRepoRoot
@@ -133,7 +133,7 @@ function normalizeAdvanced(raw) {
133
133
  if (source.orchestrationQuotaOnLimit === "switch_agent" || source.orchestrationQuotaOnLimit === "wait_reset") {
134
134
  out.orchestrationQuotaOnLimit = source.orchestrationQuotaOnLimit;
135
135
  }
136
- if (typeof source.orchestrationQuotaFallbackAgent === "string" && DEFAULT_AGENTS.has(source.orchestrationQuotaFallbackAgent)) {
136
+ if (typeof source.orchestrationQuotaFallbackAgent === "string" && DEFAULT_AGENTS.has(source.orchestrationQuotaFallbackAgent) && source.orchestrationQuotaFallbackAgent !== "brightsy") {
137
137
  out.orchestrationQuotaFallbackAgent = source.orchestrationQuotaFallbackAgent;
138
138
  }
139
139
  return out;
@@ -381,7 +381,7 @@ function updateAdvancedSettings(patch) {
381
381
  if (patch.orchestrationQuotaOnLimit === "switch_agent" || patch.orchestrationQuotaOnLimit === "wait_reset") {
382
382
  advanced.orchestrationQuotaOnLimit = patch.orchestrationQuotaOnLimit;
383
383
  }
384
- if (typeof patch.orchestrationQuotaFallbackAgent === "string" && DEFAULT_AGENTS.has(patch.orchestrationQuotaFallbackAgent)) {
384
+ if (typeof patch.orchestrationQuotaFallbackAgent === "string" && DEFAULT_AGENTS.has(patch.orchestrationQuotaFallbackAgent) && patch.orchestrationQuotaFallbackAgent !== "brightsy") {
385
385
  advanced.orchestrationQuotaFallbackAgent = patch.orchestrationQuotaFallbackAgent;
386
386
  }
387
387
  return saveAppSettings({ ...current, advanced });
@@ -409,7 +409,10 @@ function orchestrationQuotaOnLimit(settings = loadAppSettings()) {
409
409
  }
410
410
  function orchestrationQuotaFallbackAgent(settings = loadAppSettings()) {
411
411
  const preferred = settings.advanced.orchestrationQuotaFallbackAgent;
412
- return preferred && DEFAULT_AGENTS.has(preferred) ? preferred : "cursor";
412
+ if (preferred && DEFAULT_AGENTS.has(preferred) && preferred !== "brightsy") {
413
+ return preferred;
414
+ }
415
+ return "cursor";
413
416
  }
414
417
  function maxConcurrentAgents(settings = loadAppSettings()) {
415
418
  const n = settings.advanced.maxConcurrent;
@@ -15,7 +15,7 @@ import {
15
15
  claudeChromeEnabled,
16
16
  loadAppSettings,
17
17
  resolveClaudeExecutable
18
- } from "./chunk-WYY3J7GR.js";
18
+ } from "./chunk-T5QQVXK3.js";
19
19
  import {
20
20
  ensureAgentPath,
21
21
  run
@@ -597,6 +597,45 @@ async function buildInjectedMcpServers(opts) {
597
597
  }
598
598
  return servers;
599
599
  }
600
+ function toCursorMcpServers(servers) {
601
+ const out = {};
602
+ for (const s of servers) {
603
+ out[s.name] = {
604
+ command: s.command,
605
+ ...s.args ? { args: s.args } : {},
606
+ ...s.env ? { env: s.env } : {}
607
+ };
608
+ }
609
+ return out;
610
+ }
611
+ function toCodexMcpConfigArgs(servers) {
612
+ const args = [];
613
+ for (const s of servers) {
614
+ const prefix = `mcp_servers.${s.name}`;
615
+ args.push("-c", `${prefix}.command=${JSON.stringify(s.command)}`);
616
+ if (s.args?.length) {
617
+ args.push("-c", `${prefix}.args=${JSON.stringify(s.args)}`);
618
+ }
619
+ if (s.env) {
620
+ for (const [key, value] of Object.entries(s.env)) {
621
+ args.push("-c", `${prefix}.env.${key}=${JSON.stringify(value)}`);
622
+ }
623
+ }
624
+ }
625
+ return args;
626
+ }
627
+ function toOpencodeMcpConfigContent(servers) {
628
+ const mcp = {};
629
+ for (const s of servers) {
630
+ mcp[s.name] = {
631
+ type: "local",
632
+ command: [s.command, ...s.args ?? []],
633
+ enabled: true,
634
+ ...s.env && Object.keys(s.env).length > 0 ? { environment: s.env } : {}
635
+ };
636
+ }
637
+ return JSON.stringify({ mcp });
638
+ }
600
639
  function writeMcpServersConfig(servers) {
601
640
  if (servers.length === 0) return null;
602
641
  const mcpServers = {};
@@ -798,7 +837,7 @@ var claudeAdapter = {
798
837
  );
799
838
  }
800
839
  const mode = permissionMode(thread);
801
- const { isOrchestratorThread } = await import("./global-workspace-YFOQUGWD.js");
840
+ const { isOrchestratorThread } = await import("./global-workspace-XFOXEQCP.js");
802
841
  const isOrchestrator = isOrchestratorThread(thread);
803
842
  const injectedServers = await buildInjectedMcpServers({
804
843
  includeSideboard: true,
@@ -1104,6 +1143,11 @@ var codexAdapter = {
1104
1143
  }
1105
1144
  const mode = permissionMode(thread);
1106
1145
  const model = thread.model?.trim();
1146
+ const injected = await buildInjectedMcpServers({
1147
+ includeSideboard: true,
1148
+ includeBrightsy: isBrightsyConnected()
1149
+ });
1150
+ const mcpOverrides = toCodexMcpConfigArgs(injected);
1107
1151
  const args = [
1108
1152
  "exec",
1109
1153
  ...sessionId ? ["resume", sessionId] : [],
@@ -1115,7 +1159,8 @@ var codexAdapter = {
1115
1159
  mode.codexSandbox,
1116
1160
  "--ask-for-approval",
1117
1161
  "never",
1118
- ...model ? ["--model", model] : []
1162
+ ...model ? ["--model", model] : [],
1163
+ ...mcpOverrides
1119
1164
  ];
1120
1165
  return {
1121
1166
  file: "codex",
@@ -1338,6 +1383,11 @@ var cursorAdapter = {
1338
1383
  const prompt = flattenTurnInput(input);
1339
1384
  const agentId = await this.resolveSessionId(thread.worktreePath, thread.sessionId);
1340
1385
  const apiKey = resolveCursorApiKey() || void 0;
1386
+ const injected = await buildInjectedMcpServers({
1387
+ includeSideboard: true,
1388
+ includeBrightsy: isBrightsyConnected()
1389
+ });
1390
+ const mcpServers = toCursorMcpServers(injected);
1341
1391
  const req = {
1342
1392
  prompt,
1343
1393
  cwd: thread.worktreePath,
@@ -1346,7 +1396,8 @@ var cursorAdapter = {
1346
1396
  effort: thread.effort,
1347
1397
  fast: thread.fast,
1348
1398
  planMode: thread.planMode,
1349
- apiKey
1399
+ apiKey,
1400
+ ...Object.keys(mcpServers).length > 0 ? { mcpServers } : {}
1350
1401
  };
1351
1402
  const runner = cursorRunnerPath();
1352
1403
  const isTs = runner.endsWith(".ts");
@@ -1490,6 +1541,11 @@ var opencodeAdapter = {
1490
1541
  if (model) {
1491
1542
  args.push("--model", model);
1492
1543
  }
1544
+ const injected = await buildInjectedMcpServers({
1545
+ includeSideboard: true,
1546
+ includeBrightsy: isBrightsyConnected()
1547
+ });
1548
+ const mcpContent = injected.length > 0 ? toOpencodeMcpConfigContent(injected) : null;
1493
1549
  return {
1494
1550
  file: "opencode",
1495
1551
  args,
@@ -1498,7 +1554,8 @@ var opencodeAdapter = {
1498
1554
  // message is given (see resolveRunInput in opencode's run.ts).
1499
1555
  stdin: prompt,
1500
1556
  env: {
1501
- OPENCODE_PERMISSION: mode.opencodePermission
1557
+ OPENCODE_PERMISSION: mode.opencodePermission,
1558
+ ...mcpContent ? { OPENCODE_CONFIG_CONTENT: mcpContent } : {}
1502
1559
  }
1503
1560
  };
1504
1561
  },
@@ -1784,11 +1841,13 @@ var FALLBACK_ORDER = [
1784
1841
  "cursor",
1785
1842
  "codex",
1786
1843
  "opencode",
1787
- "brightsy",
1788
1844
  "claude"
1789
1845
  ];
1790
1846
  function resolveQuotaFallbackAgent(current, preferred) {
1791
- const ordered = preferred ? [preferred, ...FALLBACK_ORDER.filter((a) => a !== preferred)] : FALLBACK_ORDER;
1847
+ const ordered = [
1848
+ ...preferred && preferred !== "brightsy" ? [preferred] : [],
1849
+ ...FALLBACK_ORDER.filter((a) => a !== preferred)
1850
+ ];
1792
1851
  return ordered.find((a) => a !== current) ?? (current === "cursor" ? "codex" : "cursor");
1793
1852
  }
1794
1853
 
@@ -11,8 +11,9 @@ import {
11
11
  orchestrationTitleNeedsSoccerNickname,
12
12
  orchestratorSessionPoisonedByBuiltins,
13
13
  takenTeamSlugsForOrchestration
14
- } from "./chunk-ZNSM2DDD.js";
14
+ } from "./chunk-SPCU3MFY.js";
15
15
  import "./chunk-6NAPN2N5.js";
16
+ import "./chunk-GI7E5733.js";
16
17
  import "./chunk-FV6FN6V5.js";
17
18
  import "./chunk-O6W3P7V3.js";
18
19
  import "./chunk-77WWLBCI.js";