@sideboard-ai/core 0.1.173 → 0.1.175

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 (44) hide show
  1. package/dist/{abletime-PCLL36HW.js → abletime-BFIDZR3O.js} +2 -2
  2. package/dist/{abletime-7VW4EGPT.js → abletime-INEHQH6K.js} +2 -2
  3. package/dist/agents/cursor-runner.cjs +91 -62
  4. package/dist/agents/cursor-runner.js +1 -1
  5. package/dist/{agents-CTWLBPCV.js → agents-2W7LP7JR.js} +6 -6
  6. package/dist/{agents-7UTRNLXQ.js → agents-AWSFDB47.js} +7 -7
  7. package/dist/{chunk-QYZYDO3F.js → chunk-7JIYKYLL.js} +26 -5
  8. package/dist/{chunk-PXNOT6NV.js → chunk-7O53GXTA.js} +26 -5
  9. package/dist/{chunk-M267JPEA.js → chunk-AN3THU7F.js} +1 -1
  10. package/dist/{chunk-AQPVBVJE.js → chunk-BBNUL4IE.js} +1 -1
  11. package/dist/{chunk-LZ6QMEQC.js → chunk-HVIEYTUK.js} +1 -1
  12. package/dist/{chunk-XD2BAANL.js → chunk-IEEAVWAP.js} +6 -6
  13. package/dist/{chunk-WE34LOLO.js → chunk-JIWRBNSO.js} +22 -21
  14. package/dist/{chunk-ELBYOGVA.js → chunk-N7WZ6NIN.js} +10 -1
  15. package/dist/{chunk-2RM6BZQ2.js → chunk-NA7P3SZL.js} +4 -4
  16. package/dist/{chunk-XXIH6XYR.js → chunk-NQTKRAUF.js} +167 -35
  17. package/dist/{chunk-3F7AXVIL.js → chunk-QTJ2ERA6.js} +6 -6
  18. package/dist/{chunk-SKKEJZEX.js → chunk-RCICB4OM.js} +19 -18
  19. package/dist/{chunk-CMJ2FBBV.js → chunk-RE2YWFUQ.js} +1 -1
  20. package/dist/{chunk-234EKD2F.js → chunk-TNOLCU5B.js} +4 -4
  21. package/dist/{chunk-6GN5WPYZ.js → chunk-VKQGAWHY.js} +10 -1
  22. package/dist/{chunk-S42XV45P.js → chunk-Y4MIXGPA.js} +1 -1
  23. package/dist/{chunk-6X6KMUI2.js → chunk-ZXHV3NHY.js} +225 -96
  24. package/dist/{connected-teams-DBWAMP7G.js → connected-teams-ON2KIKQX.js} +3 -3
  25. package/dist/{connected-teams-WGONUQOF.js → connected-teams-WOYCH7FR.js} +3 -3
  26. package/dist/{coordinator-prompt-7CTI6HRH.js → coordinator-prompt-7OHKB5WV.js} +2 -2
  27. package/dist/{coordinator-prompt-PM6MPYYB.js → coordinator-prompt-XCQCGUED.js} +2 -2
  28. package/dist/{global-workspace-CMYSFRCM.js → global-workspace-KPROJ54C.js} +2 -2
  29. package/dist/{global-workspace-CRJ6ZVIY.js → global-workspace-WSQNEALF.js} +2 -2
  30. package/dist/index.cjs +600 -386
  31. package/dist/index.d.cts +49 -8
  32. package/dist/index.d.ts +49 -8
  33. package/dist/index.js +74 -28
  34. package/dist/mcp/run-stdio.cjs +795 -581
  35. package/dist/mcp/run-stdio.js +75 -26
  36. package/dist/{oauth-A7XXI2TM.js → oauth-6ZQ4Q4XN.js} +2 -2
  37. package/dist/{oauth-YJBAURIJ.js → oauth-O7UGLZOY.js} +2 -2
  38. package/dist/{orchestrator-PEOUSLAY.js → orchestrator-PDEU75EE.js} +8 -8
  39. package/dist/{orchestrator-QBB2RELD.js → orchestrator-QSNGJ2ER.js} +7 -7
  40. package/dist/{workspaces-L73MCDFA.js → workspaces-P66DGCZE.js} +2 -2
  41. package/dist/{workspaces-UYSD2STS.js → workspaces-TEBTNS2M.js} +2 -2
  42. package/dist/{worktree-SQD3DBYC.js → worktree-LC4VRWDM.js} +1 -1
  43. package/dist/{worktree-WVEDT3FM.js → worktree-UTDBQXSS.js} +1 -1
  44. package/package.json +1 -1
