@sideboard-ai/core 0.1.57 → 0.1.60

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 (39) hide show
  1. package/dist/{agents-2YYWW723.js → agents-B2723EOF.js} +4 -4
  2. package/dist/{agents-AQFEFKBL.js → agents-EADRAAPG.js} +4 -4
  3. package/dist/{app-settings-2LQNRTBE.js → app-settings-TBHTJWLQ.js} +1 -1
  4. package/dist/{app-settings-73DI4B6T.js → app-settings-YBNZ4XSR.js} +1 -1
  5. package/dist/{chunk-5DMYULLC.js → chunk-2P2UK7E7.js} +2 -2
  6. package/dist/{chunk-7LNGIP3X.js → chunk-73AT5K4A.js} +15 -3
  7. package/dist/{chunk-DIOF73S2.js → chunk-75QR74KM.js} +7 -2
  8. package/dist/{chunk-EBWEKG52.js → chunk-CHGOMFTA.js} +3 -3
  9. package/dist/{chunk-C4BCC5X5.js → chunk-FGNBTFRD.js} +7 -2
  10. package/dist/{chunk-H6GGDLYS.js → chunk-JB2H7E7V.js} +1 -1
  11. package/dist/{chunk-BXJ76RHF.js → chunk-MBAL5FE6.js} +4 -4
  12. package/dist/{chunk-XOU6HNQJ.js → chunk-MFGGIRUA.js} +39 -13
  13. package/dist/{chunk-S42XDFKF.js → chunk-MLAST5BB.js} +3 -3
  14. package/dist/{chunk-C3J4GDW4.js → chunk-MX7UH5AT.js} +76 -60
  15. package/dist/{chunk-DQJ5D42H.js → chunk-NTYRBRE7.js} +44 -13
  16. package/dist/{chunk-DZFH2KLT.js → chunk-P7EQUFB6.js} +39 -13
  17. package/dist/{chunk-V2DUTUNC.js → chunk-QJBC4BRK.js} +2 -2
  18. package/dist/{chunk-ZNM4MAN4.js → chunk-RIWUU7FO.js} +15 -3
  19. package/dist/{chunk-UA5NDAHL.js → chunk-XWPKLRB3.js} +44 -13
  20. package/dist/{chunk-7F454EE2.js → chunk-ZXDOI6IH.js} +76 -53
  21. package/dist/{connected-teams-ONC4666A.js → connected-teams-MKIYKOYA.js} +2 -2
  22. package/dist/{connected-teams-2ANNZCP5.js → connected-teams-RSL4VB3X.js} +2 -2
  23. package/dist/{coordinator-prompt-RBKUNRPR.js → coordinator-prompt-4P23VVFC.js} +4 -4
  24. package/dist/{coordinator-prompt-ICF36NUQ.js → coordinator-prompt-LNWHZ64D.js} +4 -4
  25. package/dist/{global-workspace-667XLBW6.js → global-workspace-BHT4XUAA.js} +5 -5
  26. package/dist/{global-workspace-S7VLWPWG.js → global-workspace-TMMAVRVW.js} +5 -5
  27. package/dist/index.cjs +303 -115
  28. package/dist/index.d.cts +15 -6
  29. package/dist/index.d.ts +15 -6
  30. package/dist/index.js +157 -64
  31. package/dist/mcp/run-stdio.cjs +303 -126
  32. package/dist/mcp/run-stdio.js +156 -68
  33. package/dist/{run-ZJKYHXGN.js → run-GPSVV5OH.js} +1 -1
  34. package/dist/{run-H3IMNOYN.js → run-HZTBWGQR.js} +1 -1
  35. package/dist/{workspaces-FPJJXXAE.js → workspaces-3GO3EDQG.js} +6 -6
  36. package/dist/{workspaces-LYIDE2VR.js → workspaces-GFPGDGCS.js} +6 -6
  37. package/dist/{worktree-5KEQWSAF.js → worktree-3L2G6PCM.js} +2 -2
  38. package/dist/{worktree-RWGL7FUV.js → worktree-GBLHEFHR.js} +2 -2
  39. package/package.json +1 -1
