@sideboard-ai/core 0.1.351 → 0.1.353
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 +37 -6
- package/dist/agents/claude-runner.js +16 -1
- package/dist/agents/cursor-runner.cjs +56 -12
- package/dist/agents/cursor-runner.js +2 -2
- package/dist/{agents-INTH7J3F.js → agents-5LFUHPSA.js} +9 -9
- package/dist/{agents-D5CL4CR4.js → agents-6B2HHICJ.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-YVN7L4KG.js → chunk-AF5K6GQU.js} +6 -1
- package/dist/{chunk-WB3G2LQO.js → chunk-BCNPZ7H2.js} +1 -1
- package/dist/chunk-EAV2ZF5S.js +858 -0
- package/dist/{chunk-SMSD6U3N.js → chunk-GA5MLYVG.js} +1 -1
- package/dist/{chunk-HISSQICH.js → chunk-HBRP2SHA.js} +3 -3
- package/dist/{chunk-7WPQAVS5.js → chunk-HMSXKV53.js} +150 -126
- 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-UXAKH4AW.js → chunk-MX2XU4BS.js} +418 -71
- package/dist/{chunk-TCEUNSLX.js → chunk-NRGT7RMO.js} +1 -1
- package/dist/{chunk-M45WGODR.js → chunk-OCCUD5CK.js} +2 -2
- package/dist/{chunk-BDWVBEKN.js → chunk-PKH3DRA6.js} +153 -127
- 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-PXSWVZIL.js → chunk-UPJB6TFI.js} +2 -2
- 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-AAKQU4UZ.js → chunk-Z3CGD5HC.js} +28 -10
- 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 +1414 -869
- package/dist/index.d.cts +116 -10
- package/dist/index.d.ts +116 -10
- package/dist/index.js +398 -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 +1227 -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-MUD4FY7Q.js → orchestrator-UFHS2FOC.js} +12 -12
- package/dist/{orchestrator-DMEE7CEW.js → orchestrator-YCGWSIHF.js} +11 -11
- 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/chunk-SUZOPJZC.js +0 -430
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,341 @@ var init_rpc_env = __esm({
|
|
|
15242
15246
|
}
|
|
15243
15247
|
});
|
|
15244
15248
|
|
|
15249
|
+
// src/computer-use/bridge.ts
|
|
15250
|
+
function computerUseBridgePath() {
|
|
15251
|
+
return (0, import_node_path40.join)(appDataDir(), "computer-use-bridge.json");
|
|
15252
|
+
}
|
|
15253
|
+
function readComputerUseBridge(file = computerUseBridgePath()) {
|
|
15254
|
+
try {
|
|
15255
|
+
const raw = JSON.parse((0, import_node_fs38.readFileSync)(file, "utf8"));
|
|
15256
|
+
if (typeof raw.port !== "number" || !Number.isInteger(raw.port)) return null;
|
|
15257
|
+
if (raw.port < 1 || raw.port > 65535) return null;
|
|
15258
|
+
if (typeof raw.token !== "string" || raw.token.length < 16) return null;
|
|
15259
|
+
return { port: raw.port, token: raw.token };
|
|
15260
|
+
} catch {
|
|
15261
|
+
return null;
|
|
15262
|
+
}
|
|
15263
|
+
}
|
|
15264
|
+
function cgScrollWheels(dx, dy) {
|
|
15265
|
+
return { wheel1: -dy, wheel2: -dx };
|
|
15266
|
+
}
|
|
15267
|
+
async function bridgeError(res) {
|
|
15268
|
+
try {
|
|
15269
|
+
const body = await res.json();
|
|
15270
|
+
if (typeof body.error === "string" && body.error) return body.error;
|
|
15271
|
+
} catch {
|
|
15272
|
+
}
|
|
15273
|
+
return `computer use bridge returned ${res.status}`;
|
|
15274
|
+
}
|
|
15275
|
+
async function bridgeFetch(info, path, init) {
|
|
15276
|
+
try {
|
|
15277
|
+
return await fetch(`http://127.0.0.1:${info.port}${path}`, {
|
|
15278
|
+
...init,
|
|
15279
|
+
headers: {
|
|
15280
|
+
authorization: `Bearer ${info.token}`,
|
|
15281
|
+
...init.headers
|
|
15282
|
+
},
|
|
15283
|
+
signal: AbortSignal.timeout(15e3)
|
|
15284
|
+
});
|
|
15285
|
+
} catch {
|
|
15286
|
+
return null;
|
|
15287
|
+
}
|
|
15288
|
+
}
|
|
15289
|
+
async function postComputerUseBridge(event, file = computerUseBridgePath()) {
|
|
15290
|
+
const info = readComputerUseBridge(file);
|
|
15291
|
+
if (!info) return false;
|
|
15292
|
+
const res = await bridgeFetch(info, "/v1/event", {
|
|
15293
|
+
method: "POST",
|
|
15294
|
+
headers: { "content-type": "application/json" },
|
|
15295
|
+
body: JSON.stringify(event)
|
|
15296
|
+
});
|
|
15297
|
+
if (!res) return false;
|
|
15298
|
+
if (!res.ok) throw new Error(await bridgeError(res));
|
|
15299
|
+
return true;
|
|
15300
|
+
}
|
|
15301
|
+
async function fetchComputerUseScreenshot(file = computerUseBridgePath()) {
|
|
15302
|
+
const info = readComputerUseBridge(file);
|
|
15303
|
+
if (!info) return null;
|
|
15304
|
+
const res = await bridgeFetch(info, "/v1/screenshot", { method: "POST" });
|
|
15305
|
+
if (!res) return null;
|
|
15306
|
+
if (!res.ok) throw new Error(await bridgeError(res));
|
|
15307
|
+
const png = Buffer.from(await res.arrayBuffer());
|
|
15308
|
+
if (png.length < 24) throw new Error("screen capture was empty");
|
|
15309
|
+
const header = Number(res.headers.get("x-sideboard-scale"));
|
|
15310
|
+
return { png, scale: Number.isFinite(header) && header > 0 ? header : 1 };
|
|
15311
|
+
}
|
|
15312
|
+
var import_node_fs38, import_node_path40;
|
|
15313
|
+
var init_bridge = __esm({
|
|
15314
|
+
"src/computer-use/bridge.ts"() {
|
|
15315
|
+
"use strict";
|
|
15316
|
+
import_node_fs38 = require("fs");
|
|
15317
|
+
import_node_path40 = require("path");
|
|
15318
|
+
init_paths();
|
|
15319
|
+
}
|
|
15320
|
+
});
|
|
15321
|
+
|
|
15322
|
+
// src/computer-use/computer-use.ts
|
|
15323
|
+
function macKeyCode(key) {
|
|
15324
|
+
const code = KEY_CODES[key];
|
|
15325
|
+
return code === void 0 ? null : code;
|
|
15326
|
+
}
|
|
15327
|
+
function appleScriptString(text8) {
|
|
15328
|
+
return `"${text8.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
15329
|
+
}
|
|
15330
|
+
function typeScripts(text8) {
|
|
15331
|
+
const parts = text8.split(/\r\n|\n|\r/);
|
|
15332
|
+
const scripts = [];
|
|
15333
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
15334
|
+
if (parts[i]) {
|
|
15335
|
+
scripts.push(`tell application "System Events" to keystroke ${appleScriptString(parts[i])}`);
|
|
15336
|
+
}
|
|
15337
|
+
if (i < parts.length - 1) {
|
|
15338
|
+
scripts.push('tell application "System Events" to key code 36');
|
|
15339
|
+
}
|
|
15340
|
+
}
|
|
15341
|
+
return scripts;
|
|
15342
|
+
}
|
|
15343
|
+
function modifierClause(modifiers) {
|
|
15344
|
+
const downs = modifiers.map((name) => {
|
|
15345
|
+
if (name === "cmd" || name === "command") return "command down";
|
|
15346
|
+
if (name === "alt" || name === "option") return "option down";
|
|
15347
|
+
if (name === "ctrl" || name === "control") return "control down";
|
|
15348
|
+
return "shift down";
|
|
15349
|
+
});
|
|
15350
|
+
if (!downs.length) return "";
|
|
15351
|
+
return ` using {${downs.join(", ")}}`;
|
|
15352
|
+
}
|
|
15353
|
+
function pngPointSize(bytes) {
|
|
15354
|
+
if (bytes.length < 24 || !bytes.subarray(0, 8).equals(PNG_SIG)) {
|
|
15355
|
+
throw new Error("screenshot is not a PNG");
|
|
15356
|
+
}
|
|
15357
|
+
let pixelWidth = 0;
|
|
15358
|
+
let pixelHeight = 0;
|
|
15359
|
+
let scale = 1;
|
|
15360
|
+
let offset = 8;
|
|
15361
|
+
while (offset + 8 <= bytes.length) {
|
|
15362
|
+
const length = bytes.readUInt32BE(offset);
|
|
15363
|
+
const type = bytes.toString("ascii", offset + 4, offset + 8);
|
|
15364
|
+
const data = offset + 8;
|
|
15365
|
+
if (data + length > bytes.length) break;
|
|
15366
|
+
if (type === "IHDR" && length >= 8) {
|
|
15367
|
+
pixelWidth = bytes.readUInt32BE(data);
|
|
15368
|
+
pixelHeight = bytes.readUInt32BE(data + 4);
|
|
15369
|
+
} else if (type === "pHYs" && length >= 9 && bytes[data + 8] === 1) {
|
|
15370
|
+
const ppm = bytes.readUInt32BE(data);
|
|
15371
|
+
if (ppm > 0) scale = ppm * 0.0254 / 72;
|
|
15372
|
+
} else if (type === "IEND") {
|
|
15373
|
+
break;
|
|
15374
|
+
}
|
|
15375
|
+
offset = data + length + 4;
|
|
15376
|
+
}
|
|
15377
|
+
if (pixelWidth <= 0 || pixelHeight <= 0) throw new Error("screenshot PNG has no size");
|
|
15378
|
+
return { pixelWidth, pixelHeight, scale };
|
|
15379
|
+
}
|
|
15380
|
+
function pointGeometry(info) {
|
|
15381
|
+
const raw = info.scale > 0 && Number.isFinite(info.scale) ? info.scale : 1;
|
|
15382
|
+
const scale = Math.round(raw * 100) / 100;
|
|
15383
|
+
return {
|
|
15384
|
+
width: Math.round(info.pixelWidth / scale),
|
|
15385
|
+
height: Math.round(info.pixelHeight / scale),
|
|
15386
|
+
scale
|
|
15387
|
+
};
|
|
15388
|
+
}
|
|
15389
|
+
function scrollWheelSwift(x, y, dx, dy) {
|
|
15390
|
+
for (const n of [x, y, dx, dy]) {
|
|
15391
|
+
if (!Number.isInteger(n)) throw new Error("scroll coordinates must be integers");
|
|
15392
|
+
}
|
|
15393
|
+
const { wheel1, wheel2 } = cgScrollWheels(dx, dy);
|
|
15394
|
+
return `import CoreGraphics
|
|
15395
|
+
let src = CGEventSource(stateID: .hidSystemState)
|
|
15396
|
+
let p = CGPoint(x: ${x}, y: ${y})
|
|
15397
|
+
if let move = CGEvent(mouseEventSource: src, mouseType: .mouseMoved, mouseCursorPosition: p, mouseButton: .left) {
|
|
15398
|
+
move.post(tap: .cghidEventTap)
|
|
15399
|
+
}
|
|
15400
|
+
if let ev = CGEvent(scrollWheelEvent2Source: src, units: .pixel, wheelCount: 2, wheel1: ${wheel1}, wheel2: ${wheel2}, wheel3: 0) {
|
|
15401
|
+
ev.location = p
|
|
15402
|
+
ev.post(tap: .cghidEventTap)
|
|
15403
|
+
}
|
|
15404
|
+
`;
|
|
15405
|
+
}
|
|
15406
|
+
function asRecord6(value) {
|
|
15407
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
15408
|
+
return value;
|
|
15409
|
+
}
|
|
15410
|
+
function finite(value) {
|
|
15411
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
15412
|
+
}
|
|
15413
|
+
function point(value) {
|
|
15414
|
+
const n = Math.round(value);
|
|
15415
|
+
if (n < -8e3 || n > 2e4) return null;
|
|
15416
|
+
return n;
|
|
15417
|
+
}
|
|
15418
|
+
function scrollDelta(value) {
|
|
15419
|
+
const n = Math.round(value);
|
|
15420
|
+
if (n < -4e3 || n > 4e3) return null;
|
|
15421
|
+
return n;
|
|
15422
|
+
}
|
|
15423
|
+
function screenshotFile(cwd, now) {
|
|
15424
|
+
const root = (0, import_node_path41.isAbsolute)(cwd) ? cwd : (0, import_node_os19.tmpdir)();
|
|
15425
|
+
const dir = (0, import_node_path41.join)(root, ".context", "cli");
|
|
15426
|
+
(0, import_node_fs39.mkdirSync)(dir, { recursive: true });
|
|
15427
|
+
return (0, import_node_path41.join)(dir, `computer-use-${now}.png`);
|
|
15428
|
+
}
|
|
15429
|
+
async function posted(runner, event) {
|
|
15430
|
+
if (!runner.postInput) return false;
|
|
15431
|
+
return runner.postInput(event);
|
|
15432
|
+
}
|
|
15433
|
+
function screenshotMessage(width, height, scale) {
|
|
15434
|
+
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.`;
|
|
15435
|
+
}
|
|
15436
|
+
async function performComputerUse(opts) {
|
|
15437
|
+
if (!opts.enabled) return { ok: false, error: COMPUTER_USE_OFF };
|
|
15438
|
+
const rec = asRecord6(opts.input);
|
|
15439
|
+
const action = typeof rec.action === "string" ? rec.action : "";
|
|
15440
|
+
try {
|
|
15441
|
+
if (action === "screenshot") {
|
|
15442
|
+
const file = screenshotFile(opts.cwd, opts.now ?? Date.now());
|
|
15443
|
+
const captured = await opts.runner.screenshot(file);
|
|
15444
|
+
const geo = pointGeometry(captured);
|
|
15445
|
+
return {
|
|
15446
|
+
ok: true,
|
|
15447
|
+
action,
|
|
15448
|
+
path: file,
|
|
15449
|
+
width: geo.width,
|
|
15450
|
+
height: geo.height,
|
|
15451
|
+
scale: geo.scale,
|
|
15452
|
+
message: screenshotMessage(geo.width, geo.height, geo.scale)
|
|
15453
|
+
};
|
|
15454
|
+
}
|
|
15455
|
+
if (action === "click") {
|
|
15456
|
+
const x = finite(rec.x);
|
|
15457
|
+
const y = finite(rec.y);
|
|
15458
|
+
if (x === null || y === null) return { ok: false, error: "click requires finite x and y" };
|
|
15459
|
+
const px = point(x);
|
|
15460
|
+
const py = point(y);
|
|
15461
|
+
if (px === null || py === null) return { ok: false, error: "click point is out of range" };
|
|
15462
|
+
if (!await posted(opts.runner, { type: "click", x: px, y: py })) {
|
|
15463
|
+
await opts.runner.runAppleScript(
|
|
15464
|
+
`tell application "System Events" to click at {${px}, ${py}}`
|
|
15465
|
+
);
|
|
15466
|
+
}
|
|
15467
|
+
return { ok: true, action, message: `Clicked ${px}, ${py}.` };
|
|
15468
|
+
}
|
|
15469
|
+
if (action === "type") {
|
|
15470
|
+
const text8 = typeof rec.text === "string" ? rec.text : "";
|
|
15471
|
+
if (!text8) return { ok: false, error: "type requires text" };
|
|
15472
|
+
if (text8.length > 2e3) return { ok: false, error: "type text is longer than 2000 characters" };
|
|
15473
|
+
if (!await posted(opts.runner, { type: "type", text: text8 })) {
|
|
15474
|
+
for (const script of typeScripts(text8)) {
|
|
15475
|
+
await opts.runner.runAppleScript(script);
|
|
15476
|
+
}
|
|
15477
|
+
}
|
|
15478
|
+
return { ok: true, action, message: `Typed ${text8.length} characters.` };
|
|
15479
|
+
}
|
|
15480
|
+
if (action === "key") {
|
|
15481
|
+
const key = typeof rec.key === "string" ? rec.key.trim().toLowerCase() : "";
|
|
15482
|
+
const modifiers = Array.isArray(rec.modifiers) ? rec.modifiers.filter((item) => typeof item === "string") : [];
|
|
15483
|
+
if (!key) return { ok: false, error: "key requires key" };
|
|
15484
|
+
if (modifiers.some((name) => !MODIFIERS.has(name.toLowerCase()))) {
|
|
15485
|
+
return { ok: false, error: "key modifiers are command, shift, option, and control" };
|
|
15486
|
+
}
|
|
15487
|
+
const mods = modifiers.map((name) => name.toLowerCase());
|
|
15488
|
+
const using = modifierClause(mods);
|
|
15489
|
+
const code = macKeyCode(key);
|
|
15490
|
+
const script = code !== null ? `tell application "System Events" to key code ${code}${using}` : key.length === 1 ? `tell application "System Events" to keystroke ${appleScriptString(key)}${using}` : "";
|
|
15491
|
+
if (!script) return { ok: false, error: `unsupported key ${key}` };
|
|
15492
|
+
if (!await posted(opts.runner, { type: "key", key, modifiers: mods })) {
|
|
15493
|
+
await opts.runner.runAppleScript(script);
|
|
15494
|
+
}
|
|
15495
|
+
return { ok: true, action, message: `Pressed ${key}.` };
|
|
15496
|
+
}
|
|
15497
|
+
if (action === "scroll") {
|
|
15498
|
+
const x = finite(rec.x);
|
|
15499
|
+
const y = finite(rec.y);
|
|
15500
|
+
if (x === null || y === null) return { ok: false, error: "scroll requires finite x and y" };
|
|
15501
|
+
const px = point(x);
|
|
15502
|
+
const py = point(y);
|
|
15503
|
+
if (px === null || py === null) return { ok: false, error: "scroll point is out of range" };
|
|
15504
|
+
const dx = finite(rec.dx) ?? 0;
|
|
15505
|
+
const dy = finite(rec.dy) ?? 0;
|
|
15506
|
+
const sdx = scrollDelta(dx);
|
|
15507
|
+
const sdy = scrollDelta(dy);
|
|
15508
|
+
if (sdx === null || sdy === null) return { ok: false, error: "scroll delta is out of range" };
|
|
15509
|
+
if (sdx === 0 && sdy === 0) return { ok: false, error: "scroll requires dx or dy" };
|
|
15510
|
+
if (!await posted(opts.runner, { type: "scroll", x: px, y: py, dx: sdx, dy: sdy })) {
|
|
15511
|
+
await opts.runner.scroll(px, py, sdx, sdy);
|
|
15512
|
+
}
|
|
15513
|
+
return {
|
|
15514
|
+
ok: true,
|
|
15515
|
+
action,
|
|
15516
|
+
message: `Scrolled at ${px}, ${py} by ${sdx}, ${sdy}. Positive dx is right, positive dy is down.`
|
|
15517
|
+
};
|
|
15518
|
+
}
|
|
15519
|
+
return { ok: false, error: "action must be screenshot, click, type, key, or scroll" };
|
|
15520
|
+
} catch (err) {
|
|
15521
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
15522
|
+
return { ok: false, error: message };
|
|
15523
|
+
}
|
|
15524
|
+
}
|
|
15525
|
+
function formatComputerUseHint(enabled) {
|
|
15526
|
+
if (!enabled) {
|
|
15527
|
+
return "Computer use is off (Settings \u2192 Advanced). Say the visual pass was not seen.";
|
|
15528
|
+
}
|
|
15529
|
+
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.";
|
|
15530
|
+
}
|
|
15531
|
+
var import_node_child_process5, import_node_fs39, import_node_os19, import_node_path41, import_node_util, execFileAsync, COMPUTER_USE_OFF, COMPUTER_USE_DESCRIPTION, KEY_CODES, MODIFIERS, PNG_SIG, macosComputerUseRunner;
|
|
15532
|
+
var init_computer_use = __esm({
|
|
15533
|
+
"src/computer-use/computer-use.ts"() {
|
|
15534
|
+
"use strict";
|
|
15535
|
+
import_node_child_process5 = require("child_process");
|
|
15536
|
+
import_node_fs39 = require("fs");
|
|
15537
|
+
import_node_os19 = require("os");
|
|
15538
|
+
import_node_path41 = require("path");
|
|
15539
|
+
import_node_util = require("util");
|
|
15540
|
+
init_bridge();
|
|
15541
|
+
execFileAsync = (0, import_node_util.promisify)(import_node_child_process5.execFile);
|
|
15542
|
+
COMPUTER_USE_OFF = "Computer use is off. Turn it on in Settings \u2192 Advanced.";
|
|
15543
|
+
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. Clicks, typing, scrolling, and screenshots are posted by Sideboard after macOS allows Sideboard to control this Mac and record the screen. Do not drive an app you did not start for this test.";
|
|
15544
|
+
KEY_CODES = {
|
|
15545
|
+
return: 36,
|
|
15546
|
+
enter: 36,
|
|
15547
|
+
tab: 48,
|
|
15548
|
+
escape: 53,
|
|
15549
|
+
esc: 53,
|
|
15550
|
+
delete: 51,
|
|
15551
|
+
backspace: 51,
|
|
15552
|
+
forwarddelete: 117,
|
|
15553
|
+
left: 123,
|
|
15554
|
+
right: 124,
|
|
15555
|
+
down: 125,
|
|
15556
|
+
up: 126
|
|
15557
|
+
};
|
|
15558
|
+
MODIFIERS = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
|
|
15559
|
+
PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
15560
|
+
macosComputerUseRunner = {
|
|
15561
|
+
async screenshot(file) {
|
|
15562
|
+
const via = await fetchComputerUseScreenshot();
|
|
15563
|
+
if (via) {
|
|
15564
|
+
(0, import_node_fs39.writeFileSync)(file, via.png);
|
|
15565
|
+
const info = pngPointSize(via.png);
|
|
15566
|
+
return { ...info, scale: via.scale > 0 ? via.scale : info.scale };
|
|
15567
|
+
}
|
|
15568
|
+
await execFileAsync("screencapture", ["-x", "-m", file]);
|
|
15569
|
+
return pngPointSize((0, import_node_fs39.readFileSync)(file));
|
|
15570
|
+
},
|
|
15571
|
+
async runAppleScript(script) {
|
|
15572
|
+
await execFileAsync("osascript", ["-e", script]);
|
|
15573
|
+
},
|
|
15574
|
+
async scroll(x, y, dx, dy) {
|
|
15575
|
+
await execFileAsync("swift", ["-e", scrollWheelSwift(x, y, dx, dy)]);
|
|
15576
|
+
},
|
|
15577
|
+
postInput(event) {
|
|
15578
|
+
return postComputerUseBridge(event);
|
|
15579
|
+
}
|
|
15580
|
+
};
|
|
15581
|
+
}
|
|
15582
|
+
});
|
|
15583
|
+
|
|
15245
15584
|
// src/agent-rpc/client.ts
|
|
15246
15585
|
var import_ws;
|
|
15247
15586
|
var init_client = __esm({
|
|
@@ -15258,16 +15597,19 @@ var PILOT_TOOL_NAMES, PILOT_TOOL_DESCRIPTIONS;
|
|
|
15258
15597
|
var init_pilot_tools = __esm({
|
|
15259
15598
|
"src/agent-rpc/pilot-tools.ts"() {
|
|
15260
15599
|
"use strict";
|
|
15600
|
+
init_computer_use();
|
|
15261
15601
|
init_client();
|
|
15262
15602
|
PILOT_TOOL_NAMES = [
|
|
15263
15603
|
"present_artifact",
|
|
15264
15604
|
"wait_for_job",
|
|
15265
|
-
"stop_job"
|
|
15605
|
+
"stop_job",
|
|
15606
|
+
"computer_use"
|
|
15266
15607
|
];
|
|
15267
15608
|
PILOT_TOOL_DESCRIPTIONS = {
|
|
15268
15609
|
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
15610
|
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."
|
|
15611
|
+
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.",
|
|
15612
|
+
computer_use: COMPUTER_USE_DESCRIPTION
|
|
15271
15613
|
};
|
|
15272
15614
|
}
|
|
15273
15615
|
});
|
|
@@ -15286,11 +15628,11 @@ function entryDir2() {
|
|
|
15286
15628
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
15287
15629
|
if (cjsDir) return cjsDir;
|
|
15288
15630
|
try {
|
|
15289
|
-
return (0,
|
|
15631
|
+
return (0, import_node_path42.dirname)((0, import_node_url3.fileURLToPath)(import_meta6.url));
|
|
15290
15632
|
} catch {
|
|
15291
15633
|
try {
|
|
15292
15634
|
const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
|
|
15293
|
-
return (0,
|
|
15635
|
+
return (0, import_node_path42.dirname)(req.resolve("@sideboard-ai/core"));
|
|
15294
15636
|
} catch {
|
|
15295
15637
|
return process.cwd();
|
|
15296
15638
|
}
|
|
@@ -15299,20 +15641,20 @@ function entryDir2() {
|
|
|
15299
15641
|
function claudeRunnerPath() {
|
|
15300
15642
|
const packagedDir = packagedCursorRuntimeDir();
|
|
15301
15643
|
if (packagedDir) {
|
|
15302
|
-
const packaged = (0,
|
|
15303
|
-
if ((0,
|
|
15644
|
+
const packaged = (0, import_node_path42.join)(packagedDir, "core-dist", "agents", "claude-runner.js");
|
|
15645
|
+
if ((0, import_node_fs40.existsSync)(packaged)) return packaged;
|
|
15304
15646
|
}
|
|
15305
15647
|
const root = entryDir2();
|
|
15306
15648
|
const candidates = [
|
|
15307
|
-
(0,
|
|
15308
|
-
(0,
|
|
15309
|
-
(0,
|
|
15310
|
-
(0,
|
|
15311
|
-
(0,
|
|
15312
|
-
(0,
|
|
15649
|
+
(0, import_node_path42.join)(root, "agents", "claude-runner.js"),
|
|
15650
|
+
(0, import_node_path42.join)(root, "agents", "claude-runner.cjs"),
|
|
15651
|
+
(0, import_node_path42.join)(root, "dist", "agents", "claude-runner.js"),
|
|
15652
|
+
(0, import_node_path42.join)(root, "dist", "agents", "claude-runner.cjs"),
|
|
15653
|
+
(0, import_node_path42.join)(root, "claude-runner.ts"),
|
|
15654
|
+
(0, import_node_path42.join)(root, "src", "agents", "claude-runner.ts")
|
|
15313
15655
|
];
|
|
15314
15656
|
for (const candidate of candidates) {
|
|
15315
|
-
if ((0,
|
|
15657
|
+
if ((0, import_node_fs40.existsSync)(candidate)) return candidate;
|
|
15316
15658
|
}
|
|
15317
15659
|
return candidates[0];
|
|
15318
15660
|
}
|
|
@@ -15336,13 +15678,13 @@ async function buildClaudeRpcTurnCommand(req) {
|
|
|
15336
15678
|
}
|
|
15337
15679
|
};
|
|
15338
15680
|
}
|
|
15339
|
-
var
|
|
15681
|
+
var import_node_fs40, import_node_module3, import_node_path42, import_node_url3, import_meta6;
|
|
15340
15682
|
var init_claude_host = __esm({
|
|
15341
15683
|
"src/agents/claude-host.ts"() {
|
|
15342
15684
|
"use strict";
|
|
15343
|
-
|
|
15685
|
+
import_node_fs40 = require("fs");
|
|
15344
15686
|
import_node_module3 = require("module");
|
|
15345
|
-
|
|
15687
|
+
import_node_path42 = require("path");
|
|
15346
15688
|
import_node_url3 = require("url");
|
|
15347
15689
|
init_protocol2();
|
|
15348
15690
|
init_pilot_tools();
|
|
@@ -15434,11 +15776,11 @@ function issueAttachmentWorktreePath(repoPath) {
|
|
|
15434
15776
|
return raw || process.cwd();
|
|
15435
15777
|
}
|
|
15436
15778
|
function ensureIssueAttachmentsDir(worktreePath) {
|
|
15437
|
-
const dir = (0,
|
|
15438
|
-
(0,
|
|
15439
|
-
const gi = (0,
|
|
15440
|
-
if (!(0,
|
|
15441
|
-
(0,
|
|
15779
|
+
const dir = (0, import_node_path43.join)(worktreePath, ATTACHMENTS_DIR);
|
|
15780
|
+
(0, import_node_fs41.mkdirSync)(dir, { recursive: true });
|
|
15781
|
+
const gi = (0, import_node_path43.join)(dir, ".gitignore");
|
|
15782
|
+
if (!(0, import_node_fs41.existsSync)(gi)) {
|
|
15783
|
+
(0, import_node_fs41.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
|
|
15442
15784
|
}
|
|
15443
15785
|
return dir;
|
|
15444
15786
|
}
|
|
@@ -15468,7 +15810,7 @@ function looksLikeFileUrl(url) {
|
|
|
15468
15810
|
function filenameFromUrl(url, fallback = "attachment") {
|
|
15469
15811
|
try {
|
|
15470
15812
|
const parsed = new URL(url);
|
|
15471
|
-
const last = decodeURIComponent((0,
|
|
15813
|
+
const last = decodeURIComponent((0, import_node_path43.basename)(parsed.pathname)).replace(/[/\\]/g, "_");
|
|
15472
15814
|
if (last && last !== "/" && last !== ".") return last;
|
|
15473
15815
|
} catch {
|
|
15474
15816
|
}
|
|
@@ -15490,12 +15832,12 @@ function filenameFromContentDisposition(header) {
|
|
|
15490
15832
|
}
|
|
15491
15833
|
function uniqueAttachmentFileName(dir, originalName) {
|
|
15492
15834
|
const safe = originalName.replace(/[/\\]/g, "_").replace(/^\.+/, "") || "file";
|
|
15493
|
-
if (!(0,
|
|
15494
|
-
const ext = (0,
|
|
15835
|
+
if (!(0, import_node_fs41.existsSync)((0, import_node_path43.join)(dir, safe))) return safe;
|
|
15836
|
+
const ext = (0, import_node_path43.extname)(safe);
|
|
15495
15837
|
const stem = ext ? safe.slice(0, -ext.length) : safe;
|
|
15496
15838
|
for (let i = 1; i < 1e4; i++) {
|
|
15497
15839
|
const candidate = `${stem}-${i}${ext}`;
|
|
15498
|
-
if (!(0,
|
|
15840
|
+
if (!(0, import_node_fs41.existsSync)((0, import_node_path43.join)(dir, candidate))) return candidate;
|
|
15499
15841
|
}
|
|
15500
15842
|
return `${stem}-${(0, import_node_crypto10.randomUUID)()}${ext}`;
|
|
15501
15843
|
}
|
|
@@ -15543,7 +15885,7 @@ function mergeIssueAttachments(items) {
|
|
|
15543
15885
|
return out;
|
|
15544
15886
|
}
|
|
15545
15887
|
function extensionForContentType(contentType, name) {
|
|
15546
|
-
if ((0,
|
|
15888
|
+
if ((0, import_node_path43.extname)(name)) return name;
|
|
15547
15889
|
const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
|
|
15548
15890
|
const ext = EXT_BY_MIME[mime];
|
|
15549
15891
|
return ext ? `${name}${ext}` : name;
|
|
@@ -15595,7 +15937,7 @@ async function downloadAuthenticatedFile(opts) {
|
|
|
15595
15937
|
const dir = ensureIssueAttachmentsDir(opts.worktreePath);
|
|
15596
15938
|
const hinted = opts.name?.trim() || filenameFromContentDisposition(res.headers.get("content-disposition")) || filenameFromUrl(url);
|
|
15597
15939
|
const name = uniqueAttachmentFileName(dir, extensionForContentType(contentType, hinted));
|
|
15598
|
-
(0,
|
|
15940
|
+
(0, import_node_fs41.writeFileSync)((0, import_node_path43.join)(dir, name), buf);
|
|
15599
15941
|
return {
|
|
15600
15942
|
name,
|
|
15601
15943
|
path: `${ATTACHMENTS_DIR}/${name}`,
|
|
@@ -15603,12 +15945,12 @@ async function downloadAuthenticatedFile(opts) {
|
|
|
15603
15945
|
...contentType ? { contentType } : {}
|
|
15604
15946
|
};
|
|
15605
15947
|
}
|
|
15606
|
-
var
|
|
15948
|
+
var import_node_fs41, import_node_path43, import_node_crypto10, ISSUE_ATTACHMENT_MAX_BYTES, MARKDOWN_IMAGE_RE, MARKDOWN_LINK_RE, HTML_SRC_RE, BARE_URL_RE, EXT_BY_MIME;
|
|
15607
15949
|
var init_issue_attachments = __esm({
|
|
15608
15950
|
"src/integrations/issue-attachments.ts"() {
|
|
15609
15951
|
"use strict";
|
|
15610
|
-
|
|
15611
|
-
|
|
15952
|
+
import_node_fs41 = require("fs");
|
|
15953
|
+
import_node_path43 = require("path");
|
|
15612
15954
|
import_node_crypto10 = require("crypto");
|
|
15613
15955
|
init_fetch();
|
|
15614
15956
|
init_workspace_scratch();
|
|
@@ -17261,12 +17603,12 @@ function compactMetadataFromClaude(obj) {
|
|
|
17261
17603
|
const postTokens = typeof post === "number" && Number.isFinite(post) && post > 0 ? Math.round(post) : void 0;
|
|
17262
17604
|
return { trigger, postTokens };
|
|
17263
17605
|
}
|
|
17264
|
-
var
|
|
17606
|
+
var import_node_fs42, import_node_path44, CLAUDE_PROMPT_ARG_MAX, claudeAdapter;
|
|
17265
17607
|
var init_claude = __esm({
|
|
17266
17608
|
"src/agents/claude.ts"() {
|
|
17267
17609
|
"use strict";
|
|
17268
|
-
|
|
17269
|
-
|
|
17610
|
+
import_node_fs42 = require("fs");
|
|
17611
|
+
import_node_path44 = require("path");
|
|
17270
17612
|
init_run();
|
|
17271
17613
|
init_app_settings();
|
|
17272
17614
|
init_claude_mcp_status();
|
|
@@ -17286,7 +17628,7 @@ var init_claude = __esm({
|
|
|
17286
17628
|
async detect() {
|
|
17287
17629
|
const claude = resolveClaudeExecutable();
|
|
17288
17630
|
if (claude !== "claude") {
|
|
17289
|
-
if (!(0,
|
|
17631
|
+
if (!(0, import_node_fs42.existsSync)(claude)) {
|
|
17290
17632
|
return {
|
|
17291
17633
|
agent: "claude",
|
|
17292
17634
|
installed: false,
|
|
@@ -17444,7 +17786,7 @@ ${hint}` : hint;
|
|
|
17444
17786
|
cwd: thread.worktreePath,
|
|
17445
17787
|
stdin: useStdin ? `${promptText}
|
|
17446
17788
|
` : void 0,
|
|
17447
|
-
...mcpConfigPath ? { cleanupDirs: [(0,
|
|
17789
|
+
...mcpConfigPath ? { cleanupDirs: [(0, import_node_path44.dirname)(mcpConfigPath)] } : {},
|
|
17448
17790
|
// Nested Task/Agent thinking+text in stream-json (Claude Code 2.1.211+).
|
|
17449
17791
|
// Raise the -p background-agent wait so long TaskOutput polls are not
|
|
17450
17792
|
// abandoned at Claude Code’s 10-minute default.
|
|
@@ -17624,7 +17966,7 @@ async function listCodexModels() {
|
|
|
17624
17966
|
if (codex === "codex") {
|
|
17625
17967
|
const which = await run("which", ["codex"], { reject: false });
|
|
17626
17968
|
if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
|
|
17627
|
-
} else if (!(0,
|
|
17969
|
+
} else if (!(0, import_node_fs43.existsSync)(codex)) {
|
|
17628
17970
|
return FALLBACK_CODEX_MODELS;
|
|
17629
17971
|
}
|
|
17630
17972
|
const listed = await run(codex, ["debug", "models"], { reject: false });
|
|
@@ -17661,7 +18003,7 @@ function usageFromCodex(usage, asContext = false) {
|
|
|
17661
18003
|
return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
|
|
17662
18004
|
}
|
|
17663
18005
|
function codexHomeDir() {
|
|
17664
|
-
return process.env.CODEX_HOME?.trim() || (0,
|
|
18006
|
+
return process.env.CODEX_HOME?.trim() || (0, import_node_path45.join)((0, import_node_os20.homedir)(), ".codex");
|
|
17665
18007
|
}
|
|
17666
18008
|
function unwrapCodexMcpResult(result) {
|
|
17667
18009
|
if (result == null) return void 0;
|
|
@@ -17683,28 +18025,28 @@ function unwrapCodexMcpResult(result) {
|
|
|
17683
18025
|
return String(result);
|
|
17684
18026
|
}
|
|
17685
18027
|
}
|
|
17686
|
-
function
|
|
18028
|
+
function asRecord7(value) {
|
|
17687
18029
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
17688
18030
|
return value;
|
|
17689
18031
|
}
|
|
17690
18032
|
return void 0;
|
|
17691
18033
|
}
|
|
17692
18034
|
function codexLooksAuthenticated() {
|
|
17693
|
-
const authPath = (0,
|
|
17694
|
-
if (!(0,
|
|
18035
|
+
const authPath = (0, import_node_path45.join)(codexHomeDir(), "auth.json");
|
|
18036
|
+
if (!(0, import_node_fs43.existsSync)(authPath)) return false;
|
|
17695
18037
|
try {
|
|
17696
|
-
return (0,
|
|
18038
|
+
return (0, import_node_fs43.statSync)(authPath).size > 2;
|
|
17697
18039
|
} catch {
|
|
17698
18040
|
return false;
|
|
17699
18041
|
}
|
|
17700
18042
|
}
|
|
17701
|
-
var
|
|
18043
|
+
var import_node_fs43, import_node_os20, import_node_path45, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
|
|
17702
18044
|
var init_codex = __esm({
|
|
17703
18045
|
"src/agents/codex.ts"() {
|
|
17704
18046
|
"use strict";
|
|
17705
|
-
|
|
17706
|
-
|
|
17707
|
-
|
|
18047
|
+
import_node_fs43 = require("fs");
|
|
18048
|
+
import_node_os20 = require("os");
|
|
18049
|
+
import_node_path45 = require("path");
|
|
17708
18050
|
init_run();
|
|
17709
18051
|
init_app_settings();
|
|
17710
18052
|
init_global_workspace();
|
|
@@ -17733,7 +18075,7 @@ var init_codex = __esm({
|
|
|
17733
18075
|
async detect() {
|
|
17734
18076
|
const codex = resolveAgentExecutable("codex");
|
|
17735
18077
|
if (codex !== "codex") {
|
|
17736
|
-
if (!(0,
|
|
18078
|
+
if (!(0, import_node_fs43.existsSync)(codex)) {
|
|
17737
18079
|
return {
|
|
17738
18080
|
agent: "codex",
|
|
17739
18081
|
installed: false,
|
|
@@ -17765,7 +18107,7 @@ var init_codex = __esm({
|
|
|
17765
18107
|
authenticated,
|
|
17766
18108
|
linearMcp,
|
|
17767
18109
|
warnings,
|
|
17768
|
-
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${(0,
|
|
18110
|
+
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${(0, import_node_path45.join)(codexHomeDir(), "auth.json")})`
|
|
17769
18111
|
};
|
|
17770
18112
|
},
|
|
17771
18113
|
async buildTurn(thread, input) {
|
|
@@ -17873,7 +18215,7 @@ var init_codex = __esm({
|
|
|
17873
18215
|
}
|
|
17874
18216
|
if (itemType === "mcp_tool_call" && item.id && item.server && item.tool) {
|
|
17875
18217
|
const name = `mcp__${item.server}__${item.tool}`;
|
|
17876
|
-
const input =
|
|
18218
|
+
const input = asRecord7(item.arguments);
|
|
17877
18219
|
const events = [
|
|
17878
18220
|
{ type: "tool_use", id: item.id, name, input }
|
|
17879
18221
|
];
|
|
@@ -17997,18 +18339,18 @@ var init_codex = __esm({
|
|
|
17997
18339
|
// src/agents/cursor-sdk-resolve.ts
|
|
17998
18340
|
function thisModuleFile() {
|
|
17999
18341
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
18000
|
-
if (cjsDir) return (0,
|
|
18342
|
+
if (cjsDir) return (0, import_node_path46.join)(cjsDir, "cursor-sdk-resolve.js");
|
|
18001
18343
|
try {
|
|
18002
18344
|
return (0, import_node_url4.fileURLToPath)(import_meta7.url);
|
|
18003
18345
|
} catch {
|
|
18004
|
-
return (0,
|
|
18346
|
+
return (0, import_node_path46.join)(process.cwd(), "package.json");
|
|
18005
18347
|
}
|
|
18006
18348
|
}
|
|
18007
18349
|
function packageRootLooksLikeSdk(dir) {
|
|
18008
18350
|
try {
|
|
18009
|
-
const raw = (0,
|
|
18351
|
+
const raw = (0, import_node_fs44.readFileSync)((0, import_node_path46.join)(dir, "package.json"), "utf8");
|
|
18010
18352
|
const pkg = JSON.parse(raw);
|
|
18011
|
-
return pkg.name === "@cursor/sdk" && (0,
|
|
18353
|
+
return pkg.name === "@cursor/sdk" && (0, import_node_fs44.existsSync)(dir);
|
|
18012
18354
|
} catch {
|
|
18013
18355
|
return false;
|
|
18014
18356
|
}
|
|
@@ -18017,7 +18359,7 @@ function resolvedPackageRoot(fromFile) {
|
|
|
18017
18359
|
try {
|
|
18018
18360
|
const req = (0, import_node_module4.createRequire)(fromFile);
|
|
18019
18361
|
const pkgJson = req.resolve("@cursor/sdk/package.json");
|
|
18020
|
-
const root = (0,
|
|
18362
|
+
const root = (0, import_node_path46.dirname)(pkgJson);
|
|
18021
18363
|
return packageRootLooksLikeSdk(root) ? root : null;
|
|
18022
18364
|
} catch {
|
|
18023
18365
|
return null;
|
|
@@ -18031,10 +18373,10 @@ function resolveCursorSdkRoot(opts) {
|
|
|
18031
18373
|
}
|
|
18032
18374
|
const globalNm = npmGlobalNodeModules(env);
|
|
18033
18375
|
if (globalNm) {
|
|
18034
|
-
const globalRoot = (0,
|
|
18376
|
+
const globalRoot = (0, import_node_path46.join)(globalNm, "@cursor/sdk");
|
|
18035
18377
|
if (packageRootLooksLikeSdk(globalRoot)) return globalRoot;
|
|
18036
18378
|
}
|
|
18037
|
-
const cwdPkg = (0,
|
|
18379
|
+
const cwdPkg = (0, import_node_path46.join)(process.cwd(), "package.json");
|
|
18038
18380
|
return resolvedPackageRoot(thisModuleFile()) ?? resolvedPackageRoot(cwdPkg);
|
|
18039
18381
|
}
|
|
18040
18382
|
function isCursorSdkInstalled(opts) {
|
|
@@ -18050,13 +18392,13 @@ function exportTarget(value) {
|
|
|
18050
18392
|
}
|
|
18051
18393
|
function cursorSdkEsmEntry(root) {
|
|
18052
18394
|
try {
|
|
18053
|
-
const pkg = JSON.parse((0,
|
|
18395
|
+
const pkg = JSON.parse((0, import_node_fs44.readFileSync)((0, import_node_path46.join)(root, "package.json"), "utf8"));
|
|
18054
18396
|
const exp = pkg.exports;
|
|
18055
18397
|
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
18056
18398
|
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
18057
18399
|
if (!rel) return null;
|
|
18058
|
-
const entry = (0,
|
|
18059
|
-
return (0,
|
|
18400
|
+
const entry = (0, import_node_path46.join)(root, rel);
|
|
18401
|
+
return (0, import_node_fs44.existsSync)(entry) ? entry : null;
|
|
18060
18402
|
} catch {
|
|
18061
18403
|
return null;
|
|
18062
18404
|
}
|
|
@@ -18072,7 +18414,7 @@ async function importCursorSdk(opts) {
|
|
|
18072
18414
|
try {
|
|
18073
18415
|
let entry = cursorSdkEsmEntry(root);
|
|
18074
18416
|
if (!entry) {
|
|
18075
|
-
const req = (0, import_node_module4.createRequire)((0,
|
|
18417
|
+
const req = (0, import_node_module4.createRequire)((0, import_node_path46.join)(root, "package.json"));
|
|
18076
18418
|
entry = req.resolve("@cursor/sdk");
|
|
18077
18419
|
}
|
|
18078
18420
|
return unwrapCursorSdkModule(await import((0, import_node_url4.pathToFileURL)(entry).href));
|
|
@@ -18084,8 +18426,8 @@ function cursorSdkPlatformRipgrepPackage() {
|
|
|
18084
18426
|
return `@cursor/sdk-${process.platform}-${process.arch}`;
|
|
18085
18427
|
}
|
|
18086
18428
|
function nodeModulesDirForPackageRoot(packageRoot) {
|
|
18087
|
-
const parent = (0,
|
|
18088
|
-
return (0,
|
|
18429
|
+
const parent = (0, import_node_path46.dirname)(packageRoot);
|
|
18430
|
+
return (0, import_node_path46.basename)(parent).startsWith("@") ? (0, import_node_path46.dirname)(parent) : parent;
|
|
18089
18431
|
}
|
|
18090
18432
|
function cursorSdkRipgrepCandidate(opts) {
|
|
18091
18433
|
const root = resolveCursorSdkRoot(opts);
|
|
@@ -18093,18 +18435,18 @@ function cursorSdkRipgrepCandidate(opts) {
|
|
|
18093
18435
|
const nm = nodeModulesDirForPackageRoot(root);
|
|
18094
18436
|
const pkg = cursorSdkPlatformRipgrepPackage();
|
|
18095
18437
|
const bin = process.platform === "win32" ? "rg.exe" : "rg";
|
|
18096
|
-
const sibling = (0,
|
|
18097
|
-
if ((0,
|
|
18098
|
-
const nested = (0,
|
|
18099
|
-
return (0,
|
|
18438
|
+
const sibling = (0, import_node_path46.join)(nm, pkg, "bin", bin);
|
|
18439
|
+
if ((0, import_node_fs44.existsSync)(sibling)) return sibling;
|
|
18440
|
+
const nested = (0, import_node_path46.join)(root, "node_modules", pkg, "bin", bin);
|
|
18441
|
+
return (0, import_node_fs44.existsSync)(nested) ? nested : null;
|
|
18100
18442
|
}
|
|
18101
|
-
var
|
|
18443
|
+
var import_node_fs44, import_node_module4, import_node_path46, import_node_url4, import_meta7, CURSOR_SDK_INSTALL_HINT;
|
|
18102
18444
|
var init_cursor_sdk_resolve = __esm({
|
|
18103
18445
|
"src/agents/cursor-sdk-resolve.ts"() {
|
|
18104
18446
|
"use strict";
|
|
18105
|
-
|
|
18447
|
+
import_node_fs44 = require("fs");
|
|
18106
18448
|
import_node_module4 = require("module");
|
|
18107
|
-
|
|
18449
|
+
import_node_path46 = require("path");
|
|
18108
18450
|
import_node_url4 = require("url");
|
|
18109
18451
|
init_path();
|
|
18110
18452
|
import_meta7 = {};
|
|
@@ -18146,21 +18488,21 @@ function platformRipgrepPackage() {
|
|
|
18146
18488
|
}
|
|
18147
18489
|
function usableRipgrepPath(candidate) {
|
|
18148
18490
|
const raw = candidate?.trim();
|
|
18149
|
-
if (!raw || !(0,
|
|
18491
|
+
if (!raw || !(0, import_node_path47.isAbsolute)(raw)) return null;
|
|
18150
18492
|
const readable = nodeReadableScriptPath(raw);
|
|
18151
|
-
if (!(0,
|
|
18493
|
+
if (!(0, import_node_fs45.existsSync)(readable) || isAsarPath(readable)) return null;
|
|
18152
18494
|
return readable;
|
|
18153
18495
|
}
|
|
18154
18496
|
function walkForBundledRipgrep(startFile) {
|
|
18155
18497
|
if (!startFile) return null;
|
|
18156
18498
|
const pkg = platformRipgrepPackage();
|
|
18157
18499
|
const name = rgBinaryName();
|
|
18158
|
-
let dir = (0,
|
|
18159
|
-
const root = (0,
|
|
18500
|
+
let dir = (0, import_node_path47.dirname)((0, import_node_path47.resolve)(startFile));
|
|
18501
|
+
const root = (0, import_node_path47.parse)(dir).root;
|
|
18160
18502
|
while (dir !== root) {
|
|
18161
|
-
const hit = usableRipgrepPath((0,
|
|
18503
|
+
const hit = usableRipgrepPath((0, import_node_path47.join)(dir, "node_modules", pkg, "bin", name));
|
|
18162
18504
|
if (hit) return hit;
|
|
18163
|
-
const next = (0,
|
|
18505
|
+
const next = (0, import_node_path47.dirname)(dir);
|
|
18164
18506
|
if (next === dir) break;
|
|
18165
18507
|
dir = next;
|
|
18166
18508
|
}
|
|
@@ -18170,7 +18512,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
18170
18512
|
try {
|
|
18171
18513
|
const req = (0, import_node_module5.createRequire)(fromFile);
|
|
18172
18514
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
18173
|
-
return usableRipgrepPath((0,
|
|
18515
|
+
return usableRipgrepPath((0, import_node_path47.join)((0, import_node_path47.dirname)(pkgJson), "bin", rgBinaryName()));
|
|
18174
18516
|
} catch {
|
|
18175
18517
|
return null;
|
|
18176
18518
|
}
|
|
@@ -18192,13 +18534,13 @@ function cursorRipgrepEnv(opts) {
|
|
|
18192
18534
|
const path = resolveCursorRipgrepPath(opts);
|
|
18193
18535
|
return path ? { [RIPGREP_ENV]: path } : {};
|
|
18194
18536
|
}
|
|
18195
|
-
var
|
|
18537
|
+
var import_node_fs45, import_node_module5, import_node_path47, RIPGREP_ENV;
|
|
18196
18538
|
var init_cursor_ripgrep = __esm({
|
|
18197
18539
|
"src/agents/cursor-ripgrep.ts"() {
|
|
18198
18540
|
"use strict";
|
|
18199
|
-
|
|
18541
|
+
import_node_fs45 = require("fs");
|
|
18200
18542
|
import_node_module5 = require("module");
|
|
18201
|
-
|
|
18543
|
+
import_node_path47 = require("path");
|
|
18202
18544
|
init_cursor_sdk_resolve();
|
|
18203
18545
|
init_node_launch();
|
|
18204
18546
|
init_packaged_runtime();
|
|
@@ -18242,11 +18584,11 @@ function entryDir3() {
|
|
|
18242
18584
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
18243
18585
|
if (cjsDir) return cjsDir;
|
|
18244
18586
|
try {
|
|
18245
|
-
return (0,
|
|
18587
|
+
return (0, import_node_path48.dirname)((0, import_node_url5.fileURLToPath)(import_meta8.url));
|
|
18246
18588
|
} catch {
|
|
18247
18589
|
try {
|
|
18248
18590
|
const req = (0, import_node_module6.createRequire)(process.cwd() + "/");
|
|
18249
|
-
return (0,
|
|
18591
|
+
return (0, import_node_path48.dirname)(req.resolve("@sideboard-ai/core"));
|
|
18250
18592
|
} catch {
|
|
18251
18593
|
return process.cwd();
|
|
18252
18594
|
}
|
|
@@ -18257,27 +18599,27 @@ function cursorRunnerPath() {
|
|
|
18257
18599
|
if (packaged) return packaged;
|
|
18258
18600
|
const root = entryDir3();
|
|
18259
18601
|
const candidates = [
|
|
18260
|
-
(0,
|
|
18261
|
-
(0,
|
|
18602
|
+
(0, import_node_path48.join)(root, "agents", "cursor-runner.js"),
|
|
18603
|
+
(0, import_node_path48.join)(root, "agents", "cursor-runner.cjs"),
|
|
18262
18604
|
// If somehow resolved from package root instead of dist/
|
|
18263
|
-
(0,
|
|
18264
|
-
(0,
|
|
18605
|
+
(0, import_node_path48.join)(root, "dist", "agents", "cursor-runner.js"),
|
|
18606
|
+
(0, import_node_path48.join)(root, "dist", "agents", "cursor-runner.cjs"),
|
|
18265
18607
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
18266
|
-
(0,
|
|
18267
|
-
(0,
|
|
18608
|
+
(0, import_node_path48.join)(root, "cursor-runner.ts"),
|
|
18609
|
+
(0, import_node_path48.join)(root, "src", "agents", "cursor-runner.ts")
|
|
18268
18610
|
];
|
|
18269
18611
|
for (const candidate of candidates) {
|
|
18270
|
-
if ((0,
|
|
18612
|
+
if ((0, import_node_fs46.existsSync)(candidate)) return candidate;
|
|
18271
18613
|
}
|
|
18272
18614
|
return candidates[0];
|
|
18273
18615
|
}
|
|
18274
|
-
var
|
|
18616
|
+
var import_node_fs46, import_node_module6, import_node_path48, import_node_url5, import_meta8, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
|
|
18275
18617
|
var init_cursor = __esm({
|
|
18276
18618
|
"src/agents/cursor.ts"() {
|
|
18277
18619
|
"use strict";
|
|
18278
|
-
|
|
18620
|
+
import_node_fs46 = require("fs");
|
|
18279
18621
|
import_node_module6 = require("module");
|
|
18280
|
-
|
|
18622
|
+
import_node_path48 = require("path");
|
|
18281
18623
|
import_node_url5 = require("url");
|
|
18282
18624
|
init_run();
|
|
18283
18625
|
init_app_settings();
|
|
@@ -18404,26 +18746,26 @@ var init_cursor = __esm({
|
|
|
18404
18746
|
|
|
18405
18747
|
// src/agent-rpc/opencode-hook.ts
|
|
18406
18748
|
function writeOpencodeRpcPlugin() {
|
|
18407
|
-
const pluginDir = (0,
|
|
18408
|
-
(0,
|
|
18409
|
-
const pluginFile = (0,
|
|
18410
|
-
if ((0,
|
|
18749
|
+
const pluginDir = (0, import_node_path49.join)(appDataDir(), "agent-rpc", "opencode");
|
|
18750
|
+
(0, import_node_fs47.mkdirSync)(pluginDir, { recursive: true });
|
|
18751
|
+
const pluginFile = (0, import_node_path49.join)(pluginDir, "sideboard-rpc.js");
|
|
18752
|
+
if ((0, import_node_fs47.existsSync)(pluginFile)) {
|
|
18411
18753
|
try {
|
|
18412
|
-
if ((0,
|
|
18754
|
+
if ((0, import_node_fs47.readFileSync)(pluginFile, "utf8") === OPENCODE_PLUGIN_SOURCE) return pluginFile;
|
|
18413
18755
|
} catch {
|
|
18414
18756
|
}
|
|
18415
18757
|
}
|
|
18416
18758
|
const tmp = `${pluginFile}.${process.pid}.tmp`;
|
|
18417
|
-
(0,
|
|
18418
|
-
(0,
|
|
18759
|
+
(0, import_node_fs47.writeFileSync)(tmp, OPENCODE_PLUGIN_SOURCE);
|
|
18760
|
+
(0, import_node_fs47.renameSync)(tmp, pluginFile);
|
|
18419
18761
|
return pluginFile;
|
|
18420
18762
|
}
|
|
18421
|
-
var
|
|
18763
|
+
var import_node_fs47, import_node_path49, OPENCODE_PLUGIN_SOURCE;
|
|
18422
18764
|
var init_opencode_hook = __esm({
|
|
18423
18765
|
"src/agent-rpc/opencode-hook.ts"() {
|
|
18424
18766
|
"use strict";
|
|
18425
|
-
|
|
18426
|
-
|
|
18767
|
+
import_node_fs47 = require("fs");
|
|
18768
|
+
import_node_path49 = require("path");
|
|
18427
18769
|
init_paths();
|
|
18428
18770
|
init_pilot_tools();
|
|
18429
18771
|
init_protocol2();
|
|
@@ -18531,6 +18873,22 @@ export const SideboardRpc = async (ctx) => {
|
|
|
18531
18873
|
return job("job.stop", args)
|
|
18532
18874
|
},
|
|
18533
18875
|
}),
|
|
18876
|
+
computer_use: tool({
|
|
18877
|
+
description: ${JSON.stringify(PILOT_TOOL_DESCRIPTIONS.computer_use)},
|
|
18878
|
+
args: {
|
|
18879
|
+
action: tool.schema.enum(["screenshot", "click", "type", "key", "scroll"]),
|
|
18880
|
+
x: tool.schema.number().optional().describe("Screen x in points, not PNG pixels"),
|
|
18881
|
+
y: tool.schema.number().optional().describe("Screen y in points, not PNG pixels"),
|
|
18882
|
+
text: opt("Text to type"),
|
|
18883
|
+
key: opt("One key: return, tab, escape, arrows, delete, or one character"),
|
|
18884
|
+
modifiers: tool.schema.array(tool.schema.string()).optional().describe("command, shift, option, control"),
|
|
18885
|
+
dx: tool.schema.number().optional().describe("Horizontal scroll in points. Positive is right"),
|
|
18886
|
+
dy: tool.schema.number().optional().describe("Vertical scroll in points. Positive is down"),
|
|
18887
|
+
},
|
|
18888
|
+
async execute(args) {
|
|
18889
|
+
return job("computer.act", args)
|
|
18890
|
+
},
|
|
18891
|
+
}),
|
|
18534
18892
|
},
|
|
18535
18893
|
}
|
|
18536
18894
|
}
|
|
@@ -18581,7 +18939,7 @@ var init_opencode_host = __esm({
|
|
|
18581
18939
|
});
|
|
18582
18940
|
|
|
18583
18941
|
// src/agents/opencode.ts
|
|
18584
|
-
function
|
|
18942
|
+
function asRecord8(value) {
|
|
18585
18943
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
18586
18944
|
return value;
|
|
18587
18945
|
}
|
|
@@ -18626,7 +18984,7 @@ async function listOpencodeModels() {
|
|
|
18626
18984
|
if (opencode === "opencode") {
|
|
18627
18985
|
const which = await run("which", ["opencode"], { reject: false });
|
|
18628
18986
|
if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
|
|
18629
|
-
} else if (!(0,
|
|
18987
|
+
} else if (!(0, import_node_fs48.existsSync)(opencode)) {
|
|
18630
18988
|
return FALLBACK_OPENCODE_MODELS;
|
|
18631
18989
|
}
|
|
18632
18990
|
const listed = await run(opencode, ["models"], { reject: false });
|
|
@@ -18656,11 +19014,11 @@ function usageFromOpencode(tokens) {
|
|
|
18656
19014
|
cacheWriteTokens: tokens.cache?.write ? Number(tokens.cache.write) : void 0
|
|
18657
19015
|
};
|
|
18658
19016
|
}
|
|
18659
|
-
var
|
|
19017
|
+
var import_node_fs48, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
|
|
18660
19018
|
var init_opencode = __esm({
|
|
18661
19019
|
"src/agents/opencode.ts"() {
|
|
18662
19020
|
"use strict";
|
|
18663
|
-
|
|
19021
|
+
import_node_fs48 = require("fs");
|
|
18664
19022
|
init_run();
|
|
18665
19023
|
init_app_settings();
|
|
18666
19024
|
init_error_detail();
|
|
@@ -18686,7 +19044,7 @@ var init_opencode = __esm({
|
|
|
18686
19044
|
async detect() {
|
|
18687
19045
|
const opencode = resolveAgentExecutable("opencode");
|
|
18688
19046
|
if (opencode !== "opencode") {
|
|
18689
|
-
if (!(0,
|
|
19047
|
+
if (!(0, import_node_fs48.existsSync)(opencode)) {
|
|
18690
19048
|
return {
|
|
18691
19049
|
agent: "opencode",
|
|
18692
19050
|
installed: false,
|
|
@@ -18786,7 +19144,7 @@ var init_opencode = __esm({
|
|
|
18786
19144
|
const name = part?.tool ?? part?.name ?? obj.tool ?? obj.name ?? "tool";
|
|
18787
19145
|
const state = part?.state;
|
|
18788
19146
|
const input = (state?.input && typeof state.input === "object" ? state.input : void 0) ?? part?.input ?? obj.input;
|
|
18789
|
-
const metadata =
|
|
19147
|
+
const metadata = asRecord8(state?.metadata);
|
|
18790
19148
|
const id = opencodeToolId(
|
|
18791
19149
|
name,
|
|
18792
19150
|
part?.callID ?? part?.id ?? obj.id,
|
|
@@ -18821,7 +19179,7 @@ var init_opencode = __esm({
|
|
|
18821
19179
|
}
|
|
18822
19180
|
if (obj.type === "subtask_event") {
|
|
18823
19181
|
const parentId = str3(obj.childSessionID) ?? str3(obj.childSessionId);
|
|
18824
|
-
const part =
|
|
19182
|
+
const part = asRecord8(obj.part);
|
|
18825
19183
|
if (!parentId || !part) return null;
|
|
18826
19184
|
if (part.type === "text" && str3(part.text)) {
|
|
18827
19185
|
return withTaskParent(
|
|
@@ -18832,8 +19190,8 @@ var init_opencode = __esm({
|
|
|
18832
19190
|
if (part.type === "tool" || str3(part.tool)) {
|
|
18833
19191
|
const name = str3(part.tool) ?? str3(part.name) ?? "tool";
|
|
18834
19192
|
const id = str3(part.callID) ?? str3(part.id) ?? `${parentId}-${name}`;
|
|
18835
|
-
const state =
|
|
18836
|
-
const input =
|
|
19193
|
+
const state = asRecord8(part.state);
|
|
19194
|
+
const input = asRecord8(state?.input) ?? asRecord8(part.input);
|
|
18837
19195
|
const nested = [
|
|
18838
19196
|
withEventParentId({ type: "tool_use", id, name, input }, parentId)
|
|
18839
19197
|
];
|
|
@@ -19276,21 +19634,21 @@ async function resolveCliAfterNpmInstall(cliBin) {
|
|
|
19276
19634
|
if (prefix.exitCode !== 0) return null;
|
|
19277
19635
|
const root = prefix.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.startsWith("/")).pop();
|
|
19278
19636
|
if (!root) return null;
|
|
19279
|
-
const candidate = (0,
|
|
19280
|
-
if (!(0,
|
|
19637
|
+
const candidate = (0, import_node_path50.join)(root, "bin", cliBin);
|
|
19638
|
+
if (!(0, import_node_fs49.existsSync)(candidate)) return null;
|
|
19281
19639
|
try {
|
|
19282
|
-
(0,
|
|
19640
|
+
(0, import_node_fs49.chmodSync)(candidate, 493);
|
|
19283
19641
|
} catch {
|
|
19284
19642
|
}
|
|
19285
19643
|
enrichPathWithNpmGlobalBin();
|
|
19286
19644
|
return whichOnPath(cliBin);
|
|
19287
19645
|
}
|
|
19288
|
-
var
|
|
19646
|
+
var import_node_fs49, import_node_path50;
|
|
19289
19647
|
var init_install = __esm({
|
|
19290
19648
|
"src/agents/install.ts"() {
|
|
19291
19649
|
"use strict";
|
|
19292
|
-
|
|
19293
|
-
|
|
19650
|
+
import_node_fs49 = require("fs");
|
|
19651
|
+
import_node_path50 = require("path");
|
|
19294
19652
|
init_run();
|
|
19295
19653
|
init_app_settings();
|
|
19296
19654
|
init_acp_harness();
|
|
@@ -19400,7 +19758,7 @@ function isAgentHostEnvKey(key) {
|
|
|
19400
19758
|
}
|
|
19401
19759
|
function stripHostToolingPath(pathValue) {
|
|
19402
19760
|
if (!pathValue?.trim()) return "";
|
|
19403
|
-
return pathValue.split(
|
|
19761
|
+
return pathValue.split(import_node_path51.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path51.delimiter);
|
|
19404
19762
|
}
|
|
19405
19763
|
function sanitizeAgentHostEnv(env, cwd) {
|
|
19406
19764
|
for (const key of Object.keys(env)) {
|
|
@@ -19414,11 +19772,11 @@ function sanitizeAgentHostEnv(env, cwd) {
|
|
|
19414
19772
|
}
|
|
19415
19773
|
return env;
|
|
19416
19774
|
}
|
|
19417
|
-
var
|
|
19775
|
+
var import_node_path51, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
|
|
19418
19776
|
var init_agent_host_env = __esm({
|
|
19419
19777
|
"src/hook/agent-host-env.ts"() {
|
|
19420
19778
|
"use strict";
|
|
19421
|
-
|
|
19779
|
+
import_node_path51 = require("path");
|
|
19422
19780
|
DROP_EXACT = /* @__PURE__ */ new Set([
|
|
19423
19781
|
"NODE_PATH",
|
|
19424
19782
|
"NODE_ENV_ELECTRON_VITE",
|
|
@@ -19457,15 +19815,15 @@ var init_agent_host_env = __esm({
|
|
|
19457
19815
|
|
|
19458
19816
|
// src/hook/worktree-pkg-cache.ts
|
|
19459
19817
|
function worktreePkgCacheRoot(worktreePath) {
|
|
19460
|
-
return (0,
|
|
19818
|
+
return (0, import_node_path52.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
|
|
19461
19819
|
}
|
|
19462
19820
|
function worktreePkgCacheEnv(worktreePath) {
|
|
19463
19821
|
const root = worktreePkgCacheRoot(worktreePath);
|
|
19464
|
-
const store = (0,
|
|
19465
|
-
const pnpmCache = (0,
|
|
19466
|
-
const npmCache = (0,
|
|
19467
|
-
const nodeGyp = (0,
|
|
19468
|
-
const electron = (0,
|
|
19822
|
+
const store = (0, import_node_path52.join)(root, "pnpm-store");
|
|
19823
|
+
const pnpmCache = (0, import_node_path52.join)(root, "pnpm");
|
|
19824
|
+
const npmCache = (0, import_node_path52.join)(root, "npm");
|
|
19825
|
+
const nodeGyp = (0, import_node_path52.join)(root, "node-gyp");
|
|
19826
|
+
const electron = (0, import_node_path52.join)(root, "electron");
|
|
19469
19827
|
return {
|
|
19470
19828
|
npm_config_store_dir: store,
|
|
19471
19829
|
PNPM_STORE_DIR: store,
|
|
@@ -19487,8 +19845,8 @@ function fillGroup(env, keys, values) {
|
|
|
19487
19845
|
}
|
|
19488
19846
|
}
|
|
19489
19847
|
function ensureWorktreePkgCacheDirs(worktreePath) {
|
|
19490
|
-
if (!(0,
|
|
19491
|
-
(0,
|
|
19848
|
+
if (!(0, import_node_fs50.existsSync)(worktreePath)) return;
|
|
19849
|
+
(0, import_node_fs50.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
|
|
19492
19850
|
}
|
|
19493
19851
|
function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
19494
19852
|
const cwd = worktreePath.trim();
|
|
@@ -19501,12 +19859,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
|
|
|
19501
19859
|
fillGroup(env, ["electron_config_cache"], next);
|
|
19502
19860
|
ensureWorktreePkgCacheDirs(cwd);
|
|
19503
19861
|
}
|
|
19504
|
-
var
|
|
19862
|
+
var import_node_fs50, import_node_path52, WORKTREE_PKG_CACHE_REL;
|
|
19505
19863
|
var init_worktree_pkg_cache = __esm({
|
|
19506
19864
|
"src/hook/worktree-pkg-cache.ts"() {
|
|
19507
19865
|
"use strict";
|
|
19508
|
-
|
|
19509
|
-
|
|
19866
|
+
import_node_fs50 = require("fs");
|
|
19867
|
+
import_node_path52 = require("path");
|
|
19510
19868
|
WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
|
|
19511
19869
|
}
|
|
19512
19870
|
});
|
|
@@ -19766,7 +20124,7 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
19766
20124
|
}).finally(() => {
|
|
19767
20125
|
for (const dir of cmd.cleanupDirs ?? []) {
|
|
19768
20126
|
try {
|
|
19769
|
-
(0,
|
|
20127
|
+
(0, import_node_fs51.rmSync)(dir, { recursive: true, force: true });
|
|
19770
20128
|
} catch {
|
|
19771
20129
|
}
|
|
19772
20130
|
}
|
|
@@ -19800,11 +20158,11 @@ async function spawnAgentTurn(thread, input, onEvent) {
|
|
|
19800
20158
|
done
|
|
19801
20159
|
};
|
|
19802
20160
|
}
|
|
19803
|
-
var
|
|
20161
|
+
var import_node_fs51, import_node_readline2, import_execa3;
|
|
19804
20162
|
var init_spawn = __esm({
|
|
19805
20163
|
"src/agents/spawn.ts"() {
|
|
19806
20164
|
"use strict";
|
|
19807
|
-
|
|
20165
|
+
import_node_fs51 = require("fs");
|
|
19808
20166
|
import_node_readline2 = require("readline");
|
|
19809
20167
|
import_execa3 = require("execa");
|
|
19810
20168
|
init_worktree();
|
|
@@ -20079,6 +20437,9 @@ function expandCanonicalGitRequest(prompt, opts) {
|
|
|
20079
20437
|
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
20438
|
}
|
|
20081
20439
|
if (!expansion) return prompt;
|
|
20440
|
+
if (action === "merge" && (!base || isMainishPrBase(base)) && opts?.hasAnnounceSkill) {
|
|
20441
|
+
expansion = `${expansion} ${ANNOUNCE_AFTER_MERGE}`;
|
|
20442
|
+
}
|
|
20082
20443
|
if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
|
|
20083
20444
|
return `${trimmed}
|
|
20084
20445
|
|
|
@@ -20094,10 +20455,11 @@ function expansionPushes(action, prompt) {
|
|
|
20094
20455
|
if (action) return true;
|
|
20095
20456
|
return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
|
|
20096
20457
|
}
|
|
20097
|
-
var AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
|
|
20458
|
+
var ANNOUNCE_AFTER_MERGE, AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
|
|
20098
20459
|
var init_agent_git_actions = __esm({
|
|
20099
20460
|
"src/git/agent-git-actions.ts"() {
|
|
20100
20461
|
"use strict";
|
|
20462
|
+
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
20463
|
AGENT_GIT_ACTIONS = [
|
|
20102
20464
|
"commit-push",
|
|
20103
20465
|
"create-draft",
|
|
@@ -20114,6 +20476,20 @@ var init_agent_git_actions = __esm({
|
|
|
20114
20476
|
}
|
|
20115
20477
|
});
|
|
20116
20478
|
|
|
20479
|
+
// src/git/announce-skill.ts
|
|
20480
|
+
function announceSkillPresent(worktreePath) {
|
|
20481
|
+
const root = worktreePath?.trim();
|
|
20482
|
+
return !!root && (0, import_node_fs52.existsSync)((0, import_node_path53.join)(root, ".claude/skills/announce-on-x/SKILL.md"));
|
|
20483
|
+
}
|
|
20484
|
+
var import_node_fs52, import_node_path53;
|
|
20485
|
+
var init_announce_skill = __esm({
|
|
20486
|
+
"src/git/announce-skill.ts"() {
|
|
20487
|
+
"use strict";
|
|
20488
|
+
import_node_fs52 = require("fs");
|
|
20489
|
+
import_node_path53 = require("path");
|
|
20490
|
+
}
|
|
20491
|
+
});
|
|
20492
|
+
|
|
20117
20493
|
// src/git/pr-merge-archive.ts
|
|
20118
20494
|
function normalizePrState(state) {
|
|
20119
20495
|
return (state ?? "").trim().toUpperCase();
|
|
@@ -21053,21 +21429,21 @@ function shouldRefreshReviewRequestTemplate(content) {
|
|
|
21053
21429
|
return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
|
|
21054
21430
|
}
|
|
21055
21431
|
function readTextIfPresent(abs) {
|
|
21056
|
-
if (!(0,
|
|
21432
|
+
if (!(0, import_node_fs53.existsSync)(abs)) return null;
|
|
21057
21433
|
try {
|
|
21058
|
-
const content = (0,
|
|
21434
|
+
const content = (0, import_node_fs53.readFileSync)(abs, "utf8");
|
|
21059
21435
|
return content.trim() ? content : null;
|
|
21060
21436
|
} catch {
|
|
21061
21437
|
return null;
|
|
21062
21438
|
}
|
|
21063
21439
|
}
|
|
21064
21440
|
function readLocalGuidelines(worktreePath) {
|
|
21065
|
-
const localAbs = (0,
|
|
21441
|
+
const localAbs = (0, import_node_path54.join)(worktreePath, REVIEW_REQUEST_PATH);
|
|
21066
21442
|
const localContent = readTextIfPresent(localAbs);
|
|
21067
21443
|
if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
|
|
21068
21444
|
return { path: REVIEW_REQUEST_PATH, content: localContent };
|
|
21069
21445
|
}
|
|
21070
|
-
const legacyAbs = (0,
|
|
21446
|
+
const legacyAbs = (0, import_node_path54.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
|
|
21071
21447
|
const legacyContent = readTextIfPresent(legacyAbs);
|
|
21072
21448
|
if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
|
|
21073
21449
|
return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
|
|
@@ -21091,27 +21467,27 @@ function contextGuidelines(content, source) {
|
|
|
21091
21467
|
};
|
|
21092
21468
|
}
|
|
21093
21469
|
function writeContextGuidelines(worktreePath, content) {
|
|
21094
|
-
const abs = (0,
|
|
21095
|
-
(0,
|
|
21470
|
+
const abs = (0, import_node_path54.join)(worktreePath, CONTEXT_REVIEW_PATH);
|
|
21471
|
+
(0, import_node_fs53.mkdirSync)((0, import_node_path54.dirname)(abs), { recursive: true });
|
|
21096
21472
|
const body = content.endsWith("\n") ? content : `${content}
|
|
21097
21473
|
`;
|
|
21098
|
-
(0,
|
|
21474
|
+
(0, import_node_fs53.writeFileSync)(abs, body, "utf8");
|
|
21099
21475
|
return body;
|
|
21100
21476
|
}
|
|
21101
21477
|
function readSideboardReview(worktreePath, repoPath) {
|
|
21102
|
-
const fromWorktree = readTextIfPresent((0,
|
|
21478
|
+
const fromWorktree = readTextIfPresent((0, import_node_path54.join)(worktreePath, REPO_REVIEW_PATH));
|
|
21103
21479
|
if (fromWorktree) return fromWorktree;
|
|
21104
21480
|
const repo = repoPath?.replace(/\/+$/, "");
|
|
21105
21481
|
const wt = worktreePath.replace(/\/+$/, "");
|
|
21106
21482
|
if (!repo || repo === wt) return null;
|
|
21107
|
-
return readTextIfPresent((0,
|
|
21483
|
+
return readTextIfPresent((0, import_node_path54.join)(repo, REPO_REVIEW_PATH));
|
|
21108
21484
|
}
|
|
21109
21485
|
function ensureReviewGuidelinesFile(worktreePath, repoPath) {
|
|
21110
|
-
const skillContent = readTextIfPresent((0,
|
|
21486
|
+
const skillContent = readTextIfPresent((0, import_node_path54.join)(worktreePath, REVIEW_SKILL_PATH));
|
|
21111
21487
|
if (skillContent) {
|
|
21112
21488
|
return { ...skillGuidelines(skillContent, "skill"), wrote: false };
|
|
21113
21489
|
}
|
|
21114
|
-
const contextContent = readTextIfPresent((0,
|
|
21490
|
+
const contextContent = readTextIfPresent((0, import_node_path54.join)(worktreePath, CONTEXT_REVIEW_PATH));
|
|
21115
21491
|
if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
|
|
21116
21492
|
return { ...contextGuidelines(contextContent, "local"), wrote: false };
|
|
21117
21493
|
}
|
|
@@ -21187,13 +21563,13 @@ async function requestReview(threadRef, send) {
|
|
|
21187
21563
|
const started = await send(tab.id, REVIEW_REQUEST_PREFILL);
|
|
21188
21564
|
return { tab: started, from };
|
|
21189
21565
|
}
|
|
21190
|
-
var import_node_crypto13,
|
|
21566
|
+
var import_node_crypto13, import_node_fs53, import_node_path54, 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
21567
|
var init_request_review = __esm({
|
|
21192
21568
|
"src/review/request-review.ts"() {
|
|
21193
21569
|
"use strict";
|
|
21194
21570
|
import_node_crypto13 = require("crypto");
|
|
21195
|
-
|
|
21196
|
-
|
|
21571
|
+
import_node_fs53 = require("fs");
|
|
21572
|
+
import_node_path54 = require("path");
|
|
21197
21573
|
init_global_workspace();
|
|
21198
21574
|
init_chat_tabs();
|
|
21199
21575
|
init_thread_store();
|
|
@@ -21216,7 +21592,7 @@ var init_request_review = __esm({
|
|
|
21216
21592
|
|
|
21217
21593
|
// src/hook/worktree-run-ports.ts
|
|
21218
21594
|
function worktreeRunPortsPath(worktreePath) {
|
|
21219
|
-
return (0,
|
|
21595
|
+
return (0, import_node_path55.join)(worktreePath, RUN_PORTS_REL);
|
|
21220
21596
|
}
|
|
21221
21597
|
function isPort(value) {
|
|
21222
21598
|
return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= 65535;
|
|
@@ -21241,7 +21617,7 @@ function parseFile(raw) {
|
|
|
21241
21617
|
function readScripts(worktreePath) {
|
|
21242
21618
|
if (!worktreePath.trim()) return {};
|
|
21243
21619
|
try {
|
|
21244
|
-
const raw = (0,
|
|
21620
|
+
const raw = (0, import_node_fs54.readFileSync)(worktreeRunPortsPath(worktreePath), "utf8");
|
|
21245
21621
|
return parseFile(raw).scripts ?? {};
|
|
21246
21622
|
} catch {
|
|
21247
21623
|
return {};
|
|
@@ -21268,22 +21644,22 @@ function saveWorktreeRunPorts(worktreePath, scriptName, ports) {
|
|
|
21268
21644
|
const path = worktreeRunPortsPath(worktreePath);
|
|
21269
21645
|
let current = {};
|
|
21270
21646
|
try {
|
|
21271
|
-
current = parseFile((0,
|
|
21647
|
+
current = parseFile((0, import_node_fs54.readFileSync)(path, "utf8"));
|
|
21272
21648
|
} catch {
|
|
21273
21649
|
current = {};
|
|
21274
21650
|
}
|
|
21275
21651
|
const scripts = { ...current.scripts ?? {} };
|
|
21276
21652
|
scripts[scriptName] = cleaned;
|
|
21277
|
-
(0,
|
|
21278
|
-
(0,
|
|
21653
|
+
(0, import_node_fs54.mkdirSync)((0, import_node_path55.dirname)(path), { recursive: true });
|
|
21654
|
+
(0, import_node_fs54.writeFileSync)(path, `${JSON.stringify({ scripts }, null, 2)}
|
|
21279
21655
|
`, "utf8");
|
|
21280
21656
|
}
|
|
21281
|
-
var
|
|
21657
|
+
var import_node_fs54, import_node_path55, RUN_PORTS_REL;
|
|
21282
21658
|
var init_worktree_run_ports = __esm({
|
|
21283
21659
|
"src/hook/worktree-run-ports.ts"() {
|
|
21284
21660
|
"use strict";
|
|
21285
|
-
|
|
21286
|
-
|
|
21661
|
+
import_node_fs54 = require("fs");
|
|
21662
|
+
import_node_path55 = require("path");
|
|
21287
21663
|
RUN_PORTS_REL = ".context/.sideboard/run-ports.json";
|
|
21288
21664
|
}
|
|
21289
21665
|
});
|
|
@@ -21381,24 +21757,24 @@ function sanitizeDetachedJobId(id) {
|
|
|
21381
21757
|
return s;
|
|
21382
21758
|
}
|
|
21383
21759
|
function readIntFile(file) {
|
|
21384
|
-
if (!(0,
|
|
21385
|
-
const n = Number.parseInt((0,
|
|
21760
|
+
if (!(0, import_node_fs55.existsSync)(file)) return null;
|
|
21761
|
+
const n = Number.parseInt((0, import_node_fs55.readFileSync)(file, "utf8").trim(), 10);
|
|
21386
21762
|
return Number.isInteger(n) ? n : null;
|
|
21387
21763
|
}
|
|
21388
21764
|
function jobDir(root, id, legacy = false) {
|
|
21389
|
-
return (0,
|
|
21765
|
+
return (0, import_node_path56.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
|
|
21390
21766
|
}
|
|
21391
21767
|
function resolveJobDir(root, id) {
|
|
21392
21768
|
const modern = jobDir(root, id, false);
|
|
21393
|
-
if ((0,
|
|
21769
|
+
if ((0, import_node_fs55.existsSync)(modern)) return modern;
|
|
21394
21770
|
const legacy = jobDir(root, id, true);
|
|
21395
|
-
if ((0,
|
|
21771
|
+
if ((0, import_node_fs55.existsSync)(legacy)) return legacy;
|
|
21396
21772
|
return modern;
|
|
21397
21773
|
}
|
|
21398
21774
|
function listJobIdsIn(root, rel) {
|
|
21399
|
-
const dir = (0,
|
|
21400
|
-
if (!(0,
|
|
21401
|
-
return (0,
|
|
21775
|
+
const dir = (0, import_node_path56.join)(root, rel);
|
|
21776
|
+
if (!(0, import_node_fs55.existsSync)(dir)) return [];
|
|
21777
|
+
return (0, import_node_fs55.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
|
|
21402
21778
|
}
|
|
21403
21779
|
function listRunningDetachedJobs(worktreePath) {
|
|
21404
21780
|
const root = worktreePath.trim();
|
|
@@ -21410,7 +21786,7 @@ function listRunningDetachedJobs(worktreePath) {
|
|
|
21410
21786
|
const running = [];
|
|
21411
21787
|
for (const id of ids) {
|
|
21412
21788
|
const dir = resolveJobDir(root, id);
|
|
21413
|
-
const pid = readIntFile((0,
|
|
21789
|
+
const pid = readIntFile((0, import_node_path56.join)(dir, "pid"));
|
|
21414
21790
|
if (jobTreeAlive(pid)) running.push(id);
|
|
21415
21791
|
}
|
|
21416
21792
|
return running.sort();
|
|
@@ -21492,8 +21868,8 @@ function planJobContinue(opts) {
|
|
|
21492
21868
|
return { action: "none" };
|
|
21493
21869
|
}
|
|
21494
21870
|
function tailProgress(logFile, maxLines = 12) {
|
|
21495
|
-
if (!(0,
|
|
21496
|
-
const lines = (0,
|
|
21871
|
+
if (!(0, import_node_fs55.existsSync)(logFile)) return "(no log yet)";
|
|
21872
|
+
const lines = (0, import_node_fs55.readFileSync)(logFile, "utf8").split("\n");
|
|
21497
21873
|
return lines.slice(-maxLines).join("\n");
|
|
21498
21874
|
}
|
|
21499
21875
|
function lastProgressLine(progress) {
|
|
@@ -21501,8 +21877,8 @@ function lastProgressLine(progress) {
|
|
|
21501
21877
|
return last ? last.slice(0, 72) : void 0;
|
|
21502
21878
|
}
|
|
21503
21879
|
function readLogLines(file) {
|
|
21504
|
-
if (!(0,
|
|
21505
|
-
const lines = (0,
|
|
21880
|
+
if (!(0, import_node_fs55.existsSync)(file)) return [];
|
|
21881
|
+
const lines = (0, import_node_fs55.readFileSync)(file, "utf8").split("\n");
|
|
21506
21882
|
if (lines.length && lines[lines.length - 1] === "") lines.pop();
|
|
21507
21883
|
return lines;
|
|
21508
21884
|
}
|
|
@@ -21513,15 +21889,15 @@ function takeDelta(logFile, cursorFile) {
|
|
|
21513
21889
|
return { delta: capJobLogDelta(lines.slice(start).join("\n")), nextCursor: lines.length };
|
|
21514
21890
|
}
|
|
21515
21891
|
function snapshotJob(dir) {
|
|
21516
|
-
const pid = readIntFile((0,
|
|
21892
|
+
const pid = readIntFile((0, import_node_path56.join)(dir, "pid"));
|
|
21517
21893
|
const running = jobTreeAlive(pid);
|
|
21518
21894
|
return {
|
|
21519
21895
|
pid,
|
|
21520
21896
|
running,
|
|
21521
|
-
exitCode: readIntFile((0,
|
|
21522
|
-
log: (0,
|
|
21523
|
-
cursor: (0,
|
|
21524
|
-
progress: tailProgress((0,
|
|
21897
|
+
exitCode: readIntFile((0, import_node_path56.join)(dir, "exit")),
|
|
21898
|
+
log: (0, import_node_path56.join)(dir, "log"),
|
|
21899
|
+
cursor: (0, import_node_path56.join)(dir, "present.cursor"),
|
|
21900
|
+
progress: tailProgress((0, import_node_path56.join)(dir, "log"))
|
|
21525
21901
|
};
|
|
21526
21902
|
}
|
|
21527
21903
|
function toResult(id, snap, extra) {
|
|
@@ -21530,8 +21906,8 @@ function toResult(id, snap, extra) {
|
|
|
21530
21906
|
const stillRunning = snap.running && !ok;
|
|
21531
21907
|
const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
|
|
21532
21908
|
try {
|
|
21533
|
-
(0,
|
|
21534
|
-
(0,
|
|
21909
|
+
(0, import_node_fs55.mkdirSync)((0, import_node_path56.dirname)(snap.cursor), { recursive: true });
|
|
21910
|
+
(0, import_node_fs55.writeFileSync)(snap.cursor, `${nextCursor}
|
|
21535
21911
|
`);
|
|
21536
21912
|
} catch {
|
|
21537
21913
|
}
|
|
@@ -21560,7 +21936,7 @@ async function waitForDetachedJob(cwd, id, opts) {
|
|
|
21560
21936
|
const dir = resolveJobDir(root, jobId);
|
|
21561
21937
|
const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
|
|
21562
21938
|
const sleep = opts?.sleep ?? sleepMs;
|
|
21563
|
-
if (!(0,
|
|
21939
|
+
if (!(0, import_node_fs55.existsSync)(dir)) {
|
|
21564
21940
|
return {
|
|
21565
21941
|
stillRunning: false,
|
|
21566
21942
|
ok: false,
|
|
@@ -21606,10 +21982,10 @@ function killProcessTree(pid, signal) {
|
|
|
21606
21982
|
}
|
|
21607
21983
|
function appendJobLog(logFile, line) {
|
|
21608
21984
|
try {
|
|
21609
|
-
(0,
|
|
21985
|
+
(0, import_node_fs55.mkdirSync)((0, import_node_path56.dirname)(logFile), { recursive: true });
|
|
21610
21986
|
const body = line.endsWith("\n") ? line : `${line}
|
|
21611
21987
|
`;
|
|
21612
|
-
(0,
|
|
21988
|
+
(0, import_node_fs55.appendFileSync)(logFile, body);
|
|
21613
21989
|
} catch {
|
|
21614
21990
|
}
|
|
21615
21991
|
}
|
|
@@ -21619,7 +21995,7 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
21619
21995
|
const dir = resolveJobDir(root, jobId);
|
|
21620
21996
|
const sleep = opts?.sleep ?? sleepMs;
|
|
21621
21997
|
const why = opts?.reason?.trim() ?? "";
|
|
21622
|
-
if (!(0,
|
|
21998
|
+
if (!(0, import_node_fs55.existsSync)(dir)) {
|
|
21623
21999
|
return {
|
|
21624
22000
|
stillRunning: false,
|
|
21625
22001
|
ok: false,
|
|
@@ -21655,10 +22031,10 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
21655
22031
|
killProcessTree(targetPid, "SIGKILL");
|
|
21656
22032
|
await sleep(100);
|
|
21657
22033
|
}
|
|
21658
|
-
const exitFile = (0,
|
|
21659
|
-
if (!(0,
|
|
22034
|
+
const exitFile = (0, import_node_path56.join)(dir, "exit");
|
|
22035
|
+
if (!(0, import_node_fs55.existsSync)(exitFile)) {
|
|
21660
22036
|
try {
|
|
21661
|
-
(0,
|
|
22037
|
+
(0, import_node_fs55.writeFileSync)(exitFile, "1\n");
|
|
21662
22038
|
} catch {
|
|
21663
22039
|
}
|
|
21664
22040
|
}
|
|
@@ -21678,12 +22054,12 @@ async function stopDetachedJob(cwd, id, opts) {
|
|
|
21678
22054
|
hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
|
|
21679
22055
|
};
|
|
21680
22056
|
}
|
|
21681
|
-
var
|
|
22057
|
+
var import_node_fs55, import_node_path56, 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
22058
|
var init_wait_for_job = __esm({
|
|
21683
22059
|
"src/mcp/wait-for-job.ts"() {
|
|
21684
22060
|
"use strict";
|
|
21685
|
-
|
|
21686
|
-
|
|
22061
|
+
import_node_fs55 = require("fs");
|
|
22062
|
+
import_node_path56 = require("path");
|
|
21687
22063
|
init_workspace_scratch();
|
|
21688
22064
|
init_job_process();
|
|
21689
22065
|
init_wait_for_turn();
|
|
@@ -21960,9 +22336,9 @@ function matchSimpleGlob(pattern, name) {
|
|
|
21960
22336
|
return new RegExp(`^${escaped}$`).test(name);
|
|
21961
22337
|
}
|
|
21962
22338
|
function readWorktreeInclude(repoPath) {
|
|
21963
|
-
const path = (0,
|
|
21964
|
-
if (!(0,
|
|
21965
|
-
return (0,
|
|
22339
|
+
const path = (0, import_node_path57.join)(repoPath, ".worktreeinclude");
|
|
22340
|
+
if (!(0, import_node_fs56.existsSync)(path)) return [];
|
|
22341
|
+
return (0, import_node_fs56.readFileSync)(path, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
21966
22342
|
}
|
|
21967
22343
|
function resolveFilesToCopy(repoPath) {
|
|
21968
22344
|
const fromInclude = readWorktreeInclude(repoPath);
|
|
@@ -21972,10 +22348,10 @@ function resolveFilesToCopy(repoPath) {
|
|
|
21972
22348
|
if (settings?.fileIncludeGlobs?.length) {
|
|
21973
22349
|
const matched = [];
|
|
21974
22350
|
try {
|
|
21975
|
-
for (const entry of (0,
|
|
22351
|
+
for (const entry of (0, import_node_fs56.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
21976
22352
|
if (!entry.isFile()) continue;
|
|
21977
22353
|
for (const glob of settings.fileIncludeGlobs) {
|
|
21978
|
-
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0,
|
|
22354
|
+
if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path57.basename)(glob), entry.name)) {
|
|
21979
22355
|
matched.push(entry.name);
|
|
21980
22356
|
break;
|
|
21981
22357
|
}
|
|
@@ -21987,7 +22363,7 @@ function resolveFilesToCopy(repoPath) {
|
|
|
21987
22363
|
}
|
|
21988
22364
|
const defaults = [];
|
|
21989
22365
|
try {
|
|
21990
|
-
for (const entry of (0,
|
|
22366
|
+
for (const entry of (0, import_node_fs56.readdirSync)(repoPath, { withFileTypes: true })) {
|
|
21991
22367
|
if (entry.isFile() && entry.name.startsWith(".env")) {
|
|
21992
22368
|
defaults.push(entry.name);
|
|
21993
22369
|
}
|
|
@@ -22001,11 +22377,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
|
|
|
22001
22377
|
const patterns = resolveFilesToCopy(repoPath);
|
|
22002
22378
|
const copied = [];
|
|
22003
22379
|
for (const rel of patterns) {
|
|
22004
|
-
const src = (0,
|
|
22005
|
-
if (!(0,
|
|
22006
|
-
const dest = (0,
|
|
22007
|
-
(0,
|
|
22008
|
-
(0,
|
|
22380
|
+
const src = (0, import_node_path57.join)(repoPath, rel);
|
|
22381
|
+
if (!(0, import_node_fs56.existsSync)(src)) continue;
|
|
22382
|
+
const dest = (0, import_node_path57.join)(worktreePath, rel);
|
|
22383
|
+
(0, import_node_fs56.mkdirSync)((0, import_node_path57.dirname)(dest), { recursive: true });
|
|
22384
|
+
(0, import_node_fs56.copyFileSync)(src, dest);
|
|
22009
22385
|
copied.push(rel);
|
|
22010
22386
|
}
|
|
22011
22387
|
linkSharedDirectories(repoPath, worktreePath);
|
|
@@ -22018,19 +22394,19 @@ function linkSharedDirectories(repoPath, worktreePath) {
|
|
|
22018
22394
|
for (const rel of dirs) {
|
|
22019
22395
|
if (!isSafeRelativeDir(rel)) continue;
|
|
22020
22396
|
if (!isGitignored(repoPath, rel)) continue;
|
|
22021
|
-
const src = (0,
|
|
22397
|
+
const src = (0, import_node_path57.join)(repoPath, rel);
|
|
22022
22398
|
let srcStat;
|
|
22023
22399
|
try {
|
|
22024
|
-
srcStat = (0,
|
|
22400
|
+
srcStat = (0, import_node_fs56.lstatSync)(src);
|
|
22025
22401
|
} catch {
|
|
22026
22402
|
continue;
|
|
22027
22403
|
}
|
|
22028
22404
|
if (!srcStat.isDirectory()) continue;
|
|
22029
|
-
const dest = (0,
|
|
22030
|
-
if ((0,
|
|
22031
|
-
(0,
|
|
22405
|
+
const dest = (0, import_node_path57.join)(worktreePath, rel);
|
|
22406
|
+
if ((0, import_node_fs56.existsSync)(dest)) continue;
|
|
22407
|
+
(0, import_node_fs56.mkdirSync)((0, import_node_path57.dirname)(dest), { recursive: true });
|
|
22032
22408
|
try {
|
|
22033
|
-
(0,
|
|
22409
|
+
(0, import_node_fs56.symlinkSync)(src, dest);
|
|
22034
22410
|
} catch {
|
|
22035
22411
|
continue;
|
|
22036
22412
|
}
|
|
@@ -22040,19 +22416,19 @@ function linkSharedDirectories(repoPath, worktreePath) {
|
|
|
22040
22416
|
}
|
|
22041
22417
|
function samePath(a, b) {
|
|
22042
22418
|
try {
|
|
22043
|
-
return (0,
|
|
22419
|
+
return (0, import_node_fs56.realpathSync)(a) === (0, import_node_fs56.realpathSync)(b);
|
|
22044
22420
|
} catch {
|
|
22045
|
-
return (0,
|
|
22421
|
+
return (0, import_node_path57.resolve)(a) === (0, import_node_path57.resolve)(b);
|
|
22046
22422
|
}
|
|
22047
22423
|
}
|
|
22048
22424
|
function isSafeRelativeDir(rel) {
|
|
22049
|
-
if (!rel || (0,
|
|
22425
|
+
if (!rel || (0, import_node_path57.isAbsolute)(rel)) return false;
|
|
22050
22426
|
const parts = rel.split(/[\\/]/).filter(Boolean);
|
|
22051
22427
|
return parts.length > 0 && parts.every((part) => part !== "." && part !== "..");
|
|
22052
22428
|
}
|
|
22053
22429
|
function isGitignored(repoPath, rel) {
|
|
22054
22430
|
try {
|
|
22055
|
-
(0,
|
|
22431
|
+
(0, import_node_child_process6.execFileSync)("git", ["-C", repoPath, "check-ignore", "-q", "--", rel], { stdio: "ignore" });
|
|
22056
22432
|
return true;
|
|
22057
22433
|
} catch {
|
|
22058
22434
|
return false;
|
|
@@ -22088,7 +22464,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
|
|
|
22088
22464
|
const env = stripNestedElectronEnv({
|
|
22089
22465
|
...baseEnv ?? process.env
|
|
22090
22466
|
});
|
|
22091
|
-
const name = opts.workspaceName ?? (0,
|
|
22467
|
+
const name = opts.workspaceName ?? (0, import_node_path57.basename)(opts.worktreePath);
|
|
22092
22468
|
const ports = opts.ports ?? [];
|
|
22093
22469
|
const primary = ports[0];
|
|
22094
22470
|
env.SIDEBOARD_WORKSPACE_NAME = name;
|
|
@@ -22130,7 +22506,7 @@ function killableListenerPids(raw, selfPid = process.pid) {
|
|
|
22130
22506
|
}
|
|
22131
22507
|
function listUnixListenerPids(port, selfPid) {
|
|
22132
22508
|
try {
|
|
22133
|
-
const raw = (0,
|
|
22509
|
+
const raw = (0, import_node_child_process6.execFileSync)("lsof", [`-tiTCP:${port}`, "-sTCP:LISTEN"], {
|
|
22134
22510
|
encoding: "utf8",
|
|
22135
22511
|
stdio: ["ignore", "pipe", "ignore"],
|
|
22136
22512
|
timeout: 2e3
|
|
@@ -22143,7 +22519,7 @@ function listUnixListenerPids(port, selfPid) {
|
|
|
22143
22519
|
function listenerCwd(pid) {
|
|
22144
22520
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
22145
22521
|
try {
|
|
22146
|
-
const raw = (0,
|
|
22522
|
+
const raw = (0, import_node_child_process6.execFileSync)("lsof", ["-a", "-p", String(pid), "-d", "cwd", "-Fn"], {
|
|
22147
22523
|
encoding: "utf8",
|
|
22148
22524
|
stdio: ["ignore", "pipe", "ignore"],
|
|
22149
22525
|
timeout: 2e3
|
|
@@ -22157,20 +22533,20 @@ function listenerCwd(pid) {
|
|
|
22157
22533
|
}
|
|
22158
22534
|
function realpathOrResolve(path) {
|
|
22159
22535
|
try {
|
|
22160
|
-
return (0,
|
|
22536
|
+
return (0, import_node_fs56.realpathSync)(path);
|
|
22161
22537
|
} catch {
|
|
22162
|
-
return (0,
|
|
22538
|
+
return (0, import_node_path57.resolve)(path);
|
|
22163
22539
|
}
|
|
22164
22540
|
}
|
|
22165
22541
|
function isOtherWorktreeListenerCwd(cwd, worktreePath) {
|
|
22166
22542
|
const wt = realpathOrResolve(worktreePath);
|
|
22167
22543
|
const c = realpathOrResolve(cwd);
|
|
22168
|
-
if (c === wt || c.startsWith(wt +
|
|
22169
|
-
const parent = (0,
|
|
22170
|
-
const thisName = (0,
|
|
22544
|
+
if (c === wt || c.startsWith(wt + import_node_path57.sep)) return false;
|
|
22545
|
+
const parent = (0, import_node_path57.dirname)(wt);
|
|
22546
|
+
const thisName = (0, import_node_path57.basename)(wt);
|
|
22171
22547
|
if (!thisName || c === parent) return false;
|
|
22172
|
-
if (!c.startsWith(parent +
|
|
22173
|
-
const first = c.slice(parent.length + 1).split(
|
|
22548
|
+
if (!c.startsWith(parent + import_node_path57.sep)) return false;
|
|
22549
|
+
const first = c.slice(parent.length + 1).split(import_node_path57.sep)[0];
|
|
22174
22550
|
return Boolean(first) && first !== thisName;
|
|
22175
22551
|
}
|
|
22176
22552
|
function signalPid(pid, signal) {
|
|
@@ -22182,7 +22558,7 @@ function signalPid(pid, signal) {
|
|
|
22182
22558
|
function isThisWorktreeListenerCwd(cwd, worktreePath) {
|
|
22183
22559
|
const wt = realpathOrResolve(worktreePath);
|
|
22184
22560
|
const c = realpathOrResolve(cwd);
|
|
22185
|
-
return c === wt || c.startsWith(wt +
|
|
22561
|
+
return c === wt || c.startsWith(wt + import_node_path57.sep);
|
|
22186
22562
|
}
|
|
22187
22563
|
function killDetachedRunTree(pid, worktreePath) {
|
|
22188
22564
|
if (!Number.isFinite(pid) || pid <= 1 || pid === process.pid) return;
|
|
@@ -22204,7 +22580,7 @@ function killListenersOnPorts(ports) {
|
|
|
22204
22580
|
if (!Number.isFinite(port) || port <= 0) continue;
|
|
22205
22581
|
try {
|
|
22206
22582
|
if (process.platform === "win32") {
|
|
22207
|
-
(0,
|
|
22583
|
+
(0, import_node_child_process6.execFileSync)(
|
|
22208
22584
|
"powershell",
|
|
22209
22585
|
[
|
|
22210
22586
|
"-NoProfile",
|
|
@@ -22434,13 +22810,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
|
|
|
22434
22810
|
throw err;
|
|
22435
22811
|
}
|
|
22436
22812
|
}
|
|
22437
|
-
var
|
|
22813
|
+
var import_node_fs56, import_node_child_process6, import_node_path57, import_execa4, import_node_readline3, cachedLoginEnv;
|
|
22438
22814
|
var init_conductor = __esm({
|
|
22439
22815
|
"src/hook/conductor.ts"() {
|
|
22440
22816
|
"use strict";
|
|
22441
|
-
|
|
22442
|
-
|
|
22443
|
-
|
|
22817
|
+
import_node_fs56 = require("fs");
|
|
22818
|
+
import_node_child_process6 = require("child_process");
|
|
22819
|
+
import_node_path57 = require("path");
|
|
22444
22820
|
import_execa4 = require("execa");
|
|
22445
22821
|
import_node_readline3 = require("readline");
|
|
22446
22822
|
init_settings();
|
|
@@ -22493,7 +22869,7 @@ function materialize(mem) {
|
|
|
22493
22869
|
};
|
|
22494
22870
|
}
|
|
22495
22871
|
function setupLogPath(threadId) {
|
|
22496
|
-
return (0,
|
|
22872
|
+
return (0, import_node_path58.join)(threadsDir(), `${threadId}.setup.log.json`);
|
|
22497
22873
|
}
|
|
22498
22874
|
function setupLogKeyForWorktree(worktreePath) {
|
|
22499
22875
|
const norm = normalizeWorktreePath(worktreePath);
|
|
@@ -22511,7 +22887,7 @@ function persistNow(threadId) {
|
|
|
22511
22887
|
const mem = memory.get(threadId);
|
|
22512
22888
|
if (!mem) return;
|
|
22513
22889
|
try {
|
|
22514
|
-
(0,
|
|
22890
|
+
(0, import_node_fs57.writeFileSync)(
|
|
22515
22891
|
setupLogPath(threadId),
|
|
22516
22892
|
`${JSON.stringify(materialize(mem))}
|
|
22517
22893
|
`,
|
|
@@ -22532,9 +22908,9 @@ function schedulePersist(threadId) {
|
|
|
22532
22908
|
}
|
|
22533
22909
|
function loadFromDisk(threadId) {
|
|
22534
22910
|
const path = setupLogPath(threadId);
|
|
22535
|
-
if (!(0,
|
|
22911
|
+
if (!(0, import_node_fs57.existsSync)(path)) return null;
|
|
22536
22912
|
try {
|
|
22537
|
-
const raw = JSON.parse((0,
|
|
22913
|
+
const raw = JSON.parse((0, import_node_fs57.readFileSync)(path, "utf8"));
|
|
22538
22914
|
return {
|
|
22539
22915
|
output: typeof raw.output === "string" ? raw.output : "",
|
|
22540
22916
|
running: Boolean(raw.running),
|
|
@@ -22590,13 +22966,13 @@ function finishSetupLog(threadId, exitCode, source) {
|
|
|
22590
22966
|
persistNow(threadId);
|
|
22591
22967
|
return materialize(mem);
|
|
22592
22968
|
}
|
|
22593
|
-
var import_node_crypto14,
|
|
22969
|
+
var import_node_crypto14, import_node_fs57, import_node_path58, EMPTY, MAX_SETUP_LOG_CHARS, memory, persistTimers, PERSIST_DEBOUNCE_MS;
|
|
22594
22970
|
var init_setup_log = __esm({
|
|
22595
22971
|
"src/store/setup-log.ts"() {
|
|
22596
22972
|
"use strict";
|
|
22597
22973
|
import_node_crypto14 = require("crypto");
|
|
22598
|
-
|
|
22599
|
-
|
|
22974
|
+
import_node_fs57 = require("fs");
|
|
22975
|
+
import_node_path58 = require("path");
|
|
22600
22976
|
init_worktree_labels();
|
|
22601
22977
|
init_paths();
|
|
22602
22978
|
EMPTY = {
|
|
@@ -22641,7 +23017,7 @@ function safeScriptToken(scriptName) {
|
|
|
22641
23017
|
return token || "dev";
|
|
22642
23018
|
}
|
|
22643
23019
|
function runLogPath(key) {
|
|
22644
|
-
return (0,
|
|
23020
|
+
return (0, import_node_path59.join)(threadsDir(), `${key}.run.log.json`);
|
|
22645
23021
|
}
|
|
22646
23022
|
function runLogKeyForWorktree(worktreePath, scriptName) {
|
|
22647
23023
|
const norm = normalizeWorktreePath(worktreePath);
|
|
@@ -22669,7 +23045,7 @@ function persistNow2(key) {
|
|
|
22669
23045
|
const mem = memory2.get(key);
|
|
22670
23046
|
if (!mem) return;
|
|
22671
23047
|
try {
|
|
22672
|
-
(0,
|
|
23048
|
+
(0, import_node_fs58.writeFileSync)(runLogPath(key), `${JSON.stringify(materialize2(mem))}
|
|
22673
23049
|
`, "utf8");
|
|
22674
23050
|
} catch {
|
|
22675
23051
|
}
|
|
@@ -22686,9 +23062,9 @@ function schedulePersist2(key) {
|
|
|
22686
23062
|
}
|
|
22687
23063
|
function loadFromDisk2(key) {
|
|
22688
23064
|
const path = runLogPath(key);
|
|
22689
|
-
if (!(0,
|
|
23065
|
+
if (!(0, import_node_fs58.existsSync)(path)) return null;
|
|
22690
23066
|
try {
|
|
22691
|
-
const raw = JSON.parse((0,
|
|
23067
|
+
const raw = JSON.parse((0, import_node_fs58.readFileSync)(path, "utf8"));
|
|
22692
23068
|
return {
|
|
22693
23069
|
output: typeof raw.output === "string" ? raw.output : "",
|
|
22694
23070
|
running: Boolean(raw.running),
|
|
@@ -22746,13 +23122,13 @@ function finishRunLog(key, exitCode) {
|
|
|
22746
23122
|
function flushRunLog(key) {
|
|
22747
23123
|
persistNow2(key);
|
|
22748
23124
|
}
|
|
22749
|
-
var import_node_crypto15,
|
|
23125
|
+
var import_node_crypto15, import_node_fs58, import_node_path59, EMPTY2, MAX_RUN_LOG_CHARS, DEFAULT_RUN_LOG_TAIL_CHARS, memory2, persistTimers2, PERSIST_DEBOUNCE_MS2;
|
|
22750
23126
|
var init_run_log = __esm({
|
|
22751
23127
|
"src/store/run-log.ts"() {
|
|
22752
23128
|
"use strict";
|
|
22753
23129
|
import_node_crypto15 = require("crypto");
|
|
22754
|
-
|
|
22755
|
-
|
|
23130
|
+
import_node_fs58 = require("fs");
|
|
23131
|
+
import_node_path59 = require("path");
|
|
22756
23132
|
init_worktree_labels();
|
|
22757
23133
|
init_setup_log();
|
|
22758
23134
|
init_paths();
|
|
@@ -22781,9 +23157,9 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22781
23157
|
repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
|
|
22782
23158
|
);
|
|
22783
23159
|
const homeRoot = sideboardWorkspacesDir();
|
|
22784
|
-
if ((0,
|
|
23160
|
+
if ((0, import_node_fs59.existsSync)(homeRoot)) {
|
|
22785
23161
|
try {
|
|
22786
|
-
for (const entry of (0,
|
|
23162
|
+
for (const entry of (0, import_node_fs59.readdirSync)(homeRoot, { withFileTypes: true })) {
|
|
22787
23163
|
if (!entry.isDirectory()) continue;
|
|
22788
23164
|
void entry;
|
|
22789
23165
|
}
|
|
@@ -22793,7 +23169,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22793
23169
|
const orphans = [];
|
|
22794
23170
|
const seen = /* @__PURE__ */ new Set();
|
|
22795
23171
|
for (const repoPath of repos) {
|
|
22796
|
-
if (!repoPath || !(0,
|
|
23172
|
+
if (!repoPath || !(0, import_node_fs59.existsSync)(repoPath)) continue;
|
|
22797
23173
|
try {
|
|
22798
23174
|
const wts = await listWorktrees(repoPath);
|
|
22799
23175
|
for (const wt of wts) {
|
|
@@ -22804,7 +23180,7 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22804
23180
|
seen.add(path);
|
|
22805
23181
|
let mtimeMs = 0;
|
|
22806
23182
|
try {
|
|
22807
|
-
mtimeMs = (0,
|
|
23183
|
+
mtimeMs = (0, import_node_fs59.statSync)(path).mtimeMs;
|
|
22808
23184
|
} catch {
|
|
22809
23185
|
mtimeMs = 0;
|
|
22810
23186
|
}
|
|
@@ -22814,16 +23190,16 @@ async function findOrphanWorktrees(repoPaths) {
|
|
|
22814
23190
|
}
|
|
22815
23191
|
try {
|
|
22816
23192
|
const root = worktreesRoot(repoPath);
|
|
22817
|
-
if ((0,
|
|
22818
|
-
for (const entry of (0,
|
|
23193
|
+
if ((0, import_node_fs59.existsSync)(root)) {
|
|
23194
|
+
for (const entry of (0, import_node_fs59.readdirSync)(root, { withFileTypes: true })) {
|
|
22819
23195
|
if (!entry.isDirectory()) continue;
|
|
22820
|
-
const path = (0,
|
|
23196
|
+
const path = (0, import_node_path60.join)(root, entry.name).replace(/\/$/, "");
|
|
22821
23197
|
if (known.has(path) || seen.has(path)) continue;
|
|
22822
|
-
if (!(0,
|
|
23198
|
+
if (!(0, import_node_fs59.existsSync)((0, import_node_path60.join)(path, ".git"))) continue;
|
|
22823
23199
|
seen.add(path);
|
|
22824
23200
|
let mtimeMs = 0;
|
|
22825
23201
|
try {
|
|
22826
|
-
mtimeMs = (0,
|
|
23202
|
+
mtimeMs = (0, import_node_fs59.statSync)(path).mtimeMs;
|
|
22827
23203
|
} catch {
|
|
22828
23204
|
mtimeMs = Date.now();
|
|
22829
23205
|
}
|
|
@@ -22875,12 +23251,12 @@ function shouldRunWorktreeCleanup(settings = loadAppSettings()) {
|
|
|
22875
23251
|
const elapsed = Date.now() - Date.parse(last);
|
|
22876
23252
|
return elapsed >= intervalHours * 36e5;
|
|
22877
23253
|
}
|
|
22878
|
-
var
|
|
23254
|
+
var import_node_fs59, import_node_path60;
|
|
22879
23255
|
var init_orphan_cleanup = __esm({
|
|
22880
23256
|
"src/git/orphan-cleanup.ts"() {
|
|
22881
23257
|
"use strict";
|
|
22882
|
-
|
|
22883
|
-
|
|
23258
|
+
import_node_fs59 = require("fs");
|
|
23259
|
+
import_node_path60 = require("path");
|
|
22884
23260
|
init_worktree();
|
|
22885
23261
|
init_thread_store();
|
|
22886
23262
|
init_paths();
|
|
@@ -23056,12 +23432,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
23056
23432
|
if (!url) throw new Error("Clone URL is required");
|
|
23057
23433
|
let name = opts.name?.trim();
|
|
23058
23434
|
if (!name) {
|
|
23059
|
-
const leaf = (0,
|
|
23435
|
+
const leaf = (0, import_node_path61.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
|
|
23060
23436
|
name = leaf || "repo";
|
|
23061
23437
|
}
|
|
23062
23438
|
name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
|
|
23063
|
-
const dest = (0,
|
|
23064
|
-
if ((0,
|
|
23439
|
+
const dest = (0, import_node_path61.join)(sideboardReposDir(), name);
|
|
23440
|
+
if ((0, import_node_fs60.existsSync)(dest)) {
|
|
23065
23441
|
const repoPath2 = await resolveRepoRoot(dest);
|
|
23066
23442
|
const workspace2 = await addWorkspace(repoPath2);
|
|
23067
23443
|
return { repoPath: repoPath2, workspace: workspace2 };
|
|
@@ -23076,12 +23452,12 @@ async function cloneRepoIntoSideboard(opts) {
|
|
|
23076
23452
|
const workspace = await addWorkspace(repoPath);
|
|
23077
23453
|
return { repoPath, workspace };
|
|
23078
23454
|
}
|
|
23079
|
-
var
|
|
23455
|
+
var import_node_fs60, import_node_path61, import_execa6;
|
|
23080
23456
|
var init_clone_repo = __esm({
|
|
23081
23457
|
"src/git/clone-repo.ts"() {
|
|
23082
23458
|
"use strict";
|
|
23083
|
-
|
|
23084
|
-
|
|
23459
|
+
import_node_fs60 = require("fs");
|
|
23460
|
+
import_node_path61 = require("path");
|
|
23085
23461
|
import_execa6 = require("execa");
|
|
23086
23462
|
init_paths();
|
|
23087
23463
|
init_workspaces();
|
|
@@ -23101,11 +23477,11 @@ var init_thread = __esm({
|
|
|
23101
23477
|
|
|
23102
23478
|
// src/store/desktop-host.ts
|
|
23103
23479
|
function desktopHostPidPath() {
|
|
23104
|
-
return (0,
|
|
23480
|
+
return (0, import_node_path62.join)(appDataDir(), "desktop-host.pid");
|
|
23105
23481
|
}
|
|
23106
23482
|
function readDesktopHostPid() {
|
|
23107
23483
|
try {
|
|
23108
|
-
const pid = Number.parseInt((0,
|
|
23484
|
+
const pid = Number.parseInt((0, import_node_fs61.readFileSync)(desktopHostPidPath(), "utf8").trim(), 10);
|
|
23109
23485
|
if (!Number.isFinite(pid) || pid <= 0) return null;
|
|
23110
23486
|
return pid;
|
|
23111
23487
|
} catch {
|
|
@@ -23131,12 +23507,12 @@ function thisProcessShouldDrainAgentQueues() {
|
|
|
23131
23507
|
if (isThisProcessDesktopHost()) return true;
|
|
23132
23508
|
return !isDesktopHostAlive();
|
|
23133
23509
|
}
|
|
23134
|
-
var
|
|
23510
|
+
var import_node_fs61, import_node_path62;
|
|
23135
23511
|
var init_desktop_host = __esm({
|
|
23136
23512
|
"src/store/desktop-host.ts"() {
|
|
23137
23513
|
"use strict";
|
|
23138
|
-
|
|
23139
|
-
|
|
23514
|
+
import_node_fs61 = require("fs");
|
|
23515
|
+
import_node_path62 = require("path");
|
|
23140
23516
|
init_paths();
|
|
23141
23517
|
}
|
|
23142
23518
|
});
|
|
@@ -23176,12 +23552,12 @@ function denyPendingToolPermissions(threadId) {
|
|
|
23176
23552
|
const last = pending[pending.length - 1];
|
|
23177
23553
|
if (last) clearPrompt(threadId, last.id);
|
|
23178
23554
|
}
|
|
23179
|
-
var import_node_crypto16,
|
|
23555
|
+
var import_node_crypto16, import_node_path63, queues, publisher;
|
|
23180
23556
|
var init_tool_permission = __esm({
|
|
23181
23557
|
"src/agents/tool-permission.ts"() {
|
|
23182
23558
|
"use strict";
|
|
23183
23559
|
import_node_crypto16 = require("crypto");
|
|
23184
|
-
|
|
23560
|
+
import_node_path63 = require("path");
|
|
23185
23561
|
init_claude_mcp();
|
|
23186
23562
|
queues = /* @__PURE__ */ new Map();
|
|
23187
23563
|
publisher = null;
|
|
@@ -23238,7 +23614,7 @@ var init_agent_block_view = __esm({
|
|
|
23238
23614
|
});
|
|
23239
23615
|
|
|
23240
23616
|
// src/plan/plan-present.ts
|
|
23241
|
-
function
|
|
23617
|
+
function asRecord9(v) {
|
|
23242
23618
|
return v != null && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
23243
23619
|
}
|
|
23244
23620
|
function isPresentPlanToolName(name) {
|
|
@@ -23257,7 +23633,7 @@ function extractPresentedPlan(parts) {
|
|
|
23257
23633
|
for (let i = parts.length - 1; i >= 0; i--) {
|
|
23258
23634
|
const p = parts[i];
|
|
23259
23635
|
if (p.type !== "tool" || !isPresentPlanToolName(p.name)) continue;
|
|
23260
|
-
const input =
|
|
23636
|
+
const input = asRecord9(p.input) ?? {};
|
|
23261
23637
|
const content = typeof input.content === "string" ? input.content : typeof input.plan === "string" ? input.plan : typeof input.markdown === "string" ? input.markdown : "";
|
|
23262
23638
|
if (!content.trim()) continue;
|
|
23263
23639
|
const title = typeof input.title === "string" && input.title.trim() ? input.title.trim() : "Plan";
|
|
@@ -24987,7 +25363,7 @@ __export(abletime_rest_exports, {
|
|
|
24987
25363
|
looksLikeAbleTimeUlid: () => looksLikeAbleTimeUlid,
|
|
24988
25364
|
textFromAbleTimeDoc: () => textFromAbleTimeDoc
|
|
24989
25365
|
});
|
|
24990
|
-
function
|
|
25366
|
+
function asRecord10(value) {
|
|
24991
25367
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
24992
25368
|
}
|
|
24993
25369
|
function asString(value) {
|
|
@@ -24995,7 +25371,7 @@ function asString(value) {
|
|
|
24995
25371
|
}
|
|
24996
25372
|
function asList(value) {
|
|
24997
25373
|
if (Array.isArray(value)) return value;
|
|
24998
|
-
const record =
|
|
25374
|
+
const record = asRecord10(value);
|
|
24999
25375
|
if (!record) return [];
|
|
25000
25376
|
for (const key of ["data", "tasks", "projects", "users", "items", "results"]) {
|
|
25001
25377
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25012,12 +25388,12 @@ function ableTimeDocFromText(text8) {
|
|
|
25012
25388
|
}
|
|
25013
25389
|
function textFromAbleTimeDoc(value) {
|
|
25014
25390
|
if (typeof value === "string") return value.trim();
|
|
25015
|
-
const record =
|
|
25391
|
+
const record = asRecord10(value);
|
|
25016
25392
|
if (!record) return "";
|
|
25017
25393
|
if (typeof record.text === "string" && record.text.trim()) return record.text.trim();
|
|
25018
25394
|
const chunks = [];
|
|
25019
25395
|
const walk = (node) => {
|
|
25020
|
-
const rec =
|
|
25396
|
+
const rec = asRecord10(node);
|
|
25021
25397
|
if (!rec) return;
|
|
25022
25398
|
if (typeof rec.text === "string" && rec.text) chunks.push(rec.text);
|
|
25023
25399
|
if (Array.isArray(rec.content)) rec.content.forEach(walk);
|
|
@@ -25079,7 +25455,7 @@ async function restPages(path, opts, maxPages = 20) {
|
|
|
25079
25455
|
query: { ...opts.query, ...cursor ? { cursor } : {} }
|
|
25080
25456
|
});
|
|
25081
25457
|
items.push(...asList(raw));
|
|
25082
|
-
const page =
|
|
25458
|
+
const page = asRecord10(asRecord10(raw)?.page);
|
|
25083
25459
|
const next = page ? asString(page.nextCursor) : "";
|
|
25084
25460
|
if (!next) break;
|
|
25085
25461
|
cursor = next;
|
|
@@ -25087,7 +25463,7 @@ async function restPages(path, opts, maxPages = 20) {
|
|
|
25087
25463
|
return items;
|
|
25088
25464
|
}
|
|
25089
25465
|
function userDisplayName(raw) {
|
|
25090
|
-
const rec =
|
|
25466
|
+
const rec = asRecord10(raw);
|
|
25091
25467
|
if (!rec) return null;
|
|
25092
25468
|
const id = asString(rec.userId) || asString(rec.id);
|
|
25093
25469
|
const name = [asString(rec.firstName), asString(rec.lastName)].filter(Boolean).join(" ") || asString(rec.username) || asString(rec.email) || asString(rec.name);
|
|
@@ -25095,7 +25471,7 @@ function userDisplayName(raw) {
|
|
|
25095
25471
|
return { id: id || void 0, name };
|
|
25096
25472
|
}
|
|
25097
25473
|
function restTaskToRaw(raw, users) {
|
|
25098
|
-
const rec =
|
|
25474
|
+
const rec = asRecord10(raw);
|
|
25099
25475
|
if (!rec) return null;
|
|
25100
25476
|
const id = asString(rec.timeflowTaskId) || asString(rec.taskId) || asString(rec.id);
|
|
25101
25477
|
const identifier = asString(rec.taskRef) || asString(rec.reference) || id;
|
|
@@ -25103,7 +25479,7 @@ function restTaskToRaw(raw, users) {
|
|
|
25103
25479
|
if (!id && !identifier && !title) return null;
|
|
25104
25480
|
const assignee = users.get(asString(rec.assignedUserId));
|
|
25105
25481
|
const comments = asList(rec.comments).map((item) => {
|
|
25106
|
-
const comment =
|
|
25482
|
+
const comment = asRecord10(item) ?? {};
|
|
25107
25483
|
const user = userDisplayName(comment);
|
|
25108
25484
|
return {
|
|
25109
25485
|
id: asString(comment.commentId) || asString(comment.id),
|
|
@@ -25134,13 +25510,13 @@ function restTaskToRaw(raw, users) {
|
|
|
25134
25510
|
};
|
|
25135
25511
|
}
|
|
25136
25512
|
function restProjectToRaw(raw) {
|
|
25137
|
-
const rec =
|
|
25513
|
+
const rec = asRecord10(raw);
|
|
25138
25514
|
if (!rec) return null;
|
|
25139
25515
|
const id = asString(rec.projectId) || asString(rec.id);
|
|
25140
25516
|
const name = asString(rec.projectName) || asString(rec.name);
|
|
25141
25517
|
if (!id && !name) return null;
|
|
25142
25518
|
const categories = asList(rec.categories).map((item) => {
|
|
25143
|
-
const cat =
|
|
25519
|
+
const cat = asRecord10(item) ?? {};
|
|
25144
25520
|
return {
|
|
25145
25521
|
id: asString(cat.projectCategoryId) || asString(cat.categoryId) || asString(cat.id),
|
|
25146
25522
|
name: asString(cat.categoryName) || asString(cat.name)
|
|
@@ -25152,7 +25528,7 @@ async function listUsers(opts) {
|
|
|
25152
25528
|
const users = /* @__PURE__ */ new Map();
|
|
25153
25529
|
for (const item of await restPages("/users", opts).catch(() => [])) {
|
|
25154
25530
|
const user = userDisplayName(item);
|
|
25155
|
-
const rec =
|
|
25531
|
+
const rec = asRecord10(item);
|
|
25156
25532
|
const id = user?.id || (rec ? asString(rec.userId) : "");
|
|
25157
25533
|
if (user && id) users.set(id, user);
|
|
25158
25534
|
}
|
|
@@ -25278,10 +25654,10 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
|
|
|
25278
25654
|
if (!project) throw new Error("AbleTime has no projects to create a task in");
|
|
25279
25655
|
const categories = asList(project.categories);
|
|
25280
25656
|
const wantedCategory = firstStringArg(args, ["category_id", "categoryId", "category"]);
|
|
25281
|
-
const category = categories.map((item) =>
|
|
25657
|
+
const category = categories.map((item) => asRecord10(item)).find((item) => {
|
|
25282
25658
|
if (!item || !wantedCategory) return false;
|
|
25283
25659
|
return asString(item.id).toLowerCase() === wantedCategory.toLowerCase() || asString(item.name).toLowerCase() === wantedCategory.toLowerCase();
|
|
25284
|
-
}) ??
|
|
25660
|
+
}) ?? asRecord10(categories[0]);
|
|
25285
25661
|
const parentArg = firstStringArg(args, ["parent", "parent_id", "parentId", "related_task_id"]);
|
|
25286
25662
|
const parentTaskId = parentArg ? await resolveRestParentTaskId(parentArg, requestOpts) : void 0;
|
|
25287
25663
|
const created = await abletimeRestRequest("/tasks", {
|
|
@@ -25295,7 +25671,7 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
|
|
|
25295
25671
|
}
|
|
25296
25672
|
});
|
|
25297
25673
|
const state = firstStringArg(args, ["state"]);
|
|
25298
|
-
const createdId = asString(
|
|
25674
|
+
const createdId = asString(asRecord10(created)?.timeflowTaskId);
|
|
25299
25675
|
const description = asString(args.description);
|
|
25300
25676
|
if (createdId && description) {
|
|
25301
25677
|
await abletimeRestRequest(`/tasks/${encodeURIComponent(createdId)}`, {
|
|
@@ -25368,7 +25744,7 @@ async function callAbleTimeRestTool(name, args = {}, opts) {
|
|
|
25368
25744
|
method: "POST",
|
|
25369
25745
|
body: { content: ableTimeDocFromText(body) }
|
|
25370
25746
|
});
|
|
25371
|
-
const rec =
|
|
25747
|
+
const rec = asRecord10(created) ?? {};
|
|
25372
25748
|
return {
|
|
25373
25749
|
id: asString(rec.commentId) || void 0,
|
|
25374
25750
|
body: textFromAbleTimeDoc(rec.content) || body
|
|
@@ -25463,7 +25839,7 @@ function rewriteAbleTimeError(message) {
|
|
|
25463
25839
|
}
|
|
25464
25840
|
return message;
|
|
25465
25841
|
}
|
|
25466
|
-
function
|
|
25842
|
+
function asRecord11(value) {
|
|
25467
25843
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25468
25844
|
}
|
|
25469
25845
|
function parseSseJson(body) {
|
|
@@ -25485,12 +25861,12 @@ function parseSseJson(body) {
|
|
|
25485
25861
|
}
|
|
25486
25862
|
}
|
|
25487
25863
|
function unwrapToolResult(result) {
|
|
25488
|
-
const record =
|
|
25864
|
+
const record = asRecord11(result);
|
|
25489
25865
|
if (!record) return result;
|
|
25490
25866
|
const content = record.content;
|
|
25491
25867
|
if (Array.isArray(content)) {
|
|
25492
25868
|
const texts = content.map((part) => {
|
|
25493
|
-
const item =
|
|
25869
|
+
const item = asRecord11(part);
|
|
25494
25870
|
if (!item) return "";
|
|
25495
25871
|
return typeof item.text === "string" ? item.text : "";
|
|
25496
25872
|
}).filter(Boolean);
|
|
@@ -25512,7 +25888,7 @@ function unwrapToolResult(result) {
|
|
|
25512
25888
|
return result;
|
|
25513
25889
|
}
|
|
25514
25890
|
function textsFromUnknown(value) {
|
|
25515
|
-
const record =
|
|
25891
|
+
const record = asRecord11(value);
|
|
25516
25892
|
if (!record) return "";
|
|
25517
25893
|
if (typeof record.message === "string") return record.message;
|
|
25518
25894
|
if (typeof record.error === "string") return record.error;
|
|
@@ -25559,7 +25935,7 @@ async function abletimeMcpRequest(method, params, opts) {
|
|
|
25559
25935
|
return parseSseJson(body);
|
|
25560
25936
|
}
|
|
25561
25937
|
})();
|
|
25562
|
-
const rpc =
|
|
25938
|
+
const rpc = asRecord11(parsed);
|
|
25563
25939
|
if (rpc?.error) {
|
|
25564
25940
|
const detail = typeof rpc.error.message === "string" && rpc.error.message.trim() ? rpc.error.message : `AbleTime MCP error ${rpc.error.code ?? ""}`.trim();
|
|
25565
25941
|
throw new Error(rewriteAbleTimeError(detail));
|
|
@@ -25646,7 +26022,7 @@ var init_abletime_mcp = __esm({
|
|
|
25646
26022
|
});
|
|
25647
26023
|
|
|
25648
26024
|
// src/integrations/abletime-attachments.ts
|
|
25649
|
-
function
|
|
26025
|
+
function asRecord12(value) {
|
|
25650
26026
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25651
26027
|
}
|
|
25652
26028
|
function asString2(value) {
|
|
@@ -25654,7 +26030,7 @@ function asString2(value) {
|
|
|
25654
26030
|
}
|
|
25655
26031
|
function asList2(value) {
|
|
25656
26032
|
if (Array.isArray(value)) return value;
|
|
25657
|
-
const record =
|
|
26033
|
+
const record = asRecord12(value);
|
|
25658
26034
|
if (!record) return [];
|
|
25659
26035
|
for (const key of ["data", "tasks", "projects", "items", "results", "nodes"]) {
|
|
25660
26036
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25673,9 +26049,9 @@ function filesFromAbleTimeDoc(value) {
|
|
|
25673
26049
|
const out = [];
|
|
25674
26050
|
const seen = /* @__PURE__ */ new Set();
|
|
25675
26051
|
const walk = (node) => {
|
|
25676
|
-
const rec =
|
|
26052
|
+
const rec = asRecord12(node);
|
|
25677
26053
|
if (!rec) return;
|
|
25678
|
-
const attrs =
|
|
26054
|
+
const attrs = asRecord12(rec.attrs) ?? rec;
|
|
25679
26055
|
const url = asString2(attrs.src) || asString2(attrs.href) || asString2(attrs.url) || asString2(attrs.fileUrl) || asString2(attrs.downloadUrl);
|
|
25680
26056
|
if (url && !seen.has(url)) {
|
|
25681
26057
|
seen.add(url);
|
|
@@ -25693,7 +26069,7 @@ function filesFromAbleTimeDoc(value) {
|
|
|
25693
26069
|
function listedAbleTimeFiles(raw) {
|
|
25694
26070
|
const out = [];
|
|
25695
26071
|
for (const item of asList2(raw)) {
|
|
25696
|
-
const rec =
|
|
26072
|
+
const rec = asRecord12(item);
|
|
25697
26073
|
if (!rec) continue;
|
|
25698
26074
|
const url = firstString(rec, ["url", "href", "src", "fileUrl", "downloadUrl", "permalink"]);
|
|
25699
26075
|
if (!url) continue;
|
|
@@ -25713,7 +26089,7 @@ function mapAbleTimeAttachments(record) {
|
|
|
25713
26089
|
...filesFromAbleTimeDoc(record.description),
|
|
25714
26090
|
...filesFromAbleTimeDoc(record.content),
|
|
25715
26091
|
...asList2(record.comments).flatMap((item) => {
|
|
25716
|
-
const rec =
|
|
26092
|
+
const rec = asRecord12(item);
|
|
25717
26093
|
return rec ? filesFromAbleTimeDoc(rec.content ?? rec.body) : [];
|
|
25718
26094
|
})
|
|
25719
26095
|
].map((file) => ({
|
|
@@ -25755,7 +26131,7 @@ async function resolveAbleTimeAttachmentUrl(id, opts) {
|
|
|
25755
26131
|
const json = await res.json().catch(() => null);
|
|
25756
26132
|
const rec = json && typeof json === "object" && !Array.isArray(json) ? json.data && typeof json.data === "object" ? json.data : json : null;
|
|
25757
26133
|
if (!rec) continue;
|
|
25758
|
-
const url = firstString(rec, ["url", "href", "src", "fileUrl", "downloadUrl"]) || firstString(
|
|
26134
|
+
const url = firstString(rec, ["url", "href", "src", "fileUrl", "downloadUrl"]) || firstString(asRecord12(rec.file), ["url", "href"]);
|
|
25759
26135
|
if (url) {
|
|
25760
26136
|
return {
|
|
25761
26137
|
url,
|
|
@@ -25797,7 +26173,7 @@ var init_abletime_attachments = __esm({
|
|
|
25797
26173
|
});
|
|
25798
26174
|
|
|
25799
26175
|
// src/integrations/abletime-projects.ts
|
|
25800
|
-
function
|
|
26176
|
+
function asRecord13(value) {
|
|
25801
26177
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25802
26178
|
}
|
|
25803
26179
|
function firstString2(record, keys) {
|
|
@@ -25810,7 +26186,7 @@ function firstString2(record, keys) {
|
|
|
25810
26186
|
}
|
|
25811
26187
|
function asList3(value) {
|
|
25812
26188
|
if (Array.isArray(value)) return value;
|
|
25813
|
-
const record =
|
|
26189
|
+
const record = asRecord13(value);
|
|
25814
26190
|
if (!record) return [];
|
|
25815
26191
|
for (const key of ["data", "tasks", "projects", "items", "results", "nodes"]) {
|
|
25816
26192
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25818,7 +26194,7 @@ function asList3(value) {
|
|
|
25818
26194
|
return [];
|
|
25819
26195
|
}
|
|
25820
26196
|
function ableTimeProjectFields(nested) {
|
|
25821
|
-
const projectRecord =
|
|
26197
|
+
const projectRecord = asRecord13(nested.project);
|
|
25822
26198
|
const projectId = firstString2(nested, ["project_id", "projectId"]) || firstString2(projectRecord, ["id"]) || void 0;
|
|
25823
26199
|
const projectName = firstString2(nested, ["project_name", "projectName"]) || firstString2(projectRecord, ["name", "title"]) || void 0;
|
|
25824
26200
|
if (!projectId && !projectName) return {};
|
|
@@ -25831,13 +26207,13 @@ function ableTimeProjectFields(nested) {
|
|
|
25831
26207
|
};
|
|
25832
26208
|
}
|
|
25833
26209
|
function mapAbleTimeProject(raw) {
|
|
25834
|
-
const record =
|
|
26210
|
+
const record = asRecord13(raw);
|
|
25835
26211
|
if (!record) return null;
|
|
25836
26212
|
const id = firstString2(record, ["id", "project_id", "projectId"]);
|
|
25837
26213
|
const name = firstString2(record, ["name", "title", "projectName"]);
|
|
25838
26214
|
if (!id && !name) return null;
|
|
25839
26215
|
const categories = asList3(record.categories ?? record.category).map((item) => {
|
|
25840
|
-
const rec =
|
|
26216
|
+
const rec = asRecord13(item);
|
|
25841
26217
|
if (!rec) return null;
|
|
25842
26218
|
const categoryId = firstString2(rec, ["id", "category_id", "projectCategoryId", "categoryId"]);
|
|
25843
26219
|
const categoryName = firstString2(rec, ["name", "title", "categoryName"]);
|
|
@@ -25874,7 +26250,7 @@ __export(abletime_exports, {
|
|
|
25874
26250
|
updateAbleTimeTask: () => updateAbleTimeTask,
|
|
25875
26251
|
verifyAbleTimeConnection: () => verifyAbleTimeConnection
|
|
25876
26252
|
});
|
|
25877
|
-
function
|
|
26253
|
+
function asRecord14(value) {
|
|
25878
26254
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
25879
26255
|
}
|
|
25880
26256
|
function asString3(value) {
|
|
@@ -25891,14 +26267,14 @@ function firstString3(record, keys) {
|
|
|
25891
26267
|
function firstRecord(record, keys) {
|
|
25892
26268
|
if (!record) return null;
|
|
25893
26269
|
for (const key of keys) {
|
|
25894
|
-
const value =
|
|
26270
|
+
const value = asRecord14(record[key]);
|
|
25895
26271
|
if (value) return value;
|
|
25896
26272
|
}
|
|
25897
26273
|
return null;
|
|
25898
26274
|
}
|
|
25899
26275
|
function asList4(value) {
|
|
25900
26276
|
if (Array.isArray(value)) return value;
|
|
25901
|
-
const record =
|
|
26277
|
+
const record = asRecord14(value);
|
|
25902
26278
|
if (!record) return [];
|
|
25903
26279
|
for (const key of ["data", "tasks", "projects", "items", "results", "nodes"]) {
|
|
25904
26280
|
if (Array.isArray(record[key])) return record[key];
|
|
@@ -25910,18 +26286,18 @@ function labelsOf(record) {
|
|
|
25910
26286
|
if (!Array.isArray(raw)) return [];
|
|
25911
26287
|
return raw.map((item) => {
|
|
25912
26288
|
if (typeof item === "string") return item.trim();
|
|
25913
|
-
const rec =
|
|
26289
|
+
const rec = asRecord14(item);
|
|
25914
26290
|
return rec ? firstString3(rec, ["name", "title", "label"]) : "";
|
|
25915
26291
|
}).filter(Boolean);
|
|
25916
26292
|
}
|
|
25917
26293
|
function commentsOf(record) {
|
|
25918
26294
|
const out = [];
|
|
25919
26295
|
for (const item of asList4(record.comments ?? record.notes ?? record.discussion)) {
|
|
25920
|
-
const rec =
|
|
26296
|
+
const rec = asRecord14(item);
|
|
25921
26297
|
if (!rec) continue;
|
|
25922
26298
|
const body = firstString3(rec, ["body", "text", "comment", "message", "contentSanitized"]) || textFromAbleTimeDoc(rec.content);
|
|
25923
26299
|
if (!body) continue;
|
|
25924
|
-
const user = firstString3(
|
|
26300
|
+
const user = firstString3(asRecord14(rec.user) ?? asRecord14(rec.author), ["name", "display_name", "username"]) || firstString3(rec, ["user_name", "author", "username"]);
|
|
25925
26301
|
const id = firstString3(rec, ["id", "comment_id", "commentId"]);
|
|
25926
26302
|
const url = firstString3(rec, ["url", "permalink"]);
|
|
25927
26303
|
const createdAt = firstString3(rec, ["created_at", "createdAt", "created"]);
|
|
@@ -25948,7 +26324,7 @@ function taskUrl(task, host) {
|
|
|
25948
26324
|
return `${base}/tasks/${slug}`;
|
|
25949
26325
|
}
|
|
25950
26326
|
function mapAbleTimeTask(raw, host) {
|
|
25951
|
-
const record =
|
|
26327
|
+
const record = asRecord14(raw);
|
|
25952
26328
|
if (!record) return null;
|
|
25953
26329
|
const nested = firstRecord(record, ["task", "data"]) ?? record;
|
|
25954
26330
|
const id = firstString3(nested, ["id", "task_id", "taskId", "timeflowTaskId"]);
|
|
@@ -25966,7 +26342,7 @@ function mapAbleTimeTask(raw, host) {
|
|
|
25966
26342
|
description: firstString3(nested, ["description", "body", "details", "descriptionSanitized"]) || textFromAbleTimeDoc(nested.description) || void 0,
|
|
25967
26343
|
state: firstString3(nested, ["state", "board_state", "boardState", "status", "taskState"]) || void 0,
|
|
25968
26344
|
...ableTimeProjectFields(nested),
|
|
25969
|
-
categoryId: firstString3(nested, ["category_id", "categoryId", "projectCategoryId"]) || firstString3(
|
|
26345
|
+
categoryId: firstString3(nested, ["category_id", "categoryId", "projectCategoryId"]) || firstString3(asRecord14(nested.category), ["id"]) || void 0,
|
|
25970
26346
|
assignee: assigneeOf(nested),
|
|
25971
26347
|
labels: labelsOf(nested),
|
|
25972
26348
|
comments: commentsOf(nested),
|
|
@@ -26019,7 +26395,7 @@ function isOpenTask(task) {
|
|
|
26019
26395
|
}
|
|
26020
26396
|
async function getAbleTimeOrientation(opts) {
|
|
26021
26397
|
const raw = await callAbleTimeTool("orientation", {}, opts);
|
|
26022
|
-
const record =
|
|
26398
|
+
const record = asRecord14(raw);
|
|
26023
26399
|
const viewerRec = firstRecord(record, ["viewer", "principal", "user", "actor", "me", "person"]) ?? record;
|
|
26024
26400
|
const viewer = {
|
|
26025
26401
|
id: firstString3(viewerRec, ["id", "user_id"]) || void 0,
|
|
@@ -26098,7 +26474,7 @@ async function commentAbleTimeTask(input, opts) {
|
|
|
26098
26474
|
{ id, task_id: id, task: id, body, comment: body, text: body },
|
|
26099
26475
|
opts
|
|
26100
26476
|
);
|
|
26101
|
-
const rec =
|
|
26477
|
+
const rec = asRecord14(raw);
|
|
26102
26478
|
return {
|
|
26103
26479
|
id: rec ? firstString3(rec, ["id", "comment_id"]) || void 0 : void 0,
|
|
26104
26480
|
body: rec ? firstString3(rec, ["body", "text", "comment"]) || body : body
|
|
@@ -26353,7 +26729,7 @@ function reuseLiveThread(input, repoPath, match) {
|
|
|
26353
26729
|
}
|
|
26354
26730
|
async function createThread(input, _onSetupLine) {
|
|
26355
26731
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
26356
|
-
if (!(0,
|
|
26732
|
+
if (!(0, import_node_fs62.existsSync)(repoPath)) {
|
|
26357
26733
|
throw new Error(`Repo not found: ${repoPath}`);
|
|
26358
26734
|
}
|
|
26359
26735
|
if (isRemovedWorkspace(repoPath)) throw new Error(`Project was removed: ${repoPath}`);
|
|
@@ -26544,11 +26920,11 @@ async function createThread(input, _onSetupLine) {
|
|
|
26544
26920
|
await ensureWorkspace(repoPath);
|
|
26545
26921
|
return readThread(thread.id) ?? thread;
|
|
26546
26922
|
}
|
|
26547
|
-
var
|
|
26923
|
+
var import_node_fs62;
|
|
26548
26924
|
var init_create = __esm({
|
|
26549
26925
|
"src/threads/create.ts"() {
|
|
26550
26926
|
"use strict";
|
|
26551
|
-
|
|
26927
|
+
import_node_fs62 = require("fs");
|
|
26552
26928
|
init_acp_harness();
|
|
26553
26929
|
init_detect();
|
|
26554
26930
|
init_worktree();
|
|
@@ -26638,7 +27014,7 @@ function stampOf(thread) {
|
|
|
26638
27014
|
function repoLabel(thread) {
|
|
26639
27015
|
if (isOrchestratorThread(thread)) return "Orchestration";
|
|
26640
27016
|
const path = thread.repoPath?.trim() ?? "";
|
|
26641
|
-
return path && (0,
|
|
27017
|
+
return path && (0, import_node_path64.basename)(path) || path || "project";
|
|
26642
27018
|
}
|
|
26643
27019
|
function toAgent(thread, flags) {
|
|
26644
27020
|
const prUrl = thread.prUrl?.trim();
|
|
@@ -26837,11 +27213,11 @@ function formatFleetArchive(view) {
|
|
|
26837
27213
|
}
|
|
26838
27214
|
return lines.join("\n");
|
|
26839
27215
|
}
|
|
26840
|
-
var
|
|
27216
|
+
var import_node_path64, DEFAULT_LIMIT, MAX_LIMIT;
|
|
26841
27217
|
var init_fleet_archive = __esm({
|
|
26842
27218
|
"src/archive/fleet-archive.ts"() {
|
|
26843
27219
|
"use strict";
|
|
26844
|
-
|
|
27220
|
+
import_node_path64 = require("path");
|
|
26845
27221
|
init_global_workspace();
|
|
26846
27222
|
init_worktree_labels();
|
|
26847
27223
|
DEFAULT_LIMIT = 40;
|
|
@@ -27016,11 +27392,11 @@ function writeTurnLive(threadId, progress) {
|
|
|
27016
27392
|
const path = threadLivePath(threadId);
|
|
27017
27393
|
const tmp = `${path}.${process.pid}.tmp`;
|
|
27018
27394
|
try {
|
|
27019
|
-
(0,
|
|
27020
|
-
(0,
|
|
27395
|
+
(0, import_node_fs63.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
|
|
27396
|
+
(0, import_node_fs63.renameSync)(tmp, path);
|
|
27021
27397
|
} catch {
|
|
27022
27398
|
try {
|
|
27023
|
-
(0,
|
|
27399
|
+
(0, import_node_fs63.unlinkSync)(tmp);
|
|
27024
27400
|
} catch {
|
|
27025
27401
|
}
|
|
27026
27402
|
}
|
|
@@ -27030,9 +27406,9 @@ function readTurnLiveParts(threadId) {
|
|
|
27030
27406
|
}
|
|
27031
27407
|
function readTurnLive(threadId) {
|
|
27032
27408
|
const path = threadLivePath(threadId);
|
|
27033
|
-
if (!(0,
|
|
27409
|
+
if (!(0, import_node_fs63.existsSync)(path)) return null;
|
|
27034
27410
|
try {
|
|
27035
|
-
const raw = JSON.parse((0,
|
|
27411
|
+
const raw = JSON.parse((0, import_node_fs63.readFileSync)(path, "utf8"));
|
|
27036
27412
|
if (!raw || typeof raw.summary !== "string") return null;
|
|
27037
27413
|
return raw;
|
|
27038
27414
|
} catch {
|
|
@@ -27044,17 +27420,17 @@ function clearTurnLive(threadId) {
|
|
|
27044
27420
|
if (buf?.timer) clearTimeout(buf.timer);
|
|
27045
27421
|
buffers.delete(threadId);
|
|
27046
27422
|
const path = threadLivePath(threadId);
|
|
27047
|
-
if (!(0,
|
|
27423
|
+
if (!(0, import_node_fs63.existsSync)(path)) return;
|
|
27048
27424
|
try {
|
|
27049
|
-
(0,
|
|
27425
|
+
(0, import_node_fs63.unlinkSync)(path);
|
|
27050
27426
|
} catch {
|
|
27051
27427
|
}
|
|
27052
27428
|
}
|
|
27053
|
-
var
|
|
27429
|
+
var import_node_fs63, buffers, FLUSH_MS, MAX_PARTS;
|
|
27054
27430
|
var init_turn_live = __esm({
|
|
27055
27431
|
"src/store/turn-live.ts"() {
|
|
27056
27432
|
"use strict";
|
|
27057
|
-
|
|
27433
|
+
import_node_fs63 = require("fs");
|
|
27058
27434
|
init_message_parts();
|
|
27059
27435
|
init_paths();
|
|
27060
27436
|
init_agent_block();
|
|
@@ -27339,7 +27715,7 @@ var init_quota_failover = __esm({
|
|
|
27339
27715
|
// src/threads/adopt.ts
|
|
27340
27716
|
function thisModuleFile2() {
|
|
27341
27717
|
const cjsFile = typeof __filename !== "undefined" ? __filename : "";
|
|
27342
|
-
return cjsFile || process.argv[1] || (0,
|
|
27718
|
+
return cjsFile || process.argv[1] || (0, import_node_path65.join)(process.cwd(), "package.json");
|
|
27343
27719
|
}
|
|
27344
27720
|
function openReadonlySqlite(file) {
|
|
27345
27721
|
const req = (0, import_node_module7.createRequire)(thisModuleFile2());
|
|
@@ -27357,21 +27733,21 @@ function mapAgentType(raw) {
|
|
|
27357
27733
|
return null;
|
|
27358
27734
|
}
|
|
27359
27735
|
function resolveConductorCursorAgentId(workspacePath) {
|
|
27360
|
-
if (!workspacePath || !(0,
|
|
27736
|
+
if (!workspacePath || !(0, import_node_fs64.existsSync)(CURSOR_SDK_STORE)) return null;
|
|
27361
27737
|
const normalized = workspacePath.replace(/\/$/, "");
|
|
27362
27738
|
let best = null;
|
|
27363
27739
|
let hashes;
|
|
27364
27740
|
try {
|
|
27365
|
-
hashes = (0,
|
|
27741
|
+
hashes = (0, import_node_fs64.readdirSync)(CURSOR_SDK_STORE);
|
|
27366
27742
|
} catch {
|
|
27367
27743
|
return null;
|
|
27368
27744
|
}
|
|
27369
27745
|
for (const hash of hashes) {
|
|
27370
|
-
const agentsFile = (0,
|
|
27371
|
-
if (!(0,
|
|
27746
|
+
const agentsFile = (0, import_node_path65.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
|
|
27747
|
+
if (!(0, import_node_fs64.existsSync)(agentsFile)) continue;
|
|
27372
27748
|
let text8;
|
|
27373
27749
|
try {
|
|
27374
|
-
text8 = (0,
|
|
27750
|
+
text8 = (0, import_node_fs64.readFileSync)(agentsFile, "utf8");
|
|
27375
27751
|
} catch {
|
|
27376
27752
|
continue;
|
|
27377
27753
|
}
|
|
@@ -27395,7 +27771,7 @@ function resolveConductorCursorAgentId(workspacePath) {
|
|
|
27395
27771
|
return best?.agentId ?? null;
|
|
27396
27772
|
}
|
|
27397
27773
|
async function adoptThread(input) {
|
|
27398
|
-
if (!(0,
|
|
27774
|
+
if (!(0, import_node_fs64.existsSync)(input.worktreePath)) {
|
|
27399
27775
|
throw new Error(`Worktree not found: ${input.worktreePath}`);
|
|
27400
27776
|
}
|
|
27401
27777
|
const repoPath = await resolveRepoRoot(input.worktreePath);
|
|
@@ -27424,18 +27800,18 @@ async function adoptThread(input) {
|
|
|
27424
27800
|
return thread;
|
|
27425
27801
|
}
|
|
27426
27802
|
function listConductorWorkspaces() {
|
|
27427
|
-
if (!(0,
|
|
27803
|
+
if (!(0, import_node_fs64.existsSync)(CONDUCTOR_DB)) {
|
|
27428
27804
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
27429
27805
|
}
|
|
27430
|
-
const tmp = (0,
|
|
27431
|
-
const snapshot = (0,
|
|
27806
|
+
const tmp = (0, import_node_fs64.mkdtempSync)((0, import_node_path65.join)((0, import_node_os21.tmpdir)(), "sideboard-conductor-"));
|
|
27807
|
+
const snapshot = (0, import_node_path65.join)(tmp, "conductor.db");
|
|
27432
27808
|
try {
|
|
27433
|
-
(0,
|
|
27809
|
+
(0, import_node_fs64.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
27434
27810
|
for (const suffix of ["-wal", "-shm"]) {
|
|
27435
27811
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
27436
|
-
if ((0,
|
|
27812
|
+
if ((0, import_node_fs64.existsSync)(src)) {
|
|
27437
27813
|
try {
|
|
27438
|
-
(0,
|
|
27814
|
+
(0, import_node_fs64.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
27439
27815
|
} catch {
|
|
27440
27816
|
}
|
|
27441
27817
|
}
|
|
@@ -27511,22 +27887,22 @@ function listConductorWorkspaces() {
|
|
|
27511
27887
|
db.close();
|
|
27512
27888
|
}
|
|
27513
27889
|
} finally {
|
|
27514
|
-
(0,
|
|
27890
|
+
(0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
|
|
27515
27891
|
}
|
|
27516
27892
|
}
|
|
27517
27893
|
function importConductorWorkspace(workspaceId) {
|
|
27518
|
-
if (!(0,
|
|
27894
|
+
if (!(0, import_node_fs64.existsSync)(CONDUCTOR_DB)) {
|
|
27519
27895
|
throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
|
|
27520
27896
|
}
|
|
27521
|
-
const tmp = (0,
|
|
27522
|
-
const snapshot = (0,
|
|
27897
|
+
const tmp = (0, import_node_fs64.mkdtempSync)((0, import_node_path65.join)((0, import_node_os21.tmpdir)(), "sideboard-conductor-"));
|
|
27898
|
+
const snapshot = (0, import_node_path65.join)(tmp, "conductor.db");
|
|
27523
27899
|
try {
|
|
27524
|
-
(0,
|
|
27900
|
+
(0, import_node_fs64.copyFileSync)(CONDUCTOR_DB, snapshot);
|
|
27525
27901
|
for (const suffix of ["-wal", "-shm"]) {
|
|
27526
27902
|
const src = `${CONDUCTOR_DB}${suffix}`;
|
|
27527
|
-
if ((0,
|
|
27903
|
+
if ((0, import_node_fs64.existsSync)(src)) {
|
|
27528
27904
|
try {
|
|
27529
|
-
(0,
|
|
27905
|
+
(0, import_node_fs64.copyFileSync)(src, `${snapshot}${suffix}`);
|
|
27530
27906
|
} catch {
|
|
27531
27907
|
}
|
|
27532
27908
|
}
|
|
@@ -27544,7 +27920,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
27544
27920
|
).get(workspaceId);
|
|
27545
27921
|
if (!row) throw new Error(`Conductor workspace not found: ${workspaceId}`);
|
|
27546
27922
|
const worktreePath = String(row.workspacePath);
|
|
27547
|
-
if (!(0,
|
|
27923
|
+
if (!(0, import_node_fs64.existsSync)(worktreePath)) {
|
|
27548
27924
|
throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
|
|
27549
27925
|
}
|
|
27550
27926
|
let sessionId = null;
|
|
@@ -27584,7 +27960,7 @@ function importConductorWorkspace(workspaceId) {
|
|
|
27584
27960
|
}
|
|
27585
27961
|
let repoPath = worktreePath;
|
|
27586
27962
|
try {
|
|
27587
|
-
repoPath = (0,
|
|
27963
|
+
repoPath = (0, import_node_child_process7.execFileSync)("git", ["rev-parse", "--show-toplevel"], {
|
|
27588
27964
|
cwd: worktreePath,
|
|
27589
27965
|
encoding: "utf8"
|
|
27590
27966
|
}).trim();
|
|
@@ -27607,31 +27983,31 @@ function importConductorWorkspace(workspaceId) {
|
|
|
27607
27983
|
db.close();
|
|
27608
27984
|
}
|
|
27609
27985
|
} finally {
|
|
27610
|
-
(0,
|
|
27986
|
+
(0, import_node_fs64.rmSync)(tmp, { recursive: true, force: true });
|
|
27611
27987
|
}
|
|
27612
27988
|
}
|
|
27613
27989
|
async function importConductorWorkspaceAsync(workspaceId) {
|
|
27614
27990
|
return importConductorWorkspace(workspaceId);
|
|
27615
27991
|
}
|
|
27616
|
-
var
|
|
27992
|
+
var import_node_child_process7, import_node_fs64, import_node_os21, import_node_path65, import_node_module7, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
|
|
27617
27993
|
var init_adopt = __esm({
|
|
27618
27994
|
"src/threads/adopt.ts"() {
|
|
27619
27995
|
"use strict";
|
|
27620
|
-
|
|
27621
|
-
|
|
27622
|
-
|
|
27623
|
-
|
|
27996
|
+
import_node_child_process7 = require("child_process");
|
|
27997
|
+
import_node_fs64 = require("fs");
|
|
27998
|
+
import_node_os21 = require("os");
|
|
27999
|
+
import_node_path65 = require("path");
|
|
27624
28000
|
import_node_module7 = require("module");
|
|
27625
28001
|
init_worktree();
|
|
27626
28002
|
init_thread_store();
|
|
27627
|
-
CONDUCTOR_APP_SUPPORT = (0,
|
|
28003
|
+
CONDUCTOR_APP_SUPPORT = (0, import_node_path65.join)(
|
|
27628
28004
|
process.env.HOME ?? "",
|
|
27629
28005
|
"Library",
|
|
27630
28006
|
"Application Support",
|
|
27631
28007
|
"com.conductor.app"
|
|
27632
28008
|
);
|
|
27633
|
-
CONDUCTOR_DB = (0,
|
|
27634
|
-
CURSOR_SDK_STORE = (0,
|
|
28009
|
+
CONDUCTOR_DB = (0, import_node_path65.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
|
|
28010
|
+
CURSOR_SDK_STORE = (0, import_node_path65.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
|
|
27635
28011
|
}
|
|
27636
28012
|
});
|
|
27637
28013
|
|
|
@@ -27698,7 +28074,7 @@ async function openStackLayer(input, _onSetupLine) {
|
|
|
27698
28074
|
let createdWorktree = false;
|
|
27699
28075
|
const trees = await listWorktrees(repoPath);
|
|
27700
28076
|
const checkedOut = trees.find((w) => w.branch === branchName);
|
|
27701
|
-
if (checkedOut?.path && (0,
|
|
28077
|
+
if (checkedOut?.path && (0, import_node_fs65.existsSync)(checkedOut.path)) {
|
|
27702
28078
|
if (input.reuseExistingWorktree !== false) {
|
|
27703
28079
|
worktreePath = checkedOut.path;
|
|
27704
28080
|
} else {
|
|
@@ -27840,7 +28216,7 @@ async function initStackFromThread(input, onSetupLine) {
|
|
|
27840
28216
|
async function createPrStack(input, onSetupLine) {
|
|
27841
28217
|
await requireAgent(input.agent);
|
|
27842
28218
|
const repoPath = await resolveRepoRoot(input.repoPath);
|
|
27843
|
-
if (!(0,
|
|
28219
|
+
if (!(0, import_node_fs65.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
|
|
27844
28220
|
if (!input.branches.length) throw new Error("At least one branch name required");
|
|
27845
28221
|
const status = await detectGhStack(repoPath);
|
|
27846
28222
|
if (!status.available) throw new Error(status.reason);
|
|
@@ -27907,7 +28283,7 @@ async function createPrStack(input, onSetupLine) {
|
|
|
27907
28283
|
}
|
|
27908
28284
|
}
|
|
27909
28285
|
const claimed = new Set(threads.map((t) => t.worktreePath));
|
|
27910
|
-
if (!claimed.has(bootstrap.worktreePath) && (0,
|
|
28286
|
+
if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs65.existsSync)(bootstrap.worktreePath)) {
|
|
27911
28287
|
try {
|
|
27912
28288
|
await removeWorktree(repoPath, bootstrap.worktreePath, {
|
|
27913
28289
|
deleteBranch: bootstrap.branchName
|
|
@@ -27917,11 +28293,11 @@ async function createPrStack(input, onSetupLine) {
|
|
|
27917
28293
|
}
|
|
27918
28294
|
return { stack, threads, createdThreadIds };
|
|
27919
28295
|
}
|
|
27920
|
-
var
|
|
28296
|
+
var import_node_fs65;
|
|
27921
28297
|
var init_stack_layers = __esm({
|
|
27922
28298
|
"src/threads/stack-layers.ts"() {
|
|
27923
28299
|
"use strict";
|
|
27924
|
-
|
|
28300
|
+
import_node_fs65 = require("fs");
|
|
27925
28301
|
init_detect();
|
|
27926
28302
|
init_run();
|
|
27927
28303
|
init_stack();
|
|
@@ -27961,11 +28337,11 @@ async function formatPrCreateFailure(raw, cwd, ctx) {
|
|
|
27961
28337
|
}
|
|
27962
28338
|
async function createCursorPullRequest(worktreePath, slug, opts) {
|
|
27963
28339
|
const bodyText = (opts.body ?? opts.title).trim() || opts.title;
|
|
27964
|
-
const bodyFile = (0,
|
|
27965
|
-
(0,
|
|
28340
|
+
const bodyFile = (0, import_node_path66.join)(
|
|
28341
|
+
(0, import_node_os22.tmpdir)(),
|
|
27966
28342
|
`sideboard-pr-body-${process.pid}-${(0, import_node_crypto20.randomBytes)(6).toString("hex")}.md`
|
|
27967
28343
|
);
|
|
27968
|
-
(0,
|
|
28344
|
+
(0, import_node_fs66.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
|
|
27969
28345
|
`, "utf8");
|
|
27970
28346
|
try {
|
|
27971
28347
|
return await createOrUpdateCursorPr(worktreePath, slug, {
|
|
@@ -27977,7 +28353,7 @@ async function createCursorPullRequest(worktreePath, slug, opts) {
|
|
|
27977
28353
|
});
|
|
27978
28354
|
} finally {
|
|
27979
28355
|
try {
|
|
27980
|
-
(0,
|
|
28356
|
+
(0, import_node_fs66.unlinkSync)(bodyFile);
|
|
27981
28357
|
} catch {
|
|
27982
28358
|
}
|
|
27983
28359
|
}
|
|
@@ -28003,11 +28379,11 @@ async function createOrUpdatePr(worktreePath, opts) {
|
|
|
28003
28379
|
const headRef = ghHeadRef(slug, opts.head);
|
|
28004
28380
|
const branchOnly = opts.head.trim().replace(/^refs\/heads\//, "");
|
|
28005
28381
|
const bodyText = clampGithubPrBody(opts.body ?? opts.title);
|
|
28006
|
-
const bodyFile = (0,
|
|
28007
|
-
(0,
|
|
28382
|
+
const bodyFile = (0, import_node_path66.join)(
|
|
28383
|
+
(0, import_node_os22.tmpdir)(),
|
|
28008
28384
|
`sideboard-pr-body-${process.pid}-${(0, import_node_crypto20.randomBytes)(6).toString("hex")}.md`
|
|
28009
28385
|
);
|
|
28010
|
-
(0,
|
|
28386
|
+
(0, import_node_fs66.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
|
|
28011
28387
|
`, "utf8");
|
|
28012
28388
|
const bodyArgs = ["--body-file", bodyFile];
|
|
28013
28389
|
try {
|
|
@@ -28021,7 +28397,7 @@ async function createOrUpdatePr(worktreePath, opts) {
|
|
|
28021
28397
|
});
|
|
28022
28398
|
} finally {
|
|
28023
28399
|
try {
|
|
28024
|
-
(0,
|
|
28400
|
+
(0, import_node_fs66.unlinkSync)(bodyFile);
|
|
28025
28401
|
} catch {
|
|
28026
28402
|
}
|
|
28027
28403
|
}
|
|
@@ -28096,14 +28472,14 @@ async function createOrUpdatePrWithBodyFile(worktreePath, opts) {
|
|
|
28096
28472
|
const url = created.stdout.trim().split("\n").find((l) => l.startsWith("http")) ?? created.stdout.trim();
|
|
28097
28473
|
return url;
|
|
28098
28474
|
}
|
|
28099
|
-
var import_node_crypto20,
|
|
28475
|
+
var import_node_crypto20, import_node_fs66, import_node_os22, import_node_path66;
|
|
28100
28476
|
var init_pr_write = __esm({
|
|
28101
28477
|
"src/git/pr-write.ts"() {
|
|
28102
28478
|
"use strict";
|
|
28103
28479
|
import_node_crypto20 = require("crypto");
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28480
|
+
import_node_fs66 = require("fs");
|
|
28481
|
+
import_node_os22 = require("os");
|
|
28482
|
+
import_node_path66 = require("path");
|
|
28107
28483
|
init_gh_errors();
|
|
28108
28484
|
init_run();
|
|
28109
28485
|
init_cursor_pr();
|
|
@@ -28113,7 +28489,7 @@ var init_pr_write = __esm({
|
|
|
28113
28489
|
|
|
28114
28490
|
// src/diff/diff.ts
|
|
28115
28491
|
async function inspectGitWorktree(worktreePath) {
|
|
28116
|
-
if (!worktreePath || !(0,
|
|
28492
|
+
if (!worktreePath || !(0, import_node_fs67.existsSync)(worktreePath)) return "missing_worktree";
|
|
28117
28493
|
const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
|
|
28118
28494
|
reject: false
|
|
28119
28495
|
});
|
|
@@ -28121,7 +28497,7 @@ async function inspectGitWorktree(worktreePath) {
|
|
|
28121
28497
|
return "ok";
|
|
28122
28498
|
}
|
|
28123
28499
|
async function initializeGitRepository(worktreePath) {
|
|
28124
|
-
if (!worktreePath || !(0,
|
|
28500
|
+
if (!worktreePath || !(0, import_node_fs67.existsSync)(worktreePath)) {
|
|
28125
28501
|
throw new Error("Worktree not found");
|
|
28126
28502
|
}
|
|
28127
28503
|
const status = await inspectGitWorktree(worktreePath);
|
|
@@ -28255,11 +28631,11 @@ new file mode 100644
|
|
|
28255
28631
|
};
|
|
28256
28632
|
}
|
|
28257
28633
|
async function untrackedPatch(worktreePath, path, maxHunk) {
|
|
28258
|
-
const abs = (0,
|
|
28634
|
+
const abs = (0, import_node_path67.join)(worktreePath, path);
|
|
28259
28635
|
try {
|
|
28260
|
-
const st = (0,
|
|
28636
|
+
const st = (0, import_node_fs67.statSync)(abs);
|
|
28261
28637
|
if (st.isFile() && st.size > maxHunk) {
|
|
28262
|
-
const buf = (0,
|
|
28638
|
+
const buf = (0, import_node_fs67.readFileSync)(abs).subarray(0, maxHunk);
|
|
28263
28639
|
return syntheticAddPatch(path, buf.toString("utf8"), maxHunk);
|
|
28264
28640
|
}
|
|
28265
28641
|
} catch {
|
|
@@ -28353,13 +28729,13 @@ function formatStat(files) {
|
|
|
28353
28729
|
return `${n} file${n === 1 ? "" : "s"} changed, ${additions} insertions(+), ${deletions} deletions(-)`;
|
|
28354
28730
|
}
|
|
28355
28731
|
function emptyScopeStats() {
|
|
28356
|
-
const
|
|
28732
|
+
const z15 = emptyStat();
|
|
28357
28733
|
return {
|
|
28358
|
-
commits:
|
|
28359
|
-
uncommitted:
|
|
28360
|
-
staged:
|
|
28361
|
-
unstaged:
|
|
28362
|
-
last_turn:
|
|
28734
|
+
commits: z15,
|
|
28735
|
+
uncommitted: z15,
|
|
28736
|
+
staged: z15,
|
|
28737
|
+
unstaged: z15,
|
|
28738
|
+
last_turn: z15
|
|
28363
28739
|
};
|
|
28364
28740
|
}
|
|
28365
28741
|
function filesFromDiff(nameStatus, numstat, combinedDiff, maxHunk) {
|
|
@@ -28726,9 +29102,9 @@ async function getDiff(worktreePath, repoPath, opts) {
|
|
|
28726
29102
|
}
|
|
28727
29103
|
function statWorktreePath(worktreePath, relativePath) {
|
|
28728
29104
|
assertSafeRelativePath(relativePath);
|
|
28729
|
-
const abs = (0,
|
|
28730
|
-
if (!(0,
|
|
28731
|
-
const st = (0,
|
|
29105
|
+
const abs = (0, import_node_path67.join)(worktreePath, relativePath);
|
|
29106
|
+
if (!(0, import_node_fs67.existsSync)(abs)) return "missing";
|
|
29107
|
+
const st = (0, import_node_fs67.statSync)(abs);
|
|
28732
29108
|
if (st.isDirectory()) return "dir";
|
|
28733
29109
|
if (st.isFile()) return "file";
|
|
28734
29110
|
return "missing";
|
|
@@ -28757,8 +29133,8 @@ function isImageRelativePath(relativePath) {
|
|
|
28757
29133
|
function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
28758
29134
|
assertSafeRelativePath(relativePath);
|
|
28759
29135
|
const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
|
|
28760
|
-
const abs = (0,
|
|
28761
|
-
const st = (0,
|
|
29136
|
+
const abs = (0, import_node_path67.join)(worktreePath, relativePath);
|
|
29137
|
+
const st = (0, import_node_fs67.statSync)(abs);
|
|
28762
29138
|
if (!st.isFile()) {
|
|
28763
29139
|
throw new Error(`Not a file: ${relativePath}`);
|
|
28764
29140
|
}
|
|
@@ -28767,7 +29143,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
28767
29143
|
`File too large to upload (${st.size} bytes; max ${maxBytes})`
|
|
28768
29144
|
);
|
|
28769
29145
|
}
|
|
28770
|
-
const buf = (0,
|
|
29146
|
+
const buf = (0, import_node_fs67.readFileSync)(abs);
|
|
28771
29147
|
return {
|
|
28772
29148
|
path: relativePath,
|
|
28773
29149
|
contentBase64: buf.toString("base64"),
|
|
@@ -28777,12 +29153,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
|
|
|
28777
29153
|
function readWorktreeFile(worktreePath, relativePath, opts) {
|
|
28778
29154
|
assertSafeRelativePath(relativePath);
|
|
28779
29155
|
const maxBytes = opts?.maxBytes ?? 2e5;
|
|
28780
|
-
const abs = (0,
|
|
28781
|
-
const st = (0,
|
|
29156
|
+
const abs = (0, import_node_path67.join)(worktreePath, relativePath);
|
|
29157
|
+
const st = (0, import_node_fs67.statSync)(abs);
|
|
28782
29158
|
if (!st.isFile()) {
|
|
28783
29159
|
throw new Error(`Not a file: ${relativePath}`);
|
|
28784
29160
|
}
|
|
28785
|
-
const buf = (0,
|
|
29161
|
+
const buf = (0, import_node_fs67.readFileSync)(abs);
|
|
28786
29162
|
if (isImageRelativePath(relativePath)) {
|
|
28787
29163
|
const maxImageBytes = Math.max(maxBytes, 15e6);
|
|
28788
29164
|
const truncated2 = buf.length > maxImageBytes;
|
|
@@ -28825,9 +29201,9 @@ function assertSafeRelativePath(relativePath) {
|
|
|
28825
29201
|
}
|
|
28826
29202
|
function writeWorktreeFile(worktreePath, relativePath, content) {
|
|
28827
29203
|
assertSafeRelativePath(relativePath);
|
|
28828
|
-
const abs = (0,
|
|
28829
|
-
(0,
|
|
28830
|
-
(0,
|
|
29204
|
+
const abs = (0, import_node_path67.join)(worktreePath, relativePath);
|
|
29205
|
+
(0, import_node_fs67.mkdirSync)((0, import_node_path67.dirname)(abs), { recursive: true });
|
|
29206
|
+
(0, import_node_fs67.writeFileSync)(abs, content, "utf8");
|
|
28831
29207
|
return { path: relativePath };
|
|
28832
29208
|
}
|
|
28833
29209
|
async function getWorktreeDirtyStat(worktreePath) {
|
|
@@ -28867,12 +29243,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
|
|
|
28867
29243
|
truncated: full.files.length > maxFiles
|
|
28868
29244
|
};
|
|
28869
29245
|
}
|
|
28870
|
-
var
|
|
29246
|
+
var import_node_fs67, import_node_path67, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
|
|
28871
29247
|
var init_diff = __esm({
|
|
28872
29248
|
"src/diff/diff.ts"() {
|
|
28873
29249
|
"use strict";
|
|
28874
|
-
|
|
28875
|
-
|
|
29250
|
+
import_node_fs67 = require("fs");
|
|
29251
|
+
import_node_path67 = require("path");
|
|
28876
29252
|
init_run();
|
|
28877
29253
|
init_worktree();
|
|
28878
29254
|
mergeBaseCache = /* @__PURE__ */ new Map();
|
|
@@ -29095,16 +29471,16 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
|
|
|
29095
29471
|
if (!relativePath || relativePath.includes("..") || relativePath.startsWith("/")) {
|
|
29096
29472
|
throw new Error("Invalid path");
|
|
29097
29473
|
}
|
|
29098
|
-
const abs = (0,
|
|
29099
|
-
const fd = (0,
|
|
29474
|
+
const abs = (0, import_node_path68.join)(worktreePath, relativePath);
|
|
29475
|
+
const fd = (0, import_node_fs68.openSync)(abs, "r");
|
|
29100
29476
|
try {
|
|
29101
|
-
const st = (0,
|
|
29477
|
+
const st = (0, import_node_fs68.fstatSync)(fd);
|
|
29102
29478
|
if (!st.isFile()) throw new Error(`Not a file: ${relativePath}`);
|
|
29103
29479
|
const size = st.size;
|
|
29104
29480
|
const start = Math.max(0, size - maxBytes);
|
|
29105
29481
|
const length = size - start;
|
|
29106
29482
|
const buf = Buffer.alloc(length);
|
|
29107
|
-
if (length > 0) (0,
|
|
29483
|
+
if (length > 0) (0, import_node_fs68.readSync)(fd, buf, 0, length, start);
|
|
29108
29484
|
if (buf.subarray(0, Math.min(buf.length, 8e3)).includes(0)) {
|
|
29109
29485
|
return {
|
|
29110
29486
|
path: relativePath,
|
|
@@ -29122,15 +29498,15 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
|
|
|
29122
29498
|
}
|
|
29123
29499
|
return { path: relativePath, content, truncated, binary: false, encoding: "utf8" };
|
|
29124
29500
|
} finally {
|
|
29125
|
-
(0,
|
|
29501
|
+
(0, import_node_fs68.closeSync)(fd);
|
|
29126
29502
|
}
|
|
29127
29503
|
}
|
|
29128
|
-
var
|
|
29504
|
+
var import_node_fs68, import_node_path68, WORKTREE_TAIL_BYTES;
|
|
29129
29505
|
var init_read_worktree_tail = __esm({
|
|
29130
29506
|
"src/diff/read-worktree-tail.ts"() {
|
|
29131
29507
|
"use strict";
|
|
29132
|
-
|
|
29133
|
-
|
|
29508
|
+
import_node_fs68 = require("fs");
|
|
29509
|
+
import_node_path68 = require("path");
|
|
29134
29510
|
WORKTREE_TAIL_BYTES = 2e5;
|
|
29135
29511
|
}
|
|
29136
29512
|
});
|
|
@@ -29279,7 +29655,7 @@ function parseFrontmatter(content) {
|
|
|
29279
29655
|
}
|
|
29280
29656
|
function readSkill(skillMd, source) {
|
|
29281
29657
|
try {
|
|
29282
|
-
const content = (0,
|
|
29658
|
+
const content = (0, import_node_fs69.readFileSync)(skillMd, "utf8");
|
|
29283
29659
|
const { name: fmName, description } = parseFrontmatter(content);
|
|
29284
29660
|
const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
|
|
29285
29661
|
const name = fmName || dirName;
|
|
@@ -29298,19 +29674,19 @@ function readSkill(skillMd, source) {
|
|
|
29298
29674
|
}
|
|
29299
29675
|
}
|
|
29300
29676
|
function scanSkillsDir(dir, source, out) {
|
|
29301
|
-
if (!(0,
|
|
29677
|
+
if (!(0, import_node_fs69.existsSync)(dir)) return;
|
|
29302
29678
|
let entries;
|
|
29303
29679
|
try {
|
|
29304
|
-
entries = (0,
|
|
29680
|
+
entries = (0, import_node_fs69.readdirSync)(dir);
|
|
29305
29681
|
} catch {
|
|
29306
29682
|
return;
|
|
29307
29683
|
}
|
|
29308
29684
|
for (const entry of entries) {
|
|
29309
29685
|
if (entry.startsWith(".")) continue;
|
|
29310
|
-
const skillMd = (0,
|
|
29311
|
-
if (!(0,
|
|
29686
|
+
const skillMd = (0, import_node_path69.join)(dir, entry, "SKILL.md");
|
|
29687
|
+
if (!(0, import_node_fs69.existsSync)(skillMd)) continue;
|
|
29312
29688
|
try {
|
|
29313
|
-
if (!(0,
|
|
29689
|
+
if (!(0, import_node_fs69.statSync)(skillMd).isFile()) continue;
|
|
29314
29690
|
} catch {
|
|
29315
29691
|
continue;
|
|
29316
29692
|
}
|
|
@@ -29319,24 +29695,24 @@ function scanSkillsDir(dir, source, out) {
|
|
|
29319
29695
|
}
|
|
29320
29696
|
}
|
|
29321
29697
|
function scanClaudePluginSkills(pluginsRoot, out) {
|
|
29322
|
-
if (!(0,
|
|
29698
|
+
if (!(0, import_node_fs69.existsSync)(pluginsRoot)) return;
|
|
29323
29699
|
const walk = (dir, depth, lookingForSkillsDir) => {
|
|
29324
29700
|
if (depth > 7) return;
|
|
29325
29701
|
let entries;
|
|
29326
29702
|
try {
|
|
29327
|
-
entries = (0,
|
|
29703
|
+
entries = (0, import_node_fs69.readdirSync)(dir);
|
|
29328
29704
|
} catch {
|
|
29329
29705
|
return;
|
|
29330
29706
|
}
|
|
29331
29707
|
if (lookingForSkillsDir && entries.includes("SKILL.md")) {
|
|
29332
|
-
const skill = readSkill((0,
|
|
29708
|
+
const skill = readSkill((0, import_node_path69.join)(dir, "SKILL.md"), "cli");
|
|
29333
29709
|
if (skill) out.push(skill);
|
|
29334
29710
|
}
|
|
29335
29711
|
for (const entry of entries) {
|
|
29336
29712
|
if (entry === "node_modules" || entry === ".git") continue;
|
|
29337
|
-
const full = (0,
|
|
29713
|
+
const full = (0, import_node_path69.join)(dir, entry);
|
|
29338
29714
|
try {
|
|
29339
|
-
if (!(0,
|
|
29715
|
+
if (!(0, import_node_fs69.statSync)(full).isDirectory()) continue;
|
|
29340
29716
|
} catch {
|
|
29341
29717
|
continue;
|
|
29342
29718
|
}
|
|
@@ -29351,20 +29727,20 @@ function scanClaudePluginSkills(pluginsRoot, out) {
|
|
|
29351
29727
|
walk(pluginsRoot, 0, false);
|
|
29352
29728
|
}
|
|
29353
29729
|
function discoverSkills(worktreePath) {
|
|
29354
|
-
const home = (0,
|
|
29730
|
+
const home = (0, import_node_os23.homedir)();
|
|
29355
29731
|
const collected = [];
|
|
29356
29732
|
for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
|
|
29357
|
-
scanSkillsDir((0,
|
|
29733
|
+
scanSkillsDir((0, import_node_path69.join)(worktreePath, rel), "workspace", collected);
|
|
29358
29734
|
}
|
|
29359
29735
|
for (const abs of [
|
|
29360
|
-
(0,
|
|
29361
|
-
(0,
|
|
29362
|
-
(0,
|
|
29363
|
-
(0,
|
|
29736
|
+
(0, import_node_path69.join)(home, ".claude/skills"),
|
|
29737
|
+
(0, import_node_path69.join)(home, ".cursor/skills"),
|
|
29738
|
+
(0, import_node_path69.join)(home, ".sideboard/skills"),
|
|
29739
|
+
(0, import_node_path69.join)(home, ".brightsy/skills")
|
|
29364
29740
|
]) {
|
|
29365
29741
|
scanSkillsDir(abs, "user", collected);
|
|
29366
29742
|
}
|
|
29367
|
-
scanClaudePluginSkills((0,
|
|
29743
|
+
scanClaudePluginSkills((0, import_node_path69.join)(home, ".claude/plugins"), collected);
|
|
29368
29744
|
collected.push(...bundledSkills());
|
|
29369
29745
|
const rank = {
|
|
29370
29746
|
workspace: 0,
|
|
@@ -29390,7 +29766,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
29390
29766
|
\u2026(truncated)` : body;
|
|
29391
29767
|
}
|
|
29392
29768
|
}
|
|
29393
|
-
const raw = (0,
|
|
29769
|
+
const raw = (0, import_node_fs69.readFileSync)(skillPath, "utf8");
|
|
29394
29770
|
if (raw.startsWith("---")) {
|
|
29395
29771
|
const end = raw.indexOf("\n---", 3);
|
|
29396
29772
|
if (end >= 0) {
|
|
@@ -29404,13 +29780,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
|
|
|
29404
29780
|
|
|
29405
29781
|
\u2026(truncated)` : raw;
|
|
29406
29782
|
}
|
|
29407
|
-
var
|
|
29783
|
+
var import_node_fs69, import_node_os23, import_node_path69, BUNDLED_SKILL_PREFIX;
|
|
29408
29784
|
var init_discover = __esm({
|
|
29409
29785
|
"src/skills/discover.ts"() {
|
|
29410
29786
|
"use strict";
|
|
29411
|
-
|
|
29412
|
-
|
|
29413
|
-
|
|
29787
|
+
import_node_fs69 = require("fs");
|
|
29788
|
+
import_node_os23 = require("os");
|
|
29789
|
+
import_node_path69 = require("path");
|
|
29414
29790
|
init_long_running();
|
|
29415
29791
|
BUNDLED_SKILL_PREFIX = "bundled:";
|
|
29416
29792
|
}
|
|
@@ -29696,7 +30072,11 @@ function promptForJoinedSteer(input) {
|
|
|
29696
30072
|
}
|
|
29697
30073
|
const { agentPrompt: expandedLatest } = expandComposerPrompt(
|
|
29698
30074
|
input.worktreePath,
|
|
29699
|
-
expandCanonicalGitRequest(input.latestPrompt, {
|
|
30075
|
+
expandCanonicalGitRequest(input.latestPrompt, {
|
|
30076
|
+
forge: input.gitForge,
|
|
30077
|
+
worktreePath: input.worktreePath,
|
|
30078
|
+
hasAnnounceSkill: announceSkillPresent(input.worktreePath)
|
|
30079
|
+
}),
|
|
29700
30080
|
{ attachments: latestAttachments }
|
|
29701
30081
|
);
|
|
29702
30082
|
return input.expandedPrompt && input.agentPrompt.endsWith(input.expandedPrompt) ? input.agentPrompt.slice(0, -input.expandedPrompt.length) + expandedLatest : `${input.agentPrompt}
|
|
@@ -29721,10 +30101,10 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
|
|
|
29721
30101
|
throw new Error(`Thread is archived: ${thread.id}`);
|
|
29722
30102
|
}
|
|
29723
30103
|
const requested = opts?.followUp;
|
|
29724
|
-
const
|
|
30104
|
+
const join70 = requested === "join";
|
|
29725
30105
|
const followUp = resolveSendFollowUp(
|
|
29726
30106
|
current,
|
|
29727
|
-
|
|
30107
|
+
join70 ? "steer" : requested
|
|
29728
30108
|
);
|
|
29729
30109
|
const explicit = opts?.attachments;
|
|
29730
30110
|
const consumed = explicit !== void 0 ? { attachments: current.attachments, consumed: explicit } : consumeComposerAttachments(current);
|
|
@@ -29733,7 +30113,7 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
|
|
|
29733
30113
|
const draft = host.openSteerPrompt.get(current.id);
|
|
29734
30114
|
const queuedHead = !inFlightEarly && current.status === "queued" && current.queue.length > 0 ? current.queue[0] : null;
|
|
29735
30115
|
const joinCanMerge = draft != null && !draft.spawned || !inFlightEarly && queuedHead != null;
|
|
29736
|
-
const unanswered = followUp === "steer" && !agentHasRepliedEarly && (!
|
|
30116
|
+
const unanswered = followUp === "steer" && !agentHasRepliedEarly && (!join70 || joinCanMerge) ? draft?.text ?? (inFlightEarly ? trailingUnansweredUserText(current.messages) : queuedHead) : null;
|
|
29737
30117
|
if (unanswered != null && (draft ? !draft.spawned : queuedHead != null)) {
|
|
29738
30118
|
clearSendBookkeeping(host, thread.id);
|
|
29739
30119
|
const combined = joinSteerPrompt(unanswered, prompt);
|
|
@@ -29785,7 +30165,7 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
|
|
|
29785
30165
|
clearSendBookkeeping(host, thread.id);
|
|
29786
30166
|
const inFlight = host.activeTurns.has(thread.id) || host.startingTurns.has(thread.id) || current.status === "running";
|
|
29787
30167
|
shouldSteer = sendFollowUpInterrupts(
|
|
29788
|
-
|
|
30168
|
+
join70 ? "join" : followUp,
|
|
29789
30169
|
inFlight || current.queue.length > 0
|
|
29790
30170
|
);
|
|
29791
30171
|
const patch = queued;
|
|
@@ -29813,6 +30193,7 @@ var init_enqueue_thread_send = __esm({
|
|
|
29813
30193
|
"src/orchestrator/enqueue-thread-send.ts"() {
|
|
29814
30194
|
"use strict";
|
|
29815
30195
|
init_agent_git_actions();
|
|
30196
|
+
init_announce_skill();
|
|
29816
30197
|
init_agent_has_replied();
|
|
29817
30198
|
init_expand();
|
|
29818
30199
|
init_consume_attachments();
|
|
@@ -29858,7 +30239,7 @@ function compiledModuleDir() {
|
|
|
29858
30239
|
try {
|
|
29859
30240
|
const url = import_meta9.url;
|
|
29860
30241
|
if (typeof url === "string" && url.length > 0) {
|
|
29861
|
-
return (0,
|
|
30242
|
+
return (0, import_node_path70.dirname)((0, import_node_url7.fileURLToPath)(url));
|
|
29862
30243
|
}
|
|
29863
30244
|
} catch {
|
|
29864
30245
|
}
|
|
@@ -29866,8 +30247,8 @@ function compiledModuleDir() {
|
|
|
29866
30247
|
}
|
|
29867
30248
|
function detachedJobScriptIn(dir) {
|
|
29868
30249
|
for (const name of DETACHED_JOB_FILENAMES) {
|
|
29869
|
-
const script = (0,
|
|
29870
|
-
if ((0,
|
|
30250
|
+
const script = (0, import_node_path70.join)(dir, "scripts", name);
|
|
30251
|
+
if ((0, import_node_fs70.existsSync)(script)) return script;
|
|
29871
30252
|
}
|
|
29872
30253
|
return null;
|
|
29873
30254
|
}
|
|
@@ -29884,7 +30265,7 @@ function resolveDetachedJobScript() {
|
|
|
29884
30265
|
for (let i = 0; i < 8; i++) {
|
|
29885
30266
|
const candidate = detachedJobScriptIn(dir);
|
|
29886
30267
|
if (candidate) return candidate;
|
|
29887
|
-
const parent = (0,
|
|
30268
|
+
const parent = (0, import_node_path70.dirname)(dir);
|
|
29888
30269
|
if (parent === dir) break;
|
|
29889
30270
|
dir = parent;
|
|
29890
30271
|
}
|
|
@@ -29895,12 +30276,12 @@ function formatDetachedJobInvoke(scriptPath) {
|
|
|
29895
30276
|
if (resolved) return `node ${JSON.stringify(resolved)}`;
|
|
29896
30277
|
return "node scripts/detached-job.cjs";
|
|
29897
30278
|
}
|
|
29898
|
-
var
|
|
30279
|
+
var import_node_fs70, import_node_path70, import_node_url7, import_meta9, DETACHED_JOB_FILENAMES;
|
|
29899
30280
|
var init_detached_job_path = __esm({
|
|
29900
30281
|
"src/skills/detached-job-path.ts"() {
|
|
29901
30282
|
"use strict";
|
|
29902
|
-
|
|
29903
|
-
|
|
30283
|
+
import_node_fs70 = require("fs");
|
|
30284
|
+
import_node_path70 = require("path");
|
|
29904
30285
|
import_node_url7 = require("url");
|
|
29905
30286
|
init_packaged_runtime();
|
|
29906
30287
|
import_meta9 = {};
|
|
@@ -30003,6 +30384,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
30003
30384
|
lines.push(
|
|
30004
30385
|
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
30386
|
);
|
|
30387
|
+
if ((0, import_node_fs71.existsSync)((0, import_node_path71.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
30388
|
if (thread.prUrl) {
|
|
30007
30389
|
lines.push(
|
|
30008
30390
|
`- A PR already exists (${thread.prUrl}). Update it (push + edit title/body if the purpose drifted) instead of opening a duplicate.`
|
|
@@ -30029,6 +30411,7 @@ function formatWorktreeDirective(thread, opts) {
|
|
|
30029
30411
|
);
|
|
30030
30412
|
lines.push("");
|
|
30031
30413
|
lines.push(formatDevAccessHint(opts?.activeRuns));
|
|
30414
|
+
lines.push(formatComputerUseHint(computerUseEnabled()));
|
|
30032
30415
|
lines.push("");
|
|
30033
30416
|
lines.push(
|
|
30034
30417
|
"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 +30520,16 @@ function formatPrGateDirective() {
|
|
|
30137
30520
|
}
|
|
30138
30521
|
function formatProcessGuideDirective(opts) {
|
|
30139
30522
|
const worktree = opts?.worktreePath?.trim();
|
|
30140
|
-
const hasGraphSkill = !!worktree && (0,
|
|
30141
|
-
const hasReviewSkill = !!worktree && (0,
|
|
30142
|
-
const hasInstallSkill = !!worktree && (0,
|
|
30523
|
+
const hasGraphSkill = !!worktree && (0, import_node_fs71.existsSync)((0, import_node_path71.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
|
|
30524
|
+
const hasReviewSkill = !!worktree && (0, import_node_fs71.existsSync)((0, import_node_path71.join)(worktree, ".claude/skills/review/SKILL.md"));
|
|
30525
|
+
const hasInstallSkill = !!worktree && (0, import_node_fs71.existsSync)((0, import_node_path71.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
|
|
30143
30526
|
return [
|
|
30144
30527
|
"Process guides (recurring work only):",
|
|
30145
30528
|
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
30529
|
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
30530
|
"- 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
30531
|
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,
|
|
30532
|
+
!!worktree && (0, import_node_fs71.existsSync)((0, import_node_path71.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
30533
|
].filter(Boolean).join("\n");
|
|
30151
30534
|
}
|
|
30152
30535
|
function formatLongRunningDirective(opts) {
|
|
@@ -30179,12 +30562,12 @@ function formatArtifactDirective() {
|
|
|
30179
30562
|
function formatUiReminder() {
|
|
30180
30563
|
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
30564
|
}
|
|
30182
|
-
var
|
|
30565
|
+
var import_node_fs71, import_node_path71, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
|
|
30183
30566
|
var init_instructions = __esm({
|
|
30184
30567
|
"src/agents/instructions.ts"() {
|
|
30185
30568
|
"use strict";
|
|
30186
|
-
|
|
30187
|
-
|
|
30569
|
+
import_node_fs71 = require("fs");
|
|
30570
|
+
import_node_path71 = require("path");
|
|
30188
30571
|
init_git_auth_mode();
|
|
30189
30572
|
init_forge_git_directives();
|
|
30190
30573
|
init_branch_prefix();
|
|
@@ -30192,6 +30575,8 @@ var init_instructions = __esm({
|
|
|
30192
30575
|
init_detached_job_path();
|
|
30193
30576
|
init_global_workspace();
|
|
30194
30577
|
init_connected_orchestrator();
|
|
30578
|
+
init_app_settings();
|
|
30579
|
+
init_computer_use();
|
|
30195
30580
|
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
30581
|
GITHUB_TICKET_REF = /^(?:#?\d+|gh-\d+)$/i;
|
|
30197
30582
|
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 +31239,40 @@ __export(plan_file_exports, {
|
|
|
30854
31239
|
writePlanFile: () => writePlanFile
|
|
30855
31240
|
});
|
|
30856
31241
|
function ensureAttachmentsGitignore(worktreePath) {
|
|
30857
|
-
const gitignoreAbs = (0,
|
|
30858
|
-
if ((0,
|
|
30859
|
-
(0,
|
|
30860
|
-
(0,
|
|
31242
|
+
const gitignoreAbs = (0, import_node_path72.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
|
|
31243
|
+
if ((0, import_node_fs72.existsSync)(gitignoreAbs)) return;
|
|
31244
|
+
(0, import_node_fs72.mkdirSync)((0, import_node_path72.dirname)(gitignoreAbs), { recursive: true });
|
|
31245
|
+
(0, import_node_fs72.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
|
|
30861
31246
|
}
|
|
30862
31247
|
function planFileAbs(worktreePath) {
|
|
30863
|
-
return (0,
|
|
31248
|
+
return (0, import_node_path72.join)(worktreePath, PLAN_FILE_REL);
|
|
30864
31249
|
}
|
|
30865
31250
|
function readTextIfPresent2(abs) {
|
|
30866
|
-
if (!(0,
|
|
31251
|
+
if (!(0, import_node_fs72.existsSync)(abs)) return null;
|
|
30867
31252
|
try {
|
|
30868
|
-
const content = (0,
|
|
31253
|
+
const content = (0, import_node_fs72.readFileSync)(abs, "utf8");
|
|
30869
31254
|
return content.trim() ? content : null;
|
|
30870
31255
|
} catch {
|
|
30871
31256
|
return null;
|
|
30872
31257
|
}
|
|
30873
31258
|
}
|
|
30874
31259
|
function readPlanFile(worktreePath) {
|
|
30875
|
-
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0,
|
|
31260
|
+
return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path72.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path72.join)(worktreePath, LEGACY_PLAN_FILE_REL));
|
|
30876
31261
|
}
|
|
30877
31262
|
function writePlanFile(worktreePath, content) {
|
|
30878
31263
|
ensureAttachmentsGitignore(worktreePath);
|
|
30879
31264
|
const abs = planFileAbs(worktreePath);
|
|
30880
|
-
(0,
|
|
31265
|
+
(0, import_node_fs72.mkdirSync)((0, import_node_path72.dirname)(abs), { recursive: true });
|
|
30881
31266
|
const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
|
|
30882
|
-
(0,
|
|
31267
|
+
(0, import_node_fs72.writeFileSync)(abs, body, "utf8");
|
|
30883
31268
|
return PLAN_FILE_REL;
|
|
30884
31269
|
}
|
|
30885
|
-
var
|
|
31270
|
+
var import_node_fs72, import_node_path72;
|
|
30886
31271
|
var init_plan_file = __esm({
|
|
30887
31272
|
"src/plan/plan-file.ts"() {
|
|
30888
31273
|
"use strict";
|
|
30889
|
-
|
|
30890
|
-
|
|
31274
|
+
import_node_fs72 = require("fs");
|
|
31275
|
+
import_node_path72 = require("path");
|
|
30891
31276
|
init_workspace_scratch();
|
|
30892
31277
|
init_plan_present();
|
|
30893
31278
|
init_plan_present();
|
|
@@ -30936,7 +31321,7 @@ function setCaffeinateHoldHooks(next) {
|
|
|
30936
31321
|
hooks = next;
|
|
30937
31322
|
}
|
|
30938
31323
|
function caffeinateHoldPath() {
|
|
30939
|
-
return (0,
|
|
31324
|
+
return (0, import_node_path73.join)(appDataDir(), "caffeinate-hold.json");
|
|
30940
31325
|
}
|
|
30941
31326
|
function processAlive(pid) {
|
|
30942
31327
|
if (hooks.processAlive) return hooks.processAlive(pid);
|
|
@@ -30970,9 +31355,9 @@ function uniqueIds(ids) {
|
|
|
30970
31355
|
}
|
|
30971
31356
|
function readHold() {
|
|
30972
31357
|
const path = caffeinateHoldPath();
|
|
30973
|
-
if (!(0,
|
|
31358
|
+
if (!(0, import_node_fs73.existsSync)(path)) return null;
|
|
30974
31359
|
try {
|
|
30975
|
-
const parsed = JSON.parse((0,
|
|
31360
|
+
const parsed = JSON.parse((0, import_node_fs73.readFileSync)(path, "utf8"));
|
|
30976
31361
|
if (typeof parsed?.pid === "number" && parsed.pid > 0) {
|
|
30977
31362
|
return {
|
|
30978
31363
|
pid: parsed.pid,
|
|
@@ -30994,7 +31379,7 @@ function writeHold(pid, threadIds) {
|
|
|
30994
31379
|
}
|
|
30995
31380
|
function clearHold() {
|
|
30996
31381
|
try {
|
|
30997
|
-
(0,
|
|
31382
|
+
(0, import_node_fs73.unlinkSync)(caffeinateHoldPath());
|
|
30998
31383
|
} catch {
|
|
30999
31384
|
}
|
|
31000
31385
|
}
|
|
@@ -31052,7 +31437,7 @@ function setCaffeinateHold(enabled, opts) {
|
|
|
31052
31437
|
if (platform !== "darwin") {
|
|
31053
31438
|
return idleState(platform);
|
|
31054
31439
|
}
|
|
31055
|
-
const spawnImpl = hooks.spawn ??
|
|
31440
|
+
const spawnImpl = hooks.spawn ?? import_node_child_process8.spawn;
|
|
31056
31441
|
const child = spawnImpl("caffeinate", ["-dimsu"], {
|
|
31057
31442
|
detached: true,
|
|
31058
31443
|
stdio: "ignore"
|
|
@@ -31079,13 +31464,13 @@ function releaseCaffeinateHoldForThread(threadId) {
|
|
|
31079
31464
|
}
|
|
31080
31465
|
return setCaffeinateHold(false, { threadId: id });
|
|
31081
31466
|
}
|
|
31082
|
-
var
|
|
31467
|
+
var import_node_child_process8, import_node_fs73, import_node_path73, hooks;
|
|
31083
31468
|
var init_caffeinate_hold = __esm({
|
|
31084
31469
|
"src/store/caffeinate-hold.ts"() {
|
|
31085
31470
|
"use strict";
|
|
31086
|
-
|
|
31087
|
-
|
|
31088
|
-
|
|
31471
|
+
import_node_child_process8 = require("child_process");
|
|
31472
|
+
import_node_fs73 = require("fs");
|
|
31473
|
+
import_node_path73 = require("path");
|
|
31089
31474
|
init_paths();
|
|
31090
31475
|
init_private_file();
|
|
31091
31476
|
hooks = {};
|
|
@@ -31363,13 +31748,13 @@ var init_github_edge = __esm({
|
|
|
31363
31748
|
|
|
31364
31749
|
// src/orchestrator/github-edge-watch.ts
|
|
31365
31750
|
function githubEdgeSnapshotPath() {
|
|
31366
|
-
return (0,
|
|
31751
|
+
return (0, import_node_path74.join)(appDataDir(), "github-edge-watch.json");
|
|
31367
31752
|
}
|
|
31368
31753
|
function loadGithubEdgeSnapshot() {
|
|
31369
31754
|
try {
|
|
31370
31755
|
const path = githubEdgeSnapshotPath();
|
|
31371
|
-
if (!(0,
|
|
31372
|
-
return coerceGithubEdgeSnapshot(JSON.parse((0,
|
|
31756
|
+
if (!(0, import_node_fs74.existsSync)(path)) return emptyGithubEdgeSnapshot();
|
|
31757
|
+
return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs74.readFileSync)(path, "utf8")));
|
|
31373
31758
|
} catch {
|
|
31374
31759
|
return emptyGithubEdgeSnapshot();
|
|
31375
31760
|
}
|
|
@@ -31684,12 +32069,12 @@ function realDeps() {
|
|
|
31684
32069
|
now: () => Date.now()
|
|
31685
32070
|
};
|
|
31686
32071
|
}
|
|
31687
|
-
var
|
|
32072
|
+
var import_node_fs74, import_node_path74, timer, polling, needsBaseline;
|
|
31688
32073
|
var init_github_edge_watch = __esm({
|
|
31689
32074
|
"src/orchestrator/github-edge-watch.ts"() {
|
|
31690
32075
|
"use strict";
|
|
31691
|
-
|
|
31692
|
-
|
|
32076
|
+
import_node_fs74 = require("fs");
|
|
32077
|
+
import_node_path74 = require("path");
|
|
31693
32078
|
init_pr_gates();
|
|
31694
32079
|
init_pr_merge_archive();
|
|
31695
32080
|
init_worktree();
|
|
@@ -31972,9 +32357,9 @@ function recoverFinishedCursorRun(opts) {
|
|
|
31972
32357
|
return best;
|
|
31973
32358
|
}
|
|
31974
32359
|
function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
31975
|
-
if (!(0,
|
|
32360
|
+
if (!(0, import_node_fs75.existsSync)(runsPath)) return null;
|
|
31976
32361
|
try {
|
|
31977
|
-
const lines = (0,
|
|
32362
|
+
const lines = (0, import_node_fs75.readFileSync)(runsPath, "utf8").split("\n");
|
|
31978
32363
|
let best = null;
|
|
31979
32364
|
for (const line of lines) {
|
|
31980
32365
|
const trimmed = line.trim();
|
|
@@ -32000,11 +32385,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
|
|
|
32000
32385
|
return null;
|
|
32001
32386
|
}
|
|
32002
32387
|
}
|
|
32003
|
-
var
|
|
32388
|
+
var import_node_fs75;
|
|
32004
32389
|
var init_cursor_recover = __esm({
|
|
32005
32390
|
"src/agents/cursor-recover.ts"() {
|
|
32006
32391
|
"use strict";
|
|
32007
|
-
|
|
32392
|
+
import_node_fs75 = require("fs");
|
|
32008
32393
|
init_cursor_store();
|
|
32009
32394
|
}
|
|
32010
32395
|
});
|
|
@@ -32108,7 +32493,7 @@ async function startOrchestration(opts) {
|
|
|
32108
32493
|
}
|
|
32109
32494
|
return ready;
|
|
32110
32495
|
}
|
|
32111
|
-
var import_node_events, import_node_crypto21,
|
|
32496
|
+
var import_node_events, import_node_crypto21, import_node_fs76, LIVE_TURN_SPAWN_GRACE_MS, RUN_SCRIPT_DESKTOP_ADOPT_MS, STALE_AGENT_PID_WAIT_MS, LIGHT_RECONCILE_THROTTLE_MS, Orchestrator, singleton2;
|
|
32112
32497
|
var init_orchestrator = __esm({
|
|
32113
32498
|
"src/orchestrator/orchestrator.ts"() {
|
|
32114
32499
|
"use strict";
|
|
@@ -32117,7 +32502,7 @@ var init_orchestrator = __esm({
|
|
|
32117
32502
|
init_task_state();
|
|
32118
32503
|
init_wait_for_turn();
|
|
32119
32504
|
import_node_crypto21 = require("crypto");
|
|
32120
|
-
|
|
32505
|
+
import_node_fs76 = require("fs");
|
|
32121
32506
|
init_error_detail();
|
|
32122
32507
|
init_run();
|
|
32123
32508
|
init_stale_lock();
|
|
@@ -32129,6 +32514,7 @@ var init_orchestrator = __esm({
|
|
|
32129
32514
|
init_worktree_leftovers();
|
|
32130
32515
|
init_stack();
|
|
32131
32516
|
init_agent_git_actions();
|
|
32517
|
+
init_announce_skill();
|
|
32132
32518
|
init_pr_merge_archive();
|
|
32133
32519
|
init_pr_gates();
|
|
32134
32520
|
init_conductor();
|
|
@@ -32321,7 +32707,7 @@ var init_orchestrator = __esm({
|
|
|
32321
32707
|
this.lightReconcileAt.set(repoPath, Date.now());
|
|
32322
32708
|
for (const thread of listThreads()) {
|
|
32323
32709
|
if (isGlobalThread(thread) || thread.repoPath !== repoPath) continue;
|
|
32324
|
-
if (!(0,
|
|
32710
|
+
if (!(0, import_node_fs76.existsSync)(thread.worktreePath)) {
|
|
32325
32711
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
32326
32712
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
32327
32713
|
}
|
|
@@ -32350,7 +32736,7 @@ var init_orchestrator = __esm({
|
|
|
32350
32736
|
}
|
|
32351
32737
|
continue;
|
|
32352
32738
|
}
|
|
32353
|
-
if (!(0,
|
|
32739
|
+
if (!(0, import_node_fs76.existsSync)(thread.worktreePath)) {
|
|
32354
32740
|
setStatus(thread.id, "broken", "Worktree missing on disk");
|
|
32355
32741
|
this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
|
|
32356
32742
|
continue;
|
|
@@ -33078,7 +33464,11 @@ var init_orchestrator = __esm({
|
|
|
33078
33464
|
}
|
|
33079
33465
|
thread = this.requireThread(threadId);
|
|
33080
33466
|
const turnOrigin = thread.worktreePath?.trim() ? await resolveOriginRemote(thread.worktreePath).catch(() => null) : null;
|
|
33081
|
-
const gitPrompt = expandCanonicalGitRequest(promptText, {
|
|
33467
|
+
const gitPrompt = expandCanonicalGitRequest(promptText, {
|
|
33468
|
+
forge: turnOrigin?.forge,
|
|
33469
|
+
worktreePath: thread.worktreePath,
|
|
33470
|
+
hasAnnounceSkill: announceSkillPresent(thread.worktreePath)
|
|
33471
|
+
});
|
|
33082
33472
|
const expandedAttachments = openSteerTurnAttachments(this.openSteerPrompt.get(threadId), turnAttachments, autoContinue);
|
|
33083
33473
|
const { agentPrompt: expandedPrompt } = expandComposerPrompt(
|
|
33084
33474
|
thread.worktreePath,
|
|
@@ -34836,7 +35226,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
|
|
|
34836
35226
|
this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
|
|
34837
35227
|
return restored2;
|
|
34838
35228
|
}
|
|
34839
|
-
if (!(0,
|
|
35229
|
+
if (!(0, import_node_fs76.existsSync)(thread.worktreePath)) {
|
|
34840
35230
|
if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
|
|
34841
35231
|
throw new Error(
|
|
34842
35232
|
`Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
|
|
@@ -35026,9 +35416,9 @@ function createClippedMcpServer() {
|
|
|
35026
35416
|
}
|
|
35027
35417
|
|
|
35028
35418
|
// src/mcp/server.ts
|
|
35029
|
-
var
|
|
35419
|
+
var import_zod14 = require("zod");
|
|
35030
35420
|
var import_node_crypto26 = require("crypto");
|
|
35031
|
-
var
|
|
35421
|
+
var import_node_path79 = require("path");
|
|
35032
35422
|
init_orchestrator();
|
|
35033
35423
|
init_task_state();
|
|
35034
35424
|
init_worktree();
|
|
@@ -35777,6 +36167,38 @@ function resolveRunScriptThreadRef(ref) {
|
|
|
35777
36167
|
return thread.id;
|
|
35778
36168
|
}
|
|
35779
36169
|
|
|
36170
|
+
// src/mcp/computer-use-tool.ts
|
|
36171
|
+
var import_zod4 = require("zod");
|
|
36172
|
+
init_computer_use();
|
|
36173
|
+
init_app_settings();
|
|
36174
|
+
init_issue_list();
|
|
36175
|
+
function registerComputerUseTool(server, catalog) {
|
|
36176
|
+
if (!catalog.has("computer_use")) return;
|
|
36177
|
+
server.tool(
|
|
36178
|
+
"computer_use",
|
|
36179
|
+
COMPUTER_USE_DESCRIPTION,
|
|
36180
|
+
{
|
|
36181
|
+
action: import_zod4.z.enum(["screenshot", "click", "type", "key", "scroll"]).describe("screenshot, click, type, key, or scroll"),
|
|
36182
|
+
x: import_zod4.z.number().optional().describe("Screen x in points, not PNG pixels, for click and scroll"),
|
|
36183
|
+
y: import_zod4.z.number().optional().describe("Screen y in points, not PNG pixels, for click and scroll"),
|
|
36184
|
+
text: import_zod4.z.string().optional().describe("Text to type"),
|
|
36185
|
+
key: import_zod4.z.string().optional().describe("One key: return, tab, escape, arrows, delete, or one character"),
|
|
36186
|
+
modifiers: import_zod4.z.array(import_zod4.z.string()).optional().describe("command, shift, option, control"),
|
|
36187
|
+
dx: import_zod4.z.number().optional().describe("Horizontal scroll in points. Positive is right"),
|
|
36188
|
+
dy: import_zod4.z.number().optional().describe("Vertical scroll in points. Positive is down")
|
|
36189
|
+
},
|
|
36190
|
+
async (args) => {
|
|
36191
|
+
const result = await performComputerUse({
|
|
36192
|
+
enabled: computerUseEnabled(),
|
|
36193
|
+
cwd: process.cwd(),
|
|
36194
|
+
input: args,
|
|
36195
|
+
runner: macosComputerUseRunner
|
|
36196
|
+
});
|
|
36197
|
+
return mcpJson(result);
|
|
36198
|
+
}
|
|
36199
|
+
);
|
|
36200
|
+
}
|
|
36201
|
+
|
|
35780
36202
|
// src/mcp/server.ts
|
|
35781
36203
|
init_chat_tabs();
|
|
35782
36204
|
init_connected_orchestrator();
|
|
@@ -36043,13 +36465,13 @@ function childThreadRefs(parentId, threads) {
|
|
|
36043
36465
|
init_app_settings();
|
|
36044
36466
|
|
|
36045
36467
|
// src/mcp/abletime-tools.ts
|
|
36046
|
-
var
|
|
36468
|
+
var import_zod6 = require("zod");
|
|
36047
36469
|
init_abletime();
|
|
36048
36470
|
init_issue_since();
|
|
36049
36471
|
init_issue_list();
|
|
36050
36472
|
|
|
36051
36473
|
// src/mcp/issue-payload.ts
|
|
36052
|
-
var
|
|
36474
|
+
var import_zod5 = require("zod");
|
|
36053
36475
|
init_abletime();
|
|
36054
36476
|
|
|
36055
36477
|
// src/mcp/smart-crush.ts
|
|
@@ -36295,7 +36717,7 @@ function crushMarkdown(text8, opts) {
|
|
|
36295
36717
|
|
|
36296
36718
|
// src/mcp/issue-payload.ts
|
|
36297
36719
|
var MCP_ISSUE_INCLUDE_VALUES = ["default", "full"];
|
|
36298
|
-
var mcpIssueIncludeSchema =
|
|
36720
|
+
var mcpIssueIncludeSchema = import_zod5.z.enum(MCP_ISSUE_INCLUDE_VALUES).optional().describe(
|
|
36299
36721
|
"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
36722
|
);
|
|
36301
36723
|
var MCP_ISSUE_CRUSH_HINT = "Pass include=full to re-fetch the uncompressed ticket from the vendor.";
|
|
@@ -36441,7 +36863,7 @@ function registerAbleTimeTools(server) {
|
|
|
36441
36863
|
server.tool(
|
|
36442
36864
|
"abletime_list_tasks",
|
|
36443
36865
|
"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:
|
|
36866
|
+
{ projectId: import_zod6.z.string().optional(), updatedSince: mcpIssueUpdatedSinceSchema },
|
|
36445
36867
|
async ({ projectId, updatedSince }) => {
|
|
36446
36868
|
try {
|
|
36447
36869
|
const tasks = await listAbleTimeTasks({ projectId });
|
|
@@ -36454,7 +36876,7 @@ function registerAbleTimeTools(server) {
|
|
|
36454
36876
|
server.tool(
|
|
36455
36877
|
"abletime_search_tasks",
|
|
36456
36878
|
"Search AbleTime tasks by text, reference, or tag. Pass updatedSince for tasks updated since then and any comments on that page.",
|
|
36457
|
-
{ query:
|
|
36879
|
+
{ query: import_zod6.z.string(), updatedSince: mcpIssueUpdatedSinceSchema },
|
|
36458
36880
|
async ({ query, updatedSince }) => {
|
|
36459
36881
|
try {
|
|
36460
36882
|
const tasks = await searchAbleTimeTasks(query);
|
|
@@ -36467,7 +36889,7 @@ function registerAbleTimeTools(server) {
|
|
|
36467
36889
|
server.tool(
|
|
36468
36890
|
"abletime_get_task",
|
|
36469
36891
|
"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:
|
|
36892
|
+
{ id: import_zod6.z.string(), include: mcpIssueIncludeSchema },
|
|
36471
36893
|
async ({ id, include }) => {
|
|
36472
36894
|
try {
|
|
36473
36895
|
return text3(formatAbleTimeTaskPayload(await getAbleTimeTask(id), include));
|
|
@@ -36480,9 +36902,9 @@ function registerAbleTimeTools(server) {
|
|
|
36480
36902
|
"abletime_download_attachment",
|
|
36481
36903
|
"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
36904
|
{
|
|
36483
|
-
id:
|
|
36484
|
-
name:
|
|
36485
|
-
repoPath:
|
|
36905
|
+
id: import_zod6.z.string().describe("Attachment id or URL from abletime_get_task."),
|
|
36906
|
+
name: import_zod6.z.string().optional().describe("Optional filename override."),
|
|
36907
|
+
repoPath: import_zod6.z.string().optional().describe("Workspace / worktree path. Omit on a worktree turn (uses cwd).")
|
|
36486
36908
|
},
|
|
36487
36909
|
async ({ id, name, repoPath }) => {
|
|
36488
36910
|
try {
|
|
@@ -36495,7 +36917,7 @@ function registerAbleTimeTools(server) {
|
|
|
36495
36917
|
server.tool(
|
|
36496
36918
|
"abletime_comment",
|
|
36497
36919
|
"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:
|
|
36920
|
+
{ id: import_zod6.z.string(), body: import_zod6.z.string() },
|
|
36499
36921
|
async (args) => {
|
|
36500
36922
|
try {
|
|
36501
36923
|
return text3(await commentAbleTimeTask(args));
|
|
@@ -36504,23 +36926,23 @@ function registerAbleTimeTools(server) {
|
|
|
36504
36926
|
}
|
|
36505
36927
|
}
|
|
36506
36928
|
);
|
|
36507
|
-
const relationInputSchema =
|
|
36508
|
-
type:
|
|
36509
|
-
issue:
|
|
36929
|
+
const relationInputSchema = import_zod6.z.object({
|
|
36930
|
+
type: import_zod6.z.string().describe("blockedBy (this waits on issue) or blocks (issue waits on this)."),
|
|
36931
|
+
issue: import_zod6.z.string().describe("Related task id or reference (CRM-232).")
|
|
36510
36932
|
});
|
|
36511
36933
|
server.tool(
|
|
36512
36934
|
"abletime_update_task",
|
|
36513
36935
|
'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
36936
|
{
|
|
36515
|
-
id:
|
|
36516
|
-
title:
|
|
36517
|
-
description:
|
|
36518
|
-
state:
|
|
36519
|
-
labels:
|
|
36520
|
-
project:
|
|
36521
|
-
parent:
|
|
36522
|
-
relations:
|
|
36523
|
-
removeRelations:
|
|
36937
|
+
id: import_zod6.z.string(),
|
|
36938
|
+
title: import_zod6.z.string().optional(),
|
|
36939
|
+
description: import_zod6.z.string().optional(),
|
|
36940
|
+
state: import_zod6.z.string().optional(),
|
|
36941
|
+
labels: import_zod6.z.array(import_zod6.z.string()).optional().describe("Replace tags/labels. Empty array clears when the host accepts it."),
|
|
36942
|
+
project: import_zod6.z.string().nullable().optional().describe("Project name or id. AbleTime tasks stay in a project."),
|
|
36943
|
+
parent: import_zod6.z.string().nullable().optional().describe('Parent task id or reference (CRM-232), or "none" to unset.'),
|
|
36944
|
+
relations: import_zod6.z.array(relationInputSchema).optional().describe("Set a wait-on dependency: blockedBy or blocks."),
|
|
36945
|
+
removeRelations: import_zod6.z.array(relationInputSchema).optional().describe("Clear a wait-on dependency.")
|
|
36524
36946
|
},
|
|
36525
36947
|
async (args) => {
|
|
36526
36948
|
try {
|
|
@@ -36539,12 +36961,12 @@ function registerAbleTimeTools(server) {
|
|
|
36539
36961
|
"abletime_create_task",
|
|
36540
36962
|
"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
36963
|
{
|
|
36542
|
-
title:
|
|
36543
|
-
description:
|
|
36544
|
-
projectId:
|
|
36545
|
-
categoryId:
|
|
36546
|
-
state:
|
|
36547
|
-
parent:
|
|
36964
|
+
title: import_zod6.z.string(),
|
|
36965
|
+
description: import_zod6.z.string().optional(),
|
|
36966
|
+
projectId: import_zod6.z.string().optional(),
|
|
36967
|
+
categoryId: import_zod6.z.string().optional(),
|
|
36968
|
+
state: import_zod6.z.enum(["backlog", "todo"]).optional(),
|
|
36969
|
+
parent: import_zod6.z.string().optional().describe("Parent task id or reference (CRM-232) for a spin-off.")
|
|
36548
36970
|
},
|
|
36549
36971
|
async (args) => {
|
|
36550
36972
|
try {
|
|
@@ -36558,10 +36980,10 @@ function registerAbleTimeTools(server) {
|
|
|
36558
36980
|
"abletime_ensure_task",
|
|
36559
36981
|
"Find or create an AbleTime task for this work, then create_workspace with sourceType=ticket.",
|
|
36560
36982
|
{
|
|
36561
|
-
title:
|
|
36562
|
-
description:
|
|
36563
|
-
projectId:
|
|
36564
|
-
categoryId:
|
|
36983
|
+
title: import_zod6.z.string(),
|
|
36984
|
+
description: import_zod6.z.string().optional(),
|
|
36985
|
+
projectId: import_zod6.z.string().optional(),
|
|
36986
|
+
categoryId: import_zod6.z.string().optional()
|
|
36565
36987
|
},
|
|
36566
36988
|
async (args) => {
|
|
36567
36989
|
try {
|
|
@@ -36575,7 +36997,7 @@ function registerAbleTimeTools(server) {
|
|
|
36575
36997
|
}
|
|
36576
36998
|
|
|
36577
36999
|
// src/mcp/github-tools.ts
|
|
36578
|
-
var
|
|
37000
|
+
var import_zod7 = require("zod");
|
|
36579
37001
|
init_worktree();
|
|
36580
37002
|
init_issue_since();
|
|
36581
37003
|
init_issue_list();
|
|
@@ -36592,15 +37014,15 @@ async function cursorIssueBlock(repoPath) {
|
|
|
36592
37014
|
const cwd = await resolveRepoRoot((repoPath ?? "").trim() || process.cwd());
|
|
36593
37015
|
return cursorIssuesUnavailableReason(cwd);
|
|
36594
37016
|
}
|
|
36595
|
-
var repoPathSchema =
|
|
37017
|
+
var repoPathSchema = import_zod7.z.string().optional().describe("Workspace / worktree path. Omit on a worktree turn (uses cwd).");
|
|
36596
37018
|
function registerGithubIssueTools(server) {
|
|
36597
37019
|
server.tool(
|
|
36598
37020
|
"github_search_issues",
|
|
36599
37021
|
"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
37022
|
{
|
|
36601
|
-
query:
|
|
36602
|
-
assignee:
|
|
36603
|
-
limit:
|
|
37023
|
+
query: import_zod7.z.string().optional().describe("Search text (title, body, identifiers). Omit to list by assignee only."),
|
|
37024
|
+
assignee: import_zod7.z.string().optional().describe("me, unassigned, all, or a GitHub login. Default: all when query is set, otherwise me."),
|
|
37025
|
+
limit: import_zod7.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
36604
37026
|
updatedSince: mcpIssueUpdatedSinceSchema,
|
|
36605
37027
|
repoPath: repoPathSchema
|
|
36606
37028
|
},
|
|
@@ -36663,7 +37085,7 @@ function registerGithubIssueTools(server) {
|
|
|
36663
37085
|
server.tool(
|
|
36664
37086
|
"github_get_issue",
|
|
36665
37087
|
"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:
|
|
37088
|
+
{ id: import_zod7.z.string(), include: mcpIssueIncludeSchema, repoPath: repoPathSchema },
|
|
36667
37089
|
async ({ id, include, repoPath }) => {
|
|
36668
37090
|
try {
|
|
36669
37091
|
const blocked = await cursorIssueBlock(repoPath);
|
|
@@ -36678,8 +37100,8 @@ function registerGithubIssueTools(server) {
|
|
|
36678
37100
|
"github_download_attachment",
|
|
36679
37101
|
"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
37102
|
{
|
|
36681
|
-
url:
|
|
36682
|
-
name:
|
|
37103
|
+
url: import_zod7.z.string().describe("Attachment URL from github_get_issue."),
|
|
37104
|
+
name: import_zod7.z.string().optional().describe("Optional filename override."),
|
|
36683
37105
|
repoPath: repoPathSchema
|
|
36684
37106
|
},
|
|
36685
37107
|
async ({ url, name, repoPath }) => {
|
|
@@ -36693,7 +37115,7 @@ function registerGithubIssueTools(server) {
|
|
|
36693
37115
|
server.tool(
|
|
36694
37116
|
"github_comment",
|
|
36695
37117
|
"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:
|
|
37118
|
+
{ id: import_zod7.z.string(), body: import_zod7.z.string(), repoPath: repoPathSchema },
|
|
36697
37119
|
async ({ id, body, repoPath }) => {
|
|
36698
37120
|
try {
|
|
36699
37121
|
const blocked = await cursorIssueBlock(repoPath);
|
|
@@ -36704,23 +37126,23 @@ function registerGithubIssueTools(server) {
|
|
|
36704
37126
|
}
|
|
36705
37127
|
}
|
|
36706
37128
|
);
|
|
36707
|
-
const relationInputSchema =
|
|
36708
|
-
type:
|
|
36709
|
-
issue:
|
|
37129
|
+
const relationInputSchema = import_zod7.z.object({
|
|
37130
|
+
type: import_zod7.z.string().describe("blocks or blockedBy (this issue's view)."),
|
|
37131
|
+
issue: import_zod7.z.string().describe("Related issue #123 or URL.")
|
|
36710
37132
|
});
|
|
36711
37133
|
server.tool(
|
|
36712
37134
|
"github_update_issue",
|
|
36713
37135
|
'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
37136
|
{
|
|
36715
|
-
id:
|
|
36716
|
-
title:
|
|
36717
|
-
body:
|
|
36718
|
-
state:
|
|
36719
|
-
labels:
|
|
36720
|
-
project:
|
|
36721
|
-
parent:
|
|
36722
|
-
relations:
|
|
36723
|
-
removeRelations:
|
|
37137
|
+
id: import_zod7.z.string(),
|
|
37138
|
+
title: import_zod7.z.string().optional(),
|
|
37139
|
+
body: import_zod7.z.string().optional(),
|
|
37140
|
+
state: import_zod7.z.string().optional().describe("open or closed"),
|
|
37141
|
+
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."),
|
|
37142
|
+
project: import_zod7.z.string().nullable().optional().describe('GitHub Project title, or "none" to remove current projects.'),
|
|
37143
|
+
parent: import_zod7.z.string().nullable().optional().describe('Parent issue #123 or URL, or "none" to unset.'),
|
|
37144
|
+
relations: import_zod7.z.array(relationInputSchema).optional().describe("Add blockedBy or blocks relations (issue #123 or URL)."),
|
|
37145
|
+
removeRelations: import_zod7.z.array(relationInputSchema).optional().describe("Remove blockedBy or blocks relations."),
|
|
36724
37146
|
repoPath: repoPathSchema
|
|
36725
37147
|
},
|
|
36726
37148
|
async (args) => {
|
|
@@ -36737,9 +37159,9 @@ function registerGithubIssueTools(server) {
|
|
|
36737
37159
|
"github_create_issue",
|
|
36738
37160
|
"Create a GitHub issue. Pass parent (#123) to mark a spin-off in the body.",
|
|
36739
37161
|
{
|
|
36740
|
-
title:
|
|
36741
|
-
body:
|
|
36742
|
-
parent:
|
|
37162
|
+
title: import_zod7.z.string(),
|
|
37163
|
+
body: import_zod7.z.string().optional(),
|
|
37164
|
+
parent: import_zod7.z.string().optional().describe("Parent issue #123 or URL for a spin-off."),
|
|
36743
37165
|
repoPath: repoPathSchema
|
|
36744
37166
|
},
|
|
36745
37167
|
async (args) => {
|
|
@@ -36755,7 +37177,7 @@ function registerGithubIssueTools(server) {
|
|
|
36755
37177
|
}
|
|
36756
37178
|
|
|
36757
37179
|
// src/mcp/linear-tools.ts
|
|
36758
|
-
var
|
|
37180
|
+
var import_zod8 = require("zod");
|
|
36759
37181
|
init_issue_since();
|
|
36760
37182
|
init_linear();
|
|
36761
37183
|
init_issue_list();
|
|
@@ -36768,7 +37190,7 @@ function fail3(err) {
|
|
|
36768
37190
|
true
|
|
36769
37191
|
);
|
|
36770
37192
|
}
|
|
36771
|
-
var prioritySchema =
|
|
37193
|
+
var prioritySchema = import_zod8.z.number().int().min(0).max(4).optional().describe("0 none, 1 urgent, 2 high, 3 medium, 4 low");
|
|
36772
37194
|
function registerLinearTools(server) {
|
|
36773
37195
|
server.tool(
|
|
36774
37196
|
"linear_list_teams",
|
|
@@ -36798,9 +37220,9 @@ function registerLinearTools(server) {
|
|
|
36798
37220
|
"linear_search_issues",
|
|
36799
37221
|
"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
37222
|
{
|
|
36801
|
-
query:
|
|
36802
|
-
assignee:
|
|
36803
|
-
limit:
|
|
37223
|
+
query: import_zod8.z.string().optional().describe("Search text (identifier, title, description). Omit to list by assignee only."),
|
|
37224
|
+
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."),
|
|
37225
|
+
limit: import_zod8.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
36804
37226
|
updatedSince: mcpIssueUpdatedSinceSchema
|
|
36805
37227
|
},
|
|
36806
37228
|
async ({ query, assignee, limit, updatedSince }) => {
|
|
@@ -36840,7 +37262,7 @@ function registerLinearTools(server) {
|
|
|
36840
37262
|
server.tool(
|
|
36841
37263
|
"linear_get_issue",
|
|
36842
37264
|
"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:
|
|
37265
|
+
{ id: import_zod8.z.string(), include: mcpIssueIncludeSchema },
|
|
36844
37266
|
async ({ id, include }) => {
|
|
36845
37267
|
try {
|
|
36846
37268
|
return text5(formatLinearIssuePayload(await getLinearIssue(id), include));
|
|
@@ -36853,9 +37275,9 @@ function registerLinearTools(server) {
|
|
|
36853
37275
|
"linear_download_attachment",
|
|
36854
37276
|
"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
37277
|
{
|
|
36856
|
-
id:
|
|
36857
|
-
name:
|
|
36858
|
-
repoPath:
|
|
37278
|
+
id: import_zod8.z.string().describe("Attachment uuid or upload URL from linear_get_issue."),
|
|
37279
|
+
name: import_zod8.z.string().optional().describe("Optional filename override."),
|
|
37280
|
+
repoPath: import_zod8.z.string().optional().describe("Workspace / worktree path. Omit on a worktree turn (uses cwd).")
|
|
36859
37281
|
},
|
|
36860
37282
|
async ({ id, name, repoPath }) => {
|
|
36861
37283
|
try {
|
|
@@ -36869,13 +37291,13 @@ function registerLinearTools(server) {
|
|
|
36869
37291
|
"linear_create_issue",
|
|
36870
37292
|
'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
37293
|
{
|
|
36872
|
-
team:
|
|
36873
|
-
title:
|
|
36874
|
-
description:
|
|
36875
|
-
state:
|
|
36876
|
-
assignee:
|
|
37294
|
+
team: import_zod8.z.string(),
|
|
37295
|
+
title: import_zod8.z.string(),
|
|
37296
|
+
description: import_zod8.z.string().optional(),
|
|
37297
|
+
state: import_zod8.z.string().optional(),
|
|
37298
|
+
assignee: import_zod8.z.string().nullable().optional(),
|
|
36877
37299
|
priority: prioritySchema,
|
|
36878
|
-
parent:
|
|
37300
|
+
parent: import_zod8.z.string().optional().describe("Parent issue uuid or identifier (ENG-123) for a spin-off / sub-issue.")
|
|
36879
37301
|
},
|
|
36880
37302
|
async (args) => {
|
|
36881
37303
|
try {
|
|
@@ -36885,26 +37307,26 @@ function registerLinearTools(server) {
|
|
|
36885
37307
|
}
|
|
36886
37308
|
}
|
|
36887
37309
|
);
|
|
36888
|
-
const relationInputSchema =
|
|
36889
|
-
type:
|
|
36890
|
-
issue:
|
|
37310
|
+
const relationInputSchema = import_zod8.z.object({
|
|
37311
|
+
type: import_zod8.z.string().describe("blocks, blockedBy, related, duplicate, or duplicateOf (this issue's view)."),
|
|
37312
|
+
issue: import_zod8.z.string().describe("Related issue uuid or identifier (ENG-123).")
|
|
36891
37313
|
});
|
|
36892
37314
|
server.tool(
|
|
36893
37315
|
"linear_update_issue",
|
|
36894
37316
|
'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
37317
|
{
|
|
36896
|
-
id:
|
|
36897
|
-
title:
|
|
36898
|
-
description:
|
|
36899
|
-
state:
|
|
36900
|
-
assignee:
|
|
37318
|
+
id: import_zod8.z.string(),
|
|
37319
|
+
title: import_zod8.z.string().optional(),
|
|
37320
|
+
description: import_zod8.z.string().optional(),
|
|
37321
|
+
state: import_zod8.z.string().optional(),
|
|
37322
|
+
assignee: import_zod8.z.string().nullable().optional(),
|
|
36901
37323
|
priority: prioritySchema,
|
|
36902
|
-
cycle:
|
|
36903
|
-
labels:
|
|
36904
|
-
project:
|
|
36905
|
-
parent:
|
|
36906
|
-
relations:
|
|
36907
|
-
removeRelations:
|
|
37324
|
+
cycle: import_zod8.z.string().nullable().optional().describe('Cycle name, number, "current"/"active", or "none" to unschedule.'),
|
|
37325
|
+
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."),
|
|
37326
|
+
project: import_zod8.z.string().nullable().optional().describe('Project name, id, slug, or "none" to unassign.'),
|
|
37327
|
+
parent: import_zod8.z.string().nullable().optional().describe('Parent issue uuid or identifier (ENG-123), or "none" to unset.'),
|
|
37328
|
+
relations: import_zod8.z.array(relationInputSchema).optional().describe("Add relations from this issue's view (blocks, blockedBy, related, duplicate, duplicateOf)."),
|
|
37329
|
+
removeRelations: import_zod8.z.array(relationInputSchema).optional().describe("Remove relations by type + related issue (uuid or ENG-123).")
|
|
36908
37330
|
},
|
|
36909
37331
|
async (args) => {
|
|
36910
37332
|
try {
|
|
@@ -36918,8 +37340,8 @@ function registerLinearTools(server) {
|
|
|
36918
37340
|
"linear_comment",
|
|
36919
37341
|
"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
37342
|
{
|
|
36921
|
-
id:
|
|
36922
|
-
body:
|
|
37343
|
+
id: import_zod8.z.string(),
|
|
37344
|
+
body: import_zod8.z.string()
|
|
36923
37345
|
},
|
|
36924
37346
|
async (args) => {
|
|
36925
37347
|
try {
|
|
@@ -36939,7 +37361,7 @@ function registerConnectedIssueVendorTools(server, settings = loadAppSettings())
|
|
|
36939
37361
|
}
|
|
36940
37362
|
|
|
36941
37363
|
// src/mcp/posthog-tools.ts
|
|
36942
|
-
var
|
|
37364
|
+
var import_zod9 = require("zod");
|
|
36943
37365
|
init_fetch();
|
|
36944
37366
|
init_optional_services();
|
|
36945
37367
|
|
|
@@ -37156,13 +37578,13 @@ function registerPosthogTools(server) {
|
|
|
37156
37578
|
"posthog_api",
|
|
37157
37579
|
POSTHOG_API_DESCRIPTION,
|
|
37158
37580
|
{
|
|
37159
|
-
method:
|
|
37581
|
+
method: import_zod9.z.enum(POSTHOG_METHODS).describe(
|
|
37160
37582
|
"GET, POST /api/projects|environments/:id/query/ for a read, or POST/PATCH when the user asked for a change"
|
|
37161
37583
|
),
|
|
37162
|
-
path:
|
|
37163
|
-
query:
|
|
37164
|
-
body:
|
|
37165
|
-
write:
|
|
37584
|
+
path: import_zod9.z.string().describe("PostHog path starting with /api/, not a full URL"),
|
|
37585
|
+
query: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).optional().describe("Query string parameters"),
|
|
37586
|
+
body: import_zod9.z.unknown().optional().describe("JSON body for POST or PATCH"),
|
|
37587
|
+
write: import_zod9.z.boolean().optional().describe(
|
|
37166
37588
|
"Required true for POST and PATCH that change data. Omit for GET and for POST .../query/."
|
|
37167
37589
|
)
|
|
37168
37590
|
},
|
|
@@ -37214,7 +37636,7 @@ init_list_prs();
|
|
|
37214
37636
|
init_app_settings();
|
|
37215
37637
|
|
|
37216
37638
|
// src/mcp/archive-tools.ts
|
|
37217
|
-
var
|
|
37639
|
+
var import_zod10 = require("zod");
|
|
37218
37640
|
init_fleet_archive();
|
|
37219
37641
|
init_chat_tabs();
|
|
37220
37642
|
|
|
@@ -37234,9 +37656,9 @@ function registerArchiveTools(server, orch) {
|
|
|
37234
37656
|
"list_archive",
|
|
37235
37657
|
"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
37658
|
{
|
|
37237
|
-
query:
|
|
37238
|
-
kind:
|
|
37239
|
-
limit:
|
|
37659
|
+
query: import_zod10.z.string().optional().describe("Title, branch, repo, agent, ticket, or PR"),
|
|
37660
|
+
kind: import_zod10.z.enum(["all", "workspace", "agent"]).optional().describe("all (default), workspace, or agent"),
|
|
37661
|
+
limit: import_zod10.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250)")
|
|
37240
37662
|
},
|
|
37241
37663
|
async ({ query, kind, limit }) => {
|
|
37242
37664
|
const view = listFleetArchive(orch.getThreads(true), { query, kind, limit });
|
|
@@ -37246,7 +37668,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37246
37668
|
server.tool(
|
|
37247
37669
|
"archive_workspace",
|
|
37248
37670
|
"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:
|
|
37671
|
+
{ ref: import_zod10.z.string().describe("Any chat id on the workspace") },
|
|
37250
37672
|
async ({ ref }) => {
|
|
37251
37673
|
const thread = orch.getThread(ref);
|
|
37252
37674
|
if (!thread) {
|
|
@@ -37279,7 +37701,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37279
37701
|
server.tool(
|
|
37280
37702
|
"archive_chat",
|
|
37281
37703
|
"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:
|
|
37704
|
+
{ ref: import_zod10.z.string().describe("Chat id to archive") },
|
|
37283
37705
|
async ({ ref }) => {
|
|
37284
37706
|
const t = orch.getThread(ref);
|
|
37285
37707
|
if (!t) {
|
|
@@ -37305,7 +37727,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37305
37727
|
server.tool(
|
|
37306
37728
|
"restore_workspace",
|
|
37307
37729
|
"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:
|
|
37730
|
+
{ ref: import_zod10.z.string().describe("Any chat id from list_archive on that workspace") },
|
|
37309
37731
|
async ({ ref }) => {
|
|
37310
37732
|
try {
|
|
37311
37733
|
const restored = await orch.restoreWorkspace(ref);
|
|
@@ -37329,7 +37751,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37329
37751
|
server.tool(
|
|
37330
37752
|
"restore_chat",
|
|
37331
37753
|
"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:
|
|
37754
|
+
{ ref: import_zod10.z.string().describe("Archived chat id from list_archive") },
|
|
37333
37755
|
async ({ ref }) => {
|
|
37334
37756
|
try {
|
|
37335
37757
|
const restored = await orch.restore(ref);
|
|
@@ -37347,7 +37769,7 @@ function registerArchiveTools(server, orch) {
|
|
|
37347
37769
|
}
|
|
37348
37770
|
|
|
37349
37771
|
// src/mcp/schedule-tools.ts
|
|
37350
|
-
var
|
|
37772
|
+
var import_zod11 = require("zod");
|
|
37351
37773
|
init_schedules();
|
|
37352
37774
|
init_schedule_runner();
|
|
37353
37775
|
init_issue_list();
|
|
@@ -37451,23 +37873,23 @@ function registerScheduleTools(server) {
|
|
|
37451
37873
|
"create_schedule",
|
|
37452
37874
|
"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
37875
|
{
|
|
37454
|
-
prompt:
|
|
37455
|
-
name:
|
|
37456
|
-
at:
|
|
37457
|
-
every:
|
|
37458
|
-
time:
|
|
37459
|
-
days:
|
|
37460
|
-
cron:
|
|
37461
|
-
tz:
|
|
37462
|
-
archiveChat:
|
|
37876
|
+
prompt: import_zod11.z.string().describe("User message / goal queued when the automation fires"),
|
|
37877
|
+
name: import_zod11.z.string().optional(),
|
|
37878
|
+
at: import_zod11.z.string().optional().describe("ISO datetime for a one-shot"),
|
|
37879
|
+
every: import_zod11.z.string().optional().describe("Interval such as 15m, 1h, 6h, 1d"),
|
|
37880
|
+
time: import_zod11.z.string().optional().describe("HH:mm (24-hour) clock time. Omit days for every day."),
|
|
37881
|
+
days: import_zod11.z.string().optional().describe("daily, weekdays, weekends, or days such as mon,wed,fri or mon-fri. Use with time."),
|
|
37882
|
+
cron: import_zod11.z.string().optional().describe("5-field cron expression"),
|
|
37883
|
+
tz: import_zod11.z.string().optional().describe("IANA timezone for cron or time (default: system)"),
|
|
37884
|
+
archiveChat: import_zod11.z.boolean().optional().describe(
|
|
37463
37885
|
"Archive a new Global chat when the run finishes. Default true. Pass false to leave the chat open."
|
|
37464
37886
|
),
|
|
37465
|
-
chatId:
|
|
37887
|
+
chatId: import_zod11.z.string().optional().describe(
|
|
37466
37888
|
'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
37889
|
),
|
|
37468
|
-
threadId:
|
|
37469
|
-
agent:
|
|
37470
|
-
model:
|
|
37890
|
+
threadId: import_zod11.z.string().optional().describe("Legacy alias for chatId."),
|
|
37891
|
+
agent: import_zod11.z.enum(["claude", "cursor", "codex", "opencode"]).optional().describe("Agent for a new Global chat (omit for Account default)"),
|
|
37892
|
+
model: import_zod11.z.string().optional()
|
|
37471
37893
|
},
|
|
37472
37894
|
async (args) => {
|
|
37473
37895
|
try {
|
|
@@ -37504,23 +37926,23 @@ function registerScheduleTools(server) {
|
|
|
37504
37926
|
"update_schedule",
|
|
37505
37927
|
"Update a local automation (prompt, cadence, target chat, archiveChat, enabled). Pass id from list_schedules.",
|
|
37506
37928
|
{
|
|
37507
|
-
id:
|
|
37508
|
-
prompt:
|
|
37509
|
-
name:
|
|
37510
|
-
at:
|
|
37511
|
-
every:
|
|
37512
|
-
time:
|
|
37513
|
-
days:
|
|
37514
|
-
cron:
|
|
37515
|
-
tz:
|
|
37516
|
-
archiveChat:
|
|
37517
|
-
chatId:
|
|
37929
|
+
id: import_zod11.z.string(),
|
|
37930
|
+
prompt: import_zod11.z.string().optional(),
|
|
37931
|
+
name: import_zod11.z.string().optional(),
|
|
37932
|
+
at: import_zod11.z.string().optional(),
|
|
37933
|
+
every: import_zod11.z.string().optional(),
|
|
37934
|
+
time: import_zod11.z.string().optional().describe("HH:mm clock time. Use with days, or alone to change the time of a weekly job."),
|
|
37935
|
+
days: import_zod11.z.string().optional().describe("daily, weekdays, weekends, or mon,wed,fri. Use with time, or alone on an existing weekly job."),
|
|
37936
|
+
cron: import_zod11.z.string().optional(),
|
|
37937
|
+
tz: import_zod11.z.string().optional(),
|
|
37938
|
+
archiveChat: import_zod11.z.boolean().optional().describe("Archive a new Global chat when the run finishes. False leaves it open."),
|
|
37939
|
+
chatId: import_zod11.z.string().optional().describe(
|
|
37518
37940
|
'Existing chat, "self", or empty string for a Global chat each run. A bound job is removed when that chat is archived.'
|
|
37519
37941
|
),
|
|
37520
|
-
threadId:
|
|
37521
|
-
agent:
|
|
37522
|
-
model:
|
|
37523
|
-
enabled:
|
|
37942
|
+
threadId: import_zod11.z.string().optional().describe("Legacy alias for chatId."),
|
|
37943
|
+
agent: import_zod11.z.enum(["claude", "cursor", "codex", "opencode"]).optional(),
|
|
37944
|
+
model: import_zod11.z.string().optional(),
|
|
37945
|
+
enabled: import_zod11.z.boolean().optional()
|
|
37524
37946
|
},
|
|
37525
37947
|
async (args) => {
|
|
37526
37948
|
try {
|
|
@@ -37556,7 +37978,7 @@ function registerScheduleTools(server) {
|
|
|
37556
37978
|
server.tool(
|
|
37557
37979
|
"delete_schedule",
|
|
37558
37980
|
"Delete a local automation. Pass id from list_schedules.",
|
|
37559
|
-
{ id:
|
|
37981
|
+
{ id: import_zod11.z.string() },
|
|
37560
37982
|
async ({ id }) => {
|
|
37561
37983
|
try {
|
|
37562
37984
|
deleteSchedule(id);
|
|
@@ -37569,7 +37991,7 @@ function registerScheduleTools(server) {
|
|
|
37569
37991
|
server.tool(
|
|
37570
37992
|
"run_schedule",
|
|
37571
37993
|
"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:
|
|
37994
|
+
{ id: import_zod11.z.string() },
|
|
37573
37995
|
async ({ id }) => {
|
|
37574
37996
|
try {
|
|
37575
37997
|
if (!getSchedule(id)) {
|
|
@@ -37585,7 +38007,7 @@ function registerScheduleTools(server) {
|
|
|
37585
38007
|
}
|
|
37586
38008
|
|
|
37587
38009
|
// src/mcp/follow-up-tools.ts
|
|
37588
|
-
var
|
|
38010
|
+
var import_zod12 = require("zod");
|
|
37589
38011
|
init_worktree();
|
|
37590
38012
|
init_issue_list();
|
|
37591
38013
|
init_profile();
|
|
@@ -37624,10 +38046,10 @@ function registerFollowUpTools(server) {
|
|
|
37624
38046
|
"create_follow_up",
|
|
37625
38047
|
"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
38048
|
{
|
|
37627
|
-
kind:
|
|
37628
|
-
prompt:
|
|
37629
|
-
at:
|
|
37630
|
-
deadline:
|
|
38049
|
+
kind: import_zod12.z.enum(["ci", "at"]),
|
|
38050
|
+
prompt: import_zod12.z.string(),
|
|
38051
|
+
at: import_zod12.z.string().optional(),
|
|
38052
|
+
deadline: import_zod12.z.string().optional()
|
|
37631
38053
|
},
|
|
37632
38054
|
async ({ kind, prompt, at, deadline }) => {
|
|
37633
38055
|
const thread = callerThread();
|
|
@@ -37648,7 +38070,7 @@ function registerFollowUpTools(server) {
|
|
|
37648
38070
|
server.tool(
|
|
37649
38071
|
"delete_follow_up",
|
|
37650
38072
|
"Remove one follow-up from this chat by id.",
|
|
37651
|
-
{ id:
|
|
38073
|
+
{ id: import_zod12.z.string() },
|
|
37652
38074
|
async ({ id }) => {
|
|
37653
38075
|
const thread = callerThread();
|
|
37654
38076
|
if (!thread) return text7({ error: "This chat id is missing" }, true);
|
|
@@ -37665,12 +38087,12 @@ function registerFollowUpTools(server) {
|
|
|
37665
38087
|
init_turn_failure_class();
|
|
37666
38088
|
|
|
37667
38089
|
// src/mcp/order-tools.ts
|
|
37668
|
-
var
|
|
38090
|
+
var import_zod13 = require("zod");
|
|
37669
38091
|
|
|
37670
38092
|
// src/order/order.ts
|
|
37671
38093
|
var import_node_crypto23 = require("crypto");
|
|
37672
|
-
var
|
|
37673
|
-
var
|
|
38094
|
+
var import_node_fs77 = require("fs");
|
|
38095
|
+
var import_node_path75 = require("path");
|
|
37674
38096
|
init_paths();
|
|
37675
38097
|
init_private_file();
|
|
37676
38098
|
init_thread_store();
|
|
@@ -38379,7 +38801,7 @@ function showPlanMessage(docs, worktree) {
|
|
|
38379
38801
|
|
|
38380
38802
|
// src/order/order.ts
|
|
38381
38803
|
function orderPath() {
|
|
38382
|
-
return (0,
|
|
38804
|
+
return (0, import_node_path75.join)(appDataDir(), "order.json");
|
|
38383
38805
|
}
|
|
38384
38806
|
function emptyFile() {
|
|
38385
38807
|
return { plans: [], edges: [], marks: [] };
|
|
@@ -38442,9 +38864,9 @@ function asMark(value) {
|
|
|
38442
38864
|
}
|
|
38443
38865
|
function readFile() {
|
|
38444
38866
|
const path = orderPath();
|
|
38445
|
-
if (!(0,
|
|
38867
|
+
if (!(0, import_node_fs77.existsSync)(path)) return emptyFile();
|
|
38446
38868
|
try {
|
|
38447
|
-
const parsed = JSON.parse((0,
|
|
38869
|
+
const parsed = JSON.parse((0, import_node_fs77.readFileSync)(path, "utf8"));
|
|
38448
38870
|
if (!parsed || typeof parsed !== "object") return emptyFile();
|
|
38449
38871
|
const raw = parsed;
|
|
38450
38872
|
const edges = Array.isArray(raw.edges) ? raw.edges.map(asEdge).filter((row) => Boolean(row)) : [];
|
|
@@ -38652,7 +39074,7 @@ init_issue_list();
|
|
|
38652
39074
|
init_thread_store();
|
|
38653
39075
|
init_global_workspace();
|
|
38654
39076
|
init_plan_file();
|
|
38655
|
-
var kindSchema =
|
|
39077
|
+
var kindSchema = import_zod13.z.enum(["pr", "issue", "workspace", "orchestration"]);
|
|
38656
39078
|
function callerThread2() {
|
|
38657
39079
|
const id = process.env[SIDEBOARD_THREAD_ID_ENV]?.trim();
|
|
38658
39080
|
if (!id) return null;
|
|
@@ -38724,16 +39146,16 @@ function registerOrderTools(server) {
|
|
|
38724
39146
|
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
39147
|
{
|
|
38726
39148
|
waitsOnKind: kindSchema.describe("What must happen first: pr, issue, workspace, or orchestration"),
|
|
38727
|
-
waitsOnRef:
|
|
38728
|
-
waitsOnRepoPath:
|
|
38729
|
-
waitsOnLabel:
|
|
38730
|
-
gate:
|
|
38731
|
-
hold:
|
|
39149
|
+
waitsOnRef: import_zod13.z.string().describe("PR number (12), issue id (ENG-4), or workspace chat id / worktree path"),
|
|
39150
|
+
waitsOnRepoPath: import_zod13.z.string().optional().describe("Project path when a PR or issue number is not unique"),
|
|
39151
|
+
waitsOnLabel: import_zod13.z.string().optional().describe("Short label on the planner"),
|
|
39152
|
+
gate: import_zod13.z.enum(["in-main", "in-prod"]).describe("in-main: merged to the default branch. in-prod: deployed; mark with satisfy_dependency"),
|
|
39153
|
+
hold: import_zod13.z.enum(["start", "merge"]).describe("start: subject cannot begin. merge: subject cannot merge"),
|
|
38732
39154
|
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:
|
|
39155
|
+
subjectRef: import_zod13.z.string().optional().describe("PR number, issue id, or workspace ref for the subject"),
|
|
39156
|
+
subjectRepoPath: import_zod13.z.string().optional(),
|
|
39157
|
+
subjectLabel: import_zod13.z.string().optional(),
|
|
39158
|
+
note: import_zod13.z.string().optional().describe("Why this order matters")
|
|
38737
39159
|
},
|
|
38738
39160
|
async (args) => {
|
|
38739
39161
|
try {
|
|
@@ -38797,9 +39219,9 @@ function registerOrderTools(server) {
|
|
|
38797
39219
|
"set_plan",
|
|
38798
39220
|
"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
39221
|
{
|
|
38800
|
-
title:
|
|
38801
|
-
summary:
|
|
38802
|
-
goal:
|
|
39222
|
+
title: import_zod13.z.string().describe("Short name for the plan"),
|
|
39223
|
+
summary: import_zod13.z.string().optional().describe("What this order is for, in a sentence or two"),
|
|
39224
|
+
goal: import_zod13.z.string().optional().describe("Outcome the steps are trying to reach")
|
|
38803
39225
|
},
|
|
38804
39226
|
async ({ title, summary, goal }) => {
|
|
38805
39227
|
try {
|
|
@@ -38819,7 +39241,7 @@ function registerOrderTools(server) {
|
|
|
38819
39241
|
"execute_plan",
|
|
38820
39242
|
"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
39243
|
{
|
|
38822
|
-
agreed:
|
|
39244
|
+
agreed: import_zod13.z.literal(true).describe("True only after the user has seen the plan and told you to run it")
|
|
38823
39245
|
},
|
|
38824
39246
|
async () => {
|
|
38825
39247
|
try {
|
|
@@ -38889,7 +39311,7 @@ function registerOrderTools(server) {
|
|
|
38889
39311
|
server.tool(
|
|
38890
39312
|
"clear_dependency",
|
|
38891
39313
|
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:
|
|
39314
|
+
{ id: import_zod13.z.string().describe("Step id from list_order") },
|
|
38893
39315
|
async ({ id }) => {
|
|
38894
39316
|
try {
|
|
38895
39317
|
const caller = callerThread2();
|
|
@@ -38908,8 +39330,8 @@ function registerOrderTools(server) {
|
|
|
38908
39330
|
"satisfy_dependency",
|
|
38909
39331
|
"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
39332
|
{
|
|
38911
|
-
id:
|
|
38912
|
-
satisfied:
|
|
39333
|
+
id: import_zod13.z.string().describe("Step id from list_order"),
|
|
39334
|
+
satisfied: import_zod13.z.boolean().optional().describe("false clears the manual mark. Default true.")
|
|
38913
39335
|
},
|
|
38914
39336
|
async ({ id, satisfied }) => {
|
|
38915
39337
|
try {
|
|
@@ -38940,9 +39362,11 @@ function registerOrderTools(server) {
|
|
|
38940
39362
|
|
|
38941
39363
|
// src/agent-rpc/handlers.ts
|
|
38942
39364
|
var import_node_crypto24 = require("crypto");
|
|
38943
|
-
var
|
|
39365
|
+
var import_node_path76 = require("path");
|
|
38944
39366
|
init_wait_for_job();
|
|
38945
39367
|
init_wait_for_turn();
|
|
39368
|
+
init_computer_use();
|
|
39369
|
+
init_app_settings();
|
|
38946
39370
|
|
|
38947
39371
|
// src/agent-rpc/permission-handler.ts
|
|
38948
39372
|
init_agent_block();
|
|
@@ -39005,27 +39429,27 @@ init_gh_errors();
|
|
|
39005
39429
|
init_git_auth_mode();
|
|
39006
39430
|
|
|
39007
39431
|
// src/board/load-home-board.ts
|
|
39008
|
-
var
|
|
39009
|
-
var
|
|
39432
|
+
var import_node_fs79 = require("fs");
|
|
39433
|
+
var import_node_path78 = require("path");
|
|
39010
39434
|
init_worktree();
|
|
39011
39435
|
init_paths();
|
|
39012
39436
|
|
|
39013
39437
|
// src/board/board-pins.ts
|
|
39014
39438
|
var import_node_crypto25 = require("crypto");
|
|
39015
|
-
var
|
|
39016
|
-
var
|
|
39439
|
+
var import_node_fs78 = require("fs");
|
|
39440
|
+
var import_node_path77 = require("path");
|
|
39017
39441
|
init_paths();
|
|
39018
39442
|
init_home_board();
|
|
39019
39443
|
var FILE = "home-board-pins.json";
|
|
39020
39444
|
var VERSION = 1;
|
|
39021
39445
|
function pinsFile() {
|
|
39022
|
-
return (0,
|
|
39446
|
+
return (0, import_node_path77.join)(appDataDir(), FILE);
|
|
39023
39447
|
}
|
|
39024
39448
|
function readDisk() {
|
|
39025
39449
|
const path = pinsFile();
|
|
39026
|
-
if (!(0,
|
|
39450
|
+
if (!(0, import_node_fs78.existsSync)(path)) return [];
|
|
39027
39451
|
try {
|
|
39028
|
-
const raw = JSON.parse((0,
|
|
39452
|
+
const raw = JSON.parse((0, import_node_fs78.readFileSync)(path, "utf8"));
|
|
39029
39453
|
if (raw?.version !== VERSION || !Array.isArray(raw.items)) return [];
|
|
39030
39454
|
return raw.items.filter((item) => item?.id && item.kind && item.ref);
|
|
39031
39455
|
} catch {
|
|
@@ -39033,8 +39457,8 @@ function readDisk() {
|
|
|
39033
39457
|
}
|
|
39034
39458
|
}
|
|
39035
39459
|
function writeDisk(items) {
|
|
39036
|
-
(0,
|
|
39037
|
-
(0,
|
|
39460
|
+
(0, import_node_fs78.mkdirSync)(appDataDir(), { recursive: true });
|
|
39461
|
+
(0, import_node_fs78.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION, items }, null, 2), "utf8");
|
|
39038
39462
|
}
|
|
39039
39463
|
function listBoardPins() {
|
|
39040
39464
|
return readDisk();
|
|
@@ -39055,7 +39479,7 @@ function homeBoardWorkspaceKey(workspaces) {
|
|
|
39055
39479
|
return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
|
|
39056
39480
|
}
|
|
39057
39481
|
function cacheFile() {
|
|
39058
|
-
return (0,
|
|
39482
|
+
return (0, import_node_path78.join)(appDataDir(), "home-board-cache.json");
|
|
39059
39483
|
}
|
|
39060
39484
|
function emptyInputs() {
|
|
39061
39485
|
return {
|
|
@@ -39081,9 +39505,9 @@ function shouldCacheHomeBoardInputs(inputs) {
|
|
|
39081
39505
|
}
|
|
39082
39506
|
function readDiskCache() {
|
|
39083
39507
|
const path = cacheFile();
|
|
39084
|
-
if (!(0,
|
|
39508
|
+
if (!(0, import_node_fs79.existsSync)(path)) return null;
|
|
39085
39509
|
try {
|
|
39086
|
-
const raw = JSON.parse((0,
|
|
39510
|
+
const raw = JSON.parse((0, import_node_fs79.readFileSync)(path, "utf8"));
|
|
39087
39511
|
if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
|
|
39088
39512
|
return null;
|
|
39089
39513
|
}
|
|
@@ -39097,8 +39521,8 @@ function readDiskCache() {
|
|
|
39097
39521
|
}
|
|
39098
39522
|
function writeDiskCache(entry) {
|
|
39099
39523
|
try {
|
|
39100
|
-
(0,
|
|
39101
|
-
(0,
|
|
39524
|
+
(0, import_node_fs79.mkdirSync)(appDataDir(), { recursive: true });
|
|
39525
|
+
(0, import_node_fs79.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
|
|
39102
39526
|
} catch {
|
|
39103
39527
|
}
|
|
39104
39528
|
}
|
|
@@ -39353,7 +39777,7 @@ async function startMcpServer() {
|
|
|
39353
39777
|
async () => {
|
|
39354
39778
|
const threads = orch.getThreads();
|
|
39355
39779
|
const lines = threads.map((t) => {
|
|
39356
|
-
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0,
|
|
39780
|
+
const repo = t.repoPath === GLOBAL_WORKSPACE_ID ? "Orchestration" : (0, import_node_path79.basename)(t.repoPath) || t.repoPath;
|
|
39357
39781
|
const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
|
|
39358
39782
|
const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
|
|
39359
39783
|
const preview = lastMessagePreview(t.messages, 80);
|
|
@@ -39371,16 +39795,16 @@ async function startMcpServer() {
|
|
|
39371
39795
|
"list_board",
|
|
39372
39796
|
"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
39797
|
{
|
|
39374
|
-
query:
|
|
39375
|
-
repoPath:
|
|
39376
|
-
kind:
|
|
39377
|
-
ownership:
|
|
39798
|
+
query: import_zod14.z.string().optional().describe("Case-insensitive token search across title, id, labels, workspace tags, repo"),
|
|
39799
|
+
repoPath: import_zod14.z.string().optional().describe("Limit to one project path from list_projects"),
|
|
39800
|
+
kind: import_zod14.z.enum(["all", "tickets", "prs", "branches", "threads"]).optional().describe("Filter by worktree source (default all)"),
|
|
39801
|
+
ownership: import_zod14.z.enum(["all", "mine", "reviewing"]).optional().describe(
|
|
39378
39802
|
"Mine = PRs you authored or local WIP; reviewing = someone else's PR. Uses the gh login."
|
|
39379
39803
|
),
|
|
39380
|
-
column:
|
|
39804
|
+
column: import_zod14.z.enum(["new", "draft", "review", "approved", "done", "needs_you"]).optional().describe(
|
|
39381
39805
|
"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
39806
|
),
|
|
39383
|
-
limit:
|
|
39807
|
+
limit: import_zod14.z.number().int().positive().optional().describe("Max cards per column (default 40). hidden counts the remainder.")
|
|
39384
39808
|
},
|
|
39385
39809
|
async ({ query, repoPath, kind, ownership, column, limit }) => {
|
|
39386
39810
|
const workspaces = orch.listWorkspaces();
|
|
@@ -39410,7 +39834,7 @@ async function startMcpServer() {
|
|
|
39410
39834
|
server.tool(
|
|
39411
39835
|
"get_chat",
|
|
39412
39836
|
"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:
|
|
39837
|
+
{ ref: import_zod14.z.string() },
|
|
39414
39838
|
async ({ ref }) => {
|
|
39415
39839
|
const t = orch.getThread(ref);
|
|
39416
39840
|
if (!t) {
|
|
@@ -39457,17 +39881,17 @@ async function startMcpServer() {
|
|
|
39457
39881
|
"present_artifact",
|
|
39458
39882
|
"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
39883
|
{
|
|
39460
|
-
title:
|
|
39461
|
-
type:
|
|
39884
|
+
title: import_zod14.z.string().describe("Short title shown in the artifact pane header"),
|
|
39885
|
+
type: import_zod14.z.enum(["html", "svg", "markdown", "react", "log"]).describe(
|
|
39462
39886
|
"html/svg/markdown/react replace the pane. log appends content to the same artifact_id (new lines only)."
|
|
39463
39887
|
),
|
|
39464
|
-
content:
|
|
39888
|
+
content: import_zod14.z.string().describe(
|
|
39465
39889
|
"html/svg/markdown/react: full document. log: only the new lines since the last call (empty is ok for a status-only update)."
|
|
39466
39890
|
),
|
|
39467
|
-
artifact_id:
|
|
39468
|
-
status:
|
|
39469
|
-
phase:
|
|
39470
|
-
mode:
|
|
39891
|
+
artifact_id: import_zod14.z.string().optional().describe("Stable id. Required for type=log so later calls append to the same pane."),
|
|
39892
|
+
status: import_zod14.z.enum(["running", "ok", "failed", "idle"]).optional().describe("Log header pill: running (working), ok (done), failed, idle"),
|
|
39893
|
+
phase: import_zod14.z.string().optional().describe("Log subtitle (Signing, Notarizing, \u2026)"),
|
|
39894
|
+
mode: import_zod14.z.enum(["append", "replace"]).optional().describe("log only: append (default) or replace the buffer")
|
|
39471
39895
|
},
|
|
39472
39896
|
async ({ title, type, artifact_id, status, phase, mode }) => {
|
|
39473
39897
|
return mcpJson(
|
|
@@ -39480,15 +39904,15 @@ async function startMcpServer() {
|
|
|
39480
39904
|
"ask_user",
|
|
39481
39905
|
"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
39906
|
{
|
|
39483
|
-
questions:
|
|
39484
|
-
|
|
39485
|
-
question:
|
|
39486
|
-
header:
|
|
39487
|
-
multiSelect:
|
|
39488
|
-
options:
|
|
39489
|
-
|
|
39490
|
-
label:
|
|
39491
|
-
description:
|
|
39907
|
+
questions: import_zod14.z.array(
|
|
39908
|
+
import_zod14.z.object({
|
|
39909
|
+
question: import_zod14.z.string().describe("Full question text ending with ?"),
|
|
39910
|
+
header: import_zod14.z.string().max(24).optional().describe("Short label shown above the question"),
|
|
39911
|
+
multiSelect: import_zod14.z.boolean().optional().describe("Allow selecting multiple options"),
|
|
39912
|
+
options: import_zod14.z.array(
|
|
39913
|
+
import_zod14.z.object({
|
|
39914
|
+
label: import_zod14.z.string(),
|
|
39915
|
+
description: import_zod14.z.string().optional().describe("What this option means / when to choose it (strongly preferred)")
|
|
39492
39916
|
})
|
|
39493
39917
|
).min(2).max(6).describe("2\u20136 choices (Sideboard also offers Other)")
|
|
39494
39918
|
})
|
|
@@ -39514,9 +39938,9 @@ async function startMcpServer() {
|
|
|
39514
39938
|
"present_plan",
|
|
39515
39939
|
PRESENT_PLAN_TOOL_DESCRIPTION,
|
|
39516
39940
|
{
|
|
39517
|
-
title:
|
|
39518
|
-
content:
|
|
39519
|
-
thread_id:
|
|
39941
|
+
title: import_zod14.z.string().optional().describe("Short plan title (defaults to Plan)"),
|
|
39942
|
+
content: import_zod14.z.string().min(1).describe("Full plan markdown (headings, steps, risks, open questions)"),
|
|
39943
|
+
thread_id: import_zod14.z.string().optional().describe("Sideboard thread id when cwd is not the worktree")
|
|
39520
39944
|
},
|
|
39521
39945
|
async ({ title, content, thread_id }) => {
|
|
39522
39946
|
const { writePlanFile: writePlanFile2 } = await Promise.resolve().then(() => (init_plan_file(), plan_file_exports));
|
|
@@ -39545,15 +39969,15 @@ async function startMcpServer() {
|
|
|
39545
39969
|
"present_schema",
|
|
39546
39970
|
"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
39971
|
{
|
|
39548
|
-
title:
|
|
39549
|
-
mode:
|
|
39550
|
-
datasource:
|
|
39551
|
-
resource_id:
|
|
39552
|
-
record_id:
|
|
39553
|
-
resource:
|
|
39554
|
-
record:
|
|
39555
|
-
records:
|
|
39556
|
-
pane_id:
|
|
39972
|
+
title: import_zod14.z.string().describe("Pane title"),
|
|
39973
|
+
mode: import_zod14.z.enum(["table", "form"]).optional().describe("table = list/filter records; form = edit one record"),
|
|
39974
|
+
datasource: import_zod14.z.enum(["brightsy", "inline"]).optional().describe("brightsy resolves via login; inline uses embedded resource/records"),
|
|
39975
|
+
resource_id: import_zod14.z.string().optional().describe("Brightsy record type UUID (or generic resource id)"),
|
|
39976
|
+
record_id: import_zod14.z.string().optional().describe("Record id when opening form mode"),
|
|
39977
|
+
resource: import_zod14.z.record(import_zod14.z.unknown()).optional().describe("Inline { id, title, schema, schemaUi?, slug? }"),
|
|
39978
|
+
record: import_zod14.z.record(import_zod14.z.unknown()).optional().describe("Inline record { id, data, published_at? }"),
|
|
39979
|
+
records: import_zod14.z.array(import_zod14.z.record(import_zod14.z.unknown())).optional().describe("Inline records for table mode"),
|
|
39980
|
+
pane_id: import_zod14.z.string().optional().describe("Stable pane id across updates")
|
|
39557
39981
|
},
|
|
39558
39982
|
async (args) => {
|
|
39559
39983
|
const id = args.pane_id?.trim() || `schema_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -39574,10 +39998,10 @@ async function startMcpServer() {
|
|
|
39574
39998
|
"present_files",
|
|
39575
39999
|
"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
40000
|
{
|
|
39577
|
-
title:
|
|
39578
|
-
datasource:
|
|
39579
|
-
path:
|
|
39580
|
-
pane_id:
|
|
40001
|
+
title: import_zod14.z.string().optional().describe("Pane title (default: Files)"),
|
|
40002
|
+
datasource: import_zod14.z.enum(["brightsy", "memory"]).optional().describe("brightsy = account storage via login; memory = session demo store"),
|
|
40003
|
+
path: import_zod14.z.string().optional().describe("Initial folder path (e.g. public)"),
|
|
40004
|
+
pane_id: import_zod14.z.string().optional().describe("Stable pane id across updates")
|
|
39581
40005
|
},
|
|
39582
40006
|
async (args) => {
|
|
39583
40007
|
const id = args.pane_id?.trim() || `files_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -39597,8 +40021,8 @@ async function startMcpServer() {
|
|
|
39597
40021
|
"wait_for_job",
|
|
39598
40022
|
"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
40023
|
{
|
|
39600
|
-
id:
|
|
39601
|
-
timeoutMs:
|
|
40024
|
+
id: import_zod14.z.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
|
|
40025
|
+
timeoutMs: import_zod14.z.number().optional()
|
|
39602
40026
|
},
|
|
39603
40027
|
async ({ id, timeoutMs }) => {
|
|
39604
40028
|
const result = await waitForDetachedJob(process.cwd(), id, {
|
|
@@ -39611,8 +40035,8 @@ async function startMcpServer() {
|
|
|
39611
40035
|
"stop_job",
|
|
39612
40036
|
"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
40037
|
{
|
|
39614
|
-
id:
|
|
39615
|
-
reason:
|
|
40038
|
+
id: import_zod14.z.string().describe("Detached job id (same kebab-case id passed to detached-job.cjs start)"),
|
|
40039
|
+
reason: import_zod14.z.string().optional().describe("Why you are stopping (hanging, no progress, wrong output, already have the answer)")
|
|
39616
40040
|
},
|
|
39617
40041
|
async ({ id, reason }) => {
|
|
39618
40042
|
const result = await stopDetachedJob(process.cwd(), id, { reason });
|
|
@@ -39624,7 +40048,7 @@ async function startMcpServer() {
|
|
|
39624
40048
|
"list_run_scripts",
|
|
39625
40049
|
"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
40050
|
{
|
|
39627
|
-
ref:
|
|
40051
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd).")
|
|
39628
40052
|
},
|
|
39629
40053
|
async ({ ref }) => {
|
|
39630
40054
|
try {
|
|
@@ -39654,8 +40078,8 @@ async function startMcpServer() {
|
|
|
39654
40078
|
"run_dev_script",
|
|
39655
40079
|
"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
40080
|
{
|
|
39657
|
-
ref:
|
|
39658
|
-
name:
|
|
40081
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
40082
|
+
name: import_zod14.z.string().optional().describe("Script name from list_run_scripts (default script if omitted).")
|
|
39659
40083
|
},
|
|
39660
40084
|
async ({ ref, name }) => {
|
|
39661
40085
|
try {
|
|
@@ -39683,8 +40107,8 @@ async function startMcpServer() {
|
|
|
39683
40107
|
"stop_dev_script",
|
|
39684
40108
|
"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
40109
|
{
|
|
39686
|
-
ref:
|
|
39687
|
-
name:
|
|
40110
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
40111
|
+
name: import_zod14.z.string().optional().describe("Script name to stop; omit to stop all active scripts.")
|
|
39688
40112
|
},
|
|
39689
40113
|
async ({ ref, name }) => {
|
|
39690
40114
|
try {
|
|
@@ -39701,9 +40125,9 @@ async function startMcpServer() {
|
|
|
39701
40125
|
"get_run_log",
|
|
39702
40126
|
"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
40127
|
{
|
|
39704
|
-
ref:
|
|
39705
|
-
name:
|
|
39706
|
-
tail:
|
|
40128
|
+
ref: import_zod14.z.string().optional().describe("Thread id. Omit on a worktree turn (uses cwd)."),
|
|
40129
|
+
name: import_zod14.z.string().optional().describe("Script name from list_run_scripts (default script if omitted)."),
|
|
40130
|
+
tail: import_zod14.z.number().int().min(1).max(MAX_RUN_LOG_CHARS).optional().describe(
|
|
39707
40131
|
`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
40132
|
)
|
|
39709
40133
|
},
|
|
@@ -39736,6 +40160,7 @@ async function startMcpServer() {
|
|
|
39736
40160
|
}
|
|
39737
40161
|
}
|
|
39738
40162
|
);
|
|
40163
|
+
registerComputerUseTool(server, mcpCatalog);
|
|
39739
40164
|
if (worktreeProfile) {
|
|
39740
40165
|
server.tool(
|
|
39741
40166
|
"get_orchestrator",
|
|
@@ -39766,8 +40191,8 @@ async function startMcpServer() {
|
|
|
39766
40191
|
"notify_orchestrator",
|
|
39767
40192
|
"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
40193
|
{
|
|
39769
|
-
message:
|
|
39770
|
-
reason:
|
|
40194
|
+
message: import_zod14.z.string().min(1).max(1500).describe("Why you are blocked / what the parent should know (short)."),
|
|
40195
|
+
reason: import_zod14.z.enum(["input-required", "blocked"]).optional().describe(
|
|
39771
40196
|
"input-required = waiting on the user in this chat; blocked = need the coordinator (default)."
|
|
39772
40197
|
)
|
|
39773
40198
|
},
|
|
@@ -39806,11 +40231,11 @@ async function startMcpServer() {
|
|
|
39806
40231
|
"set_workspace_tags",
|
|
39807
40232
|
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
40233
|
{
|
|
39809
|
-
ref:
|
|
40234
|
+
ref: import_zod14.z.string().optional().describe(
|
|
39810
40235
|
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace to label."
|
|
39811
40236
|
),
|
|
39812
|
-
tags:
|
|
39813
|
-
mode:
|
|
40237
|
+
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."),
|
|
40238
|
+
mode: import_zod14.z.enum(["replace", "add", "remove"]).optional()
|
|
39814
40239
|
},
|
|
39815
40240
|
async ({ ref, tags, mode }) => {
|
|
39816
40241
|
try {
|
|
@@ -39838,10 +40263,10 @@ async function startMcpServer() {
|
|
|
39838
40263
|
"set_wake_on_github_edges",
|
|
39839
40264
|
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
40265
|
{
|
|
39841
|
-
ref:
|
|
40266
|
+
ref: import_zod14.z.string().optional().describe(
|
|
39842
40267
|
worktreeProfile ? "Omit for this chat. Another chat id only if it is on this same checkout." : "Chat id on the workspace."
|
|
39843
40268
|
),
|
|
39844
|
-
enabled:
|
|
40269
|
+
enabled: import_zod14.z.boolean().describe("True opts the checkout in. False turns it off.")
|
|
39845
40270
|
},
|
|
39846
40271
|
async ({ ref, enabled }) => {
|
|
39847
40272
|
try {
|
|
@@ -39874,7 +40299,7 @@ async function startMcpServer() {
|
|
|
39874
40299
|
"set_caffeinate",
|
|
39875
40300
|
"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
40301
|
{
|
|
39877
|
-
enabled:
|
|
40302
|
+
enabled: import_zod14.z.boolean().describe("true = hold caffeinate on; false = release and let the Mac sleep")
|
|
39878
40303
|
},
|
|
39879
40304
|
async ({ enabled }) => {
|
|
39880
40305
|
const threadId = process.env.SIDEBOARD_ORCHESTRATOR_THREAD_ID?.trim() || null;
|
|
@@ -39900,25 +40325,25 @@ async function startMcpServer() {
|
|
|
39900
40325
|
"create_workspace",
|
|
39901
40326
|
`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
40327
|
{
|
|
39903
|
-
sourceType:
|
|
39904
|
-
sourceRef:
|
|
39905
|
-
agent:
|
|
40328
|
+
sourceType: import_zod14.z.enum(["branch", "pr", "ticket"]),
|
|
40329
|
+
sourceRef: import_zod14.z.string(),
|
|
40330
|
+
agent: import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]).optional().describe(
|
|
39906
40331
|
`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
40332
|
),
|
|
39908
|
-
acpHarness:
|
|
39909
|
-
model:
|
|
40333
|
+
acpHarness: import_zod14.z.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini (Gemini CLI) or copilot (GitHub Copilot CLI)."),
|
|
40334
|
+
model: import_zod14.z.string().nullable().optional().describe(
|
|
39910
40335
|
`Usually omit to use Account default model (${accountDefaults.model?.trim() || "Auto"}). Pass null only to force Auto / agent-default.`
|
|
39911
40336
|
),
|
|
39912
|
-
repoPath:
|
|
39913
|
-
title:
|
|
39914
|
-
cowboy:
|
|
40337
|
+
repoPath: import_zod14.z.string(),
|
|
40338
|
+
title: import_zod14.z.string().optional(),
|
|
40339
|
+
cowboy: import_zod14.z.boolean().optional().describe(
|
|
39915
40340
|
"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
40341
|
),
|
|
39917
|
-
parentChatId:
|
|
40342
|
+
parentChatId: import_zod14.z.string().optional().describe(
|
|
39918
40343
|
"Orchestration: omit (preferred) or pass YOUR chat id from the turn reminder / AGENTS.md. Do not invent uuids."
|
|
39919
40344
|
),
|
|
39920
|
-
parentThreadId:
|
|
39921
|
-
tags:
|
|
40345
|
+
parentThreadId: import_zod14.z.string().optional().describe("Legacy alias for parentChatId."),
|
|
40346
|
+
tags: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.array(import_zod14.z.string())]).optional().describe(
|
|
39922
40347
|
"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
40348
|
)
|
|
39924
40349
|
},
|
|
@@ -39934,11 +40359,11 @@ async function startMcpServer() {
|
|
|
39934
40359
|
"start_board_card",
|
|
39935
40360
|
"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
40361
|
{
|
|
39937
|
-
kind:
|
|
39938
|
-
ref:
|
|
39939
|
-
repoPath:
|
|
39940
|
-
title:
|
|
39941
|
-
tags:
|
|
40362
|
+
kind: import_zod14.z.enum(["ticket", "pr", "branch"]),
|
|
40363
|
+
ref: import_zod14.z.string().describe("Ticket identifier (ENG-12), PR number (44), or branch name from list_board"),
|
|
40364
|
+
repoPath: import_zod14.z.string().describe("Project path from list_projects / list_board"),
|
|
40365
|
+
title: import_zod14.z.string().optional(),
|
|
40366
|
+
tags: import_zod14.z.union([import_zod14.z.string(), import_zod14.z.array(import_zod14.z.string())]).optional().describe(
|
|
39942
40367
|
"Short labels for this workspace. Same tags on every checkout for one task. Added when the checkout already exists."
|
|
39943
40368
|
)
|
|
39944
40369
|
},
|
|
@@ -40043,9 +40468,9 @@ async function startMcpServer() {
|
|
|
40043
40468
|
"send_to_chat",
|
|
40044
40469
|
'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
40470
|
{
|
|
40046
|
-
ref:
|
|
40047
|
-
prompt:
|
|
40048
|
-
force_stop:
|
|
40471
|
+
ref: import_zod14.z.string(),
|
|
40472
|
+
prompt: import_zod14.z.string(),
|
|
40473
|
+
force_stop: import_zod14.z.boolean().optional()
|
|
40049
40474
|
},
|
|
40050
40475
|
async ({ ref, prompt, force_stop }) => {
|
|
40051
40476
|
if (force_stop) {
|
|
@@ -40070,8 +40495,8 @@ async function startMcpServer() {
|
|
|
40070
40495
|
"wait_for_turn",
|
|
40071
40496
|
"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
40497
|
{
|
|
40073
|
-
ref:
|
|
40074
|
-
timeoutMs:
|
|
40498
|
+
ref: import_zod14.z.string(),
|
|
40499
|
+
timeoutMs: import_zod14.z.number().optional()
|
|
40075
40500
|
},
|
|
40076
40501
|
async ({ ref, timeoutMs }) => {
|
|
40077
40502
|
const thread = await orch.waitForTurn(ref, mcpWaitForTurnTimeoutMs(timeoutMs), {
|
|
@@ -40099,7 +40524,7 @@ async function startMcpServer() {
|
|
|
40099
40524
|
server.tool(
|
|
40100
40525
|
"get_turn_result",
|
|
40101
40526
|
"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:
|
|
40527
|
+
{ ref: import_zod14.z.string() },
|
|
40103
40528
|
async ({ ref }) => {
|
|
40104
40529
|
const result = orch.getTurnResult(ref);
|
|
40105
40530
|
const failureClass = result.taskState === "failed" && result.status !== "broken" ? classifyTurnFailure(result.lastError || result.text) : null;
|
|
@@ -40117,9 +40542,9 @@ async function startMcpServer() {
|
|
|
40117
40542
|
"stop_chat",
|
|
40118
40543
|
"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
40544
|
{
|
|
40120
|
-
ref:
|
|
40121
|
-
force:
|
|
40122
|
-
reason:
|
|
40545
|
+
ref: import_zod14.z.string(),
|
|
40546
|
+
force: import_zod14.z.boolean().optional(),
|
|
40547
|
+
reason: import_zod14.z.string().optional().describe("Why this chat is stopping. Stored on the thread for the next session.")
|
|
40123
40548
|
},
|
|
40124
40549
|
async ({ ref, force, reason }) => {
|
|
40125
40550
|
const t = orch.getThread(ref);
|
|
@@ -40145,8 +40570,8 @@ async function startMcpServer() {
|
|
|
40145
40570
|
"get_diff",
|
|
40146
40571
|
"Compact diff summary (capped hunks, paginated)",
|
|
40147
40572
|
{
|
|
40148
|
-
ref:
|
|
40149
|
-
maxFiles:
|
|
40573
|
+
ref: import_zod14.z.string(),
|
|
40574
|
+
maxFiles: import_zod14.z.number().optional()
|
|
40150
40575
|
},
|
|
40151
40576
|
async ({ ref, maxFiles }) => {
|
|
40152
40577
|
const summary = await orch.diffSummary(ref);
|
|
@@ -40159,7 +40584,7 @@ async function startMcpServer() {
|
|
|
40159
40584
|
server.tool(
|
|
40160
40585
|
"get_pr_checks",
|
|
40161
40586
|
"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:
|
|
40587
|
+
{ ref: import_zod14.z.string().describe("Worktree thread id/ref") },
|
|
40163
40588
|
async ({ ref }) => {
|
|
40164
40589
|
try {
|
|
40165
40590
|
const checks = await orch.getPrChecks(ref);
|
|
@@ -40173,7 +40598,7 @@ async function startMcpServer() {
|
|
|
40173
40598
|
server.tool(
|
|
40174
40599
|
"request_review",
|
|
40175
40600
|
'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:
|
|
40601
|
+
{ ref: import_zod14.z.string().describe("Worktree thread id/ref to review") },
|
|
40177
40602
|
async ({ ref }) => {
|
|
40178
40603
|
try {
|
|
40179
40604
|
const tab = await orch.requestReview(ref);
|
|
@@ -40195,8 +40620,8 @@ async function startMcpServer() {
|
|
|
40195
40620
|
"ask_git",
|
|
40196
40621
|
"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
40622
|
{
|
|
40198
|
-
ref:
|
|
40199
|
-
action:
|
|
40623
|
+
ref: import_zod14.z.string().describe("Worktree thread id/ref"),
|
|
40624
|
+
action: import_zod14.z.enum(AGENT_GIT_ACTIONS).describe(
|
|
40200
40625
|
"commit-push | create-draft | create-web | resolve-conflicts | ready-for-review | merge"
|
|
40201
40626
|
)
|
|
40202
40627
|
},
|
|
@@ -40225,7 +40650,7 @@ async function startMcpServer() {
|
|
|
40225
40650
|
}
|
|
40226
40651
|
}
|
|
40227
40652
|
);
|
|
40228
|
-
const agentEnum =
|
|
40653
|
+
const agentEnum = import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]);
|
|
40229
40654
|
server.tool(
|
|
40230
40655
|
"list_models",
|
|
40231
40656
|
"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 +40671,12 @@ async function startMcpServer() {
|
|
|
40246
40671
|
"fork_workspace",
|
|
40247
40672
|
"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
40673
|
{
|
|
40249
|
-
ref:
|
|
40250
|
-
through_index:
|
|
40674
|
+
ref: import_zod14.z.string().describe("Worktree thread id/ref to fork"),
|
|
40675
|
+
through_index: import_zod14.z.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
40251
40676
|
agent: agentEnum.optional().describe("Agent for the forked chat (default: same as source)"),
|
|
40252
|
-
acpHarness:
|
|
40253
|
-
model:
|
|
40254
|
-
title:
|
|
40677
|
+
acpHarness: import_zod14.z.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
|
|
40678
|
+
model: import_zod14.z.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
40679
|
+
title: import_zod14.z.string().optional()
|
|
40255
40680
|
},
|
|
40256
40681
|
async ({ ref, through_index, agent, model, title, acpHarness }) => {
|
|
40257
40682
|
try {
|
|
@@ -40286,12 +40711,12 @@ async function startMcpServer() {
|
|
|
40286
40711
|
"fork_chat",
|
|
40287
40712
|
"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
40713
|
{
|
|
40289
|
-
ref:
|
|
40290
|
-
through_index:
|
|
40714
|
+
ref: import_zod14.z.string().describe("Thread id/ref to fork (worktree agent or orchestration chat)"),
|
|
40715
|
+
through_index: import_zod14.z.number().optional().describe("Inclusive message index to include in the transcript (default: all)"),
|
|
40291
40716
|
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:
|
|
40717
|
+
acpHarness: import_zod14.z.enum(["gemini", "copilot"]).optional().describe("When agent is acp: gemini or copilot."),
|
|
40718
|
+
model: import_zod14.z.string().nullable().optional().describe("Usually omit (Auto). Only set from list_models when you need a specific model"),
|
|
40719
|
+
title: import_zod14.z.string().optional()
|
|
40295
40720
|
},
|
|
40296
40721
|
async ({ ref, through_index, agent, model, title, acpHarness }) => {
|
|
40297
40722
|
try {
|
|
@@ -40330,7 +40755,7 @@ async function startMcpServer() {
|
|
|
40330
40755
|
server.tool(
|
|
40331
40756
|
"run_setup",
|
|
40332
40757
|
"Re-run workspace setup (Sideboard/Conductor settings, .cursor/worktrees.json, or script/setup). New worktrees already run this automatically.",
|
|
40333
|
-
{ ref:
|
|
40758
|
+
{ ref: import_zod14.z.string() },
|
|
40334
40759
|
async ({ ref }) => {
|
|
40335
40760
|
const result = await orch.runSetup(ref);
|
|
40336
40761
|
return mcpJson(result);
|
|
@@ -40339,7 +40764,7 @@ async function startMcpServer() {
|
|
|
40339
40764
|
server.tool(
|
|
40340
40765
|
"add_project",
|
|
40341
40766
|
"Register a git repo as a Sideboard workspace",
|
|
40342
|
-
{ repoPath:
|
|
40767
|
+
{ repoPath: import_zod14.z.string() },
|
|
40343
40768
|
async ({ repoPath }) => {
|
|
40344
40769
|
const ws = await orch.addWorkspace(repoPath);
|
|
40345
40770
|
return mcpJson(ws);
|
|
@@ -40348,7 +40773,7 @@ async function startMcpServer() {
|
|
|
40348
40773
|
server.tool(
|
|
40349
40774
|
"remove_project",
|
|
40350
40775
|
"Unregister a Sideboard workspace and archive its chats",
|
|
40351
|
-
{ repoPath:
|
|
40776
|
+
{ repoPath: import_zod14.z.string() },
|
|
40352
40777
|
async ({ repoPath }) => {
|
|
40353
40778
|
await orch.removeWorkspace(repoPath);
|
|
40354
40779
|
return { content: [{ type: "text", text: "ok" }] };
|
|
@@ -40358,12 +40783,12 @@ async function startMcpServer() {
|
|
|
40358
40783
|
"fanout",
|
|
40359
40784
|
"Best-of-n: create one thread per agent with the same prompt (parallel attempts)",
|
|
40360
40785
|
{
|
|
40361
|
-
prompt:
|
|
40362
|
-
agents:
|
|
40363
|
-
repoPath:
|
|
40364
|
-
sourceType:
|
|
40365
|
-
sourceRef:
|
|
40366
|
-
title:
|
|
40786
|
+
prompt: import_zod14.z.string(),
|
|
40787
|
+
agents: import_zod14.z.array(import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"])),
|
|
40788
|
+
repoPath: import_zod14.z.string(),
|
|
40789
|
+
sourceType: import_zod14.z.enum(["branch", "pr", "ticket"]).optional(),
|
|
40790
|
+
sourceRef: import_zod14.z.string().optional(),
|
|
40791
|
+
title: import_zod14.z.string().optional()
|
|
40367
40792
|
},
|
|
40368
40793
|
async (args) => {
|
|
40369
40794
|
const threads = await orch.bestOfN(args);
|
|
@@ -40381,8 +40806,8 @@ async function startMcpServer() {
|
|
|
40381
40806
|
"list_branches",
|
|
40382
40807
|
"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
40808
|
{
|
|
40384
|
-
repoPath:
|
|
40385
|
-
unmergedOnly:
|
|
40809
|
+
repoPath: import_zod14.z.string(),
|
|
40810
|
+
unmergedOnly: import_zod14.z.boolean().optional()
|
|
40386
40811
|
},
|
|
40387
40812
|
async ({ repoPath, unmergedOnly }) => {
|
|
40388
40813
|
const root = await resolveRepoRoot(repoPath);
|
|
@@ -40403,19 +40828,19 @@ async function startMcpServer() {
|
|
|
40403
40828
|
"list_prs",
|
|
40404
40829
|
`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
40830
|
{
|
|
40406
|
-
repoPath:
|
|
40407
|
-
query:
|
|
40408
|
-
queue:
|
|
40831
|
+
repoPath: import_zod14.z.string(),
|
|
40832
|
+
query: import_zod14.z.string().optional().describe("GitHub search tokens (title, draft:true, \u2026)"),
|
|
40833
|
+
queue: import_zod14.z.enum(["review", "mine", "approved", "changes"]).optional().describe(
|
|
40409
40834
|
"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
40835
|
),
|
|
40411
|
-
state:
|
|
40412
|
-
label:
|
|
40836
|
+
state: import_zod14.z.enum(["open", "closed", "merged", "all", "review"]).optional().describe("GitHub PR state (default open). review is an alias for queue=review."),
|
|
40837
|
+
label: import_zod14.z.string().optional().describe(
|
|
40413
40838
|
"GitHub label / workflow tag. Comma-separated AND. Examples: eng-review, eng-approved, eng-requested-changes"
|
|
40414
40839
|
),
|
|
40415
|
-
reviewer:
|
|
40840
|
+
reviewer: import_zod14.z.string().optional().describe(
|
|
40416
40841
|
"me (review requested of you), unassigned (no individual reviewer; team queues like engineering-team still count), all, or a GitHub login"
|
|
40417
40842
|
),
|
|
40418
|
-
limit:
|
|
40843
|
+
limit: import_zod14.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true.")
|
|
40419
40844
|
},
|
|
40420
40845
|
async ({ repoPath, query, queue, state, label, reviewer, limit }) => {
|
|
40421
40846
|
const root = await resolveRepoRoot(repoPath);
|
|
@@ -40448,7 +40873,7 @@ async function startMcpServer() {
|
|
|
40448
40873
|
server.tool(
|
|
40449
40874
|
"get_pr_stack",
|
|
40450
40875
|
"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:
|
|
40876
|
+
{ ref: import_zod14.z.string() },
|
|
40452
40877
|
async ({ ref }) => {
|
|
40453
40878
|
const stack = await orch.getPrStack(ref);
|
|
40454
40879
|
return mcpJson(stack);
|
|
@@ -40458,8 +40883,8 @@ async function startMcpServer() {
|
|
|
40458
40883
|
"open_pr_stack_layers",
|
|
40459
40884
|
"Materialize one worktree+thread per stack layer (or a single 1-based layer). Pass a thread ref already on the stack.",
|
|
40460
40885
|
{
|
|
40461
|
-
ref:
|
|
40462
|
-
layer:
|
|
40886
|
+
ref: import_zod14.z.string(),
|
|
40887
|
+
layer: import_zod14.z.number().int().positive().optional()
|
|
40463
40888
|
},
|
|
40464
40889
|
async ({ ref, layer }) => {
|
|
40465
40890
|
const result = await orch.openPrStackLayers(ref, { layer });
|
|
@@ -40482,9 +40907,9 @@ async function startMcpServer() {
|
|
|
40482
40907
|
"add_stack_layer",
|
|
40483
40908
|
"Add a branch on top of the current stack (`gh stack add`) and open a worktree+thread for it.",
|
|
40484
40909
|
{
|
|
40485
|
-
ref:
|
|
40486
|
-
branchName:
|
|
40487
|
-
title:
|
|
40910
|
+
ref: import_zod14.z.string(),
|
|
40911
|
+
branchName: import_zod14.z.string(),
|
|
40912
|
+
title: import_zod14.z.string().optional()
|
|
40488
40913
|
},
|
|
40489
40914
|
async ({ ref, branchName, title }) => {
|
|
40490
40915
|
const result = await orch.addStackLayer(ref, branchName, { title });
|
|
@@ -40502,11 +40927,11 @@ async function startMcpServer() {
|
|
|
40502
40927
|
"create_pr_stack",
|
|
40503
40928
|
"Create a new GitHub PR stack with one Sideboard worktree per layer (bottom\u2192top branch names). Requires `gh extension install github/gh-stack`.",
|
|
40504
40929
|
{
|
|
40505
|
-
repoPath:
|
|
40506
|
-
branches:
|
|
40507
|
-
agent:
|
|
40508
|
-
base:
|
|
40509
|
-
title:
|
|
40930
|
+
repoPath: import_zod14.z.string(),
|
|
40931
|
+
branches: import_zod14.z.array(import_zod14.z.string()).min(1),
|
|
40932
|
+
agent: import_zod14.z.enum(["claude", "codex", "opencode", "brightsy", "cursor", "acp"]),
|
|
40933
|
+
base: import_zod14.z.string().optional(),
|
|
40934
|
+
title: import_zod14.z.string().optional()
|
|
40510
40935
|
},
|
|
40511
40936
|
async (args) => {
|
|
40512
40937
|
const result = await orch.createPrStack({
|
|
@@ -40534,10 +40959,10 @@ async function startMcpServer() {
|
|
|
40534
40959
|
"list_issues",
|
|
40535
40960
|
"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
40961
|
{
|
|
40537
|
-
repoPath:
|
|
40538
|
-
query:
|
|
40539
|
-
assignee:
|
|
40540
|
-
limit:
|
|
40962
|
+
repoPath: import_zod14.z.string(),
|
|
40963
|
+
query: import_zod14.z.string().optional().describe("Search title, identifier, or description"),
|
|
40964
|
+
assignee: import_zod14.z.string().optional().describe("me (Linear default), unassigned, all, a user id, or a GitHub login"),
|
|
40965
|
+
limit: import_zod14.z.number().int().positive().max(250).optional().describe("Page size (default 40, max 250). Raise when truncated is true."),
|
|
40541
40966
|
updatedSince: mcpIssueUpdatedSinceSchema
|
|
40542
40967
|
},
|
|
40543
40968
|
async ({ repoPath, query, assignee, limit, updatedSince }) => {
|