@sideboard-ai/core 0.1.313 → 0.1.314

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 (32) hide show
  1. package/dist/{agents-OHIE3Z7L.js → agents-KIC6CNXF.js} +2 -2
  2. package/dist/{agents-PSNWJMEC.js → agents-S7VBS5JL.js} +2 -2
  3. package/dist/{chunk-ZW7RSQHY.js → chunk-5QYCCXXQ.js} +2 -2
  4. package/dist/{chunk-U3J2YY4T.js → chunk-6EGQPMSR.js} +11 -11
  5. package/dist/{chunk-TDXORDN6.js → chunk-7DBL5AF4.js} +117 -53
  6. package/dist/{chunk-QC2TQMPJ.js → chunk-7UP4D5XI.js} +2 -2
  7. package/dist/{chunk-2JOBQUUS.js → chunk-A45QMSVB.js} +117 -53
  8. package/dist/{chunk-WRZRX4Q7.js → chunk-NMPQ7GIS.js} +3 -3
  9. package/dist/{chunk-X3FSWWW2.js → chunk-S3KYDK6W.js} +4 -4
  10. package/dist/{chunk-62ESCTJ4.js → chunk-TO5UL7VN.js} +3 -3
  11. package/dist/{chunk-E2NJ6RH7.js → chunk-YK77HB3W.js} +10 -10
  12. package/dist/{chunk-RU6DTCCV.js → chunk-ZQLZ2A3I.js} +1 -1
  13. package/dist/{chunk-5QX2NYXL.js → chunk-ZSVKUOFH.js} +4 -4
  14. package/dist/{conductor-CTWR6NH4.js → conductor-G6TKCMIW.js} +2 -2
  15. package/dist/{conductor-YOBSYPLT.js → conductor-IIDQ2U24.js} +2 -2
  16. package/dist/{coordinator-prompt-YAZRQ4BI.js → coordinator-prompt-5USNNCG6.js} +1 -1
  17. package/dist/{coordinator-prompt-GZCWQAAV.js → coordinator-prompt-EXJSULAR.js} +1 -1
  18. package/dist/{global-workspace-H6X32IJZ.js → global-workspace-UDRTONQE.js} +1 -1
  19. package/dist/{global-workspace-BZAVBOH3.js → global-workspace-ZGPIGJ6J.js} +1 -1
  20. package/dist/index.cjs +130 -58
  21. package/dist/index.d.cts +13 -8
  22. package/dist/index.d.ts +13 -8
  23. package/dist/index.js +9 -9
  24. package/dist/mcp/run-stdio.cjs +130 -58
  25. package/dist/mcp/run-stdio.js +5 -5
  26. package/dist/{optional-cli-QDIT57VD.js → optional-cli-MLZSE6KW.js} +1 -1
  27. package/dist/{optional-cli-QY6V5S5N.js → optional-cli-SI4BCPRH.js} +2 -2
  28. package/dist/{orchestrator-RRHB7RNN.js → orchestrator-AM7VT2BD.js} +5 -5
  29. package/dist/{orchestrator-BF7TKSA2.js → orchestrator-V6NLIPLH.js} +5 -5
  30. package/dist/{workspaces-BQUDYTBX.js → workspaces-3TTODHKN.js} +1 -1
  31. package/dist/{workspaces-AGOLRBYZ.js → workspaces-TATO466L.js} +1 -1
  32. package/package.json +1 -1
@@ -46,7 +46,7 @@ import {
46
46
  resolveCursorSdkRoot,
47
47
  resolveQuotaFallbackAgent,
48
48
  turnCostUsdFromCursorUsage
49
- } from "./chunk-2JOBQUUS.js";
49
+ } from "./chunk-A45QMSVB.js";
50
50
  import {
51
51
  getAgentSetupInfo,
52
52
  installAgent,
@@ -63,7 +63,7 @@ import "./chunk-V5BTGQ6M.js";
63
63
  import "./chunk-E63AM3PW.js";
64
64
  import "./chunk-2GPQZZLY.js";
65
65
  import "./chunk-I5TESHDN.js";
66
- import "./chunk-X3FSWWW2.js";
66
+ import "./chunk-S3KYDK6W.js";
67
67
  import "./chunk-DLGGLV2M.js";
68
68
  import "./chunk-N2WW62LF.js";
69
69
  import "./chunk-DD67JWTN.js";
@@ -37,7 +37,7 @@ import {
37
37
  planModeTurnInstruction,
38
38
  resolveCursorModelId,
39
39
  resolveQuotaFallbackAgent
40
- } from "./chunk-TDXORDN6.js";
40
+ } from "./chunk-7DBL5AF4.js";
41
41
  import "./chunk-HH3VVTEC.js";
42
42
  import "./chunk-7Q327QF2.js";
