@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/mcp/run-stdio.cjs
CHANGED
|
@@ -8111,6 +8111,7 @@ __export(workspaces_exports, {
|
|
|
8111
8111
|
addWorkspace: () => addWorkspace,
|
|
8112
8112
|
ensureWorkspace: () => ensureWorkspace,
|
|
8113
8113
|
listWorkspaces: () => listWorkspaces,
|
|
8114
|
+
primaryCheckoutFromLinkedWorktree: () => primaryCheckoutFromLinkedWorktree,
|
|
8114
8115
|
removeWorkspace: () => removeWorkspace,
|
|
8115
8116
|
syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
|
|
8116
8117
|
});
|
|
@@ -8178,6 +8179,29 @@ function isLinkedWorktreeOf(path, mainRepo) {
|
|
|
8178
8179
|
return false;
|
|
8179
8180
|
}
|
|
8180
8181
|
}
|
|
8182
|
+
function primaryCheckoutFromLinkedWorktree(path) {
|
|
8183
|
+
if (!path) return null;
|
|
8184
|
+
const git2 = (0, import_node_path22.join)(path, ".git");
|
|
8185
|
+
try {
|
|
8186
|
+
if (!(0, import_node_fs18.existsSync)(git2) || (0, import_node_fs18.statSync)(git2).isDirectory()) return null;
|
|
8187
|
+
const text7 = (0, import_node_fs18.readFileSync)(git2, "utf8");
|
|
8188
|
+
const match = /^\s*gitdir:\s*(.+)$/m.exec(text7);
|
|
8189
|
+
if (!match) return null;
|
|
8190
|
+
const gitdir = match[1].trim().replace(/\/+$/, "");
|
|
8191
|
+
const worktrees = gitdir.lastIndexOf("/.git/worktrees/");
|
|
8192
|
+
const root = worktrees > 0 ? gitdir.slice(0, worktrees) : gitdir.endsWith("/.git") ? gitdir.slice(0, -5) : null;
|
|
8193
|
+
if (!root) return null;
|
|
8194
|
+
return canonicalizeRepoPath(root);
|
|
8195
|
+
} catch {
|
|
8196
|
+
return null;
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8199
|
+
function resolveSyncWorkspacePath(path) {
|
|
8200
|
+
if (!path || path === "/") return null;
|
|
8201
|
+
const primary = primaryCheckoutFromLinkedWorktree(path);
|
|
8202
|
+
if (primary) return primary;
|
|
8203
|
+
return canonicalizeRepoPath(path);
|
|
8204
|
+
}
|
|
8181
8205
|
async function addWorkspace(repoPath) {
|
|
8182
8206
|
const root = await resolveRepoRoot(repoPath);
|
|
8183
8207
|
if (!root || root === "/") throw new Error(`Invalid repo path: ${repoPath}`);
|
|
@@ -8206,9 +8230,24 @@ async function ensureWorkspace(repoPath) {
|
|
|
8206
8230
|
function syncWorkspacesFromThreads(repoPaths) {
|
|
8207
8231
|
const current = readAll();
|
|
8208
8232
|
const removed = readRemoved();
|
|
8209
|
-
const byPath = new Map(
|
|
8233
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
8210
8234
|
let dirty = false;
|
|
8211
|
-
for (const
|
|
8235
|
+
for (const w of current) {
|
|
8236
|
+
const resolved = resolveSyncWorkspacePath(w.path) ?? w.path;
|
|
8237
|
+
if (resolved !== w.path) dirty = true;
|
|
8238
|
+
if (!resolved || resolved === "/" || isGlobalRepoPath(resolved) || removed.has(resolved)) {
|
|
8239
|
+
dirty = true;
|
|
8240
|
+
continue;
|
|
8241
|
+
}
|
|
8242
|
+
if (!byPath.has(resolved)) {
|
|
8243
|
+
byPath.set(
|
|
8244
|
+
resolved,
|
|
8245
|
+
resolved === w.path ? w : { ...w, path: resolved, name: (0, import_node_path22.basename)(resolved) }
|
|
8246
|
+
);
|
|
8247
|
+
}
|
|
8248
|
+
}
|
|
8249
|
+
for (const raw of repoPaths) {
|
|
8250
|
+
const path = resolveSyncWorkspacePath(raw);
|
|
8212
8251
|
if (!path || path === "/" || isGlobalRepoPath(path) || byPath.has(path) || removed.has(path)) {
|
|
8213
8252
|
continue;
|
|
8214
8253
|
}
|
|
@@ -8221,6 +8260,13 @@ function syncWorkspacesFromThreads(repoPaths) {
|
|
|
8221
8260
|
byPath.set(path, ws);
|
|
8222
8261
|
dirty = true;
|
|
8223
8262
|
}
|
|
8263
|
+
for (const [path] of byPath) {
|
|
8264
|
+
const mains = [...byPath.keys()];
|
|
8265
|
+
if (mains.some((main) => isLinkedWorktreeOf(path, main))) {
|
|
8266
|
+
byPath.delete(path);
|
|
8267
|
+
dirty = true;
|
|
8268
|
+
}
|
|
8269
|
+
}
|
|
8224
8270
|
const next = [...byPath.values()];
|
|
8225
8271
|
if (dirty) writeAll(next);
|
|
8226
8272
|
return next.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -8862,6 +8908,12 @@ var init_fetch = __esm({
|
|
|
8862
8908
|
});
|
|
8863
8909
|
|
|
8864
8910
|
// src/brightsy/oauth.ts
|
|
8911
|
+
function defaultFetch(fetchImpl) {
|
|
8912
|
+
return fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
8913
|
+
}
|
|
8914
|
+
function normalizeBrightsyEndpoint(endpoint) {
|
|
8915
|
+
return (endpoint || "https://brightsy.ai").replace(/\/$/, "");
|
|
8916
|
+
}
|
|
8865
8917
|
function brightsyAccessTokenNeedsRefresh(expiresAt, now = Date.now()) {
|
|
8866
8918
|
if (typeof expiresAt !== "number" || !Number.isFinite(expiresAt) || expiresAt <= 0) {
|
|
8867
8919
|
return true;
|
|
@@ -8875,10 +8927,53 @@ function applyGrant(current, grant) {
|
|
|
8875
8927
|
expires_at: grant.expires_at ?? current.expires_at
|
|
8876
8928
|
};
|
|
8877
8929
|
}
|
|
8930
|
+
async function registerBrightsyOAuthClient(opts) {
|
|
8931
|
+
const endpoint = normalizeBrightsyEndpoint(opts.endpoint);
|
|
8932
|
+
const url = `${endpoint}/oauth/register`;
|
|
8933
|
+
const clientId = (opts.clientId || BRIGHTSY_OAUTH_CLIENT_ID).trim();
|
|
8934
|
+
const redirectUri = opts.redirectUri || BRIGHTSY_OAUTH_REDIRECT;
|
|
8935
|
+
const fetchImpl = defaultFetch(opts.fetchImpl);
|
|
8936
|
+
let res;
|
|
8937
|
+
try {
|
|
8938
|
+
res = await fetchImpl(url, {
|
|
8939
|
+
method: "POST",
|
|
8940
|
+
headers: { "Content-Type": "application/json" },
|
|
8941
|
+
body: JSON.stringify({
|
|
8942
|
+
client_id: clientId,
|
|
8943
|
+
client_name: "Sideboard",
|
|
8944
|
+
description: "Sideboard desktop Brightsy MCP client",
|
|
8945
|
+
redirect_uris: [redirectUri],
|
|
8946
|
+
scope: "brightsy:api",
|
|
8947
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
8948
|
+
response_types: ["code"],
|
|
8949
|
+
token_endpoint_auth_method: "none"
|
|
8950
|
+
})
|
|
8951
|
+
});
|
|
8952
|
+
} catch (err) {
|
|
8953
|
+
throw new Error(formatFetchError(err, url));
|
|
8954
|
+
}
|
|
8955
|
+
if (!res.ok) return null;
|
|
8956
|
+
const data = await res.json();
|
|
8957
|
+
if (!data.client_id?.trim()) return null;
|
|
8958
|
+
return {
|
|
8959
|
+
client_id: data.client_id.trim(),
|
|
8960
|
+
client_secret: data.client_secret?.trim() || void 0
|
|
8961
|
+
};
|
|
8962
|
+
}
|
|
8963
|
+
async function ensureBrightsyOAuthClientId(opts) {
|
|
8964
|
+
const existing = opts.clientId?.trim();
|
|
8965
|
+
if (existing) return existing;
|
|
8966
|
+
const registered = await registerBrightsyOAuthClient({
|
|
8967
|
+
endpoint: opts.endpoint,
|
|
8968
|
+
fetchImpl: opts.fetchImpl
|
|
8969
|
+
});
|
|
8970
|
+
return registered?.client_id || BRIGHTSY_OAUTH_CLIENT_ID;
|
|
8971
|
+
}
|
|
8878
8972
|
async function refreshBrightsyAccessToken(opts) {
|
|
8879
|
-
const endpoint = (opts.endpoint
|
|
8973
|
+
const endpoint = normalizeBrightsyEndpoint(opts.endpoint);
|
|
8880
8974
|
const url = `${endpoint}/oauth/token`;
|
|
8881
|
-
const fetchImpl = opts.fetchImpl
|
|
8975
|
+
const fetchImpl = defaultFetch(opts.fetchImpl);
|
|
8976
|
+
const clientId = opts.clientId?.trim() || BRIGHTSY_OAUTH_CLIENT_ID;
|
|
8882
8977
|
let res;
|
|
8883
8978
|
try {
|
|
8884
8979
|
res = await fetchImpl(url, {
|
|
@@ -8887,7 +8982,7 @@ async function refreshBrightsyAccessToken(opts) {
|
|
|
8887
8982
|
body: new URLSearchParams({
|
|
8888
8983
|
grant_type: "refresh_token",
|
|
8889
8984
|
refresh_token: opts.refreshToken,
|
|
8890
|
-
client_id:
|
|
8985
|
+
client_id: clientId
|
|
8891
8986
|
})
|
|
8892
8987
|
});
|
|
8893
8988
|
} catch (err) {
|
|
@@ -8902,34 +8997,55 @@ async function refreshBrightsyAccessToken(opts) {
|
|
|
8902
8997
|
expires_at: data.expires_in ? Date.now() + data.expires_in * 1e3 : void 0
|
|
8903
8998
|
};
|
|
8904
8999
|
}
|
|
8905
|
-
async function
|
|
9000
|
+
async function ensureBrightsyLocalConfigFreshOnce(opts) {
|
|
8906
9001
|
let cfg;
|
|
8907
9002
|
try {
|
|
8908
9003
|
cfg = loadBrightsyConfig();
|
|
8909
9004
|
} catch {
|
|
8910
9005
|
return null;
|
|
8911
9006
|
}
|
|
8912
|
-
|
|
9007
|
+
const refreshToken = cfg.refresh_token;
|
|
9008
|
+
if (!refreshToken || !brightsyAccessTokenNeedsRefresh(cfg.expires_at)) {
|
|
8913
9009
|
return cfg;
|
|
8914
9010
|
}
|
|
8915
|
-
const
|
|
8916
|
-
|
|
8917
|
-
|
|
9011
|
+
const endpoint = normalizeBrightsyEndpoint(cfg.endpoint);
|
|
9012
|
+
const clientId = await ensureBrightsyOAuthClientId({
|
|
9013
|
+
endpoint,
|
|
8918
9014
|
clientId: cfg.oauth_client_id,
|
|
8919
9015
|
fetchImpl: opts?.fetchImpl
|
|
8920
9016
|
});
|
|
9017
|
+
if (clientId !== cfg.oauth_client_id) {
|
|
9018
|
+
cfg = { ...cfg, oauth_client_id: clientId };
|
|
9019
|
+
saveBrightsyConfig(cfg);
|
|
9020
|
+
}
|
|
9021
|
+
const grant = await refreshBrightsyAccessToken({
|
|
9022
|
+
endpoint,
|
|
9023
|
+
refreshToken,
|
|
9024
|
+
clientId,
|
|
9025
|
+
fetchImpl: opts?.fetchImpl
|
|
9026
|
+
});
|
|
8921
9027
|
if (!grant) return cfg;
|
|
8922
|
-
const next = { ...cfg, ...applyGrant(cfg, grant) };
|
|
9028
|
+
const next = { ...cfg, ...applyGrant(cfg, grant), oauth_client_id: clientId };
|
|
8923
9029
|
saveBrightsyConfig(next);
|
|
8924
9030
|
return next;
|
|
8925
9031
|
}
|
|
8926
|
-
|
|
9032
|
+
async function ensureBrightsyLocalConfigFresh(opts) {
|
|
9033
|
+
if (refreshInFlight) return refreshInFlight;
|
|
9034
|
+
refreshInFlight = ensureBrightsyLocalConfigFreshOnce(opts).finally(() => {
|
|
9035
|
+
refreshInFlight = null;
|
|
9036
|
+
});
|
|
9037
|
+
return refreshInFlight;
|
|
9038
|
+
}
|
|
9039
|
+
var REFRESH_SKEW_MS, BRIGHTSY_OAUTH_CLIENT_ID, BRIGHTSY_OAUTH_REDIRECT, refreshInFlight;
|
|
8927
9040
|
var init_oauth = __esm({
|
|
8928
9041
|
"src/brightsy/oauth.ts"() {
|
|
8929
9042
|
"use strict";
|
|
8930
9043
|
init_fetch();
|
|
8931
9044
|
init_config();
|
|
8932
9045
|
REFRESH_SKEW_MS = 6e4;
|
|
9046
|
+
BRIGHTSY_OAUTH_CLIENT_ID = "sideboard";
|
|
9047
|
+
BRIGHTSY_OAUTH_REDIRECT = "http://127.0.0.1:19850/callback";
|
|
9048
|
+
refreshInFlight = null;
|
|
8933
9049
|
}
|
|
8934
9050
|
});
|
|
8935
9051
|
|
|
@@ -8978,10 +9094,10 @@ function applyConnectedTeamToCli(team) {
|
|
|
8978
9094
|
account_id: team.id,
|
|
8979
9095
|
account_slug: team.slug,
|
|
8980
9096
|
endpoint: team.endpoint ?? base.endpoint ?? "https://brightsy.ai",
|
|
8981
|
-
oauth_client_id: base.oauth_client_id
|
|
9097
|
+
oauth_client_id: team.oauth_client_id ?? base.oauth_client_id
|
|
8982
9098
|
});
|
|
8983
9099
|
}
|
|
8984
|
-
async function refreshTeamToken(team) {
|
|
9100
|
+
async function refreshTeamToken(team, opts) {
|
|
8985
9101
|
if (!team.refresh_token) return team;
|
|
8986
9102
|
const cfg = (() => {
|
|
8987
9103
|
try {
|
|
@@ -8990,21 +9106,31 @@ async function refreshTeamToken(team) {
|
|
|
8990
9106
|
return null;
|
|
8991
9107
|
}
|
|
8992
9108
|
})();
|
|
9109
|
+
const endpoint = team.endpoint || "https://brightsy.ai";
|
|
9110
|
+
const clientId = await ensureBrightsyOAuthClientId({
|
|
9111
|
+
endpoint,
|
|
9112
|
+
clientId: team.oauth_client_id || cfg?.oauth_client_id,
|
|
9113
|
+
fetchImpl: opts?.fetchImpl
|
|
9114
|
+
});
|
|
8993
9115
|
const grant = await refreshBrightsyAccessToken({
|
|
8994
|
-
endpoint
|
|
9116
|
+
endpoint,
|
|
8995
9117
|
refreshToken: team.refresh_token,
|
|
8996
|
-
clientId
|
|
9118
|
+
clientId,
|
|
9119
|
+
fetchImpl: opts?.fetchImpl
|
|
8997
9120
|
});
|
|
8998
|
-
if (!grant) return team;
|
|
9121
|
+
if (!grant) return { ...team, oauth_client_id: clientId || team.oauth_client_id };
|
|
8999
9122
|
return {
|
|
9000
9123
|
...team,
|
|
9001
9124
|
access_token: grant.access_token,
|
|
9002
9125
|
refresh_token: grant.refresh_token || team.refresh_token,
|
|
9003
|
-
expires_at: grant.expires_at ?? team.expires_at
|
|
9126
|
+
expires_at: grant.expires_at ?? team.expires_at,
|
|
9127
|
+
oauth_client_id: clientId
|
|
9004
9128
|
};
|
|
9005
9129
|
}
|
|
9006
|
-
async function ensureConnectedBrightsyTeamTokens() {
|
|
9007
|
-
await ensureBrightsyLocalConfigFresh().catch(
|
|
9130
|
+
async function ensureConnectedBrightsyTeamTokens(opts) {
|
|
9131
|
+
await ensureBrightsyLocalConfigFresh({ fetchImpl: opts?.fetchImpl }).catch(
|
|
9132
|
+
() => null
|
|
9133
|
+
);
|
|
9008
9134
|
const teams = readStore4();
|
|
9009
9135
|
if (teams.length === 0) return [];
|
|
9010
9136
|
const next = [];
|
|
@@ -9014,8 +9140,8 @@ async function ensureConnectedBrightsyTeamTokens() {
|
|
|
9014
9140
|
next.push(team);
|
|
9015
9141
|
continue;
|
|
9016
9142
|
}
|
|
9017
|
-
const refreshed = await refreshTeamToken(team);
|
|
9018
|
-
if (refreshed.access_token !== team.access_token || refreshed.refresh_token !== team.refresh_token || refreshed.expires_at !== team.expires_at) {
|
|
9143
|
+
const refreshed = await refreshTeamToken(team, opts);
|
|
9144
|
+
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) {
|
|
9019
9145
|
changed = true;
|
|
9020
9146
|
}
|
|
9021
9147
|
next.push(refreshed);
|
|
@@ -9045,7 +9171,8 @@ function ensureCliTeamTracked(meta) {
|
|
|
9045
9171
|
access_token: cfg.access_token,
|
|
9046
9172
|
refresh_token: cfg.refresh_token,
|
|
9047
9173
|
expires_at: cfg.expires_at,
|
|
9048
|
-
endpoint: cfg.endpoint
|
|
9174
|
+
endpoint: cfg.endpoint,
|
|
9175
|
+
oauth_client_id: cfg.oauth_client_id
|
|
9049
9176
|
};
|
|
9050
9177
|
writeStore2([...existing, team]);
|
|
9051
9178
|
} catch {
|
|
@@ -9847,6 +9974,7 @@ function teamEnv(team) {
|
|
|
9847
9974
|
return {
|
|
9848
9975
|
BRIGHTSY_API_TOKEN: team.access_token,
|
|
9849
9976
|
...team.refresh_token ? { BRIGHTSY_REFRESH_TOKEN: team.refresh_token } : {},
|
|
9977
|
+
...team.oauth_client_id ? { BRIGHTSY_OAUTH_CLIENT_ID: team.oauth_client_id } : {},
|
|
9850
9978
|
BRIGHTSY_ACCOUNT_ID: team.id,
|
|
9851
9979
|
BRIGHTSY_API_URL: endpoint
|
|
9852
9980
|
};
|
|
@@ -10030,8 +10158,16 @@ function toOpencodeMcpConfigContent(servers, opts) {
|
|
|
10030
10158
|
}
|
|
10031
10159
|
return JSON.stringify({ mcp });
|
|
10032
10160
|
}
|
|
10033
|
-
function
|
|
10034
|
-
|
|
10161
|
+
function stripElectronFromUserMcpEntry(entry) {
|
|
10162
|
+
const next = { ...entry };
|
|
10163
|
+
const env = next.env;
|
|
10164
|
+
if (!env || typeof env !== "object" || Array.isArray(env)) return next;
|
|
10165
|
+
const cleaned = { ...env };
|
|
10166
|
+
delete cleaned.ELECTRON_RUN_AS_NODE;
|
|
10167
|
+
next.env = cleaned;
|
|
10168
|
+
return next;
|
|
10169
|
+
}
|
|
10170
|
+
function writeMcpServersConfig(servers, extraServers) {
|
|
10035
10171
|
const mcpServers = {};
|
|
10036
10172
|
for (const s of servers) {
|
|
10037
10173
|
const env = mcpSpawnEnv(s.env);
|
|
@@ -10041,6 +10177,14 @@ function writeMcpServersConfig(servers) {
|
|
|
10041
10177
|
...env ? { env } : {}
|
|
10042
10178
|
};
|
|
10043
10179
|
}
|
|
10180
|
+
if (extraServers) {
|
|
10181
|
+
for (const [rawName, entry] of Object.entries(extraServers)) {
|
|
10182
|
+
const name = rawName.trim();
|
|
10183
|
+
if (!name || mcpServers[name] || !entry) continue;
|
|
10184
|
+
mcpServers[name] = stripElectronFromUserMcpEntry(entry);
|
|
10185
|
+
}
|
|
10186
|
+
}
|
|
10187
|
+
if (Object.keys(mcpServers).length === 0) return null;
|
|
10044
10188
|
const dir = (0, import_node_fs26.mkdtempSync)((0, import_node_path29.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
|
|
10045
10189
|
const cfgPath = (0, import_node_path29.join)(dir, "mcp.json");
|
|
10046
10190
|
(0, import_node_fs26.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
|
|
@@ -10180,10 +10324,20 @@ function listUserOpencodeMcpNames(home = (0, import_node_os11.homedir)()) {
|
|
|
10180
10324
|
}
|
|
10181
10325
|
return names;
|
|
10182
10326
|
}
|
|
10183
|
-
function
|
|
10327
|
+
function userClaudeMcpConfigObject(home = (0, import_node_os11.homedir)()) {
|
|
10184
10328
|
const claudePath = home === (0, import_node_os11.homedir)() ? userClaudeMcpConfigPath() : (0, import_node_path31.join)(home, ".claude.json");
|
|
10185
|
-
if (!(0, import_node_fs28.existsSync)(claudePath)) return
|
|
10186
|
-
return
|
|
10329
|
+
if (!(0, import_node_fs28.existsSync)(claudePath)) return {};
|
|
10330
|
+
return asObject(asObject(readJsonObject(claudePath)).mcpServers);
|
|
10331
|
+
}
|
|
10332
|
+
function listUserClaudeMcpServerEntries(home = (0, import_node_os11.homedir)()) {
|
|
10333
|
+
const out = {};
|
|
10334
|
+
for (const [rawName, value] of Object.entries(userClaudeMcpConfigObject(home))) {
|
|
10335
|
+
const name = rawName.trim();
|
|
10336
|
+
if (!name || isInjectedOrchMcpName(name)) continue;
|
|
10337
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) continue;
|
|
10338
|
+
out[name] = value;
|
|
10339
|
+
}
|
|
10340
|
+
return out;
|
|
10187
10341
|
}
|
|
10188
10342
|
function toCodexDisableUserMcpArgs(names) {
|
|
10189
10343
|
const args = [];
|
|
@@ -11172,6 +11326,7 @@ var init_claude = __esm({
|
|
|
11172
11326
|
});
|
|
11173
11327
|
const injectedBrightsyNames = injectedServers.filter((s) => s.name === "brightsy" || s.name.startsWith("brightsy_")).map((s) => s.name);
|
|
11174
11328
|
const chromeOn = claudeChromeEnabled();
|
|
11329
|
+
const userMcpEntries = isOrchestrator ? {} : listUserClaudeMcpServerEntries();
|
|
11175
11330
|
let allowedTools;
|
|
11176
11331
|
if (isOrchestrator) {
|
|
11177
11332
|
allowedTools = [
|
|
@@ -11182,7 +11337,7 @@ var init_claude = __esm({
|
|
|
11182
11337
|
} else {
|
|
11183
11338
|
allowedTools = [
|
|
11184
11339
|
...BASE_ALLOWED_TOOLS,
|
|
11185
|
-
...mcpAllowToolsFromNames(
|
|
11340
|
+
...mcpAllowToolsFromNames(Object.keys(userMcpEntries)),
|
|
11186
11341
|
...sideboardWorktreeAllowedTools({
|
|
11187
11342
|
github: true,
|
|
11188
11343
|
linear: isLinearConnected(),
|
|
@@ -11207,7 +11362,7 @@ var init_claude = __esm({
|
|
|
11207
11362
|
if (systemPrompt) {
|
|
11208
11363
|
args.push("--append-system-prompt", systemPrompt);
|
|
11209
11364
|
}
|
|
11210
|
-
const mcpConfigPath = writeMcpServersConfig(injectedServers);
|
|
11365
|
+
const mcpConfigPath = writeMcpServersConfig(injectedServers, userMcpEntries);
|
|
11211
11366
|
if (mcpConfigPath) {
|
|
11212
11367
|
args.push("--mcp-config", mcpConfigPath);
|
|
11213
11368
|
args.push("--strict-mcp-config");
|
|
@@ -16140,12 +16295,12 @@ async function ensureAbleTimeAccessToken() {
|
|
|
16140
16295
|
return access;
|
|
16141
16296
|
}
|
|
16142
16297
|
if (refresh) {
|
|
16143
|
-
if (!
|
|
16144
|
-
|
|
16145
|
-
|
|
16298
|
+
if (!refreshInFlight2) {
|
|
16299
|
+
refreshInFlight2 = refreshAbleTimeAccessToken(refresh).finally(() => {
|
|
16300
|
+
refreshInFlight2 = null;
|
|
16146
16301
|
});
|
|
16147
16302
|
}
|
|
16148
|
-
return
|
|
16303
|
+
return refreshInFlight2;
|
|
16149
16304
|
}
|
|
16150
16305
|
return access || null;
|
|
16151
16306
|
}
|
|
@@ -16268,7 +16423,7 @@ async function startAbleTimeOAuth(opts) {
|
|
|
16268
16423
|
return loadAppSettings();
|
|
16269
16424
|
}
|
|
16270
16425
|
}
|
|
16271
|
-
var import_node_crypto9, 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,
|
|
16426
|
+
var import_node_crypto9, 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;
|
|
16272
16427
|
var init_abletime_oauth = __esm({
|
|
16273
16428
|
"src/integrations/abletime-oauth.ts"() {
|
|
16274
16429
|
"use strict";
|
|
@@ -16285,7 +16440,7 @@ var init_abletime_oauth = __esm({
|
|
|
16285
16440
|
BAKED_ABLETIME_OAUTH_CLIENT_ID = "https://www.sideboard.cloud/oauth/abletime-client.json";
|
|
16286
16441
|
ABLETIME_OAUTH_RESOURCE = `${DEFAULT_ABLETIME_HOST}/api/public/v2/mcp`;
|
|
16287
16442
|
REFRESH_SKEW_MS2 = 5 * 6e4;
|
|
16288
|
-
|
|
16443
|
+
refreshInFlight2 = null;
|
|
16289
16444
|
ABLETIME_OAUTH_CANCELLED = "AbleTime sign-in cancelled";
|
|
16290
16445
|
AbleTimeOAuthCancelledError = class extends Error {
|
|
16291
16446
|
constructor(message = ABLETIME_OAUTH_CANCELLED) {
|
|
@@ -24165,7 +24320,7 @@ async function persistLinearTokens(data, viewer) {
|
|
|
24165
24320
|
organizationName: viewer?.organizationName
|
|
24166
24321
|
});
|
|
24167
24322
|
}
|
|
24168
|
-
var
|
|
24323
|
+
var refreshInFlight3 = null;
|
|
24169
24324
|
async function refreshLinearAccessToken(refreshToken) {
|
|
24170
24325
|
const { clientId, clientSecret } = linearOAuthCredentials();
|
|
24171
24326
|
const body = new URLSearchParams({
|
|
@@ -24196,12 +24351,12 @@ async function getLinearAuthToken(settings = loadAppSettings()) {
|
|
|
24196
24351
|
return access;
|
|
24197
24352
|
}
|
|
24198
24353
|
if (refresh) {
|
|
24199
|
-
if (!
|
|
24200
|
-
|
|
24201
|
-
|
|
24354
|
+
if (!refreshInFlight3) {
|
|
24355
|
+
refreshInFlight3 = refreshLinearAccessToken(refresh).finally(() => {
|
|
24356
|
+
refreshInFlight3 = null;
|
|
24202
24357
|
});
|
|
24203
24358
|
}
|
|
24204
|
-
return
|
|
24359
|
+
return refreshInFlight3.catch((err) => {
|
|
24205
24360
|
if (apiKey) return apiKey;
|
|
24206
24361
|
throw err;
|
|
24207
24362
|
});
|
package/dist/mcp/run-stdio.js
CHANGED
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
syncBoardPins,
|
|
51
51
|
updateSchedule,
|
|
52
52
|
waitForDetachedJob
|
|
53
|
-
} from "../chunk-
|
|
53
|
+
} from "../chunk-ALDVGAIO.js";
|
|
54
54
|
import "../chunk-JFOPOMK7.js";
|
|
55
55
|
import "../chunk-YWI3IBP2.js";
|
|
56
56
|
import {
|
|
@@ -61,14 +61,14 @@ import {
|
|
|
61
61
|
materializeSystemCaBundle,
|
|
62
62
|
sideboardMcpProfile,
|
|
63
63
|
trustSystemCertificates
|
|
64
|
-
} from "../chunk-
|
|
64
|
+
} from "../chunk-3Y4FIARC.js";
|
|
65
65
|
import {
|
|
66
66
|
GLOBAL_WORKSPACE_ID,
|
|
67
67
|
isCloudCoordinatorThread,
|
|
68
68
|
listWorkspaces
|
|
69
|
-
} from "../chunk-
|
|
70
|
-
import "../chunk-
|
|
71
|
-
import "../chunk-
|
|
69
|
+
} from "../chunk-P2EAAM3H.js";
|
|
70
|
+
import "../chunk-UNMMKZ4Q.js";
|
|
71
|
+
import "../chunk-P2BSMNHB.js";
|
|
72
72
|
import "../chunk-CLI5DVU4.js";
|
|
73
73
|
import "../chunk-HSYE5ID6.js";
|
|
74
74
|
import {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
5
|
+
BRIGHTSY_OAUTH_REDIRECT,
|
|
6
|
+
brightsyAccessTokenNeedsRefresh,
|
|
7
|
+
ensureBrightsyLocalConfigFresh,
|
|
8
|
+
ensureBrightsyOAuthClientId,
|
|
9
|
+
normalizeBrightsyEndpoint,
|
|
10
|
+
refreshBrightsyAccessToken,
|
|
11
|
+
registerBrightsyOAuthClient
|
|
12
|
+
} from "./chunk-P2BSMNHB.js";
|
|
13
|
+
import "./chunk-VKQGAWHY.js";
|
|
14
|
+
export {
|
|
15
|
+
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
16
|
+
BRIGHTSY_OAUTH_REDIRECT,
|
|
17
|
+
brightsyAccessTokenNeedsRefresh,
|
|
18
|
+
ensureBrightsyLocalConfigFresh,
|
|
19
|
+
ensureBrightsyOAuthClientId,
|
|
20
|
+
normalizeBrightsyEndpoint,
|
|
21
|
+
refreshBrightsyAccessToken,
|
|
22
|
+
registerBrightsyOAuthClient
|
|
23
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
3
|
+
BRIGHTSY_OAUTH_REDIRECT,
|
|
4
|
+
brightsyAccessTokenNeedsRefresh,
|
|
5
|
+
ensureBrightsyLocalConfigFresh,
|
|
6
|
+
ensureBrightsyOAuthClientId,
|
|
7
|
+
normalizeBrightsyEndpoint,
|
|
8
|
+
refreshBrightsyAccessToken,
|
|
9
|
+
registerBrightsyOAuthClient
|
|
10
|
+
} from "./chunk-ROPGQRPU.js";
|
|
11
|
+
import "./chunk-N7WZ6NIN.js";
|
|
12
|
+
export {
|
|
13
|
+
BRIGHTSY_OAUTH_CLIENT_ID,
|
|
14
|
+
BRIGHTSY_OAUTH_REDIRECT,
|
|
15
|
+
brightsyAccessTokenNeedsRefresh,
|
|
16
|
+
ensureBrightsyLocalConfigFresh,
|
|
17
|
+
ensureBrightsyOAuthClientId,
|
|
18
|
+
normalizeBrightsyEndpoint,
|
|
19
|
+
refreshBrightsyAccessToken,
|
|
20
|
+
registerBrightsyOAuthClient
|
|
21
|
+
};
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
resolveSendFollowUp,
|
|
11
11
|
startOrchestration,
|
|
12
12
|
waitForPidExit
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ALDVGAIO.js";
|
|
14
14
|
import "./chunk-JFOPOMK7.js";
|
|
15
15
|
import "./chunk-YWI3IBP2.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-3Y4FIARC.js";
|
|
17
|
+
import "./chunk-P2EAAM3H.js";
|
|
18
|
+
import "./chunk-UNMMKZ4Q.js";
|
|
19
|
+
import "./chunk-P2BSMNHB.js";
|
|
20
20
|
import "./chunk-VKQGAWHY.js";
|
|
21
21
|
import "./chunk-NFWPDEN4.js";
|
|
22
22
|
import "./chunk-D6JWYJ4P.js";
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
resolveSendFollowUp,
|
|
9
9
|
startOrchestration,
|
|
10
10
|
waitForPidExit
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-B73KKJQB.js";
|
|
12
12
|
import "./chunk-DJU54RYW.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-YG2X34EF.js";
|
|
14
|
+
import "./chunk-N2VST3NL.js";
|
|
15
15
|
import "./chunk-KTZESHYH.js";
|
|
16
16
|
import "./chunk-6K64FJDD.js";
|
|
17
17
|
import "./chunk-PO4M4JAJ.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-QILV2BRW.js";
|
|
19
|
+
import "./chunk-ROPGQRPU.js";
|
|
20
20
|
import "./chunk-N7WZ6NIN.js";
|
|
21
21
|
import "./chunk-AXQ4ZWHK.js";
|
|
22
22
|
import "./chunk-TQBUXKIB.js";
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
addWorkspace,
|
|
3
3
|
ensureWorkspace,
|
|
4
4
|
listWorkspaces,
|
|
5
|
+
primaryCheckoutFromLinkedWorktree,
|
|
5
6
|
removeWorkspace,
|
|
6
7
|
syncWorkspacesFromThreads
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-N2VST3NL.js";
|
|
8
9
|
import "./chunk-KTZESHYH.js";
|
|
9
10
|
import "./chunk-6K64FJDD.js";
|
|
10
11
|
import "./chunk-PO4M4JAJ.js";
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
addWorkspace,
|
|
22
23
|
ensureWorkspace,
|
|
23
24
|
listWorkspaces,
|
|
25
|
+
primaryCheckoutFromLinkedWorktree,
|
|
24
26
|
removeWorkspace,
|
|
25
27
|
syncWorkspacesFromThreads
|
|
26
28
|
};
|
|
@@ -4,9 +4,10 @@ import {
|
|
|
4
4
|
addWorkspace,
|
|
5
5
|
ensureWorkspace,
|
|
6
6
|
listWorkspaces,
|
|
7
|
+
primaryCheckoutFromLinkedWorktree,
|
|
7
8
|
removeWorkspace,
|
|
8
9
|
syncWorkspacesFromThreads
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P2EAAM3H.js";
|
|
10
11
|
import "./chunk-NFWPDEN4.js";
|
|
11
12
|
import "./chunk-D6JWYJ4P.js";
|
|
12
13
|
import "./chunk-HY2GFZ5S.js";
|
|
@@ -23,6 +24,7 @@ export {
|
|
|
23
24
|
addWorkspace,
|
|
24
25
|
ensureWorkspace,
|
|
25
26
|
listWorkspaces,
|
|
27
|
+
primaryCheckoutFromLinkedWorktree,
|
|
26
28
|
removeWorkspace,
|
|
27
29
|
syncWorkspacesFromThreads
|
|
28
30
|
};
|