@sideboard-ai/core 0.1.116 → 0.1.120
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/cursor-runner.cjs +74 -59
- package/dist/agents/cursor-runner.js +10 -9
- package/dist/{agents-7NIX44RB.js → agents-HOIXQEP5.js} +6 -6
- package/dist/{agents-DU7DHY7A.js → agents-XTABRYO5.js} +5 -5
- package/dist/{chunk-4HOFVKPC.js → chunk-4LRPW6QM.js} +43 -19
- package/dist/{chunk-XOYQ7LNQ.js → chunk-4NAW5BAQ.js} +3 -3
- package/dist/{chunk-4OJMZ6P2.js → chunk-4WV7C7WP.js} +3 -3
- package/dist/{chunk-DWP25N32.js → chunk-AFM6442E.js} +44 -20
- package/dist/{chunk-ZRCX43LS.js → chunk-BKVDZV7X.js} +2 -2
- package/dist/{chunk-A4VZXJEJ.js → chunk-HPAWHIZ3.js} +4 -1
- package/dist/{chunk-GBY7OOMB.js → chunk-NZBDVBCP.js} +1 -1
- package/dist/{chunk-5KSLD4MU.js → chunk-QI7VC4EG.js} +92 -62
- package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
- package/dist/{chunk-OFF5AFCR.js → chunk-TDNM7QZJ.js} +92 -62
- package/dist/{chunk-K3TIQXOH.js → chunk-U3IVCVLH.js} +2 -2
- package/dist/{chunk-FZCIQYNQ.js → chunk-VGPLXQIH.js} +1 -1
- package/dist/chunk-VHX673DI.js +32 -0
- package/dist/{chunk-ZMROW673.js → chunk-WCU3FHEI.js} +1 -1
- package/dist/{chunk-7WC5UWEB.js → chunk-X3NIPGQT.js} +1 -1
- package/dist/{chunk-ZYEFCSZJ.js → chunk-XTZQL7OU.js} +1 -1
- package/dist/{coordinator-prompt-4KCALEKD.js → coordinator-prompt-QMV6YEP5.js} +3 -3
- package/dist/{coordinator-prompt-FML4I5AR.js → coordinator-prompt-XCBHAOGE.js} +3 -3
- package/dist/cursor-recover-NOQYOFRF.js +76 -0
- package/dist/{cursor-recover-JBTIDARH.js → cursor-recover-QSLWEZNA.js} +12 -7
- package/dist/{global-workspace-CSWABOG5.js → global-workspace-SBKXKQFS.js} +4 -4
- package/dist/{global-workspace-H4YNASM6.js → global-workspace-Z37MNYU6.js} +4 -4
- package/dist/index.cjs +388 -285
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +10 -8
- package/dist/mcp/run-stdio.cjs +383 -282
- package/dist/mcp/run-stdio.js +7 -7
- package/dist/{orchestrator-NXPANCZA.js → orchestrator-3LJIG6XG.js} +7 -7
- package/dist/{orchestrator-ZY4RUJKT.js → orchestrator-NWNKWZLB.js} +8 -8
- package/dist/{thread-store-OEALWU7Y.js → thread-store-JR235AWK.js} +3 -1
- package/dist/{thread-store-LPTBVW5C.js → thread-store-PMH3BMB6.js} +3 -1
- package/dist/{workspaces-HJ3EVATC.js → workspaces-C3TJJFY3.js} +5 -5
- package/dist/{workspaces-QG6PGFQR.js → workspaces-M4OICPWF.js} +5 -5
- package/dist/{worktree-IW3BX26B.js → worktree-7AEKZSEX.js} +2 -2
- package/dist/{worktree-OTFQO2W7.js → worktree-MRSTQ32S.js} +2 -2
- package/package.json +1 -1
- package/dist/cursor-recover-ZUJG6XRQ.js +0 -42
package/dist/index.cjs
CHANGED
|
@@ -1955,6 +1955,7 @@ __export(thread_store_exports, {
|
|
|
1955
1955
|
createEmptyThread: () => createEmptyThread,
|
|
1956
1956
|
deleteThreadRecord: () => deleteThreadRecord,
|
|
1957
1957
|
findThreadByRef: () => findThreadByRef,
|
|
1958
|
+
isThreadRecordFile: () => isThreadRecordFile,
|
|
1958
1959
|
listThreads: () => listThreads,
|
|
1959
1960
|
normalizeThread: () => normalizeThread,
|
|
1960
1961
|
readThread: () => readThread,
|
|
@@ -2065,7 +2066,8 @@ function writeThread(thread) {
|
|
|
2065
2066
|
function idPath(id) {
|
|
2066
2067
|
return id;
|
|
2067
2068
|
}
|
|
2068
|
-
function isThreadRecordFile(
|
|
2069
|
+
function isThreadRecordFile(nameOrPath) {
|
|
2070
|
+
const name = (0, import_node_path10.basename)(nameOrPath);
|
|
2069
2071
|
return name.endsWith(".json") && !name.endsWith(".live.json");
|
|
2070
2072
|
}
|
|
2071
2073
|
function listThreads(opts) {
|
|
@@ -2116,12 +2118,13 @@ function findThreadByRef(ref) {
|
|
|
2116
2118
|
(t) => t.id === ref || t.id.startsWith(ref) || t.branchName === ref || t.title === ref
|
|
2117
2119
|
) ?? null;
|
|
2118
2120
|
}
|
|
2119
|
-
var import_node_crypto3, import_node_fs9, import_proper_lockfile;
|
|
2121
|
+
var import_node_crypto3, import_node_fs9, import_node_path10, import_proper_lockfile;
|
|
2120
2122
|
var init_thread_store = __esm({
|
|
2121
2123
|
"src/store/thread-store.ts"() {
|
|
2122
2124
|
"use strict";
|
|
2123
2125
|
import_node_crypto3 = require("crypto");
|
|
2124
2126
|
import_node_fs9 = require("fs");
|
|
2127
|
+
import_node_path10 = require("path");
|
|
2125
2128
|
import_proper_lockfile = __toESM(require("proper-lockfile"), 1);
|
|
2126
2129
|
init_thinking_effort();
|
|
2127
2130
|
init_paths();
|
|
@@ -2160,7 +2163,7 @@ var init_orchestrator_capable = __esm({
|
|
|
2160
2163
|
|
|
2161
2164
|
// src/store/schedules.ts
|
|
2162
2165
|
function schedulesPath() {
|
|
2163
|
-
return (0,
|
|
2166
|
+
return (0, import_node_path11.join)(appDataDir(), "schedules.json");
|
|
2164
2167
|
}
|
|
2165
2168
|
function parseDurationMs(every) {
|
|
2166
2169
|
const m = every.trim().match(DURATION_RE);
|
|
@@ -2383,13 +2386,13 @@ function recordScheduleRun(id, result) {
|
|
|
2383
2386
|
writeAll(rows);
|
|
2384
2387
|
return next;
|
|
2385
2388
|
}
|
|
2386
|
-
var import_node_crypto4, import_node_fs10,
|
|
2389
|
+
var import_node_crypto4, import_node_fs10, import_node_path11, import_croner, DURATION_RE, UNIT_MS;
|
|
2387
2390
|
var init_schedules = __esm({
|
|
2388
2391
|
"src/store/schedules.ts"() {
|
|
2389
2392
|
"use strict";
|
|
2390
2393
|
import_node_crypto4 = require("crypto");
|
|
2391
2394
|
import_node_fs10 = require("fs");
|
|
2392
|
-
|
|
2395
|
+
import_node_path11 = require("path");
|
|
2393
2396
|
import_croner = require("croner");
|
|
2394
2397
|
init_orchestrator_capable();
|
|
2395
2398
|
init_paths();
|
|
@@ -2406,7 +2409,7 @@ var init_schedules = __esm({
|
|
|
2406
2409
|
|
|
2407
2410
|
// src/store/desktop-host.ts
|
|
2408
2411
|
function desktopHostPidPath() {
|
|
2409
|
-
return (0,
|
|
2412
|
+
return (0, import_node_path12.join)(appDataDir(), "desktop-host.pid");
|
|
2410
2413
|
}
|
|
2411
2414
|
function claimDesktopHost(pid = process.pid) {
|
|
2412
2415
|
(0, import_node_fs11.writeFileSync)(desktopHostPidPath(), `${pid}
|
|
@@ -2447,12 +2450,12 @@ function thisProcessShouldDrainAgentQueues() {
|
|
|
2447
2450
|
if (isThisProcessDesktopHost()) return true;
|
|
2448
2451
|
return !isDesktopHostAlive();
|
|
2449
2452
|
}
|
|
2450
|
-
var import_node_fs11,
|
|
2453
|
+
var import_node_fs11, import_node_path12;
|
|
2451
2454
|
var init_desktop_host = __esm({
|
|
2452
2455
|
"src/store/desktop-host.ts"() {
|
|
2453
2456
|
"use strict";
|
|
2454
2457
|
import_node_fs11 = require("fs");
|
|
2455
|
-
|
|
2458
|
+
import_node_path12 = require("path");
|
|
2456
2459
|
init_paths();
|
|
2457
2460
|
}
|
|
2458
2461
|
});
|
|
@@ -3404,18 +3407,18 @@ var init_gh_errors = __esm({
|
|
|
3404
3407
|
function githubAgentAuthDir() {
|
|
3405
3408
|
const override = process.env.SIDEBOARD_GIT_AUTH_DIR?.trim();
|
|
3406
3409
|
if (override) return override;
|
|
3407
|
-
return (0,
|
|
3410
|
+
return (0, import_node_path13.join)((0, import_node_os4.homedir)(), ".sideboard-git-auth");
|
|
3408
3411
|
}
|
|
3409
3412
|
function githubCredentialStorePath() {
|
|
3410
|
-
return (0,
|
|
3413
|
+
return (0, import_node_path13.join)(githubAgentAuthDir(), "git-credentials");
|
|
3411
3414
|
}
|
|
3412
3415
|
function githubGhConfigDir() {
|
|
3413
|
-
return (0,
|
|
3416
|
+
return (0, import_node_path13.join)(githubAgentAuthDir(), "gh");
|
|
3414
3417
|
}
|
|
3415
3418
|
function writePrivateFile2(file, body) {
|
|
3416
|
-
(0, import_node_fs12.mkdirSync)((0,
|
|
3419
|
+
(0, import_node_fs12.mkdirSync)((0, import_node_path13.dirname)(file), { recursive: true, mode: 448 });
|
|
3417
3420
|
try {
|
|
3418
|
-
(0, import_node_fs12.chmodSync)((0,
|
|
3421
|
+
(0, import_node_fs12.chmodSync)((0, import_node_path13.dirname)(file), 448);
|
|
3419
3422
|
} catch {
|
|
3420
3423
|
}
|
|
3421
3424
|
(0, import_node_fs12.writeFileSync)(file, body, { encoding: "utf8", mode: 384 });
|
|
@@ -3453,11 +3456,11 @@ function materializeGithubAgentAuth(token, user) {
|
|
|
3453
3456
|
writePrivateFile2(githubCredentialStorePath(), gitCredentialStoreContents(trimmed));
|
|
3454
3457
|
const ghDir = githubGhConfigDir();
|
|
3455
3458
|
(0, import_node_fs12.mkdirSync)(ghDir, { recursive: true, mode: 448 });
|
|
3456
|
-
writePrivateFile2((0,
|
|
3457
|
-
writePrivateFile2((0,
|
|
3459
|
+
writePrivateFile2((0, import_node_path13.join)(ghDir, "hosts.yml"), ghHostsYml(trimmed, user));
|
|
3460
|
+
writePrivateFile2((0, import_node_path13.join)(ghDir, "config.yml"), "git_protocol: https\nprompt: disabled\n");
|
|
3458
3461
|
}
|
|
3459
3462
|
function githubAgentAuthReady() {
|
|
3460
|
-
return (0, import_node_fs12.existsSync)(githubCredentialStorePath()) && (0, import_node_fs12.existsSync)((0,
|
|
3463
|
+
return (0, import_node_fs12.existsSync)(githubCredentialStorePath()) && (0, import_node_fs12.existsSync)((0, import_node_path13.join)(githubGhConfigDir(), "hosts.yml"));
|
|
3461
3464
|
}
|
|
3462
3465
|
function githubCredentialHelperGitConfig() {
|
|
3463
3466
|
const file = githubCredentialStorePath();
|
|
@@ -3472,13 +3475,13 @@ function githubGhConfigEnv() {
|
|
|
3472
3475
|
GH_PROMPT_DISABLED: "1"
|
|
3473
3476
|
};
|
|
3474
3477
|
}
|
|
3475
|
-
var import_node_fs12, import_node_os4,
|
|
3478
|
+
var import_node_fs12, import_node_os4, import_node_path13;
|
|
3476
3479
|
var init_github_agent_auth = __esm({
|
|
3477
3480
|
"src/git/github-agent-auth.ts"() {
|
|
3478
3481
|
"use strict";
|
|
3479
3482
|
import_node_fs12 = require("fs");
|
|
3480
3483
|
import_node_os4 = require("os");
|
|
3481
|
-
|
|
3484
|
+
import_node_path13 = require("path");
|
|
3482
3485
|
}
|
|
3483
3486
|
});
|
|
3484
3487
|
|
|
@@ -3486,15 +3489,15 @@ var init_github_agent_auth = __esm({
|
|
|
3486
3489
|
function prependPathDir(env, dir) {
|
|
3487
3490
|
if (!dir || !(0, import_node_fs13.existsSync)(dir)) return;
|
|
3488
3491
|
const current = env.PATH ?? "";
|
|
3489
|
-
const parts = current.split(
|
|
3492
|
+
const parts = current.split(import_node_path14.delimiter).filter(Boolean);
|
|
3490
3493
|
if (parts.includes(dir)) {
|
|
3491
3494
|
env.PATH = current;
|
|
3492
3495
|
return;
|
|
3493
3496
|
}
|
|
3494
|
-
env.PATH = [dir, ...parts].join(
|
|
3497
|
+
env.PATH = [dir, ...parts].join(import_node_path14.delimiter);
|
|
3495
3498
|
}
|
|
3496
3499
|
function conductorBundledBinDir(home = process.env.HOME || process.env.USERPROFILE || (0, import_node_os5.homedir)()) {
|
|
3497
|
-
return (0,
|
|
3500
|
+
return (0, import_node_path14.join)(home, "Library", "Application Support", "com.conductor.app", "bin");
|
|
3498
3501
|
}
|
|
3499
3502
|
function isConductorBundledCli(filePath) {
|
|
3500
3503
|
const p = (filePath ?? "").replace(/\\/g, "/");
|
|
@@ -3503,10 +3506,10 @@ function isConductorBundledCli(filePath) {
|
|
|
3503
3506
|
function ensureAgentPath(env = process.env) {
|
|
3504
3507
|
const home = env.HOME || env.USERPROFILE || (0, import_node_os5.homedir)();
|
|
3505
3508
|
const current = env.PATH ?? "";
|
|
3506
|
-
const parts = current.split(
|
|
3509
|
+
const parts = current.split(import_node_path14.delimiter).filter(Boolean);
|
|
3507
3510
|
const seen = new Set(parts);
|
|
3508
3511
|
const extras = [
|
|
3509
|
-
...EXTRA_BIN_DIRS.map((rel) => (0,
|
|
3512
|
+
...EXTRA_BIN_DIRS.map((rel) => (0, import_node_path14.join)(home, rel)),
|
|
3510
3513
|
"/opt/homebrew/bin",
|
|
3511
3514
|
"/usr/local/bin",
|
|
3512
3515
|
// Keep after Homebrew/npm so a user-installed CLI still wins.
|
|
@@ -3517,7 +3520,7 @@ function ensureAgentPath(env = process.env) {
|
|
|
3517
3520
|
parts.unshift(dir);
|
|
3518
3521
|
seen.add(dir);
|
|
3519
3522
|
}
|
|
3520
|
-
const next = parts.join(
|
|
3523
|
+
const next = parts.join(import_node_path14.delimiter);
|
|
3521
3524
|
env.PATH = next;
|
|
3522
3525
|
return next;
|
|
3523
3526
|
}
|
|
@@ -3531,7 +3534,7 @@ function enrichPathWithNpmGlobalBin(env = process.env) {
|
|
|
3531
3534
|
stdio: ["ignore", "pipe", "ignore"]
|
|
3532
3535
|
}).trim().split(/\r?\n/).find(Boolean);
|
|
3533
3536
|
if (prefix) {
|
|
3534
|
-
const binDir = process.platform === "win32" ? prefix : (0,
|
|
3537
|
+
const binDir = process.platform === "win32" ? prefix : (0, import_node_path14.join)(prefix, "bin");
|
|
3535
3538
|
prependPathDir(env, binDir);
|
|
3536
3539
|
}
|
|
3537
3540
|
} catch {
|
|
@@ -3559,14 +3562,14 @@ function withExportedPath(command, pathValue) {
|
|
|
3559
3562
|
if (/^(export\s+PATH=|PATH=)/.test(trimmed)) return trimmed;
|
|
3560
3563
|
return `export PATH=${posixShellSingleQuote(pathValue)} && ${trimmed}`;
|
|
3561
3564
|
}
|
|
3562
|
-
var import_node_fs13, import_node_child_process3, import_node_os5,
|
|
3565
|
+
var import_node_fs13, import_node_child_process3, import_node_os5, import_node_path14, EXTRA_BIN_DIRS;
|
|
3563
3566
|
var init_path = __esm({
|
|
3564
3567
|
"src/agents/path.ts"() {
|
|
3565
3568
|
"use strict";
|
|
3566
3569
|
import_node_fs13 = require("fs");
|
|
3567
3570
|
import_node_child_process3 = require("child_process");
|
|
3568
3571
|
import_node_os5 = require("os");
|
|
3569
|
-
|
|
3572
|
+
import_node_path14 = require("path");
|
|
3570
3573
|
EXTRA_BIN_DIRS = [
|
|
3571
3574
|
".local/bin",
|
|
3572
3575
|
".cargo/bin",
|
|
@@ -3588,7 +3591,7 @@ function isIndexLockError(text4) {
|
|
|
3588
3591
|
return /Unable to create ['"][^'"]*index\.lock['"]: File exists/i.test(text4);
|
|
3589
3592
|
}
|
|
3590
3593
|
function clearStaleIndexLock(gitDir, maxAgeMs = STALE_INDEX_LOCK_MS, now = Date.now()) {
|
|
3591
|
-
const lockPath = (0,
|
|
3594
|
+
const lockPath = (0, import_node_path15.join)(gitDir, "index.lock");
|
|
3592
3595
|
try {
|
|
3593
3596
|
if (!(0, import_node_fs14.existsSync)(lockPath)) return null;
|
|
3594
3597
|
if (now - (0, import_node_fs14.statSync)(lockPath).mtimeMs < maxAgeMs) return null;
|
|
@@ -3607,12 +3610,12 @@ function clearStaleIndexLocks(gitDirs, maxAgeMs = STALE_INDEX_LOCK_MS) {
|
|
|
3607
3610
|
}
|
|
3608
3611
|
return removed;
|
|
3609
3612
|
}
|
|
3610
|
-
var import_node_fs14,
|
|
3613
|
+
var import_node_fs14, import_node_path15, STALE_INDEX_LOCK_MS;
|
|
3611
3614
|
var init_stale_lock = __esm({
|
|
3612
3615
|
"src/git/stale-lock.ts"() {
|
|
3613
3616
|
"use strict";
|
|
3614
3617
|
import_node_fs14 = require("fs");
|
|
3615
|
-
|
|
3618
|
+
import_node_path15 = require("path");
|
|
3616
3619
|
STALE_INDEX_LOCK_MS = 2e4;
|
|
3617
3620
|
}
|
|
3618
3621
|
});
|
|
@@ -3820,7 +3823,7 @@ async function warmGithubAgentAuth(opts) {
|
|
|
3820
3823
|
}
|
|
3821
3824
|
function normalizeWritableRoot(raw) {
|
|
3822
3825
|
const trimmed = raw.trim().replace(/\/+$/, "");
|
|
3823
|
-
return trimmed && (0,
|
|
3826
|
+
return trimmed && (0, import_node_path16.isAbsolute)(trimmed) ? trimmed : null;
|
|
3824
3827
|
}
|
|
3825
3828
|
async function resolveCodexGitWritableRoots(cwd) {
|
|
3826
3829
|
const roots = /* @__PURE__ */ new Set();
|
|
@@ -3897,11 +3900,11 @@ function formatGitAuthModeDirective(mode) {
|
|
|
3897
3900
|
].join("\n");
|
|
3898
3901
|
}
|
|
3899
3902
|
}
|
|
3900
|
-
var
|
|
3903
|
+
var import_node_path16, HTTPS_REWRITE, TOKEN_TTL_MS, tokenMemo, GITHUB_CHILD_TOKEN_KEYS;
|
|
3901
3904
|
var init_git_auth_mode = __esm({
|
|
3902
3905
|
"src/git/git-auth-mode.ts"() {
|
|
3903
3906
|
"use strict";
|
|
3904
|
-
|
|
3907
|
+
import_node_path16 = require("path");
|
|
3905
3908
|
init_app_settings();
|
|
3906
3909
|
init_github_agent_auth();
|
|
3907
3910
|
init_run();
|
|
@@ -5099,7 +5102,7 @@ function isLocalPrFetchBranch(ref) {
|
|
|
5099
5102
|
}
|
|
5100
5103
|
async function createThreadWorktree(opts) {
|
|
5101
5104
|
let branchName = `thread/${opts.slug}`;
|
|
5102
|
-
const worktreePath = (0,
|
|
5105
|
+
const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
|
|
5103
5106
|
if ((0, import_node_fs15.existsSync)(worktreePath)) {
|
|
5104
5107
|
throw new Error(`Worktree already exists at ${worktreePath}`);
|
|
5105
5108
|
}
|
|
@@ -5167,7 +5170,7 @@ ${add.stdout}`;
|
|
|
5167
5170
|
async function createExistingBranchWorktree(opts) {
|
|
5168
5171
|
const branchName = opts.branchName.trim();
|
|
5169
5172
|
if (!branchName) throw new Error("branch name required");
|
|
5170
|
-
const worktreePath = (0,
|
|
5173
|
+
const worktreePath = (0, import_node_path17.join)(worktreesRoot(opts.repoPath), opts.slug);
|
|
5171
5174
|
if ((0, import_node_fs15.existsSync)(worktreePath)) {
|
|
5172
5175
|
throw new Error(`Worktree already exists at ${worktreePath}`);
|
|
5173
5176
|
}
|
|
@@ -5459,7 +5462,7 @@ function sameRepoPath(a, b) {
|
|
|
5459
5462
|
return normalizeWorktreePath(a) === normalizeWorktreePath(b);
|
|
5460
5463
|
}
|
|
5461
5464
|
function listLocalThreadBranchSlugs(repoPath) {
|
|
5462
|
-
const refsDir = (0,
|
|
5465
|
+
const refsDir = (0, import_node_path17.join)(repoPath, ".git", "refs", "heads", "thread");
|
|
5463
5466
|
if (!(0, import_node_fs15.existsSync)(refsDir)) return [];
|
|
5464
5467
|
try {
|
|
5465
5468
|
return (0, import_node_fs15.readdirSync)(refsDir).filter((name) => !name.startsWith(".")).map((name) => normalizeTakenSlug(name));
|
|
@@ -5492,18 +5495,18 @@ function allocateTeamSlug(repoPath) {
|
|
|
5492
5495
|
const taken = collectTakenTeamSlugs(repoPath);
|
|
5493
5496
|
for (let attempt = 0; attempt < 32; attempt++) {
|
|
5494
5497
|
const team = allocateTeamName(taken);
|
|
5495
|
-
const path2 = (0,
|
|
5498
|
+
const path2 = (0, import_node_path17.join)(worktreesRoot(repoPath), team.slug);
|
|
5496
5499
|
if (!(0, import_node_fs15.existsSync)(path2)) return team;
|
|
5497
5500
|
taken.add(team.slug);
|
|
5498
5501
|
}
|
|
5499
5502
|
throw new Error("No available soccer team worktree directories left");
|
|
5500
5503
|
}
|
|
5501
|
-
var import_node_fs15,
|
|
5504
|
+
var import_node_fs15, import_node_path17;
|
|
5502
5505
|
var init_worktree = __esm({
|
|
5503
5506
|
"src/git/worktree.ts"() {
|
|
5504
5507
|
"use strict";
|
|
5505
5508
|
import_node_fs15 = require("fs");
|
|
5506
|
-
|
|
5509
|
+
import_node_path17 = require("path");
|
|
5507
5510
|
init_paths();
|
|
5508
5511
|
init_thread_store();
|
|
5509
5512
|
init_teams();
|
|
@@ -5588,7 +5591,7 @@ function ensureGlobalCoordinatorCwd(opts) {
|
|
|
5588
5591
|
let orchId = opts?.orchestratorThreadId?.trim() || "";
|
|
5589
5592
|
if (!orchId) {
|
|
5590
5593
|
try {
|
|
5591
|
-
const existing = (0, import_node_fs16.readFileSync)((0,
|
|
5594
|
+
const existing = (0, import_node_fs16.readFileSync)((0, import_node_path18.join)(dir, "AGENTS.md"), "utf8");
|
|
5592
5595
|
const m = existing.match(
|
|
5593
5596
|
/YOUR orchestration thread id is `([0-9a-f-]{36})`/i
|
|
5594
5597
|
);
|
|
@@ -5630,9 +5633,9 @@ function ensureGlobalCoordinatorCwd(opts) {
|
|
|
5630
5633
|
"Always ask worktree agents to commit, push, and open draft PRs (`ask_git` / `send_to_thread`). Tell them to merge only when the user explicitly asked. The worktree agent runs git/gh; never merge from this orchestration cwd."
|
|
5631
5634
|
].join("\n");
|
|
5632
5635
|
try {
|
|
5633
|
-
(0, import_node_fs16.writeFileSync)((0,
|
|
5636
|
+
(0, import_node_fs16.writeFileSync)((0, import_node_path18.join)(dir, "CLAUDE.md"), `${body}
|
|
5634
5637
|
`, "utf8");
|
|
5635
|
-
(0, import_node_fs16.writeFileSync)((0,
|
|
5638
|
+
(0, import_node_fs16.writeFileSync)((0, import_node_path18.join)(dir, "AGENTS.md"), `${body}
|
|
5636
5639
|
`, "utf8");
|
|
5637
5640
|
} catch {
|
|
5638
5641
|
}
|
|
@@ -5664,12 +5667,12 @@ function coordinatorSystemPrompt(opts) {
|
|
|
5664
5667
|
formatWorkspaceInventory(opts.workspaces)
|
|
5665
5668
|
].join("\n");
|
|
5666
5669
|
}
|
|
5667
|
-
var import_node_fs16,
|
|
5670
|
+
var import_node_fs16, import_node_path18, COORDINATOR_TOOL_PLAYBOOK, SLACK_REPLY_FORMATTING;
|
|
5668
5671
|
var init_coordinator_prompt = __esm({
|
|
5669
5672
|
"src/orchestrator/coordinator-prompt.ts"() {
|
|
5670
5673
|
"use strict";
|
|
5671
5674
|
import_node_fs16 = require("fs");
|
|
5672
|
-
|
|
5675
|
+
import_node_path18 = require("path");
|
|
5673
5676
|
init_worktree();
|
|
5674
5677
|
init_app_settings();
|
|
5675
5678
|
init_paths();
|
|
@@ -6012,7 +6015,7 @@ var init_api = __esm({
|
|
|
6012
6015
|
|
|
6013
6016
|
// src/slack/reply-target.ts
|
|
6014
6017
|
function storePath() {
|
|
6015
|
-
return (0,
|
|
6018
|
+
return (0, import_node_path19.join)(appDataDir(), "slack-reply-to.json");
|
|
6016
6019
|
}
|
|
6017
6020
|
function readStore() {
|
|
6018
6021
|
const path2 = storePath();
|
|
@@ -6033,12 +6036,12 @@ function setSlackReplyTarget(target) {
|
|
|
6033
6036
|
function getSlackReplyTarget(threadId) {
|
|
6034
6037
|
return readStore()[threadId] ?? null;
|
|
6035
6038
|
}
|
|
6036
|
-
var import_node_fs17,
|
|
6039
|
+
var import_node_fs17, import_node_path19;
|
|
6037
6040
|
var init_reply_target = __esm({
|
|
6038
6041
|
"src/slack/reply-target.ts"() {
|
|
6039
6042
|
"use strict";
|
|
6040
6043
|
import_node_fs17 = require("fs");
|
|
6041
|
-
|
|
6044
|
+
import_node_path19 = require("path");
|
|
6042
6045
|
init_paths();
|
|
6043
6046
|
init_private_file();
|
|
6044
6047
|
init_secure_file();
|
|
@@ -6047,7 +6050,7 @@ var init_reply_target = __esm({
|
|
|
6047
6050
|
|
|
6048
6051
|
// src/slack/workspaces.ts
|
|
6049
6052
|
function storePath2() {
|
|
6050
|
-
return (0,
|
|
6053
|
+
return (0, import_node_path20.join)(appDataDir(), "slack-workspaces.json");
|
|
6051
6054
|
}
|
|
6052
6055
|
function readStore2() {
|
|
6053
6056
|
try {
|
|
@@ -6154,11 +6157,11 @@ function requireSlackWorkspace(teamId) {
|
|
|
6154
6157
|
}
|
|
6155
6158
|
return ws;
|
|
6156
6159
|
}
|
|
6157
|
-
var
|
|
6160
|
+
var import_node_path20;
|
|
6158
6161
|
var init_workspaces = __esm({
|
|
6159
6162
|
"src/slack/workspaces.ts"() {
|
|
6160
6163
|
"use strict";
|
|
6161
|
-
|
|
6164
|
+
import_node_path20 = require("path");
|
|
6162
6165
|
init_paths();
|
|
6163
6166
|
init_secure_file();
|
|
6164
6167
|
init_api();
|
|
@@ -6167,7 +6170,7 @@ var init_workspaces = __esm({
|
|
|
6167
6170
|
|
|
6168
6171
|
// src/slack/outbound-watch.ts
|
|
6169
6172
|
function storePath3() {
|
|
6170
|
-
return (0,
|
|
6173
|
+
return (0, import_node_path21.join)(appDataDir(), "slack-outbound-watch.json");
|
|
6171
6174
|
}
|
|
6172
6175
|
function watchId(teamId, channelId, ts) {
|
|
6173
6176
|
return `${teamId}:${channelId}:${ts}`;
|
|
@@ -6542,12 +6545,12 @@ async function refreshSlackReplyBadges(opts) {
|
|
|
6542
6545
|
if (changed) writeStore2(watches);
|
|
6543
6546
|
return listSlackReplyBadges();
|
|
6544
6547
|
}
|
|
6545
|
-
var import_node_fs18,
|
|
6548
|
+
var import_node_fs18, import_node_path21, MAX_WATCHES, MAX_REPLIES_PER_WATCH, WATCH_TTL_MS, POLL_INTERVAL_MS, lastPollMs, nameCache;
|
|
6546
6549
|
var init_outbound_watch = __esm({
|
|
6547
6550
|
"src/slack/outbound-watch.ts"() {
|
|
6548
6551
|
"use strict";
|
|
6549
6552
|
import_node_fs18 = require("fs");
|
|
6550
|
-
|
|
6553
|
+
import_node_path21 = require("path");
|
|
6551
6554
|
init_paths();
|
|
6552
6555
|
init_private_file();
|
|
6553
6556
|
init_secure_file();
|
|
@@ -6682,7 +6685,7 @@ function summarizeTurnStderr(tail, maxChars = 500) {
|
|
|
6682
6685
|
function looksLikeInvalidAgentSession(text4) {
|
|
6683
6686
|
const lower = text4.trim().toLowerCase();
|
|
6684
6687
|
if (!lower) return false;
|
|
6685
|
-
return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower);
|
|
6688
|
+
return /session not found/.test(lower) || /no conversation found/.test(lower) || /conversation .+ not found/.test(lower) || /thread .+ not found/.test(lower) || /unknown session/.test(lower) || /invalid session/.test(lower) || /session .+ (missing|expired|deleted|gone)/.test(lower) || /cannot resume/.test(lower) || /failed to (load|resume|open) session/.test(lower) || /corrupt local agent checkpoint/.test(lower) || /missing root blob/.test(lower) || /\bagent\b.{0,120}\bnot found\b/.test(lower) || /\brun\b.{0,80}\bnot found for agent\b/.test(lower);
|
|
6686
6689
|
}
|
|
6687
6690
|
function looksLikeRetryableRunnerCrash(text4) {
|
|
6688
6691
|
if (looksLikeAgentFailureMessage(text4)) return false;
|
|
@@ -6797,7 +6800,7 @@ var init_error_detail = __esm({
|
|
|
6797
6800
|
|
|
6798
6801
|
// src/brightsy/config.ts
|
|
6799
6802
|
function brightsyConfigPath() {
|
|
6800
|
-
return (0,
|
|
6803
|
+
return (0, import_node_path22.join)((0, import_node_os6.homedir)(), ".brightsy", "config.json");
|
|
6801
6804
|
}
|
|
6802
6805
|
function loadBrightsyConfig() {
|
|
6803
6806
|
const path2 = brightsyConfigPath();
|
|
@@ -6816,13 +6819,13 @@ function saveBrightsyConfig(cfg) {
|
|
|
6816
6819
|
mode: 384
|
|
6817
6820
|
});
|
|
6818
6821
|
}
|
|
6819
|
-
var import_node_fs19, import_node_os6,
|
|
6822
|
+
var import_node_fs19, import_node_os6, import_node_path22;
|
|
6820
6823
|
var init_config = __esm({
|
|
6821
6824
|
"src/brightsy/config.ts"() {
|
|
6822
6825
|
"use strict";
|
|
6823
6826
|
import_node_fs19 = require("fs");
|
|
6824
6827
|
import_node_os6 = require("os");
|
|
6825
|
-
|
|
6828
|
+
import_node_path22 = require("path");
|
|
6826
6829
|
}
|
|
6827
6830
|
});
|
|
6828
6831
|
|
|
@@ -6925,7 +6928,7 @@ __export(connected_teams_exports, {
|
|
|
6925
6928
|
listConnectedBrightsyTeams: () => listConnectedBrightsyTeams
|
|
6926
6929
|
});
|
|
6927
6930
|
function storePath4() {
|
|
6928
|
-
return (0,
|
|
6931
|
+
return (0, import_node_path23.join)(appDataDir(), "brightsy-teams.json");
|
|
6929
6932
|
}
|
|
6930
6933
|
function readStore4() {
|
|
6931
6934
|
const path2 = storePath4();
|
|
@@ -7102,12 +7105,12 @@ function brightsyMcpServerName(slug) {
|
|
|
7102
7105
|
const cleaned = slug.replace(/[^A-Za-z0-9_-]/g, "_").replace(/^_+|_+$/g, "");
|
|
7103
7106
|
return `brightsy_${cleaned || "team"}`;
|
|
7104
7107
|
}
|
|
7105
|
-
var import_node_fs20,
|
|
7108
|
+
var import_node_fs20, import_node_path23;
|
|
7106
7109
|
var init_connected_teams = __esm({
|
|
7107
7110
|
"src/brightsy/connected-teams.ts"() {
|
|
7108
7111
|
"use strict";
|
|
7109
7112
|
import_node_fs20 = require("fs");
|
|
7110
|
-
|
|
7113
|
+
import_node_path23 = require("path");
|
|
7111
7114
|
init_paths();
|
|
7112
7115
|
init_accounts();
|
|
7113
7116
|
init_config();
|
|
@@ -7912,6 +7915,11 @@ function parseDiffStat(result) {
|
|
|
7912
7915
|
}
|
|
7913
7916
|
return {};
|
|
7914
7917
|
}
|
|
7918
|
+
function withPartTimes(next, prev) {
|
|
7919
|
+
const now = Date.now();
|
|
7920
|
+
const startedAt = prev && typeof prev.startedAt === "number" ? prev.startedAt : now;
|
|
7921
|
+
return { ...next, startedAt, updatedAt: now };
|
|
7922
|
+
}
|
|
7915
7923
|
function applyAgentEvent(parts, event) {
|
|
7916
7924
|
if (event.type === "stdout") {
|
|
7917
7925
|
const data = event.data;
|
|
@@ -7919,17 +7927,22 @@ function applyAgentEvent(parts, event) {
|
|
|
7919
7927
|
const next = [...parts];
|
|
7920
7928
|
const last = next[next.length - 1];
|
|
7921
7929
|
if (last?.type === "text" && sameParentId(last.parentId, event.parentId)) {
|
|
7922
|
-
next[next.length - 1] =
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7930
|
+
next[next.length - 1] = withPartTimes(
|
|
7931
|
+
{
|
|
7932
|
+
type: "text",
|
|
7933
|
+
text: last.text + data,
|
|
7934
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
7935
|
+
},
|
|
7936
|
+
last
|
|
7937
|
+
);
|
|
7927
7938
|
} else {
|
|
7928
|
-
next.push(
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7939
|
+
next.push(
|
|
7940
|
+
withPartTimes({
|
|
7941
|
+
type: "text",
|
|
7942
|
+
text: data,
|
|
7943
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
7944
|
+
})
|
|
7945
|
+
);
|
|
7933
7946
|
}
|
|
7934
7947
|
return next;
|
|
7935
7948
|
}
|
|
@@ -7941,34 +7954,44 @@ function applyAgentEvent(parts, event) {
|
|
|
7941
7954
|
for (let i = next.length - 1; i >= 0; i--) {
|
|
7942
7955
|
const prev = next[i];
|
|
7943
7956
|
if (prev?.type === "thinking" && sameParentId(prev.parentId, event.parentId)) {
|
|
7944
|
-
next[i] =
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7957
|
+
next[i] = withPartTimes(
|
|
7958
|
+
{
|
|
7959
|
+
type: "thinking",
|
|
7960
|
+
text: data,
|
|
7961
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
7962
|
+
},
|
|
7963
|
+
prev
|
|
7964
|
+
);
|
|
7949
7965
|
return next;
|
|
7950
7966
|
}
|
|
7951
7967
|
}
|
|
7952
|
-
next.push(
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7968
|
+
next.push(
|
|
7969
|
+
withPartTimes({
|
|
7970
|
+
type: "thinking",
|
|
7971
|
+
text: data,
|
|
7972
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
7973
|
+
})
|
|
7974
|
+
);
|
|
7957
7975
|
return next;
|
|
7958
7976
|
}
|
|
7959
7977
|
const last = next[next.length - 1];
|
|
7960
7978
|
if (last?.type === "thinking" && sameParentId(last.parentId, event.parentId)) {
|
|
7961
|
-
next[next.length - 1] =
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7979
|
+
next[next.length - 1] = withPartTimes(
|
|
7980
|
+
{
|
|
7981
|
+
type: "thinking",
|
|
7982
|
+
text: last.text + data,
|
|
7983
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
7984
|
+
},
|
|
7985
|
+
last
|
|
7986
|
+
);
|
|
7966
7987
|
} else {
|
|
7967
|
-
next.push(
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7988
|
+
next.push(
|
|
7989
|
+
withPartTimes({
|
|
7990
|
+
type: "thinking",
|
|
7991
|
+
text: data,
|
|
7992
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
7993
|
+
})
|
|
7994
|
+
);
|
|
7972
7995
|
}
|
|
7973
7996
|
return next;
|
|
7974
7997
|
}
|
|
@@ -7984,22 +8007,25 @@ function applyAgentEvent(parts, event) {
|
|
|
7984
8007
|
...input ?? {}
|
|
7985
8008
|
};
|
|
7986
8009
|
const mergedRecord = Object.keys(mergedInput).length > 0 ? mergedInput : void 0;
|
|
7987
|
-
next[existing] =
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
8010
|
+
next[existing] = withPartTimes(
|
|
8011
|
+
{
|
|
8012
|
+
...prev,
|
|
8013
|
+
name: event.name || prev.name,
|
|
8014
|
+
input: mergedRecord,
|
|
8015
|
+
description: toolDescription(event.name || prev.name, mergedRecord),
|
|
8016
|
+
detail: toolDetail(event.name || prev.name, mergedRecord) ?? prev.detail,
|
|
8017
|
+
filePath: toolFilePath(mergedRecord) ?? prev.filePath,
|
|
8018
|
+
additions: diff.additions ?? prev.additions,
|
|
8019
|
+
deletions: diff.deletions ?? prev.deletions,
|
|
8020
|
+
parentId: event.parentId ?? prev.parentId
|
|
8021
|
+
},
|
|
8022
|
+
prev
|
|
8023
|
+
);
|
|
7998
8024
|
return next;
|
|
7999
8025
|
}
|
|
8000
8026
|
return [
|
|
8001
8027
|
...parts,
|
|
8002
|
-
{
|
|
8028
|
+
withPartTimes({
|
|
8003
8029
|
type: "tool",
|
|
8004
8030
|
id: event.id,
|
|
8005
8031
|
name: event.name,
|
|
@@ -8010,7 +8036,7 @@ function applyAgentEvent(parts, event) {
|
|
|
8010
8036
|
filePath: toolFilePath(input),
|
|
8011
8037
|
...event.parentId ? { parentId: event.parentId } : {},
|
|
8012
8038
|
...diff
|
|
8013
|
-
}
|
|
8039
|
+
})
|
|
8014
8040
|
];
|
|
8015
8041
|
}
|
|
8016
8042
|
if (event.type === "tool_result") {
|
|
@@ -8020,7 +8046,7 @@ function applyAgentEvent(parts, event) {
|
|
|
8020
8046
|
if (existing < 0) {
|
|
8021
8047
|
return [
|
|
8022
8048
|
...parts,
|
|
8023
|
-
{
|
|
8049
|
+
withPartTimes({
|
|
8024
8050
|
type: "tool",
|
|
8025
8051
|
id: event.id,
|
|
8026
8052
|
name: "tool",
|
|
@@ -8028,22 +8054,25 @@ function applyAgentEvent(parts, event) {
|
|
|
8028
8054
|
status: event.isError ? "error" : "running",
|
|
8029
8055
|
result: event.content,
|
|
8030
8056
|
...event.parentId ? { parentId: event.parentId } : {}
|
|
8031
|
-
}
|
|
8057
|
+
})
|
|
8032
8058
|
];
|
|
8033
8059
|
}
|
|
8034
8060
|
return parts.map((p, i) => {
|
|
8035
8061
|
if (i !== existing || p.type !== "tool") return p;
|
|
8036
8062
|
if (p.status === "done" || p.status === "error") return p;
|
|
8037
|
-
return
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8063
|
+
return withPartTimes(
|
|
8064
|
+
{
|
|
8065
|
+
...p,
|
|
8066
|
+
result: event.content ?? p.result
|
|
8067
|
+
},
|
|
8068
|
+
p
|
|
8069
|
+
);
|
|
8041
8070
|
});
|
|
8042
8071
|
}
|
|
8043
8072
|
if (existing < 0) {
|
|
8044
8073
|
return [
|
|
8045
8074
|
...parts,
|
|
8046
|
-
{
|
|
8075
|
+
withPartTimes({
|
|
8047
8076
|
type: "tool",
|
|
8048
8077
|
id: event.id,
|
|
8049
8078
|
name: "tool",
|
|
@@ -8053,18 +8082,21 @@ function applyAgentEvent(parts, event) {
|
|
|
8053
8082
|
...event.parentId ? { parentId: event.parentId } : {},
|
|
8054
8083
|
...fromResult.additions != null ? { additions: fromResult.additions } : {},
|
|
8055
8084
|
...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
|
|
8056
|
-
}
|
|
8085
|
+
})
|
|
8057
8086
|
];
|
|
8058
8087
|
}
|
|
8059
8088
|
return parts.map((p, i) => {
|
|
8060
8089
|
if (i !== existing || p.type !== "tool") return p;
|
|
8061
|
-
return
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8090
|
+
return withPartTimes(
|
|
8091
|
+
{
|
|
8092
|
+
...p,
|
|
8093
|
+
status: event.isError ? "error" : "done",
|
|
8094
|
+
result: event.content,
|
|
8095
|
+
...fromResult.additions != null ? { additions: fromResult.additions } : {},
|
|
8096
|
+
...fromResult.deletions != null ? { deletions: fromResult.deletions } : {}
|
|
8097
|
+
},
|
|
8098
|
+
p
|
|
8099
|
+
);
|
|
8068
8100
|
});
|
|
8069
8101
|
}
|
|
8070
8102
|
return parts;
|
|
@@ -8132,43 +8164,43 @@ function electronResourcesPath() {
|
|
|
8132
8164
|
function packagedCursorRuntimeDir() {
|
|
8133
8165
|
const resources = electronResourcesPath();
|
|
8134
8166
|
if (!resources) return null;
|
|
8135
|
-
const dir = (0,
|
|
8136
|
-
if (!(0, import_node_fs22.existsSync)((0,
|
|
8167
|
+
const dir = (0, import_node_path24.join)(resources, "cursor-runtime");
|
|
8168
|
+
if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
|
|
8137
8169
|
return dir;
|
|
8138
8170
|
}
|
|
8139
8171
|
function packagedCursorRunnerPath() {
|
|
8140
8172
|
const dir = packagedCursorRuntimeDir();
|
|
8141
|
-
return dir ? (0,
|
|
8173
|
+
return dir ? (0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
|
|
8142
8174
|
}
|
|
8143
8175
|
function packagedMcpDir() {
|
|
8144
8176
|
const resources = electronResourcesPath();
|
|
8145
8177
|
if (!resources) return null;
|
|
8146
|
-
const dir = (0,
|
|
8147
|
-
if (!(0, import_node_fs22.existsSync)((0,
|
|
8178
|
+
const dir = (0, import_node_path24.join)(resources, "sideboard-mcp");
|
|
8179
|
+
if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
|
|
8148
8180
|
return dir;
|
|
8149
8181
|
}
|
|
8150
8182
|
function packagedMcpStdioPath() {
|
|
8151
8183
|
const dir = packagedMcpDir();
|
|
8152
|
-
return dir ? (0,
|
|
8184
|
+
return dir ? (0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
|
|
8153
8185
|
}
|
|
8154
8186
|
function packagedBundledNodePath() {
|
|
8155
8187
|
const resources = electronResourcesPath();
|
|
8156
8188
|
if (!resources) return null;
|
|
8157
|
-
const bin = (0,
|
|
8189
|
+
const bin = (0, import_node_path24.join)(resources, "node", "bin", "node");
|
|
8158
8190
|
if (!(0, import_node_fs22.existsSync)(bin)) return null;
|
|
8159
8191
|
return bin;
|
|
8160
8192
|
}
|
|
8161
8193
|
function packagedCursorRipgrepCandidate(platformPkg, binName) {
|
|
8162
8194
|
const dir = packagedCursorRuntimeDir();
|
|
8163
8195
|
if (!dir) return null;
|
|
8164
|
-
return (0,
|
|
8196
|
+
return (0, import_node_path24.join)(dir, "node_modules", platformPkg, "bin", binName);
|
|
8165
8197
|
}
|
|
8166
|
-
var import_node_fs22,
|
|
8198
|
+
var import_node_fs22, import_node_path24;
|
|
8167
8199
|
var init_packaged_runtime = __esm({
|
|
8168
8200
|
"src/agents/packaged-runtime.ts"() {
|
|
8169
8201
|
"use strict";
|
|
8170
8202
|
import_node_fs22 = require("fs");
|
|
8171
|
-
|
|
8203
|
+
import_node_path24 = require("path");
|
|
8172
8204
|
}
|
|
8173
8205
|
});
|
|
8174
8206
|
|
|
@@ -8251,28 +8283,28 @@ function versionDirNodeBins(root, toBin) {
|
|
|
8251
8283
|
}
|
|
8252
8284
|
function defaultNodeBinCandidates(home = (0, import_node_os7.homedir)()) {
|
|
8253
8285
|
const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
|
|
8254
|
-
(prefix) => PREFERRED_LTS_MAJORS.map((major) => (0,
|
|
8286
|
+
(prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path25.join)(prefix, "opt", `node@${major}`, "bin", "node"))
|
|
8255
8287
|
);
|
|
8256
8288
|
return [
|
|
8257
8289
|
...kegs,
|
|
8258
8290
|
"/opt/homebrew/bin/node",
|
|
8259
8291
|
"/usr/local/bin/node",
|
|
8260
|
-
(0,
|
|
8261
|
-
(0,
|
|
8262
|
-
(0,
|
|
8263
|
-
(0,
|
|
8264
|
-
(0,
|
|
8292
|
+
(0, import_node_path25.join)(home, ".local/share/fnm/aliases/default/bin/node"),
|
|
8293
|
+
(0, import_node_path25.join)(home, ".nvm/current/bin/node"),
|
|
8294
|
+
(0, import_node_path25.join)(home, ".volta/bin/node"),
|
|
8295
|
+
(0, import_node_path25.join)(home, ".asdf/shims/node"),
|
|
8296
|
+
(0, import_node_path25.join)(home, ".local/share/mise/shims/node"),
|
|
8265
8297
|
...versionDirNodeBins(
|
|
8266
|
-
(0,
|
|
8267
|
-
(name) => (0,
|
|
8298
|
+
(0, import_node_path25.join)(home, ".nvm", "versions", "node"),
|
|
8299
|
+
(name) => (0, import_node_path25.join)(home, ".nvm", "versions", "node", name, "bin", "node")
|
|
8268
8300
|
),
|
|
8269
8301
|
...versionDirNodeBins(
|
|
8270
|
-
(0,
|
|
8271
|
-
(name) => (0,
|
|
8302
|
+
(0, import_node_path25.join)(home, ".local/share/fnm", "node-versions"),
|
|
8303
|
+
(name) => (0, import_node_path25.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
|
|
8272
8304
|
),
|
|
8273
8305
|
...versionDirNodeBins(
|
|
8274
|
-
(0,
|
|
8275
|
-
(name) => (0,
|
|
8306
|
+
(0, import_node_path25.join)(home, ".volta", "tools", "image", "node"),
|
|
8307
|
+
(name) => (0, import_node_path25.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
|
|
8276
8308
|
)
|
|
8277
8309
|
];
|
|
8278
8310
|
}
|
|
@@ -8364,13 +8396,13 @@ async function resolveNodeLaunch(scriptPath) {
|
|
|
8364
8396
|
env: { ELECTRON_RUN_AS_NODE: "1" }
|
|
8365
8397
|
};
|
|
8366
8398
|
}
|
|
8367
|
-
var import_node_fs23, import_node_os7,
|
|
8399
|
+
var import_node_fs23, import_node_os7, import_node_path25, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
|
|
8368
8400
|
var init_node_launch = __esm({
|
|
8369
8401
|
"src/agents/node-launch.ts"() {
|
|
8370
8402
|
"use strict";
|
|
8371
8403
|
import_node_fs23 = require("fs");
|
|
8372
8404
|
import_node_os7 = require("os");
|
|
8373
|
-
|
|
8405
|
+
import_node_path25 = require("path");
|
|
8374
8406
|
init_nested_electron_env();
|
|
8375
8407
|
init_run();
|
|
8376
8408
|
init_packaged_runtime();
|
|
@@ -8463,13 +8495,13 @@ function corePackageDir() {
|
|
|
8463
8495
|
try {
|
|
8464
8496
|
const url = import_meta.url;
|
|
8465
8497
|
if (typeof url === "string" && url.length > 0) {
|
|
8466
|
-
return (0,
|
|
8498
|
+
return (0, import_node_path26.dirname)((0, import_node_url.fileURLToPath)(url));
|
|
8467
8499
|
}
|
|
8468
8500
|
} catch {
|
|
8469
8501
|
}
|
|
8470
8502
|
try {
|
|
8471
|
-
const req = (0, import_node_module.createRequire)((0,
|
|
8472
|
-
return (0,
|
|
8503
|
+
const req = (0, import_node_module.createRequire)((0, import_node_path26.join)(process.cwd(), "package.json"));
|
|
8504
|
+
return (0, import_node_path26.dirname)(req.resolve("@sideboard-ai/core"));
|
|
8473
8505
|
} catch {
|
|
8474
8506
|
return process.cwd();
|
|
8475
8507
|
}
|
|
@@ -8482,18 +8514,18 @@ function findSideboardMcpJsEntry() {
|
|
|
8482
8514
|
let dir = corePackageDir();
|
|
8483
8515
|
for (let i = 0; i < 10; i++) {
|
|
8484
8516
|
const candidates = [
|
|
8485
|
-
(0,
|
|
8486
|
-
(0,
|
|
8487
|
-
(0,
|
|
8488
|
-
(0,
|
|
8489
|
-
(0,
|
|
8490
|
-
(0,
|
|
8491
|
-
(0,
|
|
8517
|
+
(0, import_node_path26.join)(dir, "mcp/run-stdio.js"),
|
|
8518
|
+
(0, import_node_path26.join)(dir, "mcp/run-stdio.cjs"),
|
|
8519
|
+
(0, import_node_path26.join)(dir, "dist/mcp/run-stdio.js"),
|
|
8520
|
+
(0, import_node_path26.join)(dir, "dist/mcp/run-stdio.cjs"),
|
|
8521
|
+
(0, import_node_path26.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
|
|
8522
|
+
(0, import_node_path26.join)(dir, "packages/cli/dist/index.js"),
|
|
8523
|
+
(0, import_node_path26.join)(dir, "cli/dist/index.js")
|
|
8492
8524
|
];
|
|
8493
8525
|
for (const p of candidates) {
|
|
8494
8526
|
if ((0, import_node_fs24.existsSync)(p) && !isAsarPath(p)) return p;
|
|
8495
8527
|
}
|
|
8496
|
-
const parent = (0,
|
|
8528
|
+
const parent = (0, import_node_path26.dirname)(dir);
|
|
8497
8529
|
if (parent === dir) break;
|
|
8498
8530
|
dir = parent;
|
|
8499
8531
|
}
|
|
@@ -8635,22 +8667,22 @@ function writeMcpServersConfig(servers) {
|
|
|
8635
8667
|
...env ? { env } : {}
|
|
8636
8668
|
};
|
|
8637
8669
|
}
|
|
8638
|
-
const dir = (0, import_node_fs24.mkdtempSync)((0,
|
|
8639
|
-
const cfgPath = (0,
|
|
8670
|
+
const dir = (0, import_node_fs24.mkdtempSync)((0, import_node_path26.join)((0, import_node_os8.tmpdir)(), "sideboard-mcp-"));
|
|
8671
|
+
const cfgPath = (0, import_node_path26.join)(dir, "mcp.json");
|
|
8640
8672
|
(0, import_node_fs24.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
|
|
8641
8673
|
return cfgPath;
|
|
8642
8674
|
}
|
|
8643
8675
|
async function writeInjectedMcpConfig(opts) {
|
|
8644
8676
|
return writeMcpServersConfig(await buildInjectedMcpServers(opts));
|
|
8645
8677
|
}
|
|
8646
|
-
var import_node_fs24, import_node_module, import_node_os8,
|
|
8678
|
+
var import_node_fs24, import_node_module, import_node_os8, import_node_path26, import_node_url, import_meta, SIDEBOARD_MCP_ALLOWED_TOOLS, SIDEBOARD_ARTIFACT_MCP_ALLOWED_TOOLS, BRIGHTSY_MCP_ALLOWED_TOOLS, brightsyMcpCommandCache, BRIGHTSY_WORD;
|
|
8647
8679
|
var init_injected_mcp = __esm({
|
|
8648
8680
|
"src/agents/injected-mcp.ts"() {
|
|
8649
8681
|
"use strict";
|
|
8650
8682
|
import_node_fs24 = require("fs");
|
|
8651
8683
|
import_node_module = require("module");
|
|
8652
8684
|
import_node_os8 = require("os");
|
|
8653
|
-
|
|
8685
|
+
import_node_path26 = require("path");
|
|
8654
8686
|
import_node_url = require("url");
|
|
8655
8687
|
init_run();
|
|
8656
8688
|
init_config();
|
|
@@ -9256,8 +9288,8 @@ function usageFromCodex(usage) {
|
|
|
9256
9288
|
}
|
|
9257
9289
|
function codexConfigHasNetworkAccess() {
|
|
9258
9290
|
const candidates = [
|
|
9259
|
-
(0,
|
|
9260
|
-
(0,
|
|
9291
|
+
(0, import_node_path27.join)((0, import_node_os9.homedir)(), ".codex", "config.toml"),
|
|
9292
|
+
(0, import_node_path27.join)((0, import_node_os9.homedir)(), ".config", "codex", "config.toml")
|
|
9261
9293
|
];
|
|
9262
9294
|
for (const path2 of candidates) {
|
|
9263
9295
|
if (!(0, import_node_fs26.existsSync)(path2)) continue;
|
|
@@ -9293,7 +9325,7 @@ function asRecord2(value) {
|
|
|
9293
9325
|
return void 0;
|
|
9294
9326
|
}
|
|
9295
9327
|
function codexLooksAuthenticated() {
|
|
9296
|
-
const authPath = (0,
|
|
9328
|
+
const authPath = (0, import_node_path27.join)((0, import_node_os9.homedir)(), ".codex", "auth.json");
|
|
9297
9329
|
if (!(0, import_node_fs26.existsSync)(authPath)) return false;
|
|
9298
9330
|
try {
|
|
9299
9331
|
return (0, import_node_fs26.statSync)(authPath).size > 2;
|
|
@@ -9301,13 +9333,13 @@ function codexLooksAuthenticated() {
|
|
|
9301
9333
|
return false;
|
|
9302
9334
|
}
|
|
9303
9335
|
}
|
|
9304
|
-
var import_node_fs26, import_node_os9,
|
|
9336
|
+
var import_node_fs26, import_node_os9, import_node_path27, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
|
|
9305
9337
|
var init_codex = __esm({
|
|
9306
9338
|
"src/agents/codex.ts"() {
|
|
9307
9339
|
"use strict";
|
|
9308
9340
|
import_node_fs26 = require("fs");
|
|
9309
9341
|
import_node_os9 = require("os");
|
|
9310
|
-
|
|
9342
|
+
import_node_path27 = require("path");
|
|
9311
9343
|
init_run();
|
|
9312
9344
|
init_app_settings();
|
|
9313
9345
|
init_global_workspace();
|
|
@@ -9787,7 +9819,7 @@ function platformRipgrepPackage() {
|
|
|
9787
9819
|
}
|
|
9788
9820
|
function usableRipgrepPath(candidate) {
|
|
9789
9821
|
const raw = candidate?.trim();
|
|
9790
|
-
if (!raw || !(0,
|
|
9822
|
+
if (!raw || !(0, import_node_path28.isAbsolute)(raw)) return null;
|
|
9791
9823
|
const readable = nodeReadableScriptPath(raw);
|
|
9792
9824
|
if (!(0, import_node_fs27.existsSync)(readable) || isAsarPath(readable)) return null;
|
|
9793
9825
|
return readable;
|
|
@@ -9796,12 +9828,12 @@ function walkForBundledRipgrep(startFile) {
|
|
|
9796
9828
|
if (!startFile) return null;
|
|
9797
9829
|
const pkg = platformRipgrepPackage();
|
|
9798
9830
|
const name = rgBinaryName();
|
|
9799
|
-
let dir = (0,
|
|
9800
|
-
const root = (0,
|
|
9831
|
+
let dir = (0, import_node_path28.dirname)((0, import_node_path28.resolve)(startFile));
|
|
9832
|
+
const root = (0, import_node_path28.parse)(dir).root;
|
|
9801
9833
|
while (dir !== root) {
|
|
9802
|
-
const hit = usableRipgrepPath((0,
|
|
9834
|
+
const hit = usableRipgrepPath((0, import_node_path28.join)(dir, "node_modules", pkg, "bin", name));
|
|
9803
9835
|
if (hit) return hit;
|
|
9804
|
-
const next = (0,
|
|
9836
|
+
const next = (0, import_node_path28.dirname)(dir);
|
|
9805
9837
|
if (next === dir) break;
|
|
9806
9838
|
dir = next;
|
|
9807
9839
|
}
|
|
@@ -9811,7 +9843,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
9811
9843
|
try {
|
|
9812
9844
|
const req = (0, import_node_module2.createRequire)(fromFile);
|
|
9813
9845
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
9814
|
-
return usableRipgrepPath((0,
|
|
9846
|
+
return usableRipgrepPath((0, import_node_path28.join)((0, import_node_path28.dirname)(pkgJson), "bin", rgBinaryName()));
|
|
9815
9847
|
} catch {
|
|
9816
9848
|
return null;
|
|
9817
9849
|
}
|
|
@@ -9833,13 +9865,13 @@ function cursorRipgrepEnv(opts) {
|
|
|
9833
9865
|
const path2 = resolveCursorRipgrepPath(opts);
|
|
9834
9866
|
return path2 ? { [RIPGREP_ENV]: path2 } : {};
|
|
9835
9867
|
}
|
|
9836
|
-
var import_node_fs27, import_node_module2,
|
|
9868
|
+
var import_node_fs27, import_node_module2, import_node_path28, RIPGREP_ENV;
|
|
9837
9869
|
var init_cursor_ripgrep = __esm({
|
|
9838
9870
|
"src/agents/cursor-ripgrep.ts"() {
|
|
9839
9871
|
"use strict";
|
|
9840
9872
|
import_node_fs27 = require("fs");
|
|
9841
9873
|
import_node_module2 = require("module");
|
|
9842
|
-
|
|
9874
|
+
import_node_path28 = require("path");
|
|
9843
9875
|
init_node_launch();
|
|
9844
9876
|
init_packaged_runtime();
|
|
9845
9877
|
RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
|
|
@@ -9885,11 +9917,11 @@ function entryDir() {
|
|
|
9885
9917
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
9886
9918
|
if (cjsDir) return cjsDir;
|
|
9887
9919
|
try {
|
|
9888
|
-
return (0,
|
|
9920
|
+
return (0, import_node_path29.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
|
|
9889
9921
|
} catch {
|
|
9890
9922
|
try {
|
|
9891
9923
|
const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
|
|
9892
|
-
return (0,
|
|
9924
|
+
return (0, import_node_path29.dirname)(req.resolve("@sideboard-ai/core"));
|
|
9893
9925
|
} catch {
|
|
9894
9926
|
return process.cwd();
|
|
9895
9927
|
}
|
|
@@ -9900,27 +9932,27 @@ function cursorRunnerPath() {
|
|
|
9900
9932
|
if (packaged) return packaged;
|
|
9901
9933
|
const root = entryDir();
|
|
9902
9934
|
const candidates = [
|
|
9903
|
-
(0,
|
|
9904
|
-
(0,
|
|
9935
|
+
(0, import_node_path29.join)(root, "agents", "cursor-runner.js"),
|
|
9936
|
+
(0, import_node_path29.join)(root, "agents", "cursor-runner.cjs"),
|
|
9905
9937
|
// If somehow resolved from package root instead of dist/
|
|
9906
|
-
(0,
|
|
9907
|
-
(0,
|
|
9938
|
+
(0, import_node_path29.join)(root, "dist", "agents", "cursor-runner.js"),
|
|
9939
|
+
(0, import_node_path29.join)(root, "dist", "agents", "cursor-runner.cjs"),
|
|
9908
9940
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
9909
|
-
(0,
|
|
9910
|
-
(0,
|
|
9941
|
+
(0, import_node_path29.join)(root, "cursor-runner.ts"),
|
|
9942
|
+
(0, import_node_path29.join)(root, "src", "agents", "cursor-runner.ts")
|
|
9911
9943
|
];
|
|
9912
9944
|
for (const candidate of candidates) {
|
|
9913
9945
|
if ((0, import_node_fs28.existsSync)(candidate)) return candidate;
|
|
9914
9946
|
}
|
|
9915
9947
|
return candidates[0];
|
|
9916
9948
|
}
|
|
9917
|
-
var import_node_fs28, import_node_module3,
|
|
9949
|
+
var import_node_fs28, import_node_module3, import_node_path29, import_node_url2, import_sdk, import_meta2, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
|
|
9918
9950
|
var init_cursor = __esm({
|
|
9919
9951
|
"src/agents/cursor.ts"() {
|
|
9920
9952
|
"use strict";
|
|
9921
9953
|
import_node_fs28 = require("fs");
|
|
9922
9954
|
import_node_module3 = require("module");
|
|
9923
|
-
|
|
9955
|
+
import_node_path29 = require("path");
|
|
9924
9956
|
import_node_url2 = require("url");
|
|
9925
9957
|
import_sdk = require("@cursor/sdk");
|
|
9926
9958
|
init_run();
|
|
@@ -9979,6 +10011,7 @@ var init_cursor = __esm({
|
|
|
9979
10011
|
const req = {
|
|
9980
10012
|
prompt,
|
|
9981
10013
|
cwd: thread.worktreePath,
|
|
10014
|
+
threadId: thread.id,
|
|
9982
10015
|
agentId,
|
|
9983
10016
|
model: thread.model,
|
|
9984
10017
|
effort: thread.effort,
|
|
@@ -11863,12 +11896,12 @@ function readTextIfPresent(abs) {
|
|
|
11863
11896
|
}
|
|
11864
11897
|
}
|
|
11865
11898
|
function readLocalGuidelines(worktreePath) {
|
|
11866
|
-
const localAbs = (0,
|
|
11899
|
+
const localAbs = (0, import_node_path30.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
11867
11900
|
const localContent = readTextIfPresent(localAbs);
|
|
11868
11901
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
11869
11902
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
11870
11903
|
}
|
|
11871
|
-
const legacyAbs = (0,
|
|
11904
|
+
const legacyAbs = (0, import_node_path30.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
11872
11905
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
11873
11906
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
11874
11907
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -11884,20 +11917,20 @@ function skillGuidelines(content, source) {
|
|
|
11884
11917
|
};
|
|
11885
11918
|
}
|
|
11886
11919
|
function ensureReviewSkillFile(worktreePath) {
|
|
11887
|
-
const abs = (0,
|
|
11920
|
+
const abs = (0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH);
|
|
11888
11921
|
const existing = readTextIfPresent(abs);
|
|
11889
11922
|
if (existing) {
|
|
11890
11923
|
return { path: REVIEW_SKILL_PATH, content: existing, wrote: false };
|
|
11891
11924
|
}
|
|
11892
|
-
const fromRepo = readTextIfPresent((0,
|
|
11925
|
+
const fromRepo = readTextIfPresent((0, import_node_path30.join)(worktreePath, REPO_REVIEW_PATH));
|
|
11893
11926
|
const fromLocal = readLocalGuidelines(worktreePath)?.content ?? null;
|
|
11894
11927
|
const content = wrapReviewSkillMarkdown(fromRepo ?? fromLocal ?? REVIEW_REQUEST_TEMPLATE);
|
|
11895
|
-
(0, import_node_fs30.mkdirSync)((0,
|
|
11928
|
+
(0, import_node_fs30.mkdirSync)((0, import_node_path30.dirname)(abs), { recursive: true });
|
|
11896
11929
|
(0, import_node_fs30.writeFileSync)(abs, content, "utf8");
|
|
11897
11930
|
return { path: REVIEW_SKILL_PATH, content, wrote: true };
|
|
11898
11931
|
}
|
|
11899
11932
|
function resolveReviewGuidelines(worktreePath) {
|
|
11900
|
-
const skillContent = readTextIfPresent((0,
|
|
11933
|
+
const skillContent = readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
11901
11934
|
if (skillContent) return skillGuidelines(skillContent, "skill");
|
|
11902
11935
|
const local = readLocalGuidelines(worktreePath);
|
|
11903
11936
|
if (local) {
|
|
@@ -11927,7 +11960,7 @@ function buildReviewRequestAttachment(content, opts) {
|
|
|
11927
11960
|
};
|
|
11928
11961
|
}
|
|
11929
11962
|
function readExistingReviewRequestFile(worktreePath) {
|
|
11930
|
-
return readTextIfPresent((0,
|
|
11963
|
+
return readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path30.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path30.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
|
|
11931
11964
|
}
|
|
11932
11965
|
async function requestReview(threadRef, send2) {
|
|
11933
11966
|
const from = findThreadByRef(threadRef);
|
|
@@ -11954,13 +11987,13 @@ async function requestReview(threadRef, send2) {
|
|
|
11954
11987
|
const started = await send2(tab.id, REVIEW_REQUEST_PREFILL);
|
|
11955
11988
|
return { tab: started, from };
|
|
11956
11989
|
}
|
|
11957
|
-
var import_node_crypto6, import_node_fs30,
|
|
11990
|
+
var import_node_crypto6, import_node_fs30, import_node_path30, REPO_REVIEW_PATH, REPO_REVIEW_NAME, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
|
|
11958
11991
|
var init_request_review = __esm({
|
|
11959
11992
|
"src/review/request-review.ts"() {
|
|
11960
11993
|
"use strict";
|
|
11961
11994
|
import_node_crypto6 = require("crypto");
|
|
11962
11995
|
import_node_fs30 = require("fs");
|
|
11963
|
-
|
|
11996
|
+
import_node_path30 = require("path");
|
|
11964
11997
|
init_global_workspace();
|
|
11965
11998
|
init_chat_tabs();
|
|
11966
11999
|
init_thread_store();
|
|
@@ -11985,7 +12018,7 @@ function matchSimpleGlob(pattern, name) {
|
|
|
11985
12018
|
return new RegExp(`^${escaped}$`).test(name);
|
|
11986
12019
|
}
|
|
11987
12020
|
function readWorktreeInclude(repoPath) {
|
|
11988
|
-
const path2 = (0,
|
|
12021
|
+
const path2 = (0, import_node_path31.join)(repoPath, ".worktreeinclude");
|
|
11989
12022
|
if (!(0, import_node_fs31.existsSync)(path2)) return [];
|
|
11990
12023
|
return (0, import_node_fs31.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
11991
12024
|
}
|
|
@@ -12000,7 +12033,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
12000
12033
|
for (const entry of (0, import_node_fs31.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
12001
12034
|
if (!entry.isFile()) continue;
|
|
12002
12035
|
for (const glob of settings.fileIncludeGlobs) {
|
|
12003
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
12036
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path31.basename)(glob), entry.name)) {
|
|
12004
12037
|
matched.push(entry.name);
|
|
12005
12038
|
break;
|
|
12006
12039
|
}
|
|
@@ -12026,10 +12059,10 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
12026
12059
|
const patterns = resolveFilesToCopy(repoPath);
|
|
12027
12060
|
const copied = [];
|
|
12028
12061
|
for (const rel of patterns) {
|
|
12029
|
-
const src = (0,
|
|
12062
|
+
const src = (0, import_node_path31.join)(repoPath, rel);
|
|
12030
12063
|
if (!(0, import_node_fs31.existsSync)(src)) continue;
|
|
12031
|
-
const dest = (0,
|
|
12032
|
-
(0, import_node_fs31.mkdirSync)((0,
|
|
12064
|
+
const dest = (0, import_node_path31.join)(worktreePath, rel);
|
|
12065
|
+
(0, import_node_fs31.mkdirSync)((0, import_node_path31.dirname)(dest), { recursive: true });
|
|
12033
12066
|
(0, import_node_fs31.copyFileSync)(src, dest);
|
|
12034
12067
|
copied.push(rel);
|
|
12035
12068
|
}
|
|
@@ -12065,7 +12098,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
12065
12098
|
const env = stripNestedElectronEnv({
|
|
12066
12099
|
...baseEnv ?? process.env
|
|
12067
12100
|
});
|
|
12068
|
-
const name = opts.workspaceName ?? (0,
|
|
12101
|
+
const name = opts.workspaceName ?? (0, import_node_path31.basename)(opts.worktreePath);
|
|
12069
12102
|
const ports = opts.ports ?? [];
|
|
12070
12103
|
const primary = ports[0];
|
|
12071
12104
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -12326,13 +12359,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
12326
12359
|
done: handle.done
|
|
12327
12360
|
};
|
|
12328
12361
|
}
|
|
12329
|
-
var import_node_fs31, import_node_net,
|
|
12362
|
+
var import_node_fs31, import_node_net, import_node_path31, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
|
|
12330
12363
|
var init_conductor = __esm({
|
|
12331
12364
|
"src/hook/conductor.ts"() {
|
|
12332
12365
|
"use strict";
|
|
12333
12366
|
import_node_fs31 = require("fs");
|
|
12334
12367
|
import_node_net = require("net");
|
|
12335
|
-
|
|
12368
|
+
import_node_path31 = require("path");
|
|
12336
12369
|
import_execa4 = require("execa");
|
|
12337
12370
|
import_node_readline3 = require("readline");
|
|
12338
12371
|
init_settings();
|
|
@@ -12394,9 +12427,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
12394
12427
|
if ((0, import_node_fs32.existsSync)(root)) {
|
|
12395
12428
|
for (const entry of (0, import_node_fs32.readdirSync)(root, { withFileTypes: true })) {
|
|
12396
12429
|
if (!entry.isDirectory()) continue;
|
|
12397
|
-
const path2 = (0,
|
|
12430
|
+
const path2 = (0, import_node_path32.join)(root, entry.name).replace(/\/$/, "");
|
|
12398
12431
|
if (known.has(path2) || seen.has(path2)) continue;
|
|
12399
|
-
if (!(0, import_node_fs32.existsSync)((0,
|
|
12432
|
+
if (!(0, import_node_fs32.existsSync)((0, import_node_path32.join)(path2, ".git"))) continue;
|
|
12400
12433
|
seen.add(path2);
|
|
12401
12434
|
let mtimeMs = 0;
|
|
12402
12435
|
try {
|
|
@@ -12461,12 +12494,12 @@ function worktreeCleanupSettings() {
|
|
|
12461
12494
|
autoCleanupOrphans: a.autoCleanupOrphans
|
|
12462
12495
|
};
|
|
12463
12496
|
}
|
|
12464
|
-
var import_node_fs32,
|
|
12497
|
+
var import_node_fs32, import_node_path32;
|
|
12465
12498
|
var init_orphan_cleanup = __esm({
|
|
12466
12499
|
"src/git/orphan-cleanup.ts"() {
|
|
12467
12500
|
"use strict";
|
|
12468
12501
|
import_node_fs32 = require("fs");
|
|
12469
|
-
|
|
12502
|
+
import_node_path32 = require("path");
|
|
12470
12503
|
init_worktree();
|
|
12471
12504
|
init_thread_store();
|
|
12472
12505
|
init_paths();
|
|
@@ -12573,10 +12606,10 @@ __export(workspaces_exports, {
|
|
|
12573
12606
|
syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
|
|
12574
12607
|
});
|
|
12575
12608
|
function workspacesFile() {
|
|
12576
|
-
return (0,
|
|
12609
|
+
return (0, import_node_path33.join)(appDataDir(), "workspaces.json");
|
|
12577
12610
|
}
|
|
12578
12611
|
function removedWorkspacesFile() {
|
|
12579
|
-
return (0,
|
|
12612
|
+
return (0, import_node_path33.join)(appDataDir(), "removed-workspaces.json");
|
|
12580
12613
|
}
|
|
12581
12614
|
function readAll2() {
|
|
12582
12615
|
const path2 = workspacesFile();
|
|
@@ -12635,7 +12668,7 @@ async function addWorkspace(repoPath) {
|
|
|
12635
12668
|
if (existing) return existing;
|
|
12636
12669
|
const next = {
|
|
12637
12670
|
path: root,
|
|
12638
|
-
name: (0,
|
|
12671
|
+
name: (0, import_node_path33.basename)(root),
|
|
12639
12672
|
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12640
12673
|
};
|
|
12641
12674
|
writeAll2([...current, next]);
|
|
@@ -12660,7 +12693,7 @@ function syncWorkspacesFromThreads(repoPaths) {
|
|
|
12660
12693
|
if (!(0, import_node_fs33.existsSync)(path2)) continue;
|
|
12661
12694
|
const ws = {
|
|
12662
12695
|
path: path2,
|
|
12663
|
-
name: (0,
|
|
12696
|
+
name: (0, import_node_path33.basename)(path2),
|
|
12664
12697
|
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12665
12698
|
};
|
|
12666
12699
|
byPath.set(path2, ws);
|
|
@@ -12670,12 +12703,12 @@ function syncWorkspacesFromThreads(repoPaths) {
|
|
|
12670
12703
|
if (dirty) writeAll2(next);
|
|
12671
12704
|
return next.sort((a, b) => a.name.localeCompare(b.name));
|
|
12672
12705
|
}
|
|
12673
|
-
var import_node_fs33,
|
|
12706
|
+
var import_node_fs33, import_node_path33;
|
|
12674
12707
|
var init_workspaces2 = __esm({
|
|
12675
12708
|
"src/store/workspaces.ts"() {
|
|
12676
12709
|
"use strict";
|
|
12677
12710
|
import_node_fs33 = require("fs");
|
|
12678
|
-
|
|
12711
|
+
import_node_path33 = require("path");
|
|
12679
12712
|
init_paths();
|
|
12680
12713
|
init_global_workspace();
|
|
12681
12714
|
init_worktree();
|
|
@@ -12688,11 +12721,11 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
12688
12721
|
if (!url) throw new Error("Clone URL is required");
|
|
12689
12722
|
let name = opts.name?.trim();
|
|
12690
12723
|
if (!name) {
|
|
12691
|
-
const leaf = (0,
|
|
12724
|
+
const leaf = (0, import_node_path34.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
12692
12725
|
name = leaf || "repo";
|
|
12693
12726
|
}
|
|
12694
12727
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
12695
|
-
const dest = (0,
|
|
12728
|
+
const dest = (0, import_node_path34.join)(sideboardReposDir(), name);
|
|
12696
12729
|
if ((0, import_node_fs34.existsSync)(dest)) {
|
|
12697
12730
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
12698
12731
|
const workspace2 = await ensureWorkspace(repoPath2);
|
|
@@ -12708,12 +12741,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
12708
12741
|
const workspace = await ensureWorkspace(repoPath);
|
|
12709
12742
|
return { repoPath, workspace };
|
|
12710
12743
|
}
|
|
12711
|
-
var import_node_fs34,
|
|
12744
|
+
var import_node_fs34, import_node_path34, import_execa6;
|
|
12712
12745
|
var init_clone_repo = __esm({
|
|
12713
12746
|
"src/git/clone-repo.ts"() {
|
|
12714
12747
|
"use strict";
|
|
12715
12748
|
import_node_fs34 = require("fs");
|
|
12716
|
-
|
|
12749
|
+
import_node_path34 = require("path");
|
|
12717
12750
|
import_execa6 = require("execa");
|
|
12718
12751
|
init_paths();
|
|
12719
12752
|
init_workspaces2();
|
|
@@ -12991,7 +13024,7 @@ function noteTurnLiveEvent(threadId, event) {
|
|
|
12991
13024
|
buffers.delete(threadId);
|
|
12992
13025
|
return;
|
|
12993
13026
|
}
|
|
12994
|
-
const immediate = event.type === "tool_use" || event.type === "tool_result";
|
|
13027
|
+
const immediate = event.type === "tool_use" || event.type === "tool_result" && !event.partial;
|
|
12995
13028
|
if (immediate) flush(threadId);
|
|
12996
13029
|
else scheduleFlush(threadId);
|
|
12997
13030
|
}
|
|
@@ -13043,6 +13076,27 @@ var init_turn_live = __esm({
|
|
|
13043
13076
|
}
|
|
13044
13077
|
});
|
|
13045
13078
|
|
|
13079
|
+
// src/orchestrator/reconcile-heal.ts
|
|
13080
|
+
function shouldReadThreadToHealReconcile(eventType, lastCheckAt, now) {
|
|
13081
|
+
if (SKIP.has(eventType)) return false;
|
|
13082
|
+
if (lastCheckAt != null && now - lastCheckAt < RECONCILE_HEAL_MIN_MS) return false;
|
|
13083
|
+
return true;
|
|
13084
|
+
}
|
|
13085
|
+
var RECONCILE_HEAL_MIN_MS, SKIP;
|
|
13086
|
+
var init_reconcile_heal = __esm({
|
|
13087
|
+
"src/orchestrator/reconcile-heal.ts"() {
|
|
13088
|
+
"use strict";
|
|
13089
|
+
RECONCILE_HEAL_MIN_MS = 2e3;
|
|
13090
|
+
SKIP = /* @__PURE__ */ new Set([
|
|
13091
|
+
"stdout",
|
|
13092
|
+
"thinking",
|
|
13093
|
+
"usage",
|
|
13094
|
+
"stderr",
|
|
13095
|
+
"tool_result"
|
|
13096
|
+
]);
|
|
13097
|
+
}
|
|
13098
|
+
});
|
|
13099
|
+
|
|
13046
13100
|
// src/threads/fork-worktree.ts
|
|
13047
13101
|
function requireThread2(idOrRef) {
|
|
13048
13102
|
const thread = findThreadByRef(idOrRef) ?? null;
|
|
@@ -13213,7 +13267,7 @@ var init_quota_failover = __esm({
|
|
|
13213
13267
|
// src/threads/adopt.ts
|
|
13214
13268
|
function thisModuleFile() {
|
|
13215
13269
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
13216
|
-
return cjsFile || process.argv[1] || (0,
|
|
13270
|
+
return cjsFile || process.argv[1] || (0, import_node_path35.join)(process.cwd(), "package.json");
|
|
13217
13271
|
}
|
|
13218
13272
|
function openReadonlySqlite(file) {
|
|
13219
13273
|
const req = (0, import_node_module4.createRequire)(thisModuleFile());
|
|
@@ -13241,7 +13295,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
13241
13295
|
return null;
|
|
13242
13296
|
}
|
|
13243
13297
|
for (const hash of hashes) {
|
|
13244
|
-
const agentsFile = (0,
|
|
13298
|
+
const agentsFile = (0, import_node_path35.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
13245
13299
|
if (!(0, import_node_fs37.existsSync)(agentsFile)) continue;
|
|
13246
13300
|
let text4;
|
|
13247
13301
|
try {
|
|
@@ -13299,8 +13353,8 @@ function listConductorWorkspaces() {
|
|
|
13299
13353
|
if (!(0, import_node_fs37.existsSync)(CONDUCTOR_DB)) {
|
|
13300
13354
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
13301
13355
|
}
|
|
13302
|
-
const tmp = (0, import_node_fs37.mkdtempSync)((0,
|
|
13303
|
-
const snapshot = (0,
|
|
13356
|
+
const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path35.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
|
|
13357
|
+
const snapshot = (0, import_node_path35.join)(tmp, "conductor.db");
|
|
13304
13358
|
try {
|
|
13305
13359
|
(0, import_node_fs37.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
13306
13360
|
for (const suffix of ["-wal", "-shm"]) {
|
|
@@ -13390,8 +13444,8 @@ function importConductorWorkspace(workspaceId) {
|
|
|
13390
13444
|
if (!(0, import_node_fs37.existsSync)(CONDUCTOR_DB)) {
|
|
13391
13445
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
13392
13446
|
}
|
|
13393
|
-
const tmp = (0, import_node_fs37.mkdtempSync)((0,
|
|
13394
|
-
const snapshot = (0,
|
|
13447
|
+
const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path35.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
|
|
13448
|
+
const snapshot = (0, import_node_path35.join)(tmp, "conductor.db");
|
|
13395
13449
|
try {
|
|
13396
13450
|
(0, import_node_fs37.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
13397
13451
|
for (const suffix of ["-wal", "-shm"]) {
|
|
@@ -13485,25 +13539,25 @@ function importConductorWorkspace(workspaceId) {
|
|
|
13485
13539
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
13486
13540
|
return importConductorWorkspace(workspaceId);
|
|
13487
13541
|
}
|
|
13488
|
-
var import_node_child_process4, import_node_fs37, import_node_os10,
|
|
13542
|
+
var import_node_child_process4, import_node_fs37, import_node_os10, import_node_path35, import_node_module4, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
|
|
13489
13543
|
var init_adopt = __esm({
|
|
13490
13544
|
"src/threads/adopt.ts"() {
|
|
13491
13545
|
"use strict";
|
|
13492
13546
|
import_node_child_process4 = require("child_process");
|
|
13493
13547
|
import_node_fs37 = require("fs");
|
|
13494
13548
|
import_node_os10 = require("os");
|
|
13495
|
-
|
|
13549
|
+
import_node_path35 = require("path");
|
|
13496
13550
|
import_node_module4 = require("module");
|
|
13497
13551
|
init_worktree();
|
|
13498
13552
|
init_thread_store();
|
|
13499
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
13553
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path35.join)(
|
|
13500
13554
|
process.env.HOME ?? "",
|
|
13501
13555
|
"Library",
|
|
13502
13556
|
"Application Support",
|
|
13503
13557
|
"com.conductor.app"
|
|
13504
13558
|
);
|
|
13505
|
-
CONDUCTOR_DB = (0,
|
|
13506
|
-
CURSOR_SDK_STORE = (0,
|
|
13559
|
+
CONDUCTOR_DB = (0, import_node_path35.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
13560
|
+
CURSOR_SDK_STORE = (0, import_node_path35.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
13507
13561
|
}
|
|
13508
13562
|
});
|
|
13509
13563
|
|
|
@@ -13958,7 +14012,7 @@ new file mode 100644
|
|
|
13958
14012
|
};
|
|
13959
14013
|
}
|
|
13960
14014
|
async function untrackedPatch(worktreePath, path2, maxHunk) {
|
|
13961
|
-
const abs = (0,
|
|
14015
|
+
const abs = (0, import_node_path36.join)(worktreePath, path2);
|
|
13962
14016
|
try {
|
|
13963
14017
|
const st = (0, import_node_fs39.statSync)(abs);
|
|
13964
14018
|
if (st.isFile() && st.size > maxHunk) {
|
|
@@ -14451,7 +14505,7 @@ function isImageRelativePath(relativePath) {
|
|
|
14451
14505
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
14452
14506
|
assertSafeRelativePath(relativePath);
|
|
14453
14507
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
14454
|
-
const abs = (0,
|
|
14508
|
+
const abs = (0, import_node_path36.join)(worktreePath, relativePath);
|
|
14455
14509
|
const st = (0, import_node_fs39.statSync)(abs);
|
|
14456
14510
|
if (!st.isFile()) {
|
|
14457
14511
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -14471,7 +14525,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
14471
14525
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
14472
14526
|
assertSafeRelativePath(relativePath);
|
|
14473
14527
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
14474
|
-
const abs = (0,
|
|
14528
|
+
const abs = (0, import_node_path36.join)(worktreePath, relativePath);
|
|
14475
14529
|
const st = (0, import_node_fs39.statSync)(abs);
|
|
14476
14530
|
if (!st.isFile()) {
|
|
14477
14531
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -14519,8 +14573,8 @@ function assertSafeRelativePath(relativePath) {
|
|
|
14519
14573
|
}
|
|
14520
14574
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
14521
14575
|
assertSafeRelativePath(relativePath);
|
|
14522
|
-
const abs = (0,
|
|
14523
|
-
(0, import_node_fs39.mkdirSync)((0,
|
|
14576
|
+
const abs = (0, import_node_path36.join)(worktreePath, relativePath);
|
|
14577
|
+
(0, import_node_fs39.mkdirSync)((0, import_node_path36.dirname)(abs), { recursive: true });
|
|
14524
14578
|
(0, import_node_fs39.writeFileSync)(abs, content, "utf8");
|
|
14525
14579
|
return { path: relativePath };
|
|
14526
14580
|
}
|
|
@@ -14538,12 +14592,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
14538
14592
|
truncated: full.files.length > maxFiles
|
|
14539
14593
|
};
|
|
14540
14594
|
}
|
|
14541
|
-
var import_node_fs39,
|
|
14595
|
+
var import_node_fs39, import_node_path36, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS, DEFAULT_UPLOAD_MAX_BYTES;
|
|
14542
14596
|
var init_diff = __esm({
|
|
14543
14597
|
"src/diff/diff.ts"() {
|
|
14544
14598
|
"use strict";
|
|
14545
14599
|
import_node_fs39 = require("fs");
|
|
14546
|
-
|
|
14600
|
+
import_node_path36 = require("path");
|
|
14547
14601
|
init_run();
|
|
14548
14602
|
init_worktree();
|
|
14549
14603
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -14739,7 +14793,7 @@ function scanSkillsDir(dir, source, out) {
|
|
|
14739
14793
|
}
|
|
14740
14794
|
for (const entry of entries) {
|
|
14741
14795
|
if (entry.startsWith(".")) continue;
|
|
14742
|
-
const skillMd = (0,
|
|
14796
|
+
const skillMd = (0, import_node_path37.join)(dir, entry, "SKILL.md");
|
|
14743
14797
|
if (!(0, import_node_fs40.existsSync)(skillMd)) continue;
|
|
14744
14798
|
try {
|
|
14745
14799
|
if (!(0, import_node_fs40.statSync)(skillMd).isFile()) continue;
|
|
@@ -14761,12 +14815,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
|
|
|
14761
14815
|
return;
|
|
14762
14816
|
}
|
|
14763
14817
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
14764
|
-
const skill = readSkill((0,
|
|
14818
|
+
const skill = readSkill((0, import_node_path37.join)(dir, "SKILL.md"), "cli");
|
|
14765
14819
|
if (skill) out.push(skill);
|
|
14766
14820
|
}
|
|
14767
14821
|
for (const entry of entries) {
|
|
14768
14822
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
14769
|
-
const full = (0,
|
|
14823
|
+
const full = (0, import_node_path37.join)(dir, entry);
|
|
14770
14824
|
try {
|
|
14771
14825
|
if (!(0, import_node_fs40.statSync)(full).isDirectory()) continue;
|
|
14772
14826
|
} catch {
|
|
@@ -14786,17 +14840,17 @@ function discoverSkills(worktreePath) {
|
|
|
14786
14840
|
const home = (0, import_node_os11.homedir)();
|
|
14787
14841
|
const collected = [];
|
|
14788
14842
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
14789
|
-
scanSkillsDir((0,
|
|
14843
|
+
scanSkillsDir((0, import_node_path37.join)(worktreePath, rel), "workspace", collected);
|
|
14790
14844
|
}
|
|
14791
14845
|
for (const abs of [
|
|
14792
|
-
(0,
|
|
14793
|
-
(0,
|
|
14794
|
-
(0,
|
|
14795
|
-
(0,
|
|
14846
|
+
(0, import_node_path37.join)(home, ".claude/skills"),
|
|
14847
|
+
(0, import_node_path37.join)(home, ".cursor/skills"),
|
|
14848
|
+
(0, import_node_path37.join)(home, ".sideboard/skills"),
|
|
14849
|
+
(0, import_node_path37.join)(home, ".brightsy/skills")
|
|
14796
14850
|
]) {
|
|
14797
14851
|
scanSkillsDir(abs, "user", collected);
|
|
14798
14852
|
}
|
|
14799
|
-
scanClaudePluginSkills((0,
|
|
14853
|
+
scanClaudePluginSkills((0, import_node_path37.join)(home, ".claude/plugins"), collected);
|
|
14800
14854
|
const rank = { workspace: 0, user: 1, cli: 2 };
|
|
14801
14855
|
const byCommand = /* @__PURE__ */ new Map();
|
|
14802
14856
|
for (const skill of collected) {
|
|
@@ -14822,13 +14876,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
14822
14876
|
|
|
14823
14877
|
\u2026(truncated)` : raw;
|
|
14824
14878
|
}
|
|
14825
|
-
var import_node_fs40, import_node_os11,
|
|
14879
|
+
var import_node_fs40, import_node_os11, import_node_path37;
|
|
14826
14880
|
var init_discover = __esm({
|
|
14827
14881
|
"src/skills/discover.ts"() {
|
|
14828
14882
|
"use strict";
|
|
14829
14883
|
import_node_fs40 = require("fs");
|
|
14830
14884
|
import_node_os11 = require("os");
|
|
14831
|
-
|
|
14885
|
+
import_node_path37 = require("path");
|
|
14832
14886
|
}
|
|
14833
14887
|
});
|
|
14834
14888
|
|
|
@@ -14919,7 +14973,7 @@ var init_expand = __esm({
|
|
|
14919
14973
|
|
|
14920
14974
|
// src/composer/stage-files.ts
|
|
14921
14975
|
function fileExtension(filePath) {
|
|
14922
|
-
const base = (0,
|
|
14976
|
+
const base = (0, import_node_path38.basename)(filePath).toLowerCase();
|
|
14923
14977
|
return base.includes(".") ? base.split(".").pop() || "" : "";
|
|
14924
14978
|
}
|
|
14925
14979
|
function isImageFilePath(filePath) {
|
|
@@ -14929,9 +14983,9 @@ function imageMimeType(filePath) {
|
|
|
14929
14983
|
return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
|
|
14930
14984
|
}
|
|
14931
14985
|
function ensureAttachmentsDir(worktreePath) {
|
|
14932
|
-
const dir = (0,
|
|
14986
|
+
const dir = (0, import_node_path38.join)(worktreePath, ATTACHMENTS_DIR);
|
|
14933
14987
|
(0, import_node_fs41.mkdirSync)(dir, { recursive: true });
|
|
14934
|
-
const gi = (0,
|
|
14988
|
+
const gi = (0, import_node_path38.join)(dir, ".gitignore");
|
|
14935
14989
|
if (!(0, import_node_fs41.existsSync)(gi)) {
|
|
14936
14990
|
(0, import_node_fs41.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
|
|
14937
14991
|
}
|
|
@@ -14939,12 +14993,12 @@ function ensureAttachmentsDir(worktreePath) {
|
|
|
14939
14993
|
}
|
|
14940
14994
|
function uniqueAttachmentName(dir, originalName) {
|
|
14941
14995
|
const safe = originalName.replace(/[/\\]/g, "_") || "file";
|
|
14942
|
-
if (!(0, import_node_fs41.existsSync)((0,
|
|
14943
|
-
const ext = (0,
|
|
14996
|
+
if (!(0, import_node_fs41.existsSync)((0, import_node_path38.join)(dir, safe))) return safe;
|
|
14997
|
+
const ext = (0, import_node_path38.extname)(safe);
|
|
14944
14998
|
const stem = ext ? safe.slice(0, -ext.length) : safe;
|
|
14945
14999
|
for (let i = 1; i < 1e4; i++) {
|
|
14946
15000
|
const candidate = `${stem}-${i}${ext}`;
|
|
14947
|
-
if (!(0, import_node_fs41.existsSync)((0,
|
|
15001
|
+
if (!(0, import_node_fs41.existsSync)((0, import_node_path38.join)(dir, candidate))) return candidate;
|
|
14948
15002
|
}
|
|
14949
15003
|
return `${stem}-${(0, import_node_crypto8.randomUUID)()}${ext}`;
|
|
14950
15004
|
}
|
|
@@ -14996,7 +15050,7 @@ function attachmentFromBuffer(name, buf, opts) {
|
|
|
14996
15050
|
};
|
|
14997
15051
|
}
|
|
14998
15052
|
function attachmentFromAbsolutePath(absolutePath) {
|
|
14999
|
-
const name = (0,
|
|
15053
|
+
const name = (0, import_node_path38.basename)(absolutePath);
|
|
15000
15054
|
try {
|
|
15001
15055
|
const st = (0, import_node_fs41.statSync)(absolutePath);
|
|
15002
15056
|
if (!st.isFile()) {
|
|
@@ -15023,12 +15077,12 @@ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
|
|
|
15023
15077
|
const dir = ensureAttachmentsDir(worktreePath);
|
|
15024
15078
|
const out = [];
|
|
15025
15079
|
for (const abs of absolutePaths) {
|
|
15026
|
-
const originalName = (0,
|
|
15080
|
+
const originalName = (0, import_node_path38.basename)(abs);
|
|
15027
15081
|
try {
|
|
15028
15082
|
const st = (0, import_node_fs41.statSync)(abs);
|
|
15029
15083
|
if (!st.isFile()) continue;
|
|
15030
15084
|
const name = uniqueAttachmentName(dir, originalName);
|
|
15031
|
-
const destAbs = (0,
|
|
15085
|
+
const destAbs = (0, import_node_path38.join)(dir, name);
|
|
15032
15086
|
(0, import_node_fs41.copyFileSync)(abs, destAbs);
|
|
15033
15087
|
const rel = `${ATTACHMENTS_DIR}/${name}`;
|
|
15034
15088
|
const buf = (0, import_node_fs41.readFileSync)(destAbs);
|
|
@@ -15053,7 +15107,7 @@ function stageBuffersAsAttachments(worktreePath, buffers2) {
|
|
|
15053
15107
|
try {
|
|
15054
15108
|
const buf = Buffer.from(item.dataBase64, "base64");
|
|
15055
15109
|
const name = uniqueAttachmentName(dir, originalName);
|
|
15056
|
-
const destAbs = (0,
|
|
15110
|
+
const destAbs = (0, import_node_path38.join)(dir, name);
|
|
15057
15111
|
(0, import_node_fs41.writeFileSync)(destAbs, buf);
|
|
15058
15112
|
const rel = `${ATTACHMENTS_DIR}/${name}`;
|
|
15059
15113
|
out.push(attachmentFromBuffer(name, buf, { path: rel }));
|
|
@@ -15090,15 +15144,15 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
|
|
|
15090
15144
|
if (!rel || rel.includes("..") || rel.startsWith("/")) {
|
|
15091
15145
|
out.push({
|
|
15092
15146
|
id: (0, import_node_crypto8.randomUUID)(),
|
|
15093
|
-
name: (0,
|
|
15147
|
+
name: (0, import_node_path38.basename)(rel) || "file",
|
|
15094
15148
|
kind: "file",
|
|
15095
15149
|
content: `(invalid path: ${rel})`
|
|
15096
15150
|
});
|
|
15097
15151
|
continue;
|
|
15098
15152
|
}
|
|
15099
|
-
const name = (0,
|
|
15153
|
+
const name = (0, import_node_path38.basename)(rel);
|
|
15100
15154
|
try {
|
|
15101
|
-
const abs = (0,
|
|
15155
|
+
const abs = (0, import_node_path38.join)(worktreePath, rel);
|
|
15102
15156
|
const st = (0, import_node_fs41.statSync)(abs);
|
|
15103
15157
|
if (!st.isFile()) continue;
|
|
15104
15158
|
const buf = (0, import_node_fs41.readFileSync)(abs);
|
|
@@ -15114,12 +15168,12 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
|
|
|
15114
15168
|
}
|
|
15115
15169
|
return out;
|
|
15116
15170
|
}
|
|
15117
|
-
var import_node_fs41,
|
|
15171
|
+
var import_node_fs41, import_node_path38, import_node_crypto8, IMAGE_EXTENSIONS2, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES;
|
|
15118
15172
|
var init_stage_files = __esm({
|
|
15119
15173
|
"src/composer/stage-files.ts"() {
|
|
15120
15174
|
"use strict";
|
|
15121
15175
|
import_node_fs41 = require("fs");
|
|
15122
|
-
|
|
15176
|
+
import_node_path38 = require("path");
|
|
15123
15177
|
import_node_crypto8 = require("crypto");
|
|
15124
15178
|
init_workspace_scratch();
|
|
15125
15179
|
IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
@@ -15296,7 +15350,7 @@ function loadAgentInstructions(worktreePath, agent) {
|
|
|
15296
15350
|
const out = [];
|
|
15297
15351
|
for (const rel of candidates) {
|
|
15298
15352
|
if (seenPaths.has(rel)) continue;
|
|
15299
|
-
const abs = (0,
|
|
15353
|
+
const abs = (0, import_node_path39.join)(worktreePath, rel);
|
|
15300
15354
|
if (!(0, import_node_fs42.existsSync)(abs)) continue;
|
|
15301
15355
|
try {
|
|
15302
15356
|
if (!(0, import_node_fs42.statSync)(abs).isFile()) continue;
|
|
@@ -15340,12 +15394,12 @@ function withAgentInstructions(prompt, files) {
|
|
|
15340
15394
|
|
|
15341
15395
|
${prompt}`;
|
|
15342
15396
|
}
|
|
15343
|
-
var import_node_fs42,
|
|
15397
|
+
var import_node_fs42, import_node_path39, FILES_BY_AGENT, MAX_CHARS_PER_FILE;
|
|
15344
15398
|
var init_instructions = __esm({
|
|
15345
15399
|
"src/agents/instructions.ts"() {
|
|
15346
15400
|
"use strict";
|
|
15347
15401
|
import_node_fs42 = require("fs");
|
|
15348
|
-
|
|
15402
|
+
import_node_path39 = require("path");
|
|
15349
15403
|
init_git_auth_mode();
|
|
15350
15404
|
init_worktree_labels();
|
|
15351
15405
|
FILES_BY_AGENT = {
|
|
@@ -15435,13 +15489,13 @@ __export(plan_file_exports, {
|
|
|
15435
15489
|
writePlanFile: () => writePlanFile
|
|
15436
15490
|
});
|
|
15437
15491
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
15438
|
-
const gitignoreAbs = (0,
|
|
15492
|
+
const gitignoreAbs = (0, import_node_path40.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
15439
15493
|
if ((0, import_node_fs43.existsSync)(gitignoreAbs)) return;
|
|
15440
|
-
(0, import_node_fs43.mkdirSync)((0,
|
|
15494
|
+
(0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(gitignoreAbs), { recursive: true });
|
|
15441
15495
|
(0, import_node_fs43.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
15442
15496
|
}
|
|
15443
15497
|
function planFileAbs(worktreePath) {
|
|
15444
|
-
return (0,
|
|
15498
|
+
return (0, import_node_path40.join)(worktreePath, PLAN_FILE_REL);
|
|
15445
15499
|
}
|
|
15446
15500
|
function readTextIfPresent2(abs) {
|
|
15447
15501
|
if (!(0, import_node_fs43.existsSync)(abs)) return null;
|
|
@@ -15453,22 +15507,22 @@ function readTextIfPresent2(abs) {
|
|
|
15453
15507
|
}
|
|
15454
15508
|
}
|
|
15455
15509
|
function readPlanFile(worktreePath) {
|
|
15456
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
15510
|
+
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path40.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path40.join)(worktreePath, LEGACY_PLAN_FILE_REL));
|
|
15457
15511
|
}
|
|
15458
15512
|
function writePlanFile(worktreePath, content) {
|
|
15459
15513
|
ensureAttachmentsGitignore(worktreePath);
|
|
15460
15514
|
const abs = planFileAbs(worktreePath);
|
|
15461
|
-
(0, import_node_fs43.mkdirSync)((0,
|
|
15515
|
+
(0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(abs), { recursive: true });
|
|
15462
15516
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
15463
15517
|
(0, import_node_fs43.writeFileSync)(abs, body, "utf8");
|
|
15464
15518
|
return PLAN_FILE_REL;
|
|
15465
15519
|
}
|
|
15466
|
-
var import_node_fs43,
|
|
15520
|
+
var import_node_fs43, import_node_path40;
|
|
15467
15521
|
var init_plan_file = __esm({
|
|
15468
15522
|
"src/plan/plan-file.ts"() {
|
|
15469
15523
|
"use strict";
|
|
15470
15524
|
import_node_fs43 = require("fs");
|
|
15471
|
-
|
|
15525
|
+
import_node_path40 = require("path");
|
|
15472
15526
|
init_workspace_scratch();
|
|
15473
15527
|
init_plan_present();
|
|
15474
15528
|
init_plan_present();
|
|
@@ -15514,6 +15568,37 @@ var init_sync_branch = __esm({
|
|
|
15514
15568
|
}
|
|
15515
15569
|
});
|
|
15516
15570
|
|
|
15571
|
+
// src/agents/cursor-store.ts
|
|
15572
|
+
function cursorSdkStoreDir(threadId) {
|
|
15573
|
+
const root = (0, import_node_path41.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
|
|
15574
|
+
const id = sanitizeCursorStoreSegment(threadId);
|
|
15575
|
+
if (!id) return root;
|
|
15576
|
+
return (0, import_node_path41.join)(root, "threads", id);
|
|
15577
|
+
}
|
|
15578
|
+
function cursorSdkRunsNdjsonPath(threadId) {
|
|
15579
|
+
return (0, import_node_path41.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
|
|
15580
|
+
}
|
|
15581
|
+
function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
15582
|
+
const scoped = cursorSdkRunsNdjsonPath(threadId);
|
|
15583
|
+
const shared = cursorSdkRunsNdjsonPath(null);
|
|
15584
|
+
if (!threadId || !sanitizeCursorStoreSegment(threadId) || scoped === shared) {
|
|
15585
|
+
return [shared];
|
|
15586
|
+
}
|
|
15587
|
+
return [scoped, shared];
|
|
15588
|
+
}
|
|
15589
|
+
function sanitizeCursorStoreSegment(threadId) {
|
|
15590
|
+
return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
15591
|
+
}
|
|
15592
|
+
var import_node_path41, CURSOR_SDK_STORE_DIR;
|
|
15593
|
+
var init_cursor_store = __esm({
|
|
15594
|
+
"src/agents/cursor-store.ts"() {
|
|
15595
|
+
"use strict";
|
|
15596
|
+
import_node_path41 = require("path");
|
|
15597
|
+
init_paths();
|
|
15598
|
+
CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
|
|
15599
|
+
}
|
|
15600
|
+
});
|
|
15601
|
+
|
|
15517
15602
|
// src/agents/cursor-recover.ts
|
|
15518
15603
|
var cursor_recover_exports = {};
|
|
15519
15604
|
__export(cursor_recover_exports, {
|
|
@@ -15522,7 +15607,14 @@ __export(cursor_recover_exports, {
|
|
|
15522
15607
|
function recoverFinishedCursorRun(opts) {
|
|
15523
15608
|
const agentId = opts.agentId.trim();
|
|
15524
15609
|
if (!agentId) return null;
|
|
15525
|
-
|
|
15610
|
+
let best = null;
|
|
15611
|
+
for (const runsPath of cursorSdkRunsNdjsonSearchPaths(opts.threadId)) {
|
|
15612
|
+
const hit = scanFinishedCursorRuns(runsPath, agentId, opts.startedAfterMs);
|
|
15613
|
+
if (hit && (!best || hit.endedAt >= best.endedAt)) best = hit;
|
|
15614
|
+
}
|
|
15615
|
+
return best;
|
|
15616
|
+
}
|
|
15617
|
+
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
15526
15618
|
if (!(0, import_node_fs44.existsSync)(runsPath)) return null;
|
|
15527
15619
|
try {
|
|
15528
15620
|
const lines = (0, import_node_fs44.readFileSync)(runsPath, "utf8").split("\n");
|
|
@@ -15541,7 +15633,7 @@ function recoverFinishedCursorRun(opts) {
|
|
|
15541
15633
|
if (typeof row.result !== "string" || !row.result.trim()) continue;
|
|
15542
15634
|
const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
|
|
15543
15635
|
const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
|
|
15544
|
-
if (createdAt <
|
|
15636
|
+
if (createdAt < startedAfterMs && endedAt < startedAfterMs) continue;
|
|
15545
15637
|
if (!best || endedAt >= best.endedAt) {
|
|
15546
15638
|
best = { runId: row.runId || "", result: row.result.trim(), endedAt };
|
|
15547
15639
|
}
|
|
@@ -15551,13 +15643,12 @@ function recoverFinishedCursorRun(opts) {
|
|
|
15551
15643
|
return null;
|
|
15552
15644
|
}
|
|
15553
15645
|
}
|
|
15554
|
-
var import_node_fs44
|
|
15646
|
+
var import_node_fs44;
|
|
15555
15647
|
var init_cursor_recover = __esm({
|
|
15556
15648
|
"src/agents/cursor-recover.ts"() {
|
|
15557
15649
|
"use strict";
|
|
15558
15650
|
import_node_fs44 = require("fs");
|
|
15559
|
-
|
|
15560
|
-
init_paths();
|
|
15651
|
+
init_cursor_store();
|
|
15561
15652
|
}
|
|
15562
15653
|
});
|
|
15563
15654
|
|
|
@@ -15718,6 +15809,7 @@ var init_orchestrator = __esm({
|
|
|
15718
15809
|
init_run();
|
|
15719
15810
|
init_repo_git_lock();
|
|
15720
15811
|
init_turn_live();
|
|
15812
|
+
init_reconcile_heal();
|
|
15721
15813
|
init_request_review();
|
|
15722
15814
|
init_fork_worktree();
|
|
15723
15815
|
init_quota_failover();
|
|
@@ -15747,6 +15839,8 @@ var init_orchestrator = __esm({
|
|
|
15747
15839
|
draining = /* @__PURE__ */ new Set();
|
|
15748
15840
|
/** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
|
|
15749
15841
|
startingTurns = /* @__PURE__ */ new Set();
|
|
15842
|
+
/** Last sync thread-file read for false-stop heal (throttled per thread). */
|
|
15843
|
+
lastReconcileHealAt = /* @__PURE__ */ new Map();
|
|
15750
15844
|
/**
|
|
15751
15845
|
* Threads intentionally force-stopped. Prevents runTurn from re-asserting
|
|
15752
15846
|
* `running` after spawn, and from overwriting `stopped` with idle/error when
|
|
@@ -16344,7 +16438,13 @@ var init_orchestrator = __esm({
|
|
|
16344
16438
|
if (event.type === "stderr" && typeof event.data === "string") {
|
|
16345
16439
|
pushTurnStderr(stderrTail, event.data);
|
|
16346
16440
|
}
|
|
16347
|
-
|
|
16441
|
+
const now = Date.now();
|
|
16442
|
+
if (shouldReadThreadToHealReconcile(
|
|
16443
|
+
event.type,
|
|
16444
|
+
this.lastReconcileHealAt.get(threadId),
|
|
16445
|
+
now
|
|
16446
|
+
)) {
|
|
16447
|
+
this.lastReconcileHealAt.set(threadId, now);
|
|
16348
16448
|
const live = readThread(threadId);
|
|
16349
16449
|
if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
|
|
16350
16450
|
setStatus(threadId, "running");
|
|
@@ -16388,7 +16488,8 @@ var init_orchestrator = __esm({
|
|
|
16388
16488
|
for (let i = 0; i < 8; i++) {
|
|
16389
16489
|
const recovered = recoverFinishedCursorRun2({
|
|
16390
16490
|
agentId: sessionId,
|
|
16391
|
-
startedAfterMs: turnStartedAt - 5e3
|
|
16491
|
+
startedAfterMs: turnStartedAt - 5e3,
|
|
16492
|
+
threadId
|
|
16392
16493
|
});
|
|
16393
16494
|
if (recovered?.result) {
|
|
16394
16495
|
assistantText = recovered.result;
|
|
@@ -17935,6 +18036,7 @@ __export(index_exports, {
|
|
|
17935
18036
|
isThinkingEffort: () => isThinkingEffort,
|
|
17936
18037
|
isThisProcessDesktopHost: () => isThisProcessDesktopHost,
|
|
17937
18038
|
isThreadCaffeinated: () => isThreadCaffeinated,
|
|
18039
|
+
isThreadRecordFile: () => isThreadRecordFile,
|
|
17938
18040
|
isWorkspaceScratchPath: () => isWorkspaceScratchPath,
|
|
17939
18041
|
lastRequestOccupancy: () => lastRequestOccupancy,
|
|
17940
18042
|
linearAuthorizationHeader: () => linearAuthorizationHeader,
|
|
@@ -19154,7 +19256,7 @@ init_orphan_cleanup();
|
|
|
19154
19256
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
19155
19257
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
19156
19258
|
var import_zod4 = require("zod");
|
|
19157
|
-
var
|
|
19259
|
+
var import_node_path42 = require("path");
|
|
19158
19260
|
init_orchestrator();
|
|
19159
19261
|
init_worktree();
|
|
19160
19262
|
init_create();
|
|
@@ -20031,7 +20133,7 @@ async function startMcpServer() {
|
|
|
20031
20133
|
async () => {
|
|
20032
20134
|
const threads = orch.getThreads(true);
|
|
20033
20135
|
const lines = threads.map((t) => {
|
|
20034
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
20136
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path42.basename)(t.repoPath) || t.repoPath;
|
|
20035
20137
|
const live = t.status === "running" || t.status === "queued" ? readTurnLive(t.id) : null;
|
|
20036
20138
|
const progress = live?.summary ? ` ${live.summary}` : "";
|
|
20037
20139
|
return `${t.id.slice(0, 8)} ${t.status.padEnd(9)} ${t.agent.padEnd(8)} ${repo} ${t.sourceType}:${t.sourceRef} ${t.title} sideboard://thread/${t.id}${t.devPort ? ` http://localhost:${t.devPort}` : ""}${progress}`;
|
|
@@ -21373,14 +21475,14 @@ init_injected_mcp();
|
|
|
21373
21475
|
// src/agents/user-mcp-config.ts
|
|
21374
21476
|
var import_node_fs46 = require("fs");
|
|
21375
21477
|
var import_node_os12 = require("os");
|
|
21376
|
-
var
|
|
21478
|
+
var import_node_path43 = require("path");
|
|
21377
21479
|
init_paths();
|
|
21378
21480
|
init_injected_mcp();
|
|
21379
21481
|
function userCursorMcpConfigPath() {
|
|
21380
|
-
return (0,
|
|
21482
|
+
return (0, import_node_path43.join)((0, import_node_os12.homedir)(), ".cursor", "mcp.json");
|
|
21381
21483
|
}
|
|
21382
21484
|
function userClaudeMcpConfigPath() {
|
|
21383
|
-
return (0,
|
|
21485
|
+
return (0, import_node_path43.join)((0, import_node_os12.homedir)(), ".claude.json");
|
|
21384
21486
|
}
|
|
21385
21487
|
function asObject(value) {
|
|
21386
21488
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
@@ -21415,7 +21517,7 @@ function writeMergedMcpServersJson(configPath, sideboard) {
|
|
|
21415
21517
|
}
|
|
21416
21518
|
}
|
|
21417
21519
|
const next = mergeSideboardIntoMcpServersJson(existing, sideboard);
|
|
21418
|
-
(0, import_node_fs46.mkdirSync)((0,
|
|
21520
|
+
(0, import_node_fs46.mkdirSync)((0, import_node_path43.dirname)(configPath), { recursive: true });
|
|
21419
21521
|
(0, import_node_fs46.writeFileSync)(configPath, `${JSON.stringify(next, null, 2)}
|
|
21420
21522
|
`);
|
|
21421
21523
|
}
|
|
@@ -23066,7 +23168,7 @@ var import_ws3 = require("ws");
|
|
|
23066
23168
|
// src/slack/relay-static.ts
|
|
23067
23169
|
var import_node_fs47 = require("fs");
|
|
23068
23170
|
var import_promises = require("fs/promises");
|
|
23069
|
-
var
|
|
23171
|
+
var import_node_path44 = __toESM(require("path"), 1);
|
|
23070
23172
|
var TYPES = {
|
|
23071
23173
|
".css": "text/css; charset=utf-8",
|
|
23072
23174
|
".html": "text/html; charset=utf-8",
|
|
@@ -23097,9 +23199,9 @@ function resolveStaticPath(root, requestUrl) {
|
|
|
23097
23199
|
return null;
|
|
23098
23200
|
}
|
|
23099
23201
|
if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
|
|
23100
|
-
const rootResolved =
|
|
23101
|
-
const candidate =
|
|
23102
|
-
if (candidate !== rootResolved && !candidate.startsWith(rootResolved +
|
|
23202
|
+
const rootResolved = import_node_path44.default.resolve(root);
|
|
23203
|
+
const candidate = import_node_path44.default.resolve(rootResolved, `.${pathname}`);
|
|
23204
|
+
if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path44.default.sep)) {
|
|
23103
23205
|
return null;
|
|
23104
23206
|
}
|
|
23105
23207
|
return candidate;
|
|
@@ -23113,7 +23215,7 @@ async function fileSize(file) {
|
|
|
23113
23215
|
}
|
|
23114
23216
|
}
|
|
23115
23217
|
function sendFile(req, res, file, size) {
|
|
23116
|
-
const ext =
|
|
23218
|
+
const ext = import_node_path44.default.extname(file).toLowerCase();
|
|
23117
23219
|
res.writeHead(200, {
|
|
23118
23220
|
"Content-Type": TYPES[ext] ?? "application/octet-stream",
|
|
23119
23221
|
"Content-Length": size,
|
|
@@ -23132,7 +23234,7 @@ async function tryServeStatic(req, res, root) {
|
|
|
23132
23234
|
if (!candidate) return false;
|
|
23133
23235
|
const direct = await fileSize(candidate);
|
|
23134
23236
|
if (direct != null) return sendFile(req, res, candidate, direct);
|
|
23135
|
-
const asIndex =
|
|
23237
|
+
const asIndex = import_node_path44.default.join(candidate, "index.html");
|
|
23136
23238
|
const indexSize = await fileSize(asIndex);
|
|
23137
23239
|
if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
|
|
23138
23240
|
return false;
|
|
@@ -23692,6 +23794,7 @@ init_outbound_watch();
|
|
|
23692
23794
|
isThinkingEffort,
|
|
23693
23795
|
isThisProcessDesktopHost,
|
|
23694
23796
|
isThreadCaffeinated,
|
|
23797
|
+
isThreadRecordFile,
|
|
23695
23798
|
isWorkspaceScratchPath,
|
|
23696
23799
|
lastRequestOccupancy,
|
|
23697
23800
|
linearAuthorizationHeader,
|