@sideboard-ai/core 0.1.218 → 0.1.220
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/{agents-YABJUV3V.js → agents-6UOWJLXX.js} +4 -4
- package/dist/{agents-NWJ7DFJD.js → agents-DYSZ2JFY.js} +4 -4
- package/dist/{chunk-FSIJGLSV.js → chunk-3Y4FIARC.js} +39 -11
- package/dist/{chunk-JWBPSD7Q.js → chunk-ALDVGAIO.js} +8 -8
- package/dist/{chunk-SRFFIFW6.js → chunk-B73KKJQB.js} +9 -9
- package/dist/{chunk-OPYBLX4V.js → chunk-N2VST3NL.js} +49 -2
- package/dist/chunk-P2BSMNHB.js +179 -0
- package/dist/{chunk-MW57SKKR.js → chunk-P2EAAM3H.js} +49 -2
- package/dist/{chunk-IILG7DPX.js → chunk-QILV2BRW.js} +31 -18
- package/dist/chunk-ROPGQRPU.js +178 -0
- package/dist/{chunk-SVXIJ2IC.js → chunk-UNMMKZ4Q.js} +26 -13
- package/dist/{chunk-XRHTRXZN.js → chunk-YG2X34EF.js} +39 -11
- package/dist/{connected-teams-LX5DLL2I.js → connected-teams-PRHZS6B4.js} +2 -2
- package/dist/{connected-teams-PQETXUWV.js → connected-teams-YOIB42RB.js} +2 -2
- package/dist/{coordinator-prompt-5V7GEPBG.js → coordinator-prompt-JLMQVORO.js} +1 -1
- package/dist/{coordinator-prompt-J4QSNTKE.js → coordinator-prompt-VZ7OSRLD.js} +1 -1
- package/dist/{global-workspace-4TEMLESD.js → global-workspace-3FDAUNN2.js} +1 -1
- package/dist/{global-workspace-XPTFHMKL.js → global-workspace-QPSJEXGR.js} +1 -1
- package/dist/index.cjs +216 -43
- package/dist/index.d.cts +40 -2
- package/dist/index.d.ts +40 -2
- package/dist/index.js +17 -5
- package/dist/mcp/run-stdio.cjs +196 -41
- package/dist/mcp/run-stdio.js +5 -5
- package/dist/oauth-K6CWZEQO.js +23 -0
- package/dist/oauth-S3M7B475.js +21 -0
- package/dist/{orchestrator-SWRTYFHX.js → orchestrator-P4KNHFHG.js} +5 -5
- package/dist/{orchestrator-HKW3VLGX.js → orchestrator-Y5IDLJ7D.js} +5 -5
- package/dist/{workspaces-BCBBMMXB.js → workspaces-76W7IEKR.js} +3 -1
- package/dist/{workspaces-2HQP654Q.js → workspaces-TDBA64II.js} +3 -1
- package/package.json +1 -1
- package/dist/chunk-AN3THU7F.js +0 -103
- package/dist/chunk-Y4MIXGPA.js +0 -104
- package/dist/oauth-6ZQ4Q4XN.js +0 -11
- package/dist/oauth-O7UGLZOY.js +0 -13
package/dist/index.cjs
CHANGED
|
@@ -9474,6 +9474,7 @@ __export(workspaces_exports, {
|
|
|
9474
9474
|
addWorkspace: () => addWorkspace,
|
|
9475
9475
|
ensureWorkspace: () => ensureWorkspace,
|
|
9476
9476
|
listWorkspaces: () => listWorkspaces,
|
|
9477
|
+
primaryCheckoutFromLinkedWorktree: () => primaryCheckoutFromLinkedWorktree,
|
|
9477
9478
|
removeWorkspace: () => removeWorkspace,
|
|
9478
9479
|
syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
|
|
9479
9480
|
});
|
|
@@ -9541,6 +9542,29 @@ function isLinkedWorktreeOf(path2, mainRepo) {
|
|
|
9541
9542
|
return false;
|
|
9542
9543
|
}
|
|
9543
9544
|
}
|
|
9545
|
+
function primaryCheckoutFromLinkedWorktree(path2) {
|
|
9546
|
+
if (!path2) return null;
|
|
9547
|
+
const git2 = (0, import_node_path22.join)(path2, ".git");
|
|
9548
|
+
try {
|
|
9549
|
+
if (!(0, import_node_fs19.existsSync)(git2) || (0, import_node_fs19.statSync)(git2).isDirectory()) return null;
|
|
9550
|
+
const text7 = (0, import_node_fs19.readFileSync)(git2, "utf8");
|
|
9551
|
+
const match = /^\s*gitdir:\s*(.+)$/m.exec(text7);
|
|
9552
|
+
if (!match) return null;
|
|
9553
|
+
const gitdir = match[1].trim().replace(/\/+$/, "");
|
|
9554
|
+
const worktrees = gitdir.lastIndexOf("/.git/worktrees/");
|
|
9555
|
+
const root = worktrees > 0 ? gitdir.slice(0, worktrees) : gitdir.endsWith("/.git") ? gitdir.slice(0, -5) : null;
|
|
9556
|
+
if (!root) return null;
|
|
9557
|
+
return canonicalizeRepoPath(root);
|
|
9558
|
+
} catch {
|
|
9559
|
+
return null;
|
|
9560
|
+
}
|
|
9561
|
+
}
|
|
9562
|
+
function resolveSyncWorkspacePath(path2) {
|
|
9563
|
+
if (!path2 || path2 === "/") return null;
|
|
9564
|
+
const primary = primaryCheckoutFromLinkedWorktree(path2);
|
|
9565
|
+
if (primary) return primary;
|
|
9566
|
+
return canonicalizeRepoPath(path2);
|
|
9567
|
+
}
|
|
9544
9568
|
async function addWorkspace(repoPath) {
|
|
9545
9569
|
const root = await resolveRepoRoot(repoPath);
|
|
9546
9570
|
if (!root || root === "/") throw new Error(`Invalid repo path: ${repoPath}`);
|
|
@@ -9569,9 +9593,24 @@ async function ensureWorkspace(repoPath) {
|
|
|
9569
9593
|
function syncWorkspacesFromThreads(repoPaths) {
|
|
9570
9594
|
const current = readAll2();
|
|
9571
9595
|
const removed = readRemoved();
|
|
9572
|
-
const byPath = new Map(
|
|
9596
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
9573
9597
|
let dirty = false;
|
|
9574
|
-
for (const
|
|
9598
|
+
for (const w of current) {
|
|
9599
|
+
const resolved = resolveSyncWorkspacePath(w.path) ?? w.path;
|
|
9600
|
+
if (resolved !== w.path) dirty = true;
|
|
9601
|
+
if (!resolved || resolved === "/" || isGlobalRepoPath(resolved) || removed.has(resolved)) {
|
|
9602
|
+
dirty = true;
|
|
9603
|
+
continue;
|
|
9604
|
+
}
|
|
9605
|
+
if (!byPath.has(resolved)) {
|
|
9606
|
+
byPath.set(
|
|
9607
|
+
resolved,
|
|
9608
|
+
resolved === w.path ? w : { ...w, path: resolved, name: (0, import_node_path22.basename)(resolved) }
|
|
9609
|
+
);
|
|
9610
|
+
}
|
|
9611
|
+
}
|
|
9612
|
+
for (const raw of repoPaths) {
|
|
9613
|
+
const path2 = resolveSyncWorkspacePath(raw);
|
|
9575
9614
|
if (!path2 || path2 === "/" || isGlobalRepoPath(path2) || byPath.has(path2) || removed.has(path2)) {
|
|
9576
9615
|
continue;
|
|
9577
9616
|
}
|
|
@@ -9584,6 +9623,13 @@ function syncWorkspacesFromThreads(repoPaths) {
|
|
|
9584
9623
|
byPath.set(path2, ws);
|
|
9585
9624
|
dirty = true;
|
|
9586
9625
|
}
|
|
9626
|
+
for (const [path2] of byPath) {
|
|
9627
|
+
const mains = [...byPath.keys()];
|
|
9628
|
+
if (mains.some((main) => isLinkedWorktreeOf(path2, main))) {
|
|
9629
|
+
byPath.delete(path2);
|
|
9630
|
+
dirty = true;
|
|
9631
|
+
}
|
|
9632
|
+
}
|
|
9587
9633
|
const next = [...byPath.values()];
|
|
9588
9634
|
if (dirty) writeAll2(next);
|
|
9589
9635
|
return next.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -10782,10 +10828,21 @@ var init_fetch = __esm({
|
|
|
10782
10828
|
// src/brightsy/oauth.ts
|
|
10783
10829
|
var oauth_exports = {};
|
|
10784
10830
|
__export(oauth_exports, {
|
|
10831
|
+
BRIGHTSY_OAUTH_CLIENT_ID: () => BRIGHTSY_OAUTH_CLIENT_ID,
|
|
10832
|
+
BRIGHTSY_OAUTH_REDIRECT: () => BRIGHTSY_OAUTH_REDIRECT,
|
|
10785
10833
|
brightsyAccessTokenNeedsRefresh: () => brightsyAccessTokenNeedsRefresh,
|
|
10786
10834
|
ensureBrightsyLocalConfigFresh: () => ensureBrightsyLocalConfigFresh,
|
|
10787
|
-
|
|
10835
|
+
ensureBrightsyOAuthClientId: () => ensureBrightsyOAuthClientId,
|
|
10836
|
+
normalizeBrightsyEndpoint: () => normalizeBrightsyEndpoint,
|
|
10837
|
+
refreshBrightsyAccessToken: () => refreshBrightsyAccessToken,
|
|
10838
|
+
registerBrightsyOAuthClient: () => registerBrightsyOAuthClient
|
|
10788
10839
|
});
|
|
10840
|
+
function defaultFetch(fetchImpl) {
|
|
10841
|
+
return fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
10842
|
+
}
|
|
10843
|
+
function normalizeBrightsyEndpoint(endpoint) {
|
|
10844
|
+
return (endpoint || "https://brightsy.ai").replace(/\/$/, "");
|
|
10845
|
+
}
|
|
10789
10846
|
function brightsyAccessTokenNeedsRefresh(expiresAt, now = Date.now()) {
|
|
10790
10847
|
if (typeof expiresAt !== "number" || !Number.isFinite(expiresAt) || expiresAt <= 0) {
|
|
10791
10848
|
return true;
|
|
@@ -10799,10 +10856,53 @@ function applyGrant(current, grant) {
|
|
|
10799
10856
|
expires_at: grant.expires_at ?? current.expires_at
|
|
10800
10857
|
};
|
|
10801
10858
|
}
|
|
10859
|
+
async function registerBrightsyOAuthClient(opts) {
|
|
10860
|
+
const endpoint = normalizeBrightsyEndpoint(opts.endpoint);
|
|
10861
|
+
const url = `${endpoint}/oauth/register`;
|
|
10862
|
+
const clientId = (opts.clientId || BRIGHTSY_OAUTH_CLIENT_ID).trim();
|
|
10863
|
+
const redirectUri = opts.redirectUri || BRIGHTSY_OAUTH_REDIRECT;
|
|
10864
|
+
const fetchImpl = defaultFetch(opts.fetchImpl);
|
|
10865
|
+
let res;
|
|
10866
|
+
try {
|
|
10867
|
+
res = await fetchImpl(url, {
|
|
10868
|
+
method: "POST",
|
|
10869
|
+
headers: { "Content-Type": "application/json" },
|
|
10870
|
+
body: JSON.stringify({
|
|
10871
|
+
client_id: clientId,
|
|
10872
|
+
client_name: "Sideboard",
|
|
10873
|
+
description: "Sideboard desktop Brightsy MCP client",
|
|
10874
|
+
redirect_uris: [redirectUri],
|
|
10875
|
+
scope: "brightsy:api",
|
|
10876
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
10877
|
+
response_types: ["code"],
|
|
10878
|
+
token_endpoint_auth_method: "none"
|
|
10879
|
+
})
|
|
10880
|
+
});
|
|
10881
|
+
} catch (err) {
|
|
10882
|
+
throw new Error(formatFetchError(err, url));
|
|
10883
|
+
}
|
|
10884
|
+
if (!res.ok) return null;
|
|
10885
|
+
const data = await res.json();
|
|
10886
|
+
if (!data.client_id?.trim()) return null;
|
|
10887
|
+
return {
|
|
10888
|
+
client_id: data.client_id.trim(),
|
|
10889
|
+
client_secret: data.client_secret?.trim() || void 0
|
|
10890
|
+
};
|
|
10891
|
+
}
|
|
10892
|
+
async function ensureBrightsyOAuthClientId(opts) {
|
|
10893
|
+
const existing = opts.clientId?.trim();
|
|
10894
|
+
if (existing) return existing;
|
|
10895
|
+
const registered = await registerBrightsyOAuthClient({
|
|
10896
|
+
endpoint: opts.endpoint,
|
|
10897
|
+
fetchImpl: opts.fetchImpl
|
|
10898
|
+
});
|
|
10899
|
+
return registered?.client_id || BRIGHTSY_OAUTH_CLIENT_ID;
|
|
10900
|
+
}
|
|
10802
10901
|
async function refreshBrightsyAccessToken(opts) {
|
|
10803
|
-
const endpoint = (opts.endpoint
|
|
10902
|
+
const endpoint = normalizeBrightsyEndpoint(opts.endpoint);
|
|
10804
10903
|
const url = `${endpoint}/oauth/token`;
|
|
10805
|
-
const fetchImpl = opts.fetchImpl
|
|
10904
|
+
const fetchImpl = defaultFetch(opts.fetchImpl);
|
|
10905
|
+
const clientId = opts.clientId?.trim() || BRIGHTSY_OAUTH_CLIENT_ID;
|
|
10806
10906
|
let res;
|
|
10807
10907
|
try {
|
|
10808
10908
|
res = await fetchImpl(url, {
|
|
@@ -10811,7 +10911,7 @@ async function refreshBrightsyAccessToken(opts) {
|
|
|
10811
10911
|
body: new URLSearchParams({
|
|
10812
10912
|
grant_type: "refresh_token",
|
|
10813
10913
|
refresh_token: opts.refreshToken,
|
|
10814
|
-
client_id:
|
|
10914
|
+
client_id: clientId
|
|
10815
10915
|
})
|
|
10816
10916
|
});
|
|
10817
10917
|
} catch (err) {
|
|
@@ -10826,34 +10926,55 @@ async function refreshBrightsyAccessToken(opts) {
|
|
|
10826
10926
|
expires_at: data.expires_in ? Date.now() + data.expires_in * 1e3 : void 0
|
|
10827
10927
|
};
|
|
10828
10928
|
}
|
|
10829
|
-
async function
|
|
10929
|
+
async function ensureBrightsyLocalConfigFreshOnce(opts) {
|
|
10830
10930
|
let cfg;
|
|
10831
10931
|
try {
|
|
10832
10932
|
cfg = loadBrightsyConfig();
|
|
10833
10933
|
} catch {
|
|
10834
10934
|
return null;
|
|
10835
10935
|
}
|
|
10836
|
-
|
|
10936
|
+
const refreshToken = cfg.refresh_token;
|
|
10937
|
+
if (!refreshToken || !brightsyAccessTokenNeedsRefresh(cfg.expires_at)) {
|
|
10837
10938
|
return cfg;
|
|
10838
10939
|
}
|
|
10839
|
-
const
|
|
10840
|
-
|
|
10841
|
-
|
|
10940
|
+
const endpoint = normalizeBrightsyEndpoint(cfg.endpoint);
|
|
10941
|
+
const clientId = await ensureBrightsyOAuthClientId({
|
|
10942
|
+
endpoint,
|
|
10842
10943
|
clientId: cfg.oauth_client_id,
|
|
10843
10944
|
fetchImpl: opts?.fetchImpl
|
|
10844
10945
|
});
|
|
10946
|
+
if (clientId !== cfg.oauth_client_id) {
|
|
10947
|
+
cfg = { ...cfg, oauth_client_id: clientId };
|
|
10948
|
+
saveBrightsyConfig(cfg);
|
|
10949
|
+
}
|
|
10950
|
+
const grant = await refreshBrightsyAccessToken({
|
|
10951
|
+
endpoint,
|
|
10952
|
+
refreshToken,
|
|
10953
|
+
clientId,
|
|
10954
|
+
fetchImpl: opts?.fetchImpl
|
|
10955
|
+
});
|
|
10845
10956
|
if (!grant) return cfg;
|
|
10846
|
-
const next = { ...cfg, ...applyGrant(cfg, grant) };
|
|
10957
|
+
const next = { ...cfg, ...applyGrant(cfg, grant), oauth_client_id: clientId };
|
|
10847
10958
|
saveBrightsyConfig(next);
|
|
10848
10959
|
return next;
|
|
10849
10960
|
}
|
|
10850
|
-
|
|
10961
|
+
async function ensureBrightsyLocalConfigFresh(opts) {
|
|
10962
|
+
if (refreshInFlight) return refreshInFlight;
|
|
10963
|
+
refreshInFlight = ensureBrightsyLocalConfigFreshOnce(opts).finally(() => {
|
|
10964
|
+
refreshInFlight = null;
|
|
10965
|
+
});
|
|
10966
|
+
return refreshInFlight;
|
|
10967
|
+
}
|
|
10968
|
+
var REFRESH_SKEW_MS, BRIGHTSY_OAUTH_CLIENT_ID, BRIGHTSY_OAUTH_REDIRECT, refreshInFlight;
|
|
10851
10969
|
var init_oauth = __esm({
|
|
10852
10970
|
"src/brightsy/oauth.ts"() {
|
|
10853
10971
|
"use strict";
|
|
10854
10972
|
init_fetch();
|
|
10855
10973
|
init_config();
|
|
10856
10974
|
REFRESH_SKEW_MS = 6e4;
|
|
10975
|
+
BRIGHTSY_OAUTH_CLIENT_ID = "sideboard";
|
|
10976
|
+
BRIGHTSY_OAUTH_REDIRECT = "http://127.0.0.1:19850/callback";
|
|
10977
|
+
refreshInFlight = null;
|
|
10857
10978
|
}
|
|
10858
10979
|
});
|
|
10859
10980
|
|
|
@@ -11006,10 +11127,10 @@ function applyConnectedTeamToCli(team) {
|
|
|
11006
11127
|
account_id: team.id,
|
|
11007
11128
|
account_slug: team.slug,
|
|
11008
11129
|
endpoint: team.endpoint ?? base.endpoint ?? "https://brightsy.ai",
|
|
11009
|
-
oauth_client_id: base.oauth_client_id
|
|
11130
|
+
oauth_client_id: team.oauth_client_id ?? base.oauth_client_id
|
|
11010
11131
|
});
|
|
11011
11132
|
}
|
|
11012
|
-
async function refreshTeamToken(team) {
|
|
11133
|
+
async function refreshTeamToken(team, opts) {
|
|
11013
11134
|
if (!team.refresh_token) return team;
|
|
11014
11135
|
const cfg = (() => {
|
|
11015
11136
|
try {
|
|
@@ -11018,21 +11139,31 @@ async function refreshTeamToken(team) {
|
|
|
11018
11139
|
return null;
|
|
11019
11140
|
}
|
|
11020
11141
|
})();
|
|
11142
|
+
const endpoint = team.endpoint || "https://brightsy.ai";
|
|
11143
|
+
const clientId = await ensureBrightsyOAuthClientId({
|
|
11144
|
+
endpoint,
|
|
11145
|
+
clientId: team.oauth_client_id || cfg?.oauth_client_id,
|
|
11146
|
+
fetchImpl: opts?.fetchImpl
|
|
11147
|
+
});
|
|
11021
11148
|
const grant = await refreshBrightsyAccessToken({
|
|
11022
|
-
endpoint
|
|
11149
|
+
endpoint,
|
|
11023
11150
|
refreshToken: team.refresh_token,
|
|
11024
|
-
clientId
|
|
11151
|
+
clientId,
|
|
11152
|
+
fetchImpl: opts?.fetchImpl
|
|
11025
11153
|
});
|
|
11026
|
-
if (!grant) return team;
|
|
11154
|
+
if (!grant) return { ...team, oauth_client_id: clientId || team.oauth_client_id };
|
|
11027
11155
|
return {
|
|
11028
11156
|
...team,
|
|
11029
11157
|
access_token: grant.access_token,
|
|
11030
11158
|
refresh_token: grant.refresh_token || team.refresh_token,
|
|
11031
|
-
expires_at: grant.expires_at ?? team.expires_at
|
|
11159
|
+
expires_at: grant.expires_at ?? team.expires_at,
|
|
11160
|
+
oauth_client_id: clientId
|
|
11032
11161
|
};
|
|
11033
11162
|
}
|
|
11034
|
-
async function ensureConnectedBrightsyTeamTokens() {
|
|
11035
|
-
await ensureBrightsyLocalConfigFresh().catch(
|
|
11163
|
+
async function ensureConnectedBrightsyTeamTokens(opts) {
|
|
11164
|
+
await ensureBrightsyLocalConfigFresh({ fetchImpl: opts?.fetchImpl }).catch(
|
|
11165
|
+
() => null
|
|
11166
|
+
);
|
|
11036
11167
|
const teams = readStore4();
|
|
11037
11168
|
if (teams.length === 0) return [];
|
|
11038
11169
|
const next = [];
|
|
@@ -11042,8 +11173,8 @@ async function ensureConnectedBrightsyTeamTokens() {
|
|
|
11042
11173
|
next.push(team);
|
|
11043
11174
|
continue;
|
|
11044
11175
|
}
|
|
11045
|
-
const refreshed = await refreshTeamToken(team);
|
|
11046
|
-
if (refreshed.access_token !== team.access_token || refreshed.refresh_token !== team.refresh_token || refreshed.expires_at !== team.expires_at) {
|
|
11176
|
+
const refreshed = await refreshTeamToken(team, opts);
|
|
11177
|
+
if (refreshed.access_token !== team.access_token || refreshed.refresh_token !== team.refresh_token || refreshed.expires_at !== team.expires_at || refreshed.oauth_client_id !== team.oauth_client_id) {
|
|
11047
11178
|
changed = true;
|
|
11048
11179
|
}
|
|
11049
11180
|
next.push(refreshed);
|
|
@@ -11073,7 +11204,8 @@ function ensureCliTeamTracked(meta) {
|
|
|
11073
11204
|
access_token: cfg.access_token,
|
|
11074
11205
|
refresh_token: cfg.refresh_token,
|
|
11075
11206
|
expires_at: cfg.expires_at,
|
|
11076
|
-
endpoint: cfg.endpoint
|
|
11207
|
+
endpoint: cfg.endpoint,
|
|
11208
|
+
oauth_client_id: cfg.oauth_client_id
|
|
11077
11209
|
};
|
|
11078
11210
|
writeStore3([...existing, team]);
|
|
11079
11211
|
} catch {
|
|
@@ -11100,7 +11232,8 @@ async function connectBrightsyTeam(accountIdOrSlug) {
|
|
|
11100
11232
|
access_token: minted.access_token,
|
|
11101
11233
|
refresh_token: minted.refresh_token,
|
|
11102
11234
|
expires_at: minted.expires_at,
|
|
11103
|
-
endpoint: minted.endpoint
|
|
11235
|
+
endpoint: minted.endpoint,
|
|
11236
|
+
oauth_client_id: minted.oauth_client_id
|
|
11104
11237
|
};
|
|
11105
11238
|
writeStore3([...existing, team]);
|
|
11106
11239
|
return listConnectedBrightsyTeams();
|
|
@@ -12160,6 +12293,7 @@ function teamEnv(team) {
|
|
|
12160
12293
|
return {
|
|
12161
12294
|
BRIGHTSY_API_TOKEN: team.access_token,
|
|
12162
12295
|
...team.refresh_token ? { BRIGHTSY_REFRESH_TOKEN: team.refresh_token } : {},
|
|
12296
|
+
...team.oauth_client_id ? { BRIGHTSY_OAUTH_CLIENT_ID: team.oauth_client_id } : {},
|
|
12163
12297
|
BRIGHTSY_ACCOUNT_ID: team.id,
|
|
12164
12298
|
BRIGHTSY_API_URL: endpoint
|
|
12165
12299
|
};
|
|
@@ -12343,8 +12477,16 @@ function toOpencodeMcpConfigContent(servers, opts) {
|
|
|
12343
12477
|
}
|
|
12344
12478
|
return JSON.stringify({ mcp });
|
|
12345
12479
|
}
|
|
12346
|
-
function
|
|
12347
|
-
|
|
12480
|
+
function stripElectronFromUserMcpEntry(entry) {
|
|
12481
|
+
const next = { ...entry };
|
|
12482
|
+
const env = next.env;
|
|
12483
|
+
if (!env || typeof env !== "object" || Array.isArray(env)) return next;
|
|
12484
|
+
const cleaned = { ...env };
|
|
12485
|
+
delete cleaned.ELECTRON_RUN_AS_NODE;
|
|
12486
|
+
next.env = cleaned;
|
|
12487
|
+
return next;
|
|
12488
|
+
}
|
|
12489
|
+
function writeMcpServersConfig(servers, extraServers) {
|
|
12348
12490
|
const mcpServers = {};
|
|
12349
12491
|
for (const s of servers) {
|
|
12350
12492
|
const env = mcpSpawnEnv(s.env);
|
|
@@ -12354,6 +12496,14 @@ function writeMcpServersConfig(servers) {
|
|
|
12354
12496
|
...env ? { env } : {}
|
|
12355
12497
|
};
|
|
12356
12498
|
}
|
|
12499
|
+
if (extraServers) {
|
|
12500
|
+
for (const [rawName, entry] of Object.entries(extraServers)) {
|
|
12501
|
+
const name = rawName.trim();
|
|
12502
|
+
if (!name || mcpServers[name] || !entry) continue;
|
|
12503
|
+
mcpServers[name] = stripElectronFromUserMcpEntry(entry);
|
|
12504
|
+
}
|
|
12505
|
+
}
|
|
12506
|
+
if (Object.keys(mcpServers).length === 0) return null;
|
|
12357
12507
|
const dir = (0, import_node_fs30.mkdtempSync)((0, import_node_path33.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
|
|
12358
12508
|
const cfgPath = (0, import_node_path33.join)(dir, "mcp.json");
|
|
12359
12509
|
(0, import_node_fs30.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
|
|
@@ -12561,10 +12711,20 @@ function listUserOpencodeMcpNames(home = (0, import_node_os11.homedir)()) {
|
|
|
12561
12711
|
}
|
|
12562
12712
|
return names;
|
|
12563
12713
|
}
|
|
12564
|
-
function
|
|
12714
|
+
function userClaudeMcpConfigObject(home = (0, import_node_os11.homedir)()) {
|
|
12565
12715
|
const claudePath = home === (0, import_node_os11.homedir)() ? userClaudeMcpConfigPath() : (0, import_node_path35.join)(home, ".claude.json");
|
|
12566
|
-
if (!(0, import_node_fs32.existsSync)(claudePath)) return
|
|
12567
|
-
return
|
|
12716
|
+
if (!(0, import_node_fs32.existsSync)(claudePath)) return {};
|
|
12717
|
+
return asObject2(asObject2(readJsonObject(claudePath)).mcpServers);
|
|
12718
|
+
}
|
|
12719
|
+
function listUserClaudeMcpServerEntries(home = (0, import_node_os11.homedir)()) {
|
|
12720
|
+
const out = {};
|
|
12721
|
+
for (const [rawName, value] of Object.entries(userClaudeMcpConfigObject(home))) {
|
|
12722
|
+
const name = rawName.trim();
|
|
12723
|
+
if (!name || isInjectedOrchMcpName(name)) continue;
|
|
12724
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
12725
|
+
out[name] = value;
|
|
12726
|
+
}
|
|
12727
|
+
return out;
|
|
12568
12728
|
}
|
|
12569
12729
|
function toCodexDisableUserMcpArgs(names) {
|
|
12570
12730
|
const args = [];
|
|
@@ -13059,6 +13219,7 @@ var init_claude = __esm({
|
|
|
13059
13219
|
});
|
|
13060
13220
|
const injectedBrightsyNames = injectedServers.filter((s) => s.name === "brightsy" || s.name.startsWith("brightsy_")).map((s) => s.name);
|
|
13061
13221
|
const chromeOn = claudeChromeEnabled();
|
|
13222
|
+
const userMcpEntries = isOrchestrator ? {} : listUserClaudeMcpServerEntries();
|
|
13062
13223
|
let allowedTools;
|
|
13063
13224
|
if (isOrchestrator) {
|
|
13064
13225
|
allowedTools = [
|
|
@@ -13069,7 +13230,7 @@ var init_claude = __esm({
|
|
|
13069
13230
|
} else {
|
|
13070
13231
|
allowedTools = [
|
|
13071
13232
|
...BASE_ALLOWED_TOOLS,
|
|
13072
|
-
...mcpAllowToolsFromNames(
|
|
13233
|
+
...mcpAllowToolsFromNames(Object.keys(userMcpEntries)),
|
|
13073
13234
|
...sideboardWorktreeAllowedTools({
|
|
13074
13235
|
github: true,
|
|
13075
13236
|
linear: isLinearConnected(),
|
|
@@ -13094,7 +13255,7 @@ var init_claude = __esm({
|
|
|
13094
13255
|
if (systemPrompt) {
|
|
13095
13256
|
args.push("--append-system-prompt", systemPrompt);
|
|
13096
13257
|
}
|
|
13097
|
-
const mcpConfigPath = writeMcpServersConfig(injectedServers);
|
|
13258
|
+
const mcpConfigPath = writeMcpServersConfig(injectedServers, userMcpEntries);
|
|
13098
13259
|
if (mcpConfigPath) {
|
|
13099
13260
|
args.push("--mcp-config", mcpConfigPath);
|
|
13100
13261
|
args.push("--strict-mcp-config");
|
|
@@ -18250,12 +18411,12 @@ async function ensureAbleTimeAccessToken() {
|
|
|
18250
18411
|
return access;
|
|
18251
18412
|
}
|
|
18252
18413
|
if (refresh) {
|
|
18253
|
-
if (!
|
|
18254
|
-
|
|
18255
|
-
|
|
18414
|
+
if (!refreshInFlight2) {
|
|
18415
|
+
refreshInFlight2 = refreshAbleTimeAccessToken(refresh).finally(() => {
|
|
18416
|
+
refreshInFlight2 = null;
|
|
18256
18417
|
});
|
|
18257
18418
|
}
|
|
18258
|
-
return
|
|
18419
|
+
return refreshInFlight2;
|
|
18259
18420
|
}
|
|
18260
18421
|
return access || null;
|
|
18261
18422
|
}
|
|
@@ -18378,7 +18539,7 @@ async function startAbleTimeOAuth(opts) {
|
|
|
18378
18539
|
return loadAppSettings();
|
|
18379
18540
|
}
|
|
18380
18541
|
}
|
|
18381
|
-
var import_node_crypto10, import_node_http, ABLETIME_OAUTH_CALLBACK_PATH, ABLETIME_OAUTH_PORT, ABLETIME_OAUTH_LOCAL_CALLBACK, ABLETIME_OAUTH_REDIRECT, BOUNCE_QUERY_KEYS, BAKED_ABLETIME_OAUTH_CLIENT_ID, ABLETIME_OAUTH_RESOURCE, REFRESH_SKEW_MS2,
|
|
18542
|
+
var import_node_crypto10, import_node_http, ABLETIME_OAUTH_CALLBACK_PATH, ABLETIME_OAUTH_PORT, ABLETIME_OAUTH_LOCAL_CALLBACK, ABLETIME_OAUTH_REDIRECT, BOUNCE_QUERY_KEYS, BAKED_ABLETIME_OAUTH_CLIENT_ID, ABLETIME_OAUTH_RESOURCE, REFRESH_SKEW_MS2, refreshInFlight2, ABLETIME_OAUTH_CANCELLED, AbleTimeOAuthCancelledError;
|
|
18382
18543
|
var init_abletime_oauth = __esm({
|
|
18383
18544
|
"src/integrations/abletime-oauth.ts"() {
|
|
18384
18545
|
"use strict";
|
|
@@ -18395,7 +18556,7 @@ var init_abletime_oauth = __esm({
|
|
|
18395
18556
|
BAKED_ABLETIME_OAUTH_CLIENT_ID = "https://www.sideboard.cloud/oauth/abletime-client.json";
|
|
18396
18557
|
ABLETIME_OAUTH_RESOURCE = `${DEFAULT_ABLETIME_HOST}/api/public/v2/mcp`;
|
|
18397
18558
|
REFRESH_SKEW_MS2 = 5 * 6e4;
|
|
18398
|
-
|
|
18559
|
+
refreshInFlight2 = null;
|
|
18399
18560
|
ABLETIME_OAUTH_CANCELLED = "AbleTime sign-in cancelled";
|
|
18400
18561
|
AbleTimeOAuthCancelledError = class extends Error {
|
|
18401
18562
|
constructor(message = ABLETIME_OAUTH_CANCELLED) {
|
|
@@ -25611,6 +25772,8 @@ __export(index_exports, {
|
|
|
25611
25772
|
BAKED_ABLETIME_OAUTH_CLIENT_ID: () => BAKED_ABLETIME_OAUTH_CLIENT_ID,
|
|
25612
25773
|
BAKED_SLACK_RELAY_URL: () => BAKED_SLACK_RELAY_URL,
|
|
25613
25774
|
BRIGHTSY_MCP_ALLOWED_TOOLS: () => BRIGHTSY_MCP_ALLOWED_TOOLS,
|
|
25775
|
+
BRIGHTSY_OAUTH_CLIENT_ID: () => BRIGHTSY_OAUTH_CLIENT_ID,
|
|
25776
|
+
BRIGHTSY_OAUTH_REDIRECT: () => BRIGHTSY_OAUTH_REDIRECT,
|
|
25614
25777
|
BRIGHTSY_SUMMARIZE_CONTEXT_TOOL: () => BRIGHTSY_SUMMARIZE_CONTEXT_TOOL,
|
|
25615
25778
|
BUNDLED_LONG_RUNNING_PATH: () => BUNDLED_LONG_RUNNING_PATH,
|
|
25616
25779
|
BUNDLED_SKILL_PREFIX: () => BUNDLED_SKILL_PREFIX,
|
|
@@ -25879,6 +26042,7 @@ __export(index_exports, {
|
|
|
25879
26042
|
ensureAbleTimeTask: () => ensureAbleTimeTask,
|
|
25880
26043
|
ensureAgentPath: () => ensureAgentPath,
|
|
25881
26044
|
ensureBrightsyLocalConfigFresh: () => ensureBrightsyLocalConfigFresh,
|
|
26045
|
+
ensureBrightsyOAuthClientId: () => ensureBrightsyOAuthClientId,
|
|
25882
26046
|
ensureCloudCoordinator: () => ensureCloudCoordinator,
|
|
25883
26047
|
ensureConnectedBrightsyTeamTokens: () => ensureConnectedBrightsyTeamTokens,
|
|
25884
26048
|
ensureGhPreferOrigin: () => ensureGhPreferOrigin,
|
|
@@ -26187,6 +26351,7 @@ __export(index_exports, {
|
|
|
26187
26351
|
nonInteractiveGitProcessEnv: () => nonInteractiveGitProcessEnv,
|
|
26188
26352
|
normalizeAbleTimeCredential: () => normalizeAbleTimeCredential,
|
|
26189
26353
|
normalizeAbleTimeHost: () => normalizeAbleTimeHost,
|
|
26354
|
+
normalizeBrightsyEndpoint: () => normalizeBrightsyEndpoint,
|
|
26190
26355
|
normalizeCodeSelection: () => normalizeCodeSelection,
|
|
26191
26356
|
normalizeLinearRelationType: () => normalizeLinearRelationType,
|
|
26192
26357
|
normalizeParseResult: () => normalizeParseResult,
|
|
@@ -26238,6 +26403,7 @@ __export(index_exports, {
|
|
|
26238
26403
|
prepareTerminalCommand: () => prepareTerminalCommand,
|
|
26239
26404
|
prependQueuedItem: () => prependQueuedItem,
|
|
26240
26405
|
previewLand: () => previewLand,
|
|
26406
|
+
primaryCheckoutFromLinkedWorktree: () => primaryCheckoutFromLinkedWorktree,
|
|
26241
26407
|
promptMentionsBrightsy: () => promptMentionsBrightsy,
|
|
26242
26408
|
pushBranch: () => pushBranch,
|
|
26243
26409
|
readExistingReviewRequestFile: () => readExistingReviewRequestFile,
|
|
@@ -26254,6 +26420,7 @@ __export(index_exports, {
|
|
|
26254
26420
|
recordSlackOutboundWatch: () => recordSlackOutboundWatch,
|
|
26255
26421
|
refreshBrightsyAccessToken: () => refreshBrightsyAccessToken,
|
|
26256
26422
|
refreshGitHubAuth: () => refreshGitHubAuth,
|
|
26423
|
+
registerBrightsyOAuthClient: () => registerBrightsyOAuthClient,
|
|
26257
26424
|
registerPackagedUserMcpClients: () => registerPackagedUserMcpClients,
|
|
26258
26425
|
releaseCaffeinateHoldForThread: () => releaseCaffeinateHoldForThread,
|
|
26259
26426
|
releaseDesktopHost: () => releaseDesktopHost,
|
|
@@ -26785,7 +26952,7 @@ async function fetchLinearViewer(accessToken) {
|
|
|
26785
26952
|
organizationName: viewer?.organization?.name?.trim() || void 0
|
|
26786
26953
|
};
|
|
26787
26954
|
}
|
|
26788
|
-
var
|
|
26955
|
+
var refreshInFlight3 = null;
|
|
26789
26956
|
async function refreshLinearAccessToken(refreshToken) {
|
|
26790
26957
|
const { clientId, clientSecret } = linearOAuthCredentials();
|
|
26791
26958
|
const body = new URLSearchParams({
|
|
@@ -26816,12 +26983,12 @@ async function getLinearAuthToken(settings = loadAppSettings()) {
|
|
|
26816
26983
|
return access;
|
|
26817
26984
|
}
|
|
26818
26985
|
if (refresh) {
|
|
26819
|
-
if (!
|
|
26820
|
-
|
|
26821
|
-
|
|
26986
|
+
if (!refreshInFlight3) {
|
|
26987
|
+
refreshInFlight3 = refreshLinearAccessToken(refresh).finally(() => {
|
|
26988
|
+
refreshInFlight3 = null;
|
|
26822
26989
|
});
|
|
26823
26990
|
}
|
|
26824
|
-
return
|
|
26991
|
+
return refreshInFlight3.catch((err) => {
|
|
26825
26992
|
if (apiKey) return apiKey;
|
|
26826
26993
|
throw err;
|
|
26827
26994
|
});
|
|
@@ -34402,6 +34569,8 @@ init_outbound_watch();
|
|
|
34402
34569
|
BAKED_ABLETIME_OAUTH_CLIENT_ID,
|
|
34403
34570
|
BAKED_SLACK_RELAY_URL,
|
|
34404
34571
|
BRIGHTSY_MCP_ALLOWED_TOOLS,
|
|
34572
|
+
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
34573
|
+
BRIGHTSY_OAUTH_REDIRECT,
|
|
34405
34574
|
BRIGHTSY_SUMMARIZE_CONTEXT_TOOL,
|
|
34406
34575
|
BUNDLED_LONG_RUNNING_PATH,
|
|
34407
34576
|
BUNDLED_SKILL_PREFIX,
|
|
@@ -34670,6 +34839,7 @@ init_outbound_watch();
|
|
|
34670
34839
|
ensureAbleTimeTask,
|
|
34671
34840
|
ensureAgentPath,
|
|
34672
34841
|
ensureBrightsyLocalConfigFresh,
|
|
34842
|
+
ensureBrightsyOAuthClientId,
|
|
34673
34843
|
ensureCloudCoordinator,
|
|
34674
34844
|
ensureConnectedBrightsyTeamTokens,
|
|
34675
34845
|
ensureGhPreferOrigin,
|
|
@@ -34978,6 +35148,7 @@ init_outbound_watch();
|
|
|
34978
35148
|
nonInteractiveGitProcessEnv,
|
|
34979
35149
|
normalizeAbleTimeCredential,
|
|
34980
35150
|
normalizeAbleTimeHost,
|
|
35151
|
+
normalizeBrightsyEndpoint,
|
|
34981
35152
|
normalizeCodeSelection,
|
|
34982
35153
|
normalizeLinearRelationType,
|
|
34983
35154
|
normalizeParseResult,
|
|
@@ -35029,6 +35200,7 @@ init_outbound_watch();
|
|
|
35029
35200
|
prepareTerminalCommand,
|
|
35030
35201
|
prependQueuedItem,
|
|
35031
35202
|
previewLand,
|
|
35203
|
+
primaryCheckoutFromLinkedWorktree,
|
|
35032
35204
|
promptMentionsBrightsy,
|
|
35033
35205
|
pushBranch,
|
|
35034
35206
|
readExistingReviewRequestFile,
|
|
@@ -35045,6 +35217,7 @@ init_outbound_watch();
|
|
|
35045
35217
|
recordSlackOutboundWatch,
|
|
35046
35218
|
refreshBrightsyAccessToken,
|
|
35047
35219
|
refreshGitHubAuth,
|
|
35220
|
+
registerBrightsyOAuthClient,
|
|
35048
35221
|
registerPackagedUserMcpClients,
|
|
35049
35222
|
releaseCaffeinateHoldForThread,
|
|
35050
35223
|
releaseDesktopHost,
|