@@ -24,7 +24,7 @@ import {
24
24
  stripBrightsyNdjsonNoise,
25
25
  sumUsageList,
26
26
  toolDescription
27
- } from "./chunk-3F7AXVIL.js";
27
+ } from "./chunk-QTJ2ERA6.js";
28
28
  import {
29
29
  SLACK_REPLY_FORMATTING,
30
30
  addWorkspace,
@@ -47,7 +47,7 @@ import {
47
47
  stageAbsolutePathsAsAttachments,
48
48
  stageBuffersAsAttachments,
49
49
  syncWorkspacesFromThreads
50
- } from "./chunk-2RM6BZQ2.js";
50
+ } from "./chunk-NA7P3SZL.js";
51
51
  import {
52
52
  addPrStackLayer,
53
53
  allocateTeamName,
@@ -97,7 +97,7 @@ import {
97
97
  worktreeDisplayLabelForGroup,
98
98
  worktreeNameFromPath,
99
99
  worktreeSlugForTicket
100
- } from "./chunk-QYZYDO3F.js";
100
+ } from "./chunk-7JIYKYLL.js";
101
101
  import {
102
102
  ATTACHMENTS_DIR,
103
103
  DETACHED_JOBS_DIR,
@@ -106,7 +106,7 @@ import {
106
106
  } from "./chunk-6K64FJDD.js";
107
107
  import {
108
108
  httpFetch
109
- } from "./chunk-ELBYOGVA.js";
109
+ } from "./chunk-N7WZ6NIN.js";
110
110
  import {
111
111
  createAgentStreamCoalescer
112
112
  } from "./chunk-AXQ4ZWHK.js";
@@ -124,7 +124,7 @@ import {
124
124
  shouldRetryFailedAgentTurn,
125
125
  summarizeTurnStderr,
126
126
  turnFailChatText
127
- } from "./chunk-XXIH6XYR.js";
127
+ } from "./chunk-NQTKRAUF.js";
128
128
  import {
129
129
  assertOrchestratorCapableAgent,
130
130
  childEnvWithAppSettings,
@@ -466,7 +466,7 @@ async function continueSourceThread(threadId, prompt) {
466
466
  await continueOnReply(threadId, prompt);
467
467
  return;
468
468
  }
469
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-PEOUSLAY.js");
469
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-PDEU75EE.js");
470
470
  await getOrchestrator2().send(threadId, prompt);
471
471
  } catch {
472
472
  }
@@ -800,9 +800,9 @@ async function spawnAgentTurn(thread, input, onEvent) {
800
800
  `Cannot spawn ${thread.agent}: thread ${thread.id} has no worktreePath`
801
801
  );
802
802
  }
