@sideboard-ai/core 0.1.303 → 0.1.304
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.
- package/dist/{abletime-APP3DZ4P.js → abletime-SJUVZVRU.js} +6 -6
- package/dist/{abletime-RYDAQ3FE.js → abletime-T5YSJLNZ.js} +6 -6
- package/dist/{abletime-oauth-ZURGXSY6.js → abletime-oauth-2TOOZ2FN.js} +5 -5
- package/dist/{abletime-oauth-KTERKARA.js → abletime-oauth-73TFJME4.js} +5 -5
- package/dist/{abletime-rest-4TVIWLZK.js → abletime-rest-5TDRIFEV.js} +5 -5
- package/dist/{abletime-rest-EUB6RW7K.js → abletime-rest-PNUGH2FS.js} +5 -5
- package/dist/agents/claude-runner.js +2 -2
- package/dist/agents/cursor-runner.js +5 -5
- package/dist/{agents-3GN4E2X3.js → agents-IWNQOQOU.js} +12 -12
- package/dist/{agents-XLHFVC64.js → agents-PGU5WVSO.js} +10 -10
- package/dist/{app-settings-2IH42VA5.js → app-settings-CC65VPBL.js} +3 -3
- package/dist/{app-settings-3OQWRKOK.js → app-settings-DZ5AY7N5.js} +3 -3
- package/dist/{caffeinate-hold-7JM5H5P3.js → caffeinate-hold-H7TTUDGM.js} +2 -2
- package/dist/{caffeinate-hold-DYJGWK6Y.js → caffeinate-hold-ZNUEZGHB.js} +2 -2
- package/dist/{chunk-545DY7CQ.js → chunk-33HIBNSF.js} +106 -64
- package/dist/{chunk-FA3V56KF.js → chunk-3UDRWMIM.js} +2 -2
- package/dist/{chunk-7IAMHN2N.js → chunk-42JGPPVS.js} +1 -1
- package/dist/{chunk-BRFDPV7Z.js → chunk-5QX2NYXL.js} +4 -4
- package/dist/{chunk-DW6NNYUJ.js → chunk-5SFA27CF.js} +61 -8
- package/dist/{chunk-XCXUVX7I.js → chunk-62ESCTJ4.js} +1 -1
- package/dist/{chunk-SSETL5EX.js → chunk-6424BACS.js} +2 -2
- package/dist/{chunk-RSATPXU4.js → chunk-A2YXQC65.js} +264 -2
- package/dist/{chunk-GEFH4QFX.js → chunk-BIPXOHZI.js} +3 -3
- package/dist/{chunk-HSF2RQSQ.js → chunk-CFTOKVQN.js} +5 -5
- package/dist/{chunk-3D3GGL6X.js → chunk-CW4FIIDE.js} +3 -3
- package/dist/{chunk-5DZUWGKV.js → chunk-DC3VZXMA.js} +1 -1
- package/dist/{chunk-5MVOZLN7.js → chunk-DLGGLV2M.js} +3 -3
- package/dist/{chunk-WZCPZVUC.js → chunk-EGTCXNQM.js} +3 -3
- package/dist/{chunk-3TZRSKFJ.js → chunk-EZYZGDWU.js} +422 -175
- package/dist/{chunk-7AYOOG77.js → chunk-G2L3CR3A.js} +471 -107
- package/dist/{chunk-EHT2DRT4.js → chunk-H4UEFJRI.js} +4 -0
- package/dist/{chunk-P2GHFJOB.js → chunk-HG25AYBV.js} +2 -2
- package/dist/{chunk-GS6O65Q2.js → chunk-I34DCC4L.js} +104 -62
- package/dist/{chunk-UN5Q7POQ.js → chunk-J2LNLI4S.js} +1 -1
- package/dist/{chunk-MOP5L5QZ.js → chunk-JARCAPKL.js} +3 -3
- package/dist/{chunk-FAXOEKQR.js → chunk-JWW66PO3.js} +5 -5
- package/dist/{chunk-3HO2OY5T.js → chunk-KI45T4DI.js} +1 -1
- package/dist/{chunk-NOT4SEAM.js → chunk-LAWLUOWQ.js} +1 -1
- package/dist/{chunk-UWQ6UCIB.js → chunk-LG6RJBIY.js} +1 -1
- package/dist/{chunk-IOY2LF3Y.js → chunk-MMVMQ34G.js} +1 -1
- package/dist/{chunk-LZVWKJXY.js → chunk-OLSLE3LO.js} +3 -3
- package/dist/{chunk-RAGDMEIB.js → chunk-OVNIP265.js} +59 -8
- package/dist/{chunk-BU6HH5VA.js → chunk-PHMFAU35.js} +66 -2
- package/dist/{chunk-ISEYRGMP.js → chunk-RU6DTCCV.js} +2 -2
- package/dist/{chunk-R3R3ZDFC.js → chunk-SZ3XS2WM.js} +2 -2
- package/dist/{chunk-B42H6GJR.js → chunk-U4WACWBC.js} +3 -3
- package/dist/{chunk-VGNLMGBK.js → chunk-VEVFHO6K.js} +5 -5
- package/dist/{chunk-4RZRHTSZ.js → chunk-WMZIANPV.js} +1 -1
- package/dist/{chunk-H5XL4KUS.js → chunk-WOU343SI.js} +4 -0
- package/dist/{chunk-QDDTVIWE.js → chunk-WRZRX4Q7.js} +2 -2
- package/dist/{chunk-YCDHLK2Z.js → chunk-X3FSWWW2.js} +4 -4
- package/dist/{chunk-QDA6NXRA.js → chunk-YDUHLWI5.js} +1 -1
- package/dist/{chunk-J54UPHXZ.js → chunk-YJBUYGPN.js} +1 -1
- package/dist/{conductor-ATST6OMC.js → conductor-YBXURAUL.js} +10 -8
- package/dist/{conductor-2AVFGSQJ.js → conductor-ZFRXTVGP.js} +10 -8
- package/dist/{connected-teams-BJ6PMIST.js → connected-teams-BBNYTR3I.js} +2 -2
- package/dist/{connected-teams-AB7ZHJVO.js → connected-teams-WLWIVYGD.js} +2 -2
- package/dist/{coordinator-prompt-TIAI6A47.js → coordinator-prompt-GZCWQAAV.js} +7 -7
- package/dist/{coordinator-prompt-CQPUNMRX.js → coordinator-prompt-YAZRQ4BI.js} +7 -7
- package/dist/{cursor-recover-A6V5UVFT.js → cursor-recover-OWPQUHFH.js} +2 -2
- package/dist/{cursor-recover-MB3T2K5T.js → cursor-recover-TEBFKAZ4.js} +2 -2
- package/dist/{global-workspace-7YABMLQG.js → global-workspace-BZAVBOH3.js} +7 -7
- package/dist/{global-workspace-UZJUHGQP.js → global-workspace-H6X32IJZ.js} +7 -7
- package/dist/index.cjs +13486 -12609
- package/dist/index.d.cts +94 -14
- package/dist/index.d.ts +94 -14
- package/dist/index.js +11807 -11663
- package/dist/{managed-accounts-2AK5RIAF.js → managed-accounts-JJTAKHMG.js} +2 -2
- package/dist/{managed-accounts-46A4KRUE.js → managed-accounts-PITLFLKU.js} +2 -2
- package/dist/mcp/run-stdio.cjs +1037 -616
- package/dist/mcp/run-stdio.js +20 -20
- package/dist/{optional-cli-JQVNSMSU.js → optional-cli-QDIT57VD.js} +5 -5
- package/dist/{optional-cli-PZXDOVJJ.js → optional-cli-QY6V5S5N.js} +6 -6
- package/dist/{orchestrator-CZPRDLHV.js → orchestrator-IKKSYIQ3.js} +16 -16
- package/dist/{orchestrator-COX6QO2B.js → orchestrator-JGHYZDDB.js} +14 -14
- package/dist/{paths-HYT5WOOX.js → paths-HAAJNTTE.js} +1 -1
- package/dist/{paths-5JYXTAPC.js → paths-PHWEVXD5.js} +1 -1
- package/dist/{thread-store-PNX4HVLO.js → thread-store-HY22M5A7.js} +3 -3
- package/dist/{thread-store-VC4AIKN3.js → thread-store-XMUQDO5O.js} +3 -3
- package/dist/{workspaces-GZ7F5EJR.js → workspaces-AGOLRBYZ.js} +7 -7
- package/dist/{workspaces-6DJL4IST.js → workspaces-BQUDYTBX.js} +7 -7
- package/dist/{worktree-2BYVRYPJ.js → worktree-C5VI46RZ.js} +6 -6
- package/dist/{worktree-VXPOY2LE.js → worktree-FMK57ULT.js} +6 -6
- package/package.json +4 -1
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
brightsyMcpServerName,
|
|
4
4
|
ensureCliTeamTracked,
|
|
5
5
|
ensureConnectedBrightsyTeamTokens
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VEVFHO6K.js";
|
|
7
7
|
import {
|
|
8
8
|
looksLikeConversationSummary,
|
|
9
9
|
looksLikeSkillBody,
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
} from "./chunk-F36QRDM4.js";
|
|
13
13
|
import {
|
|
14
14
|
isOrchestratorThread
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5QX2NYXL.js";
|
|
16
16
|
import {
|
|
17
17
|
codexUnattendedGitConfigArgs,
|
|
18
18
|
mergeAgentGitAuthEnv,
|
|
19
19
|
resolveAgentGitAuthEnv,
|
|
20
20
|
resolveCodexGitWritableRoots
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BIPXOHZI.js";
|
|
22
22
|
import {
|
|
23
23
|
loadBrightsyConfig
|
|
24
24
|
} from "./chunk-33KDPEK4.js";
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
packagedMcpStdioPath,
|
|
46
46
|
parseCursorRunnerLine,
|
|
47
47
|
resolveNodeLaunch
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-MMVMQ34G.js";
|
|
49
49
|
import {
|
|
50
50
|
extractJsonErrorMessage,
|
|
51
51
|
formatUnknownDetail,
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
PILOT_TOOL_DESCRIPTIONS,
|
|
66
66
|
PILOT_TOOL_NAMES,
|
|
67
67
|
agentRpcConnectFromMetadata
|
|
68
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-YDUHLWI5.js";
|
|
69
69
|
import {
|
|
70
70
|
claudeChromeEnabled,
|
|
71
71
|
fromInclusiveInputUsage,
|
|
@@ -75,14 +75,14 @@ import {
|
|
|
75
75
|
loadAppSettings,
|
|
76
76
|
resolveAgentExecutable,
|
|
77
77
|
resolveClaudeExecutable
|
|
78
|
-
} from "./chunk-
|
|
78
|
+
} from "./chunk-A2YXQC65.js";
|
|
79
79
|
import {
|
|
80
80
|
isElectronLikeCommand,
|
|
81
81
|
unwrapStrippedElectronLaunch
|
|
82
82
|
} from "./chunk-4TR3HZFT.js";
|
|
83
83
|
import {
|
|
84
84
|
appDataDir
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-H4UEFJRI.js";
|
|
86
86
|
|
|
87
87
|
// src/agents/brightsy.ts
|
|
88
88
|
import { existsSync } from "fs";
|
|
@@ -512,24 +512,376 @@ var brightsyAdapter = {
|
|
|
512
512
|
};
|
|
513
513
|
|
|
514
514
|
// src/agents/claude.ts
|
|
515
|
-
import { existsSync as
|
|
515
|
+
import { existsSync as existsSync7 } from "fs";
|
|
516
|
+
import { homedir as homedir4 } from "os";
|
|
516
517
|
|
|
517
518
|
// src/agents/orch-mcp-isolation.ts
|
|
518
|
-
import { existsSync as
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
520
|
+
|
|
521
|
+
// src/agents/claude-plugins.ts
|
|
522
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
523
|
+
import { homedir } from "os";
|
|
524
|
+
import { isAbsolute, join, relative, resolve } from "path";
|
|
525
|
+
|
|
526
|
+
// src/mcp-ui/meta.ts
|
|
527
|
+
var HTML_MAX = 15e5;
|
|
528
|
+
function matchClaudeMcpTool(toolName, serverNames) {
|
|
529
|
+
const name = toolName.trim();
|
|
530
|
+
if (!name.startsWith("mcp__")) return null;
|
|
531
|
+
const ranked = [...serverNames].filter((s) => s.trim()).sort((a, b) => b.length - a.length);
|
|
532
|
+
for (const server of ranked) {
|
|
533
|
+
const prefix = `mcp__${server}__`;
|
|
534
|
+
if (!name.startsWith(prefix)) continue;
|
|
535
|
+
const tool = name.slice(prefix.length).trim();
|
|
536
|
+
if (!tool) continue;
|
|
537
|
+
return { server, tool };
|
|
538
|
+
}
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
function parseMcpServerLaunch(entry) {
|
|
542
|
+
const command = typeof entry.command === "string" ? entry.command.trim() : "";
|
|
543
|
+
if (command) {
|
|
544
|
+
const args = Array.isArray(entry.args) ? entry.args.filter((a) => typeof a === "string") : [];
|
|
545
|
+
const env = stringRecord(entry.env);
|
|
546
|
+
const cwd = typeof entry.cwd === "string" && entry.cwd.trim() ? entry.cwd.trim() : void 0;
|
|
547
|
+
return {
|
|
548
|
+
kind: "stdio",
|
|
549
|
+
command,
|
|
550
|
+
args,
|
|
551
|
+
...env ? { env } : {},
|
|
552
|
+
...cwd ? { cwd } : {}
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
const url = typeof entry.url === "string" ? entry.url.trim() : "";
|
|
556
|
+
if (!url) return null;
|
|
557
|
+
let parsed;
|
|
558
|
+
try {
|
|
559
|
+
parsed = new URL(url);
|
|
560
|
+
} catch {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
564
|
+
const type = typeof entry.type === "string" ? entry.type.trim().toLowerCase() : "";
|
|
565
|
+
const headers = stringRecord(entry.headers);
|
|
566
|
+
return {
|
|
567
|
+
kind: type === "sse" ? "sse" : "http",
|
|
568
|
+
url: parsed.toString(),
|
|
569
|
+
...headers ? { headers } : {}
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
function uiResourceUriFromMeta(meta) {
|
|
573
|
+
const rec = asRecord(meta);
|
|
574
|
+
const nested = asRecord(rec.ui);
|
|
575
|
+
const fromNested = typeof nested.resourceUri === "string" ? nested.resourceUri.trim() : "";
|
|
576
|
+
const legacy = typeof rec["ui/resourceUri"] === "string" ? rec["ui/resourceUri"].trim() : "";
|
|
577
|
+
const uri = fromNested || legacy;
|
|
578
|
+
return uri.startsWith("ui://") ? uri : null;
|
|
579
|
+
}
|
|
580
|
+
function cspFromMeta(meta) {
|
|
581
|
+
const ui = asRecord(asRecord(meta).ui);
|
|
582
|
+
const csp = asRecord(ui.csp);
|
|
583
|
+
const connectDomains = originList(csp.connectDomains);
|
|
584
|
+
const resourceDomains = originList(csp.resourceDomains);
|
|
585
|
+
const frameDomains = originList(csp.frameDomains);
|
|
586
|
+
const baseUriDomains = originList(csp.baseUriDomains);
|
|
587
|
+
if (!connectDomains?.length && !resourceDomains?.length && !frameDomains?.length && !baseUriDomains?.length) {
|
|
588
|
+
return void 0;
|
|
589
|
+
}
|
|
590
|
+
return {
|
|
591
|
+
...connectDomains?.length ? { connectDomains } : {},
|
|
592
|
+
...resourceDomains?.length ? { resourceDomains } : {},
|
|
593
|
+
...frameDomains?.length ? { frameDomains } : {},
|
|
594
|
+
...baseUriDomains?.length ? { baseUriDomains } : {}
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function htmlFromResourceContent(content) {
|
|
598
|
+
const uri = content.uri?.trim() ?? "";
|
|
599
|
+
if (!uri.startsWith("ui://")) return null;
|
|
600
|
+
const mimeType = content.mimeType?.trim() || "text/html";
|
|
601
|
+
if (!isHtmlMime(mimeType)) return null;
|
|
602
|
+
const html = htmlText(content.text, content.blob);
|
|
603
|
+
if (!html) return null;
|
|
604
|
+
return { uri, mimeType, html };
|
|
605
|
+
}
|
|
606
|
+
function mcpUiContentSecurityPolicy(csp) {
|
|
607
|
+
const resource = (csp?.resourceDomains ?? []).join(" ");
|
|
608
|
+
const connect = (csp?.connectDomains ?? []).join(" ");
|
|
609
|
+
const frames = csp?.frameDomains?.length ? csp.frameDomains.join(" ") : "'none'";
|
|
610
|
+
const base = csp?.baseUriDomains?.length ? csp.baseUriDomains.join(" ") : "'none'";
|
|
611
|
+
return [
|
|
612
|
+
"default-src 'none'",
|
|
613
|
+
`script-src 'self' 'unsafe-inline' 'unsafe-eval' ${resource}`.trim(),
|
|
614
|
+
`style-src 'self' 'unsafe-inline' ${resource}`.trim(),
|
|
615
|
+
`img-src 'self' data: blob: ${resource}`.trim(),
|
|
616
|
+
`font-src 'self' data: ${resource}`.trim(),
|
|
617
|
+
`connect-src 'self' ${connect}`.trim(),
|
|
618
|
+
`media-src 'self' data: blob: ${resource}`.trim(),
|
|
619
|
+
`frame-src ${frames}`,
|
|
620
|
+
`base-uri ${base}`,
|
|
621
|
+
"object-src 'none'",
|
|
622
|
+
"form-action 'self'"
|
|
623
|
+
].join("; ");
|
|
624
|
+
}
|
|
625
|
+
function htmlText(text, blob) {
|
|
626
|
+
if (typeof text === "string" && text.trim()) {
|
|
627
|
+
return text.length <= HTML_MAX ? text : null;
|
|
628
|
+
}
|
|
629
|
+
if (typeof blob !== "string" || !blob.trim()) return null;
|
|
630
|
+
try {
|
|
631
|
+
const decoded = decodeBase64(blob.trim());
|
|
632
|
+
if (!decoded.trim() || decoded.length > HTML_MAX) return null;
|
|
633
|
+
return decoded;
|
|
634
|
+
} catch {
|
|
635
|
+
return null;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
function decodeBase64(blob) {
|
|
639
|
+
if (typeof Buffer !== "undefined") return Buffer.from(blob, "base64").toString("utf8");
|
|
640
|
+
const bin = atob(blob);
|
|
641
|
+
const bytes = Uint8Array.from(bin, (c) => c.charCodeAt(0));
|
|
642
|
+
return new TextDecoder().decode(bytes);
|
|
643
|
+
}
|
|
644
|
+
function isHtmlMime(mime) {
|
|
645
|
+
const base = mime.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
646
|
+
return base === "text/html";
|
|
647
|
+
}
|
|
648
|
+
function originList(value) {
|
|
649
|
+
if (!Array.isArray(value)) return void 0;
|
|
650
|
+
const out = [];
|
|
651
|
+
for (const item of value) {
|
|
652
|
+
if (typeof item !== "string") continue;
|
|
653
|
+
const origin = originToken(item);
|
|
654
|
+
if (origin && !out.includes(origin)) out.push(origin);
|
|
655
|
+
}
|
|
656
|
+
return out;
|
|
657
|
+
}
|
|
658
|
+
function originToken(value) {
|
|
659
|
+
try {
|
|
660
|
+
const url = new URL(value.trim());
|
|
661
|
+
if (url.protocol !== "https:" && url.protocol !== "http:" && url.protocol !== "wss:" && url.protocol !== "ws:") {
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
return url.origin;
|
|
665
|
+
} catch {
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function stringRecord(value) {
|
|
670
|
+
const rec = asRecord(value);
|
|
671
|
+
const out = {};
|
|
672
|
+
for (const [key, item] of Object.entries(rec)) {
|
|
673
|
+
if (typeof item === "string") out[key] = item;
|
|
674
|
+
}
|
|
675
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
676
|
+
}
|
|
677
|
+
function asRecord(value) {
|
|
678
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
679
|
+
return value;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
// src/agents/claude-plugins.ts
|
|
683
|
+
function claudePluginServerId(pluginName, serverName) {
|
|
684
|
+
return `plugin_${pluginName}_${serverName}`.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
685
|
+
}
|
|
686
|
+
function listEnabledClaudePluginMcpServers(opts) {
|
|
687
|
+
const home = opts?.home ?? homedir();
|
|
688
|
+
const pluginsRoot = claudePluginsRoot(home);
|
|
689
|
+
const enabled = enabledPluginIds(home, opts?.projectDirs ?? []);
|
|
690
|
+
const installed = readInstalledPlugins(join(pluginsRoot, "installed_plugins.json"));
|
|
691
|
+
const out = {};
|
|
692
|
+
for (const [id, on] of enabled) {
|
|
693
|
+
if (!on) continue;
|
|
694
|
+
const root = installPathFor(id, installed);
|
|
695
|
+
if (!root || !existsSync2(root)) continue;
|
|
696
|
+
const pluginName = manifestName(root) || id.split("@")[0]?.trim() || "";
|
|
697
|
+
if (!pluginName) continue;
|
|
698
|
+
const dataDir = join(pluginsRoot, "data", pluginDataId(id));
|
|
699
|
+
for (const [serverName, entry] of Object.entries(loadPluginMcpServers(root))) {
|
|
700
|
+
const expanded = expandPluginEntry(entry, root, dataDir);
|
|
701
|
+
if (!parseMcpServerLaunch(expanded)) continue;
|
|
702
|
+
const key = claudePluginServerId(pluginName, serverName);
|
|
703
|
+
if (!key || key === "plugin__") continue;
|
|
704
|
+
out[key] = expanded;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return out;
|
|
708
|
+
}
|
|
709
|
+
function claudePluginsRoot(home) {
|
|
710
|
+
const override = process.env.CLAUDE_CODE_PLUGIN_CACHE_DIR?.trim();
|
|
711
|
+
if (override && isAbsolute(override)) return override;
|
|
712
|
+
return join(home, ".claude", "plugins");
|
|
713
|
+
}
|
|
714
|
+
function pluginDataId(pluginId) {
|
|
715
|
+
return pluginId.replace(/[^A-Za-z0-9_-]/g, "-");
|
|
716
|
+
}
|
|
717
|
+
function enabledPluginIds(home, projectDirs) {
|
|
718
|
+
const enabled = /* @__PURE__ */ new Map();
|
|
719
|
+
applyEnabled(enabled, readEnabledPlugins(join(home, ".claude", "settings.json")));
|
|
720
|
+
const dirs = [...new Set(projectDirs.map((dir) => dir.trim()).filter(Boolean))];
|
|
721
|
+
for (const dir of dirs) {
|
|
722
|
+
applyEnabled(enabled, readEnabledPlugins(join(dir, ".claude", "settings.json")));
|
|
723
|
+
}
|
|
724
|
+
for (const dir of dirs) {
|
|
725
|
+
applyEnabled(enabled, readEnabledPlugins(join(dir, ".claude", "settings.local.json")));
|
|
726
|
+
}
|
|
727
|
+
return enabled;
|
|
728
|
+
}
|
|
729
|
+
function applyEnabled(into, next) {
|
|
730
|
+
for (const [id, on] of Object.entries(next)) {
|
|
731
|
+
const key = id.trim();
|
|
732
|
+
if (!key) continue;
|
|
733
|
+
into.set(key, on);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
function readEnabledPlugins(path) {
|
|
737
|
+
const root = readJson(path);
|
|
738
|
+
const raw = root.enabledPlugins;
|
|
739
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
|
|
740
|
+
const out = {};
|
|
741
|
+
for (const [id, value] of Object.entries(raw)) {
|
|
742
|
+
if (value === true || value === false) out[id] = value;
|
|
743
|
+
}
|
|
744
|
+
return out;
|
|
745
|
+
}
|
|
746
|
+
function readInstalledPlugins(path) {
|
|
747
|
+
const root = readJson(path);
|
|
748
|
+
const plugins = root.plugins;
|
|
749
|
+
if (!plugins || typeof plugins !== "object" || Array.isArray(plugins)) return {};
|
|
750
|
+
const out = {};
|
|
751
|
+
for (const [id, value] of Object.entries(plugins)) {
|
|
752
|
+
const rows = Array.isArray(value) ? value : [value];
|
|
753
|
+
const installs = [];
|
|
754
|
+
for (const row of rows) {
|
|
755
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) continue;
|
|
756
|
+
const installPath = row.installPath;
|
|
757
|
+
installs.push({
|
|
758
|
+
...typeof installPath === "string" && installPath.trim() ? { installPath: installPath.trim() } : {}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
if (installs.length) out[id] = installs;
|
|
762
|
+
}
|
|
763
|
+
return out;
|
|
764
|
+
}
|
|
765
|
+
function installPathFor(id, installed) {
|
|
766
|
+
const rows = installed[id] ?? [];
|
|
767
|
+
for (let i = rows.length - 1; i >= 0; i--) {
|
|
768
|
+
const path = rows[i]?.installPath;
|
|
769
|
+
if (path && existsSync2(path)) return path;
|
|
770
|
+
}
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
function manifestName(root) {
|
|
774
|
+
const manifest = readJson(join(root, ".claude-plugin", "plugin.json"));
|
|
775
|
+
return typeof manifest.name === "string" ? manifest.name.trim() : "";
|
|
776
|
+
}
|
|
777
|
+
function loadPluginMcpServers(root) {
|
|
778
|
+
const servers = {};
|
|
779
|
+
mergeServerMap(servers, serversFromFile(join(root, ".mcp.json"), root));
|
|
780
|
+
const manifest = readJson(join(root, ".claude-plugin", "plugin.json"));
|
|
781
|
+
mergeServerMap(servers, serversFromManifest(manifest.mcpServers, root));
|
|
782
|
+
return servers;
|
|
783
|
+
}
|
|
784
|
+
function serversFromManifest(value, root) {
|
|
785
|
+
if (!value) return {};
|
|
786
|
+
if (typeof value === "string") return serversFromFile(resolveInside(root, value), root);
|
|
787
|
+
if (Array.isArray(value)) {
|
|
788
|
+
const out = {};
|
|
789
|
+
for (const item of value) {
|
|
790
|
+
if (typeof item === "string") mergeServerMap(out, serversFromFile(resolveInside(root, item), root));
|
|
791
|
+
else mergeServerMap(out, serverMap(item, root));
|
|
792
|
+
}
|
|
793
|
+
return out;
|
|
794
|
+
}
|
|
795
|
+
return serverMap(value, root);
|
|
796
|
+
}
|
|
797
|
+
function serversFromFile(path, root) {
|
|
798
|
+
if (!path || !existsSync2(path)) return {};
|
|
799
|
+
return serverMap(readJson(path), root);
|
|
800
|
+
}
|
|
801
|
+
function serverMap(value, root) {
|
|
802
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
803
|
+
const record = value;
|
|
804
|
+
const wrapped = record.mcpServers;
|
|
805
|
+
const source = wrapped && typeof wrapped === "object" && !Array.isArray(wrapped) ? wrapped : record;
|
|
806
|
+
if (typeof wrapped === "string") return serversFromFile(resolveInside(root, wrapped), root);
|
|
807
|
+
const out = {};
|
|
808
|
+
for (const [name, entry] of Object.entries(source)) {
|
|
809
|
+
if (!name.trim() || !entry || typeof entry !== "object" || Array.isArray(entry)) continue;
|
|
810
|
+
const row = entry;
|
|
811
|
+
if (row.disabled === true) continue;
|
|
812
|
+
if (typeof row.command !== "string" && typeof row.url !== "string") continue;
|
|
813
|
+
out[name.trim()] = row;
|
|
814
|
+
}
|
|
815
|
+
return out;
|
|
816
|
+
}
|
|
817
|
+
function mergeServerMap(into, extra) {
|
|
818
|
+
for (const [name, entry] of Object.entries(extra)) into[name] = entry;
|
|
819
|
+
}
|
|
820
|
+
function expandPluginEntry(entry, root, dataDir) {
|
|
821
|
+
const next = { ...entry };
|
|
822
|
+
if (typeof next.command === "string") next.command = expandVars(next.command, root, dataDir);
|
|
823
|
+
if (Array.isArray(next.args)) {
|
|
824
|
+
next.args = next.args.map((arg) => typeof arg === "string" ? expandVars(arg, root, dataDir) : arg);
|
|
825
|
+
}
|
|
826
|
+
if (typeof next.url === "string") next.url = expandVars(next.url, root, dataDir);
|
|
827
|
+
if (next.env && typeof next.env === "object" && !Array.isArray(next.env)) {
|
|
828
|
+
const env = {};
|
|
829
|
+
for (const [key, value] of Object.entries(next.env)) {
|
|
830
|
+
if (typeof value === "string") env[key] = expandVars(value, root, dataDir);
|
|
831
|
+
}
|
|
832
|
+
env.CLAUDE_PLUGIN_ROOT = env.CLAUDE_PLUGIN_ROOT || root;
|
|
833
|
+
env.CLAUDE_PLUGIN_DATA = env.CLAUDE_PLUGIN_DATA || dataDir;
|
|
834
|
+
next.env = env;
|
|
835
|
+
} else if (typeof next.command === "string") {
|
|
836
|
+
next.env = { CLAUDE_PLUGIN_ROOT: root, CLAUDE_PLUGIN_DATA: dataDir };
|
|
837
|
+
}
|
|
838
|
+
if (next.headers && typeof next.headers === "object" && !Array.isArray(next.headers)) {
|
|
839
|
+
const headers = {};
|
|
840
|
+
for (const [key, value] of Object.entries(next.headers)) {
|
|
841
|
+
if (typeof value === "string") headers[key] = expandVars(value, root, dataDir);
|
|
842
|
+
}
|
|
843
|
+
next.headers = headers;
|
|
844
|
+
}
|
|
845
|
+
return next;
|
|
846
|
+
}
|
|
847
|
+
function expandVars(value, root, dataDir) {
|
|
848
|
+
return value.replaceAll("${CLAUDE_PLUGIN_ROOT}", root).replaceAll("${CLAUDE_PLUGIN_DATA}", dataDir);
|
|
849
|
+
}
|
|
850
|
+
function resolveInside(root, spec) {
|
|
851
|
+
const trimmed = spec.trim();
|
|
852
|
+
if (!trimmed || trimmed.endsWith(".mcpb") || trimmed.endsWith(".dxt")) return null;
|
|
853
|
+
if (/^https?:\/\//i.test(trimmed)) return null;
|
|
854
|
+
const abs = resolve(root, trimmed);
|
|
855
|
+
const rel = relative(root, abs);
|
|
856
|
+
if (!rel || rel.startsWith("..") || isAbsolute(rel)) return null;
|
|
857
|
+
return abs;
|
|
858
|
+
}
|
|
859
|
+
function readJson(path) {
|
|
860
|
+
if (!existsSync2(path)) return {};
|
|
861
|
+
try {
|
|
862
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
863
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
864
|
+
return parsed;
|
|
865
|
+
} catch {
|
|
866
|
+
return {};
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/agents/orch-mcp-isolation.ts
|
|
871
|
+
import { homedir as homedir3 } from "os";
|
|
872
|
+
import { join as join4 } from "path";
|
|
521
873
|
import { parse as parseToml } from "smol-toml";
|
|
522
874
|
|
|
523
875
|
// src/agents/user-mcp-config.ts
|
|
524
|
-
import { existsSync as
|
|
525
|
-
import { homedir } from "os";
|
|
526
|
-
import { dirname as dirname2, join as
|
|
876
|
+
import { existsSync as existsSync4, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
877
|
+
import { homedir as homedir2 } from "os";
|
|
878
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
527
879
|
|
|
528
880
|
// src/agents/injected-mcp.ts
|
|
529
|
-
import { existsSync as
|
|
881
|
+
import { existsSync as existsSync3, mkdtempSync, writeFileSync } from "fs";
|
|
530
882
|
import { createRequire } from "module";
|
|
531
883
|
import { tmpdir } from "os";
|
|
532
|
-
import { dirname, join } from "path";
|
|
884
|
+
import { dirname, join as join2 } from "path";
|
|
533
885
|
import { fileURLToPath } from "url";
|
|
534
886
|
|
|
535
887
|
// src/mcp/profile.ts
|
|
@@ -763,7 +1115,7 @@ function corePackageDir() {
|
|
|
763
1115
|
} catch {
|
|
764
1116
|
}
|
|
765
1117
|
try {
|
|
766
|
-
const req = createRequire(
|
|
1118
|
+
const req = createRequire(join2(process.cwd(), "package.json"));
|
|
767
1119
|
return dirname(req.resolve("@sideboard-ai/core"));
|
|
768
1120
|
} catch {
|
|
769
1121
|
return process.cwd();
|
|
@@ -771,22 +1123,22 @@ function corePackageDir() {
|
|
|
771
1123
|
}
|
|
772
1124
|
function findSideboardMcpJsEntry() {
|
|
773
1125
|
const override = process.env.SIDEBOARD_MCP_ENTRY?.trim() || process.env.SIDEBOARD_CLI?.trim();
|
|
774
|
-
if (override &&
|
|
1126
|
+
if (override && existsSync3(override)) return override;
|
|
775
1127
|
const packaged = packagedMcpStdioPath();
|
|
776
1128
|
if (packaged) return packaged;
|
|
777
1129
|
let dir = corePackageDir();
|
|
778
1130
|
for (let i = 0; i < 10; i++) {
|
|
779
1131
|
const candidates = [
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
1132
|
+
join2(dir, "mcp/run-stdio.js"),
|
|
1133
|
+
join2(dir, "mcp/run-stdio.cjs"),
|
|
1134
|
+
join2(dir, "dist/mcp/run-stdio.js"),
|
|
1135
|
+
join2(dir, "dist/mcp/run-stdio.cjs"),
|
|
1136
|
+
join2(dir, "packages/core/dist/mcp/run-stdio.js"),
|
|
1137
|
+
join2(dir, "packages/cli/dist/index.js"),
|
|
1138
|
+
join2(dir, "cli/dist/index.js")
|
|
787
1139
|
];
|
|
788
1140
|
for (const p of candidates) {
|
|
789
|
-
if (
|
|
1141
|
+
if (existsSync3(p) && !isAsarPath(p)) return p;
|
|
790
1142
|
}
|
|
791
1143
|
const parent = dirname(dir);
|
|
792
1144
|
if (parent === dir) break;
|
|
@@ -949,8 +1301,8 @@ function mcpServersRecord(servers, extraServers) {
|
|
|
949
1301
|
function writeMcpServersConfig(servers, extraServers) {
|
|
950
1302
|
const mcpServers = mcpServersRecord(servers, extraServers);
|
|
951
1303
|
if (Object.keys(mcpServers).length === 0) return null;
|
|
952
|
-
const dir = mkdtempSync(
|
|
953
|
-
const cfgPath =
|
|
1304
|
+
const dir = mkdtempSync(join2(tmpdir(), "sideboard-mcp-"));
|
|
1305
|
+
const cfgPath = join2(dir, "mcp.json");
|
|
954
1306
|
writeFileSync(cfgPath, JSON.stringify({ mcpServers }, null, 2));
|
|
955
1307
|
return cfgPath;
|
|
956
1308
|
}
|
|
@@ -960,10 +1312,10 @@ async function writeInjectedMcpConfig(opts) {
|
|
|
960
1312
|
|
|
961
1313
|
// src/agents/user-mcp-config.ts
|
|
962
1314
|
function userCursorMcpConfigPath() {
|
|
963
|
-
return
|
|
1315
|
+
return join3(homedir2(), ".cursor", "mcp.json");
|
|
964
1316
|
}
|
|
965
1317
|
function userClaudeMcpConfigPath() {
|
|
966
|
-
return
|
|
1318
|
+
return join3(homedir2(), ".claude.json");
|
|
967
1319
|
}
|
|
968
1320
|
function asObject(value) {
|
|
969
1321
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
@@ -990,9 +1342,9 @@ function mergeSideboardIntoMcpServersJson(existing, sideboard) {
|
|
|
990
1342
|
}
|
|
991
1343
|
function writeMergedMcpServersJson(configPath, sideboard) {
|
|
992
1344
|
let existing = {};
|
|
993
|
-
if (
|
|
1345
|
+
if (existsSync4(configPath)) {
|
|
994
1346
|
try {
|
|
995
|
-
existing = JSON.parse(
|
|
1347
|
+
existing = JSON.parse(readFileSync2(configPath, "utf8"));
|
|
996
1348
|
} catch {
|
|
997
1349
|
existing = {};
|
|
998
1350
|
}
|
|
@@ -1017,7 +1369,7 @@ async function registerPackagedUserMcpClients() {
|
|
|
1017
1369
|
const cursor = userCursorMcpConfigPath();
|
|
1018
1370
|
writeMergedMcpServersJson(cursor, launch);
|
|
1019
1371
|
const claude = userClaudeMcpConfigPath();
|
|
1020
|
-
if (
|
|
1372
|
+
if (existsSync4(claude)) {
|
|
1021
1373
|
writeMergedMcpServersJson(claude, launch);
|
|
1022
1374
|
return { cursor, claude };
|
|
1023
1375
|
}
|
|
@@ -1046,25 +1398,25 @@ function listMcpNamesFromCodexToml(text) {
|
|
|
1046
1398
|
}
|
|
1047
1399
|
function readJsonObject(path) {
|
|
1048
1400
|
try {
|
|
1049
|
-
return JSON.parse(
|
|
1401
|
+
return JSON.parse(readFileSync3(path, "utf8"));
|
|
1050
1402
|
} catch {
|
|
1051
1403
|
return {};
|
|
1052
1404
|
}
|
|
1053
1405
|
}
|
|
1054
1406
|
function readText(path) {
|
|
1055
1407
|
try {
|
|
1056
|
-
return
|
|
1408
|
+
return readFileSync3(path, "utf8");
|
|
1057
1409
|
} catch {
|
|
1058
1410
|
return "";
|
|
1059
1411
|
}
|
|
1060
1412
|
}
|
|
1061
|
-
function userCodexConfigPaths(home =
|
|
1062
|
-
return [
|
|
1413
|
+
function userCodexConfigPaths(home = homedir3()) {
|
|
1414
|
+
return [join4(home, ".codex", "config.toml"), join4(home, ".config", "codex", "config.toml")];
|
|
1063
1415
|
}
|
|
1064
|
-
function userOpencodeConfigPaths(home =
|
|
1416
|
+
function userOpencodeConfigPaths(home = homedir3()) {
|
|
1065
1417
|
return [
|
|
1066
|
-
|
|
1067
|
-
|
|
1418
|
+
join4(home, ".config", "opencode", "opencode.json"),
|
|
1419
|
+
join4(home, ".config", "opencode", "opencode.jsonc")
|
|
1068
1420
|
];
|
|
1069
1421
|
}
|
|
1070
1422
|
function userMcpNamesToDisable(opts) {
|
|
@@ -1083,29 +1435,35 @@ function userMcpNamesToDisable(opts) {
|
|
|
1083
1435
|
}
|
|
1084
1436
|
return out;
|
|
1085
1437
|
}
|
|
1086
|
-
function listUserCodexMcpNames(home =
|
|
1438
|
+
function listUserCodexMcpNames(home = homedir3()) {
|
|
1087
1439
|
const names = [];
|
|
1088
1440
|
for (const path of userCodexConfigPaths(home)) {
|
|
1089
|
-
if (!
|
|
1441
|
+
if (!existsSync5(path)) continue;
|
|
1090
1442
|
names.push(...listMcpNamesFromCodexToml(readText(path)));
|
|
1091
1443
|
}
|
|
1092
1444
|
return names;
|
|
1093
1445
|
}
|
|
1094
|
-
function listUserOpencodeMcpNames(home =
|
|
1446
|
+
function listUserOpencodeMcpNames(home = homedir3()) {
|
|
1095
1447
|
const names = [];
|
|
1096
1448
|
for (const path of userOpencodeConfigPaths(home)) {
|
|
1097
|
-
if (!
|
|
1449
|
+
if (!existsSync5(path)) continue;
|
|
1098
1450
|
names.push(...listMcpNamesFromJsonMap(readJsonObject(path), "mcp"));
|
|
1099
1451
|
}
|
|
1100
1452
|
return names;
|
|
1101
1453
|
}
|
|
1102
|
-
function userClaudeMcpConfigObject(home =
|
|
1103
|
-
const claudePath = home ===
|
|
1104
|
-
if (!
|
|
1454
|
+
function userClaudeMcpConfigObject(home = homedir3()) {
|
|
1455
|
+
const claudePath = home === homedir3() ? userClaudeMcpConfigPath() : join4(home, ".claude.json");
|
|
1456
|
+
if (!existsSync5(claudePath)) return {};
|
|
1105
1457
|
return asObject2(asObject2(readJsonObject(claudePath)).mcpServers);
|
|
1106
1458
|
}
|
|
1107
|
-
function listUserClaudeMcpServerEntries(home =
|
|
1459
|
+
function listUserClaudeMcpServerEntries(home = homedir3(), projectDirs) {
|
|
1108
1460
|
const out = {};
|
|
1461
|
+
for (const [name, entry] of Object.entries(
|
|
1462
|
+
listEnabledClaudePluginMcpServers({ home, projectDirs })
|
|
1463
|
+
)) {
|
|
1464
|
+
if (!name || isInjectedOrchMcpName(name)) continue;
|
|
1465
|
+
out[name] = entry;
|
|
1466
|
+
}
|
|
1109
1467
|
for (const [rawName, value] of Object.entries(userClaudeMcpConfigObject(home))) {
|
|
1110
1468
|
const name = rawName.trim();
|
|
1111
1469
|
if (!name || isInjectedOrchMcpName(name)) continue;
|
|
@@ -1194,9 +1552,9 @@ function agentRpcChildEnv(rpc, cwd) {
|
|
|
1194
1552
|
}
|
|
1195
1553
|
|
|
1196
1554
|
// src/agents/claude-host.ts
|
|
1197
|
-
import { existsSync as
|
|
1555
|
+
import { existsSync as existsSync6 } from "fs";
|
|
1198
1556
|
import { createRequire as createRequire2 } from "module";
|
|
1199
|
-
import { dirname as dirname3, join as
|
|
1557
|
+
import { dirname as dirname3, join as join5 } from "path";
|
|
1200
1558
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1201
1559
|
function claudePilotSdkAllowedTools() {
|
|
1202
1560
|
return PILOT_TOOL_NAMES.map(
|
|
@@ -1224,20 +1582,20 @@ function entryDir() {
|
|
|
1224
1582
|
function claudeRunnerPath() {
|
|
1225
1583
|
const packagedDir = packagedCursorRuntimeDir();
|
|
1226
1584
|
if (packagedDir) {
|
|
1227
|
-
const packaged =
|
|
1228
|
-
if (
|
|
1585
|
+
const packaged = join5(packagedDir, "core-dist", "agents", "claude-runner.js");
|
|
1586
|
+
if (existsSync6(packaged)) return packaged;
|
|
1229
1587
|
}
|
|
1230
1588
|
const root = entryDir();
|
|
1231
1589
|
const candidates = [
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1590
|
+
join5(root, "agents", "claude-runner.js"),
|
|
1591
|
+
join5(root, "agents", "claude-runner.cjs"),
|
|
1592
|
+
join5(root, "dist", "agents", "claude-runner.js"),
|
|
1593
|
+
join5(root, "dist", "agents", "claude-runner.cjs"),
|
|
1594
|
+
join5(root, "claude-runner.ts"),
|
|
1595
|
+
join5(root, "src", "agents", "claude-runner.ts")
|
|
1238
1596
|
];
|
|
1239
1597
|
for (const candidate of candidates) {
|
|
1240
|
-
if (
|
|
1598
|
+
if (existsSync6(candidate)) return candidate;
|
|
1241
1599
|
}
|
|
1242
1600
|
return candidates[0];
|
|
1243
1601
|
}
|
|
@@ -1642,7 +2000,7 @@ var claudeAdapter = {
|
|
|
1642
2000
|
async detect() {
|
|
1643
2001
|
const claude = resolveClaudeExecutable();
|
|
1644
2002
|
if (claude !== "claude") {
|
|
1645
|
-
if (!
|
|
2003
|
+
if (!existsSync7(claude)) {
|
|
1646
2004
|
return {
|
|
1647
2005
|
agent: "claude",
|
|
1648
2006
|
installed: false,
|
|
@@ -1691,7 +2049,7 @@ var claudeAdapter = {
|
|
|
1691
2049
|
);
|
|
1692
2050
|
}
|
|
1693
2051
|
const mode = permissionMode(thread);
|
|
1694
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
2052
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-BZAVBOH3.js");
|
|
1695
2053
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
1696
2054
|
const rpc = worktreeAgentRpc(isOrchestrator);
|
|
1697
2055
|
const injectedServers = await buildInjectedMcpServers({
|
|
@@ -1705,7 +2063,7 @@ var claudeAdapter = {
|
|
|
1705
2063
|
});
|
|
1706
2064
|
const injectedBrightsyNames = injectedServers.filter((s) => s.name === "brightsy" || s.name.startsWith("brightsy_")).map((s) => s.name);
|
|
1707
2065
|
const chromeOn = claudeChromeEnabled();
|
|
1708
|
-
const userMcpEntries = isOrchestrator ? {} : listUserClaudeMcpServerEntries();
|
|
2066
|
+
const userMcpEntries = isOrchestrator ? {} : listUserClaudeMcpServerEntries(homedir4(), [thread.repoPath, thread.worktreePath]);
|
|
1709
2067
|
let allowedTools;
|
|
1710
2068
|
if (isOrchestrator) {
|
|
1711
2069
|
allowedTools = [
|
|
@@ -1956,9 +2314,9 @@ function parseIssuesJson(raw) {
|
|
|
1956
2314
|
}
|
|
1957
2315
|
|
|
1958
2316
|
// src/agents/codex.ts
|
|
1959
|
-
import { existsSync as
|
|
1960
|
-
import { homedir as
|
|
1961
|
-
import { join as
|
|
2317
|
+
import { existsSync as existsSync8, readFileSync as readFileSync4, statSync } from "fs";
|
|
2318
|
+
import { homedir as homedir5 } from "os";
|
|
2319
|
+
import { join as join6 } from "path";
|
|
1962
2320
|
var CODEX_PROMPT_ARG_MAX = 2e5;
|
|
1963
2321
|
var FALLBACK_CODEX_MODELS = [
|
|
1964
2322
|
{ id: "gpt-5.6-sol", displayName: "GPT-5.6 Sol" },
|
|
@@ -1978,7 +2336,7 @@ async function listCodexModels() {
|
|
|
1978
2336
|
if (codex === "codex") {
|
|
1979
2337
|
const which = await run("which", ["codex"], { reject: false });
|
|
1980
2338
|
if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
|
|
1981
|
-
} else if (!
|
|
2339
|
+
} else if (!existsSync8(codex)) {
|
|
1982
2340
|
return FALLBACK_CODEX_MODELS;
|
|
1983
2341
|
}
|
|
1984
2342
|
const listed = await run(codex, ["debug", "models"], { reject: false });
|
|
@@ -2013,12 +2371,12 @@ function usageFromCodex(usage) {
|
|
|
2013
2371
|
}
|
|
2014
2372
|
function codexConfigHasNetworkAccess() {
|
|
2015
2373
|
const candidates = [
|
|
2016
|
-
|
|
2017
|
-
|
|
2374
|
+
join6(homedir5(), ".codex", "config.toml"),
|
|
2375
|
+
join6(homedir5(), ".config", "codex", "config.toml")
|
|
2018
2376
|
];
|
|
2019
2377
|
for (const path of candidates) {
|
|
2020
|
-
if (!
|
|
2021
|
-
const text =
|
|
2378
|
+
if (!existsSync8(path)) continue;
|
|
2379
|
+
const text = readFileSync4(path, "utf8");
|
|
2022
2380
|
if (/network_access\s*=\s*true/.test(text)) return true;
|
|
2023
2381
|
}
|
|
2024
2382
|
return false;
|
|
@@ -2043,15 +2401,15 @@ function unwrapCodexMcpResult(result) {
|
|
|
2043
2401
|
return String(result);
|
|
2044
2402
|
}
|
|
2045
2403
|
}
|
|
2046
|
-
function
|
|
2404
|
+
function asRecord2(value) {
|
|
2047
2405
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2048
2406
|
return value;
|
|
2049
2407
|
}
|
|
2050
2408
|
return void 0;
|
|
2051
2409
|
}
|
|
2052
2410
|
function codexLooksAuthenticated() {
|
|
2053
|
-
const authPath =
|
|
2054
|
-
if (!
|
|
2411
|
+
const authPath = join6(homedir5(), ".codex", "auth.json");
|
|
2412
|
+
if (!existsSync8(authPath)) return false;
|
|
2055
2413
|
try {
|
|
2056
2414
|
return statSync(authPath).size > 2;
|
|
2057
2415
|
} catch {
|
|
@@ -2063,7 +2421,7 @@ var codexAdapter = {
|
|
|
2063
2421
|
async detect() {
|
|
2064
2422
|
const codex = resolveAgentExecutable("codex");
|
|
2065
2423
|
if (codex !== "codex") {
|
|
2066
|
-
if (!
|
|
2424
|
+
if (!existsSync8(codex)) {
|
|
2067
2425
|
return {
|
|
2068
2426
|
agent: "codex",
|
|
2069
2427
|
installed: false,
|
|
@@ -2196,7 +2554,7 @@ var codexAdapter = {
|
|
|
2196
2554
|
}
|
|
2197
2555
|
if (itemType === "mcp_tool_call" && item.id && item.server && item.tool) {
|
|
2198
2556
|
const name = `mcp__${item.server}__${item.tool}`;
|
|
2199
|
-
const input =
|
|
2557
|
+
const input = asRecord2(item.arguments);
|
|
2200
2558
|
const events = [
|
|
2201
2559
|
{ type: "tool_use", id: item.id, name, input }
|
|
2202
2560
|
];
|
|
@@ -2337,9 +2695,9 @@ var codexAdapter = {
|
|
|
2337
2695
|
};
|
|
2338
2696
|
|
|
2339
2697
|
// src/agents/cursor.ts
|
|
2340
|
-
import { existsSync as
|
|
2698
|
+
import { existsSync as existsSync9 } from "fs";
|
|
2341
2699
|
import { createRequire as createRequire3 } from "module";
|
|
2342
|
-
import { dirname as dirname4, join as
|
|
2700
|
+
import { dirname as dirname4, join as join7 } from "path";
|
|
2343
2701
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
2344
2702
|
var FALLBACK_CURSOR_MODELS = [
|
|
2345
2703
|
{ id: "default", displayName: "Auto" },
|
|
@@ -2406,17 +2764,17 @@ function cursorRunnerPath() {
|
|
|
2406
2764
|
if (packaged) return packaged;
|
|
2407
2765
|
const root = entryDir2();
|
|
2408
2766
|
const candidates = [
|
|
2409
|
-
|
|
2410
|
-
|
|
2767
|
+
join7(root, "agents", "cursor-runner.js"),
|
|
2768
|
+
join7(root, "agents", "cursor-runner.cjs"),
|
|
2411
2769
|
// If somehow resolved from package root instead of dist/
|
|
2412
|
-
|
|
2413
|
-
|
|
2770
|
+
join7(root, "dist", "agents", "cursor-runner.js"),
|
|
2771
|
+
join7(root, "dist", "agents", "cursor-runner.cjs"),
|
|
2414
2772
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
2415
|
-
|
|
2416
|
-
|
|
2773
|
+
join7(root, "cursor-runner.ts"),
|
|
2774
|
+
join7(root, "src", "agents", "cursor-runner.ts")
|
|
2417
2775
|
];
|
|
2418
2776
|
for (const candidate of candidates) {
|
|
2419
|
-
if (
|
|
2777
|
+
if (existsSync9(candidate)) return candidate;
|
|
2420
2778
|
}
|
|
2421
2779
|
return candidates[0];
|
|
2422
2780
|
}
|
|
@@ -2519,11 +2877,11 @@ var cursorAdapter = {
|
|
|
2519
2877
|
};
|
|
2520
2878
|
|
|
2521
2879
|
// src/agents/opencode.ts
|
|
2522
|
-
import { existsSync as
|
|
2880
|
+
import { existsSync as existsSync10 } from "fs";
|
|
2523
2881
|
|
|
2524
2882
|
// src/agent-rpc/opencode-hook.ts
|
|
2525
2883
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
2526
|
-
import { join as
|
|
2884
|
+
import { join as join8 } from "path";
|
|
2527
2885
|
var OPENCODE_PLUGIN_SOURCE = `import { tool } from "@opencode-ai/plugin"
|
|
2528
2886
|
|
|
2529
2887
|
const URL = process.env[${JSON.stringify(AGENT_RPC_URL_ENV)}] || ""
|
|
@@ -2628,10 +2986,10 @@ export const SideboardRpc = async (ctx) => {
|
|
|
2628
2986
|
}
|
|
2629
2987
|
`;
|
|
2630
2988
|
function writeOpencodeRpcPlugin() {
|
|
2631
|
-
const configDir =
|
|
2632
|
-
const pluginDir =
|
|
2989
|
+
const configDir = join8(appDataDir(), "agent-rpc", "opencode");
|
|
2990
|
+
const pluginDir = join8(configDir, "plugins");
|
|
2633
2991
|
mkdirSync2(pluginDir, { recursive: true });
|
|
2634
|
-
const pluginFile =
|
|
2992
|
+
const pluginFile = join8(pluginDir, "sideboard-rpc.js");
|
|
2635
2993
|
writeFileSync3(pluginFile, OPENCODE_PLUGIN_SOURCE);
|
|
2636
2994
|
return { configDir, pluginFile };
|
|
2637
2995
|
}
|
|
@@ -2681,7 +3039,7 @@ var FALLBACK_OPENCODE_MODELS = [
|
|
|
2681
3039
|
];
|
|
2682
3040
|
var cachedOpencodeModels = null;
|
|
2683
3041
|
var OPENCODE_MODEL_CACHE_MS = 5 * 60 * 1e3;
|
|
2684
|
-
function
|
|
3042
|
+
function asRecord3(value) {
|
|
2685
3043
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2686
3044
|
return value;
|
|
2687
3045
|
}
|
|
@@ -2726,7 +3084,7 @@ async function listOpencodeModels() {
|
|
|
2726
3084
|
if (opencode === "opencode") {
|
|
2727
3085
|
const which = await run("which", ["opencode"], { reject: false });
|
|
2728
3086
|
if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
|
|
2729
|
-
} else if (!
|
|
3087
|
+
} else if (!existsSync10(opencode)) {
|
|
2730
3088
|
return FALLBACK_OPENCODE_MODELS;
|
|
2731
3089
|
}
|
|
2732
3090
|
const listed = await run(opencode, ["models"], { reject: false });
|
|
@@ -2761,7 +3119,7 @@ var opencodeAdapter = {
|
|
|
2761
3119
|
async detect() {
|
|
2762
3120
|
const opencode = resolveAgentExecutable("opencode");
|
|
2763
3121
|
if (opencode !== "opencode") {
|
|
2764
|
-
if (!
|
|
3122
|
+
if (!existsSync10(opencode)) {
|
|
2765
3123
|
return {
|
|
2766
3124
|
agent: "opencode",
|
|
2767
3125
|
installed: false,
|
|
@@ -2852,7 +3210,7 @@ var opencodeAdapter = {
|
|
|
2852
3210
|
const name = part?.tool ?? part?.name ?? obj.tool ?? obj.name ?? "tool";
|
|
2853
3211
|
const state = part?.state;
|
|
2854
3212
|
const input = (state?.input && typeof state.input === "object" ? state.input : void 0) ?? part?.input ?? obj.input;
|
|
2855
|
-
const metadata =
|
|
3213
|
+
const metadata = asRecord3(state?.metadata);
|
|
2856
3214
|
const id = opencodeToolId(
|
|
2857
3215
|
name,
|
|
2858
3216
|
part?.callID ?? part?.id ?? obj.id,
|
|
@@ -2887,7 +3245,7 @@ var opencodeAdapter = {
|
|
|
2887
3245
|
}
|
|
2888
3246
|
if (obj.type === "subtask_event") {
|
|
2889
3247
|
const parentId = str(obj.childSessionID) ?? str(obj.childSessionId);
|
|
2890
|
-
const part =
|
|
3248
|
+
const part = asRecord3(obj.part);
|
|
2891
3249
|
if (!parentId || !part) return null;
|
|
2892
3250
|
if (part.type === "text" && str(part.text)) {
|
|
2893
3251
|
return withTaskParent(
|
|
@@ -2898,8 +3256,8 @@ var opencodeAdapter = {
|
|
|
2898
3256
|
if (part.type === "tool" || str(part.tool)) {
|
|
2899
3257
|
const name = str(part.tool) ?? str(part.name) ?? "tool";
|
|
2900
3258
|
const id = str(part.callID) ?? str(part.id) ?? `${parentId}-${name}`;
|
|
2901
|
-
const state =
|
|
2902
|
-
const input =
|
|
3259
|
+
const state = asRecord3(part.state);
|
|
3260
|
+
const input = asRecord3(state?.input) ?? asRecord3(part.input);
|
|
2903
3261
|
const nested = [
|
|
2904
3262
|
withEventParentId({ type: "tool_use", id, name, input }, parentId)
|
|
2905
3263
|
];
|
|
@@ -3141,12 +3499,12 @@ function parseSessionQuotaResetAt(text, now = /* @__PURE__ */ new Date()) {
|
|
|
3141
3499
|
}
|
|
3142
3500
|
return at;
|
|
3143
3501
|
}
|
|
3144
|
-
const
|
|
3502
|
+
const relative2 = text.match(
|
|
3145
3503
|
/resets\s+in\s+(\d+)\s*(minutes?|hours?|days?)/i
|
|
3146
3504
|
);
|
|
3147
|
-
if (
|
|
3148
|
-
const n = Number(
|
|
3149
|
-
const unit =
|
|
3505
|
+
if (relative2) {
|
|
3506
|
+
const n = Number(relative2[1]);
|
|
3507
|
+
const unit = relative2[2].toLowerCase();
|
|
3150
3508
|
const ms = unit.startsWith("day") ? n * 24 * 60 * 60 * 1e3 : unit.startsWith("hour") ? n * 60 * 60 * 1e3 : n * 60 * 1e3;
|
|
3151
3509
|
return new Date(now.getTime() + ms);
|
|
3152
3510
|
}
|
|
@@ -3426,9 +3784,9 @@ function formatClaudeUsageOverLimitWait(windows, now = /* @__PURE__ */ new Date(
|
|
|
3426
3784
|
}
|
|
3427
3785
|
|
|
3428
3786
|
// src/agents/claude-usage-client.ts
|
|
3429
|
-
import { existsSync as
|
|
3430
|
-
import { homedir as
|
|
3431
|
-
import { join as
|
|
3787
|
+
import { existsSync as existsSync11, readFileSync as readFileSync5 } from "fs";
|
|
3788
|
+
import { homedir as homedir6 } from "os";
|
|
3789
|
+
import { join as join9 } from "path";
|
|
3432
3790
|
var CLAUDE_OAUTH_USAGE_URL = "https://api.anthropic.com/api/oauth/usage";
|
|
3433
3791
|
var CLAUDE_USAGE_TTL_MS = 9e4;
|
|
3434
3792
|
var CLAUDE_USAGE_ERROR_TTL_MS = 5 * 6e4;
|
|
@@ -3468,14 +3826,14 @@ function accessTokenFromCredentialsJson(raw) {
|
|
|
3468
3826
|
}
|
|
3469
3827
|
}
|
|
3470
3828
|
function claudeCredentialsPath(configDir) {
|
|
3471
|
-
const root = configDir?.trim() || process.env.CLAUDE_CONFIG_DIR?.trim() ||
|
|
3472
|
-
return
|
|
3829
|
+
const root = configDir?.trim() || process.env.CLAUDE_CONFIG_DIR?.trim() || join9(homedir6(), ".claude");
|
|
3830
|
+
return join9(root, ".credentials.json");
|
|
3473
3831
|
}
|
|
3474
3832
|
async function readFileAccessToken(configDir) {
|
|
3475
3833
|
const path = claudeCredentialsPath(configDir);
|
|
3476
|
-
if (!
|
|
3834
|
+
if (!existsSync11(path)) return null;
|
|
3477
3835
|
try {
|
|
3478
|
-
return accessTokenFromCredentialsJson(
|
|
3836
|
+
return accessTokenFromCredentialsJson(readFileSync5(path, "utf8"));
|
|
3479
3837
|
} catch {
|
|
3480
3838
|
return null;
|
|
3481
3839
|
}
|
|
@@ -3618,6 +3976,12 @@ export {
|
|
|
3618
3976
|
adjustBrightsyTurnExit,
|
|
3619
3977
|
listBrightsyChatTargets,
|
|
3620
3978
|
brightsyAdapter,
|
|
3979
|
+
matchClaudeMcpTool,
|
|
3980
|
+
parseMcpServerLaunch,
|
|
3981
|
+
uiResourceUriFromMeta,
|
|
3982
|
+
cspFromMeta,
|
|
3983
|
+
htmlFromResourceContent,
|
|
3984
|
+
mcpUiContentSecurityPolicy,
|
|
3621
3985
|
SIDEBOARD_MCP_PROFILE_ENV,
|
|
3622
3986
|
SIDEBOARD_THREAD_ID_ENV,
|
|
3623
3987
|
shouldRegisterMcpWaitForTurn,
|