@sideboard-ai/core 0.1.115 → 0.1.117
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 +96 -60
- package/dist/agents/cursor-runner.js +10 -9
- package/dist/{agents-3X3EFCQY.js → agents-GUEKGV7V.js} +6 -6
- package/dist/{agents-AHAFC6FR.js → agents-OCGAZCKT.js} +5 -5
- package/dist/{chunk-66XTXHR3.js → chunk-4CDCTYTM.js} +61 -11
- package/dist/{chunk-XOYQ7LNQ.js → chunk-4NAW5BAQ.js} +3 -3
- package/dist/{chunk-4OJMZ6P2.js → chunk-4WV7C7WP.js} +3 -3
- package/dist/{chunk-DCNR7NAL.js → chunk-5X7GRP5W.js} +49 -24
- package/dist/{chunk-MZ6HJ7VL.js → chunk-74YJHND6.js} +48 -23
- package/dist/{chunk-ZRCX43LS.js → chunk-BKVDZV7X.js} +2 -2
- package/dist/{chunk-A4VZXJEJ.js → chunk-HPAWHIZ3.js} +4 -1
- package/dist/{chunk-SLU5JVKD.js → chunk-NZBDVBCP.js} +23 -2
- package/dist/{chunk-KYOTBZ6S.js → chunk-RG737OWT.js} +4 -1
- 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/{chunk-C6OBY6IC.js → chunk-YJ2WV5TZ.js} +54 -10
- 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 +369 -240
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +14 -10
- package/dist/mcp/run-stdio.cjs +359 -237
- package/dist/mcp/run-stdio.js +9 -9
- package/dist/{orchestrator-GKLYKLRC.js → orchestrator-4PKR6AZJ.js} +7 -7
- package/dist/{orchestrator-TXASYNHT.js → orchestrator-MKTZYWTI.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();
|
|
@@ -7766,6 +7769,9 @@ function classifyTool(name) {
|
|
|
7766
7769
|
}
|
|
7767
7770
|
return "other";
|
|
7768
7771
|
}
|
|
7772
|
+
function isShellToolName(name) {
|
|
7773
|
+
return classifyTool(name ?? "") === "shell";
|
|
7774
|
+
}
|
|
7769
7775
|
function toolActivityLine(parts) {
|
|
7770
7776
|
const tools = parts.filter((p) => {
|
|
7771
7777
|
if (p.type !== "tool" || p.parentId) return false;
|
|
@@ -8013,6 +8019,30 @@ function applyAgentEvent(parts, event) {
|
|
|
8013
8019
|
if (event.type === "tool_result") {
|
|
8014
8020
|
const existing = parts.findIndex((p) => p.type === "tool" && p.id === event.id);
|
|
8015
8021
|
const fromResult = parseDiffStat(event.content);
|
|
8022
|
+
if (event.partial) {
|
|
8023
|
+
if (existing < 0) {
|
|
8024
|
+
return [
|
|
8025
|
+
...parts,
|
|
8026
|
+
{
|
|
8027
|
+
type: "tool",
|
|
8028
|
+
id: event.id,
|
|
8029
|
+
name: "tool",
|
|
8030
|
+
description: "tool",
|
|
8031
|
+
status: event.isError ? "error" : "running",
|
|
8032
|
+
result: event.content,
|
|
8033
|
+
...event.parentId ? { parentId: event.parentId } : {}
|
|
8034
|
+
}
|
|
8035
|
+
];
|
|
8036
|
+
}
|
|
8037
|
+
return parts.map((p, i) => {
|
|
8038
|
+
if (i !== existing || p.type !== "tool") return p;
|
|
8039
|
+
if (p.status === "done" || p.status === "error") return p;
|
|
8040
|
+
return {
|
|
8041
|
+
...p,
|
|
8042
|
+
result: event.content ?? p.result
|
|
8043
|
+
};
|
|
8044
|
+
});
|
|
8045
|
+
}
|
|
8016
8046
|
if (existing < 0) {
|
|
8017
8047
|
return [
|
|
8018
8048
|
...parts,
|
|
@@ -8105,43 +8135,43 @@ function electronResourcesPath() {
|
|
|
8105
8135
|
function packagedCursorRuntimeDir() {
|
|
8106
8136
|
const resources = electronResourcesPath();
|
|
8107
8137
|
if (!resources) return null;
|
|
8108
|
-
const dir = (0,
|
|
8109
|
-
if (!(0, import_node_fs22.existsSync)((0,
|
|
8138
|
+
const dir = (0, import_node_path24.join)(resources, "cursor-runtime");
|
|
8139
|
+
if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js"))) return null;
|
|
8110
8140
|
return dir;
|
|
8111
8141
|
}
|
|
8112
8142
|
function packagedCursorRunnerPath() {
|
|
8113
8143
|
const dir = packagedCursorRuntimeDir();
|
|
8114
|
-
return dir ? (0,
|
|
8144
|
+
return dir ? (0, import_node_path24.join)(dir, "core-dist", "agents", "cursor-runner.js") : null;
|
|
8115
8145
|
}
|
|
8116
8146
|
function packagedMcpDir() {
|
|
8117
8147
|
const resources = electronResourcesPath();
|
|
8118
8148
|
if (!resources) return null;
|
|
8119
|
-
const dir = (0,
|
|
8120
|
-
if (!(0, import_node_fs22.existsSync)((0,
|
|
8149
|
+
const dir = (0, import_node_path24.join)(resources, "sideboard-mcp");
|
|
8150
|
+
if (!(0, import_node_fs22.existsSync)((0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js"))) return null;
|
|
8121
8151
|
return dir;
|
|
8122
8152
|
}
|
|
8123
8153
|
function packagedMcpStdioPath() {
|
|
8124
8154
|
const dir = packagedMcpDir();
|
|
8125
|
-
return dir ? (0,
|
|
8155
|
+
return dir ? (0, import_node_path24.join)(dir, "core-dist", "mcp", "run-stdio.js") : null;
|
|
8126
8156
|
}
|
|
8127
8157
|
function packagedBundledNodePath() {
|
|
8128
8158
|
const resources = electronResourcesPath();
|
|
8129
8159
|
if (!resources) return null;
|
|
8130
|
-
const bin = (0,
|
|
8160
|
+
const bin = (0, import_node_path24.join)(resources, "node", "bin", "node");
|
|
8131
8161
|
if (!(0, import_node_fs22.existsSync)(bin)) return null;
|
|
8132
8162
|
return bin;
|
|
8133
8163
|
}
|
|
8134
8164
|
function packagedCursorRipgrepCandidate(platformPkg, binName) {
|
|
8135
8165
|
const dir = packagedCursorRuntimeDir();
|
|
8136
8166
|
if (!dir) return null;
|
|
8137
|
-
return (0,
|
|
8167
|
+
return (0, import_node_path24.join)(dir, "node_modules", platformPkg, "bin", binName);
|
|
8138
8168
|
}
|
|
8139
|
-
var import_node_fs22,
|
|
8169
|
+
var import_node_fs22, import_node_path24;
|
|
8140
8170
|
var init_packaged_runtime = __esm({
|
|
8141
8171
|
"src/agents/packaged-runtime.ts"() {
|
|
8142
8172
|
"use strict";
|
|
8143
8173
|
import_node_fs22 = require("fs");
|
|
8144
|
-
|
|
8174
|
+
import_node_path24 = require("path");
|
|
8145
8175
|
}
|
|
8146
8176
|
});
|
|
8147
8177
|
|
|
@@ -8224,28 +8254,28 @@ function versionDirNodeBins(root, toBin) {
|
|
|
8224
8254
|
}
|
|
8225
8255
|
function defaultNodeBinCandidates(home = (0, import_node_os7.homedir)()) {
|
|
8226
8256
|
const kegs = ["/opt/homebrew", "/usr/local"].flatMap(
|
|
8227
|
-
(prefix) => PREFERRED_LTS_MAJORS.map((major) => (0,
|
|
8257
|
+
(prefix) => PREFERRED_LTS_MAJORS.map((major) => (0, import_node_path25.join)(prefix, "opt", `node@${major}`, "bin", "node"))
|
|
8228
8258
|
);
|
|
8229
8259
|
return [
|
|
8230
8260
|
...kegs,
|
|
8231
8261
|
"/opt/homebrew/bin/node",
|
|
8232
8262
|
"/usr/local/bin/node",
|
|
8233
|
-
(0,
|
|
8234
|
-
(0,
|
|
8235
|
-
(0,
|
|
8236
|
-
(0,
|
|
8237
|
-
(0,
|
|
8263
|
+
(0, import_node_path25.join)(home, ".local/share/fnm/aliases/default/bin/node"),
|
|
8264
|
+
(0, import_node_path25.join)(home, ".nvm/current/bin/node"),
|
|
8265
|
+
(0, import_node_path25.join)(home, ".volta/bin/node"),
|
|
8266
|
+
(0, import_node_path25.join)(home, ".asdf/shims/node"),
|
|
8267
|
+
(0, import_node_path25.join)(home, ".local/share/mise/shims/node"),
|
|
8238
8268
|
...versionDirNodeBins(
|
|
8239
|
-
(0,
|
|
8240
|
-
(name) => (0,
|
|
8269
|
+
(0, import_node_path25.join)(home, ".nvm", "versions", "node"),
|
|
8270
|
+
(name) => (0, import_node_path25.join)(home, ".nvm", "versions", "node", name, "bin", "node")
|
|
8241
8271
|
),
|
|
8242
8272
|
...versionDirNodeBins(
|
|
8243
|
-
(0,
|
|
8244
|
-
(name) => (0,
|
|
8273
|
+
(0, import_node_path25.join)(home, ".local/share/fnm", "node-versions"),
|
|
8274
|
+
(name) => (0, import_node_path25.join)(home, ".local/share/fnm", "node-versions", name, "installation", "bin", "node")
|
|
8245
8275
|
),
|
|
8246
8276
|
...versionDirNodeBins(
|
|
8247
|
-
(0,
|
|
8248
|
-
(name) => (0,
|
|
8277
|
+
(0, import_node_path25.join)(home, ".volta", "tools", "image", "node"),
|
|
8278
|
+
(name) => (0, import_node_path25.join)(home, ".volta", "tools", "image", "node", name, "bin", "node")
|
|
8249
8279
|
)
|
|
8250
8280
|
];
|
|
8251
8281
|
}
|
|
@@ -8337,13 +8367,13 @@ async function resolveNodeLaunch(scriptPath) {
|
|
|
8337
8367
|
env: { ELECTRON_RUN_AS_NODE: "1" }
|
|
8338
8368
|
};
|
|
8339
8369
|
}
|
|
8340
|
-
var import_node_fs23, import_node_os7,
|
|
8370
|
+
var import_node_fs23, import_node_os7, import_node_path25, AGENT_RUNNER_MAX_OLD_SPACE_MB, MAX_OLD_SPACE_FLAG, PREFERRED_LTS_MAJORS;
|
|
8341
8371
|
var init_node_launch = __esm({
|
|
8342
8372
|
"src/agents/node-launch.ts"() {
|
|
8343
8373
|
"use strict";
|
|
8344
8374
|
import_node_fs23 = require("fs");
|
|
8345
8375
|
import_node_os7 = require("os");
|
|
8346
|
-
|
|
8376
|
+
import_node_path25 = require("path");
|
|
8347
8377
|
init_nested_electron_env();
|
|
8348
8378
|
init_run();
|
|
8349
8379
|
init_packaged_runtime();
|
|
@@ -8436,13 +8466,13 @@ function corePackageDir() {
|
|
|
8436
8466
|
try {
|
|
8437
8467
|
const url = import_meta.url;
|
|
8438
8468
|
if (typeof url === "string" && url.length > 0) {
|
|
8439
|
-
return (0,
|
|
8469
|
+
return (0, import_node_path26.dirname)((0, import_node_url.fileURLToPath)(url));
|
|
8440
8470
|
}
|
|
8441
8471
|
} catch {
|
|
8442
8472
|
}
|
|
8443
8473
|
try {
|
|
8444
|
-
const req = (0, import_node_module.createRequire)((0,
|
|
8445
|
-
return (0,
|
|
8474
|
+
const req = (0, import_node_module.createRequire)((0, import_node_path26.join)(process.cwd(), "package.json"));
|
|
8475
|
+
return (0, import_node_path26.dirname)(req.resolve("@sideboard-ai/core"));
|
|
8446
8476
|
} catch {
|
|
8447
8477
|
return process.cwd();
|
|
8448
8478
|
}
|
|
@@ -8455,18 +8485,18 @@ function findSideboardMcpJsEntry() {
|
|
|
8455
8485
|
let dir = corePackageDir();
|
|
8456
8486
|
for (let i = 0; i < 10; i++) {
|
|
8457
8487
|
const candidates = [
|
|
8458
|
-
(0,
|
|
8459
|
-
(0,
|
|
8460
|
-
(0,
|
|
8461
|
-
(0,
|
|
8462
|
-
(0,
|
|
8463
|
-
(0,
|
|
8464
|
-
(0,
|
|
8488
|
+
(0, import_node_path26.join)(dir, "mcp/run-stdio.js"),
|
|
8489
|
+
(0, import_node_path26.join)(dir, "mcp/run-stdio.cjs"),
|
|
8490
|
+
(0, import_node_path26.join)(dir, "dist/mcp/run-stdio.js"),
|
|
8491
|
+
(0, import_node_path26.join)(dir, "dist/mcp/run-stdio.cjs"),
|
|
8492
|
+
(0, import_node_path26.join)(dir, "packages/core/dist/mcp/run-stdio.js"),
|
|
8493
|
+
(0, import_node_path26.join)(dir, "packages/cli/dist/index.js"),
|
|
8494
|
+
(0, import_node_path26.join)(dir, "cli/dist/index.js")
|
|
8465
8495
|
];
|
|
8466
8496
|
for (const p of candidates) {
|
|
8467
8497
|
if ((0, import_node_fs24.existsSync)(p) && !isAsarPath(p)) return p;
|
|
8468
8498
|
}
|
|
8469
|
-
const parent = (0,
|
|
8499
|
+
const parent = (0, import_node_path26.dirname)(dir);
|
|
8470
8500
|
if (parent === dir) break;
|
|
8471
8501
|
dir = parent;
|
|
8472
8502
|
}
|
|
@@ -8608,22 +8638,22 @@ function writeMcpServersConfig(servers) {
|
|
|
8608
8638
|
...env ? { env } : {}
|
|
8609
8639
|
};
|
|
8610
8640
|
}
|
|
8611
|
-
const dir = (0, import_node_fs24.mkdtempSync)((0,
|
|
8612
|
-
const cfgPath = (0,
|
|
8641
|
+
const dir = (0, import_node_fs24.mkdtempSync)((0, import_node_path26.join)((0, import_node_os8.tmpdir)(), "sideboard-mcp-"));
|
|
8642
|
+
const cfgPath = (0, import_node_path26.join)(dir, "mcp.json");
|
|
8613
8643
|
(0, import_node_fs24.writeFileSync)(cfgPath, JSON.stringify({ mcpServers }, null, 2));
|
|
8614
8644
|
return cfgPath;
|
|
8615
8645
|
}
|
|
8616
8646
|
async function writeInjectedMcpConfig(opts) {
|
|
8617
8647
|
return writeMcpServersConfig(await buildInjectedMcpServers(opts));
|
|
8618
8648
|
}
|
|
8619
|
-
var import_node_fs24, import_node_module, import_node_os8,
|
|
8649
|
+
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;
|
|
8620
8650
|
var init_injected_mcp = __esm({
|
|
8621
8651
|
"src/agents/injected-mcp.ts"() {
|
|
8622
8652
|
"use strict";
|
|
8623
8653
|
import_node_fs24 = require("fs");
|
|
8624
8654
|
import_node_module = require("module");
|
|
8625
8655
|
import_node_os8 = require("os");
|
|
8626
|
-
|
|
8656
|
+
import_node_path26 = require("path");
|
|
8627
8657
|
import_node_url = require("url");
|
|
8628
8658
|
init_run();
|
|
8629
8659
|
init_config();
|
|
@@ -9229,8 +9259,8 @@ function usageFromCodex(usage) {
|
|
|
9229
9259
|
}
|
|
9230
9260
|
function codexConfigHasNetworkAccess() {
|
|
9231
9261
|
const candidates = [
|
|
9232
|
-
(0,
|
|
9233
|
-
(0,
|
|
9262
|
+
(0, import_node_path27.join)((0, import_node_os9.homedir)(), ".codex", "config.toml"),
|
|
9263
|
+
(0, import_node_path27.join)((0, import_node_os9.homedir)(), ".config", "codex", "config.toml")
|
|
9234
9264
|
];
|
|
9235
9265
|
for (const path2 of candidates) {
|
|
9236
9266
|
if (!(0, import_node_fs26.existsSync)(path2)) continue;
|
|
@@ -9266,7 +9296,7 @@ function asRecord2(value) {
|
|
|
9266
9296
|
return void 0;
|
|
9267
9297
|
}
|
|
9268
9298
|
function codexLooksAuthenticated() {
|
|
9269
|
-
const authPath = (0,
|
|
9299
|
+
const authPath = (0, import_node_path27.join)((0, import_node_os9.homedir)(), ".codex", "auth.json");
|
|
9270
9300
|
if (!(0, import_node_fs26.existsSync)(authPath)) return false;
|
|
9271
9301
|
try {
|
|
9272
9302
|
return (0, import_node_fs26.statSync)(authPath).size > 2;
|
|
@@ -9274,13 +9304,13 @@ function codexLooksAuthenticated() {
|
|
|
9274
9304
|
return false;
|
|
9275
9305
|
}
|
|
9276
9306
|
}
|
|
9277
|
-
var import_node_fs26, import_node_os9,
|
|
9307
|
+
var import_node_fs26, import_node_os9, import_node_path27, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
|
|
9278
9308
|
var init_codex = __esm({
|
|
9279
9309
|
"src/agents/codex.ts"() {
|
|
9280
9310
|
"use strict";
|
|
9281
9311
|
import_node_fs26 = require("fs");
|
|
9282
9312
|
import_node_os9 = require("os");
|
|
9283
|
-
|
|
9313
|
+
import_node_path27 = require("path");
|
|
9284
9314
|
init_run();
|
|
9285
9315
|
init_app_settings();
|
|
9286
9316
|
init_global_workspace();
|
|
@@ -9445,13 +9475,22 @@ var init_codex = __esm({
|
|
|
9445
9475
|
const events = [
|
|
9446
9476
|
{ type: "tool_use", id: item.id, name: "Bash", input }
|
|
9447
9477
|
];
|
|
9448
|
-
|
|
9478
|
+
const finished = type === "item.completed" || item.status === "completed" || item.status === "failed";
|
|
9479
|
+
const output = typeof item.aggregated_output === "string" && item.aggregated_output ? item.aggregated_output : void 0;
|
|
9480
|
+
if (finished) {
|
|
9449
9481
|
events.push({
|
|
9450
9482
|
type: "tool_result",
|
|
9451
9483
|
id: item.id,
|
|
9452
|
-
content:
|
|
9484
|
+
content: output,
|
|
9453
9485
|
isError: item.status === "failed"
|
|
9454
9486
|
});
|
|
9487
|
+
} else if (output) {
|
|
9488
|
+
events.push({
|
|
9489
|
+
type: "tool_result",
|
|
9490
|
+
id: item.id,
|
|
9491
|
+
content: output,
|
|
9492
|
+
partial: true
|
|
9493
|
+
});
|
|
9455
9494
|
}
|
|
9456
9495
|
return events.length === 1 ? events[0] : events;
|
|
9457
9496
|
}
|
|
@@ -9667,7 +9706,7 @@ function cursorSdkMessageToEvents(msg) {
|
|
|
9667
9706
|
if (msg.type === "tool_call" && msg.call_id && msg.name) {
|
|
9668
9707
|
const normalized = normalizeCursorToolCall(msg.name, msg.args);
|
|
9669
9708
|
if (msg.status === "running") {
|
|
9670
|
-
|
|
9709
|
+
const events = [
|
|
9671
9710
|
{
|
|
9672
9711
|
type: "tool_use",
|
|
9673
9712
|
id: msg.call_id,
|
|
@@ -9675,6 +9714,16 @@ function cursorSdkMessageToEvents(msg) {
|
|
|
9675
9714
|
input: normalized.input
|
|
9676
9715
|
}
|
|
9677
9716
|
];
|
|
9717
|
+
const live = unwrapCursorToolResult(msg.result);
|
|
9718
|
+
if (live) {
|
|
9719
|
+
events.push({
|
|
9720
|
+
type: "tool_result",
|
|
9721
|
+
id: msg.call_id,
|
|
9722
|
+
content: live,
|
|
9723
|
+
partial: true
|
|
9724
|
+
});
|
|
9725
|
+
}
|
|
9726
|
+
return events;
|
|
9678
9727
|
}
|
|
9679
9728
|
if (msg.status === "completed" || msg.status === "error") {
|
|
9680
9729
|
return [
|
|
@@ -9741,7 +9790,7 @@ function platformRipgrepPackage() {
|
|
|
9741
9790
|
}
|
|
9742
9791
|
function usableRipgrepPath(candidate) {
|
|
9743
9792
|
const raw = candidate?.trim();
|
|
9744
|
-
if (!raw || !(0,
|
|
9793
|
+
if (!raw || !(0, import_node_path28.isAbsolute)(raw)) return null;
|
|
9745
9794
|
const readable = nodeReadableScriptPath(raw);
|
|
9746
9795
|
if (!(0, import_node_fs27.existsSync)(readable) || isAsarPath(readable)) return null;
|
|
9747
9796
|
return readable;
|
|
@@ -9750,12 +9799,12 @@ function walkForBundledRipgrep(startFile) {
|
|
|
9750
9799
|
if (!startFile) return null;
|
|
9751
9800
|
const pkg = platformRipgrepPackage();
|
|
9752
9801
|
const name = rgBinaryName();
|
|
9753
|
-
let dir = (0,
|
|
9754
|
-
const root = (0,
|
|
9802
|
+
let dir = (0, import_node_path28.dirname)((0, import_node_path28.resolve)(startFile));
|
|
9803
|
+
const root = (0, import_node_path28.parse)(dir).root;
|
|
9755
9804
|
while (dir !== root) {
|
|
9756
|
-
const hit = usableRipgrepPath((0,
|
|
9805
|
+
const hit = usableRipgrepPath((0, import_node_path28.join)(dir, "node_modules", pkg, "bin", name));
|
|
9757
9806
|
if (hit) return hit;
|
|
9758
|
-
const next = (0,
|
|
9807
|
+
const next = (0, import_node_path28.dirname)(dir);
|
|
9759
9808
|
if (next === dir) break;
|
|
9760
9809
|
dir = next;
|
|
9761
9810
|
}
|
|
@@ -9765,7 +9814,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
9765
9814
|
try {
|
|
9766
9815
|
const req = (0, import_node_module2.createRequire)(fromFile);
|
|
9767
9816
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
9768
|
-
return usableRipgrepPath((0,
|
|
9817
|
+
return usableRipgrepPath((0, import_node_path28.join)((0, import_node_path28.dirname)(pkgJson), "bin", rgBinaryName()));
|
|
9769
9818
|
} catch {
|
|
9770
9819
|
return null;
|
|
9771
9820
|
}
|
|
@@ -9787,13 +9836,13 @@ function cursorRipgrepEnv(opts) {
|
|
|
9787
9836
|
const path2 = resolveCursorRipgrepPath(opts);
|
|
9788
9837
|
return path2 ? { [RIPGREP_ENV]: path2 } : {};
|
|
9789
9838
|
}
|
|
9790
|
-
var import_node_fs27, import_node_module2,
|
|
9839
|
+
var import_node_fs27, import_node_module2, import_node_path28, RIPGREP_ENV;
|
|
9791
9840
|
var init_cursor_ripgrep = __esm({
|
|
9792
9841
|
"src/agents/cursor-ripgrep.ts"() {
|
|
9793
9842
|
"use strict";
|
|
9794
9843
|
import_node_fs27 = require("fs");
|
|
9795
9844
|
import_node_module2 = require("module");
|
|
9796
|
-
|
|
9845
|
+
import_node_path28 = require("path");
|
|
9797
9846
|
init_node_launch();
|
|
9798
9847
|
init_packaged_runtime();
|
|
9799
9848
|
RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
|
|
@@ -9839,11 +9888,11 @@ function entryDir() {
|
|
|
9839
9888
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
9840
9889
|
if (cjsDir) return cjsDir;
|
|
9841
9890
|
try {
|
|
9842
|
-
return (0,
|
|
9891
|
+
return (0, import_node_path29.dirname)((0, import_node_url2.fileURLToPath)(import_meta2.url));
|
|
9843
9892
|
} catch {
|
|
9844
9893
|
try {
|
|
9845
9894
|
const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
|
|
9846
|
-
return (0,
|
|
9895
|
+
return (0, import_node_path29.dirname)(req.resolve("@sideboard-ai/core"));
|
|
9847
9896
|
} catch {
|
|
9848
9897
|
return process.cwd();
|
|
9849
9898
|
}
|
|
@@ -9854,27 +9903,27 @@ function cursorRunnerPath() {
|
|
|
9854
9903
|
if (packaged) return packaged;
|
|
9855
9904
|
const root = entryDir();
|
|
9856
9905
|
const candidates = [
|
|
9857
|
-
(0,
|
|
9858
|
-
(0,
|
|
9906
|
+
(0, import_node_path29.join)(root, "agents", "cursor-runner.js"),
|
|
9907
|
+
(0, import_node_path29.join)(root, "agents", "cursor-runner.cjs"),
|
|
9859
9908
|
// If somehow resolved from package root instead of dist/
|
|
9860
|
-
(0,
|
|
9861
|
-
(0,
|
|
9909
|
+
(0, import_node_path29.join)(root, "dist", "agents", "cursor-runner.js"),
|
|
9910
|
+
(0, import_node_path29.join)(root, "dist", "agents", "cursor-runner.cjs"),
|
|
9862
9911
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
9863
|
-
(0,
|
|
9864
|
-
(0,
|
|
9912
|
+
(0, import_node_path29.join)(root, "cursor-runner.ts"),
|
|
9913
|
+
(0, import_node_path29.join)(root, "src", "agents", "cursor-runner.ts")
|
|
9865
9914
|
];
|
|
9866
9915
|
for (const candidate of candidates) {
|
|
9867
9916
|
if ((0, import_node_fs28.existsSync)(candidate)) return candidate;
|
|
9868
9917
|
}
|
|
9869
9918
|
return candidates[0];
|
|
9870
9919
|
}
|
|
9871
|
-
var import_node_fs28, import_node_module3,
|
|
9920
|
+
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;
|
|
9872
9921
|
var init_cursor = __esm({
|
|
9873
9922
|
"src/agents/cursor.ts"() {
|
|
9874
9923
|
"use strict";
|
|
9875
9924
|
import_node_fs28 = require("fs");
|
|
9876
9925
|
import_node_module3 = require("module");
|
|
9877
|
-
|
|
9926
|
+
import_node_path29 = require("path");
|
|
9878
9927
|
import_node_url2 = require("url");
|
|
9879
9928
|
import_sdk = require("@cursor/sdk");
|
|
9880
9929
|
init_run();
|
|
@@ -9933,6 +9982,7 @@ var init_cursor = __esm({
|
|
|
9933
9982
|
const req = {
|
|
9934
9983
|
prompt,
|
|
9935
9984
|
cwd: thread.worktreePath,
|
|
9985
|
+
threadId: thread.id,
|
|
9936
9986
|
agentId,
|
|
9937
9987
|
model: thread.model,
|
|
9938
9988
|
effort: thread.effort,
|
|
@@ -10192,13 +10242,16 @@ var init_opencode = __esm({
|
|
|
10192
10242
|
);
|
|
10193
10243
|
const events = [{ type: "tool_use", id, name, input }];
|
|
10194
10244
|
const output = state?.output;
|
|
10195
|
-
|
|
10245
|
+
const finished = state?.status === "completed" || state?.status === "error" || state?.status === "failed";
|
|
10246
|
+
const running = state?.status === "running" || state?.status === "in_progress" || state?.status === "pending";
|
|
10247
|
+
if (output != null || finished) {
|
|
10196
10248
|
const content = typeof output === "string" ? output : output != null ? JSON.stringify(output) : formatUnknownDetail(state?.error) || void 0;
|
|
10197
10249
|
events.push({
|
|
10198
10250
|
type: "tool_result",
|
|
10199
10251
|
id,
|
|
10200
10252
|
content,
|
|
10201
|
-
isError: state?.status === "error" || state?.status === "failed"
|
|
10253
|
+
isError: state?.status === "error" || state?.status === "failed",
|
|
10254
|
+
...running && !finished ? { partial: true } : {}
|
|
10202
10255
|
});
|
|
10203
10256
|
}
|
|
10204
10257
|
return events.length === 1 ? events[0] : events;
|
|
@@ -10233,14 +10286,17 @@ var init_opencode = __esm({
|
|
|
10233
10286
|
withEventParentId({ type: "tool_use", id, name, input }, parentId)
|
|
10234
10287
|
];
|
|
10235
10288
|
const output = state?.output ?? part.output;
|
|
10236
|
-
|
|
10289
|
+
const finished = state?.status === "completed" || state?.status === "error" || state?.status === "failed";
|
|
10290
|
+
const running = state?.status === "running" || state?.status === "in_progress" || state?.status === "pending";
|
|
10291
|
+
if (output != null || finished) {
|
|
10237
10292
|
nested.push(
|
|
10238
10293
|
withEventParentId(
|
|
10239
10294
|
{
|
|
10240
10295
|
type: "tool_result",
|
|
10241
10296
|
id,
|
|
10242
10297
|
content: typeof output === "string" ? output : output != null ? JSON.stringify(output) : void 0,
|
|
10243
|
-
isError: state?.status === "error" || state?.status === "failed"
|
|
10298
|
+
isError: state?.status === "error" || state?.status === "failed",
|
|
10299
|
+
...running && !finished ? { partial: true } : {}
|
|
10244
10300
|
},
|
|
10245
10301
|
parentId
|
|
10246
10302
|
)
|
|
@@ -11811,12 +11867,12 @@ function readTextIfPresent(abs) {
|
|
|
11811
11867
|
}
|
|
11812
11868
|
}
|
|
11813
11869
|
function readLocalGuidelines(worktreePath) {
|
|
11814
|
-
const localAbs = (0,
|
|
11870
|
+
const localAbs = (0, import_node_path30.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
11815
11871
|
const localContent = readTextIfPresent(localAbs);
|
|
11816
11872
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
11817
11873
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
11818
11874
|
}
|
|
11819
|
-
const legacyAbs = (0,
|
|
11875
|
+
const legacyAbs = (0, import_node_path30.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
11820
11876
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
11821
11877
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
11822
11878
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -11832,20 +11888,20 @@ function skillGuidelines(content, source) {
|
|
|
11832
11888
|
};
|
|
11833
11889
|
}
|
|
11834
11890
|
function ensureReviewSkillFile(worktreePath) {
|
|
11835
|
-
const abs = (0,
|
|
11891
|
+
const abs = (0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH);
|
|
11836
11892
|
const existing = readTextIfPresent(abs);
|
|
11837
11893
|
if (existing) {
|
|
11838
11894
|
return { path: REVIEW_SKILL_PATH, content: existing, wrote: false };
|
|
11839
11895
|
}
|
|
11840
|
-
const fromRepo = readTextIfPresent((0,
|
|
11896
|
+
const fromRepo = readTextIfPresent((0, import_node_path30.join)(worktreePath, REPO_REVIEW_PATH));
|
|
11841
11897
|
const fromLocal = readLocalGuidelines(worktreePath)?.content ?? null;
|
|
11842
11898
|
const content = wrapReviewSkillMarkdown(fromRepo ?? fromLocal ?? REVIEW_REQUEST_TEMPLATE);
|
|
11843
|
-
(0, import_node_fs30.mkdirSync)((0,
|
|
11899
|
+
(0, import_node_fs30.mkdirSync)((0, import_node_path30.dirname)(abs), { recursive: true });
|
|
11844
11900
|
(0, import_node_fs30.writeFileSync)(abs, content, "utf8");
|
|
11845
11901
|
return { path: REVIEW_SKILL_PATH, content, wrote: true };
|
|
11846
11902
|
}
|
|
11847
11903
|
function resolveReviewGuidelines(worktreePath) {
|
|
11848
|
-
const skillContent = readTextIfPresent((0,
|
|
11904
|
+
const skillContent = readTextIfPresent((0, import_node_path30.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
11849
11905
|
if (skillContent) return skillGuidelines(skillContent, "skill");
|
|
11850
11906
|
const local = readLocalGuidelines(worktreePath);
|
|
11851
11907
|
if (local) {
|
|
@@ -11875,7 +11931,7 @@ function buildReviewRequestAttachment(content, opts) {
|
|
|
11875
11931
|
};
|
|
11876
11932
|
}
|
|
11877
11933
|
function readExistingReviewRequestFile(worktreePath) {
|
|
11878
|
-
return readTextIfPresent((0,
|
|
11934
|
+
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));
|
|
11879
11935
|
}
|
|
11880
11936
|
async function requestReview(threadRef, send2) {
|
|
11881
11937
|
const from = findThreadByRef(threadRef);
|
|
@@ -11902,13 +11958,13 @@ async function requestReview(threadRef, send2) {
|
|
|
11902
11958
|
const started = await send2(tab.id, REVIEW_REQUEST_PREFILL);
|
|
11903
11959
|
return { tab: started, from };
|
|
11904
11960
|
}
|
|
11905
|
-
var import_node_crypto6, import_node_fs30,
|
|
11961
|
+
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;
|
|
11906
11962
|
var init_request_review = __esm({
|
|
11907
11963
|
"src/review/request-review.ts"() {
|
|
11908
11964
|
"use strict";
|
|
11909
11965
|
import_node_crypto6 = require("crypto");
|
|
11910
11966
|
import_node_fs30 = require("fs");
|
|
11911
|
-
|
|
11967
|
+
import_node_path30 = require("path");
|
|
11912
11968
|
init_global_workspace();
|
|
11913
11969
|
init_chat_tabs();
|
|
11914
11970
|
init_thread_store();
|
|
@@ -11933,7 +11989,7 @@ function matchSimpleGlob(pattern, name) {
|
|
|
11933
11989
|
return new RegExp(`^${escaped}$`).test(name);
|
|
11934
11990
|
}
|
|
11935
11991
|
function readWorktreeInclude(repoPath) {
|
|
11936
|
-
const path2 = (0,
|
|
11992
|
+
const path2 = (0, import_node_path31.join)(repoPath, ".worktreeinclude");
|
|
11937
11993
|
if (!(0, import_node_fs31.existsSync)(path2)) return [];
|
|
11938
11994
|
return (0, import_node_fs31.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
11939
11995
|
}
|
|
@@ -11948,7 +12004,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
11948
12004
|
for (const entry of (0, import_node_fs31.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
11949
12005
|
if (!entry.isFile()) continue;
|
|
11950
12006
|
for (const glob of settings.fileIncludeGlobs) {
|
|
11951
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
12007
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path31.basename)(glob), entry.name)) {
|
|
11952
12008
|
matched.push(entry.name);
|
|
11953
12009
|
break;
|
|
11954
12010
|
}
|
|
@@ -11974,10 +12030,10 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
11974
12030
|
const patterns = resolveFilesToCopy(repoPath);
|
|
11975
12031
|
const copied = [];
|
|
11976
12032
|
for (const rel of patterns) {
|
|
11977
|
-
const src = (0,
|
|
12033
|
+
const src = (0, import_node_path31.join)(repoPath, rel);
|
|
11978
12034
|
if (!(0, import_node_fs31.existsSync)(src)) continue;
|
|
11979
|
-
const dest = (0,
|
|
11980
|
-
(0, import_node_fs31.mkdirSync)((0,
|
|
12035
|
+
const dest = (0, import_node_path31.join)(worktreePath, rel);
|
|
12036
|
+
(0, import_node_fs31.mkdirSync)((0, import_node_path31.dirname)(dest), { recursive: true });
|
|
11981
12037
|
(0, import_node_fs31.copyFileSync)(src, dest);
|
|
11982
12038
|
copied.push(rel);
|
|
11983
12039
|
}
|
|
@@ -12013,7 +12069,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
12013
12069
|
const env = stripNestedElectronEnv({
|
|
12014
12070
|
...baseEnv ?? process.env
|
|
12015
12071
|
});
|
|
12016
|
-
const name = opts.workspaceName ?? (0,
|
|
12072
|
+
const name = opts.workspaceName ?? (0, import_node_path31.basename)(opts.worktreePath);
|
|
12017
12073
|
const ports = opts.ports ?? [];
|
|
12018
12074
|
const primary = ports[0];
|
|
12019
12075
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -12274,13 +12330,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
12274
12330
|
done: handle.done
|
|
12275
12331
|
};
|
|
12276
12332
|
}
|
|
12277
|
-
var import_node_fs31, import_node_net,
|
|
12333
|
+
var import_node_fs31, import_node_net, import_node_path31, import_execa4, import_node_readline3, PORT_RANGE_SIZE, cachedLoginEnv;
|
|
12278
12334
|
var init_conductor = __esm({
|
|
12279
12335
|
"src/hook/conductor.ts"() {
|
|
12280
12336
|
"use strict";
|
|
12281
12337
|
import_node_fs31 = require("fs");
|
|
12282
12338
|
import_node_net = require("net");
|
|
12283
|
-
|
|
12339
|
+
import_node_path31 = require("path");
|
|
12284
12340
|
import_execa4 = require("execa");
|
|
12285
12341
|
import_node_readline3 = require("readline");
|
|
12286
12342
|
init_settings();
|
|
@@ -12342,9 +12398,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
12342
12398
|
if ((0, import_node_fs32.existsSync)(root)) {
|
|
12343
12399
|
for (const entry of (0, import_node_fs32.readdirSync)(root, { withFileTypes: true })) {
|
|
12344
12400
|
if (!entry.isDirectory()) continue;
|
|
12345
|
-
const path2 = (0,
|
|
12401
|
+
const path2 = (0, import_node_path32.join)(root, entry.name).replace(/\/$/, "");
|
|
12346
12402
|
if (known.has(path2) || seen.has(path2)) continue;
|
|
12347
|
-
if (!(0, import_node_fs32.existsSync)((0,
|
|
12403
|
+
if (!(0, import_node_fs32.existsSync)((0, import_node_path32.join)(path2, ".git"))) continue;
|
|
12348
12404
|
seen.add(path2);
|
|
12349
12405
|
let mtimeMs = 0;
|
|
12350
12406
|
try {
|
|
@@ -12409,12 +12465,12 @@ function worktreeCleanupSettings() {
|
|
|
12409
12465
|
autoCleanupOrphans: a.autoCleanupOrphans
|
|
12410
12466
|
};
|
|
12411
12467
|
}
|
|
12412
|
-
var import_node_fs32,
|
|
12468
|
+
var import_node_fs32, import_node_path32;
|
|
12413
12469
|
var init_orphan_cleanup = __esm({
|
|
12414
12470
|
"src/git/orphan-cleanup.ts"() {
|
|
12415
12471
|
"use strict";
|
|
12416
12472
|
import_node_fs32 = require("fs");
|
|
12417
|
-
|
|
12473
|
+
import_node_path32 = require("path");
|
|
12418
12474
|
init_worktree();
|
|
12419
12475
|
init_thread_store();
|
|
12420
12476
|
init_paths();
|
|
@@ -12521,10 +12577,10 @@ __export(workspaces_exports, {
|
|
|
12521
12577
|
syncWorkspacesFromThreads: () => syncWorkspacesFromThreads
|
|
12522
12578
|
});
|
|
12523
12579
|
function workspacesFile() {
|
|
12524
|
-
return (0,
|
|
12580
|
+
return (0, import_node_path33.join)(appDataDir(), "workspaces.json");
|
|
12525
12581
|
}
|
|
12526
12582
|
function removedWorkspacesFile() {
|
|
12527
|
-
return (0,
|
|
12583
|
+
return (0, import_node_path33.join)(appDataDir(), "removed-workspaces.json");
|
|
12528
12584
|
}
|
|
12529
12585
|
function readAll2() {
|
|
12530
12586
|
const path2 = workspacesFile();
|
|
@@ -12583,7 +12639,7 @@ async function addWorkspace(repoPath) {
|
|
|
12583
12639
|
if (existing) return existing;
|
|
12584
12640
|
const next = {
|
|
12585
12641
|
path: root,
|
|
12586
|
-
name: (0,
|
|
12642
|
+
name: (0, import_node_path33.basename)(root),
|
|
12587
12643
|
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12588
12644
|
};
|
|
12589
12645
|
writeAll2([...current, next]);
|
|
@@ -12608,7 +12664,7 @@ function syncWorkspacesFromThreads(repoPaths) {
|
|
|
12608
12664
|
if (!(0, import_node_fs33.existsSync)(path2)) continue;
|
|
12609
12665
|
const ws = {
|
|
12610
12666
|
path: path2,
|
|
12611
|
-
name: (0,
|
|
12667
|
+
name: (0, import_node_path33.basename)(path2),
|
|
12612
12668
|
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12613
12669
|
};
|
|
12614
12670
|
byPath.set(path2, ws);
|
|
@@ -12618,12 +12674,12 @@ function syncWorkspacesFromThreads(repoPaths) {
|
|
|
12618
12674
|
if (dirty) writeAll2(next);
|
|
12619
12675
|
return next.sort((a, b) => a.name.localeCompare(b.name));
|
|
12620
12676
|
}
|
|
12621
|
-
var import_node_fs33,
|
|
12677
|
+
var import_node_fs33, import_node_path33;
|
|
12622
12678
|
var init_workspaces2 = __esm({
|
|
12623
12679
|
"src/store/workspaces.ts"() {
|
|
12624
12680
|
"use strict";
|
|
12625
12681
|
import_node_fs33 = require("fs");
|
|
12626
|
-
|
|
12682
|
+
import_node_path33 = require("path");
|
|
12627
12683
|
init_paths();
|
|
12628
12684
|
init_global_workspace();
|
|
12629
12685
|
init_worktree();
|
|
@@ -12636,11 +12692,11 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
12636
12692
|
if (!url) throw new Error("Clone URL is required");
|
|
12637
12693
|
let name = opts.name?.trim();
|
|
12638
12694
|
if (!name) {
|
|
12639
|
-
const leaf = (0,
|
|
12695
|
+
const leaf = (0, import_node_path34.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
12640
12696
|
name = leaf || "repo";
|
|
12641
12697
|
}
|
|
12642
12698
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
12643
|
-
const dest = (0,
|
|
12699
|
+
const dest = (0, import_node_path34.join)(sideboardReposDir(), name);
|
|
12644
12700
|
if ((0, import_node_fs34.existsSync)(dest)) {
|
|
12645
12701
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
12646
12702
|
const workspace2 = await ensureWorkspace(repoPath2);
|
|
@@ -12656,12 +12712,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
12656
12712
|
const workspace = await ensureWorkspace(repoPath);
|
|
12657
12713
|
return { repoPath, workspace };
|
|
12658
12714
|
}
|
|
12659
|
-
var import_node_fs34,
|
|
12715
|
+
var import_node_fs34, import_node_path34, import_execa6;
|
|
12660
12716
|
var init_clone_repo = __esm({
|
|
12661
12717
|
"src/git/clone-repo.ts"() {
|
|
12662
12718
|
"use strict";
|
|
12663
12719
|
import_node_fs34 = require("fs");
|
|
12664
|
-
|
|
12720
|
+
import_node_path34 = require("path");
|
|
12665
12721
|
import_execa6 = require("execa");
|
|
12666
12722
|
init_paths();
|
|
12667
12723
|
init_workspaces2();
|
|
@@ -12939,7 +12995,7 @@ function noteTurnLiveEvent(threadId, event) {
|
|
|
12939
12995
|
buffers.delete(threadId);
|
|
12940
12996
|
return;
|
|
12941
12997
|
}
|
|
12942
|
-
const immediate = event.type === "tool_use" || event.type === "tool_result";
|
|
12998
|
+
const immediate = event.type === "tool_use" || event.type === "tool_result" && !event.partial;
|
|
12943
12999
|
if (immediate) flush(threadId);
|
|
12944
13000
|
else scheduleFlush(threadId);
|
|
12945
13001
|
}
|
|
@@ -12991,6 +13047,27 @@ var init_turn_live = __esm({
|
|
|
12991
13047
|
}
|
|
12992
13048
|
});
|
|
12993
13049
|
|
|
13050
|
+
// src/orchestrator/reconcile-heal.ts
|
|
13051
|
+
function shouldReadThreadToHealReconcile(eventType, lastCheckAt, now) {
|
|
13052
|
+
if (SKIP.has(eventType)) return false;
|
|
13053
|
+
if (lastCheckAt != null && now - lastCheckAt < RECONCILE_HEAL_MIN_MS) return false;
|
|
13054
|
+
return true;
|
|
13055
|
+
}
|
|
13056
|
+
var RECONCILE_HEAL_MIN_MS, SKIP;
|
|
13057
|
+
var init_reconcile_heal = __esm({
|
|
13058
|
+
"src/orchestrator/reconcile-heal.ts"() {
|
|
13059
|
+
"use strict";
|
|
13060
|
+
RECONCILE_HEAL_MIN_MS = 2e3;
|
|
13061
|
+
SKIP = /* @__PURE__ */ new Set([
|
|
13062
|
+
"stdout",
|
|
13063
|
+
"thinking",
|
|
13064
|
+
"usage",
|
|
13065
|
+
"stderr",
|
|
13066
|
+
"tool_result"
|
|
13067
|
+
]);
|
|
13068
|
+
}
|
|
13069
|
+
});
|
|
13070
|
+
|
|
12994
13071
|
// src/threads/fork-worktree.ts
|
|
12995
13072
|
function requireThread2(idOrRef) {
|
|
12996
13073
|
const thread = findThreadByRef(idOrRef) ?? null;
|
|
@@ -13161,7 +13238,7 @@ var init_quota_failover = __esm({
|
|
|
13161
13238
|
// src/threads/adopt.ts
|
|
13162
13239
|
function thisModuleFile() {
|
|
13163
13240
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
13164
|
-
return cjsFile || process.argv[1] || (0,
|
|
13241
|
+
return cjsFile || process.argv[1] || (0, import_node_path35.join)(process.cwd(), "package.json");
|
|
13165
13242
|
}
|
|
13166
13243
|
function openReadonlySqlite(file) {
|
|
13167
13244
|
const req = (0, import_node_module4.createRequire)(thisModuleFile());
|
|
@@ -13189,7 +13266,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
13189
13266
|
return null;
|
|
13190
13267
|
}
|
|
13191
13268
|
for (const hash of hashes) {
|
|
13192
|
-
const agentsFile = (0,
|
|
13269
|
+
const agentsFile = (0, import_node_path35.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
13193
13270
|
if (!(0, import_node_fs37.existsSync)(agentsFile)) continue;
|
|
13194
13271
|
let text4;
|
|
13195
13272
|
try {
|
|
@@ -13247,8 +13324,8 @@ function listConductorWorkspaces() {
|
|
|
13247
13324
|
if (!(0, import_node_fs37.existsSync)(CONDUCTOR_DB)) {
|
|
13248
13325
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
13249
13326
|
}
|
|
13250
|
-
const tmp = (0, import_node_fs37.mkdtempSync)((0,
|
|
13251
|
-
const snapshot = (0,
|
|
13327
|
+
const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path35.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
|
|
13328
|
+
const snapshot = (0, import_node_path35.join)(tmp, "conductor.db");
|
|
13252
13329
|
try {
|
|
13253
13330
|
(0, import_node_fs37.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
13254
13331
|
for (const suffix of ["-wal", "-shm"]) {
|
|
@@ -13338,8 +13415,8 @@ function importConductorWorkspace(workspaceId) {
|
|
|
13338
13415
|
if (!(0, import_node_fs37.existsSync)(CONDUCTOR_DB)) {
|
|
13339
13416
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
13340
13417
|
}
|
|
13341
|
-
const tmp = (0, import_node_fs37.mkdtempSync)((0,
|
|
13342
|
-
const snapshot = (0,
|
|
13418
|
+
const tmp = (0, import_node_fs37.mkdtempSync)((0, import_node_path35.join)((0, import_node_os10.tmpdir)(), "sideboard-conductor-"));
|
|
13419
|
+
const snapshot = (0, import_node_path35.join)(tmp, "conductor.db");
|
|
13343
13420
|
try {
|
|
13344
13421
|
(0, import_node_fs37.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
13345
13422
|
for (const suffix of ["-wal", "-shm"]) {
|
|
@@ -13433,25 +13510,25 @@ function importConductorWorkspace(workspaceId) {
|
|
|
13433
13510
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
13434
13511
|
return importConductorWorkspace(workspaceId);
|
|
13435
13512
|
}
|
|
13436
|
-
var import_node_child_process4, import_node_fs37, import_node_os10,
|
|
13513
|
+
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;
|
|
13437
13514
|
var init_adopt = __esm({
|
|
13438
13515
|
"src/threads/adopt.ts"() {
|
|
13439
13516
|
"use strict";
|
|
13440
13517
|
import_node_child_process4 = require("child_process");
|
|
13441
13518
|
import_node_fs37 = require("fs");
|
|
13442
13519
|
import_node_os10 = require("os");
|
|
13443
|
-
|
|
13520
|
+
import_node_path35 = require("path");
|
|
13444
13521
|
import_node_module4 = require("module");
|
|
13445
13522
|
init_worktree();
|
|
13446
13523
|
init_thread_store();
|
|
13447
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
13524
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path35.join)(
|
|
13448
13525
|
process.env.HOME ?? "",
|
|
13449
13526
|
"Library",
|
|
13450
13527
|
"Application Support",
|
|
13451
13528
|
"com.conductor.app"
|
|
13452
13529
|
);
|
|
13453
|
-
CONDUCTOR_DB = (0,
|
|
13454
|
-
CURSOR_SDK_STORE = (0,
|
|
13530
|
+
CONDUCTOR_DB = (0, import_node_path35.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
13531
|
+
CURSOR_SDK_STORE = (0, import_node_path35.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
13455
13532
|
}
|
|
13456
13533
|
});
|
|
13457
13534
|
|
|
@@ -13906,7 +13983,7 @@ new file mode 100644
|
|
|
13906
13983
|
};
|
|
13907
13984
|
}
|
|
13908
13985
|
async function untrackedPatch(worktreePath, path2, maxHunk) {
|
|
13909
|
-
const abs = (0,
|
|
13986
|
+
const abs = (0, import_node_path36.join)(worktreePath, path2);
|
|
13910
13987
|
try {
|
|
13911
13988
|
const st = (0, import_node_fs39.statSync)(abs);
|
|
13912
13989
|
if (st.isFile() && st.size > maxHunk) {
|
|
@@ -14399,7 +14476,7 @@ function isImageRelativePath(relativePath) {
|
|
|
14399
14476
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
14400
14477
|
assertSafeRelativePath(relativePath);
|
|
14401
14478
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
14402
|
-
const abs = (0,
|
|
14479
|
+
const abs = (0, import_node_path36.join)(worktreePath, relativePath);
|
|
14403
14480
|
const st = (0, import_node_fs39.statSync)(abs);
|
|
14404
14481
|
if (!st.isFile()) {
|
|
14405
14482
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -14419,7 +14496,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
14419
14496
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
14420
14497
|
assertSafeRelativePath(relativePath);
|
|
14421
14498
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
14422
|
-
const abs = (0,
|
|
14499
|
+
const abs = (0, import_node_path36.join)(worktreePath, relativePath);
|
|
14423
14500
|
const st = (0, import_node_fs39.statSync)(abs);
|
|
14424
14501
|
if (!st.isFile()) {
|
|
14425
14502
|
throw new Error(`Not a file: ${relativePath}`);
|
|
@@ -14467,8 +14544,8 @@ function assertSafeRelativePath(relativePath) {
|
|
|
14467
14544
|
}
|
|
14468
14545
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
14469
14546
|
assertSafeRelativePath(relativePath);
|
|
14470
|
-
const abs = (0,
|
|
14471
|
-
(0, import_node_fs39.mkdirSync)((0,
|
|
14547
|
+
const abs = (0, import_node_path36.join)(worktreePath, relativePath);
|
|
14548
|
+
(0, import_node_fs39.mkdirSync)((0, import_node_path36.dirname)(abs), { recursive: true });
|
|
14472
14549
|
(0, import_node_fs39.writeFileSync)(abs, content, "utf8");
|
|
14473
14550
|
return { path: relativePath };
|
|
14474
14551
|
}
|
|
@@ -14486,12 +14563,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
14486
14563
|
truncated: full.files.length > maxFiles
|
|
14487
14564
|
};
|
|
14488
14565
|
}
|
|
14489
|
-
var import_node_fs39,
|
|
14566
|
+
var import_node_fs39, import_node_path36, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS, DEFAULT_UPLOAD_MAX_BYTES;
|
|
14490
14567
|
var init_diff = __esm({
|
|
14491
14568
|
"src/diff/diff.ts"() {
|
|
14492
14569
|
"use strict";
|
|
14493
14570
|
import_node_fs39 = require("fs");
|
|
14494
|
-
|
|
14571
|
+
import_node_path36 = require("path");
|
|
14495
14572
|
init_run();
|
|
14496
14573
|
init_worktree();
|
|
14497
14574
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -14687,7 +14764,7 @@ function scanSkillsDir(dir, source, out) {
|
|
|
14687
14764
|
}
|
|
14688
14765
|
for (const entry of entries) {
|
|
14689
14766
|
if (entry.startsWith(".")) continue;
|
|
14690
|
-
const skillMd = (0,
|
|
14767
|
+
const skillMd = (0, import_node_path37.join)(dir, entry, "SKILL.md");
|
|
14691
14768
|
if (!(0, import_node_fs40.existsSync)(skillMd)) continue;
|
|
14692
14769
|
try {
|
|
14693
14770
|
if (!(0, import_node_fs40.statSync)(skillMd).isFile()) continue;
|
|
@@ -14709,12 +14786,12 @@ function scanClaudePluginSkills(pluginsRoot, out) {
|
|
|
14709
14786
|
return;
|
|
14710
14787
|
}
|
|
14711
14788
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
14712
|
-
const skill = readSkill((0,
|
|
14789
|
+
const skill = readSkill((0, import_node_path37.join)(dir, "SKILL.md"), "cli");
|
|
14713
14790
|
if (skill) out.push(skill);
|
|
14714
14791
|
}
|
|
14715
14792
|
for (const entry of entries) {
|
|
14716
14793
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
14717
|
-
const full = (0,
|
|
14794
|
+
const full = (0, import_node_path37.join)(dir, entry);
|
|
14718
14795
|
try {
|
|
14719
14796
|
if (!(0, import_node_fs40.statSync)(full).isDirectory()) continue;
|
|
14720
14797
|
} catch {
|
|
@@ -14734,17 +14811,17 @@ function discoverSkills(worktreePath) {
|
|
|
14734
14811
|
const home = (0, import_node_os11.homedir)();
|
|
14735
14812
|
const collected = [];
|
|
14736
14813
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
14737
|
-
scanSkillsDir((0,
|
|
14814
|
+
scanSkillsDir((0, import_node_path37.join)(worktreePath, rel), "workspace", collected);
|
|
14738
14815
|
}
|
|
14739
14816
|
for (const abs of [
|
|
14740
|
-
(0,
|
|
14741
|
-
(0,
|
|
14742
|
-
(0,
|
|
14743
|
-
(0,
|
|
14817
|
+
(0, import_node_path37.join)(home, ".claude/skills"),
|
|
14818
|
+
(0, import_node_path37.join)(home, ".cursor/skills"),
|
|
14819
|
+
(0, import_node_path37.join)(home, ".sideboard/skills"),
|
|
14820
|
+
(0, import_node_path37.join)(home, ".brightsy/skills")
|
|
14744
14821
|
]) {
|
|
14745
14822
|
scanSkillsDir(abs, "user", collected);
|
|
14746
14823
|
}
|
|
14747
|
-
scanClaudePluginSkills((0,
|
|
14824
|
+
scanClaudePluginSkills((0, import_node_path37.join)(home, ".claude/plugins"), collected);
|
|
14748
14825
|
const rank = { workspace: 0, user: 1, cli: 2 };
|
|
14749
14826
|
const byCommand = /* @__PURE__ */ new Map();
|
|
14750
14827
|
for (const skill of collected) {
|
|
@@ -14770,13 +14847,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
14770
14847
|
|
|
14771
14848
|
\u2026(truncated)` : raw;
|
|
14772
14849
|
}
|
|
14773
|
-
var import_node_fs40, import_node_os11,
|
|
14850
|
+
var import_node_fs40, import_node_os11, import_node_path37;
|
|
14774
14851
|
var init_discover = __esm({
|
|
14775
14852
|
"src/skills/discover.ts"() {
|
|
14776
14853
|
"use strict";
|
|
14777
14854
|
import_node_fs40 = require("fs");
|
|
14778
14855
|
import_node_os11 = require("os");
|
|
14779
|
-
|
|
14856
|
+
import_node_path37 = require("path");
|
|
14780
14857
|
}
|
|
14781
14858
|
});
|
|
14782
14859
|
|
|
@@ -14867,7 +14944,7 @@ var init_expand = __esm({
|
|
|
14867
14944
|
|
|
14868
14945
|
// src/composer/stage-files.ts
|
|
14869
14946
|
function fileExtension(filePath) {
|
|
14870
|
-
const base = (0,
|
|
14947
|
+
const base = (0, import_node_path38.basename)(filePath).toLowerCase();
|
|
14871
14948
|
return base.includes(".") ? base.split(".").pop() || "" : "";
|
|
14872
14949
|
}
|
|
14873
14950
|
function isImageFilePath(filePath) {
|
|
@@ -14877,9 +14954,9 @@ function imageMimeType(filePath) {
|
|
|
14877
14954
|
return IMAGE_MIME_BY_EXT[fileExtension(filePath)] || "image/png";
|
|
14878
14955
|
}
|
|
14879
14956
|
function ensureAttachmentsDir(worktreePath) {
|
|
14880
|
-
const dir = (0,
|
|
14957
|
+
const dir = (0, import_node_path38.join)(worktreePath, ATTACHMENTS_DIR);
|
|
14881
14958
|
(0, import_node_fs41.mkdirSync)(dir, { recursive: true });
|
|
14882
|
-
const gi = (0,
|
|
14959
|
+
const gi = (0, import_node_path38.join)(dir, ".gitignore");
|
|
14883
14960
|
if (!(0, import_node_fs41.existsSync)(gi)) {
|
|
14884
14961
|
(0, import_node_fs41.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
|
|
14885
14962
|
}
|
|
@@ -14887,12 +14964,12 @@ function ensureAttachmentsDir(worktreePath) {
|
|
|
14887
14964
|
}
|
|
14888
14965
|
function uniqueAttachmentName(dir, originalName) {
|
|
14889
14966
|
const safe = originalName.replace(/[/\\]/g, "_") || "file";
|
|
14890
|
-
if (!(0, import_node_fs41.existsSync)((0,
|
|
14891
|
-
const ext = (0,
|
|
14967
|
+
if (!(0, import_node_fs41.existsSync)((0, import_node_path38.join)(dir, safe))) return safe;
|
|
14968
|
+
const ext = (0, import_node_path38.extname)(safe);
|
|
14892
14969
|
const stem = ext ? safe.slice(0, -ext.length) : safe;
|
|
14893
14970
|
for (let i = 1; i < 1e4; i++) {
|
|
14894
14971
|
const candidate = `${stem}-${i}${ext}`;
|
|
14895
|
-
if (!(0, import_node_fs41.existsSync)((0,
|
|
14972
|
+
if (!(0, import_node_fs41.existsSync)((0, import_node_path38.join)(dir, candidate))) return candidate;
|
|
14896
14973
|
}
|
|
14897
14974
|
return `${stem}-${(0, import_node_crypto8.randomUUID)()}${ext}`;
|
|
14898
14975
|
}
|
|
@@ -14944,7 +15021,7 @@ function attachmentFromBuffer(name, buf, opts) {
|
|
|
14944
15021
|
};
|
|
14945
15022
|
}
|
|
14946
15023
|
function attachmentFromAbsolutePath(absolutePath) {
|
|
14947
|
-
const name = (0,
|
|
15024
|
+
const name = (0, import_node_path38.basename)(absolutePath);
|
|
14948
15025
|
try {
|
|
14949
15026
|
const st = (0, import_node_fs41.statSync)(absolutePath);
|
|
14950
15027
|
if (!st.isFile()) {
|
|
@@ -14971,12 +15048,12 @@ function stageAbsolutePathsAsAttachments(worktreePath, absolutePaths) {
|
|
|
14971
15048
|
const dir = ensureAttachmentsDir(worktreePath);
|
|
14972
15049
|
const out = [];
|
|
14973
15050
|
for (const abs of absolutePaths) {
|
|
14974
|
-
const originalName = (0,
|
|
15051
|
+
const originalName = (0, import_node_path38.basename)(abs);
|
|
14975
15052
|
try {
|
|
14976
15053
|
const st = (0, import_node_fs41.statSync)(abs);
|
|
14977
15054
|
if (!st.isFile()) continue;
|
|
14978
15055
|
const name = uniqueAttachmentName(dir, originalName);
|
|
14979
|
-
const destAbs = (0,
|
|
15056
|
+
const destAbs = (0, import_node_path38.join)(dir, name);
|
|
14980
15057
|
(0, import_node_fs41.copyFileSync)(abs, destAbs);
|
|
14981
15058
|
const rel = `${ATTACHMENTS_DIR}/${name}`;
|
|
14982
15059
|
const buf = (0, import_node_fs41.readFileSync)(destAbs);
|
|
@@ -15001,7 +15078,7 @@ function stageBuffersAsAttachments(worktreePath, buffers2) {
|
|
|
15001
15078
|
try {
|
|
15002
15079
|
const buf = Buffer.from(item.dataBase64, "base64");
|
|
15003
15080
|
const name = uniqueAttachmentName(dir, originalName);
|
|
15004
|
-
const destAbs = (0,
|
|
15081
|
+
const destAbs = (0, import_node_path38.join)(dir, name);
|
|
15005
15082
|
(0, import_node_fs41.writeFileSync)(destAbs, buf);
|
|
15006
15083
|
const rel = `${ATTACHMENTS_DIR}/${name}`;
|
|
15007
15084
|
out.push(attachmentFromBuffer(name, buf, { path: rel }));
|
|
@@ -15038,15 +15115,15 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
|
|
|
15038
15115
|
if (!rel || rel.includes("..") || rel.startsWith("/")) {
|
|
15039
15116
|
out.push({
|
|
15040
15117
|
id: (0, import_node_crypto8.randomUUID)(),
|
|
15041
|
-
name: (0,
|
|
15118
|
+
name: (0, import_node_path38.basename)(rel) || "file",
|
|
15042
15119
|
kind: "file",
|
|
15043
15120
|
content: `(invalid path: ${rel})`
|
|
15044
15121
|
});
|
|
15045
15122
|
continue;
|
|
15046
15123
|
}
|
|
15047
|
-
const name = (0,
|
|
15124
|
+
const name = (0, import_node_path38.basename)(rel);
|
|
15048
15125
|
try {
|
|
15049
|
-
const abs = (0,
|
|
15126
|
+
const abs = (0, import_node_path38.join)(worktreePath, rel);
|
|
15050
15127
|
const st = (0, import_node_fs41.statSync)(abs);
|
|
15051
15128
|
if (!st.isFile()) continue;
|
|
15052
15129
|
const buf = (0, import_node_fs41.readFileSync)(abs);
|
|
@@ -15062,12 +15139,12 @@ function attachmentsFromWorktreePaths(worktreePath, relativePaths) {
|
|
|
15062
15139
|
}
|
|
15063
15140
|
return out;
|
|
15064
15141
|
}
|
|
15065
|
-
var import_node_fs41,
|
|
15142
|
+
var import_node_fs41, import_node_path38, import_node_crypto8, IMAGE_EXTENSIONS2, IMAGE_MIME_BY_EXT, MAX_INLINE_BYTES, MAX_PREVIEW_BYTES;
|
|
15066
15143
|
var init_stage_files = __esm({
|
|
15067
15144
|
"src/composer/stage-files.ts"() {
|
|
15068
15145
|
"use strict";
|
|
15069
15146
|
import_node_fs41 = require("fs");
|
|
15070
|
-
|
|
15147
|
+
import_node_path38 = require("path");
|
|
15071
15148
|
import_node_crypto8 = require("crypto");
|
|
15072
15149
|
init_workspace_scratch();
|
|
15073
15150
|
IMAGE_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
@@ -15214,14 +15291,15 @@ function formatArtifactDirective() {
|
|
|
15214
15291
|
return [
|
|
15215
15292
|
"Sideboard side column (desktop UI):",
|
|
15216
15293
|
"claude.ai\u2019s \u201CArtifact\u201D tool does NOT exist in Claude Code. That is expected.",
|
|
15294
|
+
"Do not unprompted-duplicate a payload. Chat markdown (including tables) already renders in the transcript \u2014 do not also call present_schema with those same rows just to display them. If the user asks for an editable / interactive table, call present_schema even if markdown already showed the data. Do not also call present_artifact for a document you already fenced in chat.",
|
|
15217
15295
|
"Documents (HTML/SVG/markdown):",
|
|
15218
15296
|
"1) Emit a fenced code block tagged `html` (preferred), `svg`, or `markdown` with the FULL document \u2014 Sideboard opens a side column. Example:",
|
|
15219
15297
|
"```html",
|
|
15220
15298
|
"<!DOCTYPE html><html><head><title>Demo</title></head><body><h1>Hi</h1></body></html>",
|
|
15221
15299
|
"```",
|
|
15222
|
-
"2) Or call Sideboard MCP `present_artifact` with title, type (html|svg|markdown), and content.",
|
|
15300
|
+
"2) Or call Sideboard MCP `present_artifact` with title, type (html|svg|markdown), and content \u2014 not both a fence and this tool for the same body.",
|
|
15223
15301
|
"CMS / JSON Schema forms & tables (Brightsy or any schema+schemaUi source):",
|
|
15224
|
-
"3) Call Sideboard MCP `present_schema`
|
|
15302
|
+
"3) Call Sideboard MCP `present_schema` when the user needs to filter, edit, publish, or persist rows \u2014 including after you already showed a markdown table, if they then ask for an editable table. If they only need to read the data, a markdown table is enough. When you do call it, pass title, mode (table|form), and either:",
|
|
15225
15303
|
" - datasource=brightsy + resource_id (record type UUID) after fetching types via Brightsy MCP, or",
|
|
15226
15304
|
" - datasource=inline + resource: { id, title, schema, schemaUi } and optional records/record.",
|
|
15227
15305
|
"Files / media browser (CMS file manager column):",
|
|
@@ -15230,11 +15308,11 @@ function formatArtifactDirective() {
|
|
|
15230
15308
|
"Multiple-choice questions:",
|
|
15231
15309
|
"5) Call Sideboard MCP `ask_user` only when work is blocked on choosing among a few concrete options (approach forks, which API, auth vs cookies). First write a short chat message that explains the decision and what each option means (tradeoffs, when to pick it). Include a description on every option. After calling, stop and wait for their next message with answers. If you are asking a real multiple-choice, use ask_user rather than chat bullets so Sideboard shows the composer picker.",
|
|
15232
15310
|
"Do not call ask_user for greetings, check-ins, \u201Chello\u201D, open-ended how-can-I-help, or to invent a menu of possible next tasks \u2014 reply in chat. If one option is the obvious default, proceed without asking.",
|
|
15233
|
-
"Never say artifacts, CMS UI, or the Files column are unavailable.
|
|
15311
|
+
"Never say artifacts, CMS UI, or the Files column are unavailable. present_schema is for interactive list/edit/publish (use it when they ask to edit, even if chat already had a markdown table); present_files for storage UI; html fences for standalone pages; ask_user only for those blocked predefined-option questions."
|
|
15234
15312
|
].join("\n");
|
|
15235
15313
|
}
|
|
15236
15314
|
function formatUiReminder() {
|
|
15237
|
-
return "Sideboard UI: html fence or present_artifact
|
|
15315
|
+
return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. ask_user only for a real multiple-choice (not hellos or \u201Cwhat next?\u201D) \u2014 reply in chat. Do not say artifacts/CMS UI are unavailable.";
|
|
15238
15316
|
}
|
|
15239
15317
|
function loadAgentInstructions(worktreePath, agent) {
|
|
15240
15318
|
const candidates = FILES_BY_AGENT[agent] ?? FILES_BY_AGENT.claude;
|
|
@@ -15243,7 +15321,7 @@ function loadAgentInstructions(worktreePath, agent) {
|
|
|
15243
15321
|
const out = [];
|
|
15244
15322
|
for (const rel of candidates) {
|
|
15245
15323
|
if (seenPaths.has(rel)) continue;
|
|
15246
|
-
const abs = (0,
|
|
15324
|
+
const abs = (0, import_node_path39.join)(worktreePath, rel);
|
|
15247
15325
|
if (!(0, import_node_fs42.existsSync)(abs)) continue;
|
|
15248
15326
|
try {
|
|
15249
15327
|
if (!(0, import_node_fs42.statSync)(abs).isFile()) continue;
|
|
@@ -15287,12 +15365,12 @@ function withAgentInstructions(prompt, files) {
|
|
|
15287
15365
|
|
|
15288
15366
|
${prompt}`;
|
|
15289
15367
|
}
|
|
15290
|
-
var import_node_fs42,
|
|
15368
|
+
var import_node_fs42, import_node_path39, FILES_BY_AGENT, MAX_CHARS_PER_FILE;
|
|
15291
15369
|
var init_instructions = __esm({
|
|
15292
15370
|
"src/agents/instructions.ts"() {
|
|
15293
15371
|
"use strict";
|
|
15294
15372
|
import_node_fs42 = require("fs");
|
|
15295
|
-
|
|
15373
|
+
import_node_path39 = require("path");
|
|
15296
15374
|
init_git_auth_mode();
|
|
15297
15375
|
init_worktree_labels();
|
|
15298
15376
|
FILES_BY_AGENT = {
|
|
@@ -15382,13 +15460,13 @@ __export(plan_file_exports, {
|
|
|
15382
15460
|
writePlanFile: () => writePlanFile
|
|
15383
15461
|
});
|
|
15384
15462
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
15385
|
-
const gitignoreAbs = (0,
|
|
15463
|
+
const gitignoreAbs = (0, import_node_path40.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
15386
15464
|
if ((0, import_node_fs43.existsSync)(gitignoreAbs)) return;
|
|
15387
|
-
(0, import_node_fs43.mkdirSync)((0,
|
|
15465
|
+
(0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(gitignoreAbs), { recursive: true });
|
|
15388
15466
|
(0, import_node_fs43.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
15389
15467
|
}
|
|
15390
15468
|
function planFileAbs(worktreePath) {
|
|
15391
|
-
return (0,
|
|
15469
|
+
return (0, import_node_path40.join)(worktreePath, PLAN_FILE_REL);
|
|
15392
15470
|
}
|
|
15393
15471
|
function readTextIfPresent2(abs) {
|
|
15394
15472
|
if (!(0, import_node_fs43.existsSync)(abs)) return null;
|
|
@@ -15400,22 +15478,22 @@ function readTextIfPresent2(abs) {
|
|
|
15400
15478
|
}
|
|
15401
15479
|
}
|
|
15402
15480
|
function readPlanFile(worktreePath) {
|
|
15403
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
15481
|
+
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));
|
|
15404
15482
|
}
|
|
15405
15483
|
function writePlanFile(worktreePath, content) {
|
|
15406
15484
|
ensureAttachmentsGitignore(worktreePath);
|
|
15407
15485
|
const abs = planFileAbs(worktreePath);
|
|
15408
|
-
(0, import_node_fs43.mkdirSync)((0,
|
|
15486
|
+
(0, import_node_fs43.mkdirSync)((0, import_node_path40.dirname)(abs), { recursive: true });
|
|
15409
15487
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
15410
15488
|
(0, import_node_fs43.writeFileSync)(abs, body, "utf8");
|
|
15411
15489
|
return PLAN_FILE_REL;
|
|
15412
15490
|
}
|
|
15413
|
-
var import_node_fs43,
|
|
15491
|
+
var import_node_fs43, import_node_path40;
|
|
15414
15492
|
var init_plan_file = __esm({
|
|
15415
15493
|
"src/plan/plan-file.ts"() {
|
|
15416
15494
|
"use strict";
|
|
15417
15495
|
import_node_fs43 = require("fs");
|
|
15418
|
-
|
|
15496
|
+
import_node_path40 = require("path");
|
|
15419
15497
|
init_workspace_scratch();
|
|
15420
15498
|
init_plan_present();
|
|
15421
15499
|
init_plan_present();
|
|
@@ -15461,6 +15539,37 @@ var init_sync_branch = __esm({
|
|
|
15461
15539
|
}
|
|
15462
15540
|
});
|
|
15463
15541
|
|
|
15542
|
+
// src/agents/cursor-store.ts
|
|
15543
|
+
function cursorSdkStoreDir(threadId) {
|
|
15544
|
+
const root = (0, import_node_path41.join)(appDataDir(), CURSOR_SDK_STORE_DIR);
|
|
15545
|
+
const id = sanitizeCursorStoreSegment(threadId);
|
|
15546
|
+
if (!id) return root;
|
|
15547
|
+
return (0, import_node_path41.join)(root, "threads", id);
|
|
15548
|
+
}
|
|
15549
|
+
function cursorSdkRunsNdjsonPath(threadId) {
|
|
15550
|
+
return (0, import_node_path41.join)(cursorSdkStoreDir(threadId), "runs.ndjson");
|
|
15551
|
+
}
|
|
15552
|
+
function cursorSdkRunsNdjsonSearchPaths(threadId) {
|
|
15553
|
+
const scoped = cursorSdkRunsNdjsonPath(threadId);
|
|
15554
|
+
const shared = cursorSdkRunsNdjsonPath(null);
|
|
15555
|
+
if (!threadId || !sanitizeCursorStoreSegment(threadId) || scoped === shared) {
|
|
15556
|
+
return [shared];
|
|
15557
|
+
}
|
|
15558
|
+
return [scoped, shared];
|
|
15559
|
+
}
|
|
15560
|
+
function sanitizeCursorStoreSegment(threadId) {
|
|
15561
|
+
return (threadId ?? "").trim().replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
15562
|
+
}
|
|
15563
|
+
var import_node_path41, CURSOR_SDK_STORE_DIR;
|
|
15564
|
+
var init_cursor_store = __esm({
|
|
15565
|
+
"src/agents/cursor-store.ts"() {
|
|
15566
|
+
"use strict";
|
|
15567
|
+
import_node_path41 = require("path");
|
|
15568
|
+
init_paths();
|
|
15569
|
+
CURSOR_SDK_STORE_DIR = "cursor-sdk-store";
|
|
15570
|
+
}
|
|
15571
|
+
});
|
|
15572
|
+
|
|
15464
15573
|
// src/agents/cursor-recover.ts
|
|
15465
15574
|
var cursor_recover_exports = {};
|
|
15466
15575
|
__export(cursor_recover_exports, {
|
|
@@ -15469,7 +15578,14 @@ __export(cursor_recover_exports, {
|
|
|
15469
15578
|
function recoverFinishedCursorRun(opts) {
|
|
15470
15579
|
const agentId = opts.agentId.trim();
|
|
15471
15580
|
if (!agentId) return null;
|
|
15472
|
-
|
|
15581
|
+
let best = null;
|
|
15582
|
+
for (const runsPath of cursorSdkRunsNdjsonSearchPaths(opts.threadId)) {
|
|
15583
|
+
const hit = scanFinishedCursorRuns(runsPath, agentId, opts.startedAfterMs);
|
|
15584
|
+
if (hit && (!best || hit.endedAt >= best.endedAt)) best = hit;
|
|
15585
|
+
}
|
|
15586
|
+
return best;
|
|
15587
|
+
}
|
|
15588
|
+
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
15473
15589
|
if (!(0, import_node_fs44.existsSync)(runsPath)) return null;
|
|
15474
15590
|
try {
|
|
15475
15591
|
const lines = (0, import_node_fs44.readFileSync)(runsPath, "utf8").split("\n");
|
|
@@ -15488,7 +15604,7 @@ function recoverFinishedCursorRun(opts) {
|
|
|
15488
15604
|
if (typeof row.result !== "string" || !row.result.trim()) continue;
|
|
15489
15605
|
const endedAt = typeof row.endedAt === "number" ? row.endedAt : 0;
|
|
15490
15606
|
const createdAt = typeof row.createdAt === "number" ? row.createdAt : 0;
|
|
15491
|
-
if (createdAt <
|
|
15607
|
+
if (createdAt < startedAfterMs && endedAt < startedAfterMs) continue;
|
|
15492
15608
|
if (!best || endedAt >= best.endedAt) {
|
|
15493
15609
|
best = { runId: row.runId || "", result: row.result.trim(), endedAt };
|
|
15494
15610
|
}
|
|
@@ -15498,13 +15614,12 @@ function recoverFinishedCursorRun(opts) {
|
|
|
15498
15614
|
return null;
|
|
15499
15615
|
}
|
|
15500
15616
|
}
|
|
15501
|
-
var import_node_fs44
|
|
15617
|
+
var import_node_fs44;
|
|
15502
15618
|
var init_cursor_recover = __esm({
|
|
15503
15619
|
"src/agents/cursor-recover.ts"() {
|
|
15504
15620
|
"use strict";
|
|
15505
15621
|
import_node_fs44 = require("fs");
|
|
15506
|
-
|
|
15507
|
-
init_paths();
|
|
15622
|
+
init_cursor_store();
|
|
15508
15623
|
}
|
|
15509
15624
|
});
|
|
15510
15625
|
|
|
@@ -15665,6 +15780,7 @@ var init_orchestrator = __esm({
|
|
|
15665
15780
|
init_run();
|
|
15666
15781
|
init_repo_git_lock();
|
|
15667
15782
|
init_turn_live();
|
|
15783
|
+
init_reconcile_heal();
|
|
15668
15784
|
init_request_review();
|
|
15669
15785
|
init_fork_worktree();
|
|
15670
15786
|
init_quota_failover();
|
|
@@ -15694,6 +15810,8 @@ var init_orchestrator = __esm({
|
|
|
15694
15810
|
draining = /* @__PURE__ */ new Set();
|
|
15695
15811
|
/** Threads past setStatus(running) but not yet in activeTurns (spawn in flight). */
|
|
15696
15812
|
startingTurns = /* @__PURE__ */ new Set();
|
|
15813
|
+
/** Last sync thread-file read for false-stop heal (throttled per thread). */
|
|
15814
|
+
lastReconcileHealAt = /* @__PURE__ */ new Map();
|
|
15697
15815
|
/**
|
|
15698
15816
|
* Threads intentionally force-stopped. Prevents runTurn from re-asserting
|
|
15699
15817
|
* `running` after spawn, and from overwriting `stopped` with idle/error when
|
|
@@ -16291,7 +16409,13 @@ var init_orchestrator = __esm({
|
|
|
16291
16409
|
if (event.type === "stderr" && typeof event.data === "string") {
|
|
16292
16410
|
pushTurnStderr(stderrTail, event.data);
|
|
16293
16411
|
}
|
|
16294
|
-
|
|
16412
|
+
const now = Date.now();
|
|
16413
|
+
if (shouldReadThreadToHealReconcile(
|
|
16414
|
+
event.type,
|
|
16415
|
+
this.lastReconcileHealAt.get(threadId),
|
|
16416
|
+
now
|
|
16417
|
+
)) {
|
|
16418
|
+
this.lastReconcileHealAt.set(threadId, now);
|
|
16295
16419
|
const live = readThread(threadId);
|
|
16296
16420
|
if (live?.lastError?.includes("reconciled on startup") && (this.activeTurns.has(threadId) || this.startingTurns.has(threadId))) {
|
|
16297
16421
|
setStatus(threadId, "running");
|
|
@@ -16335,7 +16459,8 @@ var init_orchestrator = __esm({
|
|
|
16335
16459
|
for (let i = 0; i < 8; i++) {
|
|
16336
16460
|
const recovered = recoverFinishedCursorRun2({
|
|
16337
16461
|
agentId: sessionId,
|
|
16338
|
-
startedAfterMs: turnStartedAt - 5e3
|
|
16462
|
+
startedAfterMs: turnStartedAt - 5e3,
|
|
16463
|
+
threadId
|
|
16339
16464
|
});
|
|
16340
16465
|
if (recovered?.result) {
|
|
16341
16466
|
assistantText = recovered.result;
|
|
@@ -17873,6 +17998,7 @@ __export(index_exports, {
|
|
|
17873
17998
|
isPresentPlanToolName: () => isPresentPlanToolName,
|
|
17874
17999
|
isPrimaryCheckoutThread: () => isPrimaryCheckoutThread,
|
|
17875
18000
|
isSessionQuotaLimit: () => isSessionQuotaLimit,
|
|
18001
|
+
isShellToolName: () => isShellToolName,
|
|
17876
18002
|
isSideboardScratchPath: () => isSideboardScratchPath,
|
|
17877
18003
|
isSlackCoordinatorThread: () => isSlackCoordinatorThread,
|
|
17878
18004
|
isSlackExternalReplyPrompt: () => isSlackExternalReplyPrompt,
|
|
@@ -17881,6 +18007,7 @@ __export(index_exports, {
|
|
|
17881
18007
|
isThinkingEffort: () => isThinkingEffort,
|
|
17882
18008
|
isThisProcessDesktopHost: () => isThisProcessDesktopHost,
|
|
17883
18009
|
isThreadCaffeinated: () => isThreadCaffeinated,
|
|
18010
|
+
isThreadRecordFile: () => isThreadRecordFile,
|
|
17884
18011
|
isWorkspaceScratchPath: () => isWorkspaceScratchPath,
|
|
17885
18012
|
lastRequestOccupancy: () => lastRequestOccupancy,
|
|
17886
18013
|
linearAuthorizationHeader: () => linearAuthorizationHeader,
|
|
@@ -19100,7 +19227,7 @@ init_orphan_cleanup();
|
|
|
19100
19227
|
var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
19101
19228
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
19102
19229
|
var import_zod4 = require("zod");
|
|
19103
|
-
var
|
|
19230
|
+
var import_node_path42 = require("path");
|
|
19104
19231
|
init_orchestrator();
|
|
19105
19232
|
init_worktree();
|
|
19106
19233
|
init_create();
|
|
@@ -19977,7 +20104,7 @@ async function startMcpServer() {
|
|
|
19977
20104
|
async () => {
|
|
19978
20105
|
const threads = orch.getThreads(true);
|
|
19979
20106
|
const lines = threads.map((t) => {
|
|
19980
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
20107
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path42.basename)(t.repoPath) || t.repoPath;
|
|
19981
20108
|
const live = t.status === "running" || t.status === "queued" ? readTurnLive(t.id) : null;
|
|
19982
20109
|
const progress = live?.summary ? ` ${live.summary}` : "";
|
|
19983
20110
|
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}`;
|
|
@@ -20022,7 +20149,7 @@ async function startMcpServer() {
|
|
|
20022
20149
|
}
|
|
20023
20150
|
server.tool(
|
|
20024
20151
|
"present_artifact",
|
|
20025
|
-
"Show an HTML, SVG, markdown, or React document in Sideboard\u2019s Claude-style side column (desktop). Use instead of claude.ai\u2019s artifact tool \u2014 pass the full document content. Prefer type=html for interactive pages. For type=react, pass a single component module that `export default`s a component (JSX/TSX ok) \u2014 Sideboard bootstraps React/ReactDOM/Babel and renders it; only `react`/`react-dom` imports are available, no other npm packages.",
|
|
20152
|
+
"Show an HTML, SVG, markdown, or React document in Sideboard\u2019s Claude-style side column (desktop). Use instead of claude.ai\u2019s artifact tool \u2014 pass the full document content. Do not also emit the same document as a chat html/markdown fence. Prefer type=html for interactive pages. For type=react, pass a single component module that `export default`s a component (JSX/TSX ok) \u2014 Sideboard bootstraps React/ReactDOM/Babel and renders it; only `react`/`react-dom` imports are available, no other npm packages.",
|
|
20026
20153
|
{
|
|
20027
20154
|
title: import_zod4.z.string().describe("Short title shown in the artifact pane header"),
|
|
20028
20155
|
type: import_zod4.z.enum(["html", "svg", "markdown", "react"]).describe(
|
|
@@ -20099,7 +20226,7 @@ async function startMcpServer() {
|
|
|
20099
20226
|
);
|
|
20100
20227
|
server.tool(
|
|
20101
20228
|
"present_schema",
|
|
20102
|
-
"Open Sideboard\u2019s schema-driven side column (filterable table and/or form). Pass JSON Schema + optional schemaUi. Prefer datasource=inline with embedded resource/records. Use datasource=brightsy with resource_id only when the user is logged into Brightsy.",
|
|
20229
|
+
"Open Sideboard\u2019s schema-driven side column (filterable table and/or form) when the user needs to filter, edit, publish, or persist records. Do not call this just to re-display rows you already wrote as a markdown table. If the user asks for an editable / interactive table, call this even if chat already showed those rows. Pass JSON Schema + optional schemaUi. Prefer datasource=inline with embedded resource/records. Use datasource=brightsy with resource_id only when the user is logged into Brightsy.",
|
|
20103
20230
|
{
|
|
20104
20231
|
title: import_zod4.z.string().describe("Pane title"),
|
|
20105
20232
|
mode: import_zod4.z.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
|
|
@@ -21319,14 +21446,14 @@ init_injected_mcp();
|
|
|
21319
21446
|
// src/agents/user-mcp-config.ts
|
|
21320
21447
|
var import_node_fs46 = require("fs");
|
|
21321
21448
|
var import_node_os12 = require("os");
|
|
21322
|
-
var
|
|
21449
|
+
var import_node_path43 = require("path");
|
|
21323
21450
|
init_paths();
|
|
21324
21451
|
init_injected_mcp();
|
|
21325
21452
|
function userCursorMcpConfigPath() {
|
|
21326
|
-
return (0,
|
|
21453
|
+
return (0, import_node_path43.join)((0, import_node_os12.homedir)(), ".cursor", "mcp.json");
|
|
21327
21454
|
}
|
|
21328
21455
|
function userClaudeMcpConfigPath() {
|
|
21329
|
-
return (0,
|
|
21456
|
+
return (0, import_node_path43.join)((0, import_node_os12.homedir)(), ".claude.json");
|
|
21330
21457
|
}
|
|
21331
21458
|
function asObject(value) {
|
|
21332
21459
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
@@ -21361,7 +21488,7 @@ function writeMergedMcpServersJson(configPath, sideboard) {
|
|
|
21361
21488
|
}
|
|
21362
21489
|
}
|
|
21363
21490
|
const next = mergeSideboardIntoMcpServersJson(existing, sideboard);
|
|
21364
|
-
(0, import_node_fs46.mkdirSync)((0,
|
|
21491
|
+
(0, import_node_fs46.mkdirSync)((0, import_node_path43.dirname)(configPath), { recursive: true });
|
|
21365
21492
|
(0, import_node_fs46.writeFileSync)(configPath, `${JSON.stringify(next, null, 2)}
|
|
21366
21493
|
`);
|
|
21367
21494
|
}
|
|
@@ -23012,7 +23139,7 @@ var import_ws3 = require("ws");
|
|
|
23012
23139
|
// src/slack/relay-static.ts
|
|
23013
23140
|
var import_node_fs47 = require("fs");
|
|
23014
23141
|
var import_promises = require("fs/promises");
|
|
23015
|
-
var
|
|
23142
|
+
var import_node_path44 = __toESM(require("path"), 1);
|
|
23016
23143
|
var TYPES = {
|
|
23017
23144
|
".css": "text/css; charset=utf-8",
|
|
23018
23145
|
".html": "text/html; charset=utf-8",
|
|
@@ -23043,9 +23170,9 @@ function resolveStaticPath(root, requestUrl) {
|
|
|
23043
23170
|
return null;
|
|
23044
23171
|
}
|
|
23045
23172
|
if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
|
|
23046
|
-
const rootResolved =
|
|
23047
|
-
const candidate =
|
|
23048
|
-
if (candidate !== rootResolved && !candidate.startsWith(rootResolved +
|
|
23173
|
+
const rootResolved = import_node_path44.default.resolve(root);
|
|
23174
|
+
const candidate = import_node_path44.default.resolve(rootResolved, `.${pathname}`);
|
|
23175
|
+
if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path44.default.sep)) {
|
|
23049
23176
|
return null;
|
|
23050
23177
|
}
|
|
23051
23178
|
return candidate;
|
|
@@ -23059,7 +23186,7 @@ async function fileSize(file) {
|
|
|
23059
23186
|
}
|
|
23060
23187
|
}
|
|
23061
23188
|
function sendFile(req, res, file, size) {
|
|
23062
|
-
const ext =
|
|
23189
|
+
const ext = import_node_path44.default.extname(file).toLowerCase();
|
|
23063
23190
|
res.writeHead(200, {
|
|
23064
23191
|
"Content-Type": TYPES[ext] ?? "application/octet-stream",
|
|
23065
23192
|
"Content-Length": size,
|
|
@@ -23078,7 +23205,7 @@ async function tryServeStatic(req, res, root) {
|
|
|
23078
23205
|
if (!candidate) return false;
|
|
23079
23206
|
const direct = await fileSize(candidate);
|
|
23080
23207
|
if (direct != null) return sendFile(req, res, candidate, direct);
|
|
23081
|
-
const asIndex =
|
|
23208
|
+
const asIndex = import_node_path44.default.join(candidate, "index.html");
|
|
23082
23209
|
const indexSize = await fileSize(asIndex);
|
|
23083
23210
|
if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
|
|
23084
23211
|
return false;
|
|
@@ -23629,6 +23756,7 @@ init_outbound_watch();
|
|
|
23629
23756
|
isPresentPlanToolName,
|
|
23630
23757
|
isPrimaryCheckoutThread,
|
|
23631
23758
|
isSessionQuotaLimit,
|
|
23759
|
+
isShellToolName,
|
|
23632
23760
|
isSideboardScratchPath,
|
|
23633
23761
|
isSlackCoordinatorThread,
|
|
23634
23762
|
isSlackExternalReplyPrompt,
|
|
@@ -23637,6 +23765,7 @@ init_outbound_watch();
|
|
|
23637
23765
|
isThinkingEffort,
|
|
23638
23766
|
isThisProcessDesktopHost,
|
|
23639
23767
|
isThreadCaffeinated,
|
|
23768
|
+
isThreadRecordFile,
|
|
23640
23769
|
isWorkspaceScratchPath,
|
|
23641
23770
|
lastRequestOccupancy,
|
|
23642
23771
|
linearAuthorizationHeader,
|