803
- const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-CMYSFRCM.js");
803
+ const { isGlobalThread: isGlobalThread2 } = await import("./global-workspace-KPROJ54C.js");
804
804
  if (isGlobalThread2(thread)) {
805
- const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-7CTI6HRH.js");
805
+ const { ensureGlobalCoordinatorCwd: ensureGlobalCoordinatorCwd2 } = await import("./coordinator-prompt-7OHKB5WV.js");
806
806
  ensureGlobalCoordinatorCwd2(
807
807
  isOrchestratorThread(thread) ? { orchestratorThreadId: thread.id } : void 0
808
808
  );
@@ -1381,7 +1381,7 @@ function buildSessionSeed(messages, opts) {
1381
1381
  for (let i = blocks.length - 1; i >= 0; i--) {
1382
1382
  if (keep[i]) continue;
1383
1383
  const next = used + blocks[i].length + 2;
1384
- if (next > maxChars && used > 0) break;
1384
+ if (next > maxChars && used > 0) continue;
1385
1385
  keep[i] = true;
1386
1386
  used = next;
1387
1387
  }
@@ -2770,7 +2770,7 @@ function jobAlive(pid) {
2770
2770
  }
2771
2771
  function processGroupAlive(pgid) {
2772
2772
  if (process.platform === "win32") return false;
2773
- if (!Number.isInteger(pgid) || pgid <= 0) return false;
2773
+ if (!Number.isInteger(pgid) || pgid <= 1) return false;
2774
2774
  try {
2775
2775
  process.kill(-pgid, 0);
2776
2776
  return true;
@@ -2813,7 +2813,7 @@ function listRunningDetachedJobs(worktreePath) {
2813
2813
  for (const id of ids) {
2814
2814
  const dir = resolveJobDir(root, id);
2815
2815
  const pid = readIntFile(join11(dir, "pid"));
2816
- if (pid != null && jobAlive(pid)) running.push(id);
2816
+ if (jobTreeAlive(pid)) running.push(id);
2817
2817
  }
2818
2818
  return running.sort();
2819
2819
  }
@@ -3684,7 +3684,7 @@ async function createThread(input, _onSetupLine) {
3684
3684
  let sourceIsFork = false;
3685
3685
  if (!input.cowboy && sourceType === "branch" && (!sourceRef || sourceRef === "HEAD" || sourceRef === "default")) {
3686
3686
  if (isAbleTimeConnected() && getIssueSource() === "abletime") {
3687
- const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-7VW4EGPT.js");
3687
+ const { ensureAbleTimeTask, issueAttachmentForAbleTimeTask } = await import("./abletime-INEHQH6K.js");
3688
3688
  const task = await ensureAbleTimeTask({
3689
3689
  title: title?.trim() || "Untitled work",
3690
3690
  description: input.prompt?.trim() || void 0
@@ -3782,7 +3782,7 @@ async function createThread(input, _onSetupLine) {
3782
3782
  return readThread(thread.id) ?? thread;
3783
3783
  }
3784
3784
  async function listLinearIssues(agent, repoPath) {
3785
- const { getAdapter: getAdapter2 } = await import("./agents-7UTRNLXQ.js");
3785
+ const { getAdapter: getAdapter2 } = await import("./agents-AWSFDB47.js");
3786
3786
  await requireAgent(agent, { requireLinear: true });
3787
3787
  const adapter = getAdapter2(agent);
3788
3788
  if (!adapter.listLinearIssues) {
@@ -4204,7 +4204,7 @@ async function adoptThread(input) {
4204
4204
  messages: input.messages ?? []
4205
4205
  });
4206
4206
  writeThread(thread);
4207
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-UYSD2STS.js");
4207
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-TEBTNS2M.js");
4208
4208
  await ensureWorkspace2(repoPath);
4209
4209
  const { ensureWorktreeSideboardIgnored: ensureWorktreeSideboardIgnored2 } = await import("./worktree-exclude-X54WSOXM.js");
4210
4210
  await ensureWorktreeSideboardIgnored2(input.worktreePath);
@@ -6686,7 +6686,7 @@ function formatScheduledPrompt(name, prompt) {
6686
6686
  ${prompt}`;
6687
6687
  }
6688
6688
  async function defaultDeps() {
6689
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-PEOUSLAY.js");
6689
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-PDEU75EE.js");
6690
6690
  const orch = getOrchestrator2();
6691
6691
  return {
6692
6692
  findThread: (id) => findThreadByRef(id),
@@ -7474,9 +7474,10 @@ var Orchestrator = class {
7474
7474
  ts: (/* @__PURE__ */ new Date()).toISOString()
7475
7475
  });
7476
7476
  thread = this.requireThread(threadId);
7477
+ const gitPrompt = expandCanonicalGitRequest(prompt);
7477
7478
  const { agentPrompt: expandedPrompt } = expandComposerPrompt(
7478
7479
  thread.worktreePath,
7479
- prompt,
7480
+ gitPrompt,
7480
7481
  {
7481
7482
  attachments: sentAttachments ?? thread.attachments
7482
7483
  }
@@ -7518,13 +7519,13 @@ var Orchestrator = class {
7518
7519
  artifactReminder,
7519
7520
  longRunningReminder
7520
7521
  ].filter(Boolean).join("\n\n") || void 0;
7521
- const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(expandedPrompt) ? formatPrGateDirective() : null;
7522
+ const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(prompt) ? formatPrGateDirective() : null;
7522
7523
  const agentPrompt = [
7523
7524
  thread.planMode ? PLAN_MODE_INSTRUCTION : null,
7524
7525
  orchestrationReminder,
7525
7526
  prGateDirective,
7526
7527
  slackReplyContext,
7527
- expandCanonicalGitRequest(expandedPrompt)
7528
+ expandedPrompt
7528
7529
  ].filter(Boolean).join("\n\n");
7529
7530
  if (thread.attachments.length > 0) {
7530
7531
  updateThread(threadId, { attachments: [] });
@@ -8771,7 +8772,7 @@ var Orchestrator = class {
8771
8772
  this.emit({ type: "status_changed", threadId: archived.id, status: "archived" });
8772
8773
  if (thread.repoPath && !isGlobalRepoPath(thread.repoPath)) {
8773
8774
  try {
8774
- const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-UYSD2STS.js");
8775
+ const { ensureWorkspace: ensureWorkspace2 } = await import("./workspaces-TEBTNS2M.js");
8775
8776
  await ensureWorkspace2(thread.repoPath);
8776
8777
  } catch {
8777
8778
  }
@@ -8825,7 +8826,7 @@ var Orchestrator = class {
8825
8826
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
8826
8827
  );
8827
8828
  }
8828
- const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-WVEDT3FM.js");
8829
+ const { createThreadWorktree: createThreadWorktree2 } = await import("./worktree-UTDBQXSS.js");
8829
8830
  const slug = thread.worktreePath.split("/").pop();
8830
8831
  const dest = thread.worktreePath;
8831
8832
  await withRepoGitLock(thread.repoPath, async () => {
@@ -8935,7 +8936,7 @@ async function startOrchestration(opts) {
8935
8936
  sourceRef: "default",
8936
8937
  ...createOpts
8937
8938
  }).catch(async () => {
8938
- const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-WVEDT3FM.js");
8939
+ const { resolveDefaultBranch: resolveDefaultBranch2, resolveRepoRoot: resolveRepoRoot2 } = await import("./worktree-UTDBQXSS.js");
8939
8940
  const repo = await resolveRepoRoot2(repoPath);
8940
8941
  const def = await resolveDefaultBranch2(repo);
8941
8942
  return orch.createThread({
@@ -3,17 +3,26 @@ var injected = null;
3
3
  function setHttpFetchImpl(fetchImpl) {
4
4
  injected = fetchImpl;
5
5
  }
6
+ var TLS_ISSUER_RE = /UNABLE_TO_GET_ISSUER_CERT|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT_IN_CHAIN/i;
7
+ var TLS_ISSUER_HINT = " \u2014 Node rejected the TLS certificate (corporate VPN/proxy CA). Desktop Linear can still work; reconnecting the API key will not fix this.";
8
+ function tlsIssuerHint(code, message) {
9
+ const text = `${code ?? ""} ${message}`;
10
+ return TLS_ISSUER_RE.test(text) ? TLS_ISSUER_HINT : "";
11
+ }
6
12
  function formatFetchError(err, url) {
7
13
  if (!(err instanceof Error)) return `${String(err)} (${url})`;
8
14
  const cause = err.cause;
9
15
  let detail = "";
16
+ let hint = tlsIssuerHint(void 0, err.message);
10
17
  if (cause instanceof Error) {
11
18
  const code = typeof cause.code === "string" ? cause.code : void 0;
12
19
  detail = code ? ` [${code}: ${cause.message}]` : ` [${cause.message}]`;
20
+ hint = tlsIssuerHint(code, `${err.message} ${cause.message}`) || hint;
13
21
  } else if (cause != null) {
14
22
  detail = ` [${String(cause)}]`;
23
+ hint = tlsIssuerHint(void 0, String(cause)) || hint;
15
24
  }
16
- return `${err.message}${detail} (${url})`;
25
+ return `${err.message}${detail} (${url})${hint}`;
17
26
  }
18
27
  async function httpFetch(input, init) {
19
28
  const url = typeof input === "string" ? input : input.href;
@@ -5,7 +5,7 @@ import {
5
5
  resolveRepoRoot,
6
6
  takenSlugsFromThread,
7
7
  teamSlugFromName
8
- } from "./chunk-QYZYDO3F.js";
8
+ } from "./chunk-7JIYKYLL.js";
9
9
  import {
10
10
  ATTACHMENTS_DIR,
11
11
  attachmentsGitignoreBody
@@ -390,7 +390,7 @@ var COORDINATOR_TOOL_PLAYBOOK = [
390
390
  "Workspaces:",
391
391
  "- add_workspace / remove_workspace \u2014 register or unregister a git repo",
392
392
  "Worktree threads (chats):",
393
- "- create_thread \u2014 create a worktree + chat from branch | pr | ticket (appears on Home). Do not create a second worktree for a ticket, PR, or named branch that already has one \u2014 that call returns the live thread (alreadyStarted=true). Creating from the default branch still opens a new isolated worktree. Pass repoPath + parentThreadId; omit agent and model to use Sideboard Account defaults (Settings \u2192 Default agent, model & effort). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). If you are Codex, do not set agent=codex (nested Codex deadlocks)",
393
+ "- create_thread \u2014 create a worktree + chat from branch | pr | ticket (appears on Home). Do not create a second worktree for a ticket, PR, or named branch that already has one \u2014 that call returns the live thread (alreadyStarted=true). Creating from the default branch still opens a new isolated worktree. Pass repoPath + parentThreadId; omit agent and model so Sideboard applies Settings \u2192 Default agent, model & effort (never pass your own agent or agent=cursor). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). Nested Codex (you are Codex and the child is Codex) deadlocks \u2014 omit agent; Sideboard coerces that case",
394
394
  "- start_board_card \u2014 same as create_thread for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_thread.",
395
395
  "- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
396
396
  "- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
@@ -531,8 +531,8 @@ function ensureGlobalCoordinatorCwd(opts) {
531
531
  "",
532
532
  "When creating threads, pass `repoPath` from `list_workspaces` (or the path you just registered).",
533
533
  orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
534
- "Omit `agent` / `model` on `create_thread` unless you have a reason to override Account defaults.",
535
- "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent (Account default) or use cursor/claude.",
534
+ "Omit `agent` / `model` on `create_thread`. Sideboard applies Settings \u2192 Default agent, model & effort. Do not pass your own agent or `agent=cursor` \u2014 those are ignored.",
535
+ "Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent; Sideboard applies Account defaults (and coerces only that nested-Codex case).",
536
536
  "Typical flow (Home board): list_board \u2192 create_thread (sourceType=ticket|pr|branch) \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
537
537
  "Typical flow (branch / explicit source): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
538
538
  "Typical flow (find work): list_workspaces \u2192 pick repo(s) matching account / project context \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_thread + send_to_thread when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
@@ -2,6 +2,9 @@ import {
2
2
  isElectronLikeCommand,
3
3
  wrapElectronAsNodeLaunch
4
4
  } from "./chunk-4TR3HZFT.js";
5
+ import {
6
+ appDataDir
7
+ } from "./chunk-EFVFB2AH.js";
5
8
  import {
6
9
  run
7
10
  } from "./chunk-UFHNSFAS.js";
@@ -301,14 +304,139 @@ function formatTurnExitError(exitCode, stderrSummary) {
301
304
  return `exit ${code}: ${detail}`;
302
305
  }
303
306
 
307
+ // src/http/system-ca.ts
308
+ import { spawnSync } from "child_process";
309
+ import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
310
+ import { dirname, join } from "path";
311
+ import tls from "tls";
312
+ var NODE_USE_SYSTEM_CA = "NODE_USE_SYSTEM_CA";
313
+ var NODE_EXTRA_CA_CERTS = "NODE_EXTRA_CA_CERTS";
314
+ var BUNDLE_NAME = "system-ca.pem";
315
+ var BUNDLE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
316
+ var LINUX_CA_FILES = [
317
+ "/etc/ssl/certs/ca-certificates.crt",
318
+ "/etc/pki/tls/certs/ca-bundle.crt",
319
+ "/etc/ssl/ca-bundle.pem",
320
+ "/etc/ssl/cert.pem"
321
+ ];
322
+ var PEM_CERT_RE = /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
323
+ function splitPemCertificates(pem) {
324
+ return pem.match(PEM_CERT_RE) ?? [];
325
+ }
326
+ function readExistingFile(path) {
327
+ try {
328
+ return existsSync(path) ? readFileSync(path, "utf8") : "";
329
+ } catch {
330
+ return "";
331
+ }
332
+ }
333
+ function darwinKeychainPem(spawn) {
334
+ const result = spawn("/usr/bin/security", ["find-certificate", "-a", "-p"], {
335
+ encoding: "utf8",
336
+ maxBuffer: 32 * 1024 * 1024,
337
+ timeout: 15e3
338
+ });
339
+ if (result.status !== 0) return "";
340
+ return typeof result.stdout === "string" ? result.stdout : "";
341
+ }
342
+ function linuxSystemCaPem() {
343
+ for (const path of LINUX_CA_FILES) {
344
+ const pem = readExistingFile(path);
345
+ if (splitPemCertificates(pem).length > 0) return pem;
346
+ }
347
+ return "";
348
+ }
349
+ function collectSystemCaPem(io = {}) {
350
+ const platform = io.platform ?? process.platform;
351
+ if (platform === "darwin") {
352
+ return darwinKeychainPem(io.spawn ?? spawnSync);
353
+ }
354
+ if (platform === "linux") {
355
+ return linuxSystemCaPem();
356
+ }
357
+ return "";
358
+ }
359
+ function systemCaBundlePath(io = {}) {
360
+ return join((io.appData ?? appDataDir)(), BUNDLE_NAME);
361
+ }
362
+ function bundleIsFresh(path, now) {
363
+ try {
364
+ if (!existsSync(path)) return false;
365
+ if (splitPemCertificates(readFileSync(path, "utf8")).length === 0) return false;
366
+ return now - statSync(path).mtimeMs < BUNDLE_MAX_AGE_MS;
367
+ } catch {
368
+ return false;
369
+ }
370
+ }
371
+ function materializeSystemCaBundle(io = {}) {
372
+ const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
373
+ if (inherited && splitPemCertificates(readExistingFile(inherited)).length > 0) {
374
+ return inherited;
375
+ }
376
+ const platform = io.platform ?? process.platform;
377
+ if (platform === "linux") {
378
+ for (const path of LINUX_CA_FILES) {
379
+ if (splitPemCertificates(readExistingFile(path)).length > 0) return path;
380
+ }
381
+ }
382
+ const dest = systemCaBundlePath(io);
383
+ const now = (io.now ?? Date.now)();
384
+ if (bundleIsFresh(dest, now)) return dest;
385
+ const pem = collectSystemCaPem(io);
386
+ if (splitPemCertificates(pem).length === 0) {
387
+ return existsSync(dest) && splitPemCertificates(readExistingFile(dest)).length > 0 ? dest : void 0;
388
+ }
389
+ try {
390
+ mkdirSync(dirname(dest), { recursive: true });
391
+ writeFileSync(dest, pem.endsWith("\n") ? pem : `${pem}
392
+ `, { mode: 384 });
393
+ return dest;
394
+ } catch {
395
+ return void 0;
396
+ }
397
+ }
398
+ function applySystemCaEnv(env) {
399
+ if (!String(env[NODE_USE_SYSTEM_CA] ?? "").trim()) {
400
+ env[NODE_USE_SYSTEM_CA] = "1";
401
+ }
402
+ if (String(env[NODE_EXTRA_CA_CERTS] ?? "").trim()) return;
403
+ const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
404
+ if (inherited) env[NODE_EXTRA_CA_CERTS] = inherited;
405
+ }
406
+ function extraCertsFromBundle() {
407
+ const path = process.env.NODE_EXTRA_CA_CERTS?.trim();
408
+ if (path) return splitPemCertificates(readExistingFile(path));
409
+ const dest = systemCaBundlePath();
410
+ return splitPemCertificates(readExistingFile(dest));
411
+ }
412
+ function trustSystemCertificates(io = {}) {
413
+ try {
414
+ const api = tls;
415
+ if (typeof api.getCACertificates !== "function" || typeof api.setDefaultCACertificates !== "function") {
416
+ return false;
417
+ }
418
+ const current = api.getCACertificates("default");
419
+ const system = api.getCACertificates("system");
420
+ let extra = extraCertsFromBundle();
421
+ if (system.length === 0 && extra.length === 0) {
422
+ extra = splitPemCertificates(collectSystemCaPem(io));
423
+ }
424
+ if (system.length === 0 && extra.length === 0) return false;
425
+ api.setDefaultCACertificates([...current, ...system, ...extra]);
426
+ return true;
427
+ } catch {
428
+ return false;
429
+ }
430
+ }
431
+
304
432
  // src/agents/node-launch.ts
305
- import { existsSync as existsSync2, readdirSync, realpathSync } from "fs";
433
+ import { existsSync as existsSync3, readdirSync, realpathSync } from "fs";
306
434
  import { homedir } from "os";
307
- import { join as join2 } from "path";
435
+ import { join as join3 } from "path";
308
436
 
309
437
  // src/agents/packaged-runtime.ts
310
- import { existsSync } from "fs";
311
- import { join } from "path";
438
+ import { existsSync as existsSync2 } from "fs";
439
+ import { join as join2 } from "path";
312
440
  function electronResourcesPath() {
313
441
  const resources = process.resourcesPath;
314
442
  if (typeof resources !== "string" || !resources) return null;
@@ -317,36 +445,36 @@ function electronResourcesPath() {
317
445
  function packagedCursorRuntimeDir() {
318
446
  const resources = electronResourcesPath();
319
447
  if (!resources) return null;
320
- const dir = join(resources, "cursor-runtime");
321
- if (!existsSync(join(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
448
+ const dir = join2(resources, "cursor-runtime");
449
+ if (!existsSync2(join2(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
322
450
  return dir;
323
451
  }
324
452
  function packagedCursorRunnerPath() {
325
453
  const dir = packagedCursorRuntimeDir();
326
- return dir ? join(dir, "core-dist", "agents", "cursor-runner.js") : null;
454
+ return dir ? join2(dir, "core-dist", "agents", "cursor-runner.js") : null;
327
455
  }
328
456
  function packagedMcpDir() {
329
457
  const resources = electronResourcesPath();
330
458
  if (!resources) return null;
331
- const dir = join(resources, "sideboard-mcp");
332
- if (!existsSync(join(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
459
+ const dir = join2(resources, "sideboard-mcp");
460
+ if (!existsSync2(join2(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
333
461
  return dir;
334
462
  }
335
463
  function packagedMcpStdioPath() {
336
464
  const dir = packagedMcpDir();
337
- return dir ? join(dir, "core-dist", "mcp", "run-stdio.js") : null;
465
+ return dir ? join2(dir, "core-dist", "mcp", "run-stdio.js") : null;
338
466
  }
339
467
  function packagedBundledNodePath() {
340
468
  const resources = electronResourcesPath();
341
469
  if (!resources) return null;
342
- const bin = join(resources, "node", "bin", "node");
343
- if (!existsSync(bin)) return null;
470
+ const bin = join2(resources, "node", "bin", "node");
471
+ if (!existsSync2(bin)) return null;
344
472
  return bin;
345
473
  }
346
474
  function packagedCursorRipgrepCandidate(platformPkg, binName) {
347
475
  const dir = packagedCursorRuntimeDir();
348
476
  if (!dir) return null;
349
- return join(dir, "node_modules", platformPkg, "bin", binName);
477
+ return join2(dir, "node_modules", platformPkg, "bin", binName);
350
478
  }
351
479
 
352
480
  // src/agents/node-launch.ts
@@ -367,6 +495,7 @@ function applyAgentRunnerHeapEnv(env) {
367
495
  env.NODE_OPTIONS,
368
496
  AGENT_RUNNER_MAX_OLD_SPACE_MB
369
497
  );
498
+ applySystemCaEnv(env);
370
499
  }
371
500
  function envWithAgentHeap(env) {
372
501
  const next = { ...env };
@@ -381,7 +510,7 @@ function unpackedAsarPath(filePath) {
381
510
  if (!isAsarPath(filePath)) return null;
382
511
  const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
383
512
  if (unpacked === filePath) return null;
384
- return existsSync2(unpacked) ? unpacked : null;
513
+ return existsSync3(unpacked) ? unpacked : null;
385
514
  }
386
515
  function nodeReadableScriptPath(scriptPath) {
387
516
  return unpackedAsarPath(scriptPath) ?? scriptPath;
@@ -422,7 +551,7 @@ function pickPreferredNode(candidates) {
422
551
  return best;
423
552
  }
424
553
  function versionDirNodeBins(root, toBin) {
425
- if (!existsSync2(root)) return [];
554
+ if (!existsSync3(root)) return [];
426
555
  try {
427
556
  return readdirSync(root).map(toBin);
428
557
  } catch {
@@ -431,28 +560,28 @@ function versionDirNodeBins(root, toBin) {
431
560
  }
432
561
  function defaultNodeBinCandidates(home = homedir()) {
433
562
  const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
434
- (prefix) => PREFERRED_LTS_MAJORS.map((major) => join2(prefix, "opt", `node@${major}`, "bin", "node"))
563
+ (prefix) => PREFERRED_LTS_MAJORS.map((major) => join3(prefix, "opt", `node@${major}`, "bin", "node"))
435
564
  );
436
565
  return [
437
566
  ...kegs,
438
567
  "/opt/homebrew/bin/node",
439
568
  "/usr/local/bin/node",
440
- join2(home, ".local/share/fnm/aliases/default/bin/node"),
441
- join2(home, ".nvm/current/bin/node"),
442
- join2(home, ".volta/bin/node"),
443
- join2(home, ".asdf/shims/node"),
444
- join2(home, ".local/share/mise/shims/node"),
569
+ join3(home, ".local/share/fnm/aliases/default/bin/node"),
570
+ join3(home, ".nvm/current/bin/node"),
571
+ join3(home, ".volta/bin/node"),
572
+ join3(home, ".asdf/shims/node"),
573
+ join3(home, ".local/share/mise/shims/node"),
445
574
  ...versionDirNodeBins(
446
- join2(home, ".nvm", "versions", "node"),
447
- (name) => join2(home, ".nvm", "versions", "node", name, "bin", "node")
575
+ join3(home, ".nvm", "versions", "node"),
576
+ (name) => join3(home, ".nvm", "versions", "node", name, "bin", "node")
448
577
  ),
449
578
  ...versionDirNodeBins(
450
- join2(home, ".local/share/fnm", "node-versions"),
451
- (name) => join2(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
579
+ join3(home, ".local/share/fnm", "node-versions"),
580
+ (name) => join3(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
452
581
  ),
453
582
  ...versionDirNodeBins(
454
- join2(home, ".volta", "tools", "image", "node"),
455
- (name) => join2(home, ".volta", "tools", "image", "node", name, "bin", "node")
583
+ join3(home, ".volta", "tools", "image", "node"),
584
+ (name) => join3(home, ".volta", "tools", "image", "node", name, "bin", "node")
456
585
  )
457
586
  ];
458
587
  }
@@ -461,7 +590,7 @@ function uniqueExistingNodeBins(paths) {
461
590
  const out = [];
462
591
  for (const raw of paths) {
463
592
  const p = raw.trim();
464
- if (!p || !existsSync2(p) || isElectronLikeCommand(p)) continue;
593
+ if (!p || !existsSync3(p) || isElectronLikeCommand(p)) continue;
465
594
  let key = p;
466
595
  try {
467
596
  key = realpathSync(p);
@@ -854,9 +983,9 @@ function parseCursorRunnerLine(line) {
854
983
  }
855
984
 
856
985
  // src/agents/cursor-ripgrep.ts
857
- import { existsSync as existsSync3 } from "fs";
986
+ import { existsSync as existsSync4 } from "fs";
858
987
  import { createRequire } from "module";
859
- import { dirname, isAbsolute, join as join3, parse, resolve as resolvePath } from "path";
988
+ import { dirname as dirname2, isAbsolute, join as join4, parse, resolve as resolvePath } from "path";
860
989
  var RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
861
990
  function rgBinaryName() {
862
991
  return process.platform === "win32" ? "rg.exe" : "rg";
@@ -868,19 +997,19 @@ function usableRipgrepPath(candidate) {
868
997
  const raw = candidate?.trim();
869
998
  if (!raw || !isAbsolute(raw)) return null;
870
999
  const readable = nodeReadableScriptPath(raw);
871
- if (!existsSync3(readable) || isAsarPath(readable)) return null;
1000
+ if (!existsSync4(readable) || isAsarPath(readable)) return null;
872
1001
  return readable;
873
1002
  }
874
1003
  function walkForBundledRipgrep(startFile) {
875
1004
  if (!startFile) return null;
876
1005
  const pkg = platformRipgrepPackage();
877
1006
  const name = rgBinaryName();
878
- let dir = dirname(resolvePath(startFile));
1007
+ let dir = dirname2(resolvePath(startFile));
879
1008
  const root = parse(dir).root;
880
1009
  while (dir !== root) {
881
- const hit = usableRipgrepPath(join3(dir, "node_modules", pkg, "bin", name));
1010
+ const hit = usableRipgrepPath(join4(dir, "node_modules", pkg, "bin", name));
882
1011
  if (hit) return hit;
883
- const next = dirname(dir);
1012
+ const next = dirname2(dir);
884
1013
  if (next === dir) break;
885
1014
  dir = next;
886
1015
  }
@@ -890,7 +1019,7 @@ function requireResolveBundledRipgrep(fromFile) {
890
1019
  try {
891
1020
  const req = createRequire(fromFile);
892
1021
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
893
- return usableRipgrepPath(join3(dirname(pkgJson), "bin", rgBinaryName()));
1022
+ return usableRipgrepPath(join4(dirname2(pkgJson), "bin", rgBinaryName()));
894
1023
  } catch {
895
1024
  return null;
896
1025
  }
@@ -934,6 +1063,9 @@ export {
934
1063
  shouldFeedErrorBackToAgent,
935
1064
  formatAgentErrorContinuePrompt,
936
1065
  formatTurnExitError,
1066
+ materializeSystemCaBundle,
1067
+ applySystemCaEnv,
1068
+ trustSystemCertificates,
937
1069
  packagedCursorRunnerPath,
938
1070
  packagedMcpDir,
939
1071
  packagedMcpStdioPath,
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  isOrchestratorThread
3
- } from "./chunk-2RM6BZQ2.js";
3
+ } from "./chunk-NA7P3SZL.js";
4
4
  import {
5
5
  codexUnattendedGitConfigArgs,
6
6
  mergeAgentGitAuthEnv,
7
7
  resolveAgentGitAuthEnv,
8
8
  resolveCodexGitWritableRoots
9
- } from "./chunk-QYZYDO3F.js";
9
+ } from "./chunk-7JIYKYLL.js";
10
10
  import {
11
11
  applyConnectedTeamToCli,
12
12
  brightsyMcpServerName,
13
13
  ensureCliTeamTracked,
14
14
  ensureConnectedBrightsyTeamTokens
15
- } from "./chunk-XD2BAANL.js";
15
+ } from "./chunk-IEEAVWAP.js";
16
16
  import {
17
17
  loadBrightsyConfig
18
- } from "./chunk-M267JPEA.js";
18
+ } from "./chunk-AN3THU7F.js";
19
19
  import {
20
20
  applyAgentRunnerHeapEnv,
21
21
  applyNodeLaunch,
@@ -29,7 +29,7 @@ import {
29
29
  packagedMcpStdioPath,
30
30
  parseCursorRunnerLine,
31
31
  resolveNodeLaunch
32
- } from "./chunk-XXIH6XYR.js";
32
+ } from "./chunk-NQTKRAUF.js";
33
33
  import {
34
34
  claudeChromeEnabled,
35
35
  isAbleTimeConnected,
@@ -1898,7 +1898,7 @@ var claudeAdapter = {
1898
1898
  );
1899
1899
  }
1900
1900
  const mode = permissionMode(thread);
1901
- const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-CMYSFRCM.js");
1901
+ const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-KPROJ54C.js");
1902
1902
  const isOrchestrator = isOrchestratorThread2(thread);
1903
1903
  const injectedServers = await buildInjectedMcpServers({
1904
1904
  includeSideboard: true,