43
43
  import {
@@ -52,7 +52,7 @@ import {
52
52
  resolveLoginCommand,
53
53
  whichOnPath
54
54
  } from "./chunk-U4WACWBC.js";
55
- import "./chunk-5QX2NYXL.js";
55
+ import "./chunk-ZSVKUOFH.js";
56
56
  import "./chunk-BIPXOHZI.js";
57
57
  import "./chunk-HG25AYBV.js";
58
58
  import "./chunk-2P4XKWV2.js";
@@ -11,7 +11,7 @@ import {
11
11
  isGlobalThread,
12
12
  isOrchestratorThread,
13
13
  isSlackCoordinatorThread
14
- } from "./chunk-X3FSWWW2.js";
14
+ } from "./chunk-S3KYDK6W.js";
15
15
  import {
16
16
  mergeAgentGitAuthEnv,
17
17
  resolveAgentGitAuthEnv
@@ -1702,7 +1702,7 @@ var PORT_RANGE_SIZE = 10;
1702
1702
  var RECLAIM_RETRY_DELAY_MS = 40;
1703
1703
  var RECLAIM_TRIES = 8;
1704
1704
  async function killReclaimable(ports, worktreePath, signal) {
1705
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-CTWR6NH4.js");
1705
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-G6TKCMIW.js");
1706
1706
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1707
1707
  else killListenersOnPorts2(ports);
1708
1708
  }
@@ -14,7 +14,7 @@ import {
14
14
  parseSessionQuotaResetAt,
15
15
  planModeTurnInstruction,
16
16
  resolveQuotaFallbackAgent
17
- } from "./chunk-TDXORDN6.js";
17
+ } from "./chunk-7DBL5AF4.js";
18
18
  import {
19
19
  REVIEW_TAB_TITLE,
20
20
  applyWorktreePkgCacheEnv,
@@ -56,7 +56,7 @@ import {
56
56
  worktreeDevProcessKey,
57
57
  worktreeRunProcessKey,
58
58
  worktreeSetupProcessKey
59
- } from "./chunk-QC2TQMPJ.js";
59
+ } from "./chunk-7UP4D5XI.js";
60
60
  import {
61
61
  applyAgentEvent,
62
62
  clipAgentEventForPaint,
@@ -78,7 +78,7 @@ import {
78
78
  import {
79
79
  formatOptionalServicesDirectiveForTurn,
80
80
  formatOptionalServicesReminderForTurn
81
- } from "./chunk-WRZRX4Q7.js";
81
+ } from "./chunk-NMPQ7GIS.js";
82
82
  import {
83
83
  SLACK_REPLY_FORMATTING,
84
84
  addWorkspace,
@@ -103,7 +103,7 @@ import {
103
103
  stageAbsolutePathsAsAttachments,
104
104
  stageBuffersAsAttachments,
105
105
  syncWorkspacesFromThreads
106
- } from "./chunk-5QX2NYXL.js";
106
+ } from "./chunk-ZSVKUOFH.js";
107
107
  import {
108
108
  addPrStackLayer,
109
109
  allocateTeamSlug,
@@ -460,9 +460,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
460
460
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
461
461
  );
462
462
  }