@@ -26,24 +26,24 @@ import {
26
26
  permissionMode,
27
27
  resolveCursorModelId,
28
28
  resolveQuotaFallbackAgent
29
- } from "./chunk-7F454EE2.js";
29
+ } from "./chunk-ZXDOI6IH.js";
30
30
  import {
31
31
  ORCHESTRATOR_AGENT_KINDS,
32
32
  assertOrchestratorCapableAgent,
33
33
  coerceOrchestratorAgent,
34
34
  isOrchestratorCapableAgent
35
35
  } from "./chunk-GI7E5733.js";
36
- import "./chunk-BXJ76RHF.js";
36
+ import "./chunk-MBAL5FE6.js";
37
37
  import {
38
38
  cursorSdkMessageToEvents,
39
39
  parseCursorRunnerLine
40
40
  } from "./chunk-3WJAUKIL.js";
41
- import "./chunk-DIOF73S2.js";
41
+ import "./chunk-75QR74KM.js";
42
42
  import "./chunk-77WWLBCI.js";
43
43
  import "./chunk-M37RITA6.js";
44
44
  import {
45
45
  ensureAgentPath
46
- } from "./chunk-7LNGIP3X.js";
46
+ } from "./chunk-73AT5K4A.js";
47
47
  export {
48
48
  CLAUDE_MODEL_CATALOG,
49
49
  ORCHESTRATOR_AGENT_KINDS,
@@ -30,8 +30,8 @@ import {
30
30
  permissionMode,
31
31
  resolveCursorModelId,
32
32
  resolveQuotaFallbackAgent
33
- } from "./chunk-C3J4GDW4.js";
34
- import "./chunk-H6GGDLYS.js";
33
+ } from "./chunk-MX7UH5AT.js";
34
+ import "./chunk-JB2H7E7V.js";
35
35
  import {
36
36
  ORCHESTRATOR_AGENT_KINDS,
37
37
  assertOrchestratorCapableAgent,
@@ -40,8 +40,8 @@ import {
40
40
  } from "./chunk-S2LL5HA4.js";
41
41
  import {
42
42
  ensureAgentPath
43
- } from "./chunk-ZNM4MAN4.js";
44
- import "./chunk-C4BCC5X5.js";
43
+ } from "./chunk-RIWUU7FO.js";
44
+ import "./chunk-FGNBTFRD.js";
45
45
  import "./chunk-KGZBYWZ3.js";
46
46
  import "./chunk-7MV3RXSC.js";
47
47
  export {
@@ -36,7 +36,7 @@ import {
36
36
  updateClaudeSettings,
37
37
  updateDefaultsSettings,
38
38
  updateIntegrationsSettings
39
- } from "./chunk-DIOF73S2.js";
39
+ } from "./chunk-75QR74KM.js";
40
40
  import "./chunk-77WWLBCI.js";
41
41
  import "./chunk-M37RITA6.js";
42
42
  export {
@@ -38,7 +38,7 @@ import {
38
38
  updateClaudeSettings,
39
39
  updateDefaultsSettings,
40
40
  updateIntegrationsSettings
41
- } from "./chunk-C4BCC5X5.js";
41
+ } from "./chunk-FGNBTFRD.js";
42
42
  import "./chunk-KGZBYWZ3.js";
43
43
  import "./chunk-7MV3RXSC.js";
44
44
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  isGlobalRepoPath
3
- } from "./chunk-S42XDFKF.js";
3
+ } from "./chunk-MLAST5BB.js";
4
4
  import {
5
5
  ensureGhPreferOrigin,
6
6
  resolveRepoRoot
7
- } from "./chunk-DZFH2KLT.js";
7
+ } from "./chunk-P7EQUFB6.js";
8
8
  import {
9
9
  appDataDir
10
10
  } from "./chunk-M37RITA6.js";
