@sideboard-ai/core 0.1.173 → 0.1.175
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abletime-PCLL36HW.js → abletime-BFIDZR3O.js} +2 -2
- package/dist/{abletime-7VW4EGPT.js → abletime-INEHQH6K.js} +2 -2
- package/dist/agents/cursor-runner.cjs +91 -62
- package/dist/agents/cursor-runner.js +1 -1
- package/dist/{agents-CTWLBPCV.js → agents-2W7LP7JR.js} +6 -6
- package/dist/{agents-7UTRNLXQ.js → agents-AWSFDB47.js} +7 -7
- package/dist/{chunk-QYZYDO3F.js → chunk-7JIYKYLL.js} +26 -5
- package/dist/{chunk-PXNOT6NV.js → chunk-7O53GXTA.js} +26 -5
- package/dist/{chunk-M267JPEA.js → chunk-AN3THU7F.js} +1 -1
- package/dist/{chunk-AQPVBVJE.js → chunk-BBNUL4IE.js} +1 -1
- package/dist/{chunk-LZ6QMEQC.js → chunk-HVIEYTUK.js} +1 -1
- package/dist/{chunk-XD2BAANL.js → chunk-IEEAVWAP.js} +6 -6
- package/dist/{chunk-WE34LOLO.js → chunk-JIWRBNSO.js} +22 -21
- package/dist/{chunk-ELBYOGVA.js → chunk-N7WZ6NIN.js} +10 -1
- package/dist/{chunk-2RM6BZQ2.js → chunk-NA7P3SZL.js} +4 -4
- package/dist/{chunk-XXIH6XYR.js → chunk-NQTKRAUF.js} +167 -35
- package/dist/{chunk-3F7AXVIL.js → chunk-QTJ2ERA6.js} +6 -6
- package/dist/{chunk-SKKEJZEX.js → chunk-RCICB4OM.js} +19 -18
- package/dist/{chunk-CMJ2FBBV.js → chunk-RE2YWFUQ.js} +1 -1
- package/dist/{chunk-234EKD2F.js → chunk-TNOLCU5B.js} +4 -4
- package/dist/{chunk-6GN5WPYZ.js → chunk-VKQGAWHY.js} +10 -1
- package/dist/{chunk-S42XV45P.js → chunk-Y4MIXGPA.js} +1 -1
- package/dist/{chunk-6X6KMUI2.js → chunk-ZXHV3NHY.js} +225 -96
- package/dist/{connected-teams-DBWAMP7G.js → connected-teams-ON2KIKQX.js} +3 -3
- package/dist/{connected-teams-WGONUQOF.js → connected-teams-WOYCH7FR.js} +3 -3
- package/dist/{coordinator-prompt-7CTI6HRH.js → coordinator-prompt-7OHKB5WV.js} +2 -2
- package/dist/{coordinator-prompt-PM6MPYYB.js → coordinator-prompt-XCQCGUED.js} +2 -2
- package/dist/{global-workspace-CMYSFRCM.js → global-workspace-KPROJ54C.js} +2 -2
- package/dist/{global-workspace-CRJ6ZVIY.js → global-workspace-WSQNEALF.js} +2 -2
- package/dist/index.cjs +600 -386
- package/dist/index.d.cts +49 -8
- package/dist/index.d.ts +49 -8
- package/dist/index.js +74 -28
- package/dist/mcp/run-stdio.cjs +795 -581
- package/dist/mcp/run-stdio.js +75 -26
- package/dist/{oauth-A7XXI2TM.js → oauth-6ZQ4Q4XN.js} +2 -2
- package/dist/{oauth-YJBAURIJ.js → oauth-O7UGLZOY.js} +2 -2
- package/dist/{orchestrator-PEOUSLAY.js → orchestrator-PDEU75EE.js} +8 -8
- package/dist/{orchestrator-QBB2RELD.js → orchestrator-QSNGJ2ER.js} +7 -7
- package/dist/{workspaces-L73MCDFA.js → workspaces-P66DGCZE.js} +2 -2
- package/dist/{workspaces-UYSD2STS.js → workspaces-TEBTNS2M.js} +2 -2
- package/dist/{worktree-SQD3DBYC.js → worktree-LC4VRWDM.js} +1 -1
- package/dist/{worktree-WVEDT3FM.js → worktree-UTDBQXSS.js} +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4054,18 +4054,35 @@ function teamSlugFromName(name) {
|
|
|
4054
4054
|
function normalizeTakenSlug(raw) {
|
|
4055
4055
|
return raw.toLowerCase().replace(/^thread\//, "").replace(/\/+$/, "");
|
|
4056
4056
|
}
|
|
4057
|
+
function soccerTokenFromTakenSlug(raw) {
|
|
4058
|
+
const normalized = normalizeTakenSlug(raw);
|
|
4059
|
+
if (!normalized) return null;
|
|
4060
|
+
const withoutTicket = normalized.replace(/^[a-z]{2,8}-\d{1,6}-/, "").replace(/^\d{1,8}-/, "");
|
|
4061
|
+
const lookup = withoutTicket || normalized;
|
|
4062
|
+
const suffixMatch = lookup.match(/^(.+)-(\d+)$/);
|
|
4063
|
+
const base = suffixMatch?.[1] ?? lookup;
|
|
4064
|
+
const team = FAMOUS_SOCCER_TEAM_SEEDS.find((t) => t.slug === base);
|
|
4065
|
+
if (!team) return null;
|
|
4066
|
+
return suffixMatch ? `${team.slug}-${suffixMatch[2]}` : team.slug;
|
|
4067
|
+
}
|
|
4068
|
+
function addTakenSlug(out, raw) {
|
|
4069
|
+
const normalized = normalizeTakenSlug(raw);
|
|
4070
|
+
if (!normalized) return;
|
|
4071
|
+
out.add(normalized);
|
|
4072
|
+
const token = soccerTokenFromTakenSlug(normalized);
|
|
4073
|
+
if (token) out.add(token);
|
|
4074
|
+
}
|
|
4057
4075
|
function takenSlugsFromThread(thread) {
|
|
4058
4076
|
const out = /* @__PURE__ */ new Set();
|
|
4059
4077
|
const titleSlug = thread.title ? teamSlugFromName(thread.title) : null;
|
|
4060
4078
|
if (titleSlug) out.add(normalizeTakenSlug(titleSlug));
|
|
4061
4079
|
if (thread.branchName?.trim()) {
|
|
4062
|
-
|
|
4063
|
-
if (branch) out.add(branch);
|
|
4080
|
+
addTakenSlug(out, thread.branchName.trim());
|
|
4064
4081
|
}
|
|
4065
4082
|
if (thread.worktreePath) {
|
|
4066
4083
|
const parts = thread.worktreePath.replace(/\/+$/, "").split("/");
|
|
4067
4084
|
const dir = parts[parts.length - 1];
|
|
4068
|
-
if (dir) out
|
|
4085
|
+
if (dir) addTakenSlug(out, dir);
|
|
4069
4086
|
}
|
|
4070
4087
|
return [...out];
|
|
4071
4088
|
}
|
|
@@ -7323,12 +7340,16 @@ function collectTakenTeamSlugs(repoPath) {
|
|
|
7323
7340
|
if ((0, import_node_fs18.existsSync)(root)) {
|
|
7324
7341
|
for (const entry of (0, import_node_fs18.readdirSync)(root, { withFileTypes: true })) {
|
|
7325
7342
|
if (entry.isDirectory() && entry.name !== ".DS_Store") {
|
|
7326
|
-
|
|
7343
|
+
for (const slug of takenSlugsFromThread({ worktreePath: entry.name })) {
|
|
7344
|
+
taken.add(slug);
|
|
7345
|
+
}
|
|
7327
7346
|
}
|
|
7328
7347
|
}
|
|
7329
7348
|
}
|
|
7330
7349
|
for (const slug of listLocalThreadBranchSlugs(repoPath)) {
|
|
7331
|
-
|
|
7350
|
+
for (const token of takenSlugsFromThread({ branchName: slug })) {
|
|
7351
|
+
taken.add(token);
|
|
7352
|
+
}
|
|
7332
7353
|
}
|
|
7333
7354
|
for (const thread of listThreads({ includeArchived: true })) {
|
|
7334
7355
|
if (!sameRepoPath(thread.repoPath, repoPath)) continue;
|
|
@@ -7663,8 +7684,8 @@ function ensureGlobalCoordinatorCwd(opts) {
|
|
|
7663
7684
|
"",
|
|
7664
7685
|
"When creating threads, pass `repoPath` from `list_workspaces` (or the path you just registered).",
|
|
7665
7686
|
orchId ? `Pass parentThreadId="${orchId}" (or omit it). Never invent another parentThreadId.` : "Pass `parentThreadId` for children (this chat's id from the turn reminder).",
|
|
7666
|
-
"Omit `agent` / `model` on `create_thread
|
|
7667
|
-
"Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent
|
|
7687
|
+
"Omit `agent` / `model` on `create_thread`. Sideboard applies Settings \u2192 Default agent, model & effort. Do not pass your own agent or `agent=cursor` \u2014 those are ignored.",
|
|
7688
|
+
"Never pass `agent=codex` when you yourself are Codex \u2014 nested Codex deadlocks on shared ~/.codex locks. Omit agent; Sideboard applies Account defaults (and coerces only that nested-Codex case).",
|
|
7668
7689
|
"Typical flow (Home board): list_board \u2192 create_thread (sourceType=ticket|pr|branch) \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft \u2192 wait_for_turn. Merge only if the user explicitly asked (`ask_git` merge).",
|
|
7669
7690
|
"Typical flow (branch / explicit source): list_workspaces \u2192 list_branches|list_prs|list_issues \u2192 create_thread \u2192 send_to_thread \u2192 wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
|
|
7670
7691
|
"Typical flow (find work): list_workspaces \u2192 pick repo(s) matching account / project context \u2192 Sideboard list_issues / linear_* (tickets) or list_prs(queue=review) (reviews) \u2192 show the options. Never wait on Claude Linear MCP. Only create_thread + send_to_thread when they asked to start (e.g. \u201Cfind me work and start it\u201D) \u2014 then wait_for_turn (loop while stillRunning) \u2192 ask_git create-draft.",
|
|
@@ -7741,7 +7762,7 @@ var init_coordinator_prompt = __esm({
|
|
|
7741
7762
|
"Workspaces:",
|
|
7742
7763
|
"- add_workspace / remove_workspace \u2014 register or unregister a git repo",
|
|
7743
7764
|
"Worktree threads (chats):",
|
|
7744
|
-
"- create_thread \u2014 create a worktree + chat from branch | pr | ticket (appears on Home). Do not create a second worktree for a ticket, PR, or named branch that already has one \u2014 that call returns the live thread (alreadyStarted=true). Creating from the default branch still opens a new isolated worktree. Pass repoPath + parentThreadId; omit agent and model
|
|
7765
|
+
"- create_thread \u2014 create a worktree + chat from branch | pr | ticket (appears on Home). Do not create a second worktree for a ticket, PR, or named branch that already has one \u2014 that call returns the live thread (alreadyStarted=true). Creating from the default branch still opens a new isolated worktree. Pass repoPath + parentThreadId; omit agent and model so Sideboard applies Settings \u2192 Default agent, model & effort (never pass your own agent or agent=cursor). If the repo has a setup script, Sideboard runs it in the background (does not block send_to_thread). Nested Codex (you are Codex and the child is Codex) deadlocks \u2014 omit agent; Sideboard coerces that case",
|
|
7745
7766
|
"- start_board_card \u2014 same as create_thread for a ticket/PR/named branch (attaches issue text when resolvable). Then send_to_thread.",
|
|
7746
7767
|
"- fork_worktree \u2014 fork a worktree chat into a NEW git worktree + chat (transcript attached); optional agent; leave model unset (Auto) unless you have a reason. Not for orchestration chats.",
|
|
7747
7768
|
"- fork_chat \u2014 fork a worktree chat (same worktree tab) OR a Global orchestration chat (new orchestration tab); optional agent; leave model unset (Auto) unless you have a reason. Remote coordinators: use this to continue another orchestration chat on a different agent after session limits.",
|
|
@@ -8922,17 +8943,24 @@ var init_config = __esm({
|
|
|
8922
8943
|
function setHttpFetchImpl(fetchImpl) {
|
|
8923
8944
|
injected = fetchImpl;
|
|
8924
8945
|
}
|
|
8946
|
+
function tlsIssuerHint(code, message) {
|
|
8947
|
+
const text7 = `${code ?? ""} ${message}`;
|
|
8948
|
+
return TLS_ISSUER_RE.test(text7) ? TLS_ISSUER_HINT : "";
|
|
8949
|
+
}
|
|
8925
8950
|
function formatFetchError(err, url) {
|
|
8926
8951
|
if (!(err instanceof Error)) return `${String(err)} (${url})`;
|
|
8927
8952
|
const cause = err.cause;
|
|
8928
8953
|
let detail = "";
|
|
8954
|
+
let hint = tlsIssuerHint(void 0, err.message);
|
|
8929
8955
|
if (cause instanceof Error) {
|
|
8930
8956
|
const code = typeof cause.code === "string" ? cause.code : void 0;
|
|
8931
8957
|
detail = code ? ` [${code}: ${cause.message}]` : ` [${cause.message}]`;
|
|
8958
|
+
hint = tlsIssuerHint(code, `${err.message} ${cause.message}`) || hint;
|
|
8932
8959
|
} else if (cause != null) {
|
|
8933
8960
|
detail = ` [${String(cause)}]`;
|
|
8961
|
+
hint = tlsIssuerHint(void 0, String(cause)) || hint;
|
|
8934
8962
|
}
|
|
8935
|
-
return `${err.message}${detail} (${url})`;
|
|
8963
|
+
return `${err.message}${detail} (${url})${hint}`;
|
|
8936
8964
|
}
|
|
8937
8965
|
async function httpFetch(input, init) {
|
|
8938
8966
|
const url = typeof input === "string" ? input : input.href;
|
|
@@ -8943,11 +8971,13 @@ async function httpFetch(input, init) {
|
|
|
8943
8971
|
throw new Error(formatFetchError(err, url));
|
|
8944
8972
|
}
|
|
8945
8973
|
}
|
|
8946
|
-
var injected;
|
|
8974
|
+
var injected, TLS_ISSUER_RE, TLS_ISSUER_HINT;
|
|
8947
8975
|
var init_fetch = __esm({
|
|
8948
8976
|
"src/http/fetch.ts"() {
|
|
8949
8977
|
"use strict";
|
|
8950
8978
|
injected = null;
|
|
8979
|
+
TLS_ISSUER_RE = /UNABLE_TO_GET_ISSUER_CERT|UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT_IN_CHAIN/i;
|
|
8980
|
+
TLS_ISSUER_HINT = " \u2014 Node rejected the TLS certificate (corporate VPN/proxy CA). Desktop Linear can still work; reconnecting the API key will not fix this.";
|
|
8951
8981
|
}
|
|
8952
8982
|
});
|
|
8953
8983
|
|
|
@@ -10500,6 +10530,138 @@ var init_profile = __esm({
|
|
|
10500
10530
|
}
|
|
10501
10531
|
});
|
|
10502
10532
|
|
|
10533
|
+
// src/http/system-ca.ts
|
|
10534
|
+
function splitPemCertificates(pem) {
|
|
10535
|
+
return pem.match(PEM_CERT_RE) ?? [];
|
|
10536
|
+
}
|
|
10537
|
+
function readExistingFile(path2) {
|
|
10538
|
+
try {
|
|
10539
|
+
return (0, import_node_fs26.existsSync)(path2) ? (0, import_node_fs26.readFileSync)(path2, "utf8") : "";
|
|
10540
|
+
} catch {
|
|
10541
|
+
return "";
|
|
10542
|
+
}
|
|
10543
|
+
}
|
|
10544
|
+
function darwinKeychainPem(spawn2) {
|
|
10545
|
+
const result = spawn2("/usr/bin/security", ["find-certificate", "-a", "-p"], {
|
|
10546
|
+
encoding: "utf8",
|
|
10547
|
+
maxBuffer: 32 * 1024 * 1024,
|
|
10548
|
+
timeout: 15e3
|
|
10549
|
+
});
|
|
10550
|
+
if (result.status !== 0) return "";
|
|
10551
|
+
return typeof result.stdout === "string" ? result.stdout : "";
|
|
10552
|
+
}
|
|
10553
|
+
function linuxSystemCaPem() {
|
|
10554
|
+
for (const path2 of LINUX_CA_FILES) {
|
|
10555
|
+
const pem = readExistingFile(path2);
|
|
10556
|
+
if (splitPemCertificates(pem).length > 0) return pem;
|
|
10557
|
+
}
|
|
10558
|
+
return "";
|
|
10559
|
+
}
|
|
10560
|
+
function collectSystemCaPem(io = {}) {
|
|
10561
|
+
const platform = io.platform ?? process.platform;
|
|
10562
|
+
if (platform === "darwin") {
|
|
10563
|
+
return darwinKeychainPem(io.spawn ?? import_node_child_process4.spawnSync);
|
|
10564
|
+
}
|
|
10565
|
+
if (platform === "linux") {
|
|
10566
|
+
return linuxSystemCaPem();
|
|
10567
|
+
}
|
|
10568
|
+
return "";
|
|
10569
|
+
}
|
|
10570
|
+
function systemCaBundlePath(io = {}) {
|
|
10571
|
+
return (0, import_node_path28.join)((io.appData ?? appDataDir)(), BUNDLE_NAME);
|
|
10572
|
+
}
|
|
10573
|
+
function bundleIsFresh(path2, now) {
|
|
10574
|
+
try {
|
|
10575
|
+
if (!(0, import_node_fs26.existsSync)(path2)) return false;
|
|
10576
|
+
if (splitPemCertificates((0, import_node_fs26.readFileSync)(path2, "utf8")).length === 0) return false;
|
|
10577
|
+
return now - (0, import_node_fs26.statSync)(path2).mtimeMs < BUNDLE_MAX_AGE_MS;
|
|
10578
|
+
} catch {
|
|
10579
|
+
return false;
|
|
10580
|
+
}
|
|
10581
|
+
}
|
|
10582
|
+
function materializeSystemCaBundle(io = {}) {
|
|
10583
|
+
const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
10584
|
+
if (inherited && splitPemCertificates(readExistingFile(inherited)).length > 0) {
|
|
10585
|
+
return inherited;
|
|
10586
|
+
}
|
|
10587
|
+
const platform = io.platform ?? process.platform;
|
|
10588
|
+
if (platform === "linux") {
|
|
10589
|
+
for (const path2 of LINUX_CA_FILES) {
|
|
10590
|
+
if (splitPemCertificates(readExistingFile(path2)).length > 0) return path2;
|
|
10591
|
+
}
|
|
10592
|
+
}
|
|
10593
|
+
const dest = systemCaBundlePath(io);
|
|
10594
|
+
const now = (io.now ?? Date.now)();
|
|
10595
|
+
if (bundleIsFresh(dest, now)) return dest;
|
|
10596
|
+
const pem = collectSystemCaPem(io);
|
|
10597
|
+
if (splitPemCertificates(pem).length === 0) {
|
|
10598
|
+
return (0, import_node_fs26.existsSync)(dest) && splitPemCertificates(readExistingFile(dest)).length > 0 ? dest : void 0;
|
|
10599
|
+
}
|
|
10600
|
+
try {
|
|
10601
|
+
(0, import_node_fs26.mkdirSync)((0, import_node_path28.dirname)(dest), { recursive: true });
|
|
10602
|
+
(0, import_node_fs26.writeFileSync)(dest, pem.endsWith("\n") ? pem : `${pem}
|
|
10603
|
+
`, { mode: 384 });
|
|
10604
|
+
return dest;
|
|
10605
|
+
} catch {
|
|
10606
|
+
return void 0;
|
|
10607
|
+
}
|
|
10608
|
+
}
|
|
10609
|
+
function applySystemCaEnv(env) {
|
|
10610
|
+
if (!String(env[NODE_USE_SYSTEM_CA] ?? "").trim()) {
|
|
10611
|
+
env[NODE_USE_SYSTEM_CA] = "1";
|
|
10612
|
+
}
|
|
10613
|
+
if (String(env[NODE_EXTRA_CA_CERTS] ?? "").trim()) return;
|
|
10614
|
+
const inherited = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
10615
|
+
if (inherited) env[NODE_EXTRA_CA_CERTS] = inherited;
|
|
10616
|
+
}
|
|
10617
|
+
function extraCertsFromBundle() {
|
|
10618
|
+
const path2 = process.env.NODE_EXTRA_CA_CERTS?.trim();
|
|
10619
|
+
if (path2) return splitPemCertificates(readExistingFile(path2));
|
|
10620
|
+
const dest = systemCaBundlePath();
|
|
10621
|
+
return splitPemCertificates(readExistingFile(dest));
|
|
10622
|
+
}
|
|
10623
|
+
function trustSystemCertificates(io = {}) {
|
|
10624
|
+
try {
|
|
10625
|
+
const api = import_node_tls.default;
|
|
10626
|
+
if (typeof api.getCACertificates !== "function" || typeof api.setDefaultCACertificates !== "function") {
|
|
10627
|
+
return false;
|
|
10628
|
+
}
|
|
10629
|
+
const current = api.getCACertificates("default");
|
|
10630
|
+
const system = api.getCACertificates("system");
|
|
10631
|
+
let extra = extraCertsFromBundle();
|
|
10632
|
+
if (system.length === 0 && extra.length === 0) {
|
|
10633
|
+
extra = splitPemCertificates(collectSystemCaPem(io));
|
|
10634
|
+
}
|
|
10635
|
+
if (system.length === 0 && extra.length === 0) return false;
|
|
10636
|
+
api.setDefaultCACertificates([...current, ...system, ...extra]);
|
|
10637
|
+
return true;
|
|
10638
|
+
} catch {
|
|
10639
|
+
return false;
|
|
10640
|
+
}
|
|
10641
|
+
}
|
|
10642
|
+
var import_node_child_process4, import_node_fs26, import_node_path28, import_node_tls, NODE_USE_SYSTEM_CA, NODE_EXTRA_CA_CERTS, BUNDLE_NAME, BUNDLE_MAX_AGE_MS, LINUX_CA_FILES, PEM_CERT_RE;
|
|
10643
|
+
var init_system_ca = __esm({
|
|
10644
|
+
"src/http/system-ca.ts"() {
|
|
10645
|
+
"use strict";
|
|
10646
|
+
import_node_child_process4 = require("child_process");
|
|
10647
|
+
import_node_fs26 = require("fs");
|
|
10648
|
+
import_node_path28 = require("path");
|
|
10649
|
+
import_node_tls = __toESM(require("tls"), 1);
|
|
10650
|
+
init_paths();
|
|
10651
|
+
NODE_USE_SYSTEM_CA = "NODE_USE_SYSTEM_CA";
|
|
10652
|
+
NODE_EXTRA_CA_CERTS = "NODE_EXTRA_CA_CERTS";
|
|
10653
|
+
BUNDLE_NAME = "system-ca.pem";
|
|
10654
|
+
BUNDLE_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
10655
|
+
LINUX_CA_FILES = [
|
|
10656
|
+
"/etc/ssl/certs/ca-certificates.crt",
|
|
10657
|
+
"/etc/pki/tls/certs/ca-bundle.crt",
|
|
10658
|
+
"/etc/ssl/ca-bundle.pem",
|
|
10659
|
+
"/etc/ssl/cert.pem"
|
|
10660
|
+
];
|
|
10661
|
+
PEM_CERT_RE = /-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g;
|
|
10662
|
+
}
|
|
10663
|
+
});
|
|
10664
|
+
|
|
10503
10665
|
// src/agents/packaged-runtime.ts
|
|
10504
10666
|
function electronResourcesPath() {
|
|
10505
10667
|
const resources = process.resourcesPath;
|
|
@@ -10509,43 +10671,43 @@ function electronResourcesPath() {
|
|
|
10509
10671
|
function packagedCursorRuntimeDir() {
|
|
10510
10672
|
const resources = electronResourcesPath();
|
|
10511
10673
|
if (!resources) return null;
|
|
10512
|
-
const dir = (0,
|
|
10513
|
-
if (!(0,
|
|
10674
|
+
const dir = (0, import_node_path29.join)(resources, "cursor-runtime");
|
|
10675
|
+
if (!(0, import_node_fs27.existsSync)((0, import_node_path29.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
|
|
10514
10676
|
return dir;
|
|
10515
10677
|
}
|
|
10516
10678
|
function packagedCursorRunnerPath() {
|
|
10517
10679
|
const dir = packagedCursorRuntimeDir();
|
|
10518
|
-
return dir ? (0,
|
|
10680
|
+
return dir ? (0, import_node_path29.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
|
|
10519
10681
|
}
|
|
10520
10682
|
function packagedMcpDir() {
|
|
10521
10683
|
const resources = electronResourcesPath();
|
|
10522
10684
|
if (!resources) return null;
|
|
10523
|
-
const dir = (0,
|
|
10524
|
-
if (!(0,
|
|
10685
|
+
const dir = (0, import_node_path29.join)(resources, "sideboard-mcp");
|
|
10686
|
+
if (!(0, import_node_fs27.existsSync)((0, import_node_path29.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
|
|
10525
10687
|
return dir;
|
|
10526
10688
|
}
|
|
10527
10689
|
function packagedMcpStdioPath() {
|
|
10528
10690
|
const dir = packagedMcpDir();
|
|
10529
|
-
return dir ? (0,
|
|
10691
|
+
return dir ? (0, import_node_path29.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
|
|
10530
10692
|
}
|
|
10531
10693
|
function packagedBundledNodePath() {
|
|
10532
10694
|
const resources = electronResourcesPath();
|
|
10533
10695
|
if (!resources) return null;
|
|
10534
|
-
const bin = (0,
|
|
10535
|
-
if (!(0,
|
|
10696
|
+
const bin = (0, import_node_path29.join)(resources, "node", "bin", "node");
|
|
10697
|
+
if (!(0, import_node_fs27.existsSync)(bin)) return null;
|
|
10536
10698
|
return bin;
|
|
10537
10699
|
}
|
|
10538
10700
|
function packagedCursorRipgrepCandidate(platformPkg, binName) {
|
|
10539
10701
|
const dir = packagedCursorRuntimeDir();
|
|
10540
10702
|
if (!dir) return null;
|
|
10541
|
-
return (0,
|
|
10703
|
+
return (0, import_node_path29.join)(dir, "node_modules", platformPkg, "bin", binName);
|
|
10542
10704
|
}
|
|
10543
|
-
var
|
|
10705
|
+
var import_node_fs27, import_node_path29;
|
|
10544
10706
|
var init_packaged_runtime = __esm({
|
|
10545
10707
|
"src/agents/packaged-runtime.ts"() {
|
|
10546
10708
|
"use strict";
|
|
10547
|
-
|
|
10548
|
-
|
|
10709
|
+
import_node_fs27 = require("fs");
|
|
10710
|
+
import_node_path29 = require("path");
|
|
10549
10711
|
}
|
|
10550
10712
|
});
|
|
10551
10713
|
|
|
@@ -10565,6 +10727,7 @@ function applyAgentRunnerHeapEnv(env) {
|
|
|
10565
10727
|
env.NODE_OPTIONS,
|
|
10566
10728
|
AGENT_RUNNER_MAX_OLD_SPACE_MB
|
|
10567
10729
|
);
|
|
10730
|
+
applySystemCaEnv(env);
|
|
10568
10731
|
}
|
|
10569
10732
|
function envWithAgentHeap(env) {
|
|
10570
10733
|
const next = { ...env };
|
|
@@ -10579,7 +10742,7 @@ function unpackedAsarPath(filePath) {
|
|
|
10579
10742
|
if (!isAsarPath(filePath)) return null;
|
|
10580
10743
|
const unpacked = filePath.replace(/\.asar(?=[/\\])/, ".asar.unpacked");
|
|
10581
10744
|
if (unpacked === filePath) return null;
|
|
10582
|
-
return (0,
|
|
10745
|
+
return (0, import_node_fs28.existsSync)(unpacked) ? unpacked : null;
|
|
10583
10746
|
}
|
|
10584
10747
|
function nodeReadableScriptPath(scriptPath) {
|
|
10585
10748
|
return unpackedAsarPath(scriptPath) ?? scriptPath;
|
|
@@ -10619,37 +10782,37 @@ function pickPreferredNode(candidates) {
|
|
|
10619
10782
|
return best;
|
|
10620
10783
|
}
|
|
10621
10784
|
function versionDirNodeBins(root, toBin) {
|
|
10622
|
-
if (!(0,
|
|
10785
|
+
if (!(0, import_node_fs28.existsSync)(root)) return [];
|
|
10623
10786
|
try {
|
|
10624
|
-
return (0,
|
|
10787
|
+
return (0, import_node_fs28.readdirSync)(root).map(toBin);
|
|
10625
10788
|
} catch {
|
|
10626
10789
|
return [];
|
|
10627
10790
|
}
|
|
10628
10791
|
}
|
|
10629
10792
|
function defaultNodeBinCandidates(home = (0, import_node_os8.homedir)()) {
|
|
10630
10793
|
const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
|
|
10631
|
-
(prefix) => PREFERRED_LTS_MAJORS.map((major) => (0,
|
|
10794
|
+
(prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path30.join)(prefix, "opt", `node@${major}`, "bin", "node"))
|
|
10632
10795
|
);
|
|
10633
10796
|
return [
|
|
10634
10797
|
...kegs,
|
|
10635
10798
|
"/opt/homebrew/bin/node",
|
|
10636
10799
|
"/usr/local/bin/node",
|
|
10637
|
-
(0,
|
|
10638
|
-
(0,
|
|
10639
|
-
(0,
|
|
10640
|
-
(0,
|
|
10641
|
-
(0,
|
|
10800
|
+
(0, import_node_path30.join)(home, ".local/share/fnm/aliases/default/bin/node"),
|
|
10801
|
+
(0, import_node_path30.join)(home, ".nvm/current/bin/node"),
|
|
10802
|
+
(0, import_node_path30.join)(home, ".volta/bin/node"),
|
|
10803
|
+
(0, import_node_path30.join)(home, ".asdf/shims/node"),
|
|
10804
|
+
(0, import_node_path30.join)(home, ".local/share/mise/shims/node"),
|
|
10642
10805
|
...versionDirNodeBins(
|
|
10643
|
-
(0,
|
|
10644
|
-
(name) => (0,
|
|
10806
|
+
(0, import_node_path30.join)(home, ".nvm", "versions", "node"),
|
|
10807
|
+
(name) => (0, import_node_path30.join)(home, ".nvm", "versions", "node", name, "bin", "node")
|
|
10645
10808
|
),
|
|
10646
10809
|
...versionDirNodeBins(
|
|
10647
|
-
(0,
|
|
10648
|
-
(name) => (0,
|
|
10810
|
+
(0, import_node_path30.join)(home, ".local/share/fnm", "node-versions"),
|
|
10811
|
+
(name) => (0, import_node_path30.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
|
|
10649
10812
|
),
|
|
10650
10813
|
...versionDirNodeBins(
|
|
10651
|
-
(0,
|
|
10652
|
-
(name) => (0,
|
|
10814
|
+
(0, import_node_path30.join)(home, ".volta", "tools", "image", "node"),
|
|
10815
|
+
(name) => (0, import_node_path30.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
|
|
10653
10816
|
)
|
|
10654
10817
|
];
|
|
10655
10818
|
}
|
|
@@ -10658,10 +10821,10 @@ function uniqueExistingNodeBins(paths) {
|
|
|
10658
10821
|
const out = [];
|
|
10659
10822
|
for (const raw of paths) {
|
|
10660
10823
|
const p = raw.trim();
|
|
10661
|
-
if (!p || !(0,
|
|
10824
|
+
if (!p || !(0, import_node_fs28.existsSync)(p) || isElectronLikeCommand(p)) continue;
|
|
10662
10825
|
let key = p;
|
|
10663
10826
|
try {
|
|
10664
|
-
key = (0,
|
|
10827
|
+
key = (0, import_node_fs28.realpathSync)(p);
|
|
10665
10828
|
} catch {
|
|
10666
10829
|
continue;
|
|
10667
10830
|
}
|
|
@@ -10741,14 +10904,15 @@ async function resolveNodeLaunch(scriptPath) {
|
|
|
10741
10904
|
env: { ELECTRON_RUN_AS_NODE: "1" }
|
|
10742
10905
|
};
|
|
10743
10906
|
}
|
|
10744
|
-
var
|
|
10907
|
+
var import_node_fs28, import_node_os8, import_node_path30, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
|
|
10745
10908
|
var init_node_launch = __esm({
|
|
10746
10909
|
"src/agents/node-launch.ts"() {
|
|
10747
10910
|
"use strict";
|
|
10748
|
-
|
|
10911
|
+
import_node_fs28 = require("fs");
|
|
10749
10912
|
import_node_os8 = require("os");
|
|
10750
|
-
|
|
10913
|
+
import_node_path30 = require("path");
|
|
10751
10914
|
init_nested_electron_env();
|
|
10915
|
+
init_system_ca();
|
|
10752
10916
|
init_run();
|
|
10753
10917
|
init_packaged_runtime();
|
|
10754
10918
|
AGENT_RUNNER_MAX_OLD_SPACE_MB = 8192;
|
|
@@ -10848,37 +11012,37 @@ function corePackageDir() {
|
|
|
10848
11012
|
try {
|
|
10849
11013
|
const url = import_meta.url;
|
|
10850
11014
|
if (typeof url === "string" && url.length > 0) {
|
|
10851
|
-
return (0,
|
|
11015
|
+
return (0, import_node_path31.dirname)((0, import_node_url.fileURLToPath)(url));
|
|
10852
11016
|
}
|
|
10853
11017
|
} catch {
|
|
10854
11018
|
}
|
|
10855
11019
|
try {
|
|
10856
|
-
const req = (0, import_node_module.createRequire)((0,
|
|
10857
|
-
return (0,
|
|
11020
|
+
const req = (0, import_node_module.createRequire)((0, import_node_path31.join)(process.cwd(), "package.json"));
|
|
11021
|
+
return (0, import_node_path31.dirname)(req.resolve("@sideboard-ai/core"));
|
|
10858
11022
|
} catch {
|
|
10859
11023
|
return process.cwd();
|
|
10860
11024
|
}
|
|
10861
11025
|
}
|
|
10862
11026
|
function findSideboardMcpJsEntry() {
|
|
10863
11027
|
const override = process.env.SIDEBOARD_MCP_ENTRY?.trim() || process.env.SIDEBOARD_CLI?.trim();
|
|
10864
|
-
if (override && (0,
|
|
11028
|
+
if (override && (0, import_node_fs29.existsSync)(override)) return override;
|
|
10865
11029
|
const packaged = packagedMcpStdioPath();
|
|
10866
11030
|
if (packaged) return packaged;
|
|
10867
11031
|
let dir = corePackageDir();
|
|
10868
11032
|
for (let i = 0; i < 10; i++) {
|
|
10869
11033
|
const candidates = [
|
|
10870
|
-
(0,
|
|
10871
|
-
(0,
|
|
10872
|
-
(0,
|
|
10873
|
-
(0,
|
|
10874
|
-
(0,
|
|
10875
|
-
(0,
|
|
10876
|
-
(0,
|
|
11034
|
+
(0, import_node_path31.join)(dir, "mcp/run-stdio.js"),
|
|
11035
|
+
(0, import_node_path31.join)(dir, "mcp/run-stdio.cjs"),
|
|
11036
|
+
(0, import_node_path31.join)(dir, "dist/mcp/run-stdio.js"),
|
|
11037
|
+
(0, import_node_path31.join)(dir, "dist/mcp/run-stdio.cjs"),
|
|
11038
|
+
(0, import_node_path31.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
|
|
11039
|
+
(0, import_node_path31.join)(dir, "packages/cli/dist/index.js"),
|
|
11040
|
+
(0, import_node_path31.join)(dir, "cli/dist/index.js")
|
|
10877
11041
|
];
|
|
10878
11042
|
for (const p of candidates) {
|
|
10879
|
-
if ((0,
|
|
11043
|
+
if ((0, import_node_fs29.existsSync)(p) && !isAsarPath(p)) return p;
|
|
10880
11044
|
}
|
|
10881
|
-
const parent = (0,
|
|
11045
|
+
const parent = (0, import_node_path31.dirname)(dir);
|
|
10882
11046
|
if (parent === dir) break;
|
|
10883
11047
|
dir = parent;
|
|
10884
11048
|
}
|
|
@@ -11025,22 +11189,22 @@ function writeMcpServersConfig(servers) {
|
|
|
11025
11189
|
...env ? { env } : {}
|
|
11026
11190
|
};
|
|
11027
11191
|
}
|
|
11028
|
-
const dir = (0,
|
|
11029
|
-
const cfgPath = (0,
|
|
11030
|
-
(0,
|
|
11192
|
+
const dir = (0, import_node_fs29.mkdtempSync)((0, import_node_path31.join)((0, import_node_os9.tmpdir)(), "sideboard-mcp-"));
|
|
11193
|
+
const cfgPath = (0, import_node_path31.join)(dir, "mcp.json");
|
|
11194
|
+
(0, import_node_fs29.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
|
|
11031
11195
|
return cfgPath;
|
|
11032
11196
|
}
|
|
11033
11197
|
async function writeInjectedMcpConfig(opts) {
|
|
11034
11198
|
return writeMcpServersConfig(await buildInjectedMcpServers(opts));
|
|
11035
11199
|
}
|
|
11036
|
-
var
|
|
11200
|
+
var import_node_fs29, import_node_module, import_node_os9, import_node_path31, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, SIDEBOARD_GITHUB_MCP_ALLOWED_TOOLS, SIDEBOARD_LINEAR_MCP_ALLOWED_TOOLS, SIDEBOARD_ABLETIME_MCP_ALLOWED_TOOLS, BRIGHTSY_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
|
|
11037
11201
|
var init_injected_mcp = __esm({
|
|
11038
11202
|
"src/agents/injected-mcp.ts"() {
|
|
11039
11203
|
"use strict";
|
|
11040
|
-
|
|
11204
|
+
import_node_fs29 = require("fs");
|
|
11041
11205
|
import_node_module = require("module");
|
|
11042
11206
|
import_node_os9 = require("os");
|
|
11043
|
-
|
|
11207
|
+
import_node_path31 = require("path");
|
|
11044
11208
|
import_node_url = require("url");
|
|
11045
11209
|
init_run();
|
|
11046
11210
|
init_config();
|
|
@@ -11427,11 +11591,11 @@ function parseIssuesJson(raw) {
|
|
|
11427
11591
|
}
|
|
11428
11592
|
return [];
|
|
11429
11593
|
}
|
|
11430
|
-
var
|
|
11594
|
+
var import_node_fs30, BASE_ALLOWED_TOOLS, CLAUDE_PRINT_BG_WAIT_CEILING_MS, CLAUDE_CHROME_ALLOWED_TOOLS, CLAUDE_PROMPT_ARG_MAX, mcpListCache, claudeAdapter;
|
|
11431
11595
|
var init_claude = __esm({
|
|
11432
11596
|
"src/agents/claude.ts"() {
|
|
11433
11597
|
"use strict";
|
|
11434
|
-
|
|
11598
|
+
import_node_fs30 = require("fs");
|
|
11435
11599
|
init_run();
|
|
11436
11600
|
init_app_settings();
|
|
11437
11601
|
init_claude_mcp();
|
|
@@ -11471,7 +11635,7 @@ var init_claude = __esm({
|
|
|
11471
11635
|
async detect() {
|
|
11472
11636
|
const claude = resolveClaudeExecutable();
|
|
11473
11637
|
if (claude !== "claude") {
|
|
11474
|
-
if (!(0,
|
|
11638
|
+
if (!(0, import_node_fs30.existsSync)(claude)) {
|
|
11475
11639
|
return {
|
|
11476
11640
|
agent: "claude",
|
|
11477
11641
|
installed: false,
|
|
@@ -11731,10 +11895,10 @@ var init_claude = __esm({
|
|
|
11731
11895
|
|
|
11732
11896
|
// src/agents/user-mcp-config.ts
|
|
11733
11897
|
function userCursorMcpConfigPath() {
|
|
11734
|
-
return (0,
|
|
11898
|
+
return (0, import_node_path32.join)((0, import_node_os10.homedir)(), ".cursor", "mcp.json");
|
|
11735
11899
|
}
|
|
11736
11900
|
function userClaudeMcpConfigPath() {
|
|
11737
|
-
return (0,
|
|
11901
|
+
return (0, import_node_path32.join)((0, import_node_os10.homedir)(), ".claude.json");
|
|
11738
11902
|
}
|
|
11739
11903
|
function asObject(value) {
|
|
11740
11904
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
@@ -11761,16 +11925,16 @@ function mergeSideboardIntoMcpServersJson(existing, sideboard) {
|
|
|
11761
11925
|
}
|
|
11762
11926
|
function writeMergedMcpServersJson(configPath, sideboard) {
|
|
11763
11927
|
let existing = {};
|
|
11764
|
-
if ((0,
|
|
11928
|
+
if ((0, import_node_fs31.existsSync)(configPath)) {
|
|
11765
11929
|
try {
|
|
11766
|
-
existing = JSON.parse((0,
|
|
11930
|
+
existing = JSON.parse((0, import_node_fs31.readFileSync)(configPath, "utf8"));
|
|
11767
11931
|
} catch {
|
|
11768
11932
|
existing = {};
|
|
11769
11933
|
}
|
|
11770
11934
|
}
|
|
11771
11935
|
const next = mergeSideboardIntoMcpServersJson(existing, sideboard);
|
|
11772
|
-
(0,
|
|
11773
|
-
(0,
|
|
11936
|
+
(0, import_node_fs31.mkdirSync)((0, import_node_path32.dirname)(configPath), { recursive: true });
|
|
11937
|
+
(0, import_node_fs31.writeFileSync)(configPath, `${JSON.stringify(next, null, 2)}
|
|
11774
11938
|
`);
|
|
11775
11939
|
}
|
|
11776
11940
|
function launchFromResolved(server) {
|
|
@@ -11788,19 +11952,19 @@ async function registerPackagedUserMcpClients() {
|
|
|
11788
11952
|
const cursor = userCursorMcpConfigPath();
|
|
11789
11953
|
writeMergedMcpServersJson(cursor, launch);
|
|
11790
11954
|
const claude = userClaudeMcpConfigPath();
|
|
11791
|
-
if ((0,
|
|
11955
|
+
if ((0, import_node_fs31.existsSync)(claude)) {
|
|
11792
11956
|
writeMergedMcpServersJson(claude, launch);
|
|
11793
11957
|
return { cursor, claude };
|
|
11794
11958
|
}
|
|
11795
11959
|
return { cursor };
|
|
11796
11960
|
}
|
|
11797
|
-
var
|
|
11961
|
+
var import_node_fs31, import_node_os10, import_node_path32;
|
|
11798
11962
|
var init_user_mcp_config = __esm({
|
|
11799
11963
|
"src/agents/user-mcp-config.ts"() {
|
|
11800
11964
|
"use strict";
|
|
11801
|
-
|
|
11965
|
+
import_node_fs31 = require("fs");
|
|
11802
11966
|
import_node_os10 = require("os");
|
|
11803
|
-
|
|
11967
|
+
import_node_path32 = require("path");
|
|
11804
11968
|
init_paths();
|
|
11805
11969
|
init_injected_mcp();
|
|
11806
11970
|
}
|
|
@@ -11828,25 +11992,25 @@ function listMcpNamesFromCodexToml(text7) {
|
|
|
11828
11992
|
}
|
|
11829
11993
|
function readJsonObject(path2) {
|
|
11830
11994
|
try {
|
|
11831
|
-
return JSON.parse((0,
|
|
11995
|
+
return JSON.parse((0, import_node_fs32.readFileSync)(path2, "utf8"));
|
|
11832
11996
|
} catch {
|
|
11833
11997
|
return {};
|
|
11834
11998
|
}
|
|
11835
11999
|
}
|
|
11836
12000
|
function readText(path2) {
|
|
11837
12001
|
try {
|
|
11838
|
-
return (0,
|
|
12002
|
+
return (0, import_node_fs32.readFileSync)(path2, "utf8");
|
|
11839
12003
|
} catch {
|
|
11840
12004
|
return "";
|
|
11841
12005
|
}
|
|
11842
12006
|
}
|
|
11843
12007
|
function userCodexConfigPaths(home = (0, import_node_os11.homedir)()) {
|
|
11844
|
-
return [(0,
|
|
12008
|
+
return [(0, import_node_path33.join)(home, ".codex", "config.toml"), (0, import_node_path33.join)(home, ".config", "codex", "config.toml")];
|
|
11845
12009
|
}
|
|
11846
12010
|
function userOpencodeConfigPaths(home = (0, import_node_os11.homedir)()) {
|
|
11847
12011
|
return [
|
|
11848
|
-
(0,
|
|
11849
|
-
(0,
|
|
12012
|
+
(0, import_node_path33.join)(home, ".config", "opencode", "opencode.json"),
|
|
12013
|
+
(0, import_node_path33.join)(home, ".config", "opencode", "opencode.jsonc")
|
|
11850
12014
|
];
|
|
11851
12015
|
}
|
|
11852
12016
|
function userMcpNamesToDisable(opts) {
|
|
@@ -11868,7 +12032,7 @@ function userMcpNamesToDisable(opts) {
|
|
|
11868
12032
|
function listUserCodexMcpNames(home = (0, import_node_os11.homedir)()) {
|
|
11869
12033
|
const names = [];
|
|
11870
12034
|
for (const path2 of userCodexConfigPaths(home)) {
|
|
11871
|
-
if (!(0,
|
|
12035
|
+
if (!(0, import_node_fs32.existsSync)(path2)) continue;
|
|
11872
12036
|
names.push(...listMcpNamesFromCodexToml(readText(path2)));
|
|
11873
12037
|
}
|
|
11874
12038
|
return names;
|
|
@@ -11876,7 +12040,7 @@ function listUserCodexMcpNames(home = (0, import_node_os11.homedir)()) {
|
|
|
11876
12040
|
function listUserOpencodeMcpNames(home = (0, import_node_os11.homedir)()) {
|
|
11877
12041
|
const names = [];
|
|
11878
12042
|
for (const path2 of userOpencodeConfigPaths(home)) {
|
|
11879
|
-
if (!(0,
|
|
12043
|
+
if (!(0, import_node_fs32.existsSync)(path2)) continue;
|
|
11880
12044
|
names.push(...listMcpNamesFromJsonMap(readJsonObject(path2), "mcp"));
|
|
11881
12045
|
}
|
|
11882
12046
|
return names;
|
|
@@ -11889,13 +12053,13 @@ function toCodexDisableUserMcpArgs(names) {
|
|
|
11889
12053
|
}
|
|
11890
12054
|
return args;
|
|
11891
12055
|
}
|
|
11892
|
-
var
|
|
12056
|
+
var import_node_fs32, import_node_os11, import_node_path33, import_smol_toml2;
|
|
11893
12057
|
var init_orch_mcp_isolation = __esm({
|
|
11894
12058
|
"src/agents/orch-mcp-isolation.ts"() {
|
|
11895
12059
|
"use strict";
|
|
11896
|
-
|
|
12060
|
+
import_node_fs32 = require("fs");
|
|
11897
12061
|
import_node_os11 = require("os");
|
|
11898
|
-
|
|
12062
|
+
import_node_path33 = require("path");
|
|
11899
12063
|
import_smol_toml2 = require("smol-toml");
|
|
11900
12064
|
init_user_mcp_config();
|
|
11901
12065
|
}
|
|
@@ -11911,7 +12075,7 @@ async function listCodexModels() {
|
|
|
11911
12075
|
if (codex === "codex") {
|
|
11912
12076
|
const which = await run("which", ["codex"], { reject: false });
|
|
11913
12077
|
if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
|
|
11914
|
-
} else if (!(0,
|
|
12078
|
+
} else if (!(0, import_node_fs33.existsSync)(codex)) {
|
|
11915
12079
|
return FALLBACK_CODEX_MODELS;
|
|
11916
12080
|
}
|
|
11917
12081
|
const listed = await run(codex, ["debug", "models"], { reject: false });
|
|
@@ -11946,12 +12110,12 @@ function usageFromCodex(usage) {
|
|
|
11946
12110
|
}
|
|
11947
12111
|
function codexConfigHasNetworkAccess() {
|
|
11948
12112
|
const candidates = [
|
|
11949
|
-
(0,
|
|
11950
|
-
(0,
|
|
12113
|
+
(0, import_node_path34.join)((0, import_node_os12.homedir)(), ".codex", "config.toml"),
|
|
12114
|
+
(0, import_node_path34.join)((0, import_node_os12.homedir)(), ".config", "codex", "config.toml")
|
|
11951
12115
|
];
|
|
11952
12116
|
for (const path2 of candidates) {
|
|
11953
|
-
if (!(0,
|
|
11954
|
-
const text7 = (0,
|
|
12117
|
+
if (!(0, import_node_fs33.existsSync)(path2)) continue;
|
|
12118
|
+
const text7 = (0, import_node_fs33.readFileSync)(path2, "utf8");
|
|
11955
12119
|
if (/network_access\s*=\s*true/.test(text7)) return true;
|
|
11956
12120
|
}
|
|
11957
12121
|
return false;
|
|
@@ -11983,21 +12147,21 @@ function asRecord2(value) {
|
|
|
11983
12147
|
return void 0;
|
|
11984
12148
|
}
|
|
11985
12149
|
function codexLooksAuthenticated() {
|
|
11986
|
-
const authPath = (0,
|
|
11987
|
-
if (!(0,
|
|
12150
|
+
const authPath = (0, import_node_path34.join)((0, import_node_os12.homedir)(), ".codex", "auth.json");
|
|
12151
|
+
if (!(0, import_node_fs33.existsSync)(authPath)) return false;
|
|
11988
12152
|
try {
|
|
11989
|
-
return (0,
|
|
12153
|
+
return (0, import_node_fs33.statSync)(authPath).size > 2;
|
|
11990
12154
|
} catch {
|
|
11991
12155
|
return false;
|
|
11992
12156
|
}
|
|
11993
12157
|
}
|
|
11994
|
-
var
|
|
12158
|
+
var import_node_fs33, import_node_os12, import_node_path34, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
|
|
11995
12159
|
var init_codex = __esm({
|
|
11996
12160
|
"src/agents/codex.ts"() {
|
|
11997
12161
|
"use strict";
|
|
11998
|
-
|
|
12162
|
+
import_node_fs33 = require("fs");
|
|
11999
12163
|
import_node_os12 = require("os");
|
|
12000
|
-
|
|
12164
|
+
import_node_path34 = require("path");
|
|
12001
12165
|
init_run();
|
|
12002
12166
|
init_app_settings();
|
|
12003
12167
|
init_global_workspace();
|
|
@@ -12023,7 +12187,7 @@ var init_codex = __esm({
|
|
|
12023
12187
|
async detect() {
|
|
12024
12188
|
const codex = resolveAgentExecutable("codex");
|
|
12025
12189
|
if (codex !== "codex") {
|
|
12026
|
-
if (!(0,
|
|
12190
|
+
if (!(0, import_node_fs33.existsSync)(codex)) {
|
|
12027
12191
|
return {
|
|
12028
12192
|
agent: "codex",
|
|
12029
12193
|
installed: false,
|
|
@@ -12518,21 +12682,21 @@ function platformRipgrepPackage() {
|
|
|
12518
12682
|
}
|
|
12519
12683
|
function usableRipgrepPath(candidate) {
|
|
12520
12684
|
const raw = candidate?.trim();
|
|
12521
|
-
if (!raw || !(0,
|
|
12685
|
+
if (!raw || !(0, import_node_path35.isAbsolute)(raw)) return null;
|
|
12522
12686
|
const readable = nodeReadableScriptPath(raw);
|
|
12523
|
-
if (!(0,
|
|
12687
|
+
if (!(0, import_node_fs34.existsSync)(readable) || isAsarPath(readable)) return null;
|
|
12524
12688
|
return readable;
|
|
12525
12689
|
}
|
|
12526
12690
|
function walkForBundledRipgrep(startFile) {
|
|
12527
12691
|
if (!startFile) return null;
|
|
12528
12692
|
const pkg = platformRipgrepPackage();
|
|
12529
12693
|
const name = rgBinaryName();
|
|
12530
|
-
let dir = (0,
|
|
12531
|
-
const root = (0,
|
|
12694
|
+
let dir = (0, import_node_path35.dirname)((0, import_node_path35.resolve)(startFile));
|
|
12695
|
+
const root = (0, import_node_path35.parse)(dir).root;
|
|
12532
12696
|
while (dir !== root) {
|
|
12533
|
-
const hit = usableRipgrepPath((0,
|
|
12697
|
+
const hit = usableRipgrepPath((0, import_node_path35.join)(dir, "node_modules", pkg, "bin", name));
|
|
12534
12698
|
if (hit) return hit;
|
|
12535
|
-
const next = (0,
|
|
12699
|
+
const next = (0, import_node_path35.dirname)(dir);
|
|
12536
12700
|
if (next === dir) break;
|
|
12537
12701
|
dir = next;
|
|
12538
12702
|
}
|
|
@@ -12542,7 +12706,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
12542
12706
|
try {
|
|
12543
12707
|
const req = (0, import_node_module2.createRequire)(fromFile);
|
|
12544
12708
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
12545
|
-
return usableRipgrepPath((0,
|
|
12709
|
+
return usableRipgrepPath((0, import_node_path35.join)((0, import_node_path35.dirname)(pkgJson), "bin", rgBinaryName()));
|
|
12546
12710
|
} catch {
|
|
12547
12711
|
return null;
|
|
12548
12712
|
}
|
|
@@ -12564,13 +12728,13 @@ function cursorRipgrepEnv(opts) {
|
|
|
12564
12728
|
const path2 = resolveCursorRipgrepPath(opts);
|
|
12565
12729
|
return path2 ? { [RIPGREP_ENV]: path2 } : {};
|
|
12566
12730
|
}
|
|
12567
|
-
var
|
|
12731
|
+
var import_node_fs34, import_node_module2, import_node_path35, RIPGREP_ENV;
|
|
12568
12732
|
var init_cursor_ripgrep = __esm({
|
|
12569
12733
|
"src/agents/cursor-ripgrep.ts"() {
|
|
12570
12734
|
"use strict";
|
|
12571
|
-
|
|
12735
|
+
import_node_fs34 = require("fs");
|
|
12572
12736
|
import_node_module2 = require("module");
|
|
12573
|
-
|
|
12737
|
+
import_node_path35 = require("path");
|
|
12574
12738
|
init_node_launch();
|
|
12575
12739
|
init_packaged_runtime();
|
|
12576
12740
|
RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
|
|
@@ -12616,11 +12780,11 @@ function entryDir() {
|
|
|
12616
12780
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
12617
12781
|
if (cjsDir) return cjsDir;
|
|
12618
12782
|
try {
|
|
12619
|
-
return (0,
|
|
12783
|
+
return (0, import_node_path36.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
|
|
12620
12784
|
} catch {
|
|
12621
12785
|
try {
|
|
12622
12786
|
const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
|
|
12623
|
-
return (0,
|
|
12787
|
+
return (0, import_node_path36.dirname)(req.resolve("@sideboard-ai/core"));
|
|
12624
12788
|
} catch {
|
|
12625
12789
|
return process.cwd();
|
|
12626
12790
|
}
|
|
@@ -12631,27 +12795,27 @@ function cursorRunnerPath() {
|
|
|
12631
12795
|
if (packaged) return packaged;
|
|
12632
12796
|
const root = entryDir();
|
|
12633
12797
|
const candidates = [
|
|
12634
|
-
(0,
|
|
12635
|
-
(0,
|
|
12798
|
+
(0, import_node_path36.join)(root, "agents", "cursor-runner.js"),
|
|
12799
|
+
(0, import_node_path36.join)(root, "agents", "cursor-runner.cjs"),
|
|
12636
12800
|
// If somehow resolved from package root instead of dist/
|
|
12637
|
-
(0,
|
|
12638
|
-
(0,
|
|
12801
|
+
(0, import_node_path36.join)(root, "dist", "agents", "cursor-runner.js"),
|
|
12802
|
+
(0, import_node_path36.join)(root, "dist", "agents", "cursor-runner.cjs"),
|
|
12639
12803
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
12640
|
-
(0,
|
|
12641
|
-
(0,
|
|
12804
|
+
(0, import_node_path36.join)(root, "cursor-runner.ts"),
|
|
12805
|
+
(0, import_node_path36.join)(root, "src", "agents", "cursor-runner.ts")
|
|
12642
12806
|
];
|
|
12643
12807
|
for (const candidate of candidates) {
|
|
12644
|
-
if ((0,
|
|
12808
|
+
if ((0, import_node_fs35.existsSync)(candidate)) return candidate;
|
|
12645
12809
|
}
|
|
12646
12810
|
return candidates[0];
|
|
12647
12811
|
}
|
|
12648
|
-
var
|
|
12812
|
+
var import_node_fs35, import_node_module3, import_node_path36, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
|
|
12649
12813
|
var init_cursor = __esm({
|
|
12650
12814
|
"src/agents/cursor.ts"() {
|
|
12651
12815
|
"use strict";
|
|
12652
|
-
|
|
12816
|
+
import_node_fs35 = require("fs");
|
|
12653
12817
|
import_node_module3 = require("module");
|
|
12654
|
-
|
|
12818
|
+
import_node_path36 = require("path");
|
|
12655
12819
|
import_node_url2 = require("url");
|
|
12656
12820
|
import_sdk = require("@cursor/sdk");
|
|
12657
12821
|
init_run();
|
|
@@ -12803,7 +12967,7 @@ async function listOpencodeModels() {
|
|
|
12803
12967
|
if (opencode === "opencode") {
|
|
12804
12968
|
const which = await run("which", ["opencode"], { reject: false });
|
|
12805
12969
|
if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
|
|
12806
|
-
} else if (!(0,
|
|
12970
|
+
} else if (!(0, import_node_fs36.existsSync)(opencode)) {
|
|
12807
12971
|
return FALLBACK_OPENCODE_MODELS;
|
|
12808
12972
|
}
|
|
12809
12973
|
const listed = await run(opencode, ["models"], { reject: false });
|
|
@@ -12833,11 +12997,11 @@ function usageFromOpencode(tokens) {
|
|
|
12833
12997
|
cacheWriteTokens: tokens.cache?.write ? Number(tokens.cache.write) : void 0
|
|
12834
12998
|
};
|
|
12835
12999
|
}
|
|
12836
|
-
var
|
|
13000
|
+
var import_node_fs36, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
|
|
12837
13001
|
var init_opencode = __esm({
|
|
12838
13002
|
"src/agents/opencode.ts"() {
|
|
12839
13003
|
"use strict";
|
|
12840
|
-
|
|
13004
|
+
import_node_fs36 = require("fs");
|
|
12841
13005
|
init_run();
|
|
12842
13006
|
init_app_settings();
|
|
12843
13007
|
init_global_workspace();
|
|
@@ -12865,7 +13029,7 @@ var init_opencode = __esm({
|
|
|
12865
13029
|
async detect() {
|
|
12866
13030
|
const opencode = resolveAgentExecutable("opencode");
|
|
12867
13031
|
if (opencode !== "opencode") {
|
|
12868
|
-
if (!(0,
|
|
13032
|
+
if (!(0, import_node_fs36.existsSync)(opencode)) {
|
|
12869
13033
|
return {
|
|
12870
13034
|
agent: "opencode",
|
|
12871
13035
|
installed: false,
|
|
@@ -13674,15 +13838,15 @@ var init_agents = __esm({
|
|
|
13674
13838
|
|
|
13675
13839
|
// src/hook/worktree-pkg-cache.ts
|
|
13676
13840
|
function worktreePkgCacheRoot(worktreePath) {
|
|
13677
|
-
return (0,
|
|
13841
|
+
return (0, import_node_path37.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
|
|
13678
13842
|
}
|
|
13679
13843
|
function worktreePkgCacheEnv(worktreePath) {
|
|
13680
13844
|
const root = worktreePkgCacheRoot(worktreePath);
|
|
13681
|
-
const store = (0,
|
|
13682
|
-
const pnpmCache = (0,
|
|
13683
|
-
const npmCache = (0,
|
|
13684
|
-
const nodeGyp = (0,
|
|
13685
|
-
const electron = (0,
|
|
13845
|
+
const store = (0, import_node_path37.join)(root, "pnpm-store");
|
|
13846
|
+
const pnpmCache = (0, import_node_path37.join)(root, "pnpm");
|
|
13847
|
+
const npmCache = (0, import_node_path37.join)(root, "npm");
|
|
13848
|
+
const nodeGyp = (0, import_node_path37.join)(root, "node-gyp");
|
|
13849
|
+
const electron = (0, import_node_path37.join)(root, "electron");
|
|
13686
13850
|
return {
|
|
13687
13851
|
npm_config_store_dir: store,
|
|
13688
13852
|
PNPM_STORE_DIR: store,
|
|
@@ -13704,8 +13868,8 @@ function fillGroup(env, keys, values) {
|
|
|
13704
13868
|
}
|
|
13705
13869
|
}
|
|
13706
13870
|
function ensureWorktreePkgCacheDirs(worktreePath) {
|
|
13707
|
-
if (!(0,
|
|
13708
|
-
(0,
|
|
13871
|
+
if (!(0, import_node_fs37.existsSync)(worktreePath)) return;
|
|
13872
|
+
(0, import_node_fs37.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
|
|
13709
13873
|
}
|
|
13710
13874
|
function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
13711
13875
|
const cwd = worktreePath.trim();
|
|
@@ -13718,12 +13882,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
|
13718
13882
|
fillGroup(env, ["electron_config_cache"], next);
|
|
13719
13883
|
ensureWorktreePkgCacheDirs(cwd);
|
|
13720
13884
|
}
|
|
13721
|
-
var
|
|
13885
|
+
var import_node_fs37, import_node_path37, WORKTREE_PKG_CACHE_REL;
|
|
13722
13886
|
var init_worktree_pkg_cache = __esm({
|
|
13723
13887
|
"src/hook/worktree-pkg-cache.ts"() {
|
|
13724
13888
|
"use strict";
|
|
13725
|
-
|
|
13726
|
-
|
|
13889
|
+
import_node_fs37 = require("fs");
|
|
13890
|
+
import_node_path37 = require("path");
|
|
13727
13891
|
WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
|
|
13728
13892
|
}
|
|
13729
13893
|
});
|
|
@@ -14418,7 +14582,7 @@ function buildSessionSeed(messages, opts) {
|
|
|
14418
14582
|
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
14419
14583
|
if (keep[i]) continue;
|
|
14420
14584
|
const next = used + blocks[i].length + 2;
|
|
14421
|
-
if (next > maxChars && used > 0)
|
|
14585
|
+
if (next > maxChars && used > 0) continue;
|
|
14422
14586
|
keep[i] = true;
|
|
14423
14587
|
used = next;
|
|
14424
14588
|
}
|
|
@@ -14871,21 +15035,21 @@ function shouldRefreshReviewRequestTemplate(content) {
|
|
|
14871
15035
|
return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
|
|
14872
15036
|
}
|
|
14873
15037
|
function readTextIfPresent(abs) {
|
|
14874
|
-
if (!(0,
|
|
15038
|
+
if (!(0, import_node_fs38.existsSync)(abs)) return null;
|
|
14875
15039
|
try {
|
|
14876
|
-
const content = (0,
|
|
15040
|
+
const content = (0, import_node_fs38.readFileSync)(abs, "utf8");
|
|
14877
15041
|
return content.trim() ? content : null;
|
|
14878
15042
|
} catch {
|
|
14879
15043
|
return null;
|
|
14880
15044
|
}
|
|
14881
15045
|
}
|
|
14882
15046
|
function readLocalGuidelines(worktreePath) {
|
|
14883
|
-
const localAbs = (0,
|
|
15047
|
+
const localAbs = (0, import_node_path38.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
14884
15048
|
const localContent = readTextIfPresent(localAbs);
|
|
14885
15049
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
14886
15050
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
14887
15051
|
}
|
|
14888
|
-
const legacyAbs = (0,
|
|
15052
|
+
const legacyAbs = (0, import_node_path38.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
14889
15053
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
14890
15054
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
14891
15055
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -14909,27 +15073,27 @@ function contextGuidelines(content, source) {
|
|
|
14909
15073
|
};
|
|
14910
15074
|
}
|
|
14911
15075
|
function writeContextGuidelines(worktreePath, content) {
|
|
14912
|
-
const abs = (0,
|
|
14913
|
-
(0,
|
|
15076
|
+
const abs = (0, import_node_path38.join)(worktreePath, CONTEXT_REVIEW_PATH);
|
|
15077
|
+
(0, import_node_fs38.mkdirSync)((0, import_node_path38.dirname)(abs), { recursive: true });
|
|
14914
15078
|
const body = content.endsWith("\n") ? content : `${content}
|
|
14915
15079
|
`;
|
|
14916
|
-
(0,
|
|
15080
|
+
(0, import_node_fs38.writeFileSync)(abs, body, "utf8");
|
|
14917
15081
|
return body;
|
|
14918
15082
|
}
|
|
14919
15083
|
function readSideboardReview(worktreePath, repoPath) {
|
|
14920
|
-
const fromWorktree = readTextIfPresent((0,
|
|
15084
|
+
const fromWorktree = readTextIfPresent((0, import_node_path38.join)(worktreePath, REPO_REVIEW_PATH));
|
|
14921
15085
|
if (fromWorktree) return fromWorktree;
|
|
14922
15086
|
const repo = repoPath?.replace(/\/+$/, "");
|
|
14923
15087
|
const wt = worktreePath.replace(/\/+$/, "");
|
|
14924
15088
|
if (!repo || repo === wt) return null;
|
|
14925
|
-
return readTextIfPresent((0,
|
|
15089
|
+
return readTextIfPresent((0, import_node_path38.join)(repo, REPO_REVIEW_PATH));
|
|
14926
15090
|
}
|
|
14927
15091
|
function ensureReviewGuidelinesFile(worktreePath, repoPath) {
|
|
14928
|
-
const skillContent = readTextIfPresent((0,
|
|
15092
|
+
const skillContent = readTextIfPresent((0, import_node_path38.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
14929
15093
|
if (skillContent) {
|
|
14930
15094
|
return { ...skillGuidelines(skillContent, "skill"), wrote: false };
|
|
14931
15095
|
}
|
|
14932
|
-
const contextContent = readTextIfPresent((0,
|
|
15096
|
+
const contextContent = readTextIfPresent((0, import_node_path38.join)(worktreePath, CONTEXT_REVIEW_PATH));
|
|
14933
15097
|
if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
|
|
14934
15098
|
return { ...contextGuidelines(contextContent, "local"), wrote: false };
|
|
14935
15099
|
}
|
|
@@ -14967,7 +15131,7 @@ function buildReviewRequestAttachment(content, opts) {
|
|
|
14967
15131
|
};
|
|
14968
15132
|
}
|
|
14969
15133
|
function readExistingReviewRequestFile(worktreePath) {
|
|
14970
|
-
return readTextIfPresent((0,
|
|
15134
|
+
return readTextIfPresent((0, import_node_path38.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path38.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
|
|
14971
15135
|
}
|
|
14972
15136
|
async function requestReview(threadRef, send2) {
|
|
14973
15137
|
const from = findThreadByRef(threadRef);
|
|
@@ -14994,13 +15158,13 @@ async function requestReview(threadRef, send2) {
|
|
|
14994
15158
|
const started = await send2(tab.id, REVIEW_REQUEST_PREFILL);
|
|
14995
15159
|
return { tab: started, from };
|
|
14996
15160
|
}
|
|
14997
|
-
var import_node_crypto8,
|
|
15161
|
+
var import_node_crypto8, import_node_fs38, import_node_path38, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
|
|
14998
15162
|
var init_request_review = __esm({
|
|
14999
15163
|
"src/review/request-review.ts"() {
|
|
15000
15164
|
"use strict";
|
|
15001
15165
|
import_node_crypto8 = require("crypto");
|
|
15002
|
-
|
|
15003
|
-
|
|
15166
|
+
import_node_fs38 = require("fs");
|
|
15167
|
+
import_node_path38 = require("path");
|
|
15004
15168
|
init_global_workspace();
|
|
15005
15169
|
init_chat_tabs();
|
|
15006
15170
|
init_thread_store();
|
|
@@ -15026,9 +15190,9 @@ function matchSimpleGlob(pattern, name) {
|
|
|
15026
15190
|
return new RegExp(`^${escaped}$`).test(name);
|
|
15027
15191
|
}
|
|
15028
15192
|
function readWorktreeInclude(repoPath) {
|
|
15029
|
-
const path2 = (0,
|
|
15030
|
-
if (!(0,
|
|
15031
|
-
return (0,
|
|
15193
|
+
const path2 = (0, import_node_path39.join)(repoPath, ".worktreeinclude");
|
|
15194
|
+
if (!(0, import_node_fs39.existsSync)(path2)) return [];
|
|
15195
|
+
return (0, import_node_fs39.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
15032
15196
|
}
|
|
15033
15197
|
function resolveFilesToCopy(repoPath) {
|
|
15034
15198
|
const fromInclude = readWorktreeInclude(repoPath);
|
|
@@ -15038,10 +15202,10 @@ function resolveFilesToCopy(repoPath) {
|
|
|
15038
15202
|
if (settings?.fileIncludeGlobs?.length) {
|
|
15039
15203
|
const matched = [];
|
|
15040
15204
|
try {
|
|
15041
|
-
for (const entry of (0,
|
|
15205
|
+
for (const entry of (0, import_node_fs39.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
15042
15206
|
if (!entry.isFile()) continue;
|
|
15043
15207
|
for (const glob of settings.fileIncludeGlobs) {
|
|
15044
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
15208
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path39.basename)(glob), entry.name)) {
|
|
15045
15209
|
matched.push(entry.name);
|
|
15046
15210
|
break;
|
|
15047
15211
|
}
|
|
@@ -15053,7 +15217,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
15053
15217
|
}
|
|
15054
15218
|
const defaults = [];
|
|
15055
15219
|
try {
|
|
15056
|
-
for (const entry of (0,
|
|
15220
|
+
for (const entry of (0, import_node_fs39.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
15057
15221
|
if (entry.isFile() && entry.name.startsWith(".env")) {
|
|
15058
15222
|
defaults.push(entry.name);
|
|
15059
15223
|
}
|
|
@@ -15067,11 +15231,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
15067
15231
|
const patterns = resolveFilesToCopy(repoPath);
|
|
15068
15232
|
const copied = [];
|
|
15069
15233
|
for (const rel of patterns) {
|
|
15070
|
-
const src = (0,
|
|
15071
|
-
if (!(0,
|
|
15072
|
-
const dest = (0,
|
|
15073
|
-
(0,
|
|
15074
|
-
(0,
|
|
15234
|
+
const src = (0, import_node_path39.join)(repoPath, rel);
|
|
15235
|
+
if (!(0, import_node_fs39.existsSync)(src)) continue;
|
|
15236
|
+
const dest = (0, import_node_path39.join)(worktreePath, rel);
|
|
15237
|
+
(0, import_node_fs39.mkdirSync)((0, import_node_path39.dirname)(dest), { recursive: true });
|
|
15238
|
+
(0, import_node_fs39.copyFileSync)(src, dest);
|
|
15075
15239
|
copied.push(rel);
|
|
15076
15240
|
}
|
|
15077
15241
|
return copied;
|
|
@@ -15106,7 +15270,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
15106
15270
|
const env = stripNestedElectronEnv({
|
|
15107
15271
|
...baseEnv ?? process.env
|
|
15108
15272
|
});
|
|
15109
|
-
const name = opts.workspaceName ?? (0,
|
|
15273
|
+
const name = opts.workspaceName ?? (0, import_node_path39.basename)(opts.worktreePath);
|
|
15110
15274
|
const ports = opts.ports ?? [];
|
|
15111
15275
|
const primary = ports[0];
|
|
15112
15276
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -15369,13 +15533,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
15369
15533
|
done: handle.done
|
|
15370
15534
|
};
|
|
15371
15535
|
}
|
|
15372
|
-
var
|
|
15536
|
+
var import_node_fs39, import_node_net, import_node_path39, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
|
|
15373
15537
|
var init_conductor = __esm({
|
|
15374
15538
|
"src/hook/conductor.ts"() {
|
|
15375
15539
|
"use strict";
|
|
15376
|
-
|
|
15540
|
+
import_node_fs39 = require("fs");
|
|
15377
15541
|
import_node_net = require("net");
|
|
15378
|
-
|
|
15542
|
+
import_node_path39 = require("path");
|
|
15379
15543
|
import_execa4 = require("execa");
|
|
15380
15544
|
import_node_readline3 = require("readline");
|
|
15381
15545
|
init_settings();
|
|
@@ -15403,9 +15567,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15403
15567
|
repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
|
|
15404
15568
|
);
|
|
15405
15569
|
const homeRoot = sideboardWorkspacesDir();
|
|
15406
|
-
if ((0,
|
|
15570
|
+
if ((0, import_node_fs40.existsSync)(homeRoot)) {
|
|
15407
15571
|
try {
|
|
15408
|
-
for (const entry of (0,
|
|
15572
|
+
for (const entry of (0, import_node_fs40.readdirSync)(homeRoot, { withFileTypes: true })) {
|
|
15409
15573
|
if (!entry.isDirectory()) continue;
|
|
15410
15574
|
void entry;
|
|
15411
15575
|
}
|
|
@@ -15415,7 +15579,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15415
15579
|
const orphans = [];
|
|
15416
15580
|
const seen = /* @__PURE__ */ new Set();
|
|
15417
15581
|
for (const repoPath of repos) {
|
|
15418
|
-
if (!repoPath || !(0,
|
|
15582
|
+
if (!repoPath || !(0, import_node_fs40.existsSync)(repoPath)) continue;
|
|
15419
15583
|
try {
|
|
15420
15584
|
const wts = await listWorktrees(repoPath);
|
|
15421
15585
|
for (const wt of wts) {
|
|
@@ -15426,7 +15590,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15426
15590
|
seen.add(path2);
|
|
15427
15591
|
let mtimeMs = 0;
|
|
15428
15592
|
try {
|
|
15429
|
-
mtimeMs = (0,
|
|
15593
|
+
mtimeMs = (0, import_node_fs40.statSync)(path2).mtimeMs;
|
|
15430
15594
|
} catch {
|
|
15431
15595
|
mtimeMs = 0;
|
|
15432
15596
|
}
|
|
@@ -15436,16 +15600,16 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
15436
15600
|
}
|
|
15437
15601
|
try {
|
|
15438
15602
|
const root = worktreesRoot(repoPath);
|
|
15439
|
-
if ((0,
|
|
15440
|
-
for (const entry of (0,
|
|
15603
|
+
if ((0, import_node_fs40.existsSync)(root)) {
|
|
15604
|
+
for (const entry of (0, import_node_fs40.readdirSync)(root, { withFileTypes: true })) {
|
|
15441
15605
|
if (!entry.isDirectory()) continue;
|
|
15442
|
-
const path2 = (0,
|
|
15606
|
+
const path2 = (0, import_node_path40.join)(root, entry.name).replace(/\/$/, "");
|
|
15443
15607
|
if (known.has(path2) || seen.has(path2)) continue;
|
|
15444
|
-
if (!(0,
|
|
15608
|
+
if (!(0, import_node_fs40.existsSync)((0, import_node_path40.join)(path2, ".git"))) continue;
|
|
15445
15609
|
seen.add(path2);
|
|
15446
15610
|
let mtimeMs = 0;
|
|
15447
15611
|
try {
|
|
15448
|
-
mtimeMs = (0,
|
|
15612
|
+
mtimeMs = (0, import_node_fs40.statSync)(path2).mtimeMs;
|
|
15449
15613
|
} catch {
|
|
15450
15614
|
mtimeMs = Date.now();
|
|
15451
15615
|
}
|
|
@@ -15506,12 +15670,12 @@ function worktreeCleanupSettings() {
|
|
|
15506
15670
|
autoCleanupOrphans: a.autoCleanupOrphans
|
|
15507
15671
|
};
|
|
15508
15672
|
}
|
|
15509
|
-
var
|
|
15673
|
+
var import_node_fs40, import_node_path40;
|
|
15510
15674
|
var init_orphan_cleanup = __esm({
|
|
15511
15675
|
"src/git/orphan-cleanup.ts"() {
|
|
15512
15676
|
"use strict";
|
|
15513
|
-
|
|
15514
|
-
|
|
15677
|
+
import_node_fs40 = require("fs");
|
|
15678
|
+
import_node_path40 = require("path");
|
|
15515
15679
|
init_worktree();
|
|
15516
15680
|
init_thread_store();
|
|
15517
15681
|
init_paths();
|
|
@@ -15614,12 +15778,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
15614
15778
|
if (!url) throw new Error("Clone URL is required");
|
|
15615
15779
|
let name = opts.name?.trim();
|
|
15616
15780
|
if (!name) {
|
|
15617
|
-
const leaf = (0,
|
|
15781
|
+
const leaf = (0, import_node_path41.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
15618
15782
|
name = leaf || "repo";
|
|
15619
15783
|
}
|
|
15620
15784
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
15621
|
-
const dest = (0,
|
|
15622
|
-
if ((0,
|
|
15785
|
+
const dest = (0, import_node_path41.join)(sideboardReposDir(), name);
|
|
15786
|
+
if ((0, import_node_fs41.existsSync)(dest)) {
|
|
15623
15787
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
15624
15788
|
const workspace2 = await ensureWorkspace(repoPath2);
|
|
15625
15789
|
return { repoPath: repoPath2, workspace: workspace2 };
|
|
@@ -15634,12 +15798,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
15634
15798
|
const workspace = await ensureWorkspace(repoPath);
|
|
15635
15799
|
return { repoPath, workspace };
|
|
15636
15800
|
}
|
|
15637
|
-
var
|
|
15801
|
+
var import_node_fs41, import_node_path41, import_execa6;
|
|
15638
15802
|
var init_clone_repo = __esm({
|
|
15639
15803
|
"src/git/clone-repo.ts"() {
|
|
15640
15804
|
"use strict";
|
|
15641
|
-
|
|
15642
|
-
|
|
15805
|
+
import_node_fs41 = require("fs");
|
|
15806
|
+
import_node_path41 = require("path");
|
|
15643
15807
|
import_execa6 = require("execa");
|
|
15644
15808
|
init_paths();
|
|
15645
15809
|
init_workspaces();
|
|
@@ -15744,7 +15908,7 @@ function jobAlive(pid) {
|
|
|
15744
15908
|
}
|
|
15745
15909
|
function processGroupAlive(pgid) {
|
|
15746
15910
|
if (process.platform === "win32") return false;
|
|
15747
|
-
if (!Number.isInteger(pgid) || pgid <=
|
|
15911
|
+
if (!Number.isInteger(pgid) || pgid <= 1) return false;
|
|
15748
15912
|
try {
|
|
15749
15913
|
process.kill(-pgid, 0);
|
|
15750
15914
|
return true;
|
|
@@ -15757,24 +15921,24 @@ function jobTreeAlive(pid) {
|
|
|
15757
15921
|
return jobAlive(pid) || processGroupAlive(pid);
|
|
15758
15922
|
}
|
|
15759
15923
|
function readIntFile(file) {
|
|
15760
|
-
if (!(0,
|
|
15761
|
-
const n = Number.parseInt((0,
|
|
15924
|
+
if (!(0, import_node_fs42.existsSync)(file)) return null;
|
|
15925
|
+
const n = Number.parseInt((0, import_node_fs42.readFileSync)(file, "utf8").trim(), 10);
|
|
15762
15926
|
return Number.isInteger(n) ? n : null;
|
|
15763
15927
|
}
|
|
15764
15928
|
function jobDir(root, id, legacy = false) {
|
|
15765
|
-
return (0,
|
|
15929
|
+
return (0, import_node_path42.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
|
|
15766
15930
|
}
|
|
15767
15931
|
function resolveJobDir(root, id) {
|
|
15768
15932
|
const modern = jobDir(root, id, false);
|
|
15769
|
-
if ((0,
|
|
15933
|
+
if ((0, import_node_fs42.existsSync)(modern)) return modern;
|
|
15770
15934
|
const legacy = jobDir(root, id, true);
|
|
15771
|
-
if ((0,
|
|
15935
|
+
if ((0, import_node_fs42.existsSync)(legacy)) return legacy;
|
|
15772
15936
|
return modern;
|
|
15773
15937
|
}
|
|
15774
15938
|
function listJobIdsIn(root, rel) {
|
|
15775
|
-
const dir = (0,
|
|
15776
|
-
if (!(0,
|
|
15777
|
-
return (0,
|
|
15939
|
+
const dir = (0, import_node_path42.join)(root, rel);
|
|
15940
|
+
if (!(0, import_node_fs42.existsSync)(dir)) return [];
|
|
15941
|
+
return (0, import_node_fs42.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
|
|
15778
15942
|
}
|
|
15779
15943
|
function listRunningDetachedJobs(worktreePath) {
|
|
15780
15944
|
const root = worktreePath.trim();
|
|
@@ -15786,8 +15950,8 @@ function listRunningDetachedJobs(worktreePath) {
|
|
|
15786
15950
|
const running = [];
|
|
15787
15951
|
for (const id of ids) {
|
|
15788
15952
|
const dir = resolveJobDir(root, id);
|
|
15789
|
-
const pid = readIntFile((0,
|
|
15790
|
-
if (
|
|
15953
|
+
const pid = readIntFile((0, import_node_path42.join)(dir, "pid"));
|
|
15954
|
+
if (jobTreeAlive(pid)) running.push(id);
|
|
15791
15955
|
}
|
|
15792
15956
|
return running.sort();
|
|
15793
15957
|
}
|
|
@@ -15839,13 +16003,13 @@ function planJobContinue(opts) {
|
|
|
15839
16003
|
return { action: "none" };
|
|
15840
16004
|
}
|
|
15841
16005
|
function tailProgress(logFile, maxLines = 12) {
|
|
15842
|
-
if (!(0,
|
|
15843
|
-
const lines = (0,
|
|
16006
|
+
if (!(0, import_node_fs42.existsSync)(logFile)) return "(no log yet)";
|
|
16007
|
+
const lines = (0, import_node_fs42.readFileSync)(logFile, "utf8").split("\n");
|
|
15844
16008
|
return lines.slice(-maxLines).join("\n");
|
|
15845
16009
|
}
|
|
15846
16010
|
function readLogLines(file) {
|
|
15847
|
-
if (!(0,
|
|
15848
|
-
const lines = (0,
|
|
16011
|
+
if (!(0, import_node_fs42.existsSync)(file)) return [];
|
|
16012
|
+
const lines = (0, import_node_fs42.readFileSync)(file, "utf8").split("\n");
|
|
15849
16013
|
if (lines.length && lines[lines.length - 1] === "") lines.pop();
|
|
15850
16014
|
return lines;
|
|
15851
16015
|
}
|
|
@@ -15856,15 +16020,15 @@ function takeDelta(logFile, cursorFile) {
|
|
|
15856
16020
|
return { delta: lines.slice(start).join("\n"), nextCursor: lines.length };
|
|
15857
16021
|
}
|
|
15858
16022
|
function snapshotJob(dir) {
|
|
15859
|
-
const pid = readIntFile((0,
|
|
16023
|
+
const pid = readIntFile((0, import_node_path42.join)(dir, "pid"));
|
|
15860
16024
|
const running = jobTreeAlive(pid);
|
|
15861
16025
|
return {
|
|
15862
16026
|
pid,
|
|
15863
16027
|
running,
|
|
15864
|
-
exitCode: readIntFile((0,
|
|
15865
|
-
log: (0,
|
|
15866
|
-
cursor: (0,
|
|
15867
|
-
progress: tailProgress((0,
|
|
16028
|
+
exitCode: readIntFile((0, import_node_path42.join)(dir, "exit")),
|
|
16029
|
+
log: (0, import_node_path42.join)(dir, "log"),
|
|
16030
|
+
cursor: (0, import_node_path42.join)(dir, "present.cursor"),
|
|
16031
|
+
progress: tailProgress((0, import_node_path42.join)(dir, "log"))
|
|
15868
16032
|
};
|
|
15869
16033
|
}
|
|
15870
16034
|
function toResult(id, snap, extra) {
|
|
@@ -15873,8 +16037,8 @@ function toResult(id, snap, extra) {
|
|
|
15873
16037
|
const stillRunning = snap.running && !ok;
|
|
15874
16038
|
const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
|
|
15875
16039
|
try {
|
|
15876
|
-
(0,
|
|
15877
|
-
(0,
|
|
16040
|
+
(0, import_node_fs42.mkdirSync)((0, import_node_path42.dirname)(snap.cursor), { recursive: true });
|
|
16041
|
+
(0, import_node_fs42.writeFileSync)(snap.cursor, `${nextCursor}
|
|
15878
16042
|
`);
|
|
15879
16043
|
} catch {
|
|
15880
16044
|
}
|
|
@@ -15901,7 +16065,7 @@ async function waitForDetachedJob(cwd, id, opts) {
|
|
|
15901
16065
|
const dir = resolveJobDir(root, jobId);
|
|
15902
16066
|
const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
|
|
15903
16067
|
const sleep2 = opts?.sleep ?? sleepMs;
|
|
15904
|
-
if (!(0,
|
|
16068
|
+
if (!(0, import_node_fs42.existsSync)(dir)) {
|
|
15905
16069
|
return {
|
|
15906
16070
|
stillRunning: false,
|
|
15907
16071
|
ok: false,
|
|
@@ -15947,10 +16111,10 @@ function killProcessTree(pid, signal) {
|
|
|
15947
16111
|
}
|
|
15948
16112
|
function appendJobLog(logFile, line) {
|
|
15949
16113
|
try {
|
|
15950
|
-
(0,
|
|
16114
|
+
(0, import_node_fs42.mkdirSync)((0, import_node_path42.dirname)(logFile), { recursive: true });
|
|
15951
16115
|
const body = line.endsWith("\n") ? line : `${line}
|
|
15952
16116
|
`;
|
|
15953
|
-
(0,
|
|
16117
|
+
(0, import_node_fs42.appendFileSync)(logFile, body);
|
|
15954
16118
|
} catch {
|
|
15955
16119
|
}
|
|
15956
16120
|
}
|
|
@@ -15960,7 +16124,7 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
15960
16124
|
const dir = resolveJobDir(root, jobId);
|
|
15961
16125
|
const sleep2 = opts?.sleep ?? sleepMs;
|
|
15962
16126
|
const why = opts?.reason?.trim() ?? "";
|
|
15963
|
-
if (!(0,
|
|
16127
|
+
if (!(0, import_node_fs42.existsSync)(dir)) {
|
|
15964
16128
|
return {
|
|
15965
16129
|
stillRunning: false,
|
|
15966
16130
|
ok: false,
|
|
@@ -15996,10 +16160,10 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
15996
16160
|
killProcessTree(targetPid, "SIGKILL");
|
|
15997
16161
|
await sleep2(100);
|
|
15998
16162
|
}
|
|
15999
|
-
const exitFile = (0,
|
|
16000
|
-
if (!(0,
|
|
16163
|
+
const exitFile = (0, import_node_path42.join)(dir, "exit");
|
|
16164
|
+
if (!(0, import_node_fs42.existsSync)(exitFile)) {
|
|
16001
16165
|
try {
|
|
16002
|
-
(0,
|
|
16166
|
+
(0, import_node_fs42.writeFileSync)(exitFile, "1\n");
|
|
16003
16167
|
} catch {
|
|
16004
16168
|
}
|
|
16005
16169
|
}
|
|
@@ -16019,12 +16183,12 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
16019
16183
|
hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
|
|
16020
16184
|
};
|
|
16021
16185
|
}
|
|
16022
|
-
var
|
|
16186
|
+
var import_node_fs42, import_node_path42, MAX_JOB_CONTINUES, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
|
|
16023
16187
|
var init_wait_for_job = __esm({
|
|
16024
16188
|
"src/mcp/wait-for-job.ts"() {
|
|
16025
16189
|
"use strict";
|
|
16026
|
-
|
|
16027
|
-
|
|
16190
|
+
import_node_fs42 = require("fs");
|
|
16191
|
+
import_node_path42 = require("path");
|
|
16028
16192
|
init_workspace_scratch();
|
|
16029
16193
|
init_wait_for_turn();
|
|
16030
16194
|
MAX_JOB_CONTINUES = 8;
|
|
@@ -17161,7 +17325,7 @@ function reuseLiveThread(input, repoPath, match) {
|
|
|
17161
17325
|
}
|
|
17162
17326
|
async function createThread(input, _onSetupLine) {
|
|
17163
17327
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
17164
|
-
if (!(0,
|
|
17328
|
+
if (!(0, import_node_fs43.existsSync)(repoPath)) {
|
|
17165
17329
|
throw new Error(`Repo not found: ${repoPath}`);
|
|
17166
17330
|
}
|
|
17167
17331
|
const reused = reuseLiveThread(input, repoPath, {
|
|
@@ -17342,11 +17506,11 @@ async function listLinearIssues(agent, repoPath) {
|
|
|
17342
17506
|
}
|
|
17343
17507
|
return adapter.listLinearIssues(repoPath);
|
|
17344
17508
|
}
|
|
17345
|
-
var
|
|
17509
|
+
var import_node_fs43;
|
|
17346
17510
|
var init_create = __esm({
|
|
17347
17511
|
"src/threads/create.ts"() {
|
|
17348
17512
|
"use strict";
|
|
17349
|
-
|
|
17513
|
+
import_node_fs43 = require("fs");
|
|
17350
17514
|
init_detect();
|
|
17351
17515
|
init_worktree();
|
|
17352
17516
|
init_home_board();
|
|
@@ -17466,20 +17630,20 @@ function writeTurnLive(threadId, progress) {
|
|
|
17466
17630
|
const path2 = threadLivePath(threadId);
|
|
17467
17631
|
const tmp = `${path2}.${process.pid}.tmp`;
|
|
17468
17632
|
try {
|
|
17469
|
-
(0,
|
|
17470
|
-
(0,
|
|
17633
|
+
(0, import_node_fs44.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
|
|
17634
|
+
(0, import_node_fs44.renameSync)(tmp, path2);
|
|
17471
17635
|
} catch {
|
|
17472
17636
|
try {
|
|
17473
|
-
(0,
|
|
17637
|
+
(0, import_node_fs44.unlinkSync)(tmp);
|
|
17474
17638
|
} catch {
|
|
17475
17639
|
}
|
|
17476
17640
|
}
|
|
17477
17641
|
}
|
|
17478
17642
|
function readTurnLive(threadId) {
|
|
17479
17643
|
const path2 = threadLivePath(threadId);
|
|
17480
|
-
if (!(0,
|
|
17644
|
+
if (!(0, import_node_fs44.existsSync)(path2)) return null;
|
|
17481
17645
|
try {
|
|
17482
|
-
const raw = JSON.parse((0,
|
|
17646
|
+
const raw = JSON.parse((0, import_node_fs44.readFileSync)(path2, "utf8"));
|
|
17483
17647
|
if (!raw || typeof raw.summary !== "string") return null;
|
|
17484
17648
|
return raw;
|
|
17485
17649
|
} catch {
|
|
@@ -17491,17 +17655,17 @@ function clearTurnLive(threadId) {
|
|
|
17491
17655
|
if (buf?.timer) clearTimeout(buf.timer);
|
|
17492
17656
|
buffers.delete(threadId);
|
|
17493
17657
|
const path2 = threadLivePath(threadId);
|
|
17494
|
-
if (!(0,
|
|
17658
|
+
if (!(0, import_node_fs44.existsSync)(path2)) return;
|
|
17495
17659
|
try {
|
|
17496
|
-
(0,
|
|
17660
|
+
(0, import_node_fs44.unlinkSync)(path2);
|
|
17497
17661
|
} catch {
|
|
17498
17662
|
}
|
|
17499
17663
|
}
|
|
17500
|
-
var
|
|
17664
|
+
var import_node_fs44, buffers, FLUSH_MS, MAX_PARTS;
|
|
17501
17665
|
var init_turn_live = __esm({
|
|
17502
17666
|
"src/store/turn-live.ts"() {
|
|
17503
17667
|
"use strict";
|
|
17504
|
-
|
|
17668
|
+
import_node_fs44 = require("fs");
|
|
17505
17669
|
init_message_parts();
|
|
17506
17670
|
init_paths();
|
|
17507
17671
|
buffers = /* @__PURE__ */ new Map();
|
|
@@ -17721,7 +17885,7 @@ var init_quota_failover = __esm({
|
|
|
17721
17885
|
// src/threads/adopt.ts
|
|
17722
17886
|
function thisModuleFile() {
|
|
17723
17887
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
17724
|
-
return cjsFile || process.argv[1] || (0,
|
|
17888
|
+
return cjsFile || process.argv[1] || (0, import_node_path43.join)(process.cwd(), "package.json");
|
|
17725
17889
|
}
|
|
17726
17890
|
function openReadonlySqlite(file) {
|
|
17727
17891
|
const req = (0, import_node_module4.createRequire)(thisModuleFile());
|
|
@@ -17739,21 +17903,21 @@ function mapAgentType(raw) {
|
|
|
17739
17903
|
return null;
|
|
17740
17904
|
}
|
|
17741
17905
|
function resolveConductorCursorAgentId(workspacePath) {
|
|
17742
|
-
if (!workspacePath || !(0,
|
|
17906
|
+
if (!workspacePath || !(0, import_node_fs45.existsSync)(CURSOR_SDK_STORE)) return null;
|
|
17743
17907
|
const normalized = workspacePath.replace(/\/$/, "");
|
|
17744
17908
|
let best = null;
|
|
17745
17909
|
let hashes;
|
|
17746
17910
|
try {
|
|
17747
|
-
hashes = (0,
|
|
17911
|
+
hashes = (0, import_node_fs45.readdirSync)(CURSOR_SDK_STORE);
|
|
17748
17912
|
} catch {
|
|
17749
17913
|
return null;
|
|
17750
17914
|
}
|
|
17751
17915
|
for (const hash of hashes) {
|
|
17752
|
-
const agentsFile = (0,
|
|
17753
|
-
if (!(0,
|
|
17916
|
+
const agentsFile = (0, import_node_path43.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
17917
|
+
if (!(0, import_node_fs45.existsSync)(agentsFile)) continue;
|
|
17754
17918
|
let text7;
|
|
17755
17919
|
try {
|
|
17756
|
-
text7 = (0,
|
|
17920
|
+
text7 = (0, import_node_fs45.readFileSync)(agentsFile, "utf8");
|
|
17757
17921
|
} catch {
|
|
17758
17922
|
continue;
|
|
17759
17923
|
}
|
|
@@ -17777,7 +17941,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
17777
17941
|
return best?.agentId ?? null;
|
|
17778
17942
|
}
|
|
17779
17943
|
async function adoptThread(input) {
|
|
17780
|
-
if (!(0,
|
|
17944
|
+
if (!(0, import_node_fs45.existsSync)(input.worktreePath)) {
|
|
17781
17945
|
throw new Error(`Worktree not found: ${input.worktreePath}`);
|
|
17782
17946
|
}
|
|
17783
17947
|
const repoPath = await resolveRepoRoot(input.worktreePath);
|
|
@@ -17806,18 +17970,18 @@ function conductorDbPath() {
|
|
|
17806
17970
|
return CONDUCTOR_DB;
|
|
17807
17971
|
}
|
|
17808
17972
|
function listConductorWorkspaces() {
|
|
17809
|
-
if (!(0,
|
|
17973
|
+
if (!(0, import_node_fs45.existsSync)(CONDUCTOR_DB)) {
|
|
17810
17974
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
17811
17975
|
}
|
|
17812
|
-
const tmp = (0,
|
|
17813
|
-
const snapshot = (0,
|
|
17976
|
+
const tmp = (0, import_node_fs45.mkdtempSync)((0, import_node_path43.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
|
|
17977
|
+
const snapshot = (0, import_node_path43.join)(tmp, "conductor.db");
|
|
17814
17978
|
try {
|
|
17815
|
-
(0,
|
|
17979
|
+
(0, import_node_fs45.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
17816
17980
|
for (const suffix of ["-wal", "-shm"]) {
|
|
17817
17981
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
17818
|
-
if ((0,
|
|
17982
|
+
if ((0, import_node_fs45.existsSync)(src)) {
|
|
17819
17983
|
try {
|
|
17820
|
-
(0,
|
|
17984
|
+
(0, import_node_fs45.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
17821
17985
|
} catch {
|
|
17822
17986
|
}
|
|
17823
17987
|
}
|
|
@@ -17893,22 +18057,22 @@ function listConductorWorkspaces() {
|
|
|
17893
18057
|
db.close();
|
|
17894
18058
|
}
|
|
17895
18059
|
} finally {
|
|
17896
|
-
(0,
|
|
18060
|
+
(0, import_node_fs45.rmSync)(tmp, { recursive: true, force: true });
|
|
17897
18061
|
}
|
|
17898
18062
|
}
|
|
17899
18063
|
function importConductorWorkspace(workspaceId) {
|
|
17900
|
-
if (!(0,
|
|
18064
|
+
if (!(0, import_node_fs45.existsSync)(CONDUCTOR_DB)) {
|
|
17901
18065
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
17902
18066
|
}
|
|
17903
|
-
const tmp = (0,
|
|
17904
|
-
const snapshot = (0,
|
|
18067
|
+
const tmp = (0, import_node_fs45.mkdtempSync)((0, import_node_path43.join)((0, import_node_os13.tmpdir)(), "sideboard-conductor-"));
|
|
18068
|
+
const snapshot = (0, import_node_path43.join)(tmp, "conductor.db");
|
|
17905
18069
|
try {
|
|
17906
|
-
(0,
|
|
18070
|
+
(0, import_node_fs45.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
17907
18071
|
for (const suffix of ["-wal", "-shm"]) {
|
|
17908
18072
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
17909
|
-
if ((0,
|
|
18073
|
+
if ((0, import_node_fs45.existsSync)(src)) {
|
|
17910
18074
|
try {
|
|
17911
|
-
(0,
|
|
18075
|
+
(0, import_node_fs45.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
17912
18076
|
} catch {
|
|
17913
18077
|
}
|
|
17914
18078
|
}
|
|
@@ -17926,7 +18090,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
17926
18090
|
).get(workspaceId);
|
|
17927
18091
|
if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
|
|
17928
18092
|
const worktreePath = String(row.workspacePath);
|
|
17929
|
-
if (!(0,
|
|
18093
|
+
if (!(0, import_node_fs45.existsSync)(worktreePath)) {
|
|
17930
18094
|
throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
|
|
17931
18095
|
}
|
|
17932
18096
|
let sessionId = null;
|
|
@@ -17966,7 +18130,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
17966
18130
|
}
|
|
17967
18131
|
let repoPath = worktreePath;
|
|
17968
18132
|
try {
|
|
17969
|
-
repoPath = (0,
|
|
18133
|
+
repoPath = (0, import_node_child_process5.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
|
|
17970
18134
|
cwd: worktreePath,
|
|
17971
18135
|
encoding: "utf8"
|
|
17972
18136
|
}).trim();
|
|
@@ -17989,31 +18153,31 @@ function importConductorWorkspace(workspaceId) {
|
|
|
17989
18153
|
db.close();
|
|
17990
18154
|
}
|
|
17991
18155
|
} finally {
|
|
17992
|
-
(0,
|
|
18156
|
+
(0, import_node_fs45.rmSync)(tmp, { recursive: true, force: true });
|
|
17993
18157
|
}
|
|
17994
18158
|
}
|
|
17995
18159
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
17996
18160
|
return importConductorWorkspace(workspaceId);
|
|
17997
18161
|
}
|
|
17998
|
-
var
|
|
18162
|
+
var import_node_child_process5, import_node_fs45, import_node_os13, import_node_path43, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
|
|
17999
18163
|
var init_adopt = __esm({
|
|
18000
18164
|
"src/threads/adopt.ts"() {
|
|
18001
18165
|
"use strict";
|
|
18002
|
-
|
|
18003
|
-
|
|
18166
|
+
import_node_child_process5 = require("child_process");
|
|
18167
|
+
import_node_fs45 = require("fs");
|
|
18004
18168
|
import_node_os13 = require("os");
|
|
18005
|
-
|
|
18169
|
+
import_node_path43 = require("path");
|
|
18006
18170
|
import_node_module4 = require("module");
|
|
18007
18171
|
init_worktree();
|
|
18008
18172
|
init_thread_store();
|
|
18009
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
18173
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path43.join)(
|
|
18010
18174
|
process.env.HOME ?? "",
|
|
18011
18175
|
"Library",
|
|
18012
18176
|
"Application Support",
|
|
18013
18177
|
"com.conductor.app"
|
|
18014
18178
|
);
|
|
18015
|
-
CONDUCTOR_DB = (0,
|
|
18016
|
-
CURSOR_SDK_STORE = (0,
|
|
18179
|
+
CONDUCTOR_DB = (0, import_node_path43.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
18180
|
+
CURSOR_SDK_STORE = (0, import_node_path43.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
18017
18181
|
}
|
|
18018
18182
|
});
|
|
18019
18183
|
|
|
@@ -18080,7 +18244,7 @@ async function openStackLayer(input, _onSetupLine) {
|
|
|
18080
18244
|
let createdWorktree = false;
|
|
18081
18245
|
const trees = await listWorktrees(repoPath);
|
|
18082
18246
|
const checkedOut = trees.find((w) => w.branch === branchName);
|
|
18083
|
-
if (checkedOut?.path && (0,
|
|
18247
|
+
if (checkedOut?.path && (0, import_node_fs46.existsSync)(checkedOut.path)) {
|
|
18084
18248
|
if (input.reuseExistingWorktree !== false) {
|
|
18085
18249
|
worktreePath = checkedOut.path;
|
|
18086
18250
|
} else {
|
|
@@ -18222,7 +18386,7 @@ async function initStackFromThread(input, onSetupLine) {
|
|
|
18222
18386
|
async function createPrStack(input, onSetupLine) {
|
|
18223
18387
|
await requireAgent(input.agent);
|
|
18224
18388
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
18225
|
-
if (!(0,
|
|
18389
|
+
if (!(0, import_node_fs46.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
|
|
18226
18390
|
if (!input.branches.length) throw new Error("At least one branch name required");
|
|
18227
18391
|
const status = await detectGhStack(repoPath);
|
|
18228
18392
|
if (!status.available) throw new Error(status.reason);
|
|
@@ -18289,7 +18453,7 @@ async function createPrStack(input, onSetupLine) {
|
|
|
18289
18453
|
}
|
|
18290
18454
|
}
|
|
18291
18455
|
const claimed = new Set(threads.map((t) => t.worktreePath));
|
|
18292
|
-
if (!claimed.has(bootstrap.worktreePath) && (0,
|
|
18456
|
+
if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs46.existsSync)(bootstrap.worktreePath)) {
|
|
18293
18457
|
try {
|
|
18294
18458
|
await removeWorktree(repoPath, bootstrap.worktreePath, {
|
|
18295
18459
|
deleteBranch: bootstrap.branchName
|
|
@@ -18309,11 +18473,11 @@ function stackAgentDefaultsFrom(input) {
|
|
|
18309
18473
|
planMode: input.planMode
|
|
18310
18474
|
};
|
|
18311
18475
|
}
|
|
18312
|
-
var
|
|
18476
|
+
var import_node_fs46;
|
|
18313
18477
|
var init_stack_layers = __esm({
|
|
18314
18478
|
"src/threads/stack-layers.ts"() {
|
|
18315
18479
|
"use strict";
|
|
18316
|
-
|
|
18480
|
+
import_node_fs46 = require("fs");
|
|
18317
18481
|
init_detect();
|
|
18318
18482
|
init_run();
|
|
18319
18483
|
init_stack();
|
|
@@ -18326,7 +18490,7 @@ var init_stack_layers = __esm({
|
|
|
18326
18490
|
|
|
18327
18491
|
// src/diff/diff.ts
|
|
18328
18492
|
async function inspectGitWorktree(worktreePath) {
|
|
18329
|
-
if (!worktreePath || !(0,
|
|
18493
|
+
if (!worktreePath || !(0, import_node_fs47.existsSync)(worktreePath)) return "missing_worktree";
|
|
18330
18494
|
const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
|
|
18331
18495
|
reject: false
|
|
18332
18496
|
});
|
|
@@ -18334,7 +18498,7 @@ async function inspectGitWorktree(worktreePath) {
|
|
|
18334
18498
|
return "ok";
|
|
18335
18499
|
}
|
|
18336
18500
|
async function initializeGitRepository(worktreePath) {
|
|
18337
|
-
if (!worktreePath || !(0,
|
|
18501
|
+
if (!worktreePath || !(0, import_node_fs47.existsSync)(worktreePath)) {
|
|
18338
18502
|
throw new Error("Worktree not found");
|
|
18339
18503
|
}
|
|
18340
18504
|
const status = await inspectGitWorktree(worktreePath);
|
|
@@ -18468,11 +18632,11 @@ new file mode 100644
|
|
|
18468
18632
|
};
|
|
18469
18633
|
}
|
|
18470
18634
|
async function untrackedPatch(worktreePath, path2, maxHunk) {
|
|
18471
|
-
const abs = (0,
|
|
18635
|
+
const abs = (0, import_node_path44.join)(worktreePath, path2);
|
|
18472
18636
|
try {
|
|
18473
|
-
const st = (0,
|
|
18637
|
+
const st = (0, import_node_fs47.statSync)(abs);
|
|
18474
18638
|
if (st.isFile() && st.size > maxHunk) {
|
|
18475
|
-
const buf = (0,
|
|
18639
|
+
const buf = (0, import_node_fs47.readFileSync)(abs).subarray(0, maxHunk);
|
|
18476
18640
|
return syntheticAddPatch(path2, buf.toString("utf8"), maxHunk);
|
|
18477
18641
|
}
|
|
18478
18642
|
} catch {
|
|
@@ -18961,8 +19125,8 @@ function isImageRelativePath(relativePath) {
|
|
|
18961
19125
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
18962
19126
|
assertSafeRelativePath(relativePath);
|
|
18963
19127
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
18964
|
-
const abs = (0,
|
|
18965
|
-
const st = (0,
|
|
19128
|
+
const abs = (0, import_node_path44.join)(worktreePath, relativePath);
|
|
19129
|
+
const st = (0, import_node_fs47.statSync)(abs);
|
|
18966
19130
|
if (!st.isFile()) {
|
|
18967
19131
|
throw new Error(`Not a file: ${relativePath}`);
|
|
18968
19132
|
}
|
|
@@ -18971,7 +19135,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
18971
19135
|
`File too large to upload (${st.size} bytes; max ${maxBytes})`
|
|
18972
19136
|
);
|
|
18973
19137
|
}
|
|
18974
|
-
const buf = (0,
|
|
19138
|
+
const buf = (0, import_node_fs47.readFileSync)(abs);
|
|
18975
19139
|
return {
|
|
18976
19140
|
path: relativePath,
|
|
18977
19141
|
contentBase64: buf.toString("base64"),
|
|
@@ -18981,12 +19145,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
18981
19145
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
18982
19146
|
assertSafeRelativePath(relativePath);
|
|
18983
19147
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
18984
|
-
const abs = (0,
|
|
18985
|
-
const st = (0,
|
|
19148
|
+
const abs = (0, import_node_path44.join)(worktreePath, relativePath);
|
|
19149
|
+
const st = (0, import_node_fs47.statSync)(abs);
|
|
18986
19150
|
if (!st.isFile()) {
|
|
18987
19151
|
throw new Error(`Not a file: ${relativePath}`);
|
|
18988
19152
|
}
|
|
18989
|
-
const buf = (0,
|
|
19153
|
+
const buf = (0, import_node_fs47.readFileSync)(abs);
|
|
18990
19154
|
if (isImageRelativePath(relativePath)) {
|
|
18991
19155
|
const maxImageBytes = Math.max(maxBytes, 15e6);
|
|
18992
19156
|
const truncated2 = buf.length > maxImageBytes;
|
|
@@ -19029,9 +19193,9 @@ function assertSafeRelativePath(relativePath) {
|
|
|
19029
19193
|
}
|
|
19030
19194
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
19031
19195
|
assertSafeRelativePath(relativePath);
|
|
19032
|
-
const abs = (0,
|
|
19033
|
-
(0,
|
|
19034
|
-
(0,
|
|
19196
|
+
const abs = (0, import_node_path44.join)(worktreePath, relativePath);
|
|
19197
|
+
(0, import_node_fs47.mkdirSync)((0, import_node_path44.dirname)(abs), { recursive: true });
|
|
19198
|
+
(0, import_node_fs47.writeFileSync)(abs, content, "utf8");
|
|
19035
19199
|
return { path: relativePath };
|
|
19036
19200
|
}
|
|
19037
19201
|
async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
@@ -19048,12 +19212,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
19048
19212
|
truncated: full.files.length > maxFiles
|
|
19049
19213
|
};
|
|
19050
19214
|
}
|
|
19051
|
-
var
|
|
19215
|
+
var import_node_fs47, import_node_path44, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
|
|
19052
19216
|
var init_diff = __esm({
|
|
19053
19217
|
"src/diff/diff.ts"() {
|
|
19054
19218
|
"use strict";
|
|
19055
|
-
|
|
19056
|
-
|
|
19219
|
+
import_node_fs47 = require("fs");
|
|
19220
|
+
import_node_path44 = require("path");
|
|
19057
19221
|
init_run();
|
|
19058
19222
|
init_worktree();
|
|
19059
19223
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -19329,7 +19493,7 @@ function parseFrontmatter(content) {
|
|
|
19329
19493
|
}
|
|
19330
19494
|
function readSkill(skillMd, source) {
|
|
19331
19495
|
try {
|
|
19332
|
-
const content = (0,
|
|
19496
|
+
const content = (0, import_node_fs48.readFileSync)(skillMd, "utf8");
|
|
19333
19497
|
const { name: fmName, description } = parseFrontmatter(content);
|
|
19334
19498
|
const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
|
|
19335
19499
|
const name = fmName || dirName;
|
|
@@ -19348,19 +19512,19 @@ function readSkill(skillMd, source) {
|
|
|
19348
19512
|
}
|
|
19349
19513
|
}
|
|
19350
19514
|
function scanSkillsDir(dir, source, out) {
|
|
19351
|
-
if (!(0,
|
|
19515
|
+
if (!(0, import_node_fs48.existsSync)(dir)) return;
|
|
19352
19516
|
let entries;
|
|
19353
19517
|
try {
|
|
19354
|
-
entries = (0,
|
|
19518
|
+
entries = (0, import_node_fs48.readdirSync)(dir);
|
|
19355
19519
|
} catch {
|
|
19356
19520
|
return;
|
|
19357
19521
|
}
|
|
19358
19522
|
for (const entry of entries) {
|
|
19359
19523
|
if (entry.startsWith(".")) continue;
|
|
19360
|
-
const skillMd = (0,
|
|
19361
|
-
if (!(0,
|
|
19524
|
+
const skillMd = (0, import_node_path45.join)(dir, entry, "SKILL.md");
|
|
19525
|
+
if (!(0, import_node_fs48.existsSync)(skillMd)) continue;
|
|
19362
19526
|
try {
|
|
19363
|
-
if (!(0,
|
|
19527
|
+
if (!(0, import_node_fs48.statSync)(skillMd).isFile()) continue;
|
|
19364
19528
|
} catch {
|
|
19365
19529
|
continue;
|
|
19366
19530
|
}
|
|
@@ -19369,24 +19533,24 @@ function scanSkillsDir(dir, source, out) {
|
|
|
19369
19533
|
}
|
|
19370
19534
|
}
|
|
19371
19535
|
function scanClaudePluginSkills(pluginsRoot, out) {
|
|
19372
|
-
if (!(0,
|
|
19536
|
+
if (!(0, import_node_fs48.existsSync)(pluginsRoot)) return;
|
|
19373
19537
|
const walk = (dir, depth, lookingForSkillsDir) => {
|
|
19374
19538
|
if (depth > 7) return;
|
|
19375
19539
|
let entries;
|
|
19376
19540
|
try {
|
|
19377
|
-
entries = (0,
|
|
19541
|
+
entries = (0, import_node_fs48.readdirSync)(dir);
|
|
19378
19542
|
} catch {
|
|
19379
19543
|
return;
|
|
19380
19544
|
}
|
|
19381
19545
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
19382
|
-
const skill = readSkill((0,
|
|
19546
|
+
const skill = readSkill((0, import_node_path45.join)(dir, "SKILL.md"), "cli");
|
|
19383
19547
|
if (skill) out.push(skill);
|
|
19384
19548
|
}
|
|
19385
19549
|
for (const entry of entries) {
|
|
19386
19550
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
19387
|
-
const full = (0,
|
|
19551
|
+
const full = (0, import_node_path45.join)(dir, entry);
|
|
19388
19552
|
try {
|
|
19389
|
-
if (!(0,
|
|
19553
|
+
if (!(0, import_node_fs48.statSync)(full).isDirectory()) continue;
|
|
19390
19554
|
} catch {
|
|
19391
19555
|
continue;
|
|
19392
19556
|
}
|
|
@@ -19404,17 +19568,17 @@ function discoverSkills(worktreePath) {
|
|
|
19404
19568
|
const home = (0, import_node_os14.homedir)();
|
|
19405
19569
|
const collected = [];
|
|
19406
19570
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
19407
|
-
scanSkillsDir((0,
|
|
19571
|
+
scanSkillsDir((0, import_node_path45.join)(worktreePath, rel), "workspace", collected);
|
|
19408
19572
|
}
|
|
19409
19573
|
for (const abs of [
|
|
19410
|
-
(0,
|
|
19411
|
-
(0,
|
|
19412
|
-
(0,
|
|
19413
|
-
(0,
|
|
19574
|
+
(0, import_node_path45.join)(home, ".claude/skills"),
|
|
19575
|
+
(0, import_node_path45.join)(home, ".cursor/skills"),
|
|
19576
|
+
(0, import_node_path45.join)(home, ".sideboard/skills"),
|
|
19577
|
+
(0, import_node_path45.join)(home, ".brightsy/skills")
|
|
19414
19578
|
]) {
|
|
19415
19579
|
scanSkillsDir(abs, "user", collected);
|
|
19416
19580
|
}
|
|
19417
|
-
scanClaudePluginSkills((0,
|
|
19581
|
+
scanClaudePluginSkills((0, import_node_path45.join)(home, ".claude/plugins"), collected);
|
|
19418
19582
|
collected.push(...bundledSkills());
|
|
19419
19583
|
const rank = {
|
|
19420
19584
|
workspace: 0,
|
|
@@ -19440,7 +19604,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
19440
19604
|
\u2026(truncated)` : body;
|
|
19441
19605
|
}
|
|
19442
19606
|
}
|
|
19443
|
-
const raw = (0,
|
|
19607
|
+
const raw = (0, import_node_fs48.readFileSync)(skillPath, "utf8");
|
|
19444
19608
|
if (raw.startsWith("---")) {
|
|
19445
19609
|
const end = raw.indexOf("\n---", 3);
|
|
19446
19610
|
if (end >= 0) {
|
|
@@ -19454,13 +19618,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
19454
19618
|
|
|
19455
19619
|
\u2026(truncated)` : raw;
|
|
19456
19620
|
}
|
|
19457
|
-
var
|
|
19621
|
+
var import_node_fs48, import_node_os14, import_node_path45, BUNDLED_SKILL_PREFIX;
|
|
19458
19622
|
var init_discover = __esm({
|
|
19459
19623
|
"src/skills/discover.ts"() {
|
|
19460
19624
|
"use strict";
|
|
19461
|
-
|
|
19625
|
+
import_node_fs48 = require("fs");
|
|
19462
19626
|
import_node_os14 = require("os");
|
|
19463
|
-
|
|
19627
|
+
import_node_path45 = require("path");
|
|
19464
19628
|
init_long_running();
|
|
19465
19629
|
BUNDLED_SKILL_PREFIX = "bundled:";
|
|
19466
19630
|
}
|
|
@@ -19554,8 +19718,8 @@ var init_expand = __esm({
|
|
|
19554
19718
|
// src/skills/detached-job-path.ts
|
|
19555
19719
|
function detachedJobScriptIn(dir) {
|
|
19556
19720
|
for (const name of DETACHED_JOB_FILENAMES) {
|
|
19557
|
-
const script = (0,
|
|
19558
|
-
if ((0,
|
|
19721
|
+
const script = (0, import_node_path46.join)(dir, "scripts", name);
|
|
19722
|
+
if ((0, import_node_fs49.existsSync)(script)) return script;
|
|
19559
19723
|
}
|
|
19560
19724
|
return null;
|
|
19561
19725
|
}
|
|
@@ -19567,11 +19731,11 @@ function packagedDetachedJobPath() {
|
|
|
19567
19731
|
function resolveDetachedJobScript() {
|
|
19568
19732
|
const packaged = packagedDetachedJobPath();
|
|
19569
19733
|
if (packaged) return packaged;
|
|
19570
|
-
let dir = (0,
|
|
19734
|
+
let dir = (0, import_node_path46.dirname)((0, import_node_url3.fileURLToPath)(import_meta3.url));
|
|
19571
19735
|
for (let i = 0; i < 8; i++) {
|
|
19572
19736
|
const candidate = detachedJobScriptIn(dir);
|
|
19573
19737
|
if (candidate) return candidate;
|
|
19574
|
-
const parent = (0,
|
|
19738
|
+
const parent = (0, import_node_path46.dirname)(dir);
|
|
19575
19739
|
if (parent === dir) break;
|
|
19576
19740
|
dir = parent;
|
|
19577
19741
|
}
|
|
@@ -19582,12 +19746,12 @@ function formatDetachedJobInvoke(scriptPath) {
|
|
|
19582
19746
|
if (resolved) return `node ${JSON.stringify(resolved)}`;
|
|
19583
19747
|
return "node scripts/detached-job.cjs";
|
|
19584
19748
|
}
|
|
19585
|
-
var
|
|
19749
|
+
var import_node_fs49, import_node_path46, import_node_url3, import_meta3, DETACHED_JOB_FILENAMES;
|
|
19586
19750
|
var init_detached_job_path = __esm({
|
|
19587
19751
|
"src/skills/detached-job-path.ts"() {
|
|
19588
19752
|
"use strict";
|
|
19589
|
-
|
|
19590
|
-
|
|
19753
|
+
import_node_fs49 = require("fs");
|
|
19754
|
+
import_node_path46 = require("path");
|
|
19591
19755
|
import_node_url3 = require("url");
|
|
19592
19756
|
init_packaged_runtime();
|
|
19593
19757
|
import_meta3 = {};
|
|
@@ -19767,9 +19931,9 @@ function formatPrGateDirective() {
|
|
|
19767
19931
|
}
|
|
19768
19932
|
function formatProcessGuideDirective(opts) {
|
|
19769
19933
|
const worktree = opts?.worktreePath?.trim();
|
|
19770
|
-
const hasGraphSkill = !!worktree && (0,
|
|
19771
|
-
const hasReviewSkill = !!worktree && (0,
|
|
19772
|
-
const hasInstallSkill = !!worktree && (0,
|
|
19934
|
+
const hasGraphSkill = !!worktree && (0, import_node_fs50.existsSync)((0, import_node_path47.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
|
|
19935
|
+
const hasReviewSkill = !!worktree && (0, import_node_fs50.existsSync)((0, import_node_path47.join)(worktree, ".claude/skills/review/SKILL.md"));
|
|
19936
|
+
const hasInstallSkill = !!worktree && (0, import_node_fs50.existsSync)((0, import_node_path47.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
|
|
19773
19937
|
return [
|
|
19774
19938
|
"Process guides (recurring work only):",
|
|
19775
19939
|
hasGraphSkill ? "- Migrations, ports, batch fixes, and other fan-out: follow `.claude/skills/graph-engineering/SKILL.md` (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch around it." : null,
|
|
@@ -19807,12 +19971,12 @@ function formatArtifactDirective() {
|
|
|
19807
19971
|
function formatUiReminder() {
|
|
19808
19972
|
return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. type=log appends (same artifact_id, new lines only). ask_user only for a real multiple-choice (not hellos or \u201Cwhat next?\u201D) \u2014 reply in chat. Do not say artifacts/CMS UI are unavailable.";
|
|
19809
19973
|
}
|
|
19810
|
-
var
|
|
19974
|
+
var import_node_fs50, import_node_path47, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
|
|
19811
19975
|
var init_instructions = __esm({
|
|
19812
19976
|
"src/agents/instructions.ts"() {
|
|
19813
19977
|
"use strict";
|
|
19814
|
-
|
|
19815
|
-
|
|
19978
|
+
import_node_fs50 = require("fs");
|
|
19979
|
+
import_node_path47 = require("path");
|
|
19816
19980
|
init_git_auth_mode();
|
|
19817
19981
|
init_worktree_labels();
|
|
19818
19982
|
init_detached_job_path();
|
|
@@ -20165,40 +20329,40 @@ __export(plan_file_exports, {
|
|
|
20165
20329
|
writePlanFile: () => writePlanFile
|
|
20166
20330
|
});
|
|
20167
20331
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
20168
|
-
const gitignoreAbs = (0,
|
|
20169
|
-
if ((0,
|
|
20170
|
-
(0,
|
|
20171
|
-
(0,
|
|
20332
|
+
const gitignoreAbs = (0, import_node_path48.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
20333
|
+
if ((0, import_node_fs51.existsSync)(gitignoreAbs)) return;
|
|
20334
|
+
(0, import_node_fs51.mkdirSync)((0, import_node_path48.dirname)(gitignoreAbs), { recursive: true });
|
|
20335
|
+
(0, import_node_fs51.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
20172
20336
|
}
|
|
20173
20337
|
function planFileAbs(worktreePath) {
|
|
20174
|
-
return (0,
|
|
20338
|
+
return (0, import_node_path48.join)(worktreePath, PLAN_FILE_REL);
|
|
20175
20339
|
}
|
|
20176
20340
|
function readTextIfPresent2(abs) {
|
|
20177
|
-
if (!(0,
|
|
20341
|
+
if (!(0, import_node_fs51.existsSync)(abs)) return null;
|
|
20178
20342
|
try {
|
|
20179
|
-
const content = (0,
|
|
20343
|
+
const content = (0, import_node_fs51.readFileSync)(abs, "utf8");
|
|
20180
20344
|
return content.trim() ? content : null;
|
|
20181
20345
|
} catch {
|
|
20182
20346
|
return null;
|
|
20183
20347
|
}
|
|
20184
20348
|
}
|
|
20185
20349
|
function readPlanFile(worktreePath) {
|
|
20186
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
20350
|
+
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path48.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path48.join)(worktreePath, LEGACY_PLAN_FILE_REL));
|
|
20187
20351
|
}
|
|
20188
20352
|
function writePlanFile(worktreePath, content) {
|
|
20189
20353
|
ensureAttachmentsGitignore(worktreePath);
|
|
20190
20354
|
const abs = planFileAbs(worktreePath);
|
|
20191
|
-
(0,
|
|
20355
|
+
(0, import_node_fs51.mkdirSync)((0, import_node_path48.dirname)(abs), { recursive: true });
|
|
20192
20356
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
20193
|
-
(0,
|
|
20357
|
+
(0, import_node_fs51.writeFileSync)(abs, body, "utf8");
|
|
20194
20358
|
return PLAN_FILE_REL;
|
|
20195
20359
|
}
|
|
20196
|
-
var
|
|
20360
|
+
var import_node_fs51, import_node_path48;
|
|
20197
20361
|
var init_plan_file = __esm({
|
|
20198
20362
|
"src/plan/plan-file.ts"() {
|
|
20199
20363
|
"use strict";
|
|
20200
|
-
|
|
20201
|
-
|
|
20364
|
+
import_node_fs51 = require("fs");
|
|
20365
|
+
import_node_path48 = require("path");
|
|
20202
20366
|
init_workspace_scratch();
|
|
20203
20367
|
init_plan_present();
|
|
20204
20368
|
init_plan_present();
|
|
@@ -20246,13 +20410,13 @@ var init_sync_branch = __esm({
|
|
|
20246
20410
|
|
|
20247
20411
|
// src/agents/cursor-store.ts
|
|
20248
20412
|
function cursorSdkStoreDir(threadId) {
|
|
20249
|
-
const root = (0,
|
|
20413
|
+
const root = (0, import_node_path49.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
|
|
20250
20414
|
const id = sanitizeCursorStoreSegment(threadId);
|
|
20251
20415
|
if (!id) return root;
|
|
20252
|
-
return (0,
|
|
20416
|
+
return (0, import_node_path49.join)(root, "threads", id);
|
|
20253
20417
|
}
|
|
20254
20418
|
function cursorSdkRunsNdjsonPath(threadId) {
|
|
20255
|
-
return (0,
|
|
20419
|
+
return (0, import_node_path49.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
|
|
20256
20420
|
}
|
|
20257
20421
|
function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
20258
20422
|
const scoped = cursorSdkRunsNdjsonPath(threadId);
|
|
@@ -20265,11 +20429,11 @@ function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
|
20265
20429
|
function sanitizeCursorStoreSegment(threadId) {
|
|
20266
20430
|
return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
20267
20431
|
}
|
|
20268
|
-
var
|
|
20432
|
+
var import_node_path49, CURSOR_SDK_STORE_DIR;
|
|
20269
20433
|
var init_cursor_store = __esm({
|
|
20270
20434
|
"src/agents/cursor-store.ts"() {
|
|
20271
20435
|
"use strict";
|
|
20272
|
-
|
|
20436
|
+
import_node_path49 = require("path");
|
|
20273
20437
|
init_paths();
|
|
20274
20438
|
CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
|
|
20275
20439
|
}
|
|
@@ -20291,9 +20455,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
20291
20455
|
return best;
|
|
20292
20456
|
}
|
|
20293
20457
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
20294
|
-
if (!(0,
|
|
20458
|
+
if (!(0, import_node_fs52.existsSync)(runsPath)) return null;
|
|
20295
20459
|
try {
|
|
20296
|
-
const lines = (0,
|
|
20460
|
+
const lines = (0, import_node_fs52.readFileSync)(runsPath, "utf8").split("\n");
|
|
20297
20461
|
let best = null;
|
|
20298
20462
|
for (const line of lines) {
|
|
20299
20463
|
const trimmed = line.trim();
|
|
@@ -20319,11 +20483,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
20319
20483
|
return null;
|
|
20320
20484
|
}
|
|
20321
20485
|
}
|
|
20322
|
-
var
|
|
20486
|
+
var import_node_fs52;
|
|
20323
20487
|
var init_cursor_recover = __esm({
|
|
20324
20488
|
"src/agents/cursor-recover.ts"() {
|
|
20325
20489
|
"use strict";
|
|
20326
|
-
|
|
20490
|
+
import_node_fs52 = require("fs");
|
|
20327
20491
|
init_cursor_store();
|
|
20328
20492
|
}
|
|
20329
20493
|
});
|
|
@@ -20455,13 +20619,13 @@ async function startOrchestration(opts) {
|
|
|
20455
20619
|
}
|
|
20456
20620
|
return updated;
|
|
20457
20621
|
}
|
|
20458
|
-
var import_node_events,
|
|
20622
|
+
var import_node_events, import_node_fs53, LIVE_TURN_SPAWN_GRACE_MS, STALE_AGENT_PID_WAIT_MS, Orchestrator, singleton;
|
|
20459
20623
|
var init_orchestrator = __esm({
|
|
20460
20624
|
"src/orchestrator/orchestrator.ts"() {
|
|
20461
20625
|
"use strict";
|
|
20462
20626
|
import_node_events = require("events");
|
|
20463
20627
|
init_outbound_watch();
|
|
20464
|
-
|
|
20628
|
+
import_node_fs53 = require("fs");
|
|
20465
20629
|
init_error_detail();
|
|
20466
20630
|
init_run();
|
|
20467
20631
|
init_stale_lock();
|
|
@@ -20634,7 +20798,7 @@ var init_orchestrator = __esm({
|
|
|
20634
20798
|
}
|
|
20635
20799
|
continue;
|
|
20636
20800
|
}
|
|
20637
|
-
if (!(0,
|
|
20801
|
+
if (!(0, import_node_fs53.existsSync)(thread.worktreePath)) {
|
|
20638
20802
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
20639
20803
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
20640
20804
|
continue;
|
|
@@ -21179,9 +21343,10 @@ var init_orchestrator = __esm({
|
|
|
21179
21343
|
ts: (/* @__PURE__ */ new Date()).toISOString()
|
|
21180
21344
|
});
|
|
21181
21345
|
thread = this.requireThread(threadId);
|
|
21346
|
+
const gitPrompt = expandCanonicalGitRequest(prompt);
|
|
21182
21347
|
const { agentPrompt: expandedPrompt } = expandComposerPrompt(
|
|
21183
21348
|
thread.worktreePath,
|
|
21184
|
-
|
|
21349
|
+
gitPrompt,
|
|
21185
21350
|
{
|
|
21186
21351
|
attachments: sentAttachments ?? thread.attachments
|
|
21187
21352
|
}
|
|
@@ -21223,13 +21388,13 @@ var init_orchestrator = __esm({
|
|
|
21223
21388
|
artifactReminder,
|
|
21224
21389
|
longRunningReminder
|
|
21225
21390
|
].filter(Boolean).join("\n\n") || void 0;
|
|
21226
|
-
const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(
|
|
21391
|
+
const prGateDirective = thread.agent !== "brightsy" && !isOrchestratorThread(thread) && mentionsPrGoal(prompt) ? formatPrGateDirective() : null;
|
|
21227
21392
|
const agentPrompt = [
|
|
21228
21393
|
thread.planMode ? PLAN_MODE_INSTRUCTION : null,
|
|
21229
21394
|
orchestrationReminder,
|
|
21230
21395
|
prGateDirective,
|
|
21231
21396
|
slackReplyContext,
|
|
21232
|
-
|
|
21397
|
+
expandedPrompt
|
|
21233
21398
|
].filter(Boolean).join("\n\n");
|
|
21234
21399
|
if (thread.attachments.length > 0) {
|
|
21235
21400
|
updateThread(threadId, { attachments: [] });
|
|
@@ -22524,7 +22689,7 @@ var init_orchestrator = __esm({
|
|
|
22524
22689
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
22525
22690
|
return restored2;
|
|
22526
22691
|
}
|
|
22527
|
-
if (!(0,
|
|
22692
|
+
if (!(0, import_node_fs53.existsSync)(thread.worktreePath)) {
|
|
22528
22693
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
22529
22694
|
throw new Error(
|
|
22530
22695
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -22842,6 +23007,7 @@ __export(index_exports, {
|
|
|
22842
23007
|
applyForwardOccupancy: () => applyForwardOccupancy,
|
|
22843
23008
|
applyGithubGitAuthEnv: () => applyGithubGitAuthEnv,
|
|
22844
23009
|
applyPromptCacheTtlEnv: () => applyPromptCacheTtlEnv,
|
|
23010
|
+
applySystemCaEnv: () => applySystemCaEnv,
|
|
22845
23011
|
applyThreadIntoMain: () => applyThreadIntoMain,
|
|
22846
23012
|
applyTurnUsage: () => applyTurnUsage,
|
|
22847
23013
|
armSchedules: () => armSchedules,
|
|
@@ -23220,6 +23386,7 @@ __export(index_exports, {
|
|
|
23220
23386
|
lookupSoccerTeam: () => lookupSoccerTeam,
|
|
23221
23387
|
mapAbleTimeTask: () => mapAbleTimeTask,
|
|
23222
23388
|
markPrReady: () => markPrReady,
|
|
23389
|
+
materializeSystemCaBundle: () => materializeSystemCaBundle,
|
|
23223
23390
|
maxConcurrentAgents: () => maxConcurrentAgents,
|
|
23224
23391
|
maybeCompactContext: () => maybeCompactContext,
|
|
23225
23392
|
mcpAllowTools: () => mcpAllowTools,
|
|
@@ -23443,6 +23610,7 @@ __export(index_exports, {
|
|
|
23443
23610
|
toolDetail: () => toolDetail,
|
|
23444
23611
|
toolFilePath: () => toolFilePath,
|
|
23445
23612
|
totalTokens: () => totalTokens,
|
|
23613
|
+
trustSystemCertificates: () => trustSystemCertificates,
|
|
23446
23614
|
turnCostUsdFromCursorUsage: () => turnCostUsdFromCursorUsage,
|
|
23447
23615
|
updateAbleTimeTask: () => updateAbleTimeTask,
|
|
23448
23616
|
updateAdvancedSettings: () => updateAdvancedSettings,
|
|
@@ -24809,6 +24977,7 @@ async function installOptionalServiceCli(id) {
|
|
|
24809
24977
|
|
|
24810
24978
|
// src/index.ts
|
|
24811
24979
|
init_fetch();
|
|
24980
|
+
init_system_ca();
|
|
24812
24981
|
init_agents();
|
|
24813
24982
|
init_spawn();
|
|
24814
24983
|
init_message_parts();
|
|
@@ -25154,7 +25323,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
25154
25323
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
25155
25324
|
var import_zod8 = require("zod");
|
|
25156
25325
|
var import_node_crypto13 = require("crypto");
|
|
25157
|
-
var
|
|
25326
|
+
var import_node_path52 = require("path");
|
|
25158
25327
|
init_orchestrator();
|
|
25159
25328
|
init_worktree();
|
|
25160
25329
|
init_global_workspace();
|
|
@@ -26738,27 +26907,27 @@ init_gh_errors();
|
|
|
26738
26907
|
init_git_auth_mode();
|
|
26739
26908
|
|
|
26740
26909
|
// src/board/load-home-board.ts
|
|
26741
|
-
var
|
|
26742
|
-
var
|
|
26910
|
+
var import_node_fs55 = require("fs");
|
|
26911
|
+
var import_node_path51 = require("path");
|
|
26743
26912
|
init_worktree();
|
|
26744
26913
|
init_paths();
|
|
26745
26914
|
|
|
26746
26915
|
// src/board/board-pins.ts
|
|
26747
26916
|
var import_node_crypto12 = require("crypto");
|
|
26748
|
-
var
|
|
26749
|
-
var
|
|
26917
|
+
var import_node_fs54 = require("fs");
|
|
26918
|
+
var import_node_path50 = require("path");
|
|
26750
26919
|
init_paths();
|
|
26751
26920
|
init_home_board();
|
|
26752
26921
|
var FILE = "home-board-pins.json";
|
|
26753
26922
|
var VERSION = 1;
|
|
26754
26923
|
function pinsFile() {
|
|
26755
|
-
return (0,
|
|
26924
|
+
return (0, import_node_path50.join)(appDataDir(), FILE);
|
|
26756
26925
|
}
|
|
26757
26926
|
function readDisk() {
|
|
26758
26927
|
const path2 = pinsFile();
|
|
26759
|
-
if (!(0,
|
|
26928
|
+
if (!(0, import_node_fs54.existsSync)(path2)) return [];
|
|
26760
26929
|
try {
|
|
26761
|
-
const raw = JSON.parse((0,
|
|
26930
|
+
const raw = JSON.parse((0, import_node_fs54.readFileSync)(path2, "utf8"));
|
|
26762
26931
|
if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
|
|
26763
26932
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
26764
26933
|
} catch {
|
|
@@ -26766,8 +26935,8 @@ function readDisk() {
|
|
|
26766
26935
|
}
|
|
26767
26936
|
}
|
|
26768
26937
|
function writeDisk(items) {
|
|
26769
|
-
(0,
|
|
26770
|
-
(0,
|
|
26938
|
+
(0, import_node_fs54.mkdirSync)(appDataDir(), { recursive: true });
|
|
26939
|
+
(0, import_node_fs54.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
|
|
26771
26940
|
}
|
|
26772
26941
|
function listBoardPins() {
|
|
26773
26942
|
return readDisk();
|
|
@@ -26819,7 +26988,7 @@ function replaceBoardPins(items) {
|
|
|
26819
26988
|
}
|
|
26820
26989
|
function clearBoardPins() {
|
|
26821
26990
|
try {
|
|
26822
|
-
(0,
|
|
26991
|
+
(0, import_node_fs54.unlinkSync)(pinsFile());
|
|
26823
26992
|
} catch {
|
|
26824
26993
|
}
|
|
26825
26994
|
}
|
|
@@ -26836,7 +27005,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
26836
27005
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
26837
27006
|
}
|
|
26838
27007
|
function cacheFile() {
|
|
26839
|
-
return (0,
|
|
27008
|
+
return (0, import_node_path51.join)(appDataDir(), "home-board-cache.json");
|
|
26840
27009
|
}
|
|
26841
27010
|
function emptyInputs() {
|
|
26842
27011
|
return {
|
|
@@ -26862,9 +27031,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
26862
27031
|
}
|
|
26863
27032
|
function readDiskCache() {
|
|
26864
27033
|
const path2 = cacheFile();
|
|
26865
|
-
if (!(0,
|
|
27034
|
+
if (!(0, import_node_fs55.existsSync)(path2)) return null;
|
|
26866
27035
|
try {
|
|
26867
|
-
const raw = JSON.parse((0,
|
|
27036
|
+
const raw = JSON.parse((0, import_node_fs55.readFileSync)(path2, "utf8"));
|
|
26868
27037
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
26869
27038
|
return null;
|
|
26870
27039
|
}
|
|
@@ -26878,14 +27047,14 @@ function readDiskCache() {
|
|
|
26878
27047
|
}
|
|
26879
27048
|
function writeDiskCache(entry) {
|
|
26880
27049
|
try {
|
|
26881
|
-
(0,
|
|
26882
|
-
(0,
|
|
27050
|
+
(0, import_node_fs55.mkdirSync)(appDataDir(), { recursive: true });
|
|
27051
|
+
(0, import_node_fs55.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
26883
27052
|
} catch {
|
|
26884
27053
|
}
|
|
26885
27054
|
}
|
|
26886
27055
|
function deleteDiskCache() {
|
|
26887
27056
|
try {
|
|
26888
|
-
(0,
|
|
27057
|
+
(0, import_node_fs55.unlinkSync)(cacheFile());
|
|
26889
27058
|
} catch {
|
|
26890
27059
|
}
|
|
26891
27060
|
}
|
|
@@ -27021,6 +27190,52 @@ async function getHomeBoardInputs(workspaces, opts) {
|
|
|
27021
27190
|
|
|
27022
27191
|
// src/mcp/server.ts
|
|
27023
27192
|
init_home_board();
|
|
27193
|
+
|
|
27194
|
+
// src/mcp/create-thread-agent.ts
|
|
27195
|
+
function resolveOrchCreateThreadOptions(input) {
|
|
27196
|
+
const { resolveNewThreadOptions: resolveNewThreadOptions2 } = input;
|
|
27197
|
+
const account = resolveNewThreadOptions2({});
|
|
27198
|
+
const requested = input.requestedAgent;
|
|
27199
|
+
const parent = input.parentAgent ?? void 0;
|
|
27200
|
+
let agent = account.agent;
|
|
27201
|
+
let ignoredAgent;
|
|
27202
|
+
let honorRequestedModel = false;
|
|
27203
|
+
if (requested) {
|
|
27204
|
+
const parentEcho = Boolean(parent) && requested === parent && requested !== account.agent;
|
|
27205
|
+
const cursorAutofill = requested === "cursor" && account.agent !== "cursor";
|
|
27206
|
+
if (parentEcho || cursorAutofill) {
|
|
27207
|
+
ignoredAgent = requested;
|
|
27208
|
+
} else {
|
|
27209
|
+
agent = requested;
|
|
27210
|
+
honorRequestedModel = input.requestedModel !== void 0;
|
|
27211
|
+
}
|
|
27212
|
+
}
|
|
27213
|
+
let coercedFrom;
|
|
27214
|
+
if (agent === "codex" && parent === "codex") {
|
|
27215
|
+
coercedFrom = requested ?? "codex";
|
|
27216
|
+
agent = "cursor";
|
|
27217
|
+
}
|
|
27218
|
+
const opts = resolveNewThreadOptions2({
|
|
27219
|
+
agent,
|
|
27220
|
+
model: honorRequestedModel ? input.requestedModel : void 0
|
|
27221
|
+
});
|
|
27222
|
+
return {
|
|
27223
|
+
...opts,
|
|
27224
|
+
...ignoredAgent ? { ignoredAgent } : {},
|
|
27225
|
+
...coercedFrom ? { coercedFrom } : {}
|
|
27226
|
+
};
|
|
27227
|
+
}
|
|
27228
|
+
function orchCreateThreadAgentNote(input) {
|
|
27229
|
+
if (input.coercedFrom) {
|
|
27230
|
+
return `Avoid nested Codex under a Codex orchestrator \u2014 used Account default agent=${input.agent}`;
|
|
27231
|
+
}
|
|
27232
|
+
if (input.ignoredAgent) {
|
|
27233
|
+
return `Ignored agent=${input.ignoredAgent} \u2014 used Account default agent=${input.agent}`;
|
|
27234
|
+
}
|
|
27235
|
+
return void 0;
|
|
27236
|
+
}
|
|
27237
|
+
|
|
27238
|
+
// src/mcp/server.ts
|
|
27024
27239
|
var MAX_ORCH_THREADS = 5;
|
|
27025
27240
|
var CREATE_THREAD_TIMEOUT_MS = 9e4;
|
|
27026
27241
|
function withTimeout(promise, ms, label) {
|
|
@@ -27068,18 +27283,13 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
27068
27283
|
};
|
|
27069
27284
|
}
|
|
27070
27285
|
}
|
|
27071
|
-
|
|
27072
|
-
|
|
27073
|
-
|
|
27074
|
-
|
|
27075
|
-
|
|
27076
|
-
const accountAgent = resolveNewThreadOptions2({}).agent;
|
|
27077
|
-
agentArg = accountAgent !== "codex" ? accountAgent : "cursor";
|
|
27078
|
-
}
|
|
27079
|
-
const opts = resolveNewThreadOptions2({
|
|
27080
|
-
agent: agentArg,
|
|
27081
|
-
model: args.model
|
|
27286
|
+
const opts = resolveOrchCreateThreadOptions({
|
|
27287
|
+
requestedAgent: args.agent,
|
|
27288
|
+
requestedModel: args.model,
|
|
27289
|
+
parentAgent: parent?.agent,
|
|
27290
|
+
resolveNewThreadOptions: resolveNewThreadOptions2
|
|
27082
27291
|
});
|
|
27292
|
+
const agentNote = orchCreateThreadAgentNote(opts);
|
|
27083
27293
|
try {
|
|
27084
27294
|
const priorIds = new Set(orch.getThreads(false).map((t) => t.id));
|
|
27085
27295
|
const thread = await withTimeout(
|
|
@@ -27115,10 +27325,9 @@ async function createOrchChildThread(orch, args, resolveNewThreadOptions2) {
|
|
|
27115
27325
|
link: `sideboard://thread/${thread.id}`,
|
|
27116
27326
|
parentThreadId: thread.parentThreadId,
|
|
27117
27327
|
...alreadyStarted ? { alreadyStarted: true } : {},
|
|
27118
|
-
...
|
|
27119
|
-
|
|
27120
|
-
|
|
27121
|
-
} : {},
|
|
27328
|
+
...opts.coercedFrom ? { agentCoercedFrom: opts.coercedFrom } : {},
|
|
27329
|
+
...opts.ignoredAgent ? { agentIgnored: opts.ignoredAgent } : {},
|
|
27330
|
+
...agentNote ? { note: agentNote } : {},
|
|
27122
27331
|
...parentCorrectedFrom ? { parentCorrectedFrom, parentNote } : {}
|
|
27123
27332
|
})
|
|
27124
27333
|
};
|
|
@@ -27193,7 +27402,7 @@ async function startMcpServer() {
|
|
|
27193
27402
|
async () => {
|
|
27194
27403
|
const threads = orch.getThreads(true);
|
|
27195
27404
|
const lines = threads.map((t) => {
|
|
27196
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
27405
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path52.basename)(t.repoPath) || t.repoPath;
|
|
27197
27406
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
27198
27407
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
27199
27408
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -27478,11 +27687,13 @@ async function startMcpServer() {
|
|
|
27478
27687
|
);
|
|
27479
27688
|
server.tool(
|
|
27480
27689
|
"create_thread",
|
|
27481
|
-
`Create a worktree thread (chat) from branch, pr, or ticket. A ticket, PR, or named branch may have only one live worktree \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. Creating from the default branch still opens a new isolated worktree. Pass repoPath from list_workspaces. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentThreadId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid.
|
|
27690
|
+
`Create a worktree thread (chat) from branch, pr, or ticket. A ticket, PR, or named branch may have only one live worktree \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. Creating from the default branch still opens a new isolated worktree. Pass repoPath from list_workspaces. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentThreadId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Then use send_to_thread to chat.`,
|
|
27482
27691
|
{
|
|
27483
27692
|
sourceType: import_zod8.z.enum(["branch", "pr", "ticket"]),
|
|
27484
27693
|
sourceRef: import_zod8.z.string(),
|
|
27485
|
-
agent: import_zod8.z.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
|
|
27694
|
+
agent: import_zod8.z.enum(["claude", "codex", "opencode", "brightsy", "cursor"]).optional().describe(
|
|
27695
|
+
`Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored.`
|
|
27696
|
+
),
|
|
27486
27697
|
model: import_zod8.z.string().nullable().optional().describe(
|
|
27487
27698
|
`Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
|
|
27488
27699
|
),
|
|
@@ -29695,7 +29906,7 @@ async function handleSlackInbound(msg, opts) {
|
|
|
29695
29906
|
log(`skip superseded ${msg.kind} ${msg.ts}`);
|
|
29696
29907
|
return;
|
|
29697
29908
|
}
|
|
29698
|
-
const agent = coerceOrchestratorAgent(opts.agent ??
|
|
29909
|
+
const agent = coerceOrchestratorAgent(opts.agent ?? resolveOrchestratorDefaults().agent);
|
|
29699
29910
|
const workspaces = refreshWorkspaces2();
|
|
29700
29911
|
for (const ws of workspaces) {
|
|
29701
29912
|
await getOrchestrator().reconcile(ws.path).catch(() => void 0);
|
|
@@ -29852,7 +30063,7 @@ async function runSlackListen(opts = {}) {
|
|
|
29852
30063
|
const log = opts.onLog ?? console.log;
|
|
29853
30064
|
const connected = listSlackWorkspacesRaw();
|
|
29854
30065
|
const orch = getOrchestrator();
|
|
29855
|
-
const agent = coerceOrchestratorAgent(opts.agent ??
|
|
30066
|
+
const agent = coerceOrchestratorAgent(opts.agent ?? resolveOrchestratorDefaults().agent);
|
|
29856
30067
|
let inboundGeneration = 0;
|
|
29857
30068
|
const off = orch.on((event) => {
|
|
29858
30069
|
if (event.type !== "turn_finished") return;
|
|
@@ -30153,9 +30364,9 @@ var import_node_http3 = require("http");
|
|
|
30153
30364
|
var import_ws3 = require("ws");
|
|
30154
30365
|
|
|
30155
30366
|
// src/slack/relay-static.ts
|
|
30156
|
-
var
|
|
30367
|
+
var import_node_fs56 = require("fs");
|
|
30157
30368
|
var import_promises = require("fs/promises");
|
|
30158
|
-
var
|
|
30369
|
+
var import_node_path53 = __toESM(require("path"), 1);
|
|
30159
30370
|
var TYPES = {
|
|
30160
30371
|
".css": "text/css; charset=utf-8",
|
|
30161
30372
|
".html": "text/html; charset=utf-8",
|
|
@@ -30186,9 +30397,9 @@ function resolveStaticPath(root, requestUrl) {
|
|
|
30186
30397
|
return null;
|
|
30187
30398
|
}
|
|
30188
30399
|
if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
|
|
30189
|
-
const rootResolved =
|
|
30190
|
-
const candidate =
|
|
30191
|
-
if (candidate !== rootResolved && !candidate.startsWith(rootResolved +
|
|
30400
|
+
const rootResolved = import_node_path53.default.resolve(root);
|
|
30401
|
+
const candidate = import_node_path53.default.resolve(rootResolved, `.${pathname}`);
|
|
30402
|
+
if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path53.default.sep)) {
|
|
30192
30403
|
return null;
|
|
30193
30404
|
}
|
|
30194
30405
|
return candidate;
|
|
@@ -30202,7 +30413,7 @@ async function fileSize(file) {
|
|
|
30202
30413
|
}
|
|
30203
30414
|
}
|
|
30204
30415
|
function sendFile(req, res, file, size) {
|
|
30205
|
-
const ext =
|
|
30416
|
+
const ext = import_node_path53.default.extname(file).toLowerCase();
|
|
30206
30417
|
res.writeHead(200, {
|
|
30207
30418
|
"Content-Type": TYPES[ext] ?? "application/octet-stream",
|
|
30208
30419
|
"Content-Length": size,
|
|
@@ -30212,7 +30423,7 @@ function sendFile(req, res, file, size) {
|
|
|
30212
30423
|
res.end();
|
|
30213
30424
|
return true;
|
|
30214
30425
|
}
|
|
30215
|
-
(0,
|
|
30426
|
+
(0, import_node_fs56.createReadStream)(file).pipe(res);
|
|
30216
30427
|
return true;
|
|
30217
30428
|
}
|
|
30218
30429
|
async function tryServeStatic(req, res, root) {
|
|
@@ -30221,7 +30432,7 @@ async function tryServeStatic(req, res, root) {
|
|
|
30221
30432
|
if (!candidate) return false;
|
|
30222
30433
|
const direct = await fileSize(candidate);
|
|
30223
30434
|
if (direct != null) return sendFile(req, res, candidate, direct);
|
|
30224
|
-
const asIndex =
|
|
30435
|
+
const asIndex = import_node_path53.default.join(candidate, "index.html");
|
|
30225
30436
|
const indexSize = await fileSize(asIndex);
|
|
30226
30437
|
if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
|
|
30227
30438
|
return false;
|
|
@@ -30571,6 +30782,7 @@ init_outbound_watch();
|
|
|
30571
30782
|
applyForwardOccupancy,
|
|
30572
30783
|
applyGithubGitAuthEnv,
|
|
30573
30784
|
applyPromptCacheTtlEnv,
|
|
30785
|
+
applySystemCaEnv,
|
|
30574
30786
|
applyThreadIntoMain,
|
|
30575
30787
|
applyTurnUsage,
|
|
30576
30788
|
armSchedules,
|
|
@@ -30949,6 +31161,7 @@ init_outbound_watch();
|
|
|
30949
31161
|
lookupSoccerTeam,
|
|
30950
31162
|
mapAbleTimeTask,
|
|
30951
31163
|
markPrReady,
|
|
31164
|
+
materializeSystemCaBundle,
|
|
30952
31165
|
maxConcurrentAgents,
|
|
30953
31166
|
maybeCompactContext,
|
|
30954
31167
|
mcpAllowTools,
|
|
@@ -31172,6 +31385,7 @@ init_outbound_watch();
|
|
|
31172
31385
|
toolDetail,
|
|
31173
31386
|
toolFilePath,
|
|
31174
31387
|
totalTokens,
|
|
31388
|
+
trustSystemCertificates,
|
|
31175
31389
|
turnCostUsdFromCursorUsage,
|
|
31176
31390
|
updateAbleTimeTask,
|
|
31177
31391
|
updateAdvancedSettings,
|