463
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-BZAVBOH3.js");
463
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-ZGPIGJ6J.js");
464
464
  if (isGlobalThread2(thread)) {
465
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-YAZRQ4BI.js");
465
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-5USNNCG6.js");
466
466
  ensureGlobalCoordinatorCwd2(
467
467
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
468
468
  );
@@ -3080,7 +3080,7 @@ async function createThread(input, _onSetupLine) {
3080
3080
  return readThread(thread.id) ?? thread;
3081
3081
  }
3082
3082
  async function listLinearIssues(agent, repoPath) {
3083
- const { getAdapter: getAdapter2 } = await import("./agents-PSNWJMEC.js");
3083
+ const { getAdapter: getAdapter2 } = await import("./agents-S7VBS5JL.js");
3084
3084
  await requireAgent(agent, { requireLinear: true });
3085
3085
  const adapter = getAdapter2(agent);
3086
3086
  if (!adapter.listLinearIssues) {
@@ -3857,7 +3857,7 @@ async function adoptThread(input) {
3857
3857
  messages: input.messages ?? []
3858
3858
  });
3859
3859
  writeThread(thread);
3860
- const { addWorkspace: addWorkspace2 } = await import("./workspaces-BQUDYTBX.js");
3860
+ const { addWorkspace: addWorkspace2 } = await import("./workspaces-3TTODHKN.js");
3861
3861
  await addWorkspace2(repoPath);
3862
3862
  const { ensureWorktreeSideboardIgnored } = await import("./worktree-exclude-RXZPTCNH.js");
3863
3863
  await ensureWorktreeSideboardIgnored(input.worktreePath);
@@ -5958,7 +5958,7 @@ function formatIssueToolsDirective(opts) {
5958
5958
  if (!opts.linear && !opts.abletime && !github) return null;
5959
5959
  const lines = [
5960
5960
  "Issue tracking (Settings \u2192 Issues / Git \u2014 already signed in):",
5961
- "- Use Sideboard `linear_*` / `github_*` / `abletime_*` tools. Do not call Claude Linear MCP, vendor GitHub MCP, or any other vendor issue MCP \u2014 those need a separate login and hang. If a vendor namespace shows needsAuth, ignore it and keep going with Sideboard tools."
5961
+ "- Use Sideboard `linear_*` / `github_*` / `abletime_*` when that Account connection is set and the call works. If it is not set, or the Sideboard call fails because the connection is down, use the Claude connector for that service. Do not mention a Claude connector that failed to start (for example `mcp_github_github` or `plugin:github:github`) when the Sideboard connection is working. A vendor issue MCP that only needsAuth is noise \u2014 do not sign in to it while Sideboard covers that service."
5962
5962
  ];
5963
5963
  if (opts.linear) {
5964
5964
  lines.push(
@@ -6007,7 +6007,7 @@ function formatIssueToolsReminder(opts) {
6007
6007
  ].filter(Boolean);
6008
6008
  const ticket = opts.ticketId?.trim();
6009
6009
  const ticketBit = ticket ? ` This ticket: ${ticket}${opts.ticketProvider ? ` (${opts.ticketProvider})` : ""} \u2014 get; comment/update review findings only after they ask. Spin-offs use parent=.` : " get/comment/update/create (parent= for spin-offs).";
6010
- return `Issues: Sideboard ${names.join(" / ")} (Account). Ignore vendor issue MCP auth.${ticketBit} Review stays in chat \u2014 do not ask_user after it; they type next steps. Authors see comments immediately.`;
6010
+ return `Issues: Sideboard ${names.join(" / ")} when that Account connection works. If it is not set or the call fails, use the Claude connector. Do not mention a Claude connector startup failure when Sideboard covers it.${ticketBit} Review stays in chat \u2014 do not ask_user after it; they type next steps. Authors see comments immediately.`;
6011
6011
  }
6012
6012
  function formatLinearReminder(opts) {
6013
6013
  return formatIssueToolsReminder({
@@ -6795,7 +6795,7 @@ function formatScheduledPrompt(name, prompt) {
6795
6795
  ${prompt}`;
6796
6796
  }
6797
6797
  async function defaultDeps() {
6798
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-BF7TKSA2.js");
6798
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-V6NLIPLH.js");
6799
6799
  const orch = getOrchestrator2();
6800
6800
  return {
6801
6801
  findThread: (id) => findThreadByRef(id),
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-7Q327QF2.js";
13
13
  import {
14
14
  isOrchestratorThread
15
- } from "./chunk-5QX2NYXL.js";
15
+ } from "./chunk-ZSVKUOFH.js";
16
16
  import {
17
17
  codexUnattendedGitConfigArgs,
18
18
  mergeAgentGitAuthEnv,
@@ -53,6 +53,7 @@ import {
53
53
  looksLikeBrightsyEmptyCompletion
54
54
  } from "./chunk-5XNT6BCG.js";
55
55
  import {
56
+ githubAgentAuthReady,
56
57
  run
57
58
  } from "./chunk-QVN2WOKJ.js";
58
59
  import {
@@ -514,6 +515,119 @@ var brightsyAdapter = {
514
515
  // src/agents/claude.ts
515
516
  import { existsSync as existsSync7 } from "fs";
516
517
 
518
+ // src/agents/claude-mcp-status.ts
519
+ var SIDEBOARD_CONNECTOR_SERVICES = [
520
+ "github",
521
+ "linear",
522
+ "posthog",
523
+ "vercel",
524
+ "supabase",
525
+ "sentry"
526
+ ];
527
+ function mcpStatusThinkingFromClaudeInit(obj) {
528
+ const raw = obj.mcp_servers ?? obj.mcpServers;
529
+ const servers = [];
530
+ if (Array.isArray(raw)) {
531
+ for (const item of raw) {
532
+ if (!item || typeof item !== "object" || Array.isArray(item)) continue;
533
+ const rec = item;
534
+ const name = typeof rec.name === "string" && rec.name.trim() || typeof rec.server === "string" && rec.server.trim() || "";
535
+ const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "";
536
+ if (name) servers.push({ name, status: status || "unknown" });
537
+ }
538
+ } else if (raw && typeof raw === "object") {
539
+ for (const [name, value] of Object.entries(raw)) {
540
+ if (!name.trim()) continue;
541
+ if (typeof value === "string" && value.trim()) {
542
+ servers.push({ name, status: value.trim() });
543
+ continue;
544
+ }
545
+ if (value && typeof value === "object" && !Array.isArray(value)) {
546
+ const rec = value;
547
+ const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "unknown";
548
+ servers.push({ name, status });
549
+ }
550
+ }
551
+ }
552
+ const coverage = claudeConnectorCoverage();
553
+ const sideboardOk = sideboardMcpOk(servers);
554
+ const notable = servers.filter(
555
+ (server) => isNotableMcpInitStatus(server, sideboardOk, coverage)
556
+ );
557
+ if (notable.length === 0) return null;
558
+ return `MCP: ${notable.map((s) => `${s.name} ${s.status}`).join(", ")}`;
559
+ }
560
+ function isCleanMcpConnect(status) {
561
+ return /^(connected|ok|ready|success)$/i.test(status.trim());
562
+ }
563
+ function isMcpAuthStatus(status) {
564
+ return /needs[_-]?auth|needs authentication|unauthorized|not authenticated|authrequired/i.test(
565
+ status
566
+ );
567
+ }
568
+ function isSideboardMcpName(name) {
569
+ return /^sideboard$/i.test(name.trim()) || /^mcp__sideboard$/i.test(name.trim());
570
+ }
571
+ function isVendorClaudeAiMcpName(name) {
572
+ return /^claude\.ai\b/i.test(name.trim()) || /^mcp__claude_ai_/i.test(name.trim());
573
+ }
574
+ function sideboardMcpOk(servers) {
575
+ const row = servers.find((server) => isSideboardMcpName(server.name));
576
+ return Boolean(row && isCleanMcpConnect(row.status));
577
+ }
578
+ function sideboardServiceForClaudeConnector(name) {
579
+ const raw = name.trim();
580
+ if (!raw || isSideboardMcpName(raw)) return null;
581
+ const pluginLike = /^(?:plugin[:_]|mcp__plugin_|claude\.ai\s|(?:mcp__)?claude_ai_)/i.test(raw);
582
+ const doubled = raw.match(/^mcp_([a-z0-9]+)_([a-z0-9]+)$/i);
583
+ if (!pluginLike && !(doubled && doubled[1].toLowerCase() === doubled[2].toLowerCase())) {
584
+ return null;
585
+ }
586
+ let body = raw;
587
+ if (/^claude\.ai\s+/i.test(body)) body = body.replace(/^claude\.ai\s+/i, "");
588
+ else if (/^(?:mcp__)?claude_ai_/i.test(body)) body = body.replace(/^(?:mcp__)?claude_ai_/i, "");
589
+ else if (/^mcp__plugin_/i.test(body)) body = body.slice("mcp__plugin_".length);
590
+ else if (/^plugin_/i.test(body)) body = body.slice("plugin_".length);
591
+ else if (/^plugin:/i.test(body)) body = body.slice("plugin:".length);
592
+ else if (/^mcp_/i.test(body)) body = body.slice("mcp_".length);
593
+ const head = body.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)[0];
594
+ if (!head || !SIDEBOARD_CONNECTOR_SERVICES.includes(head)) return null;
595
+ return head;
596
+ }
597
+ function claudeConnectorCoverage() {
598
+ let github = false;
599
+ try {
600
+ github = githubAgentAuthReady();
601
+ } catch {
602
+ github = false;
603
+ }
604
+ let linear = false;
605
+ let posthog = false;
606
+ let vercel = false;
607
+ let supabase = false;
608
+ let sentry = false;
609
+ try {
610
+ linear = isLinearConnected();
611
+ posthog = isPosthogConnected();
612
+ const integrations = loadAppSettings().integrations ?? {};
613
+ if (integrations.githubPat?.trim()) github = true;
614
+ vercel = Boolean(integrations.vercelToken?.trim());
615
+ supabase = Boolean(integrations.supabaseAccessToken?.trim());
616
+ sentry = Boolean(integrations.sentryAuthToken?.trim());
617
+ } catch {
618
+ }
619
+ return { github, linear, posthog, vercel, supabase, sentry };
620
+ }
621
+ function isNotableMcpInitStatus(server, sideboardOk, coverage) {
622
+ if (isCleanMcpConnect(server.status)) return false;
623
+ if (isSideboardMcpName(server.name)) return true;
624
+ if (isMcpAuthStatus(server.status)) return false;
625
+ const service = sideboardServiceForClaudeConnector(server.name);
626
+ if (service) return !(sideboardOk && coverage[service]);
627
+ if (isVendorClaudeAiMcpName(server.name)) return false;
628
+ return true;
629
+ }
630
+
517
631
  // src/mcp-ui/host.ts
518
632
  import { createHash } from "crypto";
519
633
  import { homedir as homedir4 } from "os";
@@ -2326,56 +2440,6 @@ function claudeString(obj, key) {
2326
2440
  const v = obj[key];
2327
2441
  return typeof v === "string" && v.trim() ? v.trim() : void 0;
2328
2442
  }
2329
- function mcpStatusThinkingFromClaudeInit(obj) {
2330
- const raw = obj.mcp_servers ?? obj.mcpServers;
2331
- const servers = [];
2332
- if (Array.isArray(raw)) {
2333
- for (const item of raw) {
2334
- if (!item || typeof item !== "object" || Array.isArray(item)) continue;
2335
- const rec = item;
2336
- const name = typeof rec.name === "string" && rec.name.trim() || typeof rec.server === "string" && rec.server.trim() || "";
2337
- const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "";
2338
- if (name) servers.push({ name, status: status || "unknown" });
2339
- }
2340
- } else if (raw && typeof raw === "object") {
2341
- for (const [name, value] of Object.entries(raw)) {
2342
- if (!name.trim()) continue;
2343
- if (typeof value === "string" && value.trim()) {
2344
- servers.push({ name, status: value.trim() });
2345
- continue;
2346
- }
2347
- if (value && typeof value === "object" && !Array.isArray(value)) {
2348
- const rec = value;
2349
- const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "unknown";
2350
- servers.push({ name, status });
2351
- }
2352
- }
2353
- }
2354
- const notable = servers.filter(isNotableMcpInitStatus);
2355
- if (notable.length === 0) return null;
2356
- return `MCP: ${notable.map((s) => `${s.name} ${s.status}`).join(", ")}`;
2357
- }
2358
- function isCleanMcpConnect(status) {
2359
- return /^(connected|ok|ready|success)$/i.test(status.trim());
2360
- }
2361
- function isMcpAuthStatus(status) {
2362
- return /needs[_-]?auth|needs authentication|unauthorized|not authenticated|authrequired/i.test(
2363
- status
2364
- );
2365
- }
2366
- function isSideboardMcpName(name) {
2367
- return /^sideboard$/i.test(name.trim()) || /^mcp__sideboard$/i.test(name.trim());
2368
- }
2369
- function isVendorClaudeAiMcpName(name) {
2370
- return /^claude\.ai\b/i.test(name.trim()) || /^mcp__claude_ai_/i.test(name.trim());
2371
- }
2372
- function isNotableMcpInitStatus(server) {
2373
- if (isCleanMcpConnect(server.status)) return false;
2374
- if (isSideboardMcpName(server.name)) return true;
2375
- if (isVendorClaudeAiMcpName(server.name)) return false;
2376
- if (isMcpAuthStatus(server.status)) return false;
2377
- return true;
2378
- }
2379
2443
  function eventsFromClaudeSystem(obj) {
2380
2444
  const subtype = claudeString(obj, "subtype") ?? "";
2381
2445
  const parentId = claudeParentToolUseId(obj);
@@ -2545,7 +2609,7 @@ var claudeAdapter = {
2545
2609
  );
2546
2610
  }
2547
2611
  const mode = permissionMode(thread);
2548
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-BZAVBOH3.js");
2612
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-ZGPIGJ6J.js");
2549
2613
  const isOrchestrator = isOrchestratorThread2(thread);
2550
2614
  const rpc = worktreeAgentRpc(isOrchestrator);
2551
2615
  const injectedServers = await buildInjectedMcpServers({
@@ -4472,6 +4536,7 @@ export {
4472
4536
  adjustBrightsyTurnExit,
4473
4537
  listBrightsyChatTargets,
4474
4538
  brightsyAdapter,
4539
+ mcpStatusThinkingFromClaudeInit,
4475
4540
  mcpUiContentSecurityPolicy,
4476
4541
  SIDEBOARD_MCP_PROFILE_ENV,
4477
4542
  SIDEBOARD_THREAD_ID_ENV,
@@ -4502,7 +4567,6 @@ export {
4502
4567
  PLAN_MODE_OFF_INSTRUCTION,
4503
4568
  planModeTurnInstruction,
4504
4569
  permissionMode,
4505
- mcpStatusThinkingFromClaudeInit,
4506
4570
  claudeAdapter,
4507
4571
  listCodexModels,
4508
4572
  codexAdapter,
@@ -8,7 +8,7 @@ import {
8
8
  isGlobalThread,
9
9
  isOrchestratorThread,
10
10
  isSlackCoordinatorThread
11
- } from "./chunk-5QX2NYXL.js";
11
+ } from "./chunk-ZSVKUOFH.js";
12
12
  import {
13
13
  mergeAgentGitAuthEnv,
14
14
  resolveAgentGitAuthEnv
@@ -1832,7 +1832,7 @@ var PORT_RANGE_SIZE = 10;
1832
1832
  var RECLAIM_RETRY_DELAY_MS = 40;
1833
1833
  var RECLAIM_TRIES = 8;
1834
1834
  async function killReclaimable(ports, worktreePath, signal) {
1835
- const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-YOBSYPLT.js");
1835
+ const { killListenersOnPorts: killListenersOnPorts2, killStaleWorktreeListeners: killStaleWorktreeListeners2 } = await import("./conductor-IIDQ2U24.js");
1836
1836
  if (worktreePath) killStaleWorktreeListeners2(ports, worktreePath, signal);
1837
1837
  else killListenersOnPorts2(ports);
1838
1838
  }
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-I5TESHDN.js";
25
25
  import {
26
26
  isOrchestratorThread
27
- } from "./chunk-X3FSWWW2.js";
27
+ } from "./chunk-S3KYDK6W.js";
28
28
  import {
29
29
  codexUnattendedGitConfigArgs,
30
30
  mergeAgentGitAuthEnv,
@@ -32,6 +32,7 @@ import {
32
32
  resolveCodexGitWritableRoots
33
33
  } from "./chunk-DLGGLV2M.js";
34
34
  import {
35
+ githubAgentAuthReady,
35
36
  npmGlobalNodeModules,
36
37
  run
37
38
  } from "./chunk-2UG25RMK.js";
@@ -448,6 +449,119 @@ var brightsyAdapter = {
448
449
  // src/agents/claude.ts
449
450
  import { existsSync as existsSync11 } from "fs";
450
451
 
452
+ // src/agents/claude-mcp-status.ts
453
+ var SIDEBOARD_CONNECTOR_SERVICES = [
454
+ "github",
455
+ "linear",
456
+ "posthog",
457
+ "vercel",
458
+ "supabase",
459
+ "sentry"
460
+ ];
461
+ function mcpStatusThinkingFromClaudeInit(obj) {
462
+ const raw = obj.mcp_servers ?? obj.mcpServers;
463
+ const servers = [];
464
+ if (Array.isArray(raw)) {
465
+ for (const item of raw) {
466
+ if (!item || typeof item !== "object" || Array.isArray(item)) continue;
467
+ const rec = item;
468
+ const name = typeof rec.name === "string" && rec.name.trim() || typeof rec.server === "string" && rec.server.trim() || "";
469
+ const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "";
470
+ if (name) servers.push({ name, status: status || "unknown" });
471
+ }
472
+ } else if (raw && typeof raw === "object") {
473
+ for (const [name, value] of Object.entries(raw)) {
474
+ if (!name.trim()) continue;
475
+ if (typeof value === "string" && value.trim()) {
476
+ servers.push({ name, status: value.trim() });
477
+ continue;
478
+ }
479
+ if (value && typeof value === "object" && !Array.isArray(value)) {
480
+ const rec = value;
481
+ const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "unknown";
482
+ servers.push({ name, status });
483
+ }
484
+ }
485
+ }
486
+ const coverage = claudeConnectorCoverage();
487
+ const sideboardOk = sideboardMcpOk(servers);
488
+ const notable = servers.filter(
489
+ (server) => isNotableMcpInitStatus(server, sideboardOk, coverage)
490
+ );
491
+ if (notable.length === 0) return null;
492
+ return `MCP: ${notable.map((s) => `${s.name} ${s.status}`).join(", ")}`;
493
+ }
494
+ function isCleanMcpConnect(status) {
495
+ return /^(connected|ok|ready|success)$/i.test(status.trim());
496
+ }
497
+ function isMcpAuthStatus(status) {
498
+ return /needs[_-]?auth|needs authentication|unauthorized|not authenticated|authrequired/i.test(
499
+ status
500
+ );
501
+ }
502
+ function isSideboardMcpName(name) {
503
+ return /^sideboard$/i.test(name.trim()) || /^mcp__sideboard$/i.test(name.trim());
504
+ }
505
+ function isVendorClaudeAiMcpName(name) {
506
+ return /^claude\.ai\b/i.test(name.trim()) || /^mcp__claude_ai_/i.test(name.trim());
507
+ }
508
+ function sideboardMcpOk(servers) {
509
+ const row = servers.find((server) => isSideboardMcpName(server.name));
510
+ return Boolean(row && isCleanMcpConnect(row.status));
511
+ }
512
+ function sideboardServiceForClaudeConnector(name) {
513
+ const raw = name.trim();
514
+ if (!raw || isSideboardMcpName(raw)) return null;
515
+ const pluginLike = /^(?:plugin[:_]|mcp__plugin_|claude\.ai\s|(?:mcp__)?claude_ai_)/i.test(raw);
516
+ const doubled = raw.match(/^mcp_([a-z0-9]+)_([a-z0-9]+)$/i);
517
+ if (!pluginLike && !(doubled && doubled[1].toLowerCase() === doubled[2].toLowerCase())) {
518
+ return null;
519
+ }
520
+ let body = raw;
521
+ if (/^claude\.ai\s+/i.test(body)) body = body.replace(/^claude\.ai\s+/i, "");
522
+ else if (/^(?:mcp__)?claude_ai_/i.test(body)) body = body.replace(/^(?:mcp__)?claude_ai_/i, "");
523
+ else if (/^mcp__plugin_/i.test(body)) body = body.slice("mcp__plugin_".length);
524
+ else if (/^plugin_/i.test(body)) body = body.slice("plugin_".length);
525
+ else if (/^plugin:/i.test(body)) body = body.slice("plugin:".length);
526
+ else if (/^mcp_/i.test(body)) body = body.slice("mcp_".length);
527
+ const head = body.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean)[0];
528
+ if (!head || !SIDEBOARD_CONNECTOR_SERVICES.includes(head)) return null;
529
+ return head;
530
+ }
531
+ function claudeConnectorCoverage() {
532
+ let github = false;
533
+ try {
534
+ github = githubAgentAuthReady();
535
+ } catch {
536
+ github = false;
537
+ }
538
+ let linear = false;
539
+ let posthog = false;
540
+ let vercel = false;
541
+ let supabase = false;
542
+ let sentry = false;
543
+ try {
544
+ linear = isLinearConnected();
545
+ posthog = isPosthogConnected();
546
+ const integrations = loadAppSettings().integrations ?? {};
547
+ if (integrations.githubPat?.trim()) github = true;
548
+ vercel = Boolean(integrations.vercelToken?.trim());
549
+ supabase = Boolean(integrations.supabaseAccessToken?.trim());
550
+ sentry = Boolean(integrations.sentryAuthToken?.trim());
551
+ } catch {
552
+ }
553
+ return { github, linear, posthog, vercel, supabase, sentry };
554
+ }
555
+ function isNotableMcpInitStatus(server, sideboardOk, coverage) {
556
+ if (isCleanMcpConnect(server.status)) return false;
557
+ if (isSideboardMcpName(server.name)) return true;
558
+ if (isMcpAuthStatus(server.status)) return false;
559
+ const service = sideboardServiceForClaudeConnector(server.name);
560
+ if (service) return !(sideboardOk && coverage[service]);
561
+ if (isVendorClaudeAiMcpName(server.name)) return false;
562
+ return true;
563
+ }
564
+
451
565
  // src/mcp-ui/host.ts
452
566
  import { createHash } from "crypto";
453
567
  import { homedir as homedir5 } from "os";
@@ -2633,56 +2747,6 @@ function claudeString(obj, key) {
2633
2747
  const v = obj[key];
2634
2748
  return typeof v === "string" && v.trim() ? v.trim() : void 0;
2635
2749
  }
2636
- function mcpStatusThinkingFromClaudeInit(obj) {
2637
- const raw = obj.mcp_servers ?? obj.mcpServers;
2638
- const servers = [];
2639
- if (Array.isArray(raw)) {
2640
- for (const item of raw) {
2641
- if (!item || typeof item !== "object" || Array.isArray(item)) continue;
2642
- const rec = item;
2643
- const name = typeof rec.name === "string" && rec.name.trim() || typeof rec.server === "string" && rec.server.trim() || "";
2644
- const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "";
2645
- if (name) servers.push({ name, status: status || "unknown" });
2646
- }
2647
- } else if (raw && typeof raw === "object") {
2648
- for (const [name, value] of Object.entries(raw)) {
2649
- if (!name.trim()) continue;
2650
- if (typeof value === "string" && value.trim()) {
2651
- servers.push({ name, status: value.trim() });
2652
- continue;
2653
- }
2654
- if (value && typeof value === "object" && !Array.isArray(value)) {
2655
- const rec = value;
2656
- const status = typeof rec.status === "string" && rec.status.trim() || typeof rec.state === "string" && rec.state.trim() || "unknown";
2657
- servers.push({ name, status });
2658
- }
2659
- }
2660
- }
2661
- const notable = servers.filter(isNotableMcpInitStatus);
2662
- if (notable.length === 0) return null;
2663
- return `MCP: ${notable.map((s) => `${s.name} ${s.status}`).join(", ")}`;
2664
- }
2665
- function isCleanMcpConnect(status) {
2666
- return /^(connected|ok|ready|success)$/i.test(status.trim());
2667
- }
2668
- function isMcpAuthStatus(status) {
2669
- return /needs[_-]?auth|needs authentication|unauthorized|not authenticated|authrequired/i.test(
2670
- status
2671
- );
2672
- }
2673
- function isSideboardMcpName(name) {
2674
- return /^sideboard$/i.test(name.trim()) || /^mcp__sideboard$/i.test(name.trim());
2675
- }
2676
- function isVendorClaudeAiMcpName(name) {
2677
- return /^claude\.ai\b/i.test(name.trim()) || /^mcp__claude_ai_/i.test(name.trim());
2678
- }
2679
- function isNotableMcpInitStatus(server) {
2680
- if (isCleanMcpConnect(server.status)) return false;
2681
- if (isSideboardMcpName(server.name)) return true;
2682
- if (isVendorClaudeAiMcpName(server.name)) return false;
2683
- if (isMcpAuthStatus(server.status)) return false;
2684
- return true;
2685
- }
2686
2750
  function eventsFromClaudeSystem(obj) {
2687
2751
  const subtype = claudeString(obj, "subtype") ?? "";
2688
2752
  const parentId = claudeParentToolUseId(obj);
@@ -2852,7 +2916,7 @@ var claudeAdapter = {
2852
2916
  );
2853
2917
  }
2854
2918
  const mode = permissionMode(thread);
2855
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-H6X32IJZ.js");
2919
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-UDRTONQE.js");
2856
2920
  const isOrchestrator = isOrchestratorThread2(thread);
2857
2921
  const rpc = worktreeAgentRpc(isOrchestrator);
2858
2922
  const injectedServers = await buildInjectedMcpServers({
@@ -5154,6 +5218,7 @@ export {
5154
5218
  adjustBrightsyTurnExit,
5155
5219
  listBrightsyChatTargets,
5156
5220
  brightsyAdapter,
5221
+ mcpStatusThinkingFromClaudeInit,
5157
5222
  SIDEBOARD_THREAD_ID_ENV,
5158
5223
  shouldRegisterMcpWaitForTurn,
5159
5224
  worktreeMcpToolNames,
@@ -5164,7 +5229,6 @@ export {
5164
5229
  PLAN_MODE_OFF_INSTRUCTION,
5165
5230
  planModeTurnInstruction,
5166
5231
  permissionMode,
5167
- mcpStatusThinkingFromClaudeInit,
5168
5232
  claudeAdapter,
5169
5233
  listCodexModels,
5170
5234
  codexAdapter,
@@ -239,7 +239,7 @@ function connectorAuthCaution(posthog, cliConnected) {
239
239
  const signIn = posthog ? "If a connector MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP." : "If a Vercel, Supabase, or Sentry MCP is listed but needsAuth or returns unauthorized, do not sign in to that MCP.";
240
240
  const token = cliConnected ? " CLI tokens are already in this process." : "";
241
241
  const key = posthog ? " Do not read a PostHog key from the environment." : "";
242
- return `${signIn}${token}${key}`;
242
+ return `${signIn}${token}${key} When this Sideboard connection works, ignore a Claude connector that failed to start. Use the Claude connector only when this connection is not set or the CLI call fails.`;
243
243
  }
244
244
  function connectorReminderBit(spec, cli) {
245
245
  if (!spec.cli) return `${spec.label}: \`posthog_api\``;
@@ -266,14 +266,14 @@ function formatOptionalServicesReminder(integrations, cli) {
266
266
  const bits = connected.map((spec) => connectorReminderBit(spec, cli)).join(". ");
267
267
  const tokenBit = connected.some((spec) => spec.cli) ? "CLI tokens are already in this process. " : "";
268
268
  const posthog = connected.some((spec) => spec.id === "posthog");
269
- const auth = posthog ? "If a connector MCP needsAuth or is unauthorized, ignore it and use the CLI or `posthog_api`. Do not read a PostHog key from the environment." : "If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized, ignore it and use the CLI.";
269
+ const auth = posthog ? "If a connector MCP needsAuth or is unauthorized, ignore it and use the CLI or `posthog_api` while this Sideboard connection works. Use the Claude connector only when it is not set or the call fails. Do not read a PostHog key from the environment." : "If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized, ignore it and use the CLI while this Sideboard connection works. Use the Claude connector only when it is not set or the CLI call fails.";
270
270
  return `Settings \u2192 Connectors: ${tokenBit}${bits}. ${auth} Do not add vendor MCPs. Shell dumps from those CLIs go in \`.context/cli/\` \u2014 read a slice.`;
271
271
  }
272
272
  async function connectedCliPresence(integrations) {
273
273
  const ids = connectedOptionalServices(integrations).filter((spec) => spec.cli).map((spec) => spec.id);
274
274
  if (ids.length === 0) return void 0;
275
275
  try {
276
- const { optionalCliPresence } = await import("./optional-cli-QY6V5S5N.js");
276
+ const { optionalCliPresence } = await import("./optional-cli-SI4BCPRH.js");
277
277
  return await optionalCliPresence(ids);
278
278
  } catch {
279
279
  return void 0;
@@ -341,12 +341,12 @@ var COORDINATOR_TOOL_PLAYBOOK = [
341
341
  "- list_projects \u2014 registered repos (path + github slug + project context when set). Use account / project context to pick the right repo for tickets or reviews.",
342
342
  "- list_board \u2014 Home Kanban of workspaces (New / Draft / Review / Approved / Merged; one card per checkout). Sibling chats on a card are separate agents, not one agent. Path to merge: no PR \u2192 draft PR \u2192 open PR \u2192 approved \u2192 merged. Archive removes the card to Settings \u2192 History (list_archive to browse, restore_workspace to bring it back). Queued/running are activity on the card, not columns. Orchestration chats are not on the board. Filters: query, repoPath, kind, column, limit.",
343
343
  `- list_branches / list_prs / list_issues \u2014 pass repoPath from list_projects. Review is PRs (the surface for assigned ticket work), not the tickets: "Get me N tickets to review" \u2192 list_prs(queue=review, limit=N) then create_workspace sourceType=pr. That is open non-draft PRs labeled with this project's ready-for-review GitHub label (Settings \u2192 Projects; default eng-review) with no individual user reviewer yet. A team request (engineering-team) is not a claim \u2014 the viewer is on that team and can pick it up; claimed means an individual account is the reviewer. Bots ignored. Use Settings \u2192 Agents / Projects context (roles, teams, labels \u2014 freeform text; project adds to account) to prefer the right queues. queue=mine is review-requested:@me; queue=approved|changes uses those labels. Also: state, label, reviewer=me|unassigned|login, query, limit default 40 max 250; raise limit or tighten when truncated. list_issues (query, assignee=me|unassigned|all|user, limit default 40 max 250) lists Linear, AbleTime, or GitHub tickets \u2014 do not use it for that review-inbox ask. When they ask for tickets to work on, follow their context (assignee=me or unassigned as it says).`,
344
- "- Find work: when they ask to find work, pick up tickets, or list reviews, use Settings \u2192 Agents (account) plus Settings \u2192 Projects (per-repo) context. Tickets \u2192 Sideboard list_issues / linear_* (Account Linear). Reviews \u2192 list_prs(queue=review). Do not call Claude Linear MCP or any other vendor Linear MCP \u2014 those HTTP connectors hang or flap on the first turn. If a vendor MCP is down or reconnecting, ignore it and keep going with Sideboard tools. Show the options \u2014 do not create_workspace or start unless they also asked to start (e.g. \u201Cfind me work and start it\u201D). Do not start this unprompted. To change that context, show the proposed text, ask_user (Save this context / Do not save), wait, then update_viewer_context with confirmed=true. Never write it without confirmation.",
344
+ "- Find work: when they ask to find work, pick up tickets, or list reviews, use Settings \u2192 Agents (account) plus Settings \u2192 Projects (per-repo) context. Tickets \u2192 Sideboard list_issues / linear_* (Account Linear). Reviews \u2192 list_prs(queue=review). Do not call Claude Linear MCP or any other vendor Linear MCP \u2014 those HTTP connectors hang or flap on the first turn. If a vendor MCP is down or reconnecting, ignore it and keep going with Sideboard tools. A failed Claude connector is not a Sideboard outage \u2014 do not mention it when the Account connection works. Show the options \u2014 do not create_workspace or start unless they also asked to start (e.g. \u201Cfind me work and start it\u201D). Do not start this unprompted. To change that context, show the proposed text, ask_user (Save this context / Do not save), wait, then update_viewer_context with confirmed=true. Never write it without confirmation.",
345
345
  "- Ticket updates: list_issues / linear_search_issues / github_search_issues with updatedSince (yesterday, 2d, or ISO). One call returns new assignments, ticket edits, and new comments \u2014 do not get_issue every ticket just to check for comments. kind=created vs updated distinguishes new tickets from existing ones.",
346
- "- linear_* (when Linear is connected) \u2014 list_teams for team key/states; linear_list_projects for project names; get/search include the project a ticket is on; get/create/update/comment with ENG-123. Worktree agents have the same Account tools \u2014 prefer they comment, update status, and create spin-offs (parent=) on their own ticket when they were asked to do the work. When reviewing a PR or ticket, do not comment or update until the user types a next step \u2014 they should work through the feedback in chat first. Do not tell the child to ask_user after the review. Scope errors: reconnect Linear in Account settings. Prefer these over any Linear MCP the CLI may still list.",
347
- "- github_* \u2014 get/comment/update/create GitHub issues via Account `gh` (#123). github_list_projects and get/search include GitHub Projects. projectsError or a missing read:project scope \u2192 `gh auth refresh -s read:project`. Worktree agents have these too. Prefer over any vendor GitHub MCP. Pass parent= for spin-offs. When reviewing a PR or ticket, do not comment, submit `gh pr review`, or update the PR/ticket until the user types a next step.",
346
+ "- linear_* (when Linear is connected) \u2014 list_teams for team key/states; linear_list_projects for project names; get/search include the project a ticket is on; get/create/update/comment with ENG-123. Worktree agents have the same Account tools \u2014 prefer they comment, update status, and create spin-offs (parent=) on their own ticket when they were asked to do the work. When reviewing a PR or ticket, do not comment or update until the user types a next step \u2014 they should work through the feedback in chat first. Do not tell the child to ask_user after the review. Scope errors: reconnect Linear in Account settings. Prefer these over any Linear MCP the CLI may still list. Worktree agents use the Claude Linear connector only when Account Linear is not set or the Sideboard call fails, and they do not mention that connector startup failure when Sideboard works.",
347
+ "- github_* \u2014 get/comment/update/create GitHub issues via Account `gh` (#123). github_list_projects and get/search include GitHub Projects. projectsError or a missing read:project scope \u2192 `gh auth refresh -s read:project`. Worktree agents have these too. Prefer Sideboard `github_*` while Account `gh` works. A failed Claude GitHub connector (`mcp_github_github`) is not a Sideboard outage \u2014 do not mention it. Use that connector only when `gh` is not set up or the Sideboard call fails. Pass parent= for spin-offs. When reviewing a PR or ticket, do not comment, submit `gh pr review`, or update the PR/ticket until the user types a next step.",
348
348
  "- abletime_* (when AbleTime is connected) \u2014 orientation first; abletime_list_projects lists projects; get/list include the project a task is on; get/comment/update/create (parent= for spin-offs); ensure_task when work has no ticket (or create_workspace from the default branch auto-creates one). Worktree agents have the same Account tools. Same review-write gate as Linear/GitHub.",
349
- "- Optional connectors (Vercel, Supabase, Sentry) in Settings \u2192 Connectors inject tokens into worktree agent env when connected. Prefer official CLIs (`vercel`, `supabase`, `sentry-cli`). When Settings \u2192 Connectors has a PostHog personal API key, PostHog is the Sideboard tool `posthog_api` (GET by default; POST `/api/projects/:id/query/` or `/api/environments/:id/query/` is a read and does not need write=true; other POST and PATCH need write=true only when the user asked to change data). The PostHog key stays in the vault \u2014 do not read it from the environment, and do not sign in to a PostHog MCP. When no PostHog API key is set, leave the Claude PostHog connector alone. If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized, do not sign in \u2014 use the native CLI. Tell any worktree agent (Claude / Cursor / Codex / OpenCode) to write CLI output to `.context/cli/` and read a slice. If a CLI is missing, the user presses Install CLI on that row. Do not add vendor MCPs. Git (`gh`) stays Settings \u2192 Git; issue tracking stays Settings \u2192 Issues. The phone remote is Settings \u2192 Remote \u2014 do not look up Slack users.",
349
+ "- Optional connectors (Vercel, Supabase, Sentry) in Settings \u2192 Connectors inject tokens into worktree agent env when connected. Prefer official CLIs (`vercel`, `supabase`, `sentry-cli`). When Settings \u2192 Connectors has a PostHog personal API key, PostHog is the Sideboard tool `posthog_api` (GET by default; POST `/api/projects/:id/query/` or `/api/environments/:id/query/` is a read and does not need write=true; other POST and PATCH need write=true only when the user asked to change data). The PostHog key stays in the vault \u2014 do not read it from the environment, and do not sign in to a PostHog MCP. When no PostHog API key is set, use the Claude PostHog connector. When a key is set, ignore a failed Claude PostHog connector and do not sign in to a PostHog MCP. If a Vercel, Supabase, or Sentry MCP needsAuth or is unauthorized while that Sideboard token is set, do not sign in \u2014 use the native CLI. When that token is not set or the CLI call fails, the Claude connector is the fallback. Do not mention a Claude connector startup failure when the Sideboard connection works. Tell any worktree agent (Claude / Cursor / Codex / OpenCode) to write CLI output to `.context/cli/` and read a slice. If a CLI is missing, the user presses Install CLI on that row. Do not add vendor MCPs. Git (`gh`) stays Settings \u2192 Git; issue tracking stays Settings \u2192 Issues. The phone remote is Settings \u2192 Remote \u2014 do not look up Slack users.",
350
350
  "- get_pr_stack / open_pr_stack_layers / add_stack_layer / create_pr_stack \u2014 GitHub stacked PRs (`gh stack`); one worktree per layer",
351
351
  "- list_models \u2014 only when you need a specific model (rare); otherwise omit model so Account defaults apply",
352
352
  "- list_chats / get_chat \u2014 live thread list (parent id + last message preview). get_chat on this orchestration chat lists child worktree agents (status + lastText). blockedReason is why that agent is waiting on a person. Also includes usage / lastTurnUsage. Archived workspaces and agents are list_archive, not this list.",