@@ -40,7 +40,8 @@ async function run(file, args, opts) {
40
40
  const result = await execa(file, args, {
41
41
  cwd: opts?.cwd,
42
42
  env: { ...process.env, ...opts?.env },
43
- reject: opts?.reject ?? true
43
+ reject: opts?.reject ?? true,
44
+ ...opts?.timeoutMs != null ? { timeout: opts.timeoutMs } : {}
44
45
  });
45
46
  return {
46
47
  stdout: result.stdout ?? "",
@@ -70,11 +71,22 @@ async function git(args, cwd, opts) {
70
71
  return run("git", [...prefix, ...args], {
71
72
  cwd,
72
73
  reject: opts?.reject,
73
- env: opts?.env
74
+ timeoutMs: opts?.timeoutMs,
75
+ // Never block forever on a credential/SSH prompt inside MCP / Electron.
76
+ env: {
77
+ GIT_TERMINAL_PROMPT: "0",
78
+ GIT_ASKPASS: process.env.GIT_ASKPASS || "echo",
79
+ GIT_SSH_COMMAND: process.env.GIT_SSH_COMMAND || "ssh -o BatchMode=yes -o ConnectTimeout=15",
80
+ ...opts?.env
81
+ }
74
82
  });
75
83
  }
76
84
  async function gh(args, cwd, opts) {
77
- return run("gh", args, { cwd, reject: opts?.reject });
85
+ return run("gh", args, {
86
+ cwd,
87
+ reject: opts?.reject,
88
+ timeoutMs: opts?.timeoutMs
89
+ });
78
90
  }
79
91
  async function resolveGhAuthToken(cwd) {
80
92
  const result = await gh(["auth", "token"], cwd, { reject: false });
@@ -324,9 +324,14 @@ function resolveThreadDefaults(settings = loadAppSettings()) {
324
324
  function resolveNewThreadOptions(overrides = {}, settings = loadAppSettings()) {
325
325
  const defaults = resolveThreadDefaults(settings);
326
326
  const effort = overrides.effort === void 0 || overrides.effort === null ? defaults.effort : normalizeThinkingEffort(overrides.effort) ?? defaults.effort;
327
+ const agent = overrides.agent ?? defaults.agent;
328
+ let model = overrides.model === void 0 ? defaults.model : overrides.model?.trim() || null;
329
+ if (model && agent !== "cursor" && /^(default|auto)$/i.test(model.trim())) {
330
+ model = null;
331
+ }
327
332
  return {
328
- agent: overrides.agent ?? defaults.agent,
329
- model: overrides.model === void 0 ? defaults.model : overrides.model?.trim() || null,
333
+ agent,
334
+ model,
330
335
  effort,
331
336
  fast: overrides.fast === void 0 || overrides.fast === null ? defaults.fast : Boolean(overrides.fast)
332
337
  };
@@ -5,12 +5,12 @@ import {
5
5
  } from "./chunk-S2LL5HA4.js";
6
6
  import {
7
7
  ensureGlobalCoordinatorCwd
8
- } from "./chunk-DQJ5D42H.js";
8
+ } from "./chunk-NTYRBRE7.js";
9
9
  import {
10
10
  allocateTeamName,
11
11
  takenSlugsFromThread,
12
12
  teamSlugFromName
13
- } from "./chunk-XOU6HNQJ.js";
13
+ } from "./chunk-MFGGIRUA.js";
14
14
  import {
15
15
  createEmptyThread,
16
16
  listThreads,
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  resolveNewThreadOptions,
22
22
  resolveThreadDefaults
23
- } from "./chunk-C4BCC5X5.js";
23
+ } from "./chunk-FGNBTFRD.js";
24
24
  import {
25
25
  globalAgentCwd
26
26
  } from "./chunk-7MV3RXSC.js";
@@ -326,9 +326,14 @@ function resolveThreadDefaults(settings = loadAppSettings()) {
326
326
  function resolveNewThreadOptions(overrides = {}, settings = loadAppSettings()) {
327
327
  const defaults = resolveThreadDefaults(settings);
328
328
  const effort = overrides.effort === void 0 || overrides.effort === null ? defaults.effort : normalizeThinkingEffort(overrides.effort) ?? defaults.effort;
329
+ const agent = overrides.agent ?? defaults.agent;
330
+ let model = overrides.model === void 0 ? defaults.model : overrides.model?.trim() || null;
331
+ if (model && agent !== "cursor" && /^(default|auto)$/i.test(model.trim())) {
332
+ model = null;
333
+ }
329
334
  return {
330
- agent: overrides.agent ?? defaults.agent,
331
- model: overrides.model === void 0 ? defaults.model : overrides.model?.trim() || null,
335
+ agent,
336
+ model,
332
337
  effort,
333
338
  fast: overrides.fast === void 0 || overrides.fast === null ? defaults.fast : Boolean(overrides.fast)
334
339
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  run
5
- } from "./chunk-ZNM4MAN4.js";
5
+ } from "./chunk-RIWUU7FO.js";
6
6
  import {
7
7
  appDataDir
8
8
  } from "./chunk-7MV3RXSC.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-M37RITA6.js";
4
4
  import {
5
5
  run
6
- } from "./chunk-7LNGIP3X.js";
6
+ } from "./chunk-73AT5K4A.js";
7
7
 
8
8
  // src/brightsy/connected-teams.ts
9
9
  import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
@@ -36,7 +36,7 @@ function saveBrightsyConfig(cfg) {
36
36
 
37
37
  // src/brightsy/accounts.ts
38
38
  async function loadConnectedTeams() {
39
- const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-ONC4666A.js");
39
+ const { listConnectedBrightsyTeams: listConnectedBrightsyTeams2 } = await import("./connected-teams-MKIYKOYA.js");
40
40
  return listConnectedBrightsyTeams2();
41
41
  }
42
42
  async function runBrightsyTeamsJson(args) {
@@ -68,7 +68,7 @@ async function getBrightsySession() {
68
68
  const data = await runBrightsyTeamsJson([]);
69
69
  const accounts = Array.isArray(data.teams) ? data.teams : [];
70
70
  const active = data.active ?? accounts.find((a) => a.active) ?? null;
71
- const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-ONC4666A.js");
71
+ const { ensureCliTeamTracked: ensureCliTeamTracked2 } = await import("./connected-teams-MKIYKOYA.js");
72
72
  const connectedTeams = ensureCliTeamTracked2(
73
73
  active ? { id: active.id, slug: active.slug, name: active.name } : void 0
74
74
  );
@@ -108,7 +108,7 @@ async function performBrightsyAccountSwitch(accountIdOrSlug) {
108
108
  return { cfg, target: data.active };
109
109
  }
110
110
  async function switchBrightsyAccount(accountIdOrSlug) {
111
- const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-ONC4666A.js");
111
+ const { connectBrightsyTeam: connectBrightsyTeam2 } = await import("./connected-teams-MKIYKOYA.js");
112
112
  await connectBrightsyTeam2(accountIdOrSlug);
113
113
  return getBrightsySession();
114
114
  }
@@ -10,7 +10,7 @@ import {
10
10
  gh,
11
11
  git,
12
12
  resolveGhAuthToken
13
- } from "./chunk-ZNM4MAN4.js";
13
+ } from "./chunk-RIWUU7FO.js";
14
14
  import {
15
15
  worktreesRoot
16
16
  } from "./chunk-7MV3RXSC.js";
@@ -1225,12 +1225,16 @@ async function ensureGhPreferOrigin(cwd) {
1225
1225
  const hasAlt = Boolean(await slugFromGitRemote(cwd, "upstream")) || Boolean(await slugFromGitRemote(cwd, "github"));
1226
1226
  if (!hasAlt) return;
1227
1227
  const view = await gh(["repo", "set-default", "--view"], cwd, {
1228
- reject: false
1228
+ reject: false,
1229
+ timeoutMs: 15e3
1229
1230
  });
1230
1231
  const current = `${view.stdout}
1231
1232
  ${view.stderr}`;
1232
1233
  if (view.exitCode === 0 && current.includes(originSlug)) return;
1233
- await gh(["repo", "set-default", "origin"], cwd, { reject: false });
1234
+ await gh(["repo", "set-default", "origin"], cwd, {
1235
+ reject: false,
1236
+ timeoutMs: 15e3
1237
+ });
1234
1238
  }
1235
1239
  async function originGhRepoEnv(cwd) {
1236
1240
  await ensureGhPreferOrigin(cwd);
@@ -1776,20 +1780,42 @@ async function createThreadWorktree(opts) {
1776
1780
  throw new Error(`Worktree already exists at ${worktreePath}`);
1777
1781
  }
1778
1782
  await ensureGhPreferOrigin(opts.repoPath);
1779
- await git(["fetch", "origin", "--prune"], opts.repoPath, { reject: false });
1780
- if (!isLocalPrFetchBranch(opts.sourceRef) && !opts.sourceRef.startsWith("origin/") && !opts.sourceRef.startsWith("refs/")) {
1781
- await git(["fetch", "origin", opts.sourceRef], opts.repoPath, {
1782
- reject: false
1783
+ let startPoint = null;
1784
+ try {
1785
+ startPoint = await resolveWorktreeStartPoint(opts.repoPath, opts.sourceRef);
1786
+ } catch {
1787
+ startPoint = null;
1788
+ }
1789
+ if (!isLocalPrFetchBranch(opts.sourceRef)) {
1790
+ const fetchTimeoutMs = startPoint ? 12e3 : 45e3;
1791
+ await git(["fetch", "origin", "--prune"], opts.repoPath, {
1792
+ reject: false,
1793
+ timeoutMs: fetchTimeoutMs
1783
1794
  });
1795
+ if (!opts.sourceRef.startsWith("origin/") && !opts.sourceRef.startsWith("refs/")) {
1796
+ await git(["fetch", "origin", opts.sourceRef], opts.repoPath, {
1797
+ reject: false,
1798
+ timeoutMs: fetchTimeoutMs
1799
+ });
1800
+ }
1801
+ try {
1802
+ startPoint = await resolveWorktreeStartPoint(
1803
+ opts.repoPath,
1804
+ opts.sourceRef
1805
+ );
1806
+ } catch (err) {
1807
+ if (!startPoint) throw err;
1808
+ }
1809
+ }
1810
+ if (!startPoint) {
1811
+ throw new Error(
1812
+ `Invalid git reference: ${opts.sourceRef} (and fetch did not resolve it)`
1813
+ );
1784
1814
  }
1785
- const startPoint = await resolveWorktreeStartPoint(
1786
- opts.repoPath,
1787
- opts.sourceRef
1788
- );
1789
1815
  const add = await git(
1790
1816
  ["worktree", "add", "-b", branchName, worktreePath, startPoint],
1791
1817
  opts.repoPath,
1792
- { reject: false }
1818
+ { reject: false, timeoutMs: 6e4 }
1793
1819
  );
1794
1820
  if (add.exitCode !== 0) {
1795
1821
  const err = `${add.stderr}
@@ -1800,7 +1826,7 @@ ${add.stdout}`;
1800
1826
  const retry = await git(
1801
1827
  ["worktree", "add", "-b", alt, worktreePath, startPoint],
1802
1828
  opts.repoPath,
1803
- { reject: false }
1829
+ { reject: false, timeoutMs: 6e4 }
1804
1830
  );
1805
1831
  if (retry.exitCode === 0) {
1806
1832
  branchName = alt;
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-GI7E5733.js";
4
4
  import {
5
5
  ensureGlobalCoordinatorCwd
6
- } from "./chunk-UA5NDAHL.js";
6
+ } from "./chunk-XWPKLRB3.js";
7
7
  import {
8
8
  resolveNewThreadOptions,
9
9
  resolveThreadDefaults
10
- } from "./chunk-DIOF73S2.js";
10
+ } from "./chunk-75QR74KM.js";
11
11
  import {
12
12
  allocateTeamName,
13
13
  takenSlugsFromThread,
14
14
  teamSlugFromName
15
- } from "./chunk-DZFH2KLT.js";
15
+ } from "./chunk-P7EQUFB6.js";
16
16
  import {
17
17
  createEmptyThread,
18
18
  listThreads,
@@ -6,16 +6,19 @@ import {
6
6
  ensureCliTeamTracked,
7
7
  ensureConnectedBrightsyTeamTokens,
8
8
  loadBrightsyConfig
9
- } from "./chunk-H6GGDLYS.js";
9
+ } from "./chunk-JB2H7E7V.js";
10
10
  import {
11
11
  ensureAgentPath,
12
12
  run
13
- } from "./chunk-ZNM4MAN4.js";
13
+ } from "./chunk-RIWUU7FO.js";
14
14
  import {
15
15
  claudeChromeEnabled,
16
16
  loadAppSettings,
17
17
  resolveClaudeExecutable
18
- } from "./chunk-C4BCC5X5.js";
18
+ } from "./chunk-FGNBTFRD.js";
19
+ import {
20
+ appDataDir
21
+ } from "./chunk-7MV3RXSC.js";
19
22
 
20
23
  // src/agents/brightsy-targets.ts
21
24
  function encodeBrightsyTarget(type, id, accountId) {
@@ -494,13 +497,6 @@ function mcpAllowTools(servers) {
494
497
  }
495
498
  return out;
496
499
  }
497
- function mcpAuthWarnings(servers) {
498
- const needing = servers.filter((s) => s.needsAuth).map((s) => s.name);
499
- if (needing.length === 0) return [];
500
- return [
501
- `MCP needs login: ${needing.join(", ")}. Run: claude mcp login "<name>"`
502
- ];
503
- }
504
500
 
505
501
  // src/agents/injected-mcp.ts
506
502
  import { existsSync, mkdtempSync, writeFileSync } from "fs";
@@ -650,7 +646,16 @@ async function resolveSideboardMcpServer() {
650
646
  async function buildInjectedMcpServers(opts) {
651
647
  const servers = [];
652
648
  if (opts.includeSideboard) {
653
- servers.push(await resolveSideboardMcpServer());
649
+ const sideboard = await resolveSideboardMcpServer();
650
+ sideboard.env = {
651
+ ...sideboard.env ?? {},
652
+ SIDEBOARD_APP_DATA: appDataDir()
653
+ };
654
+ const orchId = opts.orchestratorThreadId?.trim();
655
+ if (orchId) {
656
+ sideboard.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID = orchId;
657
+ }
658
+ servers.push(sideboard);
654
659
  }
655
660
  if (opts.includeBrightsy && isBrightsyConnected()) {
656
661
  const cmd = await resolveBrightsyMcpCommand();
@@ -694,6 +699,8 @@ function toCodexMcpConfigArgs(servers) {
694
699
  }
695
700
  }
696
701
  args.push("-c", `${prefix}.default_tools_approval_mode=${JSON.stringify("approve")}`);
702
+ args.push("-c", `${prefix}.tool_timeout_sec=300`);
703
+ args.push("-c", `${prefix}.startup_timeout_sec=30`);
697
704
  }
698
705
  return args;
699
706
  }
@@ -728,6 +735,16 @@ function writeMcpServersConfig(servers) {
728
735
  // src/agents/types.ts
729
736
  var PLAN_MODE_INSTRUCTION = "Plan mode is active and must remain active until the user turns Plan mode off in the UI (or Approves / Hands off the plan). Analyze the codebase, search and read files as needed, and produce or refine a clear implementation plan. Do not modify, create, or delete any project files except via Sideboard MCP present_plan (writes .context/attachments/plan.md). When you need a clarifying decision (approach forks, auth choice, scope): (1) first write a short chat message that explains the decision and what each option means (tradeoffs, when to pick it) \u2014 do not leave the user staring at bare labels; (2) then call Sideboard MCP ask_user with the same options, including a description on every option. Sideboard shows questions in the composer and mirrors them in chat. After ask_user, wait for the user's next message with their answers before finalizing the plan. When the plan is ready for approval: (1) call present_plan with the full markdown plan (title + content) so Sideboard saves .context/attachments/plan.md and shows it in chat for Approve / Hand off / Copy; (2) Claude should also call ExitPlanMode after present_plan. Do not skip present_plan \u2014 the plan must be a markdown file, not only chat prose.";
730
737
  function permissionMode(thread) {
738
+ if (thread.sourceType === "orchestration") {
739
+ return {
740
+ claude: "acceptEdits",
741
+ opencodePermission: JSON.stringify({
742
+ edit: "allow",
743
+ bash: { "*": "allow", "rm -rf *": "deny" }
744
+ }),
745
+ codexSandbox: "danger-full-access"
746
+ };
747
+ }
731
748
  if (thread.planMode) {
732
749
  return {
733
750
  claude: "plan",
@@ -879,18 +896,17 @@ var claudeAdapter = {
879
896
  };
880
897
  }
881
898
  }
882
- const auth = await run(claude, ["auth", "status"], { reject: false });
899
+ const auth = await run(claude, ["auth", "status"], {
900
+ reject: false,
901
+ timeoutMs: 5e3
902
+ });
883
903
  const authenticated = auth.exitCode === 0;
884
- const servers = await loadMcpServers();
885
- const linearMcp = servers.some(
886
- (s) => s.connected && /linear/i.test(s.name)
887
- );
888
904
  return {
889
905
  agent: "claude",
890
906
  installed: true,
891
907
  authenticated,
892
- linearMcp,
893
- warnings: mcpAuthWarnings(servers),
908
+ linearMcp: false,
909
+ warnings: [],
894
910
  reason: authenticated ? void 0 : "claude auth status failed \u2014 run `claude auth login`"
895
911
  };
896
912
  },
@@ -907,11 +923,12 @@ var claudeAdapter = {
907
923
  );
908
924
  }
909
925
  const mode = permissionMode(thread);
910
- const { isOrchestratorThread } = await import("./global-workspace-667XLBW6.js");
926
+ const { isOrchestratorThread } = await import("./global-workspace-BHT4XUAA.js");
911
927
  const isOrchestrator = isOrchestratorThread(thread);
912
928
  const injectedServers = await buildInjectedMcpServers({
913
929
  includeSideboard: true,
914
- includeBrightsy: isBrightsyConnected()
930
+ includeBrightsy: isBrightsyConnected(),
931
+ orchestratorThreadId: isOrchestrator ? thread.id : null
915
932
  });
916
933
  const injectedBrightsyNames = injectedServers.filter((s) => s.name === "brightsy" || s.name.startsWith("brightsy_")).map((s) => s.name);
917
934
  const chromeOn = claudeChromeEnabled();
@@ -1102,7 +1119,7 @@ function parseIssuesJson(raw) {
1102
1119
  }
1103
1120
 
1104
1121
  // src/agents/codex.ts
1105
- import { existsSync as existsSync3, readFileSync } from "fs";
1122
+ import { existsSync as existsSync3, readFileSync, statSync } from "fs";
1106
1123
  import { homedir } from "os";
1107
1124
  import { join as join2 } from "path";
1108
1125
  var CODEX_PROMPT_ARG_MAX = 2e5;
@@ -1193,10 +1210,19 @@ function asRecord(value) {
1193
1210
  }
1194
1211
  return void 0;
1195
1212
  }
1213
+ function codexLooksAuthenticated() {
1214
+ const authPath = join2(homedir(), ".codex", "auth.json");
1215
+ if (!existsSync3(authPath)) return false;
1216
+ try {
1217
+ return statSync(authPath).size > 2;
1218
+ } catch {
1219
+ return false;
1220
+ }
1221
+ }
1196
1222
  var codexAdapter = {
1197
1223
  kind: "codex",
1198
1224
  async detect() {
1199
- const which = await run("which", ["codex"], { reject: false });
1225
+ const which = await run("which", ["codex"], { reject: false, timeoutMs: 3e3 });
1200
1226
  if (which.exitCode !== 0) {
1201
1227
  return {
1202
1228
  agent: "codex",
@@ -1207,10 +1233,8 @@ var codexAdapter = {
1207
1233
  reason: "codex CLI not found on PATH"
1208
1234
  };
1209
1235
  }
1210
- const auth = await run("codex", ["login", "status"], { reject: false });
1211
- const authenticated = auth.exitCode === 0;
1212
- const mcp = await run("codex", ["mcp", "list", "--json"], { reject: false });
1213
- const linearMcp = /linear/i.test(mcp.stdout + mcp.stderr);
1236
+ const authenticated = codexLooksAuthenticated();
1237
+ const linearMcp = false;
1214
1238
  const warnings = [];
1215
1239
  if (!codexConfigHasNetworkAccess()) {
1216
1240
  warnings.push(
@@ -1223,7 +1247,7 @@ var codexAdapter = {
1223
1247
  authenticated,
1224
1248
  linearMcp,
1225
1249
  warnings,
1226
- reason: authenticated ? void 0 : "codex login status failed \u2014 run `codex login`"
1250
+ reason: authenticated ? void 0 : "Codex auth not found \u2014 run `codex login` (expected ~/.codex/auth.json)"
1227
1251
  };
1228
1252
  },
1229
1253
  async buildTurn(thread, input) {
@@ -1241,23 +1265,26 @@ var codexAdapter = {
1241
1265
  const model = thread.model?.trim();
1242
1266
  const injected = await buildInjectedMcpServers({
1243
1267
  includeSideboard: true,
1244
- includeBrightsy: isBrightsyConnected()
1268
+ includeBrightsy: isBrightsyConnected(),
1269
+ orchestratorThreadId: thread.sourceType === "orchestration" ? thread.id : null
1245
1270
  });
1246
1271
  const mcpOverrides = toCodexMcpConfigArgs(injected);
1247
- const args = [
1248
- "exec",
1249
- ...sessionId ? ["resume", sessionId] : [],
1250
- promptArg,
1272
+ const execOpts = [
1273
+ // Global orchestration cwd is not a git repo; without this Codex ≥0.147
1274
+ // refuses to start ("Not inside a trusted directory").
1275
+ "--skip-git-repo-check",
1251
1276
  "--cd",
1252
1277
  thread.worktreePath,
1253
1278
  "--json",
1254
1279
  "--sandbox",
1255
1280
  mode.codexSandbox,
1256
- "--ask-for-approval",
1257
- "never",
1281
+ // `codex exec` rejects `--ask-for-approval` (global-only on newer CLIs).
1282
+ "-c",
1283
+ 'approval_policy="never"',
1258
1284
  ...model ? ["--model", model] : [],
1259
1285
  ...mcpOverrides
1260
1286
  ];
1287
+ const args = sessionId ? ["exec", ...execOpts, "resume", sessionId, promptArg] : ["exec", ...execOpts, promptArg];
1261
1288
  return {
1262
1289
  file: "codex",
1263
1290
  args,
@@ -1359,7 +1386,7 @@ var codexAdapter = {
1359
1386
  if (sessionId) {
1360
1387
  return {
1361
1388
  file: "codex",
1362
- args: ["exec", "resume", sessionId, "--cd", thread.worktreePath],
1389
+ args: ["exec", "--cd", thread.worktreePath, "resume", sessionId],
1363
1390
  cwd: thread.worktreePath
1364
1391
  };
1365
1392
  }
@@ -1375,12 +1402,12 @@ var codexAdapter = {
1375
1402
  "codex",
1376
1403
  [
1377
1404
  "exec",
1378
- prompt,
1379
1405
  "--json",
1380
1406
  "--sandbox",
1381
1407
  "read-only",
1382
- "--ask-for-approval",
1383
- "never"
1408
+ "-c",
1409
+ 'approval_policy="never"',
1410
+ prompt
1384
1411
  ],
1385
1412
  { reject: false }
1386
1413
  );
@@ -1659,26 +1686,13 @@ var cursorAdapter = {
1659
1686
  reason: "CURSOR_API_KEY not set \u2014 add it in Settings \u2192 Agents \u2192 Cursor, or Settings \u2192 Environment"
1660
1687
  };
1661
1688
  }
1662
- try {
1663
- await Cursor.models.list({ apiKey });
1664
- return {
1665
- agent: "cursor",
1666
- installed: true,
1667
- authenticated: true,
1668
- linearMcp: false,
1669
- warnings: []
1670
- };
1671
- } catch (err) {
1672
- const message = err instanceof Error ? err.message : String(err);
1673
- return {
1674
- agent: "cursor",
1675
- installed: true,
1676
- authenticated: false,
1677
- linearMcp: false,
1678
- warnings: [],
1679
- reason: `Cursor API auth failed: ${message}`
1680
- };
1681
- }
1689
+ return {
1690
+ agent: "cursor",
1691
+ installed: true,
1692
+ authenticated: true,
1693
+ linearMcp: false,
1694
+ warnings: []
1695
+ };
1682
1696
  },
1683
1697
  async buildTurn(thread, input) {
1684
1698
  const prompt = flattenTurnInput(input);
@@ -1686,7 +1700,8 @@ var cursorAdapter = {
1686
1700
  const apiKey = resolveCursorApiKey() || void 0;
1687
1701
  const injected = await buildInjectedMcpServers({
1688
1702
  includeSideboard: true,
1689
- includeBrightsy: isBrightsyConnected()
1703
+ includeBrightsy: isBrightsyConnected(),
1704
+ orchestratorThreadId: thread.sourceType === "orchestration" ? thread.id : null
1690
1705
  });
1691
1706
  const mcpServers = toCursorMcpServers(injected);
1692
1707
  const req = {
@@ -1844,7 +1859,8 @@ var opencodeAdapter = {
1844
1859
  }
1845
1860
  const injected = await buildInjectedMcpServers({
1846
1861
  includeSideboard: true,
1847
- includeBrightsy: isBrightsyConnected()
1862
+ includeBrightsy: isBrightsyConnected(),
1863
+ orchestratorThreadId: thread.sourceType === "orchestration" ? thread.id : null
1848
1864
  });
1849
1865
  const mcpContent = injected.length > 0 ? toOpencodeMcpConfigContent(injected) : null;
1850
1866
  return {