@sideboard-ai/core 0.1.351 → 0.1.352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abletime-TX7BTTR2.js → abletime-5LEOMLQE.js} +4 -4
- package/dist/{abletime-URSRZW7P.js → abletime-VUPUERE4.js} +4 -4
- package/dist/{abletime-oauth-QS3WPSCC.js → abletime-oauth-65LHLQ7P.js} +3 -3
- package/dist/{abletime-oauth-SL3NMNEC.js → abletime-oauth-JAINJBNY.js} +3 -3
- package/dist/{abletime-rest-JZU6JJCV.js → abletime-rest-4TCWPN7E.js} +3 -3
- package/dist/{abletime-rest-GGQLUO55.js → abletime-rest-HBIK234Y.js} +3 -3
- package/dist/agents/claude-runner.cjs +46 -19
- package/dist/agents/claude-runner.js +16 -1
- package/dist/agents/cursor-runner.cjs +50 -12
- package/dist/agents/cursor-runner.js +2 -2
- package/dist/{agents-INTH7J3F.js → agents-4DQDWMSX.js} +9 -9
- package/dist/{agents-D5CL4CR4.js → agents-IV454BNN.js} +8 -8
- package/dist/{app-settings-IA7ZZKWQ.js → app-settings-GM4MJD2E.js} +3 -1
- package/dist/{app-settings-XILTSD6L.js → app-settings-X3UFWRAF.js} +3 -1
- package/dist/{chunk-BZK62VPT.js → chunk-2S7EAUDI.js} +2 -2
- package/dist/{chunk-CCWQ65VD.js → chunk-2SFKLWU5.js} +2 -2
- package/dist/{chunk-WB3G2LQO.js → chunk-BCNPZ7H2.js} +1 -1
- package/dist/{chunk-BDWVBEKN.js → chunk-CQDJ4RX4.js} +149 -127
- package/dist/{chunk-SMSD6U3N.js → chunk-GA5MLYVG.js} +1 -1
- package/dist/{chunk-HISSQICH.js → chunk-HBRP2SHA.js} +3 -3
- package/dist/{chunk-DL4OHDBV.js → chunk-I6BKWSCT.js} +3 -3
- package/dist/{chunk-WJURGCBR.js → chunk-KSBJOWVO.js} +1 -1
- package/dist/{chunk-J4EA5SHF.js → chunk-LZ3TAKNJ.js} +3 -3
- package/dist/{chunk-F4RFFE2H.js → chunk-M426EW7O.js} +3 -3
- package/dist/{chunk-C3E2DGDF.js → chunk-MBQU6RE2.js} +6 -6
- package/dist/{chunk-TCEUNSLX.js → chunk-NRGT7RMO.js} +1 -1
- package/dist/{chunk-M45WGODR.js → chunk-OCCUD5CK.js} +2 -2
- package/dist/{chunk-UXAKH4AW.js → chunk-PR5TOSRD.js} +324 -70
- package/dist/{chunk-SUZOPJZC.js → chunk-PS6TD5MQ.js} +260 -2
- package/dist/{chunk-YE7Z5WH3.js → chunk-QKNOKO2P.js} +1 -1
- package/dist/{chunk-VL6F2KRE.js → chunk-RMJXFABA.js} +8 -6
- package/dist/{chunk-FQ3JYUKI.js → chunk-SBUR2WCP.js} +2 -2
- package/dist/{chunk-AEEOYLVK.js → chunk-SWU5C3HQ.js} +6 -6
- package/dist/{chunk-UFUAIVNV.js → chunk-TB7SYXXS.js} +8 -6
- package/dist/{chunk-7ZD4OK6G.js → chunk-TDWE7INS.js} +1 -1
- package/dist/{chunk-WFX4ZVSZ.js → chunk-TRUNDXCE.js} +1 -1
- package/dist/{chunk-AAKQU4UZ.js → chunk-UDTFOKVX.js} +28 -10
- package/dist/{chunk-PXSWVZIL.js → chunk-UPJB6TFI.js} +2 -2
- package/dist/{chunk-7WPQAVS5.js → chunk-US2PGV3X.js} +146 -126
- package/dist/{chunk-YVN7L4KG.js → chunk-V2G6AGWM.js} +6 -1
- package/dist/{chunk-37ZBEBP6.js → chunk-VZAICZHU.js} +3 -3
- package/dist/{chunk-FCKTBE26.js → chunk-WJQFWDGH.js} +1 -1
- package/dist/{chunk-SZY23KGS.js → chunk-WTT525MC.js} +3 -3
- package/dist/{chunk-BF6INES4.js → chunk-X52SO3DM.js} +1 -1
- package/dist/{chunk-B4EFQTMP.js → chunk-XB6NCBZK.js} +5 -5
- package/dist/{chunk-5TCMXEYL.js → chunk-YGXUIBIT.js} +3 -3
- package/dist/{chunk-VHQ6OG3U.js → chunk-ZHYFRRPN.js} +2 -2
- package/dist/{chunk-5WF54R3B.js → chunk-ZLPP66IP.js} +5 -5
- package/dist/{conductor-FWYWIHEW.js → conductor-2UOW2XBE.js} +6 -6
- package/dist/{conductor-W2X7QUKZ.js → conductor-6NYG2SZA.js} +6 -6
- package/dist/{coordinator-prompt-J57Q4Z4W.js → coordinator-prompt-K3WT5UVS.js} +4 -4
- package/dist/{coordinator-prompt-KIHNLENN.js → coordinator-prompt-ZP6AEETR.js} +4 -4
- package/dist/{global-workspace-WXDWFZAN.js → global-workspace-EFPSYP4N.js} +4 -4
- package/dist/{global-workspace-CGB5CY4U.js → global-workspace-EPVNFQVC.js} +4 -4
- package/dist/index.cjs +1192 -865
- package/dist/index.d.cts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +361 -315
- package/dist/{linear-WG23LBCX.js → linear-4ACCQCWM.js} +2 -2
- package/dist/{linear-E3BX5PX5.js → linear-Q2E6LKJW.js} +2 -2
- package/dist/{linear-list-VU47BNUV.js → linear-list-5A3BAWRZ.js} +1 -1
- package/dist/{linear-list-OINZWVV5.js → linear-list-V3A57XBR.js} +1 -1
- package/dist/mcp/run-stdio.cjs +1116 -802
- package/dist/mcp/run-stdio.js +342 -308
- package/dist/{optional-cli-K6HX2X5O.js → optional-cli-CKQPLY4Q.js} +4 -4
- package/dist/{optional-cli-SA3EQYML.js → optional-cli-WE3ULLFV.js} +5 -5
- package/dist/{orchestrator-DMEE7CEW.js → orchestrator-5BCHUAFG.js} +11 -11
- package/dist/{orchestrator-MUD4FY7Q.js → orchestrator-EY6GCYQG.js} +12 -12
- package/dist/{thread-store-4YTOV2HL.js → thread-store-CDFHHRXB.js} +2 -2
- package/dist/{thread-store-LME2ICZP.js → thread-store-TDGZEGS6.js} +2 -2
- package/dist/{workspaces-ZCTF4ECL.js → workspaces-KL4SZMJE.js} +4 -4
- package/dist/{workspaces-7DPHDXNY.js → workspaces-SQRR67HD.js} +4 -4
- package/dist/{worktree-4ATMCYIE.js → worktree-7KG5N2XL.js} +3 -3
- package/dist/{worktree-DA6SKIU5.js → worktree-IDX7LMBC.js} +3 -3
- package/package.json +1 -1
package/dist/mcp/run-stdio.cjs
CHANGED
|
@@ -4953,6 +4953,7 @@ __export(app_settings_exports, {
|
|
|
4953
4953
|
childEnvWithAppSettings: () => childEnvWithAppSettings,
|
|
4954
4954
|
claudeChromeEnabled: () => claudeChromeEnabled,
|
|
4955
4955
|
claudeUserSettingsPath: () => claudeUserSettingsPath,
|
|
4956
|
+
computerUseEnabled: () => computerUseEnabled,
|
|
4956
4957
|
confirmClaudeUsageOverLimitEnabled: () => confirmClaudeUsageOverLimitEnabled,
|
|
4957
4958
|
cowboyModeEnabled: () => cowboyModeEnabled,
|
|
4958
4959
|
deleteBranchOnPurgeEnabled: () => deleteBranchOnPurgeEnabled,
|
|
@@ -5445,9 +5446,8 @@ function normalizeAdvanced(raw) {
|
|
|
5445
5446
|
if (typeof source.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
5446
5447
|
out.wakeOrchestratorOnGithubEdges = source.wakeOrchestratorOnGithubEdges;
|
|
5447
5448
|
}
|
|
5448
|
-
if (typeof source.showCost === "boolean")
|
|
5449
|
-
|
|
5450
|
-
}
|
|
5449
|
+
if (typeof source.showCost === "boolean") out.showCost = source.showCost;
|
|
5450
|
+
if (typeof source.computerUse === "boolean") out.computerUse = source.computerUse;
|
|
5451
5451
|
if (isChatTextScale(source.chatTextScale)) {
|
|
5452
5452
|
out.chatTextScale = source.chatTextScale;
|
|
5453
5453
|
}
|
|
@@ -6359,9 +6359,8 @@ function updateAdvancedSettings(patch) {
|
|
|
6359
6359
|
if (typeof patch.wakeOrchestratorOnGithubEdges === "boolean") {
|
|
6360
6360
|
advanced.wakeOrchestratorOnGithubEdges = patch.wakeOrchestratorOnGithubEdges;
|
|
6361
6361
|
}
|
|
6362
|
-
if (typeof patch.showCost === "boolean")
|
|
6363
|
-
|
|
6364
|
-
}
|
|
6362
|
+
if (typeof patch.showCost === "boolean") advanced.showCost = patch.showCost;
|
|
6363
|
+
if (typeof patch.computerUse === "boolean") advanced.computerUse = patch.computerUse;
|
|
6365
6364
|
if (isChatTextScale(patch.chatTextScale)) {
|
|
6366
6365
|
advanced.chatTextScale = patch.chatTextScale;
|
|
6367
6366
|
}
|
|
@@ -6473,6 +6472,9 @@ function wakeOrchestratorOnGithubEdgesEnabled(settings = loadAppSettings()) {
|
|
|
6473
6472
|
function showCostEnabled(settings = loadAppSettings()) {
|
|
6474
6473
|
return Boolean(settings.advanced.showCost);
|
|
6475
6474
|
}
|
|
6475
|
+
function computerUseEnabled(settings = loadAppSettings()) {
|
|
6476
|
+
return Boolean(settings.advanced.computerUse);
|
|
6477
|
+
}
|
|
6476
6478
|
function chatTextScale(settings = loadAppSettings()) {
|
|
6477
6479
|
return isChatTextScale(settings.advanced.chatTextScale) ? settings.advanced.chatTextScale : CHAT_TEXT_SCALE_DEFAULT;
|
|
6478
6480
|
}
|
|
@@ -13332,7 +13334,8 @@ var init_profile = __esm({
|
|
|
13332
13334
|
AGENT_RPC_PILOT_MCP_TOOLS = [
|
|
13333
13335
|
"present_artifact",
|
|
13334
13336
|
"wait_for_job",
|
|
13335
|
-
"stop_job"
|
|
13337
|
+
"stop_job",
|
|
13338
|
+
"computer_use"
|
|
13336
13339
|
];
|
|
13337
13340
|
WORKTREE_MCP_TOOLS = [
|
|
13338
13341
|
"present_artifact",
|
|
@@ -13346,6 +13349,7 @@ var init_profile = __esm({
|
|
|
13346
13349
|
"run_dev_script",
|
|
13347
13350
|
"stop_dev_script",
|
|
13348
13351
|
"get_run_log",
|
|
13352
|
+
"computer_use",
|
|
13349
13353
|
"get_orchestrator",
|
|
13350
13354
|
"notify_orchestrator",
|
|
13351
13355
|
"set_workspace_tags",
|
|
@@ -15242,6 +15246,242 @@ var init_rpc_env = __esm({
|
|
|
15242
15246
|
}
|
|
15243
15247
|
});
|
|
15244
15248
|
|
|
15249
|
+
// src/computer-use/computer-use.ts
|
|
15250
|
+
function appleScriptString(text8) {
|
|
15251
|
+
return `"${text8.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
15252
|
+
}
|
|
15253
|
+
function typeScripts(text8) {
|
|
15254
|
+
const parts = text8.split(/\r\n|\n|\r/);
|
|
15255
|
+
const scripts = [];
|
|
15256
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
15257
|
+
if (parts[i]) {
|
|
15258
|
+
scripts.push(`tell application "System Events" to keystroke ${appleScriptString(parts[i])}`);
|
|
15259
|
+
}
|
|
15260
|
+
if (i < parts.length - 1) {
|
|
15261
|
+
scripts.push('tell application "System Events" to key code 36');
|
|
15262
|
+
}
|
|
15263
|
+
}
|
|
15264
|
+
return scripts;
|
|
15265
|
+
}
|
|
15266
|
+
function modifierClause(modifiers) {
|
|
15267
|
+
const downs = modifiers.map((name) => {
|
|
15268
|
+
if (name === "cmd" || name === "command") return "command down";
|
|
15269
|
+
if (name === "alt" || name === "option") return "option down";
|
|
15270
|
+
if (name === "ctrl" || name === "control") return "control down";
|
|
15271
|
+
return "shift down";
|
|
15272
|
+
});
|
|
15273
|
+
if (!downs.length) return "";
|
|
15274
|
+
return ` using {${downs.join(", ")}}`;
|
|
15275
|
+
}
|
|
15276
|
+
function pngPointSize(bytes) {
|
|
15277
|
+
if (bytes.length < 24 || !bytes.subarray(0, 8).equals(PNG_SIG)) {
|
|
15278
|
+
throw new Error("screenshot is not a PNG");
|
|
15279
|
+
}
|
|
15280
|
+
let pixelWidth = 0;
|
|
15281
|
+
let pixelHeight = 0;
|
|
15282
|
+
let scale = 1;
|
|
15283
|
+
let offset = 8;
|
|
15284
|
+
while (offset + 8 <= bytes.length) {
|
|
15285
|
+
const length = bytes.readUInt32BE(offset);
|
|
15286
|
+
const type = bytes.toString("ascii", offset + 4, offset + 8);
|
|
15287
|
+
const data = offset + 8;
|
|
15288
|
+
if (data + length > bytes.length) break;
|
|
15289
|
+
if (type === "IHDR" && length >= 8) {
|
|
15290
|
+
pixelWidth = bytes.readUInt32BE(data);
|
|
15291
|
+
pixelHeight = bytes.readUInt32BE(data + 4);
|
|
15292
|
+
} else if (type === "pHYs" && length >= 9 && bytes[data + 8] === 1) {
|
|
15293
|
+
const ppm = bytes.readUInt32BE(data);
|
|
15294
|
+
if (ppm > 0) scale = ppm * 0.0254 / 72;
|
|
15295
|
+
} else if (type === "IEND") {
|
|
15296
|
+
break;
|
|
15297
|
+
}
|
|
15298
|
+
offset = data + length + 4;
|
|
15299
|
+
}
|
|
15300
|
+
if (pixelWidth <= 0 || pixelHeight <= 0) throw new Error("screenshot PNG has no size");
|
|
15301
|
+
return { pixelWidth, pixelHeight, scale };
|
|
15302
|
+
}
|
|
15303
|
+
function pointGeometry(info) {
|
|
15304
|
+
const raw = info.scale > 0 && Number.isFinite(info.scale) ? info.scale : 1;
|
|
15305
|
+
const scale = Math.round(raw * 100) / 100;
|
|
15306
|
+
return {
|
|
15307
|
+
width: Math.round(info.pixelWidth / scale),
|
|
15308
|
+
height: Math.round(info.pixelHeight / scale),
|
|
15309
|
+
scale
|
|
15310
|
+
};
|
|
15311
|
+
}
|
|
15312
|
+
function scrollWheelSwift(x, y, dx, dy) {
|
|
15313
|
+
for (const n of [x, y, dx, dy]) {
|
|
15314
|
+
if (!Number.isInteger(n)) throw new Error("scroll coordinates must be integers");
|
|
15315
|
+
}
|
|
15316
|
+
const wheel1 = -dy;
|
|
15317
|
+
const wheel2 = -dx;
|
|
15318
|
+
return `import CoreGraphics
|
|
15319
|
+
let src = CGEventSource(stateID: .hidSystemState)
|
|
15320
|
+
let p = CGPoint(x: ${x}, y: ${y})
|
|
15321
|
+
if let move = CGEvent(mouseEventSource: src, mouseType: .mouseMoved, mouseCursorPosition: p, mouseButton: .left) {
|
|
15322
|
+
move.post(tap: .cghidEventTap)
|
|
15323
|
+
}
|
|
15324
|
+
if let ev = CGEvent(scrollWheelEvent2Source: src, units: .pixel, wheelCount: 2, wheel1: ${wheel1}, wheel2: ${wheel2}, wheel3: 0) {
|
|
15325
|
+
ev.location = p
|
|
15326
|
+
ev.post(tap: .cghidEventTap)
|
|
15327
|
+
}
|
|
15328
|
+
`;
|
|
15329
|
+
}
|
|
15330
|
+
function asRecord6(value) {
|
|
15331
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
15332
|
+
return value;
|
|
15333
|
+
}
|
|
15334
|
+
function finite(value) {
|
|
15335
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
15336
|
+
}
|
|
15337
|
+
function point(value) {
|
|
15338
|
+
const n = Math.round(value);
|
|
15339
|
+
if (n < -8e3 || n > 2e4) return null;
|
|
15340
|
+
return n;
|
|
15341
|
+
}
|
|
15342
|
+
function scrollDelta(value) {
|
|
15343
|
+
const n = Math.round(value);
|
|
15344
|
+
if (n < -4e3 || n > 4e3) return null;
|
|
15345
|
+
return n;
|
|
15346
|
+
}
|
|
15347
|
+
function screenshotFile(cwd, now) {
|
|
15348
|
+
const root = (0, import_node_path40.isAbsolute)(cwd) ? cwd : (0, import_node_os19.tmpdir)();
|
|
15349
|
+
const dir = (0, import_node_path40.join)(root, ".context", "cli");
|
|
15350
|
+
(0, import_node_fs38.mkdirSync)(dir, { recursive: true });
|
|
15351
|
+
return (0, import_node_path40.join)(dir, `computer-use-${now}.png`);
|
|
15352
|
+
}
|
|
15353
|
+
function screenshotMessage(width, height, scale) {
|
|
15354
|
+
return `Screenshot saved (main display). Read that PNG. x and y are screen points from the top-left of this image, not PNG pixels. Divide a pixel by scale ${scale}. Point size is ${width}\xD7${height}. Judge behavior and visual design: hierarchy, alignment, spacing, type, contrast, and fit with the surrounding surface.`;
|
|
15355
|
+
}
|
|
15356
|
+
async function performComputerUse(opts) {
|
|
15357
|
+
if (!opts.enabled) return { ok: false, error: COMPUTER_USE_OFF };
|
|
15358
|
+
const rec = asRecord6(opts.input);
|
|
15359
|
+
const action = typeof rec.action === "string" ? rec.action : "";
|
|
15360
|
+
try {
|
|
15361
|
+
if (action === "screenshot") {
|
|
15362
|
+
const file = screenshotFile(opts.cwd, opts.now ?? Date.now());
|
|
15363
|
+
const captured = await opts.runner.screenshot(file);
|
|
15364
|
+
const geo = pointGeometry(captured);
|
|
15365
|
+
return {
|
|
15366
|
+
ok: true,
|
|
15367
|
+
action,
|
|
15368
|
+
path: file,
|
|
15369
|
+
width: geo.width,
|
|
15370
|
+
height: geo.height,
|
|
15371
|
+
scale: geo.scale,
|
|
15372
|
+
message: screenshotMessage(geo.width, geo.height, geo.scale)
|
|
15373
|
+
};
|
|
15374
|
+
}
|
|
15375
|
+
if (action === "click") {
|
|
15376
|
+
const x = finite(rec.x);
|
|
15377
|
+
const y = finite(rec.y);
|
|
15378
|
+
if (x === null || y === null) return { ok: false, error: "click requires finite x and y" };
|
|
15379
|
+
const px = point(x);
|
|
15380
|
+
const py = point(y);
|
|
15381
|
+
if (px === null || py === null) return { ok: false, error: "click point is out of range" };
|
|
15382
|
+
await opts.runner.runAppleScript(
|
|
15383
|
+
`tell application "System Events" to click at {${px}, ${py}}`
|
|
15384
|
+
);
|
|
15385
|
+
return { ok: true, action, message: `Clicked ${px}, ${py}.` };
|
|
15386
|
+
}
|
|
15387
|
+
if (action === "type") {
|
|
15388
|
+
const text8 = typeof rec.text === "string" ? rec.text : "";
|
|
15389
|
+
if (!text8) return { ok: false, error: "type requires text" };
|
|
15390
|
+
if (text8.length > 2e3) return { ok: false, error: "type text is longer than 2000 characters" };
|
|
15391
|
+
for (const script of typeScripts(text8)) {
|
|
15392
|
+
await opts.runner.runAppleScript(script);
|
|
15393
|
+
}
|
|
15394
|
+
return { ok: true, action, message: `Typed ${text8.length} characters.` };
|
|
15395
|
+
}
|
|
15396
|
+
if (action === "key") {
|
|
15397
|
+
const key = typeof rec.key === "string" ? rec.key.trim().toLowerCase() : "";
|
|
15398
|
+
const modifiers = Array.isArray(rec.modifiers) ? rec.modifiers.filter((item) => typeof item === "string") : [];
|
|
15399
|
+
if (!key) return { ok: false, error: "key requires key" };
|
|
15400
|
+
if (modifiers.some((name) => !MODIFIERS.has(name.toLowerCase()))) {
|
|
15401
|
+
return { ok: false, error: "key modifiers are command, shift, option, and control" };
|
|
15402
|
+
}
|
|
15403
|
+
const using = modifierClause(modifiers.map((name) => name.toLowerCase()));
|
|
15404
|
+
const code = KEY_CODES[key];
|
|
15405
|
+
const script = code !== void 0 ? `tell application "System Events" to key code ${code}${using}` : key.length === 1 ? `tell application "System Events" to keystroke ${appleScriptString(key)}${using}` : "";
|
|
15406
|
+
if (!script) return { ok: false, error: `unsupported key ${key}` };
|
|
15407
|
+
await opts.runner.runAppleScript(script);
|
|
15408
|
+
return { ok: true, action, message: `Pressed ${key}.` };
|
|
15409
|
+
}
|
|
15410
|
+
if (action === "scroll") {
|
|
15411
|
+
const x = finite(rec.x);
|
|
15412
|
+
const y = finite(rec.y);
|
|
15413
|
+
if (x === null || y === null) return { ok: false, error: "scroll requires finite x and y" };
|
|
15414
|
+
const px = point(x);
|
|
15415
|
+
const py = point(y);
|
|
15416
|
+
if (px === null || py === null) return { ok: false, error: "scroll point is out of range" };
|
|
15417
|
+
const dx = finite(rec.dx) ?? 0;
|
|
15418
|
+
const dy = finite(rec.dy) ?? 0;
|
|
15419
|
+
const sdx = scrollDelta(dx);
|
|
15420
|
+
const sdy = scrollDelta(dy);
|
|
15421
|
+
if (sdx === null || sdy === null) return { ok: false, error: "scroll delta is out of range" };
|
|
15422
|
+
if (sdx === 0 && sdy === 0) return { ok: false, error: "scroll requires dx or dy" };
|
|
15423
|
+
await opts.runner.scroll(px, py, sdx, sdy);
|
|
15424
|
+
return {
|
|
15425
|
+
ok: true,
|
|
15426
|
+
action,
|
|
15427
|
+
message: `Scrolled at ${px}, ${py} by ${sdx}, ${sdy}. Positive dx is right, positive dy is down.`
|
|
15428
|
+
};
|
|
15429
|
+
}
|
|
15430
|
+
return { ok: false, error: "action must be screenshot, click, type, key, or scroll" };
|
|
15431
|
+
} catch (err) {
|
|
15432
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
15433
|
+
return { ok: false, error: message };
|
|
15434
|
+
}
|
|
15435
|
+
}
|
|
15436
|
+
function formatComputerUseHint(enabled) {
|
|
15437
|
+
if (!enabled) {
|
|
15438
|
+
return "Computer use is off (Settings \u2192 Advanced). Say the visual pass was not seen.";
|
|
15439
|
+
}
|
|
15440
|
+
return "Computer use is on. Screenshot returns scale; x and y are screen points (divide a PNG pixel by scale). Scroll is a wheel event at that point.";
|
|
15441
|
+
}
|
|
15442
|
+
var import_node_child_process5, import_node_fs38, import_node_os19, import_node_path40, import_node_util, execFileAsync, COMPUTER_USE_OFF, COMPUTER_USE_DESCRIPTION, KEY_CODES, MODIFIERS, PNG_SIG, macosComputerUseRunner;
|
|
15443
|
+
var init_computer_use = __esm({
|
|
15444
|
+
"src/computer-use/computer-use.ts"() {
|
|
15445
|
+
"use strict";
|
|
15446
|
+
import_node_child_process5 = require("child_process");
|
|
15447
|
+
import_node_fs38 = require("fs");
|
|
15448
|
+
import_node_os19 = require("os");
|
|
15449
|
+
import_node_path40 = require("path");
|
|
15450
|
+
import_node_util = require("util");
|
|
15451
|
+
execFileAsync = (0, import_node_util.promisify)(import_node_child_process5.execFile);
|
|
15452
|
+
COMPUTER_USE_OFF = "Computer use is off. Turn it on in Settings \u2192 Advanced.";
|
|
15453
|
+
COMPUTER_USE_DESCRIPTION = "Drive this Mac to test an app you started. Off unless Settings \u2192 Advanced \u2192 Computer use is on. action is screenshot, click, type, key, or scroll. screenshot writes a PNG of the main display under the worktree .context/cli/ and returns that path plus point width, height, and scale. Read the image. x and y are screen points from the top-left of that image, not PNG pixels: divide a pixel by scale. click and scroll use those points. scroll posts a wheel event at the point (positive dx is right, positive dy is down). type sends text. key is one key (return, tab, escape, arrows, delete, or one character) with optional modifiers command, shift, option, control. Use it to check behavior and visual design (hierarchy, alignment, spacing, type, contrast, fit with the surrounding surface). preview=window means the Electron window, not a browser tab. Sideboard needs Accessibility and Screen Recording permission. Do not drive an app you did not start for this test.";
|
|
15454
|
+
KEY_CODES = {
|
|
15455
|
+
return: 36,
|
|
15456
|
+
enter: 36,
|
|
15457
|
+
tab: 48,
|
|
15458
|
+
escape: 53,
|
|
15459
|
+
esc: 53,
|
|
15460
|
+
delete: 51,
|
|
15461
|
+
backspace: 51,
|
|
15462
|
+
forwarddelete: 117,
|
|
15463
|
+
left: 123,
|
|
15464
|
+
right: 124,
|
|
15465
|
+
down: 125,
|
|
15466
|
+
up: 126
|
|
15467
|
+
};
|
|
15468
|
+
MODIFIERS = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
|
|
15469
|
+
PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
15470
|
+
macosComputerUseRunner = {
|
|
15471
|
+
async screenshot(file) {
|
|
15472
|
+
await execFileAsync("screencapture", ["-x", "-m", file]);
|
|
15473
|
+
return pngPointSize((0, import_node_fs38.readFileSync)(file));
|
|
15474
|
+
},
|
|
15475
|
+
async runAppleScript(script) {
|
|
15476
|
+
await execFileAsync("osascript", ["-e", script]);
|
|
15477
|
+
},
|
|
15478
|
+
async scroll(x, y, dx, dy) {
|
|
15479
|
+
await execFileAsync("swift", ["-e", scrollWheelSwift(x, y, dx, dy)]);
|
|
15480
|
+
}
|
|
15481
|
+
};
|
|
15482
|
+
}
|
|
15483
|
+
});
|
|
15484
|
+
|
|
15245
15485
|
// src/agent-rpc/client.ts
|
|
15246
15486
|
var import_ws;
|
|
15247
15487
|
var init_client = __esm({
|
|
@@ -15258,16 +15498,19 @@ var PILOT_TOOL_NAMES, PILOT_TOOL_DESCRIPTIONS;
|
|
|
15258
15498
|
var init_pilot_tools = __esm({
|
|
15259
15499
|
"src/agent-rpc/pilot-tools.ts"() {
|
|
15260
15500
|
"use strict";
|
|
15501
|
+
init_computer_use();
|
|
15261
15502
|
init_client();
|
|
15262
15503
|
PILOT_TOOL_NAMES = [
|
|
15263
15504
|
"present_artifact",
|
|
15264
15505
|
"wait_for_job",
|
|
15265
|
-
"stop_job"
|
|
15506
|
+
"stop_job",
|
|
15507
|
+
"computer_use"
|
|
15266
15508
|
];
|
|
15267
15509
|
PILOT_TOOL_DESCRIPTIONS = {
|
|
15268
15510
|
present_artifact: "Show a document or live log in Sideboard\u2019s side column. For html/svg/markdown/react, pass the FULL document and do not also fence that same body in chat. For type=log, pass only NEW lines (same artifact_id appends). Prefer type=log for long-running job output \u2014 do not resend HTML. type=react is a single default-export component (JSX/TSX); only react/react-dom imports.",
|
|
15269
15511
|
wait_for_job: "Wait until a detached long job (tests, pack, deploy, connector CLI) finishes. This call stays open for up to ~2 minutes. stillRunning true means the runtime hit the max hold; call wait_for_job again immediately. If the job is hanging, producing no useful output, or doing the wrong thing, call stop_job instead. Do not end the turn or tell the user you will let them know later.",
|
|
15270
|
-
stop_job: "Stop a detached job you started with detached-job.cjs when it is hanging, producing no useful output, buffering forever, or doing the wrong thing (wrong project, infinite watch, huge dump). Do not stop a pack/test/deploy that is clearly making progress."
|
|
15512
|
+
stop_job: "Stop a detached job you started with detached-job.cjs when it is hanging, producing no useful output, buffering forever, or doing the wrong thing (wrong project, infinite watch, huge dump). Do not stop a pack/test/deploy that is clearly making progress.",
|
|
15513
|
+
computer_use: COMPUTER_USE_DESCRIPTION
|
|
15271
15514
|
};
|
|
15272
15515
|
}
|
|
15273
15516
|
});
|
|
@@ -15286,11 +15529,11 @@ function entryDir2() {
|
|
|
15286
15529
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
15287
15530
|
if (cjsDir) return cjsDir;
|
|
15288
15531
|
try {
|
|
15289
|
-
return (0,
|
|
15532
|
+
return (0, import_node_path41.dirname)((0, import_node_url3.fileURLToPath)(import_meta6.url));
|
|
15290
15533
|
} catch {
|
|
15291
15534
|
try {
|
|
15292
15535
|
const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
|
|
15293
|
-
return (0,
|
|
15536
|
+
return (0, import_node_path41.dirname)(req.resolve("@sideboard-ai/core"));
|
|
15294
15537
|
} catch {
|
|
15295
15538
|
return process.cwd();
|
|
15296
15539
|
}
|
|
@@ -15299,20 +15542,20 @@ function entryDir2() {
|
|
|
15299
15542
|
function claudeRunnerPath() {
|
|
15300
15543
|
const packagedDir = packagedCursorRuntimeDir();
|
|
15301
15544
|
if (packagedDir) {
|
|
15302
|
-
const packaged = (0,
|
|
15303
|
-
if ((0,
|
|
15545
|
+
const packaged = (0, import_node_path41.join)(packagedDir, "core-dist", "agents", "claude-runner.js");
|
|
15546
|
+
if ((0, import_node_fs39.existsSync)(packaged)) return packaged;
|
|
15304
15547
|
}
|
|
15305
15548
|
const root = entryDir2();
|
|
15306
15549
|
const candidates = [
|
|
15307
|
-
(0,
|
|
15308
|
-
(0,
|
|
15309
|
-
(0,
|
|
15310
|
-
(0,
|
|
15311
|
-
(0,
|
|
15312
|
-
(0,
|
|
15550
|
+
(0, import_node_path41.join)(root, "agents", "claude-runner.js"),
|
|
15551
|
+
(0, import_node_path41.join)(root, "agents", "claude-runner.cjs"),
|
|
15552
|
+
(0, import_node_path41.join)(root, "dist", "agents", "claude-runner.js"),
|
|
15553
|
+
(0, import_node_path41.join)(root, "dist", "agents", "claude-runner.cjs"),
|
|
15554
|
+
(0, import_node_path41.join)(root, "claude-runner.ts"),
|
|
15555
|
+
(0, import_node_path41.join)(root, "src", "agents", "claude-runner.ts")
|
|
15313
15556
|
];
|
|
15314
15557
|
for (const candidate of candidates) {
|
|
15315
|
-
if ((0,
|
|
15558
|
+
if ((0, import_node_fs39.existsSync)(candidate)) return candidate;
|
|
15316
15559
|
}
|
|
15317
15560
|
return candidates[0];
|
|
15318
15561
|
}
|
|
@@ -15336,13 +15579,13 @@ async function buildClaudeRpcTurnCommand(req) {
|
|
|
15336
15579
|
}
|
|
15337
15580
|
};
|
|
15338
15581
|
}
|
|
15339
|
-
var
|
|
15582
|
+
var import_node_fs39, import_node_module3, import_node_path41, import_node_url3, import_meta6;
|
|
15340
15583
|
var init_claude_host = __esm({
|
|
15341
15584
|
"src/agents/claude-host.ts"() {
|
|
15342
15585
|
"use strict";
|
|
15343
|
-
|
|
15586
|
+
import_node_fs39 = require("fs");
|
|
15344
15587
|
import_node_module3 = require("module");
|
|
15345
|
-
|
|
15588
|
+
import_node_path41 = require("path");
|
|
15346
15589
|
import_node_url3 = require("url");
|
|
15347
15590
|
init_protocol2();
|
|
15348
15591
|
init_pilot_tools();
|
|
@@ -15434,11 +15677,11 @@ function issueAttachmentWorktreePath(repoPath) {
|
|
|
15434
15677
|
return raw || process.cwd();
|
|
15435
15678
|
}
|
|
15436
15679
|
function ensureIssueAttachmentsDir(worktreePath) {
|
|
15437
|
-
const dir = (0,
|
|
15438
|
-
(0,
|
|
15439
|
-
const gi = (0,
|
|
15440
|
-
if (!(0,
|
|
15441
|
-
(0,
|
|
15680
|
+
const dir = (0, import_node_path42.join)(worktreePath, ATTACHMENTS_DIR);
|
|
15681
|
+
(0, import_node_fs40.mkdirSync)(dir, { recursive: true });
|
|
15682
|
+
const gi = (0, import_node_path42.join)(dir, ".gitignore");
|
|
15683
|
+
if (!(0, import_node_fs40.existsSync)(gi)) {
|
|
15684
|
+
(0, import_node_fs40.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
|
|
15442
15685
|
}
|
|
15443
15686
|
return dir;
|
|
15444
15687
|
}
|
|
@@ -15468,7 +15711,7 @@ function looksLikeFileUrl(url) {
|
|
|
15468
15711
|
function filenameFromUrl(url, fallback = "attachment") {
|
|
15469
15712
|
try {
|
|
15470
15713
|
const parsed = new URL(url);
|
|
15471
|
-
const last = decodeURIComponent((0,
|
|
15714
|
+
const last = decodeURIComponent((0, import_node_path42.basename)(parsed.pathname)).replace(/[/\\]/g, "_");
|
|
15472
15715
|
if (last && last !== "/" && last !== ".") return last;
|
|
15473
15716
|
} catch {
|
|
15474
15717
|
}
|
|
@@ -15490,12 +15733,12 @@ function filenameFromContentDisposition(header) {
|
|
|
15490
15733
|
}
|
|
15491
15734
|
function uniqueAttachmentFileName(dir, originalName) {
|
|
15492
15735
|
const safe = originalName.replace(/[/\\]/g, "_").replace(/^\.+/, "") || "file";
|
|
15493
|
-
if (!(0,
|
|
15494
|
-
const ext = (0,
|
|
15736
|
+
if (!(0, import_node_fs40.existsSync)((0, import_node_path42.join)(dir, safe))) return safe;
|
|
15737
|
+
const ext = (0, import_node_path42.extname)(safe);
|
|
15495
15738
|
const stem = ext ? safe.slice(0, -ext.length) : safe;
|
|
15496
15739
|
for (let i = 1; i < 1e4; i++) {
|
|
15497
15740
|
const candidate = `${stem}-${i}${ext}`;
|
|
15498
|
-
if (!(0,
|
|
15741
|
+
if (!(0, import_node_fs40.existsSync)((0, import_node_path42.join)(dir, candidate))) return candidate;
|
|
15499
15742
|
}
|
|
15500
15743
|
return `${stem}-${(0, import_node_crypto10.randomUUID)()}${ext}`;
|
|
15501
15744
|
}
|
|
@@ -15543,7 +15786,7 @@ function mergeIssueAttachments(items) {
|
|
|
15543
15786
|
return out;
|
|
15544
15787
|
}
|
|
15545
15788
|
function extensionForContentType(contentType, name) {
|
|
15546
|
-
if ((0,
|
|
15789
|
+
if ((0, import_node_path42.extname)(name)) return name;
|
|
15547
15790
|
const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
|
|
15548
15791
|
const ext = EXT_BY_MIME[mime];
|
|
15549
15792
|
return ext ? `${name}${ext}` : name;
|
|
@@ -15595,7 +15838,7 @@ async function downloadAuthenticatedFile(opts) {
|
|
|
15595
15838
|
const dir = ensureIssueAttachmentsDir(opts.worktreePath);
|
|
15596
15839
|
const hinted = opts.name?.trim() || filenameFromContentDisposition(res.headers.get("content-disposition")) || filenameFromUrl(url);
|
|
15597
15840
|
const name = uniqueAttachmentFileName(dir, extensionForContentType(contentType, hinted));
|
|
15598
|
-
(0,
|
|
15841
|
+
(0, import_node_fs40.writeFileSync)((0, import_node_path42.join)(dir, name), buf);
|
|
15599
15842
|
return {
|
|
15600
15843
|
name,
|
|
15601
15844
|
path: `${ATTACHMENTS_DIR}/${name}`,
|
|
@@ -15603,12 +15846,12 @@ async function downloadAuthenticatedFile(opts) {
|
|
|
15603
15846
|
...contentType ? { contentType } : {}
|
|
15604
15847
|
};
|
|
15605
15848
|
}
|
|
15606
|
-
var
|
|
15849
|
+
var import_node_fs40, import_node_path42, import_node_crypto10, ISSUE_ATTACHMENT_MAX_BYTES, MARKDOWN_IMAGE_RE, MARKDOWN_LINK_RE, HTML_SRC_RE, BARE_URL_RE, EXT_BY_MIME;
|
|
15607
15850
|
var init_issue_attachments = __esm({
|
|
15608
15851
|
"src/integrations/issue-attachments.ts"() {
|
|
15609
15852
|
"use strict";
|
|
15610
|
-
|
|
15611
|
-
|
|
15853
|
+
import_node_fs40 = require("fs");
|
|
15854
|
+
import_node_path42 = require("path");
|
|
15612
15855
|
import_node_crypto10 = require("crypto");
|
|
15613
15856
|
init_fetch();
|
|
15614
15857
|
init_workspace_scratch();
|
|
@@ -17261,12 +17504,12 @@ function compactMetadataFromClaude(obj) {
|
|
|
17261
17504
|
const postTokens = typeof post === "number" && Number.isFinite(post) && post > 0 ? Math.round(post) : void 0;
|
|
17262
17505
|
return { trigger, postTokens };
|
|
17263
17506
|
}
|
|
17264
|
-
var
|
|
17507
|
+
var import_node_fs41, import_node_path43, CLAUDE_PROMPT_ARG_MAX, claudeAdapter;
|
|
17265
17508
|
var init_claude = __esm({
|
|
17266
17509
|
"src/agents/claude.ts"() {
|
|
17267
17510
|
"use strict";
|
|
17268
|
-
|
|
17269
|
-
|
|
17511
|
+
import_node_fs41 = require("fs");
|
|
17512
|
+
import_node_path43 = require("path");
|
|
17270
17513
|
init_run();
|
|
17271
17514
|
init_app_settings();
|
|
17272
17515
|
init_claude_mcp_status();
|
|
@@ -17286,7 +17529,7 @@ var init_claude = __esm({
|
|
|
17286
17529
|
async detect() {
|
|
17287
17530
|
const claude = resolveClaudeExecutable();
|
|
17288
17531
|
if (claude !== "claude") {
|
|
17289
|
-
if (!(0,
|
|
17532
|
+
if (!(0, import_node_fs41.existsSync)(claude)) {
|
|
17290
17533
|
return {
|
|
17291
17534
|
agent: "claude",
|
|
17292
17535
|
installed: false,
|
|
@@ -17444,7 +17687,7 @@ ${hint}` : hint;
|
|
|
17444
17687
|
cwd: thread.worktreePath,
|
|
17445
17688
|
stdin: useStdin ? `${promptText}
|
|
17446
17689
|
` : void 0,
|
|
17447
|
-
...mcpConfigPath ? { cleanupDirs: [(0,
|
|
17690
|
+
...mcpConfigPath ? { cleanupDirs: [(0, import_node_path43.dirname)(mcpConfigPath)] } : {},
|
|
17448
17691
|
// Nested Task/Agent thinking+text in stream-json (Claude Code 2.1.211+).
|
|
17449
17692
|
// Raise the -p background-agent wait so long TaskOutput polls are not
|
|
17450
17693
|
// abandoned at Claude Code’s 10-minute default.
|
|
@@ -17624,7 +17867,7 @@ async function listCodexModels() {
|
|
|
17624
17867
|
if (codex === "codex") {
|
|
17625
17868
|
const which = await run("which", ["codex"], { reject: false });
|
|
17626
17869
|
if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
|
|
17627
|
-
} else if (!(0,
|
|
17870
|
+
} else if (!(0, import_node_fs42.existsSync)(codex)) {
|
|
17628
17871
|
return FALLBACK_CODEX_MODELS;
|
|
17629
17872
|
}
|
|
17630
17873
|
const listed = await run(codex, ["debug", "models"], { reject: false });
|
|
@@ -17661,7 +17904,7 @@ function usageFromCodex(usage, asContext = false) {
|
|
|
17661
17904
|
return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
|
|
17662
17905
|
}
|
|
17663
17906
|
function codexHomeDir() {
|
|
17664
|
-
return process.env.CODEX_HOME?.trim() || (0,
|
|
17907
|
+
return process.env.CODEX_HOME?.trim() || (0, import_node_path44.join)((0, import_node_os20.homedir)(), ".codex");
|
|
17665
17908
|
}
|
|
17666
17909
|
function unwrapCodexMcpResult(result) {
|
|
17667
17910
|
if (result == null) return void 0;
|
|
@@ -17683,28 +17926,28 @@ function unwrapCodexMcpResult(result) {
|
|
|
17683
17926
|
return String(result);
|
|
17684
17927
|
}
|
|
17685
17928
|
}
|
|
17686
|
-
function
|
|
17929
|
+
function asRecord7(value) {
|
|
17687
17930
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
17688
17931
|
return value;
|
|
17689
17932
|
}
|
|
17690
17933
|
return void 0;
|
|
17691
17934
|
}
|
|
17692
17935
|
function codexLooksAuthenticated() {
|
|
17693
|
-
const authPath = (0,
|
|
17694
|
-
if (!(0,
|
|
17936
|
+
const authPath = (0, import_node_path44.join)(codexHomeDir(), "auth.json");
|
|
17937
|
+
if (!(0, import_node_fs42.existsSync)(authPath)) return false;
|
|
17695
17938
|
try {
|
|
17696
|
-
return (0,
|
|
17939
|
+
return (0, import_node_fs42.statSync)(authPath).size > 2;
|
|
17697
17940
|
} catch {
|
|
17698
17941
|
return false;
|
|
17699
17942
|
}
|
|
17700
17943
|
}
|
|
17701
|
-
var
|
|
17944
|
+
var import_node_fs42, import_node_os20, import_node_path44, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
|
|
17702
17945
|
var init_codex = __esm({
|
|
17703
17946
|
"src/agents/codex.ts"() {
|
|
17704
17947
|
"use strict";
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
17948
|
+
import_node_fs42 = require("fs");
|
|
17949
|
+
import_node_os20 = require("os");
|
|
17950
|
+
import_node_path44 = require("path");
|
|
17708
17951
|
init_run();
|
|
17709
17952
|
init_app_settings();
|
|
17710
17953
|
init_global_workspace();
|
|
@@ -17733,7 +17976,7 @@ var init_codex = __esm({
|
|
|
17733
17976
|
async detect() {
|
|
17734
17977
|
const codex = resolveAgentExecutable("codex");
|
|
17735
17978
|
if (codex !== "codex") {
|
|
17736
|
-
if (!(0,
|
|
17979
|
+
if (!(0, import_node_fs42.existsSync)(codex)) {
|
|
17737
17980
|
return {
|
|
17738
17981
|
agent: "codex",
|
|
17739
17982
|
installed: false,
|
|
@@ -17765,7 +18008,7 @@ var init_codex = __esm({
|
|
|
17765
18008
|
authenticated,
|
|
17766
18009
|
linearMcp,
|
|
17767
18010
|
warnings,
|
|
17768
|
-
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${(0,
|
|
18011
|
+
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${(0, import_node_path44.join)(codexHomeDir(), "auth.json")})`
|
|
17769
18012
|
};
|
|
17770
18013
|
},
|
|
17771
18014
|
async buildTurn(thread, input) {
|
|
@@ -17873,7 +18116,7 @@ var init_codex = __esm({
|
|
|
17873
18116
|
}
|
|
17874
18117
|
if (itemType === "mcp_tool_call" && item.id && item.server && item.tool) {
|
|
17875
18118
|
const name = `mcp__${item.server}__${item.tool}`;
|
|
17876
|
-
const input =
|
|
18119
|
+
const input = asRecord7(item.arguments);
|
|
17877
18120
|
const events = [
|
|
17878
18121
|
{ type: "tool_use", id: item.id, name, input }
|
|
17879
18122
|
];
|
|
@@ -17997,18 +18240,18 @@ var init_codex = __esm({
|
|
|
17997
18240
|
// src/agents/cursor-sdk-resolve.ts
|
|
17998
18241
|
function thisModuleFile() {
|
|
17999
18242
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
18000
|
-
if (cjsDir) return (0,
|
|
18243
|
+
if (cjsDir) return (0, import_node_path45.join)(cjsDir, "cursor-sdk-resolve.js");
|
|
18001
18244
|
try {
|
|
18002
18245
|
return (0, import_node_url4.fileURLToPath)(import_meta7.url);
|
|
18003
18246
|
} catch {
|
|
18004
|
-
return (0,
|
|
18247
|
+
return (0, import_node_path45.join)(process.cwd(), "package.json");
|
|
18005
18248
|
}
|
|
18006
18249
|
}
|
|
18007
18250
|
function packageRootLooksLikeSdk(dir) {
|
|
18008
18251
|
try {
|
|
18009
|
-
const raw = (0,
|
|
18252
|
+
const raw = (0, import_node_fs43.readFileSync)((0, import_node_path45.join)(dir, "package.json"), "utf8");
|
|
18010
18253
|
const pkg = JSON.parse(raw);
|
|
18011
|
-
return pkg.name === "@cursor/sdk" && (0,
|
|
18254
|
+
return pkg.name === "@cursor/sdk" && (0, import_node_fs43.existsSync)(dir);
|
|
18012
18255
|
} catch {
|
|
18013
18256
|
return false;
|
|
18014
18257
|
}
|
|
@@ -18017,7 +18260,7 @@ function resolvedPackageRoot(fromFile) {
|
|
|
18017
18260
|
try {
|
|
18018
18261
|
const req = (0, import_node_module4.createRequire)(fromFile);
|
|
18019
18262
|
const pkgJson = req.resolve("@cursor/sdk/package.json");
|
|
18020
|
-
const root = (0,
|
|
18263
|
+
const root = (0, import_node_path45.dirname)(pkgJson);
|
|
18021
18264
|
return packageRootLooksLikeSdk(root) ? root : null;
|
|
18022
18265
|
} catch {
|
|
18023
18266
|
return null;
|
|
@@ -18031,10 +18274,10 @@ function resolveCursorSdkRoot(opts) {
|
|
|
18031
18274
|
}
|
|
18032
18275
|
const globalNm = npmGlobalNodeModules(env);
|
|
18033
18276
|
if (globalNm) {
|
|
18034
|
-
const globalRoot = (0,
|
|
18277
|
+
const globalRoot = (0, import_node_path45.join)(globalNm, "@cursor/sdk");
|
|
18035
18278
|
if (packageRootLooksLikeSdk(globalRoot)) return globalRoot;
|
|
18036
18279
|
}
|
|
18037
|
-
const cwdPkg = (0,
|
|
18280
|
+
const cwdPkg = (0, import_node_path45.join)(process.cwd(), "package.json");
|
|
18038
18281
|
return resolvedPackageRoot(thisModuleFile()) ?? resolvedPackageRoot(cwdPkg);
|
|
18039
18282
|
}
|
|
18040
18283
|
function isCursorSdkInstalled(opts) {
|
|
@@ -18050,13 +18293,13 @@ function exportTarget(value) {
|
|
|
18050
18293
|
}
|
|
18051
18294
|
function cursorSdkEsmEntry(root) {
|
|
18052
18295
|
try {
|
|
18053
|
-
const pkg = JSON.parse((0,
|
|
18296
|
+
const pkg = JSON.parse((0, import_node_fs43.readFileSync)((0, import_node_path45.join)(root, "package.json"), "utf8"));
|
|
18054
18297
|
const exp = pkg.exports;
|
|
18055
18298
|
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
18056
18299
|
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
18057
18300
|
if (!rel) return null;
|
|
18058
|
-
const entry = (0,
|
|
18059
|
-
return (0,
|
|
18301
|
+
const entry = (0, import_node_path45.join)(root, rel);
|
|
18302
|
+
return (0, import_node_fs43.existsSync)(entry) ? entry : null;
|
|
18060
18303
|
} catch {
|
|
18061
18304
|
return null;
|
|
18062
18305
|
}
|
|
@@ -18072,7 +18315,7 @@ async function importCursorSdk(opts) {
|
|
|
18072
18315
|
try {
|
|
18073
18316
|
let entry = cursorSdkEsmEntry(root);
|
|
18074
18317
|
if (!entry) {
|
|
18075
|
-
const req = (0, import_node_module4.createRequire)((0,
|
|
18318
|
+
const req = (0, import_node_module4.createRequire)((0, import_node_path45.join)(root, "package.json"));
|
|
18076
18319
|
entry = req.resolve("@cursor/sdk");
|
|
18077
18320
|
}
|
|
18078
18321
|
return unwrapCursorSdkModule(await import((0, import_node_url4.pathToFileURL)(entry).href));
|
|
@@ -18084,8 +18327,8 @@ function cursorSdkPlatformRipgrepPackage() {
|
|
|
18084
18327
|
return `@cursor/sdk-${process.platform}-${process.arch}`;
|
|
18085
18328
|
}
|
|
18086
18329
|
function nodeModulesDirForPackageRoot(packageRoot) {
|
|
18087
|
-
const parent = (0,
|
|
18088
|
-
return (0,
|
|
18330
|
+
const parent = (0, import_node_path45.dirname)(packageRoot);
|
|
18331
|
+
return (0, import_node_path45.basename)(parent).startsWith("@") ? (0, import_node_path45.dirname)(parent) : parent;
|
|
18089
18332
|
}
|
|
18090
18333
|
function cursorSdkRipgrepCandidate(opts) {
|
|
18091
18334
|
const root = resolveCursorSdkRoot(opts);
|
|
@@ -18093,18 +18336,18 @@ function cursorSdkRipgrepCandidate(opts) {
|
|
|
18093
18336
|
const nm = nodeModulesDirForPackageRoot(root);
|
|
18094
18337
|
const pkg = cursorSdkPlatformRipgrepPackage();
|
|
18095
18338
|
const bin = process.platform === "win32" ? "rg.exe" : "rg";
|
|
18096
|
-
const sibling = (0,
|
|
18097
|
-
if ((0,
|
|
18098
|
-
const nested = (0,
|
|
18099
|
-
return (0,
|
|
18339
|
+
const sibling = (0, import_node_path45.join)(nm, pkg, "bin", bin);
|
|
18340
|
+
if ((0, import_node_fs43.existsSync)(sibling)) return sibling;
|
|
18341
|
+
const nested = (0, import_node_path45.join)(root, "node_modules", pkg, "bin", bin);
|
|
18342
|
+
return (0, import_node_fs43.existsSync)(nested) ? nested : null;
|
|
18100
18343
|
}
|
|
18101
|
-
var
|
|
18344
|
+
var import_node_fs43, import_node_module4, import_node_path45, import_node_url4, import_meta7, CURSOR_SDK_INSTALL_HINT;
|
|
18102
18345
|
var init_cursor_sdk_resolve = __esm({
|
|
18103
18346
|
"src/agents/cursor-sdk-resolve.ts"() {
|
|
18104
18347
|
"use strict";
|
|
18105
|
-
|
|
18348
|
+
import_node_fs43 = require("fs");
|
|
18106
18349
|
import_node_module4 = require("module");
|
|
18107
|
-
|
|
18350
|
+
import_node_path45 = require("path");
|
|
18108
18351
|
import_node_url4 = require("url");
|
|
18109
18352
|
init_path();
|
|
18110
18353
|
import_meta7 = {};
|
|
@@ -18146,21 +18389,21 @@ function platformRipgrepPackage() {
|
|
|
18146
18389
|
}
|
|
18147
18390
|
function usableRipgrepPath(candidate) {
|
|
18148
18391
|
const raw = candidate?.trim();
|
|
18149
|
-
if (!raw || !(0,
|
|
18392
|
+
if (!raw || !(0, import_node_path46.isAbsolute)(raw)) return null;
|
|
18150
18393
|
const readable = nodeReadableScriptPath(raw);
|
|
18151
|
-
if (!(0,
|
|
18394
|
+
if (!(0, import_node_fs44.existsSync)(readable) || isAsarPath(readable)) return null;
|
|
18152
18395
|
return readable;
|
|
18153
18396
|
}
|
|
18154
18397
|
function walkForBundledRipgrep(startFile) {
|
|
18155
18398
|
if (!startFile) return null;
|
|
18156
18399
|
const pkg = platformRipgrepPackage();
|
|
18157
18400
|
const name = rgBinaryName();
|
|
18158
|
-
let dir = (0,
|
|
18159
|
-
const root = (0,
|
|
18401
|
+
let dir = (0, import_node_path46.dirname)((0, import_node_path46.resolve)(startFile));
|
|
18402
|
+
const root = (0, import_node_path46.parse)(dir).root;
|
|
18160
18403
|
while (dir !== root) {
|
|
18161
|
-
const hit = usableRipgrepPath((0,
|
|
18404
|
+
const hit = usableRipgrepPath((0, import_node_path46.join)(dir, "node_modules", pkg, "bin", name));
|
|
18162
18405
|
if (hit) return hit;
|
|
18163
|
-
const next = (0,
|
|
18406
|
+
const next = (0, import_node_path46.dirname)(dir);
|
|
18164
18407
|
if (next === dir) break;
|
|
18165
18408
|
dir = next;
|
|
18166
18409
|
}
|
|
@@ -18170,7 +18413,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
18170
18413
|
try {
|
|
18171
18414
|
const req = (0, import_node_module5.createRequire)(fromFile);
|
|
18172
18415
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
18173
|
-
return usableRipgrepPath((0,
|
|
18416
|
+
return usableRipgrepPath((0, import_node_path46.join)((0, import_node_path46.dirname)(pkgJson), "bin", rgBinaryName()));
|
|
18174
18417
|
} catch {
|
|
18175
18418
|
return null;
|
|
18176
18419
|
}
|
|
@@ -18192,13 +18435,13 @@ function cursorRipgrepEnv(opts) {
|
|
|
18192
18435
|
const path = resolveCursorRipgrepPath(opts);
|
|
18193
18436
|
return path ? { [RIPGREP_ENV]: path } : {};
|
|
18194
18437
|
}
|
|
18195
|
-
var
|
|
18438
|
+
var import_node_fs44, import_node_module5, import_node_path46, RIPGREP_ENV;
|
|
18196
18439
|
var init_cursor_ripgrep = __esm({
|
|
18197
18440
|
"src/agents/cursor-ripgrep.ts"() {
|
|
18198
18441
|
"use strict";
|
|
18199
|
-
|
|
18442
|
+
import_node_fs44 = require("fs");
|
|
18200
18443
|
import_node_module5 = require("module");
|
|
18201
|
-
|
|
18444
|
+
import_node_path46 = require("path");
|
|
18202
18445
|
init_cursor_sdk_resolve();
|
|
18203
18446
|
init_node_launch();
|
|
18204
18447
|
init_packaged_runtime();
|
|
@@ -18242,11 +18485,11 @@ function entryDir3() {
|
|
|
18242
18485
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
18243
18486
|
if (cjsDir) return cjsDir;
|
|
18244
18487
|
try {
|
|
18245
|
-
return (0,
|
|
18488
|
+
return (0, import_node_path47.dirname)((0, import_node_url5.fileURLToPath)(import_meta8.url));
|
|
18246
18489
|
} catch {
|
|
18247
18490
|
try {
|
|
18248
18491
|
const req = (0, import_node_module6.createRequire)(process.cwd() + "/");
|
|
18249
|
-
return (0,
|
|
18492
|
+
return (0, import_node_path47.dirname)(req.resolve("@sideboard-ai/core"));
|
|
18250
18493
|
} catch {
|
|
18251
18494
|
return process.cwd();
|
|
18252
18495
|
}
|
|
@@ -18257,27 +18500,27 @@ function cursorRunnerPath() {
|
|
|
18257
18500
|
if (packaged) return packaged;
|
|
18258
18501
|
const root = entryDir3();
|
|
18259
18502
|
const candidates = [
|
|
18260
|
-
(0,
|
|
18261
|
-
(0,
|
|
18503
|
+
(0, import_node_path47.join)(root, "agents", "cursor-runner.js"),
|
|
18504
|
+
(0, import_node_path47.join)(root, "agents", "cursor-runner.cjs"),
|
|
18262
18505
|
// If somehow resolved from package root instead of dist/
|
|
18263
|
-
(0,
|
|
18264
|
-
(0,
|
|
18506
|
+
(0, import_node_path47.join)(root, "dist", "agents", "cursor-runner.js"),
|
|
18507
|
+
(0, import_node_path47.join)(root, "dist", "agents", "cursor-runner.cjs"),
|
|
18265
18508
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
18266
|
-
(0,
|
|
18267
|
-
(0,
|
|
18509
|
+
(0, import_node_path47.join)(root, "cursor-runner.ts"),
|
|
18510
|
+
(0, import_node_path47.join)(root, "src", "agents", "cursor-runner.ts")
|
|
18268
18511
|
];
|
|
18269
18512
|
for (const candidate of candidates) {
|
|
18270
|
-
if ((0,
|
|
18513
|
+
if ((0, import_node_fs45.existsSync)(candidate)) return candidate;
|
|
18271
18514
|
}
|
|
18272
18515
|
return candidates[0];
|
|
18273
18516
|
}
|
|
18274
|
-
var
|
|
18517
|
+
var import_node_fs45, import_node_module6, import_node_path47, import_node_url5, import_meta8, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
|
|
18275
18518
|
var init_cursor = __esm({
|
|
18276
18519
|
"src/agents/cursor.ts"() {
|
|
18277
18520
|
"use strict";
|
|
18278
|
-
|
|
18521
|
+
import_node_fs45 = require("fs");
|
|
18279
18522
|
import_node_module6 = require("module");
|
|
18280
|
-
|
|
18523
|
+
import_node_path47 = require("path");
|
|
18281
18524
|
import_node_url5 = require("url");
|
|
18282
18525
|
init_run();
|
|
18283
18526
|
init_app_settings();
|
|
@@ -18404,26 +18647,26 @@ var init_cursor = __esm({
|
|
|
18404
18647
|
|
|
18405
18648
|
// src/agent-rpc/opencode-hook.ts
|
|
18406
18649
|
function writeOpencodeRpcPlugin() {
|
|
18407
|
-
const pluginDir = (0,
|
|
18408
|
-
(0,
|
|
18409
|
-
const pluginFile = (0,
|
|
18410
|
-
if ((0,
|
|
18650
|
+
const pluginDir = (0, import_node_path48.join)(appDataDir(), "agent-rpc", "opencode");
|
|
18651
|
+
(0, import_node_fs46.mkdirSync)(pluginDir, { recursive: true });
|
|
18652
|
+
const pluginFile = (0, import_node_path48.join)(pluginDir, "sideboard-rpc.js");
|
|
18653
|
+
if ((0, import_node_fs46.existsSync)(pluginFile)) {
|
|
18411
18654
|
try {
|
|
18412
|
-
if ((0,
|
|
18655
|
+
if ((0, import_node_fs46.readFileSync)(pluginFile, "utf8") === OPENCODE_PLUGIN_SOURCE) return pluginFile;
|
|
18413
18656
|
} catch {
|
|
18414
18657
|
}
|
|
18415
18658
|
}
|
|
18416
18659
|
const tmp = `${pluginFile}.${process.pid}.tmp`;
|
|
18417
|
-
(0,
|
|
18418
|
-
(0,
|
|
18660
|
+
(0, import_node_fs46.writeFileSync)(tmp, OPENCODE_PLUGIN_SOURCE);
|
|
18661
|
+
(0, import_node_fs46.renameSync)(tmp, pluginFile);
|
|
18419
18662
|
return pluginFile;
|
|
18420
18663
|
}
|
|
18421
|
-
var
|
|
18664
|
+
var import_node_fs46, import_node_path48, OPENCODE_PLUGIN_SOURCE;
|
|
18422
18665
|
var init_opencode_hook = __esm({
|
|
18423
18666
|
"src/agent-rpc/opencode-hook.ts"() {
|
|
18424
18667
|
"use strict";
|
|
18425
|
-
|
|
18426
|
-
|
|
18668
|
+
import_node_fs46 = require("fs");
|
|
18669
|
+
import_node_path48 = require("path");
|
|
18427
18670
|
init_paths();
|
|
18428
18671
|
init_pilot_tools();
|
|
18429
18672
|
init_protocol2();
|
|
@@ -18531,6 +18774,22 @@ export const SideboardRpc = async (ctx) => {
|
|
|
18531
18774
|
return job("job.stop", args)
|
|
18532
18775
|
},
|
|
18533
18776
|
}),
|
|
18777
|
+
computer_use: tool({
|
|
18778
|
+
description: ${JSON.stringify(PILOT_TOOL_DESCRIPTIONS.computer_use)},
|
|
18779
|
+
args: {
|
|
18780
|
+
action: tool.schema.enum(["screenshot", "click", "type", "key", "scroll"]),
|
|
18781
|
+
x: tool.schema.number().optional().describe("Screen x in points, not PNG pixels"),
|
|
18782
|
+
y: tool.schema.number().optional().describe("Screen y in points, not PNG pixels"),
|
|
18783
|
+
text: opt("Text to type"),
|
|
18784
|
+
key: opt("One key: return, tab, escape, arrows, delete, or one character"),
|
|
18785
|
+
modifiers: tool.schema.array(tool.schema.string()).optional().describe("command, shift, option, control"),
|
|
18786
|
+
dx: tool.schema.number().optional().describe("Horizontal scroll in points. Positive is right"),
|
|
18787
|
+
dy: tool.schema.number().optional().describe("Vertical scroll in points. Positive is down"),
|
|
18788
|
+
},
|
|
18789
|
+
async execute(args) {
|
|
18790
|
+
return job("computer.act", args)
|
|
18791
|
+
},
|
|
18792
|
+
}),
|
|
18534
18793
|
},
|
|
18535
18794
|
}
|
|
18536
18795
|
}
|
|
@@ -18581,7 +18840,7 @@ var init_opencode_host = __esm({
|
|
|
18581
18840
|
});
|
|
18582
18841
|
|
|
18583
18842
|
// src/agents/opencode.ts
|
|
18584
|
-
function
|
|
18843
|
+
function asRecord8(value) {
|
|
18585
18844
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
18586
18845
|
return value;
|
|
18587
18846
|
}
|
|
@@ -18626,7 +18885,7 @@ async function listOpencodeModels() {
|
|
|
18626
18885
|
if (opencode === "opencode") {
|
|
18627
18886
|
const which = await run("which", ["opencode"], { reject: false });
|
|
18628
18887
|
if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
|
|
18629
|
-
} else if (!(0,
|
|
18888
|
+
} else if (!(0, import_node_fs47.existsSync)(opencode)) {
|
|
18630
18889
|
return FALLBACK_OPENCODE_MODELS;
|
|
18631
18890
|
}
|
|
18632
18891
|
const listed = await run(opencode, ["models"], { reject: false });
|
|
@@ -18656,11 +18915,11 @@ function usageFromOpencode(tokens) {
|
|
|
18656
18915
|
cacheWriteTokens: tokens.cache?.write ? Number(tokens.cache.write) : void 0
|
|
18657
18916
|
};
|
|
18658
18917
|
}
|
|
18659
|
-
var
|
|
18918
|
+
var import_node_fs47, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
|
|
18660
18919
|
var init_opencode = __esm({
|
|
18661
18920
|
"src/agents/opencode.ts"() {
|
|
18662
18921
|
"use strict";
|
|
18663
|
-
|
|
18922
|
+
import_node_fs47 = require("fs");
|
|
18664
18923
|
init_run();
|
|
18665
18924
|
init_app_settings();
|
|
18666
18925
|
init_error_detail();
|
|
@@ -18686,7 +18945,7 @@ var init_opencode = __esm({
|
|
|
18686
18945
|
async detect() {
|
|
18687
18946
|
const opencode = resolveAgentExecutable("opencode");
|
|
18688
18947
|
if (opencode !== "opencode") {
|
|
18689
|
-
if (!(0,
|
|
18948
|
+
if (!(0, import_node_fs47.existsSync)(opencode)) {
|
|
18690
18949
|
return {
|
|
18691
18950
|
agent: "opencode",
|
|
18692
18951
|
installed: false,
|
|
@@ -18786,7 +19045,7 @@ var init_opencode = __esm({
|
|
|
18786
19045
|
const name = part?.tool ?? part?.name ?? obj.tool ?? obj.name ?? "tool";
|
|
18787
19046
|
const state = part?.state;
|
|
18788
19047
|
const input = (state?.input && typeof state.input === "object" ? state.input : void 0) ?? part?.input ?? obj.input;
|
|
18789
|
-
const metadata =
|
|
19048
|
+
const metadata = asRecord8(state?.metadata);
|
|
18790
19049
|
const id = opencodeToolId(
|
|
18791
19050
|
name,
|
|
18792
19051
|
part?.callID ?? part?.id ?? obj.id,
|
|
@@ -18821,7 +19080,7 @@ var init_opencode = __esm({
|
|
|
18821
19080
|
}
|
|
18822
19081
|
if (obj.type === "subtask_event") {
|
|
18823
19082
|
const parentId = str3(obj.childSessionID) ?? str3(obj.childSessionId);
|
|
18824
|
-
const part =
|
|
19083
|
+
const part = asRecord8(obj.part);
|
|
18825
19084
|
if (!parentId || !part) return null;
|
|
18826
19085
|
if (part.type === "text" && str3(part.text)) {
|
|
18827
19086
|
return withTaskParent(
|
|
@@ -18832,8 +19091,8 @@ var init_opencode = __esm({
|
|
|
18832
19091
|
if (part.type === "tool" || str3(part.tool)) {
|
|
18833
19092
|
const name = str3(part.tool) ?? str3(part.name) ?? "tool";
|
|
18834
19093
|
const id = str3(part.callID) ?? str3(part.id) ?? `${parentId}-${name}`;
|
|
18835
|
-
const state =
|
|
18836
|
-
const input =
|
|
19094
|
+
const state = asRecord8(part.state);
|
|
19095
|
+
const input = asRecord8(state?.input) ?? asRecord8(part.input);
|
|
18837
19096
|
const nested = [
|
|
18838
19097
|
withEventParentId({ type: "tool_use", id, name, input }, parentId)
|
|
18839
19098
|
];
|
|
@@ -19276,21 +19535,21 @@ async function resolveCliAfterNpmInstall(cliBin) {
|
|
|
19276
19535
|
if (prefix.exitCode !== 0) return null;
|
|
19277
19536
|
const root = prefix.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.startsWith("/")).pop();
|
|
19278
19537
|
if (!root) return null;
|
|
19279
|
-
const candidate = (0,
|
|
19280
|
-
if (!(0,
|
|
19538
|
+
const candidate = (0, import_node_path49.join)(root, "bin", cliBin);
|
|
19539
|
+
if (!(0, import_node_fs48.existsSync)(candidate)) return null;
|
|
19281
19540
|
try {
|
|
19282
|
-
(0,
|
|
19541
|
+
(0, import_node_fs48.chmodSync)(candidate, 493);
|
|
19283
19542
|
} catch {
|
|
19284
19543
|
}
|
|
19285
19544
|
enrichPathWithNpmGlobalBin();
|
|
19286
19545
|
return whichOnPath(cliBin);
|
|
19287
19546
|
}
|
|
19288
|
-
var
|
|
19547
|
+
var import_node_fs48, import_node_path49;
|
|
19289
19548
|
var init_install = __esm({
|
|
19290
19549
|
"src/agents/install.ts"() {
|
|
19291
19550
|
"use strict";
|
|
19292
|
-
|
|
19293
|
-
|
|
19551
|
+
import_node_fs48 = require("fs");
|
|
19552
|
+
import_node_path49 = require("path");
|
|
19294
19553
|
init_run();
|
|
19295
19554
|
init_app_settings();
|
|
19296
19555
|
init_acp_harness();
|
|
@@ -19400,7 +19659,7 @@ function isAgentHostEnvKey(key) {
|
|
|
19400
19659
|
}
|
|
19401
19660
|
function stripHostToolingPath(pathValue) {
|
|
19402
19661
|
if (!pathValue?.trim()) return "";
|
|
19403
|
-
return pathValue.split(
|
|
19662
|
+
return pathValue.split(import_node_path50.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path50.delimiter);
|
|
19404
19663
|
}
|
|
19405
19664
|
function sanitizeAgentHostEnv(env, cwd) {
|
|
19406
19665
|
for (const key of Object.keys(env)) {
|
|
@@ -19414,11 +19673,11 @@ function sanitizeAgentHostEnv(env, cwd) {
|
|
|
19414
19673
|
}
|
|
19415
19674
|
return env;
|
|
19416
19675
|
}
|
|
19417
|
-
var
|
|
19676
|
+
var import_node_path50, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
|
|
19418
19677
|
var init_agent_host_env = __esm({
|
|
19419
19678
|
"src/hook/agent-host-env.ts"() {
|
|
19420
19679
|
"use strict";
|
|
19421
|
-
|
|
19680
|
+
import_node_path50 = require("path");
|
|
19422
19681
|
DROP_EXACT = /* @__PURE__ */ new Set([
|
|
19423
19682
|
"NODE_PATH",
|
|
19424
19683
|
"NODE_ENV_ELECTRON_VITE",
|
|
@@ -19457,15 +19716,15 @@ var init_agent_host_env = __esm({
|
|
|
19457
19716
|
|
|
19458
19717
|
// src/hook/worktree-pkg-cache.ts
|
|
19459
19718
|
function worktreePkgCacheRoot(worktreePath) {
|
|
19460
|
-
return (0,
|
|
19719
|
+
return (0, import_node_path51.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
|
|
19461
19720
|
}
|
|
19462
19721
|
function worktreePkgCacheEnv(worktreePath) {
|
|
19463
19722
|
const root = worktreePkgCacheRoot(worktreePath);
|
|
19464
|
-
const store = (0,
|
|
19465
|
-
const pnpmCache = (0,
|
|
19466
|
-
const npmCache = (0,
|
|
19467
|
-
const nodeGyp = (0,
|
|
19468
|
-
const electron = (0,
|
|
19723
|
+
const store = (0, import_node_path51.join)(root, "pnpm-store");
|
|
19724
|
+
const pnpmCache = (0, import_node_path51.join)(root, "pnpm");
|
|
19725
|
+
const npmCache = (0, import_node_path51.join)(root, "npm");
|
|
19726
|
+
const nodeGyp = (0, import_node_path51.join)(root, "node-gyp");
|
|
19727
|
+
const electron = (0, import_node_path51.join)(root, "electron");
|
|
19469
19728
|
return {
|
|
19470
19729
|
npm_config_store_dir: store,
|
|
19471
19730
|
PNPM_STORE_DIR: store,
|
|
@@ -19487,8 +19746,8 @@ function fillGroup(env, keys, values) {
|
|
|
19487
19746
|
}
|
|
19488
19747
|
}
|
|
19489
19748
|
function ensureWorktreePkgCacheDirs(worktreePath) {
|
|
19490
|
-
if (!(0,
|
|
19491
|
-
(0,
|
|
19749
|
+
if (!(0, import_node_fs49.existsSync)(worktreePath)) return;
|
|
19750
|
+
(0, import_node_fs49.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
|
|
19492
19751
|
}
|
|
19493
19752
|
function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
19494
19753
|
const cwd = worktreePath.trim();
|
|
@@ -19501,12 +19760,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
|
19501
19760
|
fillGroup(env, ["electron_config_cache"], next);
|
|
19502
19761
|
ensureWorktreePkgCacheDirs(cwd);
|
|
19503
19762
|
}
|
|
19504
|
-
var
|
|
19763
|
+
var import_node_fs49, import_node_path51, WORKTREE_PKG_CACHE_REL;
|
|
19505
19764
|
var init_worktree_pkg_cache = __esm({
|
|
19506
19765
|
"src/hook/worktree-pkg-cache.ts"() {
|
|
19507
19766
|
"use strict";
|
|
19508
|
-
|
|
19509
|
-
|
|
19767
|
+
import_node_fs49 = require("fs");
|
|
19768
|
+
import_node_path51 = require("path");
|
|
19510
19769
|
WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
|
|
19511
19770
|
}
|
|
19512
19771
|
});
|
|
@@ -19766,7 +20025,7 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
19766
20025
|
}).finally(() => {
|
|
19767
20026
|
for (const dir of cmd.cleanupDirs ?? []) {
|
|
19768
20027
|
try {
|
|
19769
|
-
(0,
|
|
20028
|
+
(0, import_node_fs50.rmSync)(dir, { recursive: true, force: true });
|
|
19770
20029
|
} catch {
|
|
19771
20030
|
}
|
|
19772
20031
|
}
|
|
@@ -19800,11 +20059,11 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
19800
20059
|
done
|
|
19801
20060
|
};
|
|
19802
20061
|
}
|
|
19803
|
-
var
|
|
20062
|
+
var import_node_fs50, import_node_readline2, import_execa3;
|
|
19804
20063
|
var init_spawn = __esm({
|
|
19805
20064
|
"src/agents/spawn.ts"() {
|
|
19806
20065
|
"use strict";
|
|
19807
|
-
|
|
20066
|
+
import_node_fs50 = require("fs");
|
|
19808
20067
|
import_node_readline2 = require("readline");
|
|
19809
20068
|
import_execa3 = require("execa");
|
|
19810
20069
|
init_worktree();
|
|
@@ -20046,6 +20305,10 @@ function entireGitActionExpansion(action, base) {
|
|
|
20046
20305
|
return "This phrase is the explicit ask to merge this thread's Trail change with `entire trail merge`. Do not force-push main/master or merge locally into the main checkout. Do not use `gh`.";
|
|
20047
20306
|
}
|
|
20048
20307
|
}
|
|
20308
|
+
function worktreeHasAnnounceSkill(worktreePath) {
|
|
20309
|
+
const root = worktreePath?.trim();
|
|
20310
|
+
return !!root && (0, import_node_fs51.existsSync)((0, import_node_path52.join)(root, ".claude/skills/announce-on-x/SKILL.md"));
|
|
20311
|
+
}
|
|
20049
20312
|
function expandCanonicalGitRequest(prompt, opts) {
|
|
20050
20313
|
const trimmed = prompt.trim();
|
|
20051
20314
|
let action = null;
|
|
@@ -20079,6 +20342,9 @@ function expandCanonicalGitRequest(prompt, opts) {
|
|
|
20079
20342
|
expansion = forge === "cursor" ? "Investigate that failing check (`origin pr checks`, `origin pr watch`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given. Do not use `gh run`." : forge === "entire" ? "Investigate the blocking gate (`entire trail merge --dry-run`, `entire trail finding list`, `entire trail watch`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given. Do not use `gh run`." : "Investigate that failing check (`gh pr checks`, `gh run view --log-failed`), fix it, commit, and push. Loop only if a goal to keep going until it passes was given.";
|
|
20080
20343
|
}
|
|
20081
20344
|
if (!expansion) return prompt;
|
|
20345
|
+
if (action === "merge" && (!base || isMainishPrBase(base)) && worktreeHasAnnounceSkill(opts?.worktreePath)) {
|
|
20346
|
+
expansion = `${expansion} ${ANNOUNCE_AFTER_MERGE}`;
|
|
20347
|
+
}
|
|
20082
20348
|
if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
|
|
20083
20349
|
return `${trimmed}
|
|
20084
20350
|
|
|
@@ -20094,10 +20360,13 @@ function expansionPushes(action, prompt) {
|
|
|
20094
20360
|
if (action) return true;
|
|
20095
20361
|
return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
|
|
20096
20362
|
}
|
|
20097
|
-
var AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
|
|
20363
|
+
var import_node_fs51, import_node_path52, ANNOUNCE_AFTER_MERGE, AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
|
|
20098
20364
|
var init_agent_git_actions = __esm({
|
|
20099
20365
|
"src/git/agent-git-actions.ts"() {
|
|
20100
20366
|
"use strict";
|
|
20367
|
+
import_node_fs51 = require("fs");
|
|
20368
|
+
import_node_path52 = require("path");
|
|
20369
|
+
ANNOUNCE_AFTER_MERGE = "After that merge to the default branch succeeds, follow `.claude/skills/announce-on-x/SKILL.md` (`/announce-on-x`) before the turn ends. Post or skip each pull request that merge landed on the default branch. Do not schedule a catch-up.";
|
|
20101
20370
|
AGENT_GIT_ACTIONS = [
|
|
20102
20371
|
"commit-push",
|
|
20103
20372
|
"create-draft",
|
|
@@ -21053,21 +21322,21 @@ function shouldRefreshReviewRequestTemplate(content) {
|
|
|
21053
21322
|
return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
|
|
21054
21323
|
}
|
|
21055
21324
|
function readTextIfPresent(abs) {
|
|
21056
|
-
if (!(0,
|
|
21325
|
+
if (!(0, import_node_fs52.existsSync)(abs)) return null;
|
|
21057
21326
|
try {
|
|
21058
|
-
const content = (0,
|
|
21327
|
+
const content = (0, import_node_fs52.readFileSync)(abs, "utf8");
|
|
21059
21328
|
return content.trim() ? content : null;
|
|
21060
21329
|
} catch {
|
|
21061
21330
|
return null;
|
|
21062
21331
|
}
|
|
21063
21332
|
}
|
|
21064
21333
|
function readLocalGuidelines(worktreePath) {
|
|
21065
|
-
const localAbs = (0,
|
|
21334
|
+
const localAbs = (0, import_node_path53.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
21066
21335
|
const localContent = readTextIfPresent(localAbs);
|
|
21067
21336
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
21068
21337
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
21069
21338
|
}
|
|
21070
|
-
const legacyAbs = (0,
|
|
21339
|
+
const legacyAbs = (0, import_node_path53.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
21071
21340
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
21072
21341
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
21073
21342
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -21091,27 +21360,27 @@ function contextGuidelines(content, source) {
|
|
|
21091
21360
|
};
|
|
21092
21361
|
}
|
|
21093
21362
|
function writeContextGuidelines(worktreePath, content) {
|
|
21094
|
-
const abs = (0,
|
|
21095
|
-
(0,
|
|
21363
|
+
const abs = (0, import_node_path53.join)(worktreePath, CONTEXT_REVIEW_PATH);
|
|
21364
|
+
(0, import_node_fs52.mkdirSync)((0, import_node_path53.dirname)(abs), { recursive: true });
|
|
21096
21365
|
const body = content.endsWith("\n") ? content : `${content}
|
|
21097
21366
|
`;
|
|
21098
|
-
(0,
|
|
21367
|
+
(0, import_node_fs52.writeFileSync)(abs, body, "utf8");
|
|
21099
21368
|
return body;
|
|
21100
21369
|
}
|
|
21101
21370
|
function readSideboardReview(worktreePath, repoPath) {
|
|
21102
|
-
const fromWorktree = readTextIfPresent((0,
|
|
21371
|
+
const fromWorktree = readTextIfPresent((0, import_node_path53.join)(worktreePath, REPO_REVIEW_PATH));
|
|
21103
21372
|
if (fromWorktree) return fromWorktree;
|
|
21104
21373
|
const repo = repoPath?.replace(/\/+$/, "");
|
|
21105
21374
|
const wt = worktreePath.replace(/\/+$/, "");
|
|
21106
21375
|
if (!repo || repo === wt) return null;
|
|
21107
|
-
return readTextIfPresent((0,
|
|
21376
|
+
return readTextIfPresent((0, import_node_path53.join)(repo, REPO_REVIEW_PATH));
|
|
21108
21377
|
}
|
|
21109
21378
|
function ensureReviewGuidelinesFile(worktreePath, repoPath) {
|
|
21110
|
-
const skillContent = readTextIfPresent((0,
|
|
21379
|
+
const skillContent = readTextIfPresent((0, import_node_path53.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
21111
21380
|
if (skillContent) {
|
|
21112
21381
|
return { ...skillGuidelines(skillContent, "skill"), wrote: false };
|
|
21113
21382
|
}
|
|
21114
|
-
const contextContent = readTextIfPresent((0,
|
|
21383
|
+
const contextContent = readTextIfPresent((0, import_node_path53.join)(worktreePath, CONTEXT_REVIEW_PATH));
|
|
21115
21384
|
if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
|
|
21116
21385
|
return { ...contextGuidelines(contextContent, "local"), wrote: false };
|
|
21117
21386
|
}
|
|
@@ -21187,13 +21456,13 @@ async function requestReview(threadRef, send) {
|
|
|
21187
21456
|
const started = await send(tab.id, REVIEW_REQUEST_PREFILL);
|
|
21188
21457
|
return { tab: started, from };
|
|
21189
21458
|
}
|
|
21190
|
-
var import_node_crypto13,
|
|
21459
|
+
var import_node_crypto13, import_node_fs52, import_node_path53, REPO_REVIEW_PATH, REPO_REVIEW_NAME, CONTEXT_REVIEW_PATH, REVIEW_REQUEST_PATH, LEGACY_REVIEW_REQUEST_PATH, REVIEW_REQUEST_NAME, REVIEW_REQUEST_PREFILL, LEGACY_REVIEW_TEMPLATE_MARKERS;
|
|
21191
21460
|
var init_request_review = __esm({
|
|
21192
21461
|
"src/review/request-review.ts"() {
|
|
21193
21462
|
"use strict";
|
|
21194
21463
|
import_node_crypto13 = require("crypto");
|
|
21195
|
-
|
|
21196
|
-
|
|
21464
|
+
import_node_fs52 = require("fs");
|
|
21465
|
+
import_node_path53 = require("path");
|
|
21197
21466
|
init_global_workspace();
|
|
21198
21467
|
init_chat_tabs();
|
|
21199
21468
|
init_thread_store();
|
|
@@ -21216,7 +21485,7 @@ var init_request_review = __esm({
|
|
|
21216
21485
|
|
|
21217
21486
|
// src/hook/worktree-run-ports.ts
|
|
21218
21487
|
function worktreeRunPortsPath(worktreePath) {
|
|
21219
|
-
return (0,
|
|
21488
|
+
return (0, import_node_path54.join)(worktreePath, RUN_PORTS_REL);
|
|
21220
21489
|
}
|
|
21221
21490
|
function isPort(value) {
|
|
21222
21491
|
return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= 65535;
|
|
@@ -21241,7 +21510,7 @@ function parseFile(raw) {
|
|
|
21241
21510
|
function readScripts(worktreePath) {
|
|
21242
21511
|
if (!worktreePath.trim()) return {};
|
|
21243
21512
|
try {
|
|
21244
|
-
const raw = (0,
|
|
21513
|
+
const raw = (0, import_node_fs53.readFileSync)(worktreeRunPortsPath(worktreePath), "utf8");
|
|
21245
21514
|
return parseFile(raw).scripts ?? {};
|
|
21246
21515
|
} catch {
|
|
21247
21516
|
return {};
|
|
@@ -21268,22 +21537,22 @@ function saveWorktreeRunPorts(worktreePath, scriptName, ports) {
|
|
|
21268
21537
|
const path = worktreeRunPortsPath(worktreePath);
|
|
21269
21538
|
let current = {};
|
|
21270
21539
|
try {
|
|
21271
|
-
current = parseFile((0,
|
|
21540
|
+
current = parseFile((0, import_node_fs53.readFileSync)(path, "utf8"));
|
|
21272
21541
|
} catch {
|
|
21273
21542
|
current = {};
|
|
21274
21543
|
}
|
|
21275
21544
|
const scripts = { ...current.scripts ?? {} };
|
|
21276
21545
|
scripts[scriptName] = cleaned;
|
|
21277
|
-
(0,
|
|
21278
|
-
(0,
|
|
21546
|
+
(0, import_node_fs53.mkdirSync)((0, import_node_path54.dirname)(path), { recursive: true });
|
|
21547
|
+
(0, import_node_fs53.writeFileSync)(path, `${JSON.stringify({ scripts }, null, 2)}
|
|
21279
21548
|
`, "utf8");
|
|
21280
21549
|
}
|
|
21281
|
-
var
|
|
21550
|
+
var import_node_fs53, import_node_path54, RUN_PORTS_REL;
|
|
21282
21551
|
var init_worktree_run_ports = __esm({
|
|
21283
21552
|
"src/hook/worktree-run-ports.ts"() {
|
|
21284
21553
|
"use strict";
|
|
21285
|
-
|
|
21286
|
-
|
|
21554
|
+
import_node_fs53 = require("fs");
|
|
21555
|
+
import_node_path54 = require("path");
|
|
21287
21556
|
RUN_PORTS_REL = ".context/.sideboard/run-ports.json";
|
|
21288
21557
|
}
|
|
21289
21558
|
});
|
|
@@ -21381,24 +21650,24 @@ function sanitizeDetachedJobId(id) {
|
|
|
21381
21650
|
return s;
|
|
21382
21651
|
}
|
|
21383
21652
|
function readIntFile(file) {
|
|
21384
|
-
if (!(0,
|
|
21385
|
-
const n = Number.parseInt((0,
|
|
21653
|
+
if (!(0, import_node_fs54.existsSync)(file)) return null;
|
|
21654
|
+
const n = Number.parseInt((0, import_node_fs54.readFileSync)(file, "utf8").trim(), 10);
|
|
21386
21655
|
return Number.isInteger(n) ? n : null;
|
|
21387
21656
|
}
|
|
21388
21657
|
function jobDir(root, id, legacy = false) {
|
|
21389
|
-
return (0,
|
|
21658
|
+
return (0, import_node_path55.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
|
|
21390
21659
|
}
|
|
21391
21660
|
function resolveJobDir(root, id) {
|
|
21392
21661
|
const modern = jobDir(root, id, false);
|
|
21393
|
-
if ((0,
|
|
21662
|
+
if ((0, import_node_fs54.existsSync)(modern)) return modern;
|
|
21394
21663
|
const legacy = jobDir(root, id, true);
|
|
21395
|
-
if ((0,
|
|
21664
|
+
if ((0, import_node_fs54.existsSync)(legacy)) return legacy;
|
|
21396
21665
|
return modern;
|
|
21397
21666
|
}
|
|
21398
21667
|
function listJobIdsIn(root, rel) {
|
|
21399
|
-
const dir = (0,
|
|
21400
|
-
if (!(0,
|
|
21401
|
-
return (0,
|
|
21668
|
+
const dir = (0, import_node_path55.join)(root, rel);
|
|
21669
|
+
if (!(0, import_node_fs54.existsSync)(dir)) return [];
|
|
21670
|
+
return (0, import_node_fs54.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
|
|
21402
21671
|
}
|
|
21403
21672
|
function listRunningDetachedJobs(worktreePath) {
|
|
21404
21673
|
const root = worktreePath.trim();
|
|
@@ -21410,7 +21679,7 @@ function listRunningDetachedJobs(worktreePath) {
|
|
|
21410
21679
|
const running = [];
|
|
21411
21680
|
for (const id of ids) {
|
|
21412
21681
|
const dir = resolveJobDir(root, id);
|
|
21413
|
-
const pid = readIntFile((0,
|
|
21682
|
+
const pid = readIntFile((0, import_node_path55.join)(dir, "pid"));
|
|
21414
21683
|
if (jobTreeAlive(pid)) running.push(id);
|
|
21415
21684
|
}
|
|
21416
21685
|
return running.sort();
|
|
@@ -21492,8 +21761,8 @@ function planJobContinue(opts) {
|
|
|
21492
21761
|
return { action: "none" };
|
|
21493
21762
|
}
|
|
21494
21763
|
function tailProgress(logFile, maxLines = 12) {
|
|
21495
|
-
if (!(0,
|
|
21496
|
-
const lines = (0,
|
|
21764
|
+
if (!(0, import_node_fs54.existsSync)(logFile)) return "(no log yet)";
|
|
21765
|
+
const lines = (0, import_node_fs54.readFileSync)(logFile, "utf8").split("\n");
|
|
21497
21766
|
return lines.slice(-maxLines).join("\n");
|
|
21498
21767
|
}
|
|
21499
21768
|
function lastProgressLine(progress) {
|
|
@@ -21501,8 +21770,8 @@ function lastProgressLine(progress) {
|
|
|
21501
21770
|
return last ? last.slice(0, 72) : void 0;
|
|
21502
21771
|
}
|
|
21503
21772
|
function readLogLines(file) {
|
|
21504
|
-
if (!(0,
|
|
21505
|
-
const lines = (0,
|
|
21773
|
+
if (!(0, import_node_fs54.existsSync)(file)) return [];
|
|
21774
|
+
const lines = (0, import_node_fs54.readFileSync)(file, "utf8").split("\n");
|
|
21506
21775
|
if (lines.length && lines[lines.length - 1] === "") lines.pop();
|
|
21507
21776
|
return lines;
|
|
21508
21777
|
}
|
|
@@ -21513,15 +21782,15 @@ function takeDelta(logFile, cursorFile) {
|
|
|
21513
21782
|
return { delta: capJobLogDelta(lines.slice(start).join("\n")), nextCursor: lines.length };
|
|
21514
21783
|
}
|
|
21515
21784
|
function snapshotJob(dir) {
|
|
21516
|
-
const pid = readIntFile((0,
|
|
21785
|
+
const pid = readIntFile((0, import_node_path55.join)(dir, "pid"));
|
|
21517
21786
|
const running = jobTreeAlive(pid);
|
|
21518
21787
|
return {
|
|
21519
21788
|
pid,
|
|
21520
21789
|
running,
|
|
21521
|
-
exitCode: readIntFile((0,
|
|
21522
|
-
log: (0,
|
|
21523
|
-
cursor: (0,
|
|
21524
|
-
progress: tailProgress((0,
|
|
21790
|
+
exitCode: readIntFile((0, import_node_path55.join)(dir, "exit")),
|
|
21791
|
+
log: (0, import_node_path55.join)(dir, "log"),
|
|
21792
|
+
cursor: (0, import_node_path55.join)(dir, "present.cursor"),
|
|
21793
|
+
progress: tailProgress((0, import_node_path55.join)(dir, "log"))
|
|
21525
21794
|
};
|
|
21526
21795
|
}
|
|
21527
21796
|
function toResult(id, snap, extra) {
|
|
@@ -21530,8 +21799,8 @@ function toResult(id, snap, extra) {
|
|
|
21530
21799
|
const stillRunning = snap.running && !ok;
|
|
21531
21800
|
const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
|
|
21532
21801
|
try {
|
|
21533
|
-
(0,
|
|
21534
|
-
(0,
|
|
21802
|
+
(0, import_node_fs54.mkdirSync)((0, import_node_path55.dirname)(snap.cursor), { recursive: true });
|
|
21803
|
+
(0, import_node_fs54.writeFileSync)(snap.cursor, `${nextCursor}
|
|
21535
21804
|
`);
|
|
21536
21805
|
} catch {
|
|
21537
21806
|
}
|
|
@@ -21560,7 +21829,7 @@ async function waitForDetachedJob(cwd, id, opts) {
|
|
|
21560
21829
|
const dir = resolveJobDir(root, jobId);
|
|
21561
21830
|
const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
|
|
21562
21831
|
const sleep = opts?.sleep ?? sleepMs;
|
|
21563
|
-
if (!(0,
|
|
21832
|
+
if (!(0, import_node_fs54.existsSync)(dir)) {
|
|
21564
21833
|
return {
|
|
21565
21834
|
stillRunning: false,
|
|
21566
21835
|
ok: false,
|
|
@@ -21606,10 +21875,10 @@ function killProcessTree(pid, signal) {
|
|
|
21606
21875
|
}
|
|
21607
21876
|
function appendJobLog(logFile, line) {
|
|
21608
21877
|
try {
|
|
21609
|
-
(0,
|
|
21878
|
+
(0, import_node_fs54.mkdirSync)((0, import_node_path55.dirname)(logFile), { recursive: true });
|
|
21610
21879
|
const body = line.endsWith("\n") ? line : `${line}
|
|
21611
21880
|
`;
|
|
21612
|
-
(0,
|
|
21881
|
+
(0, import_node_fs54.appendFileSync)(logFile, body);
|
|
21613
21882
|
} catch {
|
|
21614
21883
|
}
|
|
21615
21884
|
}
|
|
@@ -21619,7 +21888,7 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
21619
21888
|
const dir = resolveJobDir(root, jobId);
|
|
21620
21889
|
const sleep = opts?.sleep ?? sleepMs;
|
|
21621
21890
|
const why = opts?.reason?.trim() ?? "";
|
|
21622
|
-
if (!(0,
|
|
21891
|
+
if (!(0, import_node_fs54.existsSync)(dir)) {
|
|
21623
21892
|
return {
|
|
21624
21893
|
stillRunning: false,
|
|
21625
21894
|
ok: false,
|
|
@@ -21655,10 +21924,10 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
21655
21924
|
killProcessTree(targetPid, "SIGKILL");
|
|
21656
21925
|
await sleep(100);
|
|
21657
21926
|
}
|
|
21658
|
-
const exitFile = (0,
|
|
21659
|
-
if (!(0,
|
|
21927
|
+
const exitFile = (0, import_node_path55.join)(dir, "exit");
|
|
21928
|
+
if (!(0, import_node_fs54.existsSync)(exitFile)) {
|
|
21660
21929
|
try {
|
|
21661
|
-
(0,
|
|
21930
|
+
(0, import_node_fs54.writeFileSync)(exitFile, "1\n");
|
|
21662
21931
|
} catch {
|
|
21663
21932
|
}
|
|
21664
21933
|
}
|
|
@@ -21678,12 +21947,12 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
21678
21947
|
hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
|
|
21679
21948
|
};
|
|
21680
21949
|
}
|
|
21681
|
-
var
|
|
21950
|
+
var import_node_fs54, import_node_path55, MAX_JOB_CONTINUES, MAX_JOB_DELTA_LINES, MAX_JOB_DELTA_CHARS, GH_WATCH_REFRESH, MCP_WAIT_JOB_STILL_RUNNING_HINT, MCP_STOP_JOB_HINT, JOB_ID_RE;
|
|
21682
21951
|
var init_wait_for_job = __esm({
|
|
21683
21952
|
"src/mcp/wait-for-job.ts"() {
|
|
21684
21953
|
"use strict";
|
|
21685
|
-
|
|
21686
|
-
|
|
21954
|
+
import_node_fs54 = require("fs");
|
|
21955
|
+
import_node_path55 = require("path");
|
|
21687
21956
|
init_workspace_scratch();
|
|
21688
21957
|
init_job_process();
|
|
21689
21958
|
init_wait_for_turn();
|
|
@@ -21960,9 +22229,9 @@ function matchSimpleGlob(pattern, name) {
|
|
|
21960
22229
|
return new RegExp(`^${escaped}$`).test(name);
|
|
21961
22230
|
}
|
|
21962
22231
|
function readWorktreeInclude(repoPath) {
|
|
21963
|
-
const path = (0,
|
|
21964
|
-
if (!(0,
|
|
21965
|
-
return (0,
|
|
22232
|
+
const path = (0, import_node_path56.join)(repoPath, ".worktreeinclude");
|
|
22233
|
+
if (!(0, import_node_fs55.existsSync)(path)) return [];
|
|
22234
|
+
return (0, import_node_fs55.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
21966
22235
|
}
|
|
21967
22236
|
function resolveFilesToCopy(repoPath) {
|
|
21968
22237
|
const fromInclude = readWorktreeInclude(repoPath);
|
|
@@ -21972,10 +22241,10 @@ function resolveFilesToCopy(repoPath) {
|
|
|
21972
22241
|
if (settings?.fileIncludeGlobs?.length) {
|
|
21973
22242
|
const matched = [];
|
|
21974
22243
|
try {
|
|
21975
|
-
for (const entry of (0,
|
|
22244
|
+
for (const entry of (0, import_node_fs55.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
21976
22245
|
if (!entry.isFile()) continue;
|
|
21977
22246
|
for (const glob of settings.fileIncludeGlobs) {
|
|
21978
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
22247
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path56.basename)(glob), entry.name)) {
|
|
21979
22248
|
matched.push(entry.name);
|
|
21980
22249
|
break;
|
|
21981
22250
|
}
|
|
@@ -21987,7 +22256,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
21987
22256
|
}
|
|
21988
22257
|
const defaults = [];
|
|
21989
22258
|
try {
|
|
21990
|
-
for (const entry of (0,
|
|
22259
|
+
for (const entry of (0, import_node_fs55.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
21991
22260
|
if (entry.isFile() && entry.name.startsWith(".env")) {
|
|
21992
22261
|
defaults.push(entry.name);
|
|
21993
22262
|
}
|
|
@@ -22001,11 +22270,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
22001
22270
|
const patterns = resolveFilesToCopy(repoPath);
|
|
22002
22271
|
const copied = [];
|
|
22003
22272
|
for (const rel of patterns) {
|
|
22004
|
-
const src = (0,
|
|
22005
|
-
if (!(0,
|
|
22006
|
-
const dest = (0,
|
|
22007
|
-
(0,
|
|
22008
|
-
(0,
|
|
22273
|
+
const src = (0, import_node_path56.join)(repoPath, rel);
|
|
22274
|
+
if (!(0, import_node_fs55.existsSync)(src)) continue;
|
|
22275
|
+
const dest = (0, import_node_path56.join)(worktreePath, rel);
|
|
22276
|
+
(0, import_node_fs55.mkdirSync)((0, import_node_path56.dirname)(dest), { recursive: true });
|
|
22277
|
+
(0, import_node_fs55.copyFileSync)(src, dest);
|
|
22009
22278
|
copied.push(rel);
|
|
22010
22279
|
}
|
|
22011
22280
|
linkSharedDirectories(repoPath, worktreePath);
|
|
@@ -22018,19 +22287,19 @@ function linkSharedDirectories(repoPath, worktreePath) {
|
|
|
22018
22287
|
for (const rel of dirs) {
|
|
22019
22288
|
if (!isSafeRelativeDir(rel)) continue;
|
|
22020
22289
|
if (!isGitignored(repoPath, rel)) continue;
|
|
22021
|
-
const src = (0,
|
|
22290
|
+
const src = (0, import_node_path56.join)(repoPath, rel);
|
|
22022
22291
|
let srcStat;
|
|
22023
22292
|
try {
|
|
22024
|
-
srcStat = (0,
|
|
22293
|
+
srcStat = (0, import_node_fs55.lstatSync)(src);
|
|
22025
22294
|
} catch {
|
|
22026
22295
|
continue;
|
|
22027
22296
|
}
|
|
22028
22297
|
if (!srcStat.isDirectory()) continue;
|
|
22029
|
-
const dest = (0,
|
|
22030
|
-
if ((0,
|
|
22031
|
-
(0,
|
|
22298
|
+
const dest = (0, import_node_path56.join)(worktreePath, rel);
|
|
22299
|
+
if ((0, import_node_fs55.existsSync)(dest)) continue;
|
|
22300
|
+
(0, import_node_fs55.mkdirSync)((0, import_node_path56.dirname)(dest), { recursive: true });
|
|
22032
22301
|
try {
|
|
22033
|
-
(0,
|
|
22302
|
+
(0, import_node_fs55.symlinkSync)(src, dest);
|
|
22034
22303
|
} catch {
|
|
22035
22304
|
continue;
|
|
22036
22305
|
}
|
|
@@ -22040,19 +22309,19 @@ function linkSharedDirectories(repoPath, worktreePath) {
|
|
|
22040
22309
|
}
|
|
22041
22310
|
function samePath(a, b) {
|
|
22042
22311
|
try {
|
|
22043
|
-
return (0,
|
|
22312
|
+
return (0, import_node_fs55.realpathSync)(a) === (0, import_node_fs55.realpathSync)(b);
|
|
22044
22313
|
} catch {
|
|
22045
|
-
return (0,
|
|
22314
|
+
return (0, import_node_path56.resolve)(a) === (0, import_node_path56.resolve)(b);
|
|
22046
22315
|
}
|
|
22047
22316
|
}
|
|
22048
22317
|
function isSafeRelativeDir(rel) {
|
|
22049
|
-
if (!rel || (0,
|
|
22318
|
+
if (!rel || (0, import_node_path56.isAbsolute)(rel)) return false;
|
|
22050
22319
|
const parts = rel.split(/[\\/]/).filter(Boolean);
|
|
22051
22320
|
return parts.length > 0 && parts.every((part) => part !== "." && part !== "..");
|
|
22052
22321
|
}
|
|
22053
22322
|
function isGitignored(repoPath, rel) {
|
|
22054
22323
|
try {
|
|
22055
|
-
(0,
|
|
22324
|
+
(0, import_node_child_process6.execFileSync)("git", ["-C", repoPath, "check-ignore", "-q", "--", rel], { stdio: "ignore" });
|
|
22056
22325
|
return true;
|
|
22057
22326
|
} catch {
|
|
22058
22327
|
return false;
|
|
@@ -22088,7 +22357,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
22088
22357
|
const env = stripNestedElectronEnv({
|
|
22089
22358
|
...baseEnv ?? process.env
|
|
22090
22359
|
});
|
|
22091
|
-
const name = opts.workspaceName ?? (0,
|
|
22360
|
+
const name = opts.workspaceName ?? (0, import_node_path56.basename)(opts.worktreePath);
|
|
22092
22361
|
const ports = opts.ports ?? [];
|
|
22093
22362
|
const primary = ports[0];
|
|
22094
22363
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -22130,7 +22399,7 @@ function killableListenerPids(raw, selfPid = process.pid) {
|
|
|
22130
22399
|
}
|
|
22131
22400
|
function listUnixListenerPids(port, selfPid) {
|
|
22132
22401
|
try {
|
|
22133
|
-
const raw = (0,
|
|
22402
|
+
const raw = (0, import_node_child_process6.execFileSync)("lsof", [`-tiTCP:${port}`, "-sTCP:LISTEN"], {
|
|
22134
22403
|
encoding: "utf8",
|
|
22135
22404
|
stdio: ["ignore", "pipe", "ignore"],
|
|
22136
22405
|
timeout: 2e3
|
|
@@ -22143,7 +22412,7 @@ function listUnixListenerPids(port, selfPid) {
|
|
|
22143
22412
|
function listenerCwd(pid) {
|
|
22144
22413
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
22145
22414
|
try {
|
|
22146
|
-
const raw = (0,
|
|
22415
|
+
const raw = (0, import_node_child_process6.execFileSync)("lsof", ["-a", "-p", String(pid), "-d", "cwd", "-Fn"], {
|
|
22147
22416
|
encoding: "utf8",
|
|
22148
22417
|
stdio: ["ignore", "pipe", "ignore"],
|
|
22149
22418
|
timeout: 2e3
|
|
@@ -22157,20 +22426,20 @@ function listenerCwd(pid) {
|
|
|
22157
22426
|
}
|
|
22158
22427
|
function realpathOrResolve(path) {
|
|
22159
22428
|
try {
|
|
22160
|
-
return (0,
|
|
22429
|
+
return (0, import_node_fs55.realpathSync)(path);
|
|
22161
22430
|
} catch {
|
|
22162
|
-
return (0,
|
|
22431
|
+
return (0, import_node_path56.resolve)(path);
|
|
22163
22432
|
}
|
|
22164
22433
|
}
|
|
22165
22434
|
function isOtherWorktreeListenerCwd(cwd, worktreePath) {
|
|
22166
22435
|
const wt = realpathOrResolve(worktreePath);
|
|
22167
22436
|
const c = realpathOrResolve(cwd);
|
|
22168
|
-
if (c === wt || c.startsWith(wt +
|
|
22169
|
-
const parent = (0,
|
|
22170
|
-
const thisName = (0,
|
|
22437
|
+
if (c === wt || c.startsWith(wt + import_node_path56.sep)) return false;
|
|
22438
|
+
const parent = (0, import_node_path56.dirname)(wt);
|
|
22439
|
+
const thisName = (0, import_node_path56.basename)(wt);
|
|
22171
22440
|
if (!thisName || c === parent) return false;
|
|
22172
|
-
if (!c.startsWith(parent +
|
|
22173
|
-
const first = c.slice(parent.length + 1).split(
|
|
22441
|
+
if (!c.startsWith(parent + import_node_path56.sep)) return false;
|
|
22442
|
+
const first = c.slice(parent.length + 1).split(import_node_path56.sep)[0];
|
|
22174
22443
|
return Boolean(first) && first !== thisName;
|
|
22175
22444
|
}
|
|
22176
22445
|
function signalPid(pid, signal) {
|
|
@@ -22182,7 +22451,7 @@ function signalPid(pid, signal) {
|
|
|
22182
22451
|
function isThisWorktreeListenerCwd(cwd, worktreePath) {
|
|
22183
22452
|
const wt = realpathOrResolve(worktreePath);
|
|
22184
22453
|
const c = realpathOrResolve(cwd);
|
|
22185
|
-
return c === wt || c.startsWith(wt +
|
|
22454
|
+
return c === wt || c.startsWith(wt + import_node_path56.sep);
|
|
22186
22455
|
}
|
|
22187
22456
|
function killDetachedRunTree(pid, worktreePath) {
|
|
22188
22457
|
if (!Number.isFinite(pid) || pid <= 1 || pid === process.pid) return;
|
|
@@ -22204,7 +22473,7 @@ function killListenersOnPorts(ports) {
|
|
|
22204
22473
|
if (!Number.isFinite(port) || port <= 0) continue;
|
|
22205
22474
|
try {
|
|
22206
22475
|
if (process.platform === "win32") {
|
|
22207
|
-
(0,
|
|
22476
|
+
(0, import_node_child_process6.execFileSync)(
|
|
22208
22477
|
"powershell",
|
|
22209
22478
|
[
|
|
22210
22479
|
"-NoProfile",
|
|
@@ -22434,13 +22703,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
22434
22703
|
throw err;
|
|
22435
22704
|
}
|
|
22436
22705
|
}
|
|
22437
|
-
var
|
|
22706
|
+
var import_node_fs55, import_node_child_process6, import_node_path56, import_execa4, import_node_readline3, cachedLoginEnv;
|
|
22438
22707
|
var init_conductor = __esm({
|
|
22439
22708
|
"src/hook/conductor.ts"() {
|
|
22440
22709
|
"use strict";
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
|
|
22710
|
+
import_node_fs55 = require("fs");
|
|
22711
|
+
import_node_child_process6 = require("child_process");
|
|
22712
|
+
import_node_path56 = require("path");
|
|
22444
22713
|
import_execa4 = require("execa");
|
|
22445
22714
|
import_node_readline3 = require("readline");
|
|
22446
22715
|
init_settings();
|
|
@@ -22493,7 +22762,7 @@ function materialize(mem) {
|
|
|
22493
22762
|
};
|
|
22494
22763
|
}
|
|
22495
22764
|
function setupLogPath(threadId) {
|
|
22496
|
-
return (0,
|
|
22765
|
+
return (0, import_node_path57.join)(threadsDir(), `${threadId}.setup.log.json`);
|
|
22497
22766
|
}
|
|
22498
22767
|
function setupLogKeyForWorktree(worktreePath) {
|
|
22499
22768
|
const norm = normalizeWorktreePath(worktreePath);
|
|
@@ -22511,7 +22780,7 @@ function persistNow(threadId) {
|
|
|
22511
22780
|
const mem = memory.get(threadId);
|
|
22512
22781
|
if (!mem) return;
|
|
22513
22782
|
try {
|
|
22514
|
-
(0,
|
|
22783
|
+
(0, import_node_fs56.writeFileSync)(
|
|
22515
22784
|
setupLogPath(threadId),
|
|
22516
22785
|
`${JSON.stringify(materialize(mem))}
|
|
22517
22786
|
`,
|
|
@@ -22532,9 +22801,9 @@ function schedulePersist(threadId) {
|
|
|
22532
22801
|
}
|
|
22533
22802
|
function loadFromDisk(threadId) {
|
|
22534
22803
|
const path = setupLogPath(threadId);
|
|
22535
|
-
if (!(0,
|
|
22804
|
+
if (!(0, import_node_fs56.existsSync)(path)) return null;
|
|
22536
22805
|
try {
|
|
22537
|
-
const raw = JSON.parse((0,
|
|
22806
|
+
const raw = JSON.parse((0, import_node_fs56.readFileSync)(path, "utf8"));
|
|
22538
22807
|
return {
|
|
22539
22808
|
output: typeof raw.output === "string" ? raw.output : "",
|
|
22540
22809
|
running: Boolean(raw.running),
|
|
@@ -22590,13 +22859,13 @@ function finishSetupLog(threadId, exitCode, source) {
|
|
|
22590
22859
|
persistNow(threadId);
|
|
22591
22860
|
return materialize(mem);
|
|
22592
22861
|
}
|
|
22593
|
-
var import_node_crypto14,
|
|
22862
|
+
var import_node_crypto14, import_node_fs56, import_node_path57, EMPTY, MAX_SETUP_LOG_CHARS, memory, persistTimers, PERSIST_DEBOUNCE_MS;
|
|
22594
22863
|
var init_setup_log = __esm({
|
|
22595
22864
|
"src/store/setup-log.ts"() {
|
|
22596
22865
|
"use strict";
|
|
22597
22866
|
import_node_crypto14 = require("crypto");
|
|
22598
|
-
|
|
22599
|
-
|
|
22867
|
+
import_node_fs56 = require("fs");
|
|
22868
|
+
import_node_path57 = require("path");
|
|
22600
22869
|
init_worktree_labels();
|
|
22601
22870
|
init_paths();
|
|
22602
22871
|
EMPTY = {
|
|
@@ -22641,7 +22910,7 @@ function safeScriptToken(scriptName) {
|
|
|
22641
22910
|
return token || "dev";
|
|
22642
22911
|
}
|
|
22643
22912
|
function runLogPath(key) {
|
|
22644
|
-
return (0,
|
|
22913
|
+
return (0, import_node_path58.join)(threadsDir(), `${key}.run.log.json`);
|
|
22645
22914
|
}
|
|
22646
22915
|
function runLogKeyForWorktree(worktreePath, scriptName) {
|
|
22647
22916
|
const norm = normalizeWorktreePath(worktreePath);
|
|
@@ -22669,7 +22938,7 @@ function persistNow2(key) {
|
|
|
22669
22938
|
const mem = memory2.get(key);
|
|
22670
22939
|
if (!mem) return;
|
|
22671
22940
|
try {
|
|
22672
|
-
(0,
|
|
22941
|
+
(0, import_node_fs57.writeFileSync)(runLogPath(key), `${JSON.stringify(materialize2(mem))}
|
|
22673
22942
|
`, "utf8");
|
|
22674
22943
|
} catch {
|
|
22675
22944
|
}
|
|
@@ -22686,9 +22955,9 @@ function schedulePersist2(key) {
|
|
|
22686
22955
|
}
|
|
22687
22956
|
function loadFromDisk2(key) {
|
|
22688
22957
|
const path = runLogPath(key);
|
|
22689
|
-
if (!(0,
|
|
22958
|
+
if (!(0, import_node_fs57.existsSync)(path)) return null;
|
|
22690
22959
|
try {
|
|
22691
|
-
const raw = JSON.parse((0,
|
|
22960
|
+
const raw = JSON.parse((0, import_node_fs57.readFileSync)(path, "utf8"));
|
|
22692
22961
|
return {
|
|
22693
22962
|
output: typeof raw.output === "string" ? raw.output : "",
|
|
22694
22963
|
running: Boolean(raw.running),
|
|
@@ -22746,13 +23015,13 @@ function finishRunLog(key, exitCode) {
|
|
|
22746
23015
|
function flushRunLog(key) {
|
|
22747
23016
|
persistNow2(key);
|
|
22748
23017
|
}
|
|
22749
|
-
var import_node_crypto15,
|
|
23018
|
+
var import_node_crypto15, import_node_fs57, import_node_path58, EMPTY2, MAX_RUN_LOG_CHARS, DEFAULT_RUN_LOG_TAIL_CHARS, memory2, persistTimers2, PERSIST_DEBOUNCE_MS2;
|
|
22750
23019
|
var init_run_log = __esm({
|
|
22751
23020
|
"src/store/run-log.ts"() {
|
|
22752
23021
|
"use strict";
|
|
22753
23022
|
import_node_crypto15 = require("crypto");
|
|
22754
|
-
|
|
22755
|
-
|
|
23023
|
+
import_node_fs57 = require("fs");
|
|
23024
|
+
import_node_path58 = require("path");
|
|
22756
23025
|
init_worktree_labels();
|
|
22757
23026
|
init_setup_log();
|
|
22758
23027
|
init_paths();
|
|
@@ -22781,9 +23050,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22781
23050
|
repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
|
|
22782
23051
|
);
|
|
22783
23052
|
const homeRoot = sideboardWorkspacesDir();
|
|
22784
|
-
if ((0,
|
|
23053
|
+
if ((0, import_node_fs58.existsSync)(homeRoot)) {
|
|
22785
23054
|
try {
|
|
22786
|
-
for (const entry of (0,
|
|
23055
|
+
for (const entry of (0, import_node_fs58.readdirSync)(homeRoot, { withFileTypes: true })) {
|
|
22787
23056
|
if (!entry.isDirectory()) continue;
|
|
22788
23057
|
void entry;
|
|
22789
23058
|
}
|
|
@@ -22793,7 +23062,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22793
23062
|
const orphans = [];
|
|
22794
23063
|
const seen = /* @__PURE__ */ new Set();
|
|
22795
23064
|
for (const repoPath of repos) {
|
|
22796
|
-
if (!repoPath || !(0,
|
|
23065
|
+
if (!repoPath || !(0, import_node_fs58.existsSync)(repoPath)) continue;
|
|
22797
23066
|
try {
|
|
22798
23067
|
const wts = await listWorktrees(repoPath);
|
|
22799
23068
|
for (const wt of wts) {
|
|
@@ -22804,7 +23073,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22804
23073
|
seen.add(path);
|
|
22805
23074
|
let mtimeMs = 0;
|
|
22806
23075
|
try {
|
|
22807
|
-
mtimeMs = (0,
|
|
23076
|
+
mtimeMs = (0, import_node_fs58.statSync)(path).mtimeMs;
|
|
22808
23077
|
} catch {
|
|
22809
23078
|
mtimeMs = 0;
|
|
22810
23079
|
}
|
|
@@ -22814,16 +23083,16 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22814
23083
|
}
|
|
22815
23084
|
try {
|
|
22816
23085
|
const root = worktreesRoot(repoPath);
|
|
22817
|
-
if ((0,
|
|
22818
|
-
for (const entry of (0,
|
|
23086
|
+
if ((0, import_node_fs58.existsSync)(root)) {
|
|
23087
|
+
for (const entry of (0, import_node_fs58.readdirSync)(root, { withFileTypes: true })) {
|
|
22819
23088
|
if (!entry.isDirectory()) continue;
|
|
22820
|
-
const path = (0,
|
|
23089
|
+
const path = (0, import_node_path59.join)(root, entry.name).replace(/\/$/, "");
|
|
22821
23090
|
if (known.has(path) || seen.has(path)) continue;
|
|
22822
|
-
if (!(0,
|
|
23091
|
+
if (!(0, import_node_fs58.existsSync)((0, import_node_path59.join)(path, ".git"))) continue;
|
|
22823
23092
|
seen.add(path);
|
|
22824
23093
|
let mtimeMs = 0;
|
|
22825
23094
|
try {
|
|
22826
|
-
mtimeMs = (0,
|
|
23095
|
+
mtimeMs = (0, import_node_fs58.statSync)(path).mtimeMs;
|
|
22827
23096
|
} catch {
|
|
22828
23097
|
mtimeMs = Date.now();
|
|
22829
23098
|
}
|
|
@@ -22875,12 +23144,12 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
|
|
|
22875
23144
|
const elapsed = Date.now() - Date.parse(last);
|
|
22876
23145
|
return elapsed >= intervalHours * 36e5;
|
|
22877
23146
|
}
|
|
22878
|
-
var
|
|
23147
|
+
var import_node_fs58, import_node_path59;
|
|
22879
23148
|
var init_orphan_cleanup = __esm({
|
|
22880
23149
|
"src/git/orphan-cleanup.ts"() {
|
|
22881
23150
|
"use strict";
|
|
22882
|
-
|
|
22883
|
-
|
|
23151
|
+
import_node_fs58 = require("fs");
|
|
23152
|
+
import_node_path59 = require("path");
|
|
22884
23153
|
init_worktree();
|
|
22885
23154
|
init_thread_store();
|
|
22886
23155
|
init_paths();
|
|
@@ -23056,12 +23325,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
23056
23325
|
if (!url) throw new Error("Clone URL is required");
|
|
23057
23326
|
let name = opts.name?.trim();
|
|
23058
23327
|
if (!name) {
|
|
23059
|
-
const leaf = (0,
|
|
23328
|
+
const leaf = (0, import_node_path60.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
23060
23329
|
name = leaf || "repo";
|
|
23061
23330
|
}
|
|
23062
23331
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
23063
|
-
const dest = (0,
|
|
23064
|
-
if ((0,
|
|
23332
|
+
const dest = (0, import_node_path60.join)(sideboardReposDir(), name);
|
|
23333
|
+
if ((0, import_node_fs59.existsSync)(dest)) {
|
|
23065
23334
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
23066
23335
|
const workspace2 = await addWorkspace(repoPath2);
|
|
23067
23336
|
return { repoPath: repoPath2, workspace: workspace2 };
|
|
@@ -23076,12 +23345,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
23076
23345
|
const workspace = await addWorkspace(repoPath);
|
|
23077
23346
|
return { repoPath, workspace };
|
|
23078
23347
|
}
|
|
23079
|
-
var
|
|
23348
|
+
var import_node_fs59, import_node_path60, import_execa6;
|
|
23080
23349
|
var init_clone_repo = __esm({
|
|
23081
23350
|
"src/git/clone-repo.ts"() {
|
|
23082
23351
|
"use strict";
|
|
23083
|
-
|
|
23084
|
-
|
|
23352
|
+
import_node_fs59 = require("fs");
|
|
23353
|
+
import_node_path60 = require("path");
|
|
23085
23354
|
import_execa6 = require("execa");
|
|
23086
23355
|
init_paths();
|
|
23087
23356
|
init_workspaces();
|
|
@@ -23101,11 +23370,11 @@ var init_thread = __esm({
|
|
|
23101
23370
|
|
|
23102
23371
|
// src/store/desktop-host.ts
|
|
23103
23372
|
function desktopHostPidPath() {
|
|
23104
|
-
return (0,
|
|
23373
|
+
return (0, import_node_path61.join)(appDataDir(), "desktop-host.pid");
|
|
23105
23374
|
}
|
|
23106
23375
|
function readDesktopHostPid() {
|
|
23107
23376
|
try {
|
|
23108
|
-
const pid = Number.parseInt((0,
|
|
23377
|
+
const pid = Number.parseInt((0, import_node_fs60.readFileSync)(desktopHostPidPath(), "utf8").trim(), 10);
|
|
23109
23378
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
23110
23379
|
return pid;
|
|
23111
23380
|
} catch {
|
|
@@ -23131,12 +23400,12 @@ function thisProcessShouldDrainAgentQueues() {
|
|
|
23131
23400
|
if (isThisProcessDesktopHost()) return true;
|
|
23132
23401
|
return !isDesktopHostAlive();
|
|
23133
23402
|
}
|
|
23134
|
-
var
|
|
23403
|
+
var import_node_fs60, import_node_path61;
|
|
23135
23404
|
var init_desktop_host = __esm({
|
|
23136
23405
|
"src/store/desktop-host.ts"() {
|
|
23137
23406
|
"use strict";
|
|
23138
|
-
|
|
23139
|
-
|
|
23407
|
+
import_node_fs60 = require("fs");
|
|
23408
|
+
import_node_path61 = require("path");
|
|
23140
23409
|
init_paths();
|
|
23141
23410
|
}
|
|
23142
23411
|
});
|
|
@@ -23176,12 +23445,12 @@ function denyPendingToolPermissions(threadId) {
|
|
|
23176
23445
|
const last = pending[pending.length - 1];
|
|
23177
23446
|
if (last) clearPrompt(threadId, last.id);
|
|
23178
23447
|
}
|
|
23179
|
-
var import_node_crypto16,
|
|
23448
|
+
var import_node_crypto16, import_node_path62, queues, publisher;
|
|
23180
23449
|
var init_tool_permission = __esm({
|
|
23181
23450
|
"src/agents/tool-permission.ts"() {
|
|
23182
23451
|
"use strict";
|
|
23183
23452
|
import_node_crypto16 = require("crypto");
|
|
23184
|
-
|
|
23453
|
+
import_node_path62 = require("path");
|
|
23185
23454
|
init_claude_mcp();
|
|
23186
23455
|
queues = /* @__PURE__ */ new Map();
|
|
23187
23456
|
publisher = null;
|
|
@@ -23238,7 +23507,7 @@ var init_agent_block_view = __esm({
|
|
|
23238
23507
|
});
|
|
23239
23508
|
|
|
23240
23509
|
// src/plan/plan-present.ts
|
|
23241
|
-
function
|
|
23510
|
+
function asRecord9(v) {
|
|
23242
23511
|
return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
23243
23512
|
}
|
|
23244
23513
|
function isPresentPlanToolName(name) {
|
|
@@ -23257,7 +23526,7 @@ function extractPresentedPlan(parts) {
|
|
|
23257
23526
|
for (let i = parts.length - 1; i >= 0; i--) {
|
|
23258
23527
|
const p = parts[i];
|
|
23259
23528
|
if (p.type !== "tool" || !isPresentPlanToolName(p.name)) continue;
|
|
23260
|
-
const input =
|
|
23529
|
+
const input = asRecord9(p.input) ?? {};
|
|
23261
23530
|
const content = typeof input.content === "string" ? input.content : typeof input.plan === "string" ? input.plan : typeof input.markdown === "string" ? input.markdown : "";
|
|
23262
23531
|
if (!content.trim()) continue;
|
|
23263
23532
|
const title = typeof input.title === "string" && input.title.trim() ? input.title.trim() : "Plan";
|
|
@@ -24987,7 +25256,7 @@ __export(abletime_rest_exports, {
|
|
|
24987
25256
|
looksLikeAbleTimeUlid: () => looksLikeAbleTimeUlid,
|
|
24988
25257
|
textFromAbleTimeDoc: () => textFromAbleTimeDoc
|
|
24989
25258
|
});
|
|
24990
|
-
function
|
|
25259
|
+
function asRecord10(value) {
|
|
24991
25260
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
24992
25261
|
}
|
|
24993
25262
|
function asString(value) {
|
|
@@ -24995,7 +25264,7 @@ function asString(value) {
|
|
|
24995
25264
|
}
|
|
24996
25265
|
function asList(value) {
|
|
24997
25266
|
if (Array.isArray(value)) return value;
|
|
24998
|
-
const record =
|
|
25267
|
+
const record = asRecord10(value);
|
|
24999
25268
|
if (!record) return [];
|
|
25000
25269
|
for (const key of ["data", "tasks", "projects", "users", "items", "results"]) {
|
|
25001
25270
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25012,12 +25281,12 @@ function ableTimeDocFromText(text8) {
|
|
|
25012
25281
|
}
|
|
25013
25282
|
function textFromAbleTimeDoc(value) {
|
|
25014
25283
|
if (typeof value === "string") return value.trim();
|
|
25015
|
-
const record =
|
|
25284
|
+
const record = asRecord10(value);
|
|
25016
25285
|
if (!record) return "";
|
|
25017
25286
|
if (typeof record.text === "string" && record.text.trim()) return record.text.trim();
|
|
25018
25287
|
const chunks = [];
|
|
25019
25288
|
const walk = (node) => {
|
|
25020
|
-
const rec =
|
|
25289
|
+
const rec = asRecord10(node);
|
|
25021
25290
|
if (!rec) return;
|
|
25022
25291
|
if (typeof rec.text === "string" && rec.text) chunks.push(rec.text);
|
|
25023
25292
|
if (Array.isArray(rec.content)) rec.content.forEach(walk);
|
|
@@ -25079,7 +25348,7 @@ async function restPages(path, opts, maxPages = 20) {
|
|
|
25079
25348
|
query: { ...opts.query, ...cursor ? { cursor } : {} }
|
|
25080
25349
|
});
|
|
25081
25350
|
items.push(...asList(raw));
|
|
25082
|
-
const page =
|
|
25351
|
+
const page = asRecord10(asRecord10(raw)?.page);
|
|
25083
25352
|
const next = page ? asString(page.nextCursor) : "";
|
|
25084
25353
|
if (!next) break;
|
|
25085
25354
|
cursor = next;
|
|
@@ -25087,7 +25356,7 @@ async function restPages(path, opts, maxPages = 20) {
|
|
|
25087
25356
|
return items;
|
|
25088
25357
|
}
|
|
25089
25358
|
function userDisplayName(raw) {
|
|
25090
|
-
const rec =
|
|
25359
|
+
const rec = asRecord10(raw);
|
|
25091
25360
|
if (!rec) return null;
|
|
25092
25361
|
const id = asString(rec.userId) || asString(rec.id);
|
|
25093
25362
|
const name = [asString(rec.firstName), asString(rec.lastName)].filter(Boolean).join(" ") || asString(rec.username) || asString(rec.email) || asString(rec.name);
|
|
@@ -25095,7 +25364,7 @@ function userDisplayName(raw) {
|
|
|
25095
25364
|
return { id: id || void 0, name };
|
|
25096
25365
|
}
|
|
25097
25366
|
function restTaskToRaw(raw, users) {
|
|
25098
|
-
const rec =
|
|
25367
|
+
const rec = asRecord10(raw);
|
|
25099
25368
|
if (!rec) return null;
|
|
25100
25369
|
const id = asString(rec.timeflowTaskId) || asString(rec.taskId) || asString(rec.id);
|
|
25101
25370
|
const identifier = asString(rec.taskRef) || asString(rec.reference) || id;
|
|
@@ -25103,7 +25372,7 @@ function restTaskToRaw(raw, users) {
|
|
|
25103
25372
|
if (!id && !identifier && !title) return null;
|
|
25104
25373
|
const assignee = users.get(asString(rec.assignedUserId));
|
|
25105
25374
|
const comments = asList(rec.comments).map((item) => {
|
|
25106
|
-
const comment =
|
|
25375
|
+
const comment = asRecord10(item) ?? {};
|
|
25107
25376
|
const user = userDisplayName(comment);
|
|
25108
25377
|
return {
|
|
25109
25378
|
id: asString(comment.commentId) || asString(comment.id),
|
|
@@ -25134,13 +25403,13 @@ function restTaskToRaw(raw, users) {
|
|
|
25134
25403
|
};
|
|
25135
25404
|
}
|
|
25136
25405
|
function restProjectToRaw(raw) {
|
|
25137
|
-
const rec =
|
|
25406
|
+
const rec = asRecord10(raw);
|
|
25138
25407
|
if (!rec) return null;
|
|
25139
25408
|
const id = asString(rec.projectId) || asString(rec.id);
|
|
25140
25409
|
const name = asString(rec.projectName) || asString(rec.name);
|
|
25141
25410
|
if (!id && !name) return null;
|
|
25142
25411
|
const categories = asList(rec.categories).map((item) => {
|
|
25143
|
-
const cat =
|
|
25412
|
+
const cat = asRecord10(item) ?? {};
|
|
25144
25413
|
return {
|
|
25145
25414
|
id: asString(cat.projectCategoryId) || asString(cat.categoryId) || asString(cat.id),
|
|
25146
25415
|
name: asString(cat.categoryName) || asString(cat.name)
|
|
@@ -25152,7 +25421,7 @@ async function listUsers(opts) {
|
|
|
25152
25421
|
const users = /* @__PURE__ */ new Map();
|
|
25153
25422
|
for (const item of await restPages("/users", opts).catch(() => [])) {
|
|
25154
25423
|
const user = userDisplayName(item);
|
|
25155
|
-
const rec =
|
|
25424
|
+
const rec = asRecord10(item);
|
|
25156
25425
|
const id = user?.id || (rec ? asString(rec.userId) : "");
|
|
25157
25426
|
if (user && id) users.set(id, user);
|
|
25158
25427
|
}
|
|
@@ -25278,10 +25547,10 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
|
|
|
25278
25547
|
if (!project) throw new Error("AbleTime has no projects to create a task in");
|
|
25279
25548
|
const categories = asList(project.categories);
|
|
25280
25549
|
const wantedCategory = firstStringArg(args, ["category_id", "categoryId", "category"]);
|
|
25281
|
-
const category = categories.map((item) =>
|
|
25550
|
+
const category = categories.map((item) => asRecord10(item)).find((item) => {
|
|
25282
25551
|
if (!item || !wantedCategory) return false;
|
|
25283
25552
|
return asString(item.id).toLowerCase() === wantedCategory.toLowerCase() || asString(item.name).toLowerCase() === wantedCategory.toLowerCase();
|
|
25284
|
-
}) ??
|
|
25553
|
+
}) ?? asRecord10(categories[0]);
|
|
25285
25554
|
const parentArg = firstStringArg(args, ["parent", "parent_id", "parentId", "related_task_id"]);
|
|
25286
25555
|
const parentTaskId = parentArg ? await resolveRestParentTaskId(parentArg, requestOpts) : void 0;
|
|
25287
25556
|
const created = await abletimeRestRequest("/tasks", {
|
|
@@ -25295,7 +25564,7 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
|
|
|
25295
25564
|
}
|
|
25296
25565
|
});
|
|
25297
25566
|
const state = firstStringArg(args, ["state"]);
|
|
25298
|
-
const createdId = asString(
|
|
25567
|
+
const createdId = asString(asRecord10(created)?.timeflowTaskId);
|
|
25299
25568
|
const description = asString(args.description);
|
|
25300
25569
|
if (createdId && description) {
|
|
25301
25570
|
await abletimeRestRequest(`/tasks/${encodeURIComponent(createdId)}`, {
|
|
@@ -25368,7 +25637,7 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
|
|
|
25368
25637
|
method: "POST",
|
|
25369
25638
|
body: { content: ableTimeDocFromText(body) }
|
|
25370
25639
|
});
|
|
25371
|
-
const rec =
|
|
25640
|
+
const rec = asRecord10(created) ?? {};
|
|
25372
25641
|
return {
|
|
25373
25642
|
id: asString(rec.commentId) || void 0,
|
|
25374
25643
|
body: textFromAbleTimeDoc(rec.content) || body
|
|
@@ -25463,7 +25732,7 @@ function rewriteAbleTimeError(message) {
|
|
|
25463
25732
|
}
|
|
25464
25733
|
return message;
|
|
25465
25734
|
}
|
|
25466
|
-
function
|
|
25735
|
+
function asRecord11(value) {
|
|
25467
25736
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25468
25737
|
}
|
|
25469
25738
|
function parseSseJson(body) {
|
|
@@ -25485,12 +25754,12 @@ function parseSseJson(body) {
|
|
|
25485
25754
|
}
|
|
25486
25755
|
}
|
|
25487
25756
|
function unwrapToolResult(result) {
|
|
25488
|
-
const record =
|
|
25757
|
+
const record = asRecord11(result);
|
|
25489
25758
|
if (!record) return result;
|
|
25490
25759
|
const content = record.content;
|
|
25491
25760
|
if (Array.isArray(content)) {
|
|
25492
25761
|
const texts = content.map((part) => {
|
|
25493
|
-
const item =
|
|
25762
|
+
const item = asRecord11(part);
|
|
25494
25763
|
if (!item) return "";
|
|
25495
25764
|
return typeof item.text === "string" ? item.text : "";
|
|
25496
25765
|
}).filter(Boolean);
|
|
@@ -25512,7 +25781,7 @@ function unwrapToolResult(result) {
|
|
|
25512
25781
|
return result;
|
|
25513
25782
|
}
|
|
25514
25783
|
function textsFromUnknown(value) {
|
|
25515
|
-
const record =
|
|
25784
|
+
const record = asRecord11(value);
|
|
25516
25785
|
if (!record) return "";
|
|
25517
25786
|
if (typeof record.message === "string") return record.message;
|
|
25518
25787
|
if (typeof record.error === "string") return record.error;
|
|
@@ -25559,7 +25828,7 @@ async function abletimeMcpRequest(method, params, opts) {
|
|
|
25559
25828
|
return parseSseJson(body);
|
|
25560
25829
|
}
|
|
25561
25830
|
})();
|
|
25562
|
-
const rpc =
|
|
25831
|
+
const rpc = asRecord11(parsed);
|
|
25563
25832
|
if (rpc?.error) {
|
|
25564
25833
|
const detail = typeof rpc.error.message === "string" && rpc.error.message.trim() ? rpc.error.message : `AbleTime MCP error ${rpc.error.code ?? ""}`.trim();
|
|
25565
25834
|
throw new Error(rewriteAbleTimeError(detail));
|
|
@@ -25646,7 +25915,7 @@ var init_abletime_mcp = __esm({
|
|
|
25646
25915
|
});
|
|
25647
25916
|
|
|
25648
25917
|
// src/integrations/abletime-attachments.ts
|
|
25649
|
-
function
|
|
25918
|
+
function asRecord12(value) {
|
|
25650
25919
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25651
25920
|
}
|
|
25652
25921
|
function asString2(value) {
|
|
@@ -25654,7 +25923,7 @@ function asString2(value) {
|
|
|
25654
25923
|
}
|
|
25655
25924
|
function asList2(value) {
|
|
25656
25925
|
if (Array.isArray(value)) return value;
|
|
25657
|
-
const record =
|
|
25926
|
+
const record = asRecord12(value);
|
|
25658
25927
|
if (!record) return [];
|
|
25659
25928
|
for (const key of ["data", "tasks", "projects", "items", "results", "nodes"]) {
|
|
25660
25929
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25673,9 +25942,9 @@ function filesFromAbleTimeDoc(value) {
|
|
|
25673
25942
|
const out = [];
|
|
25674
25943
|
const seen = /* @__PURE__ */ new Set();
|
|
25675
25944
|
const walk = (node) => {
|
|
25676
|
-
const rec =
|
|
25945
|
+
const rec = asRecord12(node);
|
|
25677
25946
|
if (!rec) return;
|
|
25678
|
-
const attrs =
|
|
25947
|
+
const attrs = asRecord12(rec.attrs) ?? rec;
|
|
25679
25948
|
const url = asString2(attrs.src) || asString2(attrs.href) || asString2(attrs.url) || asString2(attrs.fileUrl) || asString2(attrs.downloadUrl);
|
|
25680
25949
|
if (url && !seen.has(url)) {
|
|
25681
25950
|
seen.add(url);
|
|
@@ -25693,7 +25962,7 @@ function filesFromAbleTimeDoc(value) {
|
|
|
25693
25962
|
function listedAbleTimeFiles(raw) {
|
|
25694
25963
|
const out = [];
|
|
25695
25964
|
for (const item of asList2(raw)) {
|
|
25696
|
-
const rec =
|
|
25965
|
+
const rec = asRecord12(item);
|
|
25697
25966
|
if (!rec) continue;
|
|
25698
25967
|
const url = firstString(rec, ["url", "href", "src", "fileUrl", "downloadUrl", "permalink"]);
|
|
25699
25968
|
if (!url) continue;
|
|
@@ -25713,7 +25982,7 @@ function mapAbleTimeAttachments(record) {
|
|
|
25713
25982
|
...filesFromAbleTimeDoc(record.description),
|
|
25714
25983
|
...filesFromAbleTimeDoc(record.content),
|
|
25715
25984
|
...asList2(record.comments).flatMap((item) => {
|
|
25716
|
-
const rec =
|
|
25985
|
+
const rec = asRecord12(item);
|
|
25717
25986
|
return rec ? filesFromAbleTimeDoc(rec.content ?? rec.body) : [];
|
|
25718
25987
|
})
|
|
25719
25988
|
].map((file) => ({
|
|
@@ -25755,7 +26024,7 @@ async function resolveAbleTimeAttachmentUrl(id, opts) {
|
|
|
25755
26024
|
const json = await res.json().catch(() => null);
|
|
25756
26025
|
const rec = json && typeof json === "object" && !Array.isArray(json) ? json.data && typeof json.data === "object" ? json.data : json : null;
|
|
25757
26026
|
if (!rec) continue;
|
|
25758
|
-
const url = firstString(rec, ["url", "href", "src", "fileUrl", "downloadUrl"]) || firstString(
|
|
26027
|
+
const url = firstString(rec, ["url", "href", "src", "fileUrl", "downloadUrl"]) || firstString(asRecord12(rec.file), ["url", "href"]);
|
|
25759
26028
|
if (url) {
|
|
25760
26029
|
return {
|
|
25761
26030
|
url,
|
|
@@ -25797,7 +26066,7 @@ var init_abletime_attachments = __esm({
|
|
|
25797
26066
|
});
|
|
25798
26067
|
|
|
25799
26068
|
// src/integrations/abletime-projects.ts
|
|
25800
|
-
function
|
|
26069
|
+
function asRecord13(value) {
|
|
25801
26070
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25802
26071
|
}
|
|
25803
26072
|
function firstString2(record, keys) {
|
|
@@ -25810,7 +26079,7 @@ function firstString2(record, keys) {
|
|
|
25810
26079
|
}
|
|
25811
26080
|
function asList3(value) {
|
|
25812
26081
|
if (Array.isArray(value)) return value;
|
|
25813
|
-
const record =
|
|
26082
|
+
const record = asRecord13(value);
|
|
25814
26083
|
if (!record) return [];
|
|
25815
26084
|
for (const key of ["data", "tasks", "projects", "items", "results", "nodes"]) {
|
|
25816
26085
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25818,7 +26087,7 @@ function asList3(value) {
|
|
|
25818
26087
|
return [];
|
|
25819
26088
|
}
|
|
25820
26089
|
function ableTimeProjectFields(nested) {
|
|
25821
|
-
const projectRecord =
|
|
26090
|
+
const projectRecord = asRecord13(nested.project);
|
|
25822
26091
|
const projectId = firstString2(nested, ["project_id", "projectId"]) || firstString2(projectRecord, ["id"]) || void 0;
|
|
25823
26092
|
const projectName = firstString2(nested, ["project_name", "projectName"]) || firstString2(projectRecord, ["name", "title"]) || void 0;
|
|
25824
26093
|
if (!projectId && !projectName) return {};
|
|
@@ -25831,13 +26100,13 @@ function ableTimeProjectFields(nested) {
|
|
|
25831
26100
|
};
|
|
25832
26101
|
}
|
|
25833
26102
|
function mapAbleTimeProject(raw) {
|
|
25834
|
-
const record =
|
|
26103
|
+
const record = asRecord13(raw);
|
|
25835
26104
|
if (!record) return null;
|
|
25836
26105
|
const id = firstString2(record, ["id", "project_id", "projectId"]);
|
|
25837
26106
|
const name = firstString2(record, ["name", "title", "projectName"]);
|
|
25838
26107
|
if (!id && !name) return null;
|
|
25839
26108
|
const categories = asList3(record.categories ?? record.category).map((item) => {
|
|
25840
|
-
const rec =
|
|
26109
|
+
const rec = asRecord13(item);
|
|
25841
26110
|
if (!rec) return null;
|
|
25842
26111
|
const categoryId = firstString2(rec, ["id", "category_id", "projectCategoryId", "categoryId"]);
|
|
25843
26112
|
const categoryName = firstString2(rec, ["name", "title", "categoryName"]);
|
|
@@ -25874,7 +26143,7 @@ __export(abletime_exports, {
|
|
|
25874
26143
|
updateAbleTimeTask: () => updateAbleTimeTask,
|
|
25875
26144
|
verifyAbleTimeConnection: () => verifyAbleTimeConnection
|
|
25876
26145
|
});
|
|
25877
|
-
function
|
|
26146
|
+
function asRecord14(value) {
|
|
25878
26147
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25879
26148
|
}
|
|
25880
26149
|
function asString3(value) {
|
|
@@ -25891,14 +26160,14 @@ function firstString3(record, keys) {
|
|
|
25891
26160
|
function firstRecord(record, keys) {
|
|
25892
26161
|
if (!record) return null;
|
|
25893
26162
|
for (const key of keys) {
|
|
25894
|
-
const value =
|
|
26163
|
+
const value = asRecord14(record[key]);
|
|
25895
26164
|
if (value) return value;
|
|
25896
26165
|
}
|
|
25897
26166
|
return null;
|
|
25898
26167
|
}
|
|
25899
26168
|
function asList4(value) {
|
|
25900
26169
|
if (Array.isArray(value)) return value;
|
|
25901
|
-
const record =
|
|
26170
|
+
const record = asRecord14(value);
|
|
25902
26171
|
if (!record) return [];
|
|
25903
26172
|
for (const key of ["data", "tasks", "projects", "items", "results", "nodes"]) {
|
|
25904
26173
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25910,18 +26179,18 @@ function labelsOf(record) {
|
|
|
25910
26179
|
if (!Array.isArray(raw)) return [];
|
|
25911
26180
|
return raw.map((item) => {
|
|
25912
26181
|
if (typeof item === "string") return item.trim();
|
|
25913
|
-
const rec =
|
|
26182
|
+
const rec = asRecord14(item);
|
|
25914
26183
|
return rec ? firstString3(rec, ["name", "title", "label"]) : "";
|
|
25915
26184
|
}).filter(Boolean);
|
|
25916
26185
|
}
|
|
25917
26186
|
function commentsOf(record) {
|
|
25918
26187
|
const out = [];
|
|
25919
26188
|
for (const item of asList4(record.comments ?? record.notes ?? record.discussion)) {
|
|
25920
|
-
const rec =
|
|
26189
|
+
const rec = asRecord14(item);
|
|
25921
26190
|
if (!rec) continue;
|
|
25922
26191
|
const body = firstString3(rec, ["body", "text", "comment", "message", "contentSanitized"]) || textFromAbleTimeDoc(rec.content);
|
|
25923
26192
|
if (!body) continue;
|
|
25924
|
-
const user = firstString3(
|
|
26193
|
+
const user = firstString3(asRecord14(rec.user) ?? asRecord14(rec.author), ["name", "display_name", "username"]) || firstString3(rec, ["user_name", "author", "username"]);
|
|
25925
26194
|
const id = firstString3(rec, ["id", "comment_id", "commentId"]);
|
|
25926
26195
|
const url = firstString3(rec, ["url", "permalink"]);
|
|
25927
26196
|
const createdAt = firstString3(rec, ["created_at", "createdAt", "created"]);
|
|
@@ -25948,7 +26217,7 @@ function taskUrl(task, host) {
|
|
|
25948
26217
|
return `${base}/tasks/${slug}`;
|
|
25949
26218
|
}
|
|
25950
26219
|
function mapAbleTimeTask(raw, host) {
|
|
25951
|
-
const record =
|
|
26220
|
+
const record = asRecord14(raw);
|
|
25952
26221
|
if (!record) return null;
|
|
25953
26222
|
const nested = firstRecord(record, ["task", "data"]) ?? record;
|
|
25954
26223
|
const id = firstString3(nested, ["id", "task_id", "taskId", "timeflowTaskId"]);
|
|
@@ -25966,7 +26235,7 @@ function mapAbleTimeTask(raw, host) {
|
|
|
25966
26235
|
description: firstString3(nested, ["description", "body", "details", "descriptionSanitized"]) || textFromAbleTimeDoc(nested.description) || void 0,
|
|
25967
26236
|
state: firstString3(nested, ["state", "board_state", "boardState", "status", "taskState"]) || void 0,
|
|
25968
26237
|
...ableTimeProjectFields(nested),
|
|
25969
|
-
categoryId: firstString3(nested, ["category_id", "categoryId", "projectCategoryId"]) || firstString3(
|
|
26238
|
+
categoryId: firstString3(nested, ["category_id", "categoryId", "projectCategoryId"]) || firstString3(asRecord14(nested.category), ["id"]) || void 0,
|
|
25970
26239
|
assignee: assigneeOf(nested),
|
|
25971
26240
|
labels: labelsOf(nested),
|
|
25972
26241
|
comments: commentsOf(nested),
|
|
@@ -26019,7 +26288,7 @@ function isOpenTask(task) {
|
|
|
26019
26288
|
}
|
|
26020
26289
|
async function getAbleTimeOrientation(opts) {
|
|
26021
26290
|
const raw = await callAbleTimeTool("orientation", {}, opts);
|
|
26022
|
-
const record =
|
|
26291
|
+
const record = asRecord14(raw);
|
|
26023
26292
|
const viewerRec = firstRecord(record, ["viewer", "principal", "user", "actor", "me", "person"]) ?? record;
|
|
26024
26293
|
const viewer = {
|
|
26025
26294
|
id: firstString3(viewerRec, ["id", "user_id"]) || void 0,
|
|
@@ -26098,7 +26367,7 @@ async function commentAbleTimeTask(input, opts) {
|
|
|
26098
26367
|
{ id, task_id: id, task: id, body, comment: body, text: body },
|
|
26099
26368
|
opts
|
|
26100
26369
|
);
|
|
26101
|
-
const rec =
|
|
26370
|
+
const rec = asRecord14(raw);
|
|
26102
26371
|
return {
|
|
26103
26372
|
id: rec ? firstString3(rec, ["id", "comment_id"]) || void 0 : void 0,
|
|
26104
26373
|
body: rec ? firstString3(rec, ["body", "text", "comment"]) || body : body
|
|
@@ -26353,7 +26622,7 @@ function reuseLiveThread(input, repoPath, match) {
|
|
|
26353
26622
|
}
|
|
26354
26623
|
async function createThread(input, _onSetupLine) {
|
|
26355
26624
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
26356
|
-
if (!(0,
|
|
26625
|
+
if (!(0, import_node_fs61.existsSync)(repoPath)) {
|
|
26357
26626
|
throw new Error(`Repo not found: ${repoPath}`);
|
|
26358
26627
|
}
|
|
26359
26628
|
if (isRemovedWorkspace(repoPath)) throw new Error(`Project was removed: ${repoPath}`);
|
|
@@ -26544,11 +26813,11 @@ async function createThread(input, _onSetupLine) {
|
|
|
26544
26813
|
await ensureWorkspace(repoPath);
|
|
26545
26814
|
return readThread(thread.id) ?? thread;
|
|
26546
26815
|
}
|
|
26547
|
-
var
|
|
26816
|
+
var import_node_fs61;
|
|
26548
26817
|
var init_create = __esm({
|
|
26549
26818
|
"src/threads/create.ts"() {
|
|
26550
26819
|
"use strict";
|
|
26551
|
-
|
|
26820
|
+
import_node_fs61 = require("fs");
|
|
26552
26821
|
init_acp_harness();
|
|
26553
26822
|
init_detect();
|
|
26554
26823
|
init_worktree();
|
|
@@ -26638,7 +26907,7 @@ function stampOf(thread) {
|
|
|
26638
26907
|
function repoLabel(thread) {
|
|
26639
26908
|
if (isOrchestratorThread(thread)) return "Orchestration";
|
|
26640
26909
|
const path = thread.repoPath?.trim() ?? "";
|
|
26641
|
-
return path && (0,
|
|
26910
|
+
return path && (0, import_node_path63.basename)(path) || path || "project";
|
|
26642
26911
|
}
|
|
26643
26912
|
function toAgent(thread, flags) {
|
|
26644
26913
|
const prUrl = thread.prUrl?.trim();
|
|
@@ -26837,11 +27106,11 @@ function formatFleetArchive(view) {
|
|
|
26837
27106
|
}
|
|
26838
27107
|
return lines.join("\n");
|
|
26839
27108
|
}
|
|
26840
|
-
var
|
|
27109
|
+
var import_node_path63, DEFAULT_LIMIT, MAX_LIMIT;
|
|
26841
27110
|
var init_fleet_archive = __esm({
|
|
26842
27111
|
"src/archive/fleet-archive.ts"() {
|
|
26843
27112
|
"use strict";
|
|
26844
|
-
|
|
27113
|
+
import_node_path63 = require("path");
|
|
26845
27114
|
init_global_workspace();
|
|
26846
27115
|
init_worktree_labels();
|
|
26847
27116
|
DEFAULT_LIMIT = 40;
|
|
@@ -27016,11 +27285,11 @@ function writeTurnLive(threadId, progress) {
|
|
|
27016
27285
|
const path = threadLivePath(threadId);
|
|
27017
27286
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
27018
27287
|
try {
|
|
27019
|
-
(0,
|
|
27020
|
-
(0,
|
|
27288
|
+
(0, import_node_fs62.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
|
|
27289
|
+
(0, import_node_fs62.renameSync)(tmp, path);
|
|
27021
27290
|
} catch {
|
|
27022
27291
|
try {
|
|
27023
|
-
(0,
|
|
27292
|
+
(0, import_node_fs62.unlinkSync)(tmp);
|
|
27024
27293
|
} catch {
|
|
27025
27294
|
}
|
|
27026
27295
|
}
|
|
@@ -27030,9 +27299,9 @@ function readTurnLiveParts(threadId) {
|
|
|
27030
27299
|
}
|
|
27031
27300
|
function readTurnLive(threadId) {
|
|
27032
27301
|
const path = threadLivePath(threadId);
|
|
27033
|
-
if (!(0,
|
|
27302
|
+
if (!(0, import_node_fs62.existsSync)(path)) return null;
|
|
27034
27303
|
try {
|
|
27035
|
-
const raw = JSON.parse((0,
|
|
27304
|
+
const raw = JSON.parse((0, import_node_fs62.readFileSync)(path, "utf8"));
|
|
27036
27305
|
if (!raw || typeof raw.summary !== "string") return null;
|
|
27037
27306
|
return raw;
|
|
27038
27307
|
} catch {
|
|
@@ -27044,17 +27313,17 @@ function clearTurnLive(threadId) {
|
|
|
27044
27313
|
if (buf?.timer) clearTimeout(buf.timer);
|
|
27045
27314
|
buffers.delete(threadId);
|
|
27046
27315
|
const path = threadLivePath(threadId);
|
|
27047
|
-
if (!(0,
|
|
27316
|
+
if (!(0, import_node_fs62.existsSync)(path)) return;
|
|
27048
27317
|
try {
|
|
27049
|
-
(0,
|
|
27318
|
+
(0, import_node_fs62.unlinkSync)(path);
|
|
27050
27319
|
} catch {
|
|
27051
27320
|
}
|
|
27052
27321
|
}
|
|
27053
|
-
var
|
|
27322
|
+
var import_node_fs62, buffers, FLUSH_MS, MAX_PARTS;
|
|
27054
27323
|
var init_turn_live = __esm({
|
|
27055
27324
|
"src/store/turn-live.ts"() {
|
|
27056
27325
|
"use strict";
|
|
27057
|
-
|
|
27326
|
+
import_node_fs62 = require("fs");
|
|
27058
27327
|
init_message_parts();
|
|
27059
27328
|
init_paths();
|
|
27060
27329
|
init_agent_block();
|
|
@@ -27339,7 +27608,7 @@ var init_quota_failover = __esm({
|
|
|
27339
27608
|
// src/threads/adopt.ts
|
|
27340
27609
|
function thisModuleFile2() {
|
|
27341
27610
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
27342
|
-
return cjsFile || process.argv[1] || (0,
|
|
27611
|
+
return cjsFile || process.argv[1] || (0, import_node_path64.join)(process.cwd(), "package.json");
|
|
27343
27612
|
}
|
|
27344
27613
|
function openReadonlySqlite(file) {
|
|
27345
27614
|
const req = (0, import_node_module7.createRequire)(thisModuleFile2());
|
|
@@ -27357,21 +27626,21 @@ function mapAgentType(raw) {
|
|
|
27357
27626
|
return null;
|
|
27358
27627
|
}
|
|
27359
27628
|
function resolveConductorCursorAgentId(workspacePath) {
|
|
27360
|
-
if (!workspacePath || !(0,
|
|
27629
|
+
if (!workspacePath || !(0, import_node_fs63.existsSync)(CURSOR_SDK_STORE)) return null;
|
|
27361
27630
|
const normalized = workspacePath.replace(/\/$/, "");
|
|
27362
27631
|
let best = null;
|
|
27363
27632
|
let hashes;
|
|
27364
27633
|
try {
|
|
27365
|
-
hashes = (0,
|
|
27634
|
+
hashes = (0, import_node_fs63.readdirSync)(CURSOR_SDK_STORE);
|
|
27366
27635
|
} catch {
|
|
27367
27636
|
return null;
|
|
27368
27637
|
}
|
|
27369
27638
|
for (const hash of hashes) {
|
|
27370
|
-
const agentsFile = (0,
|
|
27371
|
-
if (!(0,
|
|
27639
|
+
const agentsFile = (0, import_node_path64.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
27640
|
+
if (!(0, import_node_fs63.existsSync)(agentsFile)) continue;
|
|
27372
27641
|
let text8;
|
|
27373
27642
|
try {
|
|
27374
|
-
text8 = (0,
|
|
27643
|
+
text8 = (0, import_node_fs63.readFileSync)(agentsFile, "utf8");
|
|
27375
27644
|
} catch {
|
|
27376
27645
|
continue;
|
|
27377
27646
|
}
|
|
@@ -27395,7 +27664,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
27395
27664
|
return best?.agentId ?? null;
|
|
27396
27665
|
}
|
|
27397
27666
|
async function adoptThread(input) {
|
|
27398
|
-
if (!(0,
|
|
27667
|
+
if (!(0, import_node_fs63.existsSync)(input.worktreePath)) {
|
|
27399
27668
|
throw new Error(`Worktree not found: ${input.worktreePath}`);
|
|
27400
27669
|
}
|
|
27401
27670
|
const repoPath = await resolveRepoRoot(input.worktreePath);
|
|
@@ -27424,18 +27693,18 @@ async function adoptThread(input) {
|
|
|
27424
27693
|
return thread;
|
|
27425
27694
|
}
|
|
27426
27695
|
function listConductorWorkspaces() {
|
|
27427
|
-
if (!(0,
|
|
27696
|
+
if (!(0, import_node_fs63.existsSync)(CONDUCTOR_DB)) {
|
|
27428
27697
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
27429
27698
|
}
|
|
27430
|
-
const tmp = (0,
|
|
27431
|
-
const snapshot = (0,
|
|
27699
|
+
const tmp = (0, import_node_fs63.mkdtempSync)((0, import_node_path64.join)((0, import_node_os21.tmpdir)(), "sideboard-conductor-"));
|
|
27700
|
+
const snapshot = (0, import_node_path64.join)(tmp, "conductor.db");
|
|
27432
27701
|
try {
|
|
27433
|
-
(0,
|
|
27702
|
+
(0, import_node_fs63.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
27434
27703
|
for (const suffix of ["-wal", "-shm"]) {
|
|
27435
27704
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
27436
|
-
if ((0,
|
|
27705
|
+
if ((0, import_node_fs63.existsSync)(src)) {
|
|
27437
27706
|
try {
|
|
27438
|
-
(0,
|
|
27707
|
+
(0, import_node_fs63.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
27439
27708
|
} catch {
|
|
27440
27709
|
}
|
|
27441
27710
|
}
|
|
@@ -27511,22 +27780,22 @@ function listConductorWorkspaces() {
|
|
|
27511
27780
|
db.close();
|
|
27512
27781
|
}
|
|
27513
27782
|
} finally {
|
|
27514
|
-
(0,
|
|
27783
|
+
(0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
|
|
27515
27784
|
}
|
|
27516
27785
|
}
|
|
27517
27786
|
function importConductorWorkspace(workspaceId) {
|
|
27518
|
-
if (!(0,
|
|
27787
|
+
if (!(0, import_node_fs63.existsSync)(CONDUCTOR_DB)) {
|
|
27519
27788
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
27520
27789
|
}
|
|
27521
|
-
const tmp = (0,
|
|
27522
|
-
const snapshot = (0,
|
|
27790
|
+
const tmp = (0, import_node_fs63.mkdtempSync)((0, import_node_path64.join)((0, import_node_os21.tmpdir)(), "sideboard-conductor-"));
|
|
27791
|
+
const snapshot = (0, import_node_path64.join)(tmp, "conductor.db");
|
|
27523
27792
|
try {
|
|
27524
|
-
(0,
|
|
27793
|
+
(0, import_node_fs63.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
27525
27794
|
for (const suffix of ["-wal", "-shm"]) {
|
|
27526
27795
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
27527
|
-
if ((0,
|
|
27796
|
+
if ((0, import_node_fs63.existsSync)(src)) {
|
|
27528
27797
|
try {
|
|
27529
|
-
(0,
|
|
27798
|
+
(0, import_node_fs63.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
27530
27799
|
} catch {
|
|
27531
27800
|
}
|
|
27532
27801
|
}
|
|
@@ -27544,7 +27813,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
27544
27813
|
).get(workspaceId);
|
|
27545
27814
|
if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
|
|
27546
27815
|
const worktreePath = String(row.workspacePath);
|
|
27547
|
-
if (!(0,
|
|
27816
|
+
if (!(0, import_node_fs63.existsSync)(worktreePath)) {
|
|
27548
27817
|
throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
|
|
27549
27818
|
}
|
|
27550
27819
|
let sessionId = null;
|
|
@@ -27584,7 +27853,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
27584
27853
|
}
|
|
27585
27854
|
let repoPath = worktreePath;
|
|
27586
27855
|
try {
|
|
27587
|
-
repoPath = (0,
|
|
27856
|
+
repoPath = (0, import_node_child_process7.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
|
|
27588
27857
|
cwd: worktreePath,
|
|
27589
27858
|
encoding: "utf8"
|
|
27590
27859
|
}).trim();
|
|
@@ -27607,31 +27876,31 @@ function importConductorWorkspace(workspaceId) {
|
|
|
27607
27876
|
db.close();
|
|
27608
27877
|
}
|
|
27609
27878
|
} finally {
|
|
27610
|
-
(0,
|
|
27879
|
+
(0, import_node_fs63.rmSync)(tmp, { recursive: true, force: true });
|
|
27611
27880
|
}
|
|
27612
27881
|
}
|
|
27613
27882
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
27614
27883
|
return importConductorWorkspace(workspaceId);
|
|
27615
27884
|
}
|
|
27616
|
-
var
|
|
27885
|
+
var import_node_child_process7, import_node_fs63, import_node_os21, import_node_path64, import_node_module7, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
|
|
27617
27886
|
var init_adopt = __esm({
|
|
27618
27887
|
"src/threads/adopt.ts"() {
|
|
27619
27888
|
"use strict";
|
|
27620
|
-
|
|
27621
|
-
|
|
27622
|
-
|
|
27623
|
-
|
|
27889
|
+
import_node_child_process7 = require("child_process");
|
|
27890
|
+
import_node_fs63 = require("fs");
|
|
27891
|
+
import_node_os21 = require("os");
|
|
27892
|
+
import_node_path64 = require("path");
|
|
27624
27893
|
import_node_module7 = require("module");
|
|
27625
27894
|
init_worktree();
|
|
27626
27895
|
init_thread_store();
|
|
27627
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
27896
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path64.join)(
|
|
27628
27897
|
process.env.HOME ?? "",
|
|
27629
27898
|
"Library",
|
|
27630
27899
|
"Application Support",
|
|
27631
27900
|
"com.conductor.app"
|
|
27632
27901
|
);
|
|
27633
|
-
CONDUCTOR_DB = (0,
|
|
27634
|
-
CURSOR_SDK_STORE = (0,
|
|
27902
|
+
CONDUCTOR_DB = (0, import_node_path64.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
27903
|
+
CURSOR_SDK_STORE = (0, import_node_path64.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
27635
27904
|
}
|
|
27636
27905
|
});
|
|
27637
27906
|
|
|
@@ -27698,7 +27967,7 @@ async function openStackLayer(input, _onSetupLine) {
|
|
|
27698
27967
|
let createdWorktree = false;
|
|
27699
27968
|
const trees = await listWorktrees(repoPath);
|
|
27700
27969
|
const checkedOut = trees.find((w) => w.branch === branchName);
|
|
27701
|
-
if (checkedOut?.path && (0,
|
|
27970
|
+
if (checkedOut?.path && (0, import_node_fs64.existsSync)(checkedOut.path)) {
|
|
27702
27971
|
if (input.reuseExistingWorktree !== false) {
|
|
27703
27972
|
worktreePath = checkedOut.path;
|
|
27704
27973
|
} else {
|
|
@@ -27840,7 +28109,7 @@ async function initStackFromThread(input, onSetupLine) {
|
|
|
27840
28109
|
async function createPrStack(input, onSetupLine) {
|
|
27841
28110
|
await requireAgent(input.agent);
|
|
27842
28111
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
27843
|
-
if (!(0,
|
|
28112
|
+
if (!(0, import_node_fs64.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
|
|
27844
28113
|
if (!input.branches.length) throw new Error("At least one branch name required");
|
|
27845
28114
|
const status = await detectGhStack(repoPath);
|
|
27846
28115
|
if (!status.available) throw new Error(status.reason);
|
|
@@ -27907,7 +28176,7 @@ async function createPrStack(input, onSetupLine) {
|
|
|
27907
28176
|
}
|
|
27908
28177
|
}
|
|
27909
28178
|
const claimed = new Set(threads.map((t) => t.worktreePath));
|
|
27910
|
-
if (!claimed.has(bootstrap.worktreePath) && (0,
|
|
28179
|
+
if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs64.existsSync)(bootstrap.worktreePath)) {
|
|
27911
28180
|
try {
|
|
27912
28181
|
await removeWorktree(repoPath, bootstrap.worktreePath, {
|
|
27913
28182
|
deleteBranch: bootstrap.branchName
|
|
@@ -27917,11 +28186,11 @@ async function createPrStack(input, onSetupLine) {
|
|
|
27917
28186
|
}
|
|
27918
28187
|
return { stack, threads, createdThreadIds };
|
|
27919
28188
|
}
|
|
27920
|
-
var
|
|
28189
|
+
var import_node_fs64;
|
|
27921
28190
|
var init_stack_layers = __esm({
|
|
27922
28191
|
"src/threads/stack-layers.ts"() {
|
|
27923
28192
|
"use strict";
|
|
27924
|
-
|
|
28193
|
+
import_node_fs64 = require("fs");
|
|
27925
28194
|
init_detect();
|
|
27926
28195
|
init_run();
|
|
27927
28196
|
init_stack();
|
|
@@ -27961,11 +28230,11 @@ async function formatPrCreateFailure(raw, cwd, ctx) {
|
|
|
27961
28230
|
}
|
|
27962
28231
|
async function createCursorPullRequest(worktreePath, slug, opts) {
|
|
27963
28232
|
const bodyText = (opts.body ?? opts.title).trim() || opts.title;
|
|
27964
|
-
const bodyFile = (0,
|
|
27965
|
-
(0,
|
|
28233
|
+
const bodyFile = (0, import_node_path65.join)(
|
|
28234
|
+
(0, import_node_os22.tmpdir)(),
|
|
27966
28235
|
`sideboard-pr-body-${process.pid}-${(0, import_node_crypto20.randomBytes)(6).toString("hex")}.md`
|
|
27967
28236
|
);
|
|
27968
|
-
(0,
|
|
28237
|
+
(0, import_node_fs65.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
|
|
27969
28238
|
`, "utf8");
|
|
27970
28239
|
try {
|
|
27971
28240
|
return await createOrUpdateCursorPr(worktreePath, slug, {
|
|
@@ -27977,7 +28246,7 @@ async function createCursorPullRequest(worktreePath, slug, opts) {
|
|
|
27977
28246
|
});
|
|
27978
28247
|
} finally {
|
|
27979
28248
|
try {
|
|
27980
|
-
(0,
|
|
28249
|
+
(0, import_node_fs65.unlinkSync)(bodyFile);
|
|
27981
28250
|
} catch {
|
|
27982
28251
|
}
|
|
27983
28252
|
}
|
|
@@ -28003,11 +28272,11 @@ async function createOrUpdatePr(worktreePath, opts) {
|
|
|
28003
28272
|
const headRef = ghHeadRef(slug, opts.head);
|
|
28004
28273
|
const branchOnly = opts.head.trim().replace(/^refs\/heads\//, "");
|
|
28005
28274
|
const bodyText = clampGithubPrBody(opts.body ?? opts.title);
|
|
28006
|
-
const bodyFile = (0,
|
|
28007
|
-
(0,
|
|
28275
|
+
const bodyFile = (0, import_node_path65.join)(
|
|
28276
|
+
(0, import_node_os22.tmpdir)(),
|
|
28008
28277
|
`sideboard-pr-body-${process.pid}-${(0, import_node_crypto20.randomBytes)(6).toString("hex")}.md`
|
|
28009
28278
|
);
|
|
28010
|
-
(0,
|
|
28279
|
+
(0, import_node_fs65.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
|
|
28011
28280
|
`, "utf8");
|
|
28012
28281
|
const bodyArgs = ["--body-file", bodyFile];
|
|
28013
28282
|
try {
|
|
@@ -28021,7 +28290,7 @@ async function createOrUpdatePr(worktreePath, opts) {
|
|
|
28021
28290
|
});
|
|
28022
28291
|
} finally {
|
|
28023
28292
|
try {
|
|
28024
|
-
(0,
|
|
28293
|
+
(0, import_node_fs65.unlinkSync)(bodyFile);
|
|
28025
28294
|
} catch {
|
|
28026
28295
|
}
|
|
28027
28296
|
}
|
|
@@ -28096,14 +28365,14 @@ async function createOrUpdatePrWithBodyFile(worktreePath, opts) {
|
|
|
28096
28365
|
const url = created.stdout.trim().split("\n").find((l) => l.startsWith("http")) ?? created.stdout.trim();
|
|
28097
28366
|
return url;
|
|
28098
28367
|
}
|
|
28099
|
-
var import_node_crypto20,
|
|
28368
|
+
var import_node_crypto20, import_node_fs65, import_node_os22, import_node_path65;
|
|
28100
28369
|
var init_pr_write = __esm({
|
|
28101
28370
|
"src/git/pr-write.ts"() {
|
|
28102
28371
|
"use strict";
|
|
28103
28372
|
import_node_crypto20 = require("crypto");
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28373
|
+
import_node_fs65 = require("fs");
|
|
28374
|
+
import_node_os22 = require("os");
|
|
28375
|
+
import_node_path65 = require("path");
|
|
28107
28376
|
init_gh_errors();
|
|
28108
28377
|
init_run();
|
|
28109
28378
|
init_cursor_pr();
|
|
@@ -28113,7 +28382,7 @@ var init_pr_write = __esm({
|
|
|
28113
28382
|
|
|
28114
28383
|
// src/diff/diff.ts
|
|
28115
28384
|
async function inspectGitWorktree(worktreePath) {
|
|
28116
|
-
if (!worktreePath || !(0,
|
|
28385
|
+
if (!worktreePath || !(0, import_node_fs66.existsSync)(worktreePath)) return "missing_worktree";
|
|
28117
28386
|
const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
|
|
28118
28387
|
reject: false
|
|
28119
28388
|
});
|
|
@@ -28121,7 +28390,7 @@ async function inspectGitWorktree(worktreePath) {
|
|
|
28121
28390
|
return "ok";
|
|
28122
28391
|
}
|
|
28123
28392
|
async function initializeGitRepository(worktreePath) {
|
|
28124
|
-
if (!worktreePath || !(0,
|
|
28393
|
+
if (!worktreePath || !(0, import_node_fs66.existsSync)(worktreePath)) {
|
|
28125
28394
|
throw new Error("Worktree not found");
|
|
28126
28395
|
}
|
|
28127
28396
|
const status = await inspectGitWorktree(worktreePath);
|
|
@@ -28255,11 +28524,11 @@ new file mode 100644
|
|
|
28255
28524
|
};
|
|
28256
28525
|
}
|
|
28257
28526
|
async function untrackedPatch(worktreePath, path, maxHunk) {
|
|
28258
|
-
const abs = (0,
|
|
28527
|
+
const abs = (0, import_node_path66.join)(worktreePath, path);
|
|
28259
28528
|
try {
|
|
28260
|
-
const st = (0,
|
|
28529
|
+
const st = (0, import_node_fs66.statSync)(abs);
|
|
28261
28530
|
if (st.isFile() && st.size > maxHunk) {
|
|
28262
|
-
const buf = (0,
|
|
28531
|
+
const buf = (0, import_node_fs66.readFileSync)(abs).subarray(0, maxHunk);
|
|
28263
28532
|
return syntheticAddPatch(path, buf.toString("utf8"), maxHunk);
|
|
28264
28533
|
}
|
|
28265
28534
|
} catch {
|
|
@@ -28353,13 +28622,13 @@ function formatStat(files) {
|
|
|
28353
28622
|
return `${n} file${n === 1 ? "" : "s"} changed, ${additions} insertions(+), ${deletions} deletions(-)`;
|
|
28354
28623
|
}
|
|
28355
28624
|
function emptyScopeStats() {
|
|
28356
|
-
const
|
|
28625
|
+
const z15 = emptyStat();
|
|
28357
28626
|
return {
|
|
28358
|
-
commits:
|
|
28359
|
-
uncommitted:
|
|
28360
|
-
staged:
|
|
28361
|
-
unstaged:
|
|
28362
|
-
last_turn:
|
|
28627
|
+
commits: z15,
|
|
28628
|
+
uncommitted: z15,
|
|
28629
|
+
staged: z15,
|
|
28630
|
+
unstaged: z15,
|
|
28631
|
+
last_turn: z15
|
|
28363
28632
|
};
|
|
28364
28633
|
}
|
|
28365
28634
|
function filesFromDiff(nameStatus, numstat, combinedDiff, maxHunk) {
|
|
@@ -28726,9 +28995,9 @@ async function getDiff(worktreePath, repoPath, opts) {
|
|
|
28726
28995
|
}
|
|
28727
28996
|
function statWorktreePath(worktreePath, relativePath) {
|
|
28728
28997
|
assertSafeRelativePath(relativePath);
|
|
28729
|
-
const abs = (0,
|
|
28730
|
-
if (!(0,
|
|
28731
|
-
const st = (0,
|
|
28998
|
+
const abs = (0, import_node_path66.join)(worktreePath, relativePath);
|
|
28999
|
+
if (!(0, import_node_fs66.existsSync)(abs)) return "missing";
|
|
29000
|
+
const st = (0, import_node_fs66.statSync)(abs);
|
|
28732
29001
|
if (st.isDirectory()) return "dir";
|
|
28733
29002
|
if (st.isFile()) return "file";
|
|
28734
29003
|
return "missing";
|
|
@@ -28757,8 +29026,8 @@ function isImageRelativePath(relativePath) {
|
|
|
28757
29026
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
28758
29027
|
assertSafeRelativePath(relativePath);
|
|
28759
29028
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
28760
|
-
const abs = (0,
|
|
28761
|
-
const st = (0,
|
|
29029
|
+
const abs = (0, import_node_path66.join)(worktreePath, relativePath);
|
|
29030
|
+
const st = (0, import_node_fs66.statSync)(abs);
|
|
28762
29031
|
if (!st.isFile()) {
|
|
28763
29032
|
throw new Error(`Not a file: ${relativePath}`);
|
|
28764
29033
|
}
|
|
@@ -28767,7 +29036,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
28767
29036
|
`File too large to upload (${st.size} bytes; max ${maxBytes})`
|
|
28768
29037
|
);
|
|
28769
29038
|
}
|
|
28770
|
-
const buf = (0,
|
|
29039
|
+
const buf = (0, import_node_fs66.readFileSync)(abs);
|
|
28771
29040
|
return {
|
|
28772
29041
|
path: relativePath,
|
|
28773
29042
|
contentBase64: buf.toString("base64"),
|
|
@@ -28777,12 +29046,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
28777
29046
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
28778
29047
|
assertSafeRelativePath(relativePath);
|
|
28779
29048
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
28780
|
-
const abs = (0,
|
|
28781
|
-
const st = (0,
|
|
29049
|
+
const abs = (0, import_node_path66.join)(worktreePath, relativePath);
|
|
29050
|
+
const st = (0, import_node_fs66.statSync)(abs);
|
|
28782
29051
|
if (!st.isFile()) {
|
|
28783
29052
|
throw new Error(`Not a file: ${relativePath}`);
|
|
28784
29053
|
}
|
|
28785
|
-
const buf = (0,
|
|
29054
|
+
const buf = (0, import_node_fs66.readFileSync)(abs);
|
|
28786
29055
|
if (isImageRelativePath(relativePath)) {
|
|
28787
29056
|
const maxImageBytes = Math.max(maxBytes, 15e6);
|
|
28788
29057
|
const truncated2 = buf.length > maxImageBytes;
|
|
@@ -28825,9 +29094,9 @@ function assertSafeRelativePath(relativePath) {
|
|
|
28825
29094
|
}
|
|
28826
29095
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
28827
29096
|
assertSafeRelativePath(relativePath);
|
|
28828
|
-
const abs = (0,
|
|
28829
|
-
(0,
|
|
28830
|
-
(0,
|
|
29097
|
+
const abs = (0, import_node_path66.join)(worktreePath, relativePath);
|
|
29098
|
+
(0, import_node_fs66.mkdirSync)((0, import_node_path66.dirname)(abs), { recursive: true });
|
|
29099
|
+
(0, import_node_fs66.writeFileSync)(abs, content, "utf8");
|
|
28831
29100
|
return { path: relativePath };
|
|
28832
29101
|
}
|
|
28833
29102
|
async function getWorktreeDirtyStat(worktreePath) {
|
|
@@ -28867,12 +29136,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
28867
29136
|
truncated: full.files.length > maxFiles
|
|
28868
29137
|
};
|
|
28869
29138
|
}
|
|
28870
|
-
var
|
|
29139
|
+
var import_node_fs66, import_node_path66, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
|
|
28871
29140
|
var init_diff = __esm({
|
|
28872
29141
|
"src/diff/diff.ts"() {
|
|
28873
29142
|
"use strict";
|
|
28874
|
-
|
|
28875
|
-
|
|
29143
|
+
import_node_fs66 = require("fs");
|
|
29144
|
+
import_node_path66 = require("path");
|
|
28876
29145
|
init_run();
|
|
28877
29146
|
init_worktree();
|
|
28878
29147
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -29095,16 +29364,16 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
|
|
|
29095
29364
|
if (!relativePath || relativePath.includes("..") || relativePath.startsWith("/")) {
|
|
29096
29365
|
throw new Error("Invalid path");
|
|
29097
29366
|
}
|
|
29098
|
-
const abs = (0,
|
|
29099
|
-
const fd = (0,
|
|
29367
|
+
const abs = (0, import_node_path67.join)(worktreePath, relativePath);
|
|
29368
|
+
const fd = (0, import_node_fs67.openSync)(abs, "r");
|
|
29100
29369
|
try {
|
|
29101
|
-
const st = (0,
|
|
29370
|
+
const st = (0, import_node_fs67.fstatSync)(fd);
|
|
29102
29371
|
if (!st.isFile()) throw new Error(`Not a file: ${relativePath}`);
|
|
29103
29372
|
const size = st.size;
|
|
29104
29373
|
const start = Math.max(0, size - maxBytes);
|
|
29105
29374
|
const length = size - start;
|
|
29106
29375
|
const buf = Buffer.alloc(length);
|
|
29107
|
-
if (length > 0) (0,
|
|
29376
|
+
if (length > 0) (0, import_node_fs67.readSync)(fd, buf, 0, length, start);
|
|
29108
29377
|
if (buf.subarray(0, Math.min(buf.length, 8e3)).includes(0)) {
|
|
29109
29378
|
return {
|
|
29110
29379
|
path: relativePath,
|
|
@@ -29122,15 +29391,15 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
|
|
|
29122
29391
|
}
|
|
29123
29392
|
return { path: relativePath, content, truncated, binary: false, encoding: "utf8" };
|
|
29124
29393
|
} finally {
|
|
29125
|
-
(0,
|
|
29394
|
+
(0, import_node_fs67.closeSync)(fd);
|
|
29126
29395
|
}
|
|
29127
29396
|
}
|
|
29128
|
-
var
|
|
29397
|
+
var import_node_fs67, import_node_path67, WORKTREE_TAIL_BYTES;
|
|
29129
29398
|
var init_read_worktree_tail = __esm({
|
|
29130
29399
|
"src/diff/read-worktree-tail.ts"() {
|
|
29131
29400
|
"use strict";
|
|
29132
|
-
|
|
29133
|
-
|
|
29401
|
+
import_node_fs67 = require("fs");
|
|
29402
|
+
import_node_path67 = require("path");
|
|
29134
29403
|
WORKTREE_TAIL_BYTES = 2e5;
|
|
29135
29404
|
}
|
|
29136
29405
|
});
|
|
@@ -29279,7 +29548,7 @@ function parseFrontmatter(content) {
|
|
|
29279
29548
|
}
|
|
29280
29549
|
function readSkill(skillMd, source) {
|
|
29281
29550
|
try {
|
|
29282
|
-
const content = (0,
|
|
29551
|
+
const content = (0, import_node_fs68.readFileSync)(skillMd, "utf8");
|
|
29283
29552
|
const { name: fmName, description } = parseFrontmatter(content);
|
|
29284
29553
|
const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
|
|
29285
29554
|
const name = fmName || dirName;
|
|
@@ -29298,19 +29567,19 @@ function readSkill(skillMd, source) {
|
|
|
29298
29567
|
}
|
|
29299
29568
|
}
|
|
29300
29569
|
function scanSkillsDir(dir, source, out) {
|
|
29301
|
-
if (!(0,
|
|
29570
|
+
if (!(0, import_node_fs68.existsSync)(dir)) return;
|
|
29302
29571
|
let entries;
|
|
29303
29572
|
try {
|
|
29304
|
-
entries = (0,
|
|
29573
|
+
entries = (0, import_node_fs68.readdirSync)(dir);
|
|
29305
29574
|
} catch {
|
|
29306
29575
|
return;
|
|
29307
29576
|
}
|
|
29308
29577
|
for (const entry of entries) {
|
|
29309
29578
|
if (entry.startsWith(".")) continue;
|
|
29310
|
-
const skillMd = (0,
|
|
29311
|
-
if (!(0,
|
|
29579
|
+
const skillMd = (0, import_node_path68.join)(dir, entry, "SKILL.md");
|
|
29580
|
+
if (!(0, import_node_fs68.existsSync)(skillMd)) continue;
|
|
29312
29581
|
try {
|
|
29313
|
-
if (!(0,
|
|
29582
|
+
if (!(0, import_node_fs68.statSync)(skillMd).isFile()) continue;
|
|
29314
29583
|
} catch {
|
|
29315
29584
|
continue;
|
|
29316
29585
|
}
|
|
@@ -29319,24 +29588,24 @@ function scanSkillsDir(dir, source, out) {
|
|
|
29319
29588
|
}
|
|
29320
29589
|
}
|
|
29321
29590
|
function scanClaudePluginSkills(pluginsRoot, out) {
|
|
29322
|
-
if (!(0,
|
|
29591
|
+
if (!(0, import_node_fs68.existsSync)(pluginsRoot)) return;
|
|
29323
29592
|
const walk = (dir, depth, lookingForSkillsDir) => {
|
|
29324
29593
|
if (depth > 7) return;
|
|
29325
29594
|
let entries;
|
|
29326
29595
|
try {
|
|
29327
|
-
entries = (0,
|
|
29596
|
+
entries = (0, import_node_fs68.readdirSync)(dir);
|
|
29328
29597
|
} catch {
|
|
29329
29598
|
return;
|
|
29330
29599
|
}
|
|
29331
29600
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
29332
|
-
const skill = readSkill((0,
|
|
29601
|
+
const skill = readSkill((0, import_node_path68.join)(dir, "SKILL.md"), "cli");
|
|
29333
29602
|
if (skill) out.push(skill);
|
|
29334
29603
|
}
|
|
29335
29604
|
for (const entry of entries) {
|
|
29336
29605
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
29337
|
-
const full = (0,
|
|
29606
|
+
const full = (0, import_node_path68.join)(dir, entry);
|
|
29338
29607
|
try {
|
|
29339
|
-
if (!(0,
|
|
29608
|
+
if (!(0, import_node_fs68.statSync)(full).isDirectory()) continue;
|
|
29340
29609
|
} catch {
|
|
29341
29610
|
continue;
|
|
29342
29611
|
}
|
|
@@ -29351,20 +29620,20 @@ function scanClaudePluginSkills(pluginsRoot, out) {
|
|
|
29351
29620
|
walk(pluginsRoot, 0, false);
|
|
29352
29621
|
}
|
|
29353
29622
|
function discoverSkills(worktreePath) {
|
|
29354
|
-
const home = (0,
|
|
29623
|
+
const home = (0, import_node_os23.homedir)();
|
|
29355
29624
|
const collected = [];
|
|
29356
29625
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
29357
|
-
scanSkillsDir((0,
|
|
29626
|
+
scanSkillsDir((0, import_node_path68.join)(worktreePath, rel), "workspace", collected);
|
|
29358
29627
|
}
|
|
29359
29628
|
for (const abs of [
|
|
29360
|
-
(0,
|
|
29361
|
-
(0,
|
|
29362
|
-
(0,
|
|
29363
|
-
(0,
|
|
29629
|
+
(0, import_node_path68.join)(home, ".claude/skills"),
|
|
29630
|
+
(0, import_node_path68.join)(home, ".cursor/skills"),
|
|
29631
|
+
(0, import_node_path68.join)(home, ".sideboard/skills"),
|
|
29632
|
+
(0, import_node_path68.join)(home, ".brightsy/skills")
|
|
29364
29633
|
]) {
|
|
29365
29634
|
scanSkillsDir(abs, "user", collected);
|
|
29366
29635
|
}
|
|
29367
|
-
scanClaudePluginSkills((0,
|
|
29636
|
+
scanClaudePluginSkills((0, import_node_path68.join)(home, ".claude/plugins"), collected);
|
|
29368
29637
|
collected.push(...bundledSkills());
|
|
29369
29638
|
const rank = {
|
|
29370
29639
|
workspace: 0,
|
|
@@ -29390,7 +29659,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
29390
29659
|
\u2026(truncated)` : body;
|
|
29391
29660
|
}
|
|
29392
29661
|
}
|
|
29393
|
-
const raw = (0,
|
|
29662
|
+
const raw = (0, import_node_fs68.readFileSync)(skillPath, "utf8");
|
|
29394
29663
|
if (raw.startsWith("---")) {
|
|
29395
29664
|
const end = raw.indexOf("\n---", 3);
|
|
29396
29665
|
if (end >= 0) {
|
|
@@ -29404,13 +29673,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
29404
29673
|
|
|
29405
29674
|
\u2026(truncated)` : raw;
|
|
29406
29675
|
}
|
|
29407
|
-
var
|
|
29676
|
+
var import_node_fs68, import_node_os23, import_node_path68, BUNDLED_SKILL_PREFIX;
|
|
29408
29677
|
var init_discover = __esm({
|
|
29409
29678
|
"src/skills/discover.ts"() {
|
|
29410
29679
|
"use strict";
|
|
29411
|
-
|
|
29412
|
-
|
|
29413
|
-
|
|
29680
|
+
import_node_fs68 = require("fs");
|
|
29681
|
+
import_node_os23 = require("os");
|
|
29682
|
+
import_node_path68 = require("path");
|
|
29414
29683
|
init_long_running();
|
|
29415
29684
|
BUNDLED_SKILL_PREFIX = "bundled:";
|
|
29416
29685
|
}
|
|
@@ -29696,7 +29965,10 @@ function promptForJoinedSteer(input) {
|
|
|
29696
29965
|
}
|
|
29697
29966
|
const { agentPrompt: expandedLatest } = expandComposerPrompt(
|
|
29698
29967
|
input.worktreePath,
|
|
29699
|
-
expandCanonicalGitRequest(input.latestPrompt, {
|
|
29968
|
+
expandCanonicalGitRequest(input.latestPrompt, {
|
|
29969
|
+
forge: input.gitForge,
|
|
29970
|
+
worktreePath: input.worktreePath
|
|
29971
|
+
}),
|
|
29700
29972
|
{ attachments: latestAttachments }
|
|
29701
29973
|
);
|
|
29702
29974
|
return input.expandedPrompt && input.agentPrompt.endsWith(input.expandedPrompt) ? input.agentPrompt.slice(0, -input.expandedPrompt.length) + expandedLatest : `${input.agentPrompt}
|
|
@@ -29721,10 +29993,10 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
|
|
|
29721
29993
|
throw new Error(`Thread is archived: ${thread.id}`);
|
|
29722
29994
|
}
|
|
29723
29995
|
const requested = opts?.followUp;
|
|
29724
|
-
const
|
|
29996
|
+
const join69 = requested === "join";
|
|
29725
29997
|
const followUp = resolveSendFollowUp(
|
|
29726
29998
|
current,
|
|
29727
|
-
|
|
29999
|
+
join69 ? "steer" : requested
|
|
29728
30000
|
);
|
|
29729
30001
|
const explicit = opts?.attachments;
|
|
29730
30002
|
const consumed = explicit !== void 0 ? { attachments: current.attachments, consumed: explicit } : consumeComposerAttachments(current);
|
|
@@ -29733,7 +30005,7 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
|
|
|
29733
30005
|
const draft = host.openSteerPrompt.get(current.id);
|
|
29734
30006
|
const queuedHead = !inFlightEarly && current.status === "queued" && current.queue.length > 0 ? current.queue[0] : null;
|
|
29735
30007
|
const joinCanMerge = draft != null && !draft.spawned || !inFlightEarly && queuedHead != null;
|
|
29736
|
-
const unanswered = followUp === "steer" && !agentHasRepliedEarly && (!
|
|
30008
|
+
const unanswered = followUp === "steer" && !agentHasRepliedEarly && (!join69 || joinCanMerge) ? draft?.text ?? (inFlightEarly ? trailingUnansweredUserText(current.messages) : queuedHead) : null;
|
|
29737
30009
|
if (unanswered != null && (draft ? !draft.spawned : queuedHead != null)) {
|
|
29738
30010
|
clearSendBookkeeping(host, thread.id);
|
|
29739
30011
|
const combined = joinSteerPrompt(unanswered, prompt);
|
|
@@ -29785,7 +30057,7 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
|
|
|
29785
30057
|
clearSendBookkeeping(host, thread.id);
|
|
29786
30058
|
const inFlight = host.activeTurns.has(thread.id) || host.startingTurns.has(thread.id) || current.status === "running";
|
|
29787
30059
|
shouldSteer = sendFollowUpInterrupts(
|
|
29788
|
-
|
|
30060
|
+
join69 ? "join" : followUp,
|
|
29789
30061
|
inFlight || current.queue.length > 0
|
|
29790
30062
|
);
|
|
29791
30063
|
const patch = queued;
|
|
@@ -29858,7 +30130,7 @@ function compiledModuleDir() {
|
|
|
29858
30130
|
try {
|
|
29859
30131
|
const url = import_meta9.url;
|
|
29860
30132
|
if (typeof url === "string" && url.length > 0) {
|
|
29861
|
-
return (0,
|
|
30133
|
+
return (0, import_node_path69.dirname)((0, import_node_url7.fileURLToPath)(url));
|
|
29862
30134
|
}
|
|
29863
30135
|
} catch {
|
|
29864
30136
|
}
|
|
@@ -29866,8 +30138,8 @@ function compiledModuleDir() {
|
|
|
29866
30138
|
}
|
|
29867
30139
|
function detachedJobScriptIn(dir) {
|
|
29868
30140
|
for (const name of DETACHED_JOB_FILENAMES) {
|
|
29869
|
-
const script = (0,
|
|
29870
|
-
if ((0,
|
|
30141
|
+
const script = (0, import_node_path69.join)(dir, "scripts", name);
|
|
30142
|
+
if ((0, import_node_fs69.existsSync)(script)) return script;
|
|
29871
30143
|
}
|
|
29872
30144
|
return null;
|
|
29873
30145
|
}
|
|
@@ -29884,7 +30156,7 @@ function resolveDetachedJobScript() {
|
|
|
29884
30156
|
for (let i = 0; i < 8; i++) {
|
|
29885
30157
|
const candidate = detachedJobScriptIn(dir);
|
|
29886
30158
|
if (candidate) return candidate;
|
|
29887
|
-
const parent = (0,
|
|
30159
|
+
const parent = (0, import_node_path69.dirname)(dir);
|
|
29888
30160
|
if (parent === dir) break;
|
|
29889
30161
|
dir = parent;
|
|
29890
30162
|
}
|
|
@@ -29895,12 +30167,12 @@ function formatDetachedJobInvoke(scriptPath) {
|
|
|
29895
30167
|
if (resolved) return `node ${JSON.stringify(resolved)}`;
|
|
29896
30168
|
return "node scripts/detached-job.cjs";
|
|
29897
30169
|
}
|
|
29898
|
-
var
|
|
30170
|
+
var import_node_fs69, import_node_path69, import_node_url7, import_meta9, DETACHED_JOB_FILENAMES;
|
|
29899
30171
|
var init_detached_job_path = __esm({
|
|
29900
30172
|
"src/skills/detached-job-path.ts"() {
|
|
29901
30173
|
"use strict";
|
|
29902
|
-
|
|
29903
|
-
|
|
30174
|
+
import_node_fs69 = require("fs");
|
|
30175
|
+
import_node_path69 = require("path");
|
|
29904
30176
|
import_node_url7 = require("url");
|
|
29905
30177
|
init_packaged_runtime();
|
|
29906
30178
|
import_meta9 = {};
|
|
@@ -30003,6 +30275,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
30003
30275
|
lines.push(
|
|
30004
30276
|
cursorRepo ? "- Stay on this workspace branch. Never push to main/master or merge locally into the main checkout. Merge the PR only when this turn is a Merge PR request or the user explicitly asked \u2014 via Origin from this worktree (`origin pr merge` / `origin stack merge`)." : entireRepo ? "- Stay on this workspace branch. Never push to main/master or merge locally into the main checkout. Merge only when this turn is a Merge PR request or the user explicitly asked \u2014 via Entire from this worktree (`entire trail merge`)." : "- Stay on this workspace branch. Never push to main/master or merge locally into the main checkout. Merge the PR only when this turn is a Merge PR request or the user explicitly asked \u2014 via GitHub from this worktree (`gh pr merge` / `gh stack merge`)."
|
|
30005
30277
|
);
|
|
30278
|
+
if ((0, import_node_fs70.existsSync)((0, import_node_path70.join)(worktree, ".claude/skills/announce-on-x/SKILL.md"))) lines.push("- After that merge to the default branch succeeds, follow `.claude/skills/announce-on-x/SKILL.md` (`/announce-on-x`) before the turn ends. Post or skip each pull request that merge landed on the default branch. Do not schedule a catch-up.");
|
|
30006
30279
|
if (thread.prUrl) {
|
|
30007
30280
|
lines.push(
|
|
30008
30281
|
`- A PR already exists (${thread.prUrl}). Update it (push + edit title/body if the purpose drifted) instead of opening a duplicate.`
|
|
@@ -30029,6 +30302,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
30029
30302
|
);
|
|
30030
30303
|
lines.push("");
|
|
30031
30304
|
lines.push(formatDevAccessHint(opts?.activeRuns));
|
|
30305
|
+
lines.push(formatComputerUseHint(computerUseEnabled()));
|
|
30032
30306
|
lines.push("");
|
|
30033
30307
|
lines.push(
|
|
30034
30308
|
"Automations (sidebar, after Board): `create_schedule` / `list_schedules` (`at` / `every` / `cron` / `time`+`days`). `archiveChat=false` keeps the new chat. `chatId=self` is removed when this chat is archived. Fires only while Sideboard.app is running. Future jobs turn on Caffeinate. `create_follow_up` (ci|at) waits behind this turn."
|
|
@@ -30137,16 +30411,16 @@ function formatPrGateDirective() {
|
|
|
30137
30411
|
}
|
|
30138
30412
|
function formatProcessGuideDirective(opts) {
|
|
30139
30413
|
const worktree = opts?.worktreePath?.trim();
|
|
30140
|
-
const hasGraphSkill = !!worktree && (0,
|
|
30141
|
-
const hasReviewSkill = !!worktree && (0,
|
|
30142
|
-
const hasInstallSkill = !!worktree && (0,
|
|
30414
|
+
const hasGraphSkill = !!worktree && (0, import_node_fs70.existsSync)((0, import_node_path70.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
|
|
30415
|
+
const hasReviewSkill = !!worktree && (0, import_node_fs70.existsSync)((0, import_node_path70.join)(worktree, ".claude/skills/review/SKILL.md"));
|
|
30416
|
+
const hasInstallSkill = !!worktree && (0, import_node_fs70.existsSync)((0, import_node_path70.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
|
|
30143
30417
|
return [
|
|
30144
30418
|
"Process guides (recurring work only):",
|
|
30145
30419
|
hasGraphSkill ? "- Migrations, ports, batch fixes, and other fan-out: follow `.claude/skills/graph-engineering/SKILL.md` (`/graph-engineering`). Judge first; state on disk; grow the rulebook; do not patch around it." : null,
|
|
30146
30420
|
hasInstallSkill ? "- After merge-from-main / lockfile change, or a hung `pnpm install`: follow `.claude/skills/worktree-install/SKILL.md` (`/worktree-install`). Use the worktree-local store Sideboard already set; do not share `~/.pnpm-store` across concurrent worktrees." : null,
|
|
30147
30421
|
"- If this same shape of work will happen again, write `.claude/skills/<kebab-name>/SKILL.md` in this worktree (Claude Code project skill; Sideboard `/name`, Claude Code, and `attach` all load it). Not under `.sideboard/skills/`. Point Codex/OpenCode at it from `AGENTS.md`.",
|
|
30148
30422
|
hasReviewSkill ? "- Merge-readiness notes go in `.claude/skills/review/SKILL.md` (edit it; do not create another review skill)." : "- Merge-readiness notes go in `.context/review.md` (copied from `.sideboard/review.md` when that file exists). Do not create a review skill.",
|
|
30149
|
-
!!worktree && (0,
|
|
30423
|
+
!!worktree && (0, import_node_fs70.existsSync)((0, import_node_path70.join)(worktree, ".claude/skills/skill-improver/SKILL.md")) ? "- Skip a guide for a one-off. If a matching skill exists, follow it. A miss that will recur (you made it twice, or a person told you the rule) \u2192 follow `.claude/skills/skill-improver/SKILL.md` (`/skill-improver`): one sentence in the skill that owns it, in this change. Do not patch around it." : "- Skip a guide for a one-off. If a matching skill exists, follow it. Same miss twice \u2192 edit the skill, do not patch around it."
|
|
30150
30424
|
].filter(Boolean).join("\n");
|
|
30151
30425
|
}
|
|
30152
30426
|
function formatLongRunningDirective(opts) {
|
|
@@ -30179,12 +30453,12 @@ function formatArtifactDirective() {
|
|
|
30179
30453
|
function formatUiReminder() {
|
|
30180
30454
|
return "Sideboard UI: markdown table is enough to read data; present_schema if they ask to edit/filter (even after markdown); present_files for the file manager. html fence or present_artifact, not both for the same document. type=log appends (same artifact_id, new lines only). Chat links: `[name](sideboard://artifact/<id-or-title>)` opens that pane; `[name](sideboard://file/path#L12-L40)` opens a file. ask_user only for a real multiple-choice (not hellos, \u201Cwhat next?\u201D, or after a review) \u2014 reply in chat. ask_user wakes the parent orchestrator; notify_orchestrator if blocked without a picker. Do not say artifacts/CMS UI are unavailable. Dev / preview: run_dev_script (same as the Dev button; pass name \u2014 several scripts can run at once) returns {url, port, preview} (SIDEBOARD_PORT \u2014 never guess :3000). preview=url \u2192 open url; preview=window \u2192 Electron window is the app, url is renderer/HMR only. list_run_scripts active[].url if already running; get_run_log for that script\u2019s Run-tab terminal; stop_dev_script to stop one.";
|
|
30181
30455
|
}
|
|
30182
|
-
var
|
|
30456
|
+
var import_node_fs70, import_node_path70, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
|
|
30183
30457
|
var init_instructions = __esm({
|
|
30184
30458
|
"src/agents/instructions.ts"() {
|
|
30185
30459
|
"use strict";
|
|
30186
|
-
|
|
30187
|
-
|
|
30460
|
+
import_node_fs70 = require("fs");
|
|
30461
|
+
import_node_path70 = require("path");
|
|
30188
30462
|
init_git_auth_mode();
|
|
30189
30463
|
init_forge_git_directives();
|
|
30190
30464
|
init_branch_prefix();
|
|
@@ -30192,6 +30466,8 @@ var init_instructions = __esm({
|
|
|
30192
30466
|
init_detached_job_path();
|
|
30193
30467
|
init_global_workspace();
|
|
30194
30468
|
init_connected_orchestrator();
|
|
30469
|
+
init_app_settings();
|
|
30470
|
+
init_computer_use();
|
|
30195
30471
|
PR_GOAL_RE = /greptile|\bci\b.*\b(green|pass)|checks?\s+(pass|green)|until\s+.*\b(pass|green|merge|clean)|\bfix ci\b|watch[- ]fix[- ]push/i;
|
|
30196
30472
|
GITHUB_TICKET_REF = /^(?:#?\d+|gh-\d+)$/i;
|
|
30197
30473
|
KEYED_TICKET_REF = /^(?:[A-Z][A-Z0-9]{0,9}-\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;
|
|
@@ -30854,40 +31130,40 @@ __export(plan_file_exports, {
|
|
|
30854
31130
|
writePlanFile: () => writePlanFile
|
|
30855
31131
|
});
|
|
30856
31132
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
30857
|
-
const gitignoreAbs = (0,
|
|
30858
|
-
if ((0,
|
|
30859
|
-
(0,
|
|
30860
|
-
(0,
|
|
31133
|
+
const gitignoreAbs = (0, import_node_path71.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
31134
|
+
if ((0, import_node_fs71.existsSync)(gitignoreAbs)) return;
|
|
31135
|
+
(0, import_node_fs71.mkdirSync)((0, import_node_path71.dirname)(gitignoreAbs), { recursive: true });
|
|
31136
|
+
(0, import_node_fs71.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
30861
31137
|
}
|
|
30862
31138
|
function planFileAbs(worktreePath) {
|
|
30863
|
-
return (0,
|
|
31139
|
+
return (0, import_node_path71.join)(worktreePath, PLAN_FILE_REL);
|
|
30864
31140
|
}
|
|
30865
31141
|
function readTextIfPresent2(abs) {
|
|
30866
|
-
if (!(0,
|
|
31142
|
+
if (!(0, import_node_fs71.existsSync)(abs)) return null;
|
|
30867
31143
|
try {
|
|
30868
|
-
const content = (0,
|
|
31144
|
+
const content = (0, import_node_fs71.readFileSync)(abs, "utf8");
|
|
30869
31145
|
return content.trim() ? content : null;
|
|
30870
31146
|
} catch {
|
|
30871
31147
|
return null;
|
|
30872
31148
|
}
|
|
30873
31149
|
}
|
|
30874
31150
|
function readPlanFile(worktreePath) {
|
|
30875
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
31151
|
+
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path71.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path71.join)(worktreePath, LEGACY_PLAN_FILE_REL));
|
|
30876
31152
|
}
|
|
30877
31153
|
function writePlanFile(worktreePath, content) {
|
|
30878
31154
|
ensureAttachmentsGitignore(worktreePath);
|
|
30879
31155
|
const abs = planFileAbs(worktreePath);
|
|
30880
|
-
(0,
|
|
31156
|
+
(0, import_node_fs71.mkdirSync)((0, import_node_path71.dirname)(abs), { recursive: true });
|
|
30881
31157
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
30882
|
-
(0,
|
|
31158
|
+
(0, import_node_fs71.writeFileSync)(abs, body, "utf8");
|
|
30883
31159
|
return PLAN_FILE_REL;
|
|
30884
31160
|
}
|
|
30885
|
-
var
|
|
31161
|
+
var import_node_fs71, import_node_path71;
|
|
30886
31162
|
var init_plan_file = __esm({
|
|
30887
31163
|
"src/plan/plan-file.ts"() {
|
|
30888
31164
|
"use strict";
|
|
30889
|
-
|
|
30890
|
-
|
|
31165
|
+
import_node_fs71 = require("fs");
|
|
31166
|
+
import_node_path71 = require("path");
|
|
30891
31167
|
init_workspace_scratch();
|
|
30892
31168
|
init_plan_present();
|
|
30893
31169
|
init_plan_present();
|
|
@@ -30936,7 +31212,7 @@ function setCaffeinateHoldHooks(next) {
|
|
|
30936
31212
|
hooks = next;
|
|
30937
31213
|
}
|
|
30938
31214
|
function caffeinateHoldPath() {
|
|
30939
|
-
return (0,
|
|
31215
|
+
return (0, import_node_path72.join)(appDataDir(), "caffeinate-hold.json");
|
|
30940
31216
|
}
|
|
30941
31217
|
function processAlive(pid) {
|
|
30942
31218
|
if (hooks.processAlive) return hooks.processAlive(pid);
|
|
@@ -30970,9 +31246,9 @@ function uniqueIds(ids) {
|
|
|
30970
31246
|
}
|
|
30971
31247
|
function readHold() {
|
|
30972
31248
|
const path = caffeinateHoldPath();
|
|
30973
|
-
if (!(0,
|
|
31249
|
+
if (!(0, import_node_fs72.existsSync)(path)) return null;
|
|
30974
31250
|
try {
|
|
30975
|
-
const parsed = JSON.parse((0,
|
|
31251
|
+
const parsed = JSON.parse((0, import_node_fs72.readFileSync)(path, "utf8"));
|
|
30976
31252
|
if (typeof parsed?.pid === "number" && parsed.pid > 0) {
|
|
30977
31253
|
return {
|
|
30978
31254
|
pid: parsed.pid,
|
|
@@ -30994,7 +31270,7 @@ function writeHold(pid, threadIds) {
|
|
|
30994
31270
|
}
|
|
30995
31271
|
function clearHold() {
|
|
30996
31272
|
try {
|
|
30997
|
-
(0,
|
|
31273
|
+
(0, import_node_fs72.unlinkSync)(caffeinateHoldPath());
|
|
30998
31274
|
} catch {
|
|
30999
31275
|
}
|
|
31000
31276
|
}
|
|
@@ -31052,7 +31328,7 @@ function setCaffeinateHold(enabled, opts) {
|
|
|
31052
31328
|
if (platform !== "darwin") {
|
|
31053
31329
|
return idleState(platform);
|
|
31054
31330
|
}
|
|
31055
|
-
const spawnImpl = hooks.spawn ??
|
|
31331
|
+
const spawnImpl = hooks.spawn ?? import_node_child_process8.spawn;
|
|
31056
31332
|
const child = spawnImpl("caffeinate", ["-dimsu"], {
|
|
31057
31333
|
detached: true,
|
|
31058
31334
|
stdio: "ignore"
|
|
@@ -31079,13 +31355,13 @@ function releaseCaffeinateHoldForThread(threadId) {
|
|
|
31079
31355
|
}
|
|
31080
31356
|
return setCaffeinateHold(false, { threadId: id });
|
|
31081
31357
|
}
|
|
31082
|
-
var
|
|
31358
|
+
var import_node_child_process8, import_node_fs72, import_node_path72, hooks;
|
|
31083
31359
|
var init_caffeinate_hold = __esm({
|
|
31084
31360
|
"src/store/caffeinate-hold.ts"() {
|
|
31085
31361
|
"use strict";
|
|
31086
|
-
|
|
31087
|
-
|
|
31088
|
-
|
|
31362
|
+
import_node_child_process8 = require("child_process");
|
|
31363
|
+
import_node_fs72 = require("fs");
|
|
31364
|
+
import_node_path72 = require("path");
|
|
31089
31365
|
init_paths();
|
|
31090
31366
|
init_private_file();
|
|
31091
31367
|
hooks = {};
|
|
@@ -31363,13 +31639,13 @@ var init_github_edge = __esm({
|
|
|
31363
31639
|
|
|
31364
31640
|
// src/orchestrator/github-edge-watch.ts
|
|
31365
31641
|
function githubEdgeSnapshotPath() {
|
|
31366
|
-
return (0,
|
|
31642
|
+
return (0, import_node_path73.join)(appDataDir(), "github-edge-watch.json");
|
|
31367
31643
|
}
|
|
31368
31644
|
function loadGithubEdgeSnapshot() {
|
|
31369
31645
|
try {
|
|
31370
31646
|
const path = githubEdgeSnapshotPath();
|
|
31371
|
-
if (!(0,
|
|
31372
|
-
return coerceGithubEdgeSnapshot(JSON.parse((0,
|
|
31647
|
+
if (!(0, import_node_fs73.existsSync)(path)) return emptyGithubEdgeSnapshot();
|
|
31648
|
+
return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs73.readFileSync)(path, "utf8")));
|
|
31373
31649
|
} catch {
|
|
31374
31650
|
return emptyGithubEdgeSnapshot();
|
|
31375
31651
|
}
|
|
@@ -31684,12 +31960,12 @@ function realDeps() {
|
|
|
31684
31960
|
now: () => Date.now()
|
|
31685
31961
|
};
|
|
31686
31962
|
}
|
|
31687
|
-
var
|
|
31963
|
+
var import_node_fs73, import_node_path73, timer, polling, needsBaseline;
|
|
31688
31964
|
var init_github_edge_watch = __esm({
|
|
31689
31965
|
"src/orchestrator/github-edge-watch.ts"() {
|
|
31690
31966
|
"use strict";
|
|
31691
|
-
|
|
31692
|
-
|
|
31967
|
+
import_node_fs73 = require("fs");
|
|
31968
|
+
import_node_path73 = require("path");
|
|
31693
31969
|
init_pr_gates();
|
|
31694
31970
|
init_pr_merge_archive();
|
|
31695
31971
|
init_worktree();
|
|
@@ -31972,9 +32248,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
31972
32248
|
return best;
|
|
31973
32249
|
}
|
|
31974
32250
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
31975
|
-
if (!(0,
|
|
32251
|
+
if (!(0, import_node_fs74.existsSync)(runsPath)) return null;
|
|
31976
32252
|
try {
|
|
31977
|
-
const lines = (0,
|
|
32253
|
+
const lines = (0, import_node_fs74.readFileSync)(runsPath, "utf8").split("\n");
|
|
31978
32254
|
let best = null;
|
|
31979
32255
|
for (const line of lines) {
|
|
31980
32256
|
const trimmed = line.trim();
|
|
@@ -32000,11 +32276,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
32000
32276
|
return null;
|
|
32001
32277
|
}
|
|
32002
32278
|
}
|
|
32003
|
-
var
|
|
32279
|
+
var import_node_fs74;
|
|
32004
32280
|
var init_cursor_recover = __esm({
|
|
32005
32281
|
"src/agents/cursor-recover.ts"() {
|
|
32006
32282
|
"use strict";
|
|
32007
|
-
|
|
32283
|
+
import_node_fs74 = require("fs");
|
|
32008
32284
|
init_cursor_store();
|
|
32009
32285
|
}
|
|
32010
32286
|
});
|
|
@@ -32108,7 +32384,7 @@ async function startOrchestration(opts) {
|
|
|
32108
32384
|
}
|
|
32109
32385
|
return ready;
|
|
32110
32386
|
}
|
|
32111
|
-
var import_node_events, import_node_crypto21,
|
|
32387
|
+
var import_node_events, import_node_crypto21, import_node_fs75, LIVE_TURN_SPAWN_GRACE_MS, RUN_SCRIPT_DESKTOP_ADOPT_MS, STALE_AGENT_PID_WAIT_MS, LIGHT_RECONCILE_THROTTLE_MS, Orchestrator, singleton2;
|
|
32112
32388
|
var init_orchestrator = __esm({
|
|
32113
32389
|
"src/orchestrator/orchestrator.ts"() {
|
|
32114
32390
|
"use strict";
|
|
@@ -32117,7 +32393,7 @@ var init_orchestrator = __esm({
|
|
|
32117
32393
|
init_task_state();
|
|
32118
32394
|
init_wait_for_turn();
|
|
32119
32395
|
import_node_crypto21 = require("crypto");
|
|
32120
|
-
|
|
32396
|
+
import_node_fs75 = require("fs");
|
|
32121
32397
|
init_error_detail();
|
|
32122
32398
|
init_run();
|
|
32123
32399
|
init_stale_lock();
|
|
@@ -32321,7 +32597,7 @@ var init_orchestrator = __esm({
|
|
|
32321
32597
|
this.lightReconcileAt.set(repoPath, Date.now());
|
|
32322
32598
|
for (const thread of listThreads()) {
|
|
32323
32599
|
if (isGlobalThread(thread) || thread.repoPath !== repoPath) continue;
|
|
32324
|
-
if (!(0,
|
|
32600
|
+
if (!(0, import_node_fs75.existsSync)(thread.worktreePath)) {
|
|
32325
32601
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
32326
32602
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
32327
32603
|
}
|
|
@@ -32350,7 +32626,7 @@ var init_orchestrator = __esm({
|
|
|
32350
32626
|
}
|
|
32351
32627
|
continue;
|
|
32352
32628
|
}
|
|
32353
|
-
if (!(0,
|
|
32629
|
+
if (!(0, import_node_fs75.existsSync)(thread.worktreePath)) {
|
|
32354
32630
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
32355
32631
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
32356
32632
|
continue;
|
|
@@ -33078,7 +33354,10 @@ var init_orchestrator = __esm({
|
|
|
33078
33354
|
}
|
|
33079
33355
|
thread = this.requireThread(threadId);
|
|
33080
33356
|
const turnOrigin = thread.worktreePath?.trim() ? await resolveOriginRemote(thread.worktreePath).catch(() => null) : null;
|
|
33081
|
-
const gitPrompt = expandCanonicalGitRequest(promptText, {
|
|
33357
|
+
const gitPrompt = expandCanonicalGitRequest(promptText, {
|
|
33358
|
+
forge: turnOrigin?.forge,
|
|
33359
|
+
worktreePath: thread.worktreePath
|
|
33360
|
+
});
|
|
33082
33361
|
const expandedAttachments = openSteerTurnAttachments(this.openSteerPrompt.get(threadId), turnAttachments, autoContinue);
|
|
33083
33362
|
const { agentPrompt: expandedPrompt } = expandComposerPrompt(
|
|
33084
33363
|
thread.worktreePath,
|
|
@@ -34836,7 +35115,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
34836
35115
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
34837
35116
|
return restored2;
|
|
34838
35117
|
}
|
|
34839
|
-
if (!(0,
|
|
35118
|
+
if (!(0, import_node_fs75.existsSync)(thread.worktreePath)) {
|
|
34840
35119
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
34841
35120
|
throw new Error(
|
|
34842
35121
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -35026,9 +35305,9 @@ function createClippedMcpServer() {
|
|
|
35026
35305
|
}
|
|
35027
35306
|
|
|
35028
35307
|
// src/mcp/server.ts
|
|
35029
|
-
var
|
|
35308
|
+
var import_zod14 = require("zod");
|
|
35030
35309
|
var import_node_crypto26 = require("crypto");
|
|
35031
|
-
var
|
|
35310
|
+
var import_node_path78 = require("path");
|
|
35032
35311
|
init_orchestrator();
|
|
35033
35312
|
init_task_state();
|
|
35034
35313
|
init_worktree();
|
|
@@ -35777,6 +36056,38 @@ function resolveRunScriptThreadRef(ref) {
|
|
|
35777
36056
|
return thread.id;
|
|
35778
36057
|
}
|
|
35779
36058
|
|
|
36059
|
+
// src/mcp/computer-use-tool.ts
|
|
36060
|
+
var import_zod4 = require("zod");
|
|
36061
|
+
init_computer_use();
|
|
36062
|
+
init_app_settings();
|
|
36063
|
+
init_issue_list();
|
|
36064
|
+
function registerComputerUseTool(server, catalog) {
|
|
36065
|
+
if (!catalog.has("computer_use")) return;
|
|
36066
|
+
server.tool(
|
|
36067
|
+
"computer_use",
|
|
36068
|
+
COMPUTER_USE_DESCRIPTION,
|
|
36069
|
+
{
|
|
36070
|
+
action: import_zod4.z.enum(["screenshot", "click", "type", "key", "scroll"]).describe("screenshot, click, type, key, or scroll"),
|
|
36071
|
+
x: import_zod4.z.number().optional().describe("Screen x in points, not PNG pixels, for click and scroll"),
|
|
36072
|
+
y: import_zod4.z.number().optional().describe("Screen y in points, not PNG pixels, for click and scroll"),
|
|
36073
|
+
text: import_zod4.z.string().optional().describe("Text to type"),
|
|
36074
|
+
key: import_zod4.z.string().optional().describe("One key: return, tab, escape, arrows, delete, or one character"),
|
|
36075
|
+
modifiers: import_zod4.z.array(import_zod4.z.string()).optional().describe("command, shift, option, control"),
|
|
36076
|
+
dx: import_zod4.z.number().optional().describe("Horizontal scroll in points. Positive is right"),
|
|
36077
|
+
dy: import_zod4.z.number().optional().describe("Vertical scroll in points. Positive is down")
|
|
36078
|
+
},
|
|
36079
|
+
async (args) => {
|
|
36080
|
+
const result = await performComputerUse({
|
|
36081
|
+
enabled: computerUseEnabled(),
|
|
36082
|
+
cwd: process.cwd(),
|
|
36083
|
+
input: args,
|
|
36084
|
+
runner: macosComputerUseRunner
|
|
36085
|
+
});
|
|
36086
|
+
return mcpJson(result);
|
|
36087
|
+
}
|
|
36088
|
+
);
|
|
36089
|
+
}
|
|
36090
|
+
|
|
35780
36091
|
// src/mcp/server.ts
|
|
35781
36092
|
init_chat_tabs();
|
|
35782
36093
|
init_connected_orchestrator();
|
|
@@ -36043,13 +36354,13 @@ function childThreadRefs(parentId, threads) {
|
|
|
36043
36354
|
init_app_settings();
|
|
36044
36355
|
|
|
36045
36356
|
// src/mcp/abletime-tools.ts
|
|
36046
|
-
var
|
|
36357
|
+
var import_zod6 = require("zod");
|
|
36047
36358
|
init_abletime();
|
|
36048
36359
|
init_issue_since();
|
|
36049
36360
|
init_issue_list();
|
|
36050
36361
|
|
|
36051
36362
|
// src/mcp/issue-payload.ts
|
|
36052
|
-
var
|
|
36363
|
+
var import_zod5 = require("zod");
|
|
36053
36364
|
init_abletime();
|
|
36054
36365
|
|
|
36055
36366
|
// src/mcp/smart-crush.ts
|
|
@@ -36295,7 +36606,7 @@ function crushMarkdown(text8, opts) {
|
|
|
36295
36606
|
|
|
36296
36607
|
// src/mcp/issue-payload.ts
|
|
36297
36608
|
var MCP_ISSUE_INCLUDE_VALUES = ["default", "full"];
|
|
36298
|
-
var mcpIssueIncludeSchema =
|
|
36609
|
+
var mcpIssueIncludeSchema = import_zod5.z.enum(MCP_ISSUE_INCLUDE_VALUES).optional().describe(
|
|
36299
36610
|
"default applies SmartCrusher-style crush (dedup + budget; small unique tickets pass through). full returns the uncompressed vendor payload. Re-call with include=full if crush.truncated."
|
|
36300
36611
|
);
|
|
36301
36612
|
var MCP_ISSUE_CRUSH_HINT = "Pass include=full to re-fetch the uncompressed ticket from the vendor.";
|
|
@@ -36441,7 +36752,7 @@ function registerAbleTimeTools(server) {
|
|
|
36441
36752
|
server.tool(
|
|
36442
36753
|
"abletime_list_tasks",
|
|
36443
36754
|
"List open AbleTime tasks (excludes done/archived). Optional projectId filter. Pass updatedSince for tasks updated since then and any comments on that page.",
|
|
36444
|
-
{ projectId:
|
|
36755
|
+
{ projectId: import_zod6.z.string().optional(), updatedSince: mcpIssueUpdatedSinceSchema },
|
|
36445
36756
|
async ({ projectId, updatedSince }) => {
|
|
36446
36757
|
try {
|
|
36447
36758
|
const tasks = await listAbleTimeTasks({ projectId });
|
|
@@ -36454,7 +36765,7 @@ function registerAbleTimeTools(server) {
|
|
|
36454
36765
|
server.tool(
|
|
36455
36766
|
"abletime_search_tasks",
|
|
36456
36767
|
"Search AbleTime tasks by text, reference, or tag. Pass updatedSince for tasks updated since then and any comments on that page.",
|
|
36457
|
-
{ query:
|
|
36768
|
+
{ query: import_zod6.z.string(), updatedSince: mcpIssueUpdatedSinceSchema },
|
|
36458
36769
|
async ({ query, updatedSince }) => {
|
|
36459
36770
|
try {
|
|
36460
36771
|
const tasks = await searchAbleTimeTasks(query);
|
|
@@ -36467,7 +36778,7 @@ function registerAbleTimeTools(server) {
|
|
|
36467
36778
|
server.tool(
|
|
36468
36779
|
"abletime_get_task",
|
|
36469
36780
|
"Get one AbleTime task by id or reference (e.g. CRM-232): description, state, project, comments, attachments. Re-fetch to read new comments. Default crushes redundant comments and huge pasted bodies (SmartCrusher-style; small unique tickets pass through). Pass include=full for the uncompressed vendor payload. To save a file, call abletime_download_attachment with the attachment id or url (writes `.context/attachments/`; do not dump bytes into the tool result).",
|
|
36470
|
-
{ id:
|
|
36781
|
+
{ id: import_zod6.z.string(), include: mcpIssueIncludeSchema },
|
|
36471
36782
|
async ({ id, include }) => {
|
|
36472
36783
|
try {
|
|
36473
36784
|
return text3(formatAbleTimeTaskPayload(await getAbleTimeTask(id), include));
|
|
@@ -36480,9 +36791,9 @@ function registerAbleTimeTools(server) {
|
|
|
36480
36791
|
"abletime_download_attachment",
|
|
36481
36792
|
"Download an AbleTime task file into `.context/attachments/` using Account AbleTime auth. Pass the attachment id or URL from abletime_get_task. Returns the worktree-relative path \u2014 Read that file; do not dump bytes into chat.",
|
|
36482
36793
|
{
|
|
36483
|
-
id:
|
|
36484
|
-
name:
|
|
36485
|
-
repoPath:
|
|
36794
|
+
id: import_zod6.z.string().describe("Attachment id or URL from abletime_get_task."),
|
|
36795
|
+
name: import_zod6.z.string().optional().describe("Optional filename override."),
|
|
36796
|
+
repoPath: import_zod6.z.string().optional().describe("Workspace / worktree path. Omit on a worktree turn (uses cwd).")
|
|
36486
36797
|
},
|
|
36487
36798
|
async ({ id, name, repoPath }) => {
|
|
36488
36799
|
try {
|
|
@@ -36495,7 +36806,7 @@ function registerAbleTimeTools(server) {
|
|
|
36495
36806
|
server.tool(
|
|
36496
36807
|
"abletime_comment",
|
|
36497
36808
|
"Add a markdown comment on an AbleTime task (id or CRM-232). When reviewing a PR or ticket, show the draft in chat and wait until they type a next step \u2014 do not ask_user after the review. The author sees this immediately.",
|
|
36498
|
-
{ id:
|
|
36809
|
+
{ id: import_zod6.z.string(), body: import_zod6.z.string() },
|
|
36499
36810
|
async (args) => {
|
|
36500
36811
|
try {
|
|
36501
36812
|
return text3(await commentAbleTimeTask(args));
|
|
@@ -36504,23 +36815,23 @@ function registerAbleTimeTools(server) {
|
|
|
36504
36815
|
}
|
|
36505
36816
|
}
|
|
36506
36817
|
);
|
|
36507
|
-
const relationInputSchema =
|
|
36508
|
-
type:
|
|
36509
|
-
issue:
|
|
36818
|
+
const relationInputSchema = import_zod6.z.object({
|
|
36819
|
+
type: import_zod6.z.string().describe("blockedBy (this waits on issue) or blocks (issue waits on this)."),
|
|
36820
|
+
issue: import_zod6.z.string().describe("Related task id or reference (CRM-232).")
|
|
36510
36821
|
});
|
|
36511
36822
|
server.tool(
|
|
36512
36823
|
"abletime_update_task",
|
|
36513
36824
|
'Update an AbleTime task (id or CRM-232). Pass title, description, state, labels, project, parent, and/or relations. labels replaces tags. project is name or id (tasks stay in a project). parent is CRM-232 or "none". relations sets the wait-on dependency (blockedBy/blocks); removeRelations clears it. When reviewing a PR or ticket, wait until they type a next step before changing the task \u2014 do not ask_user after the review. The author is notified.',
|
|
36514
36825
|
{
|
|
36515
|
-
id:
|
|
36516
|
-
title:
|
|
36517
|
-
description:
|
|
36518
|
-
state:
|
|
36519
|
-
labels:
|
|
36520
|
-
project:
|
|
36521
|
-
parent:
|
|
36522
|
-
relations:
|
|
36523
|
-
removeRelations:
|
|
36826
|
+
id: import_zod6.z.string(),
|
|
36827
|
+
title: import_zod6.z.string().optional(),
|
|
36828
|
+
description: import_zod6.z.string().optional(),
|
|
36829
|
+
state: import_zod6.z.string().optional(),
|
|
36830
|
+
labels: import_zod6.z.array(import_zod6.z.string()).optional().describe("Replace tags/labels. Empty array clears when the host accepts it."),
|
|
36831
|
+
project: import_zod6.z.string().nullable().optional().describe("Project name or id. AbleTime tasks stay in a project."),
|
|
36832
|
+
parent: import_zod6.z.string().nullable().optional().describe('Parent task id or reference (CRM-232), or "none" to unset.'),
|
|
36833
|
+
relations: import_zod6.z.array(relationInputSchema).optional().describe("Set a wait-on dependency: blockedBy or blocks."),
|
|
36834
|
+
removeRelations: import_zod6.z.array(relationInputSchema).optional().describe("Clear a wait-on dependency.")
|
|
36524
36835
|
},
|
|
36525
36836
|
async (args) => {
|
|
36526
36837
|
try {
|
|
@@ -36539,12 +36850,12 @@ function registerAbleTimeTools(server) {
|
|
|
36539
36850
|
"abletime_create_task",
|
|
36540
36851
|
"Create an AbleTime task in a project. Call abletime_list_projects if you do not have a project id. Pass parent (CRM-232) for a spin-off. New tasks start in todo (or backlog).",
|
|
36541
36852
|
{
|
|
36542
|
-
title:
|
|
36543
|
-
description:
|
|
36544
|
-
projectId:
|
|
36545
|
-
categoryId:
|
|
36546
|
-
state:
|
|
36547
|
-
parent:
|
|
36853
|
+
title: import_zod6.z.string(),
|
|
36854
|
+
description: import_zod6.z.string().optional(),
|
|
36855
|
+
projectId: import_zod6.z.string().optional(),
|
|
36856
|
+
categoryId: import_zod6.z.string().optional(),
|
|
36857
|
+
state: import_zod6.z.enum(["backlog", "todo"]).optional(),
|
|
36858
|
+
parent: import_zod6.z.string().optional().describe("Parent task id or reference (CRM-232) for a spin-off.")
|
|
36548
36859
|
},
|
|
36549
36860
|
async (args) => {
|
|
36550
36861
|
try {
|
|
@@ -36558,10 +36869,10 @@ function registerAbleTimeTools(server) {
|
|
|
36558
36869
|
"abletime_ensure_task",
|
|
36559
36870
|
"Find or create an AbleTime task for this work, then create_workspace with sourceType=ticket.",
|
|
36560
36871
|
{
|
|
36561
|
-
title:
|
|
36562
|
-
description:
|
|
36563
|
-
projectId:
|
|
36564
|
-
categoryId:
|
|
36872
|
+
title: import_zod6.z.string(),
|
|
36873
|
+
description: import_zod6.z.string().optional(),
|
|
36874
|
+
projectId: import_zod6.z.string().optional(),
|
|
36875
|
+
categoryId: import_zod6.z.string().optional()
|
|
36565
36876
|
},
|
|
36566
36877
|
async (args) => {
|
|
36567
36878
|
try {
|
|
@@ -36575,7 +36886,7 @@ function registerAbleTimeTools(server) {
|
|
|
36575
36886
|
}
|
|
36576
36887
|
|
|
36577
36888
|
// src/mcp/github-tools.ts
|
|
36578
|
-
var
|
|
36889
|
+
var import_zod7 = require("zod");
|
|
36579
36890
|
init_worktree();
|
|
36580
36891
|
init_issue_since();
|
|
36581
36892
|
init_issue_list();
|
|
@@ -36592,15 +36903,15 @@ async function cursorIssueBlock(repoPath) {
|
|
|
36592
36903
|
const cwd = await resolveRepoRoot((repoPath ?? "").trim() || process.cwd());
|
|
36593
36904
|
return cursorIssuesUnavailableReason(cwd);
|
|
36594
36905
|
}
|
|
36595
|
-
var repoPathSchema =
|
|
36906
|
+
var repoPathSchema = import_zod7.z.string().optional().describe("Workspace / worktree path. Omit on a worktree turn (uses cwd).");
|
|
36596
36907
|
function registerGithubIssueTools(server) {
|
|
36597
36908
|
server.tool(
|
|
36598
36909
|
"github_search_issues",
|
|
36599
36910
|
"Search or list open GitHub issues in this repo via Account gh. A Cursor origin returns unavailableReason \u2014 Origin has no issue tracker. An Entire origin does the same \u2014 tickets there are Trails (`entire trail`), not GitHub Issues. Default 40; pass query and/or limit (max 250) when truncated. assignee: me, unassigned, all, or a login. Pass updatedSince for new/updated tickets and new comments (e.g. \u201Cany updates since yesterday?\u201D).",
|
|
36600
36911
|
{
|
|
36601
|
-
query:
|
|
36602
|
-
assignee:
|
|
36603
|
-
limit:
|
|
36912
|
+
query: import_zod7.z.string().optional().describe("Search text (title, body, identifiers). Omit to list by assignee only."),
|
|
36913
|
+
assignee: import_zod7.z.string().optional().describe("me, unassigned, all, or a GitHub login. Default: all when query is set, otherwise me."),
|
|
36914
|
+
limit: import_zod7.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
36604
36915
|
updatedSince: mcpIssueUpdatedSinceSchema,
|
|
36605
36916
|
repoPath: repoPathSchema
|
|
36606
36917
|
},
|
|
@@ -36663,7 +36974,7 @@ function registerGithubIssueTools(server) {
|
|
|
36663
36974
|
server.tool(
|
|
36664
36975
|
"github_get_issue",
|
|
36665
36976
|
"Get a GitHub issue (#123 or URL): body, comments, state, projects, attachments. Re-fetch to read new comments. projectsError means GitHub refused Projects (usually missing read:project \u2014 run `gh auth refresh -s read:project`). Default crushes redundant comments and huge pasted bodies (SmartCrusher-style; small unique tickets pass through). Pass include=full for the uncompressed vendor payload. Uses Account gh. To save a file, call github_download_attachment with the attachment URL (writes `.context/attachments/`; do not dump bytes into the tool result).",
|
|
36666
|
-
{ id:
|
|
36977
|
+
{ id: import_zod7.z.string(), include: mcpIssueIncludeSchema, repoPath: repoPathSchema },
|
|
36667
36978
|
async ({ id, include, repoPath }) => {
|
|
36668
36979
|
try {
|
|
36669
36980
|
const blocked = await cursorIssueBlock(repoPath);
|
|
@@ -36678,8 +36989,8 @@ function registerGithubIssueTools(server) {
|
|
|
36678
36989
|
"github_download_attachment",
|
|
36679
36990
|
"Download a GitHub issue file (github.com/user-attachments/\u2026 or githubusercontent.com) into `.context/attachments/` using Account gh. Pass the URL from github_get_issue attachments. Returns the worktree-relative path \u2014 Read that file; do not dump bytes into chat.",
|
|
36680
36991
|
{
|
|
36681
|
-
url:
|
|
36682
|
-
name:
|
|
36992
|
+
url: import_zod7.z.string().describe("Attachment URL from github_get_issue."),
|
|
36993
|
+
name: import_zod7.z.string().optional().describe("Optional filename override."),
|
|
36683
36994
|
repoPath: repoPathSchema
|
|
36684
36995
|
},
|
|
36685
36996
|
async ({ url, name, repoPath }) => {
|
|
@@ -36693,7 +37004,7 @@ function registerGithubIssueTools(server) {
|
|
|
36693
37004
|
server.tool(
|
|
36694
37005
|
"github_comment",
|
|
36695
37006
|
"Add a markdown comment on a GitHub issue (#123 or URL). Uses Account gh. When reviewing a PR or ticket, show the draft in chat and wait until they type a next step \u2014 do not ask_user after the review. The author sees this immediately.",
|
|
36696
|
-
{ id:
|
|
37007
|
+
{ id: import_zod7.z.string(), body: import_zod7.z.string(), repoPath: repoPathSchema },
|
|
36697
37008
|
async ({ id, body, repoPath }) => {
|
|
36698
37009
|
try {
|
|
36699
37010
|
const blocked = await cursorIssueBlock(repoPath);
|
|
@@ -36704,23 +37015,23 @@ function registerGithubIssueTools(server) {
|
|
|
36704
37015
|
}
|
|
36705
37016
|
}
|
|
36706
37017
|
);
|
|
36707
|
-
const relationInputSchema =
|
|
36708
|
-
type:
|
|
36709
|
-
issue:
|
|
37018
|
+
const relationInputSchema = import_zod7.z.object({
|
|
37019
|
+
type: import_zod7.z.string().describe("blocks or blockedBy (this issue's view)."),
|
|
37020
|
+
issue: import_zod7.z.string().describe("Related issue #123 or URL.")
|
|
36710
37021
|
});
|
|
36711
37022
|
server.tool(
|
|
36712
37023
|
"github_update_issue",
|
|
36713
37024
|
'Update a GitHub issue (#123). Pass title, body, state (open|closed), labels, project, parent, and/or relations. labels replaces all names (pass [] to clear). project is a Project title, or "none" to remove. parent is #123 or "none". relations adds blockedBy/blocks; removeRelations drops them (`gh` 2.94+). When reviewing a PR or ticket, wait until they type a next step before changing the issue \u2014 do not ask_user after the review. The author is notified.',
|
|
36714
37025
|
{
|
|
36715
|
-
id:
|
|
36716
|
-
title:
|
|
36717
|
-
body:
|
|
36718
|
-
state:
|
|
36719
|
-
labels:
|
|
36720
|
-
project:
|
|
36721
|
-
parent:
|
|
36722
|
-
relations:
|
|
36723
|
-
removeRelations:
|
|
37026
|
+
id: import_zod7.z.string(),
|
|
37027
|
+
title: import_zod7.z.string().optional(),
|
|
37028
|
+
body: import_zod7.z.string().optional(),
|
|
37029
|
+
state: import_zod7.z.string().optional().describe("open or closed"),
|
|
37030
|
+
labels: import_zod7.z.array(import_zod7.z.string()).optional().describe("Replace all labels. Empty array clears. Call github_get_issue first to keep existing."),
|
|
37031
|
+
project: import_zod7.z.string().nullable().optional().describe('GitHub Project title, or "none" to remove current projects.'),
|
|
37032
|
+
parent: import_zod7.z.string().nullable().optional().describe('Parent issue #123 or URL, or "none" to unset.'),
|
|
37033
|
+
relations: import_zod7.z.array(relationInputSchema).optional().describe("Add blockedBy or blocks relations (issue #123 or URL)."),
|
|
37034
|
+
removeRelations: import_zod7.z.array(relationInputSchema).optional().describe("Remove blockedBy or blocks relations."),
|
|
36724
37035
|
repoPath: repoPathSchema
|
|
36725
37036
|
},
|
|
36726
37037
|
async (args) => {
|
|
@@ -36737,9 +37048,9 @@ function registerGithubIssueTools(server) {
|
|
|
36737
37048
|
"github_create_issue",
|
|
36738
37049
|
"Create a GitHub issue. Pass parent (#123) to mark a spin-off in the body.",
|
|
36739
37050
|
{
|
|
36740
|
-
title:
|
|
36741
|
-
body:
|
|
36742
|
-
parent:
|
|
37051
|
+
title: import_zod7.z.string(),
|
|
37052
|
+
body: import_zod7.z.string().optional(),
|
|
37053
|
+
parent: import_zod7.z.string().optional().describe("Parent issue #123 or URL for a spin-off."),
|
|
36743
37054
|
repoPath: repoPathSchema
|
|
36744
37055
|
},
|
|
36745
37056
|
async (args) => {
|
|
@@ -36755,7 +37066,7 @@ function registerGithubIssueTools(server) {
|
|
|
36755
37066
|
}
|
|
36756
37067
|
|
|
36757
37068
|
// src/mcp/linear-tools.ts
|
|
36758
|
-
var
|
|
37069
|
+
var import_zod8 = require("zod");
|
|
36759
37070
|
init_issue_since();
|
|
36760
37071
|
init_linear();
|
|
36761
37072
|
init_issue_list();
|
|
@@ -36768,7 +37079,7 @@ function fail3(err) {
|
|
|
36768
37079
|
true
|
|
36769
37080
|
);
|
|
36770
37081
|
}
|
|
36771
|
-
var prioritySchema =
|
|
37082
|
+
var prioritySchema = import_zod8.z.number().int().min(0).max(4).optional().describe("0 none, 1 urgent, 2 high, 3 medium, 4 low");
|
|
36772
37083
|
function registerLinearTools(server) {
|
|
36773
37084
|
server.tool(
|
|
36774
37085
|
"linear_list_teams",
|
|
@@ -36798,9 +37109,9 @@ function registerLinearTools(server) {
|
|
|
36798
37109
|
"linear_search_issues",
|
|
36799
37110
|
"Search or list open Linear issues. Default 40; pass query and/or limit (max 250) when truncated. assignee: me, unassigned, all (default with query), or a user id/name. Pass updatedSince for new/updated tickets and new comments (e.g. \u201Cany updates since yesterday?\u201D).",
|
|
36800
37111
|
{
|
|
36801
|
-
query:
|
|
36802
|
-
assignee:
|
|
36803
|
-
limit:
|
|
37112
|
+
query: import_zod8.z.string().optional().describe("Search text (identifier, title, description). Omit to list by assignee only."),
|
|
37113
|
+
assignee: import_zod8.z.string().optional().describe("me, unassigned, all, a Linear user id, or a display name. Default: all when query is set, otherwise me."),
|
|
37114
|
+
limit: import_zod8.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
36804
37115
|
updatedSince: mcpIssueUpdatedSinceSchema
|
|
36805
37116
|
},
|
|
36806
37117
|
async ({ query, assignee, limit, updatedSince }) => {
|
|
@@ -36840,7 +37151,7 @@ function registerLinearTools(server) {
|
|
|
36840
37151
|
server.tool(
|
|
36841
37152
|
"linear_get_issue",
|
|
36842
37153
|
"Get a Linear issue by uuid or identifier (ENG-123): description, comments, relations, parent/children, project, attachments. Default crushes redundant comments and huge pasted bodies (SmartCrusher-style; small unique tickets pass through). Pass include=full for the uncompressed vendor payload. To save a file, call linear_download_attachment with the attachment id or url (writes `.context/attachments/`; do not dump bytes into the tool result).",
|
|
36843
|
-
{ id:
|
|
37154
|
+
{ id: import_zod8.z.string(), include: mcpIssueIncludeSchema },
|
|
36844
37155
|
async ({ id, include }) => {
|
|
36845
37156
|
try {
|
|
36846
37157
|
return text5(formatLinearIssuePayload(await getLinearIssue(id), include));
|
|
@@ -36853,9 +37164,9 @@ function registerLinearTools(server) {
|
|
|
36853
37164
|
"linear_download_attachment",
|
|
36854
37165
|
"Download a Linear file attachment into `.context/attachments/` using Account Linear auth. Pass the attachment uuid or uploads.linear.app URL from linear_get_issue. Returns the worktree-relative path \u2014 Read that file; do not dump bytes into chat.",
|
|
36855
37166
|
{
|
|
36856
|
-
id:
|
|
36857
|
-
name:
|
|
36858
|
-
repoPath:
|
|
37167
|
+
id: import_zod8.z.string().describe("Attachment uuid or upload URL from linear_get_issue."),
|
|
37168
|
+
name: import_zod8.z.string().optional().describe("Optional filename override."),
|
|
37169
|
+
repoPath: import_zod8.z.string().optional().describe("Workspace / worktree path. Omit on a worktree turn (uses cwd).")
|
|
36859
37170
|
},
|
|
36860
37171
|
async ({ id, name, repoPath }) => {
|
|
36861
37172
|
try {
|
|
@@ -36869,13 +37180,13 @@ function registerLinearTools(server) {
|
|
|
36869
37180
|
"linear_create_issue",
|
|
36870
37181
|
'Create a Linear issue. Call linear_list_teams first. team is id/key/name; state is name/type/id; assignee is "me" or a user id. Pass parent (ENG-123 or uuid) to nest a spin-off under the current ticket.',
|
|
36871
37182
|
{
|
|
36872
|
-
team:
|
|
36873
|
-
title:
|
|
36874
|
-
description:
|
|
36875
|
-
state:
|
|
36876
|
-
assignee:
|
|
37183
|
+
team: import_zod8.z.string(),
|
|
37184
|
+
title: import_zod8.z.string(),
|
|
37185
|
+
description: import_zod8.z.string().optional(),
|
|
37186
|
+
state: import_zod8.z.string().optional(),
|
|
37187
|
+
assignee: import_zod8.z.string().nullable().optional(),
|
|
36877
37188
|
priority: prioritySchema,
|
|
36878
|
-
parent:
|
|
37189
|
+
parent: import_zod8.z.string().optional().describe("Parent issue uuid or identifier (ENG-123) for a spin-off / sub-issue.")
|
|
36879
37190
|
},
|
|
36880
37191
|
async (args) => {
|
|
36881
37192
|
try {
|
|
@@ -36885,26 +37196,26 @@ function registerLinearTools(server) {
|
|
|
36885
37196
|
}
|
|
36886
37197
|
}
|
|
36887
37198
|
);
|
|
36888
|
-
const relationInputSchema =
|
|
36889
|
-
type:
|
|
36890
|
-
issue:
|
|
37199
|
+
const relationInputSchema = import_zod8.z.object({
|
|
37200
|
+
type: import_zod8.z.string().describe("blocks, blockedBy, related, duplicate, or duplicateOf (this issue's view)."),
|
|
37201
|
+
issue: import_zod8.z.string().describe("Related issue uuid or identifier (ENG-123).")
|
|
36891
37202
|
});
|
|
36892
37203
|
server.tool(
|
|
36893
37204
|
"linear_update_issue",
|
|
36894
37205
|
'Update a Linear issue (uuid or ENG-123). Pass title, description, state, assignee, priority, cycle, labels, project, parent, and/or relations. Cycle/project/parent: name or id, or "none" to clear. labels replaces all names (pass [] to clear; get the issue first to keep existing). relations adds; removeRelations removes by type + issue. When reviewing a PR or ticket, wait until they type a next step before changing the ticket \u2014 do not ask_user after the review. The author is notified.',
|
|
36895
37206
|
{
|
|
36896
|
-
id:
|
|
36897
|
-
title:
|
|
36898
|
-
description:
|
|
36899
|
-
state:
|
|
36900
|
-
assignee:
|
|
37207
|
+
id: import_zod8.z.string(),
|
|
37208
|
+
title: import_zod8.z.string().optional(),
|
|
37209
|
+
description: import_zod8.z.string().optional(),
|
|
37210
|
+
state: import_zod8.z.string().optional(),
|
|
37211
|
+
assignee: import_zod8.z.string().nullable().optional(),
|
|
36901
37212
|
priority: prioritySchema,
|
|
36902
|
-
cycle:
|
|
36903
|
-
labels:
|
|
36904
|
-
project:
|
|
36905
|
-
parent:
|
|
36906
|
-
relations:
|
|
36907
|
-
removeRelations:
|
|
37213
|
+
cycle: import_zod8.z.string().nullable().optional().describe('Cycle name, number, "current"/"active", or "none" to unschedule.'),
|
|
37214
|
+
labels: import_zod8.z.array(import_zod8.z.string()).optional().describe("Replace all labels (names or ids). Empty array clears. Call linear_get_issue first to keep existing."),
|
|
37215
|
+
project: import_zod8.z.string().nullable().optional().describe('Project name, id, slug, or "none" to unassign.'),
|
|
37216
|
+
parent: import_zod8.z.string().nullable().optional().describe('Parent issue uuid or identifier (ENG-123), or "none" to unset.'),
|
|
37217
|
+
relations: import_zod8.z.array(relationInputSchema).optional().describe("Add relations from this issue's view (blocks, blockedBy, related, duplicate, duplicateOf)."),
|
|
37218
|
+
removeRelations: import_zod8.z.array(relationInputSchema).optional().describe("Remove relations by type + related issue (uuid or ENG-123).")
|
|
36908
37219
|
},
|
|
36909
37220
|
async (args) => {
|
|
36910
37221
|
try {
|
|
@@ -36918,8 +37229,8 @@ function registerLinearTools(server) {
|
|
|
36918
37229
|
"linear_comment",
|
|
36919
37230
|
"Add a markdown comment on a Linear issue (uuid or ENG-123). When reviewing a PR or ticket, show the draft in chat and wait until they type a next step \u2014 do not ask_user after the review. The author sees this immediately.",
|
|
36920
37231
|
{
|
|
36921
|
-
id:
|
|
36922
|
-
body:
|
|
37232
|
+
id: import_zod8.z.string(),
|
|
37233
|
+
body: import_zod8.z.string()
|
|
36923
37234
|
},
|
|
36924
37235
|
async (args) => {
|
|
36925
37236
|
try {
|
|
@@ -36939,7 +37250,7 @@ function registerConnectedIssueVendorTools(server, settings = loadAppSettings())
|
|
|
36939
37250
|
}
|
|
36940
37251
|
|
|
36941
37252
|
// src/mcp/posthog-tools.ts
|
|
36942
|
-
var
|
|
37253
|
+
var import_zod9 = require("zod");
|
|
36943
37254
|
init_fetch();
|
|
36944
37255
|
init_optional_services();
|
|
36945
37256
|
|
|
@@ -37156,13 +37467,13 @@ function registerPosthogTools(server) {
|
|
|
37156
37467
|
"posthog_api",
|
|
37157
37468
|
POSTHOG_API_DESCRIPTION,
|
|
37158
37469
|
{
|
|
37159
|
-
method:
|
|
37470
|
+
method: import_zod9.z.enum(POSTHOG_METHODS).describe(
|
|
37160
37471
|
"GET, POST /api/projects|environments/:id/query/ for a read, or POST/PATCH when the user asked for a change"
|
|
37161
37472
|
),
|
|
37162
|
-
path:
|
|
37163
|
-
query:
|
|
37164
|
-
body:
|
|
37165
|
-
write:
|
|
37473
|
+
path: import_zod9.z.string().describe("PostHog path starting with /api/, not a full URL"),
|
|
37474
|
+
query: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).optional().describe("Query string parameters"),
|
|
37475
|
+
body: import_zod9.z.unknown().optional().describe("JSON body for POST or PATCH"),
|
|
37476
|
+
write: import_zod9.z.boolean().optional().describe(
|
|
37166
37477
|
"Required true for POST and PATCH that change data. Omit for GET and for POST .../query/."
|
|
37167
37478
|
)
|
|
37168
37479
|
},
|
|
@@ -37214,7 +37525,7 @@ init_list_prs();
|
|
|
37214
37525
|
init_app_settings();
|
|
37215
37526
|
|
|
37216
37527
|
// src/mcp/archive-tools.ts
|
|
37217
|
-
var
|
|
37528
|
+
var import_zod10 = require("zod");
|
|
37218
37529
|
init_fleet_archive();
|
|
37219
37530
|
init_chat_tabs();
|
|
37220
37531
|
|
|
@@ -37234,9 +37545,9 @@ function registerArchiveTools(server, orch) {
|
|
|
37234
37545
|
"list_archive",
|
|
37235
37546
|
"Browse Settings \u2192 History (archived workspaces and agents), newest first. A workspace row is a checkout with no live agents \u2014 it is off Home and list_board. Nested lines are that workspace's agents; any of those ids restores the whole checkout. An agent row is an orchestration chat, or one agent archived while its workspace stayed live (workspace-live). kind=agent lists every archived agent, including agents on an archived workspace (workspace-archived). query matches title, branch, repo, agent, ticket, or PR. limit default 40, max 250. Then restore_workspace (whole checkout) or restore_chat (one agent).",
|
|
37236
37547
|
{
|
|
37237
|
-
query:
|
|
37238
|
-
kind:
|
|
37239
|
-
limit:
|
|
37548
|
+
query: import_zod10.z.string().optional().describe("Title, branch, repo, agent, ticket, or PR"),
|
|
37549
|
+
kind: import_zod10.z.enum(["all", "workspace", "agent"]).optional().describe("all (default), workspace, or agent"),
|
|
37550
|
+
limit: import_zod10.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250)")
|
|
37240
37551
|
},
|
|
37241
37552
|
async ({ query, kind, limit }) => {
|
|
37242
37553
|
const view = listFleetArchive(orch.getThreads(true), { query, kind, limit });
|
|
@@ -37246,7 +37557,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37246
37557
|
server.tool(
|
|
37247
37558
|
"archive_workspace",
|
|
37248
37559
|
"Archive a workspace: every live agent on that checkout, then remove the worktree when the last agent archives (cowboy keeps the project folder). The Home card moves to Settings \u2192 History. Pass any chat id on the workspace. Orchestration chats are agents \u2014 use archive_chat. To archive one agent and leave the checkout up, use archive_chat.",
|
|
37249
|
-
{ ref:
|
|
37560
|
+
{ ref: import_zod10.z.string().describe("Any chat id on the workspace") },
|
|
37250
37561
|
async ({ ref }) => {
|
|
37251
37562
|
const thread = orch.getThread(ref);
|
|
37252
37563
|
if (!thread) {
|
|
@@ -37279,7 +37590,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37279
37590
|
server.tool(
|
|
37280
37591
|
"archive_chat",
|
|
37281
37592
|
"Archive one agent chat: stop the turn and move that chat to Settings \u2192 History. Other agents on the workspace stay, and the worktree is removed only when this is the last agent. Uncommitted and untracked files are saved on a hidden git ref and put back uncommitted if that checkout is restored. If that snapshot fails, the checkout stays. History Delete does not keep the snapshot. Orchestration chats archive without removing a project checkout. Refuses the cloud coordinator. To archive every agent on a checkout, use archive_workspace. Commit, push, and open PRs via ask_git before archiving when the work should be kept. Merge only when the user explicitly asked.",
|
|
37282
|
-
{ ref:
|
|
37593
|
+
{ ref: import_zod10.z.string().describe("Chat id to archive") },
|
|
37283
37594
|
async ({ ref }) => {
|
|
37284
37595
|
const t = orch.getThread(ref);
|
|
37285
37596
|
if (!t) {
|
|
@@ -37305,7 +37616,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37305
37616
|
server.tool(
|
|
37306
37617
|
"restore_workspace",
|
|
37307
37618
|
"Restore a workspace from Settings \u2192 History: recreate the worktree if it was removed and bring every archived agent on that checkout back. Pass any chat id from list_archive. If some agents are still live, only the archived ones return to that checkout. One agent only: restore_chat. Orchestration agents: restore_chat.",
|
|
37308
|
-
{ ref:
|
|
37619
|
+
{ ref: import_zod10.z.string().describe("Any chat id from list_archive on that workspace") },
|
|
37309
37620
|
async ({ ref }) => {
|
|
37310
37621
|
try {
|
|
37311
37622
|
const restored = await orch.restoreWorkspace(ref);
|
|
@@ -37329,7 +37640,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37329
37640
|
server.tool(
|
|
37330
37641
|
"restore_chat",
|
|
37331
37642
|
"Restore one archived agent from list_archive. Recreates the worktree when that checkout was fully archived and the folder is gone. Other archived agents on the checkout stay in History until restore_workspace or another restore_chat. Orchestration agents come back as Global chats.",
|
|
37332
|
-
{ ref:
|
|
37643
|
+
{ ref: import_zod10.z.string().describe("Archived chat id from list_archive") },
|
|
37333
37644
|
async ({ ref }) => {
|
|
37334
37645
|
try {
|
|
37335
37646
|
const restored = await orch.restore(ref);
|
|
@@ -37347,7 +37658,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37347
37658
|
}
|
|
37348
37659
|
|
|
37349
37660
|
// src/mcp/schedule-tools.ts
|
|
37350
|
-
var
|
|
37661
|
+
var import_zod11 = require("zod");
|
|
37351
37662
|
init_schedules();
|
|
37352
37663
|
init_schedule_runner();
|
|
37353
37664
|
init_issue_list();
|
|
@@ -37451,23 +37762,23 @@ function registerScheduleTools(server) {
|
|
|
37451
37762
|
"create_schedule",
|
|
37452
37763
|
"Create a local automation that, when due, sends a prompt to an existing chat (chatId) or starts a new Global orchestration chat (omit chatId). Pass chatId=self to continue this chat. A job bound to a chat is removed when that chat is archived or gone; it does not start a new Global chat. Omit chatId only for a Global automation that should outlive this chat. Exactly one of at (ISO datetime), every (15m/1h/6h/1d), time (HH:mm, with days such as weekdays or mon,wed), or cron (5-field). Recurring jobs without chatId open a new Global chat each run and archive it when that run finishes unless archiveChat is false (leave the chat open to keep talking, for example a morning start-my-day run). History keeps the last 5 archived chats for that automation, and the schedule keeps the last 10 runs. To schedule a prompt from this chat, call this tool with that prompt (omit chatId for a new Global chat, or chatId=self). Creating or enabling a future job turns on Settings \u2192 Advanced \u2192 Caffeinate while automations are enabled so the Mac stays awake until due. Sideboard.app must be running for the job to fire.",
|
|
37453
37764
|
{
|
|
37454
|
-
prompt:
|
|
37455
|
-
name:
|
|
37456
|
-
at:
|
|
37457
|
-
every:
|
|
37458
|
-
time:
|
|
37459
|
-
days:
|
|
37460
|
-
cron:
|
|
37461
|
-
tz:
|
|
37462
|
-
archiveChat:
|
|
37765
|
+
prompt: import_zod11.z.string().describe("User message / goal queued when the automation fires"),
|
|
37766
|
+
name: import_zod11.z.string().optional(),
|
|
37767
|
+
at: import_zod11.z.string().optional().describe("ISO datetime for a one-shot"),
|
|
37768
|
+
every: import_zod11.z.string().optional().describe("Interval such as 15m, 1h, 6h, 1d"),
|
|
37769
|
+
time: import_zod11.z.string().optional().describe("HH:mm (24-hour) clock time. Omit days for every day."),
|
|
37770
|
+
days: import_zod11.z.string().optional().describe("daily, weekdays, weekends, or days such as mon,wed,fri or mon-fri. Use with time."),
|
|
37771
|
+
cron: import_zod11.z.string().optional().describe("5-field cron expression"),
|
|
37772
|
+
tz: import_zod11.z.string().optional().describe("IANA timezone for cron or time (default: system)"),
|
|
37773
|
+
archiveChat: import_zod11.z.boolean().optional().describe(
|
|
37463
37774
|
"Archive a new Global chat when the run finishes. Default true. Pass false to leave the chat open."
|
|
37464
37775
|
),
|
|
37465
|
-
chatId:
|
|
37776
|
+
chatId: import_zod11.z.string().optional().describe(
|
|
37466
37777
|
'Existing chat id, or "self" for this chat. That job is removed when the chat is archived. Omit only for a Global automation that should outlive this chat.'
|
|
37467
37778
|
),
|
|
37468
|
-
threadId:
|
|
37469
|
-
agent:
|
|
37470
|
-
model:
|
|
37779
|
+
threadId: import_zod11.z.string().optional().describe("Legacy alias for chatId."),
|
|
37780
|
+
agent: import_zod11.z.enum(["claude", "cursor", "codex", "opencode"]).optional().describe("Agent for a new Global chat (omit for Account default)"),
|
|
37781
|
+
model: import_zod11.z.string().optional()
|
|
37471
37782
|
},
|
|
37472
37783
|
async (args) => {
|
|
37473
37784
|
try {
|
|
@@ -37504,23 +37815,23 @@ function registerScheduleTools(server) {
|
|
|
37504
37815
|
"update_schedule",
|
|
37505
37816
|
"Update a local automation (prompt, cadence, target chat, archiveChat, enabled). Pass id from list_schedules.",
|
|
37506
37817
|
{
|
|
37507
|
-
id:
|
|
37508
|
-
prompt:
|
|
37509
|
-
name:
|
|
37510
|
-
at:
|
|
37511
|
-
every:
|
|
37512
|
-
time:
|
|
37513
|
-
days:
|
|
37514
|
-
cron:
|
|
37515
|
-
tz:
|
|
37516
|
-
archiveChat:
|
|
37517
|
-
chatId:
|
|
37818
|
+
id: import_zod11.z.string(),
|
|
37819
|
+
prompt: import_zod11.z.string().optional(),
|
|
37820
|
+
name: import_zod11.z.string().optional(),
|
|
37821
|
+
at: import_zod11.z.string().optional(),
|
|
37822
|
+
every: import_zod11.z.string().optional(),
|
|
37823
|
+
time: import_zod11.z.string().optional().describe("HH:mm clock time. Use with days, or alone to change the time of a weekly job."),
|
|
37824
|
+
days: import_zod11.z.string().optional().describe("daily, weekdays, weekends, or mon,wed,fri. Use with time, or alone on an existing weekly job."),
|
|
37825
|
+
cron: import_zod11.z.string().optional(),
|
|
37826
|
+
tz: import_zod11.z.string().optional(),
|
|
37827
|
+
archiveChat: import_zod11.z.boolean().optional().describe("Archive a new Global chat when the run finishes. False leaves it open."),
|
|
37828
|
+
chatId: import_zod11.z.string().optional().describe(
|
|
37518
37829
|
'Existing chat, "self", or empty string for a Global chat each run. A bound job is removed when that chat is archived.'
|
|
37519
37830
|
),
|
|
37520
|
-
threadId:
|
|
37521
|
-
agent:
|
|
37522
|
-
model:
|
|
37523
|
-
enabled:
|
|
37831
|
+
threadId: import_zod11.z.string().optional().describe("Legacy alias for chatId."),
|
|
37832
|
+
agent: import_zod11.z.enum(["claude", "cursor", "codex", "opencode"]).optional(),
|
|
37833
|
+
model: import_zod11.z.string().optional(),
|
|
37834
|
+
enabled: import_zod11.z.boolean().optional()
|
|
37524
37835
|
},
|
|
37525
37836
|
async (args) => {
|
|
37526
37837
|
try {
|
|
@@ -37556,7 +37867,7 @@ function registerScheduleTools(server) {
|
|
|
37556
37867
|
server.tool(
|
|
37557
37868
|
"delete_schedule",
|
|
37558
37869
|
"Delete a local automation. Pass id from list_schedules.",
|
|
37559
|
-
{ id:
|
|
37870
|
+
{ id: import_zod11.z.string() },
|
|
37560
37871
|
async ({ id }) => {
|
|
37561
37872
|
try {
|
|
37562
37873
|
deleteSchedule(id);
|
|
@@ -37569,7 +37880,7 @@ function registerScheduleTools(server) {
|
|
|
37569
37880
|
server.tool(
|
|
37570
37881
|
"run_schedule",
|
|
37571
37882
|
"Fire an automation now (does not wait for nextRunAt). Queues the prompt on the target chat or starts a new Global chat. If Sideboard.app is running, the desktop drains the turn.",
|
|
37572
|
-
{ id:
|
|
37883
|
+
{ id: import_zod11.z.string() },
|
|
37573
37884
|
async ({ id }) => {
|
|
37574
37885
|
try {
|
|
37575
37886
|
if (!getSchedule(id)) {
|
|
@@ -37585,7 +37896,7 @@ function registerScheduleTools(server) {
|
|
|
37585
37896
|
}
|
|
37586
37897
|
|
|
37587
37898
|
// src/mcp/follow-up-tools.ts
|
|
37588
|
-
var
|
|
37899
|
+
var import_zod12 = require("zod");
|
|
37589
37900
|
init_worktree();
|
|
37590
37901
|
init_issue_list();
|
|
37591
37902
|
init_profile();
|
|
@@ -37624,10 +37935,10 @@ function registerFollowUpTools(server) {
|
|
|
37624
37935
|
"create_follow_up",
|
|
37625
37936
|
"Register a follow-up on THIS chat. kind=ci sends the prompt when GitHub checks on this chat\u2019s PR finish (pass or fail). Checks that are already finished do not send until a later run finishes. A failed checks read does not count as finished or in progress. A CI follow-up that is still pending at deadline (default 7 days) ends silently. kind=at sends at `30m`, `2h`, `1d`, or an ISO time and waits behind a turn that is already running. Cap 10.",
|
|
37626
37937
|
{
|
|
37627
|
-
kind:
|
|
37628
|
-
prompt:
|
|
37629
|
-
at:
|
|
37630
|
-
deadline:
|
|
37938
|
+
kind: import_zod12.z.enum(["ci", "at"]),
|
|
37939
|
+
prompt: import_zod12.z.string(),
|
|
37940
|
+
at: import_zod12.z.string().optional(),
|
|
37941
|
+
deadline: import_zod12.z.string().optional()
|
|
37631
37942
|
},
|
|
37632
37943
|
async ({ kind, prompt, at, deadline }) => {
|
|
37633
37944
|
const thread = callerThread();
|
|
@@ -37648,7 +37959,7 @@ function registerFollowUpTools(server) {
|
|
|
37648
37959
|
server.tool(
|
|
37649
37960
|
"delete_follow_up",
|
|
37650
37961
|
"Remove one follow-up from this chat by id.",
|
|
37651
|
-
{ id:
|
|
37962
|
+
{ id: import_zod12.z.string() },
|
|
37652
37963
|
async ({ id }) => {
|
|
37653
37964
|
const thread = callerThread();
|
|
37654
37965
|
if (!thread) return text7({ error: "This chat id is missing" }, true);
|
|
@@ -37665,12 +37976,12 @@ function registerFollowUpTools(server) {
|
|
|
37665
37976
|
init_turn_failure_class();
|
|
37666
37977
|
|
|
37667
37978
|
// src/mcp/order-tools.ts
|
|
37668
|
-
var
|
|
37979
|
+
var import_zod13 = require("zod");
|
|
37669
37980
|
|
|
37670
37981
|
// src/order/order.ts
|
|
37671
37982
|
var import_node_crypto23 = require("crypto");
|
|
37672
|
-
var
|
|
37673
|
-
var
|
|
37983
|
+
var import_node_fs76 = require("fs");
|
|
37984
|
+
var import_node_path74 = require("path");
|
|
37674
37985
|
init_paths();
|
|
37675
37986
|
init_private_file();
|
|
37676
37987
|
init_thread_store();
|
|
@@ -38379,7 +38690,7 @@ function showPlanMessage(docs, worktree) {
|
|
|
38379
38690
|
|
|
38380
38691
|
// src/order/order.ts
|
|
38381
38692
|
function orderPath() {
|
|
38382
|
-
return (0,
|
|
38693
|
+
return (0, import_node_path74.join)(appDataDir(), "order.json");
|
|
38383
38694
|
}
|
|
38384
38695
|
function emptyFile() {
|
|
38385
38696
|
return { plans: [], edges: [], marks: [] };
|
|
@@ -38442,9 +38753,9 @@ function asMark(value) {
|
|
|
38442
38753
|
}
|
|
38443
38754
|
function readFile() {
|
|
38444
38755
|
const path = orderPath();
|
|
38445
|
-
if (!(0,
|
|
38756
|
+
if (!(0, import_node_fs76.existsSync)(path)) return emptyFile();
|
|
38446
38757
|
try {
|
|
38447
|
-
const parsed = JSON.parse((0,
|
|
38758
|
+
const parsed = JSON.parse((0, import_node_fs76.readFileSync)(path, "utf8"));
|
|
38448
38759
|
if (!parsed || typeof parsed !== "object") return emptyFile();
|
|
38449
38760
|
const raw = parsed;
|
|
38450
38761
|
const edges = Array.isArray(raw.edges) ? raw.edges.map(asEdge).filter((row) => Boolean(row)) : [];
|
|
@@ -38652,7 +38963,7 @@ init_issue_list();
|
|
|
38652
38963
|
init_thread_store();
|
|
38653
38964
|
init_global_workspace();
|
|
38654
38965
|
init_plan_file();
|
|
38655
|
-
var kindSchema =
|
|
38966
|
+
var kindSchema = import_zod13.z.enum(["pr", "issue", "workspace", "orchestration"]);
|
|
38656
38967
|
function callerThread2() {
|
|
38657
38968
|
const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim();
|
|
38658
38969
|
if (!id) return null;
|
|
@@ -38724,16 +39035,16 @@ function registerOrderTools(server) {
|
|
|
38724
39035
|
worktree ? "Change what this checkout waits on. Omit subject to mean this workspace (hold=merge uses this PR; hold=start on a ticket uses this issue). gate=in-main (met when that PR is merged) or in-prod (stays waiting until satisfy_dependency). hold=start means do not begin; hold=merge means do not merge. You cannot set a dependency for a different checkout. show_plan so the user sees the change." : "Record a step on this orchestration plan. waitsOn must reach gate before subject can hold. gate=in-main is met when that PR is merged; gate=in-prod stays waiting until satisfy_dependency. hold=start blocks starting the subject; hold=merge blocks merging it. Example: PR 1 in prod before PR 2 can merge; PR 3 in main before issue 4 can start. Pass repoPath when the same PR number exists in more than one project. Worktree agents set their own checkout and can omit subject. Then show_plan so the user sees it.",
|
|
38725
39036
|
{
|
|
38726
39037
|
waitsOnKind: kindSchema.describe("What must happen first: pr, issue, workspace, or orchestration"),
|
|
38727
|
-
waitsOnRef:
|
|
38728
|
-
waitsOnRepoPath:
|
|
38729
|
-
waitsOnLabel:
|
|
38730
|
-
gate:
|
|
38731
|
-
hold:
|
|
39038
|
+
waitsOnRef: import_zod13.z.string().describe("PR number (12), issue id (ENG-4), or workspace chat id / worktree path"),
|
|
39039
|
+
waitsOnRepoPath: import_zod13.z.string().optional().describe("Project path when a PR or issue number is not unique"),
|
|
39040
|
+
waitsOnLabel: import_zod13.z.string().optional().describe("Short label on the planner"),
|
|
39041
|
+
gate: import_zod13.z.enum(["in-main", "in-prod"]).describe("in-main: merged to the default branch. in-prod: deployed; mark with satisfy_dependency"),
|
|
39042
|
+
hold: import_zod13.z.enum(["start", "merge"]).describe("start: subject cannot begin. merge: subject cannot merge"),
|
|
38732
39043
|
subjectKind: kindSchema.optional().describe("What is held. Required from orchestration. Omit on a worktree to mean this checkout."),
|
|
38733
|
-
subjectRef:
|
|
38734
|
-
subjectRepoPath:
|
|
38735
|
-
subjectLabel:
|
|
38736
|
-
note:
|
|
39044
|
+
subjectRef: import_zod13.z.string().optional().describe("PR number, issue id, or workspace ref for the subject"),
|
|
39045
|
+
subjectRepoPath: import_zod13.z.string().optional(),
|
|
39046
|
+
subjectLabel: import_zod13.z.string().optional(),
|
|
39047
|
+
note: import_zod13.z.string().optional().describe("Why this order matters")
|
|
38737
39048
|
},
|
|
38738
39049
|
async (args) => {
|
|
38739
39050
|
try {
|
|
@@ -38797,9 +39108,9 @@ function registerOrderTools(server) {
|
|
|
38797
39108
|
"set_plan",
|
|
38798
39109
|
"Draft or retitle this chat's plan. It stays draft until execute_plan. Pass goal for the outcome the steps are trying to reach. Then set_dependency for each gate. A step may loop back to an earlier one. Call show_plan so the user sees it. Do not paste the diagram in chat. Do not start workspaces while it is draft.",
|
|
38799
39110
|
{
|
|
38800
|
-
title:
|
|
38801
|
-
summary:
|
|
38802
|
-
goal:
|
|
39111
|
+
title: import_zod13.z.string().describe("Short name for the plan"),
|
|
39112
|
+
summary: import_zod13.z.string().optional().describe("What this order is for, in a sentence or two"),
|
|
39113
|
+
goal: import_zod13.z.string().optional().describe("Outcome the steps are trying to reach")
|
|
38803
39114
|
},
|
|
38804
39115
|
async ({ title, summary, goal }) => {
|
|
38805
39116
|
try {
|
|
@@ -38819,7 +39130,7 @@ function registerOrderTools(server) {
|
|
|
38819
39130
|
"execute_plan",
|
|
38820
39131
|
"Mark the plan active after the user has seen it and told you to run it. Returns start (open or continue these, including the first step others wait on), waiting (hold=start is still unmet; leave them alone), and mergeHeld (work may proceed; do not merge). Does not create workspaces. Pass agreed: true only after they agree. Merge only if they asked.",
|
|
38821
39132
|
{
|
|
38822
|
-
agreed:
|
|
39133
|
+
agreed: import_zod13.z.literal(true).describe("True only after the user has seen the plan and told you to run it")
|
|
38823
39134
|
},
|
|
38824
39135
|
async () => {
|
|
38825
39136
|
try {
|
|
@@ -38889,7 +39200,7 @@ function registerOrderTools(server) {
|
|
|
38889
39200
|
server.tool(
|
|
38890
39201
|
"clear_dependency",
|
|
38891
39202
|
worktree ? "Remove a planner step this checkout is part of. Pass id from list_order. Then show_plan so the user sees it." : "Remove one planner step. Pass id from list_order. Then show_plan so the user sees it.",
|
|
38892
|
-
{ id:
|
|
39203
|
+
{ id: import_zod13.z.string().describe("Step id from list_order") },
|
|
38893
39204
|
async ({ id }) => {
|
|
38894
39205
|
try {
|
|
38895
39206
|
const caller = callerThread2();
|
|
@@ -38908,8 +39219,8 @@ function registerOrderTools(server) {
|
|
|
38908
39219
|
"satisfy_dependency",
|
|
38909
39220
|
"Mark a planner gate met. Use this when a PR is in production \u2014 Sideboard cannot see deploys. in-main also clears on its own once that PR is merged. Pass satisfied=false to undo a manual mark. One mark covers every step waiting on that same gate.",
|
|
38910
39221
|
{
|
|
38911
|
-
id:
|
|
38912
|
-
satisfied:
|
|
39222
|
+
id: import_zod13.z.string().describe("Step id from list_order"),
|
|
39223
|
+
satisfied: import_zod13.z.boolean().optional().describe("false clears the manual mark. Default true.")
|
|
38913
39224
|
},
|
|
38914
39225
|
async ({ id, satisfied }) => {
|
|
38915
39226
|
try {
|
|
@@ -38940,9 +39251,11 @@ function registerOrderTools(server) {
|
|
|
38940
39251
|
|
|
38941
39252
|
// src/agent-rpc/handlers.ts
|
|
38942
39253
|
var import_node_crypto24 = require("crypto");
|
|
38943
|
-
var
|
|
39254
|
+
var import_node_path75 = require("path");
|
|
38944
39255
|
init_wait_for_job();
|
|
38945
39256
|
init_wait_for_turn();
|
|
39257
|
+
init_computer_use();
|
|
39258
|
+
init_app_settings();
|
|
38946
39259
|
|
|
38947
39260
|
// src/agent-rpc/permission-handler.ts
|
|
38948
39261
|
init_agent_block();
|
|
@@ -39005,27 +39318,27 @@ init_gh_errors();
|
|
|
39005
39318
|
init_git_auth_mode();
|
|
39006
39319
|
|
|
39007
39320
|
// src/board/load-home-board.ts
|
|
39008
|
-
var
|
|
39009
|
-
var
|
|
39321
|
+
var import_node_fs78 = require("fs");
|
|
39322
|
+
var import_node_path77 = require("path");
|
|
39010
39323
|
init_worktree();
|
|
39011
39324
|
init_paths();
|
|
39012
39325
|
|
|
39013
39326
|
// src/board/board-pins.ts
|
|
39014
39327
|
var import_node_crypto25 = require("crypto");
|
|
39015
|
-
var
|
|
39016
|
-
var
|
|
39328
|
+
var import_node_fs77 = require("fs");
|
|
39329
|
+
var import_node_path76 = require("path");
|
|
39017
39330
|
init_paths();
|
|
39018
39331
|
init_home_board();
|
|
39019
39332
|
var FILE = "home-board-pins.json";
|
|
39020
39333
|
var VERSION = 1;
|
|
39021
39334
|
function pinsFile() {
|
|
39022
|
-
return (0,
|
|
39335
|
+
return (0, import_node_path76.join)(appDataDir(), FILE);
|
|
39023
39336
|
}
|
|
39024
39337
|
function readDisk() {
|
|
39025
39338
|
const path = pinsFile();
|
|
39026
|
-
if (!(0,
|
|
39339
|
+
if (!(0, import_node_fs77.existsSync)(path)) return [];
|
|
39027
39340
|
try {
|
|
39028
|
-
const raw = JSON.parse((0,
|
|
39341
|
+
const raw = JSON.parse((0, import_node_fs77.readFileSync)(path, "utf8"));
|
|
39029
39342
|
if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
|
|
39030
39343
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
39031
39344
|
} catch {
|
|
@@ -39033,8 +39346,8 @@ function readDisk() {
|
|
|
39033
39346
|
}
|
|
39034
39347
|
}
|
|
39035
39348
|
function writeDisk(items) {
|
|
39036
|
-
(0,
|
|
39037
|
-
(0,
|
|
39349
|
+
(0, import_node_fs77.mkdirSync)(appDataDir(), { recursive: true });
|
|
39350
|
+
(0, import_node_fs77.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
|
|
39038
39351
|
}
|
|
39039
39352
|
function listBoardPins() {
|
|
39040
39353
|
return readDisk();
|
|
@@ -39055,7 +39368,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
39055
39368
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
39056
39369
|
}
|
|
39057
39370
|
function cacheFile() {
|
|
39058
|
-
return (0,
|
|
39371
|
+
return (0, import_node_path77.join)(appDataDir(), "home-board-cache.json");
|
|
39059
39372
|
}
|
|
39060
39373
|
function emptyInputs() {
|
|
39061
39374
|
return {
|
|
@@ -39081,9 +39394,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
39081
39394
|
}
|
|
39082
39395
|
function readDiskCache() {
|
|
39083
39396
|
const path = cacheFile();
|
|
39084
|
-
if (!(0,
|
|
39397
|
+
if (!(0, import_node_fs78.existsSync)(path)) return null;
|
|
39085
39398
|
try {
|
|
39086
|
-
const raw = JSON.parse((0,
|
|
39399
|
+
const raw = JSON.parse((0, import_node_fs78.readFileSync)(path, "utf8"));
|
|
39087
39400
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
39088
39401
|
return null;
|
|
39089
39402
|
}
|
|
@@ -39097,8 +39410,8 @@ function readDiskCache() {
|
|
|
39097
39410
|
}
|
|
39098
39411
|
function writeDiskCache(entry) {
|
|
39099
39412
|
try {
|
|
39100
|
-
(0,
|
|
39101
|
-
(0,
|
|
39413
|
+
(0, import_node_fs78.mkdirSync)(appDataDir(), { recursive: true });
|
|
39414
|
+
(0, import_node_fs78.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
39102
39415
|
} catch {
|
|
39103
39416
|
}
|
|
39104
39417
|
}
|
|
@@ -39353,7 +39666,7 @@ async function startMcpServer() {
|
|
|
39353
39666
|
async () => {
|
|
39354
39667
|
const threads = orch.getThreads();
|
|
39355
39668
|
const lines = threads.map((t) => {
|
|
39356
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
39669
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path78.basename)(t.repoPath) || t.repoPath;
|
|
39357
39670
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
39358
39671
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
39359
39672
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -39371,16 +39684,16 @@ async function startMcpServer() {
|
|
|
39371
39684
|
"list_board",
|
|
39372
39685
|
"Home Kanban of workspaces (New, Draft, Review, Approved, Merged) \u2014 one card per checkout; sibling chats on that card are separate agents. Same cards as desktop Home. Path to merge: no PR \u2192 draft PR \u2192 open PR \u2192 approved \u2192 merged. Archive removes the card to Settings \u2192 History (list_archive to browse, restore_workspace to bring it back). Queued/running are activity on the card, not stages. Orchestration chats are not on the board. Filters: query, repoPath, kind (ticket/PR/branch source), ownership (mine = your PRs / WIP; reviewing = someone else's PR), column, limit (default 40). create_workspace adds a workspace (and a Home card), or returns the live checkout if that ticket/PR/named branch is already checked out. That reuse is one checkout, not one agent \u2014 fork_chat to add another.",
|
|
39373
39686
|
{
|
|
39374
|
-
query:
|
|
39375
|
-
repoPath:
|
|
39376
|
-
kind:
|
|
39377
|
-
ownership:
|
|
39687
|
+
query: import_zod14.z.string().optional().describe("Case-insensitive token search across title, id, labels, workspace tags, repo"),
|
|
39688
|
+
repoPath: import_zod14.z.string().optional().describe("Limit to one project path from list_projects"),
|
|
39689
|
+
kind: import_zod14.z.enum(["all", "tickets", "prs", "branches", "threads"]).optional().describe("Filter by worktree source (default all)"),
|
|
39690
|
+
ownership: import_zod14.z.enum(["all", "mine", "reviewing"]).optional().describe(
|
|
39378
39691
|
"Mine = PRs you authored or local WIP; reviewing = someone else's PR. Uses the gh login."
|
|
39379
39692
|
),
|
|
39380
|
-
column:
|
|
39693
|
+
column: import_zod14.z.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
|
|
39381
39694
|
"Return cards for this column only (totals still include the rest). approved is an open PR GitHub has approved. needs_you is a legacy alias for new."
|
|
39382
39695
|
),
|
|
39383
|
-
limit:
|
|
39696
|
+
limit: import_zod14.z.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
|
|
39384
39697
|
},
|
|
39385
39698
|
async ({ query, repoPath, kind, ownership, column, limit }) => {
|
|
39386
39699
|
const workspaces = orch.listWorkspaces();
|
|
@@ -39410,7 +39723,7 @@ async function startMcpServer() {
|
|
|
39410
39723
|
server.tool(
|
|
39411
39724
|
"get_chat",
|
|
39412
39725
|
"Get a compact chat summary by id/ref. Includes last message preview, parentChatId, and child workspace chats (status + lastText). While running, includes progress (last tool/thinking) and lastActivityAt. Includes usage (billed token + costUsd totals when providers reported cost) and lastTurnUsage. blockedReason is why that agent is waiting on a person (question, plan approval, or a reported block).",
|
|
39413
|
-
{ ref:
|
|
39726
|
+
{ ref: import_zod14.z.string() },
|
|
39414
39727
|
async ({ ref }) => {
|
|
39415
39728
|
const t = orch.getThread(ref);
|
|
39416
39729
|
if (!t) {
|
|
@@ -39457,17 +39770,17 @@ async function startMcpServer() {
|
|
|
39457
39770
|
"present_artifact",
|
|
39458
39771
|
"Show a document or live log in Sideboard\u2019s side column. For html/svg/markdown/react, pass the FULL document and do not also fence that same body in chat. For type=log, pass only NEW lines (same artifact_id appends). Prefer type=log for long-running job output \u2014 do not resend HTML. type=react is a single default-export component (JSX/TSX); only react/react-dom imports.",
|
|
39459
39772
|
{
|
|
39460
|
-
title:
|
|
39461
|
-
type:
|
|
39773
|
+
title: import_zod14.z.string().describe("Short title shown in the artifact pane header"),
|
|
39774
|
+
type: import_zod14.z.enum(["html", "svg", "markdown", "react", "log"]).describe(
|
|
39462
39775
|
"html/svg/markdown/react replace the pane. log appends content to the same artifact_id (new lines only)."
|
|
39463
39776
|
),
|
|
39464
|
-
content:
|
|
39777
|
+
content: import_zod14.z.string().describe(
|
|
39465
39778
|
"html/svg/markdown/react: full document. log: only the new lines since the last call (empty is ok for a status-only update)."
|
|
39466
39779
|
),
|
|
39467
|
-
artifact_id:
|
|
39468
|
-
status:
|
|
39469
|
-
phase:
|
|
39470
|
-
mode:
|
|
39780
|
+
artifact_id: import_zod14.z.string().optional().describe("Stable id. Required for type=log so later calls append to the same pane."),
|
|
39781
|
+
status: import_zod14.z.enum(["running", "ok", "failed", "idle"]).optional().describe("Log header pill: running (working), ok (done), failed, idle"),
|
|
39782
|
+
phase: import_zod14.z.string().optional().describe("Log subtitle (Signing, Notarizing, \u2026)"),
|
|
39783
|
+
mode: import_zod14.z.enum(["append", "replace"]).optional().describe("log only: append (default) or replace the buffer")
|
|
39471
39784
|
},
|
|
39472
39785
|
async ({ title, type, artifact_id, status, phase, mode }) => {
|
|
39473
39786
|
return mcpJson(
|
|
@@ -39480,15 +39793,15 @@ async function startMcpServer() {
|
|
|
39480
39793
|
"ask_user",
|
|
39481
39794
|
"Ask the user a clarifying multiple-choice question in Sideboard\u2019s composer. Call only when work is blocked on choosing among a few concrete options (approach fork, which API, auth vs cookies). Do not call 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 instead. If one option is the obvious default, proceed without asking. Before calling, write a short chat message explaining the decision and what each option means. Include a description on every option. After calling, stop and wait for answers. Not for \u201Cis the plan ready?\u201D.",
|
|
39482
39795
|
{
|
|
39483
|
-
questions:
|
|
39484
|
-
|
|
39485
|
-
question:
|
|
39486
|
-
header:
|
|
39487
|
-
multiSelect:
|
|
39488
|
-
options:
|
|
39489
|
-
|
|
39490
|
-
label:
|
|
39491
|
-
description:
|
|
39796
|
+
questions: import_zod14.z.array(
|
|
39797
|
+
import_zod14.z.object({
|
|
39798
|
+
question: import_zod14.z.string().describe("Full question text ending with ?"),
|
|
39799
|
+
header: import_zod14.z.string().max(24).optional().describe("Short label shown above the question"),
|
|
39800
|
+
multiSelect: import_zod14.z.boolean().optional().describe("Allow selecting multiple options"),
|
|
39801
|
+
options: import_zod14.z.array(
|
|
39802
|
+
import_zod14.z.object({
|
|
39803
|
+
label: import_zod14.z.string(),
|
|
39804
|
+
description: import_zod14.z.string().optional().describe("What this option means / when to choose it (strongly preferred)")
|
|
39492
39805
|
})
|
|
39493
39806
|
).min(2).max(6).describe("2\u20136 choices (Sideboard also offers Other)")
|
|
39494
39807
|
})
|
|
@@ -39514,9 +39827,9 @@ async function startMcpServer() {
|
|
|
39514
39827
|
"present_plan",
|
|
39515
39828
|
PRESENT_PLAN_TOOL_DESCRIPTION,
|
|
39516
39829
|
{
|
|
39517
|
-
title:
|
|
39518
|
-
content:
|
|
39519
|
-
thread_id:
|
|
39830
|
+
title: import_zod14.z.string().optional().describe("Short plan title (defaults to Plan)"),
|
|
39831
|
+
content: import_zod14.z.string().min(1).describe("Full plan markdown (headings, steps, risks, open questions)"),
|
|
39832
|
+
thread_id: import_zod14.z.string().optional().describe("Sideboard thread id when cwd is not the worktree")
|
|
39520
39833
|
},
|
|
39521
39834
|
async ({ title, content, thread_id }) => {
|
|
39522
39835
|
const { writePlanFile: writePlanFile2 } = await Promise.resolve().then(() => (init_plan_file(), plan_file_exports));
|
|
@@ -39545,15 +39858,15 @@ async function startMcpServer() {
|
|
|
39545
39858
|
"present_schema",
|
|
39546
39859
|
"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.",
|
|
39547
39860
|
{
|
|
39548
|
-
title:
|
|
39549
|
-
mode:
|
|
39550
|
-
datasource:
|
|
39551
|
-
resource_id:
|
|
39552
|
-
record_id:
|
|
39553
|
-
resource:
|
|
39554
|
-
record:
|
|
39555
|
-
records:
|
|
39556
|
-
pane_id:
|
|
39861
|
+
title: import_zod14.z.string().describe("Pane title"),
|
|
39862
|
+
mode: import_zod14.z.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
|
|
39863
|
+
datasource: import_zod14.z.enum(["brightsy", "inline"]).optional().describe("brightsy resolves via login; inline uses embedded resource/records"),
|
|
39864
|
+
resource_id: import_zod14.z.string().optional().describe("Brightsy record type UUID (or generic resource id)"),
|
|
39865
|
+
record_id: import_zod14.z.string().optional().describe("Record id when opening form mode"),
|
|
39866
|
+
resource: import_zod14.z.record(import_zod14.z.unknown()).optional().describe("Inline { id, title, schema, schemaUi?, slug? }"),
|
|
39867
|
+
record: import_zod14.z.record(import_zod14.z.unknown()).optional().describe("Inline record { id, data, published_at? }"),
|
|
39868
|
+
records: import_zod14.z.array(import_zod14.z.record(import_zod14.z.unknown())).optional().describe("Inline records for table mode"),
|
|
39869
|
+
pane_id: import_zod14.z.string().optional().describe("Stable pane id across updates")
|
|
39557
39870
|
},
|
|
39558
39871
|
async (args) => {
|
|
39559
39872
|
const id = args.pane_id?.trim() || `schema_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -39574,10 +39887,10 @@ async function startMcpServer() {
|
|
|
39574
39887
|
"present_files",
|
|
39575
39888
|
"Open Sideboard\u2019s Files column (CMS-style file manager: browse, upload, pick). Use datasource=brightsy when the user is logged into Brightsy account storage; datasource=memory for a session-local demo store. Prefer this over claiming a file manager UI is unavailable. Pair with present_schema when editing records that need media.",
|
|
39576
39889
|
{
|
|
39577
|
-
title:
|
|
39578
|
-
datasource:
|
|
39579
|
-
path:
|
|
39580
|
-
pane_id:
|
|
39890
|
+
title: import_zod14.z.string().optional().describe("Pane title (default: Files)"),
|
|
39891
|
+
datasource: import_zod14.z.enum(["brightsy", "memory"]).optional().describe("brightsy = account storage via login; memory = session demo store"),
|
|
39892
|
+
path: import_zod14.z.string().optional().describe("Initial folder path (e.g. public)"),
|
|
39893
|
+
pane_id: import_zod14.z.string().optional().describe("Stable pane id across updates")
|
|
39581
39894
|
},
|
|
39582
39895
|
async (args) => {
|
|
39583
39896
|
const id = args.pane_id?.trim() || `files_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -39597,8 +39910,8 @@ async function startMcpServer() {
|
|
|
39597
39910
|
"wait_for_job",
|
|
39598
39911
|
"Wait on a detached long job (tests, pack, deploy, connector CLI) started with detached-job.cjs. MCP clients kill tools around 60s, so this returns within 45s. Sideboard opens a type=log pane from this result (artifact_id = job id, content = delta). stillRunning is the source of truth \u2014 if true, call wait_for_job again. If the job is hanging, producing no useful output, or doing the wrong thing, call stop_job instead of looping forever. Do not end the turn or tell the user you will let them know later. If false, ok/failed is the result.",
|
|
39599
39912
|
{
|
|
39600
|
-
id:
|
|
39601
|
-
timeoutMs:
|
|
39913
|
+
id: import_zod14.z.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
|
|
39914
|
+
timeoutMs: import_zod14.z.number().optional()
|
|
39602
39915
|
},
|
|
39603
39916
|
async ({ id, timeoutMs }) => {
|
|
39604
39917
|
const result = await waitForDetachedJob(process.cwd(), id, {
|
|
@@ -39611,8 +39924,8 @@ async function startMcpServer() {
|
|
|
39611
39924
|
"stop_job",
|
|
39612
39925
|
"Stop a detached job you started with detached-job.cjs when it is hanging, producing no useful output, buffering forever, or doing the wrong thing (wrong project, infinite watch, huge dump). Do not stop a pack/test/deploy that is clearly making progress. The type=log pane updates to status=failed with the last delta. Then decide the next step.",
|
|
39613
39926
|
{
|
|
39614
|
-
id:
|
|
39615
|
-
reason:
|
|
39927
|
+
id: import_zod14.z.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
|
|
39928
|
+
reason: import_zod14.z.string().optional().describe("Why you are stopping (hanging, no progress, wrong output, already have the answer)")
|
|
39616
39929
|
},
|
|
39617
39930
|
async ({ id, reason }) => {
|
|
39618
39931
|
const result = await stopDetachedJob(process.cwd(), id, { reason });
|
|
@@ -39624,7 +39937,7 @@ async function startMcpServer() {
|
|
|
39624
39937
|
"list_run_scripts",
|
|
39625
39938
|
"List .sideboard/.conductor run scripts for this thread (same menu as the desktop Dev button) and which are active. Each script and active run includes preview: url (open http://localhost:<SIDEBOARD_PORT>) or window (Electron: native window is the app; url is renderer/HMR only). Never guess :3000. Worktree turns may omit ref (uses cwd).",
|
|
39626
39939
|
{
|
|
39627
|
-
ref:
|
|
39940
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
|
|
39628
39941
|
},
|
|
39629
39942
|
async ({ ref }) => {
|
|
39630
39943
|
try {
|
|
@@ -39654,8 +39967,8 @@ async function startMcpServer() {
|
|
|
39654
39967
|
"run_dev_script",
|
|
39655
39968
|
"Start a .sideboard/.conductor run script (same as the desktop Dev / play button). Several named scripts can run at once; each gets its own port, and starting one does not stop the others. Logs and Stop appear in the thread UI \u2014 do not detached-job or shell-spawn the same command. Returns {port, ports, url, preview}. preview=url \u2192 open url (browser, curl, Playwright). preview=window \u2192 Electron: the native window is the app; url is renderer/HMR only (no preload/IPC in a browser). The port is allocated SIDEBOARD_PORT, not 3000. Worktree turns may omit ref (uses cwd). Omit name for the default script.",
|
|
39656
39969
|
{
|
|
39657
|
-
ref:
|
|
39658
|
-
name:
|
|
39970
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
39971
|
+
name: import_zod14.z.string().optional().describe("Script name from list_run_scripts (default script if omitted).")
|
|
39659
39972
|
},
|
|
39660
39973
|
async ({ ref, name }) => {
|
|
39661
39974
|
try {
|
|
@@ -39683,8 +39996,8 @@ async function startMcpServer() {
|
|
|
39683
39996
|
"stop_dev_script",
|
|
39684
39997
|
"Stop a run script started with run_dev_script or the desktop Dev button (same as UI Stop). Omit name to stop all scripts on this worktree. Worktree turns may omit ref (uses cwd).",
|
|
39685
39998
|
{
|
|
39686
|
-
ref:
|
|
39687
|
-
name:
|
|
39999
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
40000
|
+
name: import_zod14.z.string().optional().describe("Script name to stop; omit to stop all active scripts.")
|
|
39688
40001
|
},
|
|
39689
40002
|
async ({ ref, name }) => {
|
|
39690
40003
|
try {
|
|
@@ -39701,9 +40014,9 @@ async function startMcpServer() {
|
|
|
39701
40014
|
"get_run_log",
|
|
39702
40015
|
"Read the Run-tab terminal for a worktree script (same stdout/stderr as the desktop Dev pane). Default is a tail \u2014 raise `tail` only if the error is missing. Worktree turns may omit ref (uses cwd). Omit name for the default script.",
|
|
39703
40016
|
{
|
|
39704
|
-
ref:
|
|
39705
|
-
name:
|
|
39706
|
-
tail:
|
|
40017
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
40018
|
+
name: import_zod14.z.string().optional().describe("Script name from list_run_scripts (default script if omitted)."),
|
|
40019
|
+
tail: import_zod14.z.number().int().min(1).max(MAX_RUN_LOG_CHARS).optional().describe(
|
|
39707
40020
|
`Max characters to return from the end (default ${DEFAULT_RUN_LOG_TAIL_CHARS}). Do not request the full buffer unless the tail is truncated and you still need more.`
|
|
39708
40021
|
)
|
|
39709
40022
|
},
|
|
@@ -39736,6 +40049,7 @@ async function startMcpServer() {
|
|
|
39736
40049
|
}
|
|
39737
40050
|
}
|
|
39738
40051
|
);
|
|
40052
|
+
registerComputerUseTool(server, mcpCatalog);
|
|
39739
40053
|
if (worktreeProfile) {
|
|
39740
40054
|
server.tool(
|
|
39741
40055
|
"get_orchestrator",
|
|
@@ -39766,8 +40080,8 @@ async function startMcpServer() {
|
|
|
39766
40080
|
"notify_orchestrator",
|
|
39767
40081
|
"Wake the parent Global orchestrator with a short status so it does not have to poll wait_for_turn. Use when you are blocked and the parent may have moved on (missing access, waiting on something the coordinator must handle). The message is shown on the sidebar and board until the next user message in this chat. ask_user already notifies for input-required \u2014 do not call this for the same question. Information only: never a git command. Do not use this to steer other worktrees.",
|
|
39768
40082
|
{
|
|
39769
|
-
message:
|
|
39770
|
-
reason:
|
|
40083
|
+
message: import_zod14.z.string().min(1).max(1500).describe("Why you are blocked / what the parent should know (short)."),
|
|
40084
|
+
reason: import_zod14.z.enum(["input-required", "blocked"]).optional().describe(
|
|
39771
40085
|
"input-required = waiting on the user in this chat; blocked = need the coordinator (default)."
|
|
39772
40086
|
)
|
|
39773
40087
|
},
|
|
@@ -39806,11 +40120,11 @@ async function startMcpServer() {
|
|
|
39806
40120
|
"set_workspace_tags",
|
|
39807
40121
|
worktreeProfile ? "Update tags on this workspace (the checkout you are in). Omit ref to use this chat. mode=replace (default), add, or remove. Short labels \u2014 the same ones the orchestrator used for this task. You cannot retag a different checkout." : "Label a project workspace so related checkouts stay recognizable in the sidebar and on the phone. Pass any chat id on that workspace. Use the same tags on every workspace from one task. mode=replace is the default; add and remove change the set. create_workspace tags= sets them at create time. Not for orchestration chats.",
|
|
39808
40122
|
{
|
|
39809
|
-
ref:
|
|
40123
|
+
ref: import_zod14.z.string().optional().describe(
|
|
39810
40124
|
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace to label."
|
|
39811
40125
|
),
|
|
39812
|
-
tags:
|
|
39813
|
-
mode:
|
|
40126
|
+
tags: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.array(import_zod14.z.string())]).describe("Labels to set. A string may be comma-separated."),
|
|
40127
|
+
mode: import_zod14.z.enum(["replace", "add", "remove"]).optional()
|
|
39814
40128
|
},
|
|
39815
40129
|
async ({ ref, tags, mode }) => {
|
|
39816
40130
|
try {
|
|
@@ -39838,10 +40152,10 @@ async function startMcpServer() {
|
|
|
39838
40152
|
"set_wake_on_github_edges",
|
|
39839
40153
|
worktreeProfile ? "Opt this checkout into orchestrator wakes when CI starts failing or GitHub requests a review. Omit ref. Only works after Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is on. Do not change that Advanced switch." : "Opt a project workspace into CI and review-request wakes. Pass any chat id on that checkout. Only works after Settings \u2192 Advanced \u2192 Wake orchestrator on CI / review-requested is already on. Do not change that Advanced switch. Not for orchestration chats.",
|
|
39840
40154
|
{
|
|
39841
|
-
ref:
|
|
40155
|
+
ref: import_zod14.z.string().optional().describe(
|
|
39842
40156
|
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
|
|
39843
40157
|
),
|
|
39844
|
-
enabled:
|
|
40158
|
+
enabled: import_zod14.z.boolean().describe("True opts the checkout in. False turns it off.")
|
|
39845
40159
|
},
|
|
39846
40160
|
async ({ ref, enabled }) => {
|
|
39847
40161
|
try {
|
|
@@ -39874,7 +40188,7 @@ async function startMcpServer() {
|
|
|
39874
40188
|
"set_caffeinate",
|
|
39875
40189
|
"Keep this Mac awake with caffeinate across turns \u2014 independent of Settings toggles. A connected phone already holds caffeinate (lid can close on power), so do not turn this on just because they are on the phone. Turn ON when the user will be away and no phone is connected, or they ask you to keep the machine awake. Turn OFF when they say they are done, wrapping up, going to sleep, or no longer need the Mac awake. Closing or archiving this orchestration chat also releases the hold. macOS only.",
|
|
39876
40190
|
{
|
|
39877
|
-
enabled:
|
|
40191
|
+
enabled: import_zod14.z.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
|
|
39878
40192
|
},
|
|
39879
40193
|
async ({ enabled }) => {
|
|
39880
40194
|
const threadId = process.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || null;
|
|
@@ -39900,25 +40214,25 @@ async function startMcpServer() {
|
|
|
39900
40214
|
"create_workspace",
|
|
39901
40215
|
`Create a workspace (isolated git checkout + first chat) from branch, pr, or ticket. A ticket, PR, or named branch has one checkout \u2014 if one already matches, returns it (alreadyStarted=true) instead of a second checkout. That is not one agent: chats lists every agent on that checkout. Add another with fork_chat; send_to_chat only the chat that should do this job. Creating from the default branch still opens a new isolated checkout. Pass repoPath from list_projects. cowboy=true uses the project folder on the default branch (no isolated worktree; land is commit+push). From an orchestration chat, omit parentChatId (Sideboard binds the child to this chat) or pass the exact id from the turn reminder \u2014 never invent a uuid. Omit agent/model \u2014 Sideboard applies ${accountDefaultsHint}. Do not pass your own agent or agent=cursor; those are ignored. Setup (settings.toml, .cursor/worktrees.json, or script/setup) runs in the background in parallel with the first turn (skipped for cowboy). Pass the same tags on every workspace you open for one task (short labels such as "phone-sync") so they still match in the sidebar the next day. Reusing a checkout adds those tags. Each orchestration chat can create at most the Settings \u2192 Advanced \u201CMax orchestration threads\u201D cap of child workspaces (default 5). fork_chat on an existing checkout does not use a slot.`,
|
|
39902
40216
|
{
|
|
39903
|
-
sourceType:
|
|
39904
|
-
sourceRef:
|
|
39905
|
-
agent:
|
|
40217
|
+
sourceType: import_zod14.z.enum(["branch", "pr", "ticket"]),
|
|
40218
|
+
sourceRef: import_zod14.z.string(),
|
|
40219
|
+
agent: import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]).optional().describe(
|
|
39906
40220
|
`Usually omit. Sideboard uses Account default agent (${accountDefaults.agent}). Passing your own agent or cursor is ignored. Pass agent=acp and acpHarness=gemini or copilot for Gemini CLI or Copilot CLI.`
|
|
39907
40221
|
),
|
|
39908
|
-
acpHarness:
|
|
39909
|
-
model:
|
|
40222
|
+
acpHarness: import_zod14.z.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini (Gemini CLI) or copilot (GitHub Copilot CLI)."),
|
|
40223
|
+
model: import_zod14.z.string().nullable().optional().describe(
|
|
39910
40224
|
`Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
|
|
39911
40225
|
),
|
|
39912
|
-
repoPath:
|
|
39913
|
-
title:
|
|
39914
|
-
cowboy:
|
|
40226
|
+
repoPath: import_zod14.z.string(),
|
|
40227
|
+
title: import_zod14.z.string().optional(),
|
|
40228
|
+
cowboy: import_zod14.z.boolean().optional().describe(
|
|
39915
40229
|
"If true, work in the project folder on the default branch (no thread/* worktree). Requires Settings \u2192 Advanced \u2192 Cowboy mode. Land is commit+push to that branch. Archive does not delete the folder."
|
|
39916
40230
|
),
|
|
39917
|
-
parentChatId:
|
|
40231
|
+
parentChatId: import_zod14.z.string().optional().describe(
|
|
39918
40232
|
"Orchestration: omit (preferred) or pass YOUR chat id from the turn reminder / AGENTS.md. Do not invent uuids."
|
|
39919
40233
|
),
|
|
39920
|
-
parentThreadId:
|
|
39921
|
-
tags:
|
|
40234
|
+
parentThreadId: import_zod14.z.string().optional().describe("Legacy alias for parentChatId."),
|
|
40235
|
+
tags: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.array(import_zod14.z.string())]).optional().describe(
|
|
39922
40236
|
"Short labels for this workspace (or a comma-separated string). Use the same tags on every checkout for one task. Added when the checkout already exists."
|
|
39923
40237
|
)
|
|
39924
40238
|
},
|
|
@@ -39934,11 +40248,11 @@ async function startMcpServer() {
|
|
|
39934
40248
|
"start_board_card",
|
|
39935
40249
|
"Same as create_workspace for a ticket, PR, or named branch (attaches issue text when Sideboard can resolve it). Does not create a second checkout when one already matches \u2014 returns that workspace (alreadyStarted) and its chats. A workspace can have many agents. fork_chat to add one; send_to_chat only the chat that should do this job.",
|
|
39936
40250
|
{
|
|
39937
|
-
kind:
|
|
39938
|
-
ref:
|
|
39939
|
-
repoPath:
|
|
39940
|
-
title:
|
|
39941
|
-
tags:
|
|
40251
|
+
kind: import_zod14.z.enum(["ticket", "pr", "branch"]),
|
|
40252
|
+
ref: import_zod14.z.string().describe("Ticket identifier (ENG-12), PR number (44), or branch name from list_board"),
|
|
40253
|
+
repoPath: import_zod14.z.string().describe("Project path from list_projects / list_board"),
|
|
40254
|
+
title: import_zod14.z.string().optional(),
|
|
40255
|
+
tags: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.array(import_zod14.z.string())]).optional().describe(
|
|
39942
40256
|
"Short labels for this workspace. Same tags on every checkout for one task. Added when the checkout already exists."
|
|
39943
40257
|
)
|
|
39944
40258
|
},
|
|
@@ -40043,9 +40357,9 @@ async function startMcpServer() {
|
|
|
40043
40357
|
"send_to_chat",
|
|
40044
40358
|
'Send a prompt to a workspace chat. A second send joins that prompt only while it is still queued or not yet handed to the process. Once the process has started, the send waits behind the turn and does not stop it or change the prompt already running. force_stop=true kills the in-flight turn and clears the queue before this prompt \u2014 only when the current request is wrong and must be replaced. The workspace composer still follows Settings \u2192 Follow-up. Use after create_workspace to start or continue a conversation. For commit/push/PR, prefer ask_git (canonical desktop-button phrases). Send "Merge PR." / ask_git merge only when the user explicitly asked to merge. Do not send_to_chat to check in, resume after a halt notice, or because wait_for_turn returned stillRunning. Call wait_for_turn again instead.',
|
|
40045
40359
|
{
|
|
40046
|
-
ref:
|
|
40047
|
-
prompt:
|
|
40048
|
-
force_stop:
|
|
40360
|
+
ref: import_zod14.z.string(),
|
|
40361
|
+
prompt: import_zod14.z.string(),
|
|
40362
|
+
force_stop: import_zod14.z.boolean().optional()
|
|
40049
40363
|
},
|
|
40050
40364
|
async ({ ref, prompt, force_stop }) => {
|
|
40051
40365
|
if (force_stop) {
|
|
@@ -40070,8 +40384,8 @@ async function startMcpServer() {
|
|
|
40070
40384
|
"wait_for_turn",
|
|
40071
40385
|
"Wait until the chat finishes its current/queued turn, or return early with a live progress snapshot. MCP clients often kill tools around 60s, so this returns within 45s even while the child is still working. taskState is the A2A-style lifecycle: submitted (queued, not started), working, input-required (ask_user), completed, failed, canceled. stillRunning is true only for submitted/working. blockedReason is why the child is waiting on a person (the question, plan approval, or a reported block) \u2014 read it and do not send_to_chat a check-in. If stillRunning, text and usage are empty (they would be the previous turn) \u2014 read progress and call wait_for_turn again. Do not send_to_chat a check-in. On failed, read failureClass: auth, quota, and refused are not a retry; timeout or runner can be one. lastError/text is the failure. On canceled, the child did not finish \u2014 resume with send_to_chat or tell the user. On input-required, wait for the user in that chat. When finished, text is this turn\u2019s assistant reply and usage is that turn\u2019s tokens + costUsd (this turn, not the Claude session total; sessionCostUsd is the provider session total when present).",
|
|
40072
40386
|
{
|
|
40073
|
-
ref:
|
|
40074
|
-
timeoutMs:
|
|
40387
|
+
ref: import_zod14.z.string(),
|
|
40388
|
+
timeoutMs: import_zod14.z.number().optional()
|
|
40075
40389
|
},
|
|
40076
40390
|
async ({ ref, timeoutMs }) => {
|
|
40077
40391
|
const thread = await orch.waitForTurn(ref, mcpWaitForTurnTimeoutMs(timeoutMs), {
|
|
@@ -40099,7 +40413,7 @@ async function startMcpServer() {
|
|
|
40099
40413
|
server.tool(
|
|
40100
40414
|
"get_turn_result",
|
|
40101
40415
|
"Assistant message and last-turn usage when the turn finished. While stillRunning (submitted/working), text and usage are empty so a previous reply cannot be mistaken for this turn \u2014 use progress for tools/thinking. Not the full transcript. Includes taskState (A2A lifecycle), failureClass when the turn failed (auth, quota, refused, timeout, runner, other), and blockedReason (why the agent is waiting on a person).",
|
|
40102
|
-
{ ref:
|
|
40416
|
+
{ ref: import_zod14.z.string() },
|
|
40103
40417
|
async ({ ref }) => {
|
|
40104
40418
|
const result = orch.getTurnResult(ref);
|
|
40105
40419
|
const failureClass = result.taskState === "failed" && result.status !== "broken" ? classifyTurnFailure(result.lastError || result.text) : null;
|
|
@@ -40117,9 +40431,9 @@ async function startMcpServer() {
|
|
|
40117
40431
|
"stop_chat",
|
|
40118
40432
|
"Force-stop a thread: kill any in-flight agent turn AND clear queued prompts so drainQueue cannot continue. Does not archive the worktree. Optional force defaults to true. Pass reason \u2014 a short note on why this chat is stopping. It is stored on the thread and kept when the turn unwinds. If you omit it, Sideboard still records that the queue was cleared.",
|
|
40119
40433
|
{
|
|
40120
|
-
ref:
|
|
40121
|
-
force:
|
|
40122
|
-
reason:
|
|
40434
|
+
ref: import_zod14.z.string(),
|
|
40435
|
+
force: import_zod14.z.boolean().optional(),
|
|
40436
|
+
reason: import_zod14.z.string().optional().describe("Why this chat is stopping. Stored on the thread for the next session.")
|
|
40123
40437
|
},
|
|
40124
40438
|
async ({ ref, force, reason }) => {
|
|
40125
40439
|
const t = orch.getThread(ref);
|
|
@@ -40145,8 +40459,8 @@ async function startMcpServer() {
|
|
|
40145
40459
|
"get_diff",
|
|
40146
40460
|
"Compact diff summary (capped hunks, paginated)",
|
|
40147
40461
|
{
|
|
40148
|
-
ref:
|
|
40149
|
-
maxFiles:
|
|
40462
|
+
ref: import_zod14.z.string(),
|
|
40463
|
+
maxFiles: import_zod14.z.number().optional()
|
|
40150
40464
|
},
|
|
40151
40465
|
async ({ ref, maxFiles }) => {
|
|
40152
40466
|
const summary = await orch.diffSummary(ref);
|
|
@@ -40159,7 +40473,7 @@ async function startMcpServer() {
|
|
|
40159
40473
|
server.tool(
|
|
40160
40474
|
"get_pr_checks",
|
|
40161
40475
|
"Snapshot of GitHub PR checks for a worktree thread (`gh pr checks` plus merge/review gates). null = no PR. If the user gave a goal (Greptile 5/5, CI green), the worktree agent watches with `gh pr checks --watch` via /long-running \u2014 this tool is a snapshot, not a waiter. Coordinators: do not run gh from the orchestration cwd.",
|
|
40162
|
-
{ ref:
|
|
40476
|
+
{ ref: import_zod14.z.string().describe("Worktree thread id/ref") },
|
|
40163
40477
|
async ({ ref }) => {
|
|
40164
40478
|
try {
|
|
40165
40479
|
const checks = await orch.getPrChecks(ref);
|
|
@@ -40173,7 +40487,7 @@ async function startMcpServer() {
|
|
|
40173
40487
|
server.tool(
|
|
40174
40488
|
"request_review",
|
|
40175
40489
|
'Start a merge-readiness Review on a worktree agent thread (same as the desktop Review button). If that worktree has a single unused idle agent (no messages), runs the review there; otherwise opens a new Review chat tab. Attaches .claude/skills/review/SKILL.md when present (else copies .sideboard/review.md into .context/review.md, or seeds that file from the stock template), and sends "Review changes in this workspace." Expect Approve / Approve with nits / Request changes / Needs more information in that chat. The review stays there so the user can read it and type next steps \u2014 do not comment on or update the PR or ticket, and do not ask_user after the review, until they ask. Pass a worktree thread ref \u2014 not the orchestrator. Then wait_for_turn (loop while stillRunning) / get_turn_result on the returned review thread id.',
|
|
40176
|
-
{ ref:
|
|
40490
|
+
{ ref: import_zod14.z.string().describe("Worktree thread id/ref to review") },
|
|
40177
40491
|
async ({ ref }) => {
|
|
40178
40492
|
try {
|
|
40179
40493
|
const tab = await orch.requestReview(ref);
|
|
@@ -40195,8 +40509,8 @@ async function startMcpServer() {
|
|
|
40195
40509
|
"ask_git",
|
|
40196
40510
|
"Commit & push, open a draft PR, mark ready for review, resolve conflicts, or merge \u2014 same prompts as the desktop git buttons (including Resolve). Always steers the worktree agent; does not push or open the PR locally. Then wait_for_turn (loop while stillRunning). Do not start a checks loop on a plain push \u2014 only if the user gave a goal (CI green, a review score, until checks pass). A push can wake a third-party PR review; the worktree agent acknowledges it only inside that goal. Pass a worktree thread ref (not the orchestrator). action=ready-for-review and action=merge only when the user explicitly asked (or clicked the desktop button). Do not run git or gh from the orchestration cwd.",
|
|
40197
40511
|
{
|
|
40198
|
-
ref:
|
|
40199
|
-
action:
|
|
40512
|
+
ref: import_zod14.z.string().describe("Worktree thread id/ref"),
|
|
40513
|
+
action: import_zod14.z.enum(AGENT_GIT_ACTIONS).describe(
|
|
40200
40514
|
"commit-push | create-draft | create-web | resolve-conflicts | ready-for-review | merge"
|
|
40201
40515
|
)
|
|
40202
40516
|
},
|
|
@@ -40225,7 +40539,7 @@ async function startMcpServer() {
|
|
|
40225
40539
|
}
|
|
40226
40540
|
}
|
|
40227
40541
|
);
|
|
40228
|
-
const agentEnum =
|
|
40542
|
+
const agentEnum = import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
|
|
40229
40543
|
server.tool(
|
|
40230
40544
|
"list_models",
|
|
40231
40545
|
"List models for an agent. Prefer Auto: do not call this unless you have a reason to pin a specific model (user request, cost/latency, capability). Omit agent to list all.",
|
|
@@ -40246,12 +40560,12 @@ async function startMcpServer() {
|
|
|
40246
40560
|
"fork_workspace",
|
|
40247
40561
|
"Fork a worktree agent chat into a NEW git worktree + chat (desktop \u201CFork to new workspace\u201D). Seeds a transcript (through through_index, default all). Optional agent override. Leave model unset for Auto (default) \u2014 only pass model when you have a reason. Not for the orchestrator. Then send_to_chat / wait_for_turn (loop while stillRunning) on the returned id.",
|
|
40248
40562
|
{
|
|
40249
|
-
ref:
|
|
40250
|
-
through_index:
|
|
40563
|
+
ref: import_zod14.z.string().describe("Worktree thread id/ref to fork"),
|
|
40564
|
+
through_index: import_zod14.z.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
40251
40565
|
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
|
|
40252
|
-
acpHarness:
|
|
40253
|
-
model:
|
|
40254
|
-
title:
|
|
40566
|
+
acpHarness: import_zod14.z.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
|
|
40567
|
+
model: import_zod14.z.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
40568
|
+
title: import_zod14.z.string().optional()
|
|
40255
40569
|
},
|
|
40256
40570
|
async ({ ref, through_index, agent, model, title, acpHarness }) => {
|
|
40257
40571
|
try {
|
|
@@ -40286,12 +40600,12 @@ async function startMcpServer() {
|
|
|
40286
40600
|
"fork_chat",
|
|
40287
40601
|
"Add another agent chat on the SAME workspace (same files, Run, and git). Also forks a Global orchestration chat into a new orchestration tab. Pass agent when the new chat should use a different harness. Leave model unset for Auto unless you have a reason. Orchestration forks require an MCP-capable agent (claude, cursor, codex, opencode \u2014 not brightsy). Use this for a second agent on a checkout (review, another harness, parallel work on the same branch). Do not create_workspace again for that \u2014 it returns the existing checkout. Then send_to_chat / wait_for_turn (loop while stillRunning) on the returned id. Use fork_workspace only when the work needs its own git checkout.",
|
|
40288
40602
|
{
|
|
40289
|
-
ref:
|
|
40290
|
-
through_index:
|
|
40603
|
+
ref: import_zod14.z.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
|
|
40604
|
+
through_index: import_zod14.z.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
40291
40605
|
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source). agent=acp with acpHarness=gemini or copilot opens Gemini CLI or Copilot CLI. An orchestration fork cannot use acp."),
|
|
40292
|
-
acpHarness:
|
|
40293
|
-
model:
|
|
40294
|
-
title:
|
|
40606
|
+
acpHarness: import_zod14.z.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
|
|
40607
|
+
model: import_zod14.z.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
40608
|
+
title: import_zod14.z.string().optional()
|
|
40295
40609
|
},
|
|
40296
40610
|
async ({ ref, through_index, agent, model, title, acpHarness }) => {
|
|
40297
40611
|
try {
|
|
@@ -40330,7 +40644,7 @@ async function startMcpServer() {
|
|
|
40330
40644
|
server.tool(
|
|
40331
40645
|
"run_setup",
|
|
40332
40646
|
"Re-run workspace setup (Sideboard/Conductor settings, .cursor/worktrees.json, or script/setup). New worktrees already run this automatically.",
|
|
40333
|
-
{ ref:
|
|
40647
|
+
{ ref: import_zod14.z.string() },
|
|
40334
40648
|
async ({ ref }) => {
|
|
40335
40649
|
const result = await orch.runSetup(ref);
|
|
40336
40650
|
return mcpJson(result);
|
|
@@ -40339,7 +40653,7 @@ async function startMcpServer() {
|
|
|
40339
40653
|
server.tool(
|
|
40340
40654
|
"add_project",
|
|
40341
40655
|
"Register a git repo as a Sideboard workspace",
|
|
40342
|
-
{ repoPath:
|
|
40656
|
+
{ repoPath: import_zod14.z.string() },
|
|
40343
40657
|
async ({ repoPath }) => {
|
|
40344
40658
|
const ws = await orch.addWorkspace(repoPath);
|
|
40345
40659
|
return mcpJson(ws);
|
|
@@ -40348,7 +40662,7 @@ async function startMcpServer() {
|
|
|
40348
40662
|
server.tool(
|
|
40349
40663
|
"remove_project",
|
|
40350
40664
|
"Unregister a Sideboard workspace and archive its chats",
|
|
40351
|
-
{ repoPath:
|
|
40665
|
+
{ repoPath: import_zod14.z.string() },
|
|
40352
40666
|
async ({ repoPath }) => {
|
|
40353
40667
|
await orch.removeWorkspace(repoPath);
|
|
40354
40668
|
return { content: [{ type: "text", text: "ok" }] };
|
|
@@ -40358,12 +40672,12 @@ async function startMcpServer() {
|
|
|
40358
40672
|
"fanout",
|
|
40359
40673
|
"Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
|
|
40360
40674
|
{
|
|
40361
|
-
prompt:
|
|
40362
|
-
agents:
|
|
40363
|
-
repoPath:
|
|
40364
|
-
sourceType:
|
|
40365
|
-
sourceRef:
|
|
40366
|
-
title:
|
|
40675
|
+
prompt: import_zod14.z.string(),
|
|
40676
|
+
agents: import_zod14.z.array(import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"])),
|
|
40677
|
+
repoPath: import_zod14.z.string(),
|
|
40678
|
+
sourceType: import_zod14.z.enum(["branch", "pr", "ticket"]).optional(),
|
|
40679
|
+
sourceRef: import_zod14.z.string().optional(),
|
|
40680
|
+
title: import_zod14.z.string().optional()
|
|
40367
40681
|
},
|
|
40368
40682
|
async (args) => {
|
|
40369
40683
|
const threads = await orch.bestOfN(args);
|
|
@@ -40381,8 +40695,8 @@ async function startMcpServer() {
|
|
|
40381
40695
|
"list_branches",
|
|
40382
40696
|
"List git branches in a registered workspace. Pass repoPath from list_projects (unmerged into the default branch by default \u2014 for create_workspace sourceType=branch).",
|
|
40383
40697
|
{
|
|
40384
|
-
repoPath:
|
|
40385
|
-
unmergedOnly:
|
|
40698
|
+
repoPath: import_zod14.z.string(),
|
|
40699
|
+
unmergedOnly: import_zod14.z.boolean().optional()
|
|
40386
40700
|
},
|
|
40387
40701
|
async ({ repoPath, unmergedOnly }) => {
|
|
40388
40702
|
const root = await resolveRepoRoot(repoPath);
|
|
@@ -40403,19 +40717,19 @@ async function startMcpServer() {
|
|
|
40403
40717
|
"list_prs",
|
|
40404
40718
|
`List GitHub PRs for a registered workspace (the review surface for assigned ticket work \u2014 not the tickets). Pass repoPath from list_projects. "Get me N tickets to review" \u2192 queue=review and limit=N: open non-draft PRs labeled with this project's ready-for-review GitHub label (Settings \u2192 Projects; default eng-review) with no individual user reviewer. Prefer teams that match Settings \u2192 Agents / Projects roles for this repo. A team like engineering-team is not a claim (you are on that team). Also: state (open|closed|merged|all|review), label, reviewer (me|unassigned|login), query, limit (default 40, max 250). Then create_workspace with sourceType=pr.`,
|
|
40405
40719
|
{
|
|
40406
|
-
repoPath:
|
|
40407
|
-
query:
|
|
40408
|
-
queue:
|
|
40720
|
+
repoPath: import_zod14.z.string(),
|
|
40721
|
+
query: import_zod14.z.string().optional().describe("GitHub search tokens (title, draft:true, \u2026)"),
|
|
40722
|
+
queue: import_zod14.z.enum(["review", "mine", "approved", "changes"]).optional().describe(
|
|
40409
40723
|
"review = unclaimed ready-for-review inbox (Settings \u2192 Projects label, default eng-review). mine = review-requested:@me. approved / changes = eng-approved / eng-requested-changes."
|
|
40410
40724
|
),
|
|
40411
|
-
state:
|
|
40412
|
-
label:
|
|
40725
|
+
state: import_zod14.z.enum(["open", "closed", "merged", "all", "review"]).optional().describe("GitHub PR state (default open). review is an alias for queue=review."),
|
|
40726
|
+
label: import_zod14.z.string().optional().describe(
|
|
40413
40727
|
"GitHub label / workflow tag. Comma-separated AND. Examples: eng-review, eng-approved, eng-requested-changes"
|
|
40414
40728
|
),
|
|
40415
|
-
reviewer:
|
|
40729
|
+
reviewer: import_zod14.z.string().optional().describe(
|
|
40416
40730
|
"me (review requested of you), unassigned (no individual reviewer; team queues like engineering-team still count), all, or a GitHub login"
|
|
40417
40731
|
),
|
|
40418
|
-
limit:
|
|
40732
|
+
limit: import_zod14.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
|
|
40419
40733
|
},
|
|
40420
40734
|
async ({ repoPath, query, queue, state, label, reviewer, limit }) => {
|
|
40421
40735
|
const root = await resolveRepoRoot(repoPath);
|
|
@@ -40448,7 +40762,7 @@ async function startMcpServer() {
|
|
|
40448
40762
|
server.tool(
|
|
40449
40763
|
"get_pr_stack",
|
|
40450
40764
|
"Load the GitHub PR stack for a thread worktree (`gh stack view --json`). Returns null JSON when the branch is not stacked. Prefer this before ask_git merge on stacked PRs (and only merge when the user explicitly asked).",
|
|
40451
|
-
{ ref:
|
|
40765
|
+
{ ref: import_zod14.z.string() },
|
|
40452
40766
|
async ({ ref }) => {
|
|
40453
40767
|
const stack = await orch.getPrStack(ref);
|
|
40454
40768
|
return mcpJson(stack);
|
|
@@ -40458,8 +40772,8 @@ async function startMcpServer() {
|
|
|
40458
40772
|
"open_pr_stack_layers",
|
|
40459
40773
|
"Materialize one worktree+thread per stack layer (or a single 1-based layer). Pass a thread ref already on the stack.",
|
|
40460
40774
|
{
|
|
40461
|
-
ref:
|
|
40462
|
-
layer:
|
|
40775
|
+
ref: import_zod14.z.string(),
|
|
40776
|
+
layer: import_zod14.z.number().int().positive().optional()
|
|
40463
40777
|
},
|
|
40464
40778
|
async ({ ref, layer }) => {
|
|
40465
40779
|
const result = await orch.openPrStackLayers(ref, { layer });
|
|
@@ -40482,9 +40796,9 @@ async function startMcpServer() {
|
|
|
40482
40796
|
"add_stack_layer",
|
|
40483
40797
|
"Add a branch on top of the current stack (`gh stack add`) and open a worktree+thread for it.",
|
|
40484
40798
|
{
|
|
40485
|
-
ref:
|
|
40486
|
-
branchName:
|
|
40487
|
-
title:
|
|
40799
|
+
ref: import_zod14.z.string(),
|
|
40800
|
+
branchName: import_zod14.z.string(),
|
|
40801
|
+
title: import_zod14.z.string().optional()
|
|
40488
40802
|
},
|
|
40489
40803
|
async ({ ref, branchName, title }) => {
|
|
40490
40804
|
const result = await orch.addStackLayer(ref, branchName, { title });
|
|
@@ -40502,11 +40816,11 @@ async function startMcpServer() {
|
|
|
40502
40816
|
"create_pr_stack",
|
|
40503
40817
|
"Create a new GitHub PR stack with one Sideboard worktree per layer (bottom\u2192top branch names). Requires `gh extension install github/gh-stack`.",
|
|
40504
40818
|
{
|
|
40505
|
-
repoPath:
|
|
40506
|
-
branches:
|
|
40507
|
-
agent:
|
|
40508
|
-
base:
|
|
40509
|
-
title:
|
|
40819
|
+
repoPath: import_zod14.z.string(),
|
|
40820
|
+
branches: import_zod14.z.array(import_zod14.z.string()).min(1),
|
|
40821
|
+
agent: import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]),
|
|
40822
|
+
base: import_zod14.z.string().optional(),
|
|
40823
|
+
title: import_zod14.z.string().optional()
|
|
40510
40824
|
},
|
|
40511
40825
|
async (args) => {
|
|
40512
40826
|
const result = await orch.createPrStack({
|
|
@@ -40534,10 +40848,10 @@ async function startMcpServer() {
|
|
|
40534
40848
|
"list_issues",
|
|
40535
40849
|
"List or search issues (Linear, AbleTime, or GitHub; falls back to GitHub). Cursor Origin has no issue tracker \u2014 a Cursor repo returns unavailableReason unless Linear or AbleTime is the source. Entire tickets are Trails (`entire trail`), not GitHub Issues, so an Entire repo does the same unless Linear or AbleTime is the source. Use Settings \u2192 Agents / Projects notes and roles to pick tickets relevant to the viewer (query + assignee=me or unassigned as the notes say). Default 40; pass query and/or limit (max 250) when truncated. assignee: me (Linear default), unassigned, all, or a user id. Pass updatedSince for new/updated tickets and new comments (\u201Cany updates since yesterday?\u201D). Then create_workspace with sourceType=ticket.",
|
|
40536
40850
|
{
|
|
40537
|
-
repoPath:
|
|
40538
|
-
query:
|
|
40539
|
-
assignee:
|
|
40540
|
-
limit:
|
|
40851
|
+
repoPath: import_zod14.z.string(),
|
|
40852
|
+
query: import_zod14.z.string().optional().describe("Search title, identifier, or description"),
|
|
40853
|
+
assignee: import_zod14.z.string().optional().describe("me (Linear default), unassigned, all, a user id, or a GitHub login"),
|
|
40854
|
+
limit: import_zod14.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
40541
40855
|
updatedSince: mcpIssueUpdatedSinceSchema
|
|
40542
40856
|
},
|
|
40543
40857
|
async ({ repoPath, query, assignee, limit, updatedSince }) => {
|