@sideboard-ai/core 0.1.351 → 0.1.352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{abletime-TX7BTTR2.js → abletime-5LEOMLQE.js} +4 -4
- package/dist/{abletime-URSRZW7P.js → abletime-VUPUERE4.js} +4 -4
- package/dist/{abletime-oauth-QS3WPSCC.js → abletime-oauth-65LHLQ7P.js} +3 -3
- package/dist/{abletime-oauth-SL3NMNEC.js → abletime-oauth-JAINJBNY.js} +3 -3
- package/dist/{abletime-rest-JZU6JJCV.js → abletime-rest-4TCWPN7E.js} +3 -3
- package/dist/{abletime-rest-GGQLUO55.js → abletime-rest-HBIK234Y.js} +3 -3
- package/dist/agents/claude-runner.cjs +46 -19
- package/dist/agents/claude-runner.js +16 -1
- package/dist/agents/cursor-runner.cjs +50 -12
- package/dist/agents/cursor-runner.js +2 -2
- package/dist/{agents-INTH7J3F.js → agents-4DQDWMSX.js} +9 -9
- package/dist/{agents-D5CL4CR4.js → agents-IV454BNN.js} +8 -8
- package/dist/{app-settings-IA7ZZKWQ.js → app-settings-GM4MJD2E.js} +3 -1
- package/dist/{app-settings-XILTSD6L.js → app-settings-X3UFWRAF.js} +3 -1
- package/dist/{chunk-BZK62VPT.js → chunk-2S7EAUDI.js} +2 -2
- package/dist/{chunk-CCWQ65VD.js → chunk-2SFKLWU5.js} +2 -2
- package/dist/{chunk-WB3G2LQO.js → chunk-BCNPZ7H2.js} +1 -1
- package/dist/{chunk-BDWVBEKN.js → chunk-CQDJ4RX4.js} +149 -127
- package/dist/{chunk-SMSD6U3N.js → chunk-GA5MLYVG.js} +1 -1
- package/dist/{chunk-HISSQICH.js → chunk-HBRP2SHA.js} +3 -3
- package/dist/{chunk-DL4OHDBV.js → chunk-I6BKWSCT.js} +3 -3
- package/dist/{chunk-WJURGCBR.js → chunk-KSBJOWVO.js} +1 -1
- package/dist/{chunk-J4EA5SHF.js → chunk-LZ3TAKNJ.js} +3 -3
- package/dist/{chunk-F4RFFE2H.js → chunk-M426EW7O.js} +3 -3
- package/dist/{chunk-C3E2DGDF.js → chunk-MBQU6RE2.js} +6 -6
- package/dist/{chunk-TCEUNSLX.js → chunk-NRGT7RMO.js} +1 -1
- package/dist/{chunk-M45WGODR.js → chunk-OCCUD5CK.js} +2 -2
- package/dist/{chunk-UXAKH4AW.js → chunk-PR5TOSRD.js} +324 -70
- package/dist/{chunk-SUZOPJZC.js → chunk-PS6TD5MQ.js} +260 -2
- package/dist/{chunk-YE7Z5WH3.js → chunk-QKNOKO2P.js} +1 -1
- package/dist/{chunk-VL6F2KRE.js → chunk-RMJXFABA.js} +8 -6
- package/dist/{chunk-FQ3JYUKI.js → chunk-SBUR2WCP.js} +2 -2
- package/dist/{chunk-AEEOYLVK.js → chunk-SWU5C3HQ.js} +6 -6
- package/dist/{chunk-UFUAIVNV.js → chunk-TB7SYXXS.js} +8 -6
- package/dist/{chunk-7ZD4OK6G.js → chunk-TDWE7INS.js} +1 -1
- package/dist/{chunk-WFX4ZVSZ.js → chunk-TRUNDXCE.js} +1 -1
- package/dist/{chunk-AAKQU4UZ.js → chunk-UDTFOKVX.js} +28 -10
- package/dist/{chunk-PXSWVZIL.js → chunk-UPJB6TFI.js} +2 -2
- package/dist/{chunk-7WPQAVS5.js → chunk-US2PGV3X.js} +146 -126
- package/dist/{chunk-YVN7L4KG.js → chunk-V2G6AGWM.js} +6 -1
- package/dist/{chunk-37ZBEBP6.js → chunk-VZAICZHU.js} +3 -3
- package/dist/{chunk-FCKTBE26.js → chunk-WJQFWDGH.js} +1 -1
- package/dist/{chunk-SZY23KGS.js → chunk-WTT525MC.js} +3 -3
- package/dist/{chunk-BF6INES4.js → chunk-X52SO3DM.js} +1 -1
- package/dist/{chunk-B4EFQTMP.js → chunk-XB6NCBZK.js} +5 -5
- package/dist/{chunk-5TCMXEYL.js → chunk-YGXUIBIT.js} +3 -3
- package/dist/{chunk-VHQ6OG3U.js → chunk-ZHYFRRPN.js} +2 -2
- package/dist/{chunk-5WF54R3B.js → chunk-ZLPP66IP.js} +5 -5
- package/dist/{conductor-FWYWIHEW.js → conductor-2UOW2XBE.js} +6 -6
- package/dist/{conductor-W2X7QUKZ.js → conductor-6NYG2SZA.js} +6 -6
- package/dist/{coordinator-prompt-J57Q4Z4W.js → coordinator-prompt-K3WT5UVS.js} +4 -4
- package/dist/{coordinator-prompt-KIHNLENN.js → coordinator-prompt-ZP6AEETR.js} +4 -4
- package/dist/{global-workspace-WXDWFZAN.js → global-workspace-EFPSYP4N.js} +4 -4
- package/dist/{global-workspace-CGB5CY4U.js → global-workspace-EPVNFQVC.js} +4 -4
- package/dist/index.cjs +1192 -865
- package/dist/index.d.cts +8 -10
- package/dist/index.d.ts +8 -10
- package/dist/index.js +361 -315
- package/dist/{linear-WG23LBCX.js → linear-4ACCQCWM.js} +2 -2
- package/dist/{linear-E3BX5PX5.js → linear-Q2E6LKJW.js} +2 -2
- package/dist/{linear-list-VU47BNUV.js → linear-list-5A3BAWRZ.js} +1 -1
- package/dist/{linear-list-OINZWVV5.js → linear-list-V3A57XBR.js} +1 -1
- package/dist/mcp/run-stdio.cjs +1116 -802
- package/dist/mcp/run-stdio.js +342 -308
- package/dist/{optional-cli-K6HX2X5O.js → optional-cli-CKQPLY4Q.js} +4 -4
- package/dist/{optional-cli-SA3EQYML.js → optional-cli-WE3ULLFV.js} +5 -5
- package/dist/{orchestrator-DMEE7CEW.js → orchestrator-5BCHUAFG.js} +11 -11
- package/dist/{orchestrator-MUD4FY7Q.js → orchestrator-EY6GCYQG.js} +12 -12
- package/dist/{thread-store-4YTOV2HL.js → thread-store-CDFHHRXB.js} +2 -2
- package/dist/{thread-store-LME2ICZP.js → thread-store-TDGZEGS6.js} +2 -2
- package/dist/{workspaces-ZCTF4ECL.js → workspaces-KL4SZMJE.js} +4 -4
- package/dist/{workspaces-7DPHDXNY.js → workspaces-SQRR67HD.js} +4 -4
- package/dist/{worktree-4ATMCYIE.js → worktree-7KG5N2XL.js} +3 -3
- package/dist/{worktree-DA6SKIU5.js → worktree-IDX7LMBC.js} +3 -3
- package/package.json +1 -1
|
@@ -16,16 +16,16 @@ import {
|
|
|
16
16
|
detectAcpHarness,
|
|
17
17
|
isAcpHarnessId,
|
|
18
18
|
resolveAcpHarnessCommand
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-X52SO3DM.js";
|
|
20
20
|
import {
|
|
21
21
|
isOrchestratorThread
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-WTT525MC.js";
|
|
23
23
|
import {
|
|
24
24
|
codexUnattendedGitConfigArgs,
|
|
25
25
|
mergeAgentGitAuthEnv,
|
|
26
26
|
resolveAgentGitAuthEnv,
|
|
27
27
|
resolveCodexGitWritableRoots
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ZHYFRRPN.js";
|
|
29
29
|
import {
|
|
30
30
|
applyConnectedTeamToCli,
|
|
31
31
|
brightsyMcpServerName,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
} from "./chunk-2GPQZZLY.js";
|
|
41
41
|
import {
|
|
42
42
|
listAssignedLinearIssues
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-TRUNDXCE.js";
|
|
44
44
|
import {
|
|
45
45
|
githubAgentAuthReady,
|
|
46
46
|
npmGlobalNodeModules,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
CLAUDE_POSTHOG_CONNECTOR_ALLOWED_TOOLS,
|
|
53
53
|
CLAUDE_PRINT_BG_WAIT_CEILING_MS,
|
|
54
54
|
mcpAllowToolsFromNames
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-GA5MLYVG.js";
|
|
56
56
|
import {
|
|
57
57
|
claudeChromeEnabled,
|
|
58
58
|
fromInclusiveInputUsage,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
requestOccupancy,
|
|
64
64
|
resolveAgentExecutable,
|
|
65
65
|
resolveClaudeExecutable
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-RMJXFABA.js";
|
|
67
67
|
import {
|
|
68
68
|
isElectronLikeCommand,
|
|
69
69
|
unwrapStrippedElectronLaunch,
|
|
@@ -553,7 +553,8 @@ function injectedSideboardMcpEnv(opts) {
|
|
|
553
553
|
var AGENT_RPC_PILOT_MCP_TOOLS = [
|
|
554
554
|
"present_artifact",
|
|
555
555
|
"wait_for_job",
|
|
556
|
-
"stop_job"
|
|
556
|
+
"stop_job",
|
|
557
|
+
"computer_use"
|
|
557
558
|
];
|
|
558
559
|
function shouldRegisterMcpWaitForTurn(env = process.env) {
|
|
559
560
|
return !agentRpcOwnsPilotTools(env);
|
|
@@ -575,6 +576,7 @@ var WORKTREE_MCP_TOOLS = [
|
|
|
575
576
|
"run_dev_script",
|
|
576
577
|
"stop_dev_script",
|
|
577
578
|
"get_run_log",
|
|
579
|
+
"computer_use",
|
|
578
580
|
"get_orchestrator",
|
|
579
581
|
"notify_orchestrator",
|
|
580
582
|
"set_workspace_tags",
|
|
@@ -3171,9 +3173,239 @@ function agentRpcChildEnv(rpc, cwd) {
|
|
|
3171
3173
|
// src/agents/claude-host.ts
|
|
3172
3174
|
import { existsSync as existsSync12 } from "fs";
|
|
3173
3175
|
import { createRequire as createRequire3 } from "module";
|
|
3174
|
-
import { dirname as dirname5, join as
|
|
3176
|
+
import { dirname as dirname5, join as join13 } from "path";
|
|
3175
3177
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3176
3178
|
|
|
3179
|
+
// src/computer-use/computer-use.ts
|
|
3180
|
+
import { execFile } from "child_process";
|
|
3181
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync7 } from "fs";
|
|
3182
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
3183
|
+
import { isAbsolute as isAbsolute2, join as join12 } from "path";
|
|
3184
|
+
import { promisify } from "util";
|
|
3185
|
+
var execFileAsync = promisify(execFile);
|
|
3186
|
+
var COMPUTER_USE_OFF = "Computer use is off. Turn it on in Settings \u2192 Advanced.";
|
|
3187
|
+
var COMPUTER_USE_DESCRIPTION = "Drive this Mac to test an app you started. Off unless Settings \u2192 Advanced \u2192 Computer use is on. action is screenshot, click, type, key, or scroll. screenshot writes a PNG of the main display under the worktree .context/cli/ and returns that path plus point width, height, and scale. Read the image. x and y are screen points from the top-left of that image, not PNG pixels: divide a pixel by scale. click and scroll use those points. scroll posts a wheel event at the point (positive dx is right, positive dy is down). type sends text. key is one key (return, tab, escape, arrows, delete, or one character) with optional modifiers command, shift, option, control. Use it to check behavior and visual design (hierarchy, alignment, spacing, type, contrast, fit with the surrounding surface). preview=window means the Electron window, not a browser tab. Sideboard needs Accessibility and Screen Recording permission. Do not drive an app you did not start for this test.";
|
|
3188
|
+
var KEY_CODES = {
|
|
3189
|
+
return: 36,
|
|
3190
|
+
enter: 36,
|
|
3191
|
+
tab: 48,
|
|
3192
|
+
escape: 53,
|
|
3193
|
+
esc: 53,
|
|
3194
|
+
delete: 51,
|
|
3195
|
+
backspace: 51,
|
|
3196
|
+
forwarddelete: 117,
|
|
3197
|
+
left: 123,
|
|
3198
|
+
right: 124,
|
|
3199
|
+
down: 125,
|
|
3200
|
+
up: 126
|
|
3201
|
+
};
|
|
3202
|
+
var MODIFIERS = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
|
|
3203
|
+
var PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
3204
|
+
function appleScriptString(text) {
|
|
3205
|
+
return `"${text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
3206
|
+
}
|
|
3207
|
+
function typeScripts(text) {
|
|
3208
|
+
const parts = text.split(/\r\n|\n|\r/);
|
|
3209
|
+
const scripts = [];
|
|
3210
|
+
for (let i = 0; i < parts.length; i += 1) {
|
|
3211
|
+
if (parts[i]) {
|
|
3212
|
+
scripts.push(`tell application "System Events" to keystroke ${appleScriptString(parts[i])}`);
|
|
3213
|
+
}
|
|
3214
|
+
if (i < parts.length - 1) {
|
|
3215
|
+
scripts.push('tell application "System Events" to key code 36');
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
return scripts;
|
|
3219
|
+
}
|
|
3220
|
+
function modifierClause(modifiers) {
|
|
3221
|
+
const downs = modifiers.map((name) => {
|
|
3222
|
+
if (name === "cmd" || name === "command") return "command down";
|
|
3223
|
+
if (name === "alt" || name === "option") return "option down";
|
|
3224
|
+
if (name === "ctrl" || name === "control") return "control down";
|
|
3225
|
+
return "shift down";
|
|
3226
|
+
});
|
|
3227
|
+
if (!downs.length) return "";
|
|
3228
|
+
return ` using {${downs.join(", ")}}`;
|
|
3229
|
+
}
|
|
3230
|
+
function pngPointSize(bytes) {
|
|
3231
|
+
if (bytes.length < 24 || !bytes.subarray(0, 8).equals(PNG_SIG)) {
|
|
3232
|
+
throw new Error("screenshot is not a PNG");
|
|
3233
|
+
}
|
|
3234
|
+
let pixelWidth = 0;
|
|
3235
|
+
let pixelHeight = 0;
|
|
3236
|
+
let scale = 1;
|
|
3237
|
+
let offset = 8;
|
|
3238
|
+
while (offset + 8 <= bytes.length) {
|
|
3239
|
+
const length = bytes.readUInt32BE(offset);
|
|
3240
|
+
const type = bytes.toString("ascii", offset + 4, offset + 8);
|
|
3241
|
+
const data = offset + 8;
|
|
3242
|
+
if (data + length > bytes.length) break;
|
|
3243
|
+
if (type === "IHDR" && length >= 8) {
|
|
3244
|
+
pixelWidth = bytes.readUInt32BE(data);
|
|
3245
|
+
pixelHeight = bytes.readUInt32BE(data + 4);
|
|
3246
|
+
} else if (type === "pHYs" && length >= 9 && bytes[data + 8] === 1) {
|
|
3247
|
+
const ppm = bytes.readUInt32BE(data);
|
|
3248
|
+
if (ppm > 0) scale = ppm * 0.0254 / 72;
|
|
3249
|
+
} else if (type === "IEND") {
|
|
3250
|
+
break;
|
|
3251
|
+
}
|
|
3252
|
+
offset = data + length + 4;
|
|
3253
|
+
}
|
|
3254
|
+
if (pixelWidth <= 0 || pixelHeight <= 0) throw new Error("screenshot PNG has no size");
|
|
3255
|
+
return { pixelWidth, pixelHeight, scale };
|
|
3256
|
+
}
|
|
3257
|
+
function pointGeometry(info) {
|
|
3258
|
+
const raw = info.scale > 0 && Number.isFinite(info.scale) ? info.scale : 1;
|
|
3259
|
+
const scale = Math.round(raw * 100) / 100;
|
|
3260
|
+
return {
|
|
3261
|
+
width: Math.round(info.pixelWidth / scale),
|
|
3262
|
+
height: Math.round(info.pixelHeight / scale),
|
|
3263
|
+
scale
|
|
3264
|
+
};
|
|
3265
|
+
}
|
|
3266
|
+
function scrollWheelSwift(x, y, dx, dy) {
|
|
3267
|
+
for (const n of [x, y, dx, dy]) {
|
|
3268
|
+
if (!Number.isInteger(n)) throw new Error("scroll coordinates must be integers");
|
|
3269
|
+
}
|
|
3270
|
+
const wheel1 = -dy;
|
|
3271
|
+
const wheel2 = -dx;
|
|
3272
|
+
return `import CoreGraphics
|
|
3273
|
+
let src = CGEventSource(stateID: .hidSystemState)
|
|
3274
|
+
let p = CGPoint(x: ${x}, y: ${y})
|
|
3275
|
+
if let move = CGEvent(mouseEventSource: src, mouseType: .mouseMoved, mouseCursorPosition: p, mouseButton: .left) {
|
|
3276
|
+
move.post(tap: .cghidEventTap)
|
|
3277
|
+
}
|
|
3278
|
+
if let ev = CGEvent(scrollWheelEvent2Source: src, units: .pixel, wheelCount: 2, wheel1: ${wheel1}, wheel2: ${wheel2}, wheel3: 0) {
|
|
3279
|
+
ev.location = p
|
|
3280
|
+
ev.post(tap: .cghidEventTap)
|
|
3281
|
+
}
|
|
3282
|
+
`;
|
|
3283
|
+
}
|
|
3284
|
+
function asRecord4(value) {
|
|
3285
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
3286
|
+
return value;
|
|
3287
|
+
}
|
|
3288
|
+
function finite(value) {
|
|
3289
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
3290
|
+
}
|
|
3291
|
+
function point(value) {
|
|
3292
|
+
const n = Math.round(value);
|
|
3293
|
+
if (n < -8e3 || n > 2e4) return null;
|
|
3294
|
+
return n;
|
|
3295
|
+
}
|
|
3296
|
+
function scrollDelta(value) {
|
|
3297
|
+
const n = Math.round(value);
|
|
3298
|
+
if (n < -4e3 || n > 4e3) return null;
|
|
3299
|
+
return n;
|
|
3300
|
+
}
|
|
3301
|
+
function screenshotFile(cwd, now) {
|
|
3302
|
+
const root = isAbsolute2(cwd) ? cwd : tmpdir2();
|
|
3303
|
+
const dir = join12(root, ".context", "cli");
|
|
3304
|
+
mkdirSync4(dir, { recursive: true });
|
|
3305
|
+
return join12(dir, `computer-use-${now}.png`);
|
|
3306
|
+
}
|
|
3307
|
+
function screenshotMessage(width, height, scale) {
|
|
3308
|
+
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.`;
|
|
3309
|
+
}
|
|
3310
|
+
async function performComputerUse(opts) {
|
|
3311
|
+
if (!opts.enabled) return { ok: false, error: COMPUTER_USE_OFF };
|
|
3312
|
+
const rec = asRecord4(opts.input);
|
|
3313
|
+
const action = typeof rec.action === "string" ? rec.action : "";
|
|
3314
|
+
try {
|
|
3315
|
+
if (action === "screenshot") {
|
|
3316
|
+
const file = screenshotFile(opts.cwd, opts.now ?? Date.now());
|
|
3317
|
+
const captured = await opts.runner.screenshot(file);
|
|
3318
|
+
const geo = pointGeometry(captured);
|
|
3319
|
+
return {
|
|
3320
|
+
ok: true,
|
|
3321
|
+
action,
|
|
3322
|
+
path: file,
|
|
3323
|
+
width: geo.width,
|
|
3324
|
+
height: geo.height,
|
|
3325
|
+
scale: geo.scale,
|
|
3326
|
+
message: screenshotMessage(geo.width, geo.height, geo.scale)
|
|
3327
|
+
};
|
|
3328
|
+
}
|
|
3329
|
+
if (action === "click") {
|
|
3330
|
+
const x = finite(rec.x);
|
|
3331
|
+
const y = finite(rec.y);
|
|
3332
|
+
if (x === null || y === null) return { ok: false, error: "click requires finite x and y" };
|
|
3333
|
+
const px = point(x);
|
|
3334
|
+
const py = point(y);
|
|
3335
|
+
if (px === null || py === null) return { ok: false, error: "click point is out of range" };
|
|
3336
|
+
await opts.runner.runAppleScript(
|
|
3337
|
+
`tell application "System Events" to click at {${px}, ${py}}`
|
|
3338
|
+
);
|
|
3339
|
+
return { ok: true, action, message: `Clicked ${px}, ${py}.` };
|
|
3340
|
+
}
|
|
3341
|
+
if (action === "type") {
|
|
3342
|
+
const text = typeof rec.text === "string" ? rec.text : "";
|
|
3343
|
+
if (!text) return { ok: false, error: "type requires text" };
|
|
3344
|
+
if (text.length > 2e3) return { ok: false, error: "type text is longer than 2000 characters" };
|
|
3345
|
+
for (const script of typeScripts(text)) {
|
|
3346
|
+
await opts.runner.runAppleScript(script);
|
|
3347
|
+
}
|
|
3348
|
+
return { ok: true, action, message: `Typed ${text.length} characters.` };
|
|
3349
|
+
}
|
|
3350
|
+
if (action === "key") {
|
|
3351
|
+
const key = typeof rec.key === "string" ? rec.key.trim().toLowerCase() : "";
|
|
3352
|
+
const modifiers = Array.isArray(rec.modifiers) ? rec.modifiers.filter((item) => typeof item === "string") : [];
|
|
3353
|
+
if (!key) return { ok: false, error: "key requires key" };
|
|
3354
|
+
if (modifiers.some((name) => !MODIFIERS.has(name.toLowerCase()))) {
|
|
3355
|
+
return { ok: false, error: "key modifiers are command, shift, option, and control" };
|
|
3356
|
+
}
|
|
3357
|
+
const using = modifierClause(modifiers.map((name) => name.toLowerCase()));
|
|
3358
|
+
const code = KEY_CODES[key];
|
|
3359
|
+
const script = code !== void 0 ? `tell application "System Events" to key code ${code}${using}` : key.length === 1 ? `tell application "System Events" to keystroke ${appleScriptString(key)}${using}` : "";
|
|
3360
|
+
if (!script) return { ok: false, error: `unsupported key ${key}` };
|
|
3361
|
+
await opts.runner.runAppleScript(script);
|
|
3362
|
+
return { ok: true, action, message: `Pressed ${key}.` };
|
|
3363
|
+
}
|
|
3364
|
+
if (action === "scroll") {
|
|
3365
|
+
const x = finite(rec.x);
|
|
3366
|
+
const y = finite(rec.y);
|
|
3367
|
+
if (x === null || y === null) return { ok: false, error: "scroll requires finite x and y" };
|
|
3368
|
+
const px = point(x);
|
|
3369
|
+
const py = point(y);
|
|
3370
|
+
if (px === null || py === null) return { ok: false, error: "scroll point is out of range" };
|
|
3371
|
+
const dx = finite(rec.dx) ?? 0;
|
|
3372
|
+
const dy = finite(rec.dy) ?? 0;
|
|
3373
|
+
const sdx = scrollDelta(dx);
|
|
3374
|
+
const sdy = scrollDelta(dy);
|
|
3375
|
+
if (sdx === null || sdy === null) return { ok: false, error: "scroll delta is out of range" };
|
|
3376
|
+
if (sdx === 0 && sdy === 0) return { ok: false, error: "scroll requires dx or dy" };
|
|
3377
|
+
await opts.runner.scroll(px, py, sdx, sdy);
|
|
3378
|
+
return {
|
|
3379
|
+
ok: true,
|
|
3380
|
+
action,
|
|
3381
|
+
message: `Scrolled at ${px}, ${py} by ${sdx}, ${sdy}. Positive dx is right, positive dy is down.`
|
|
3382
|
+
};
|
|
3383
|
+
}
|
|
3384
|
+
return { ok: false, error: "action must be screenshot, click, type, key, or scroll" };
|
|
3385
|
+
} catch (err) {
|
|
3386
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3387
|
+
return { ok: false, error: message };
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
function formatComputerUseHint(enabled) {
|
|
3391
|
+
if (!enabled) {
|
|
3392
|
+
return "Computer use is off (Settings \u2192 Advanced). Say the visual pass was not seen.";
|
|
3393
|
+
}
|
|
3394
|
+
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.";
|
|
3395
|
+
}
|
|
3396
|
+
var macosComputerUseRunner = {
|
|
3397
|
+
async screenshot(file) {
|
|
3398
|
+
await execFileAsync("screencapture", ["-x", "-m", file]);
|
|
3399
|
+
return pngPointSize(readFileSync7(file));
|
|
3400
|
+
},
|
|
3401
|
+
async runAppleScript(script) {
|
|
3402
|
+
await execFileAsync("osascript", ["-e", script]);
|
|
3403
|
+
},
|
|
3404
|
+
async scroll(x, y, dx, dy) {
|
|
3405
|
+
await execFileAsync("swift", ["-e", scrollWheelSwift(x, y, dx, dy)]);
|
|
3406
|
+
}
|
|
3407
|
+
};
|
|
3408
|
+
|
|
3177
3409
|
// src/agent-rpc/client.ts
|
|
3178
3410
|
import { WebSocket } from "ws";
|
|
3179
3411
|
|
|
@@ -3181,12 +3413,14 @@ import { WebSocket } from "ws";
|
|
|
3181
3413
|
var PILOT_TOOL_NAMES = [
|
|
3182
3414
|
"present_artifact",
|
|
3183
3415
|
"wait_for_job",
|
|
3184
|
-
"stop_job"
|
|
3416
|
+
"stop_job",
|
|
3417
|
+
"computer_use"
|
|
3185
3418
|
];
|
|
3186
3419
|
var PILOT_TOOL_DESCRIPTIONS = {
|
|
3187
3420
|
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.",
|
|
3188
3421
|
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.",
|
|
3189
|
-
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."
|
|
3422
|
+
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.",
|
|
3423
|
+
computer_use: COMPUTER_USE_DESCRIPTION
|
|
3190
3424
|
};
|
|
3191
3425
|
|
|
3192
3426
|
// src/agents/claude-host.ts
|
|
@@ -3216,17 +3450,17 @@ function entryDir2() {
|
|
|
3216
3450
|
function claudeRunnerPath() {
|
|
3217
3451
|
const packagedDir = packagedCursorRuntimeDir();
|
|
3218
3452
|
if (packagedDir) {
|
|
3219
|
-
const packaged =
|
|
3453
|
+
const packaged = join13(packagedDir, "core-dist", "agents", "claude-runner.js");
|
|
3220
3454
|
if (existsSync12(packaged)) return packaged;
|
|
3221
3455
|
}
|
|
3222
3456
|
const root = entryDir2();
|
|
3223
3457
|
const candidates = [
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3458
|
+
join13(root, "agents", "claude-runner.js"),
|
|
3459
|
+
join13(root, "agents", "claude-runner.cjs"),
|
|
3460
|
+
join13(root, "dist", "agents", "claude-runner.js"),
|
|
3461
|
+
join13(root, "dist", "agents", "claude-runner.cjs"),
|
|
3462
|
+
join13(root, "claude-runner.ts"),
|
|
3463
|
+
join13(root, "src", "agents", "claude-runner.ts")
|
|
3230
3464
|
];
|
|
3231
3465
|
for (const candidate of candidates) {
|
|
3232
3466
|
if (existsSync12(candidate)) return candidate;
|
|
@@ -3634,7 +3868,7 @@ var claudeAdapter = {
|
|
|
3634
3868
|
);
|
|
3635
3869
|
}
|
|
3636
3870
|
const mode = permissionMode(thread);
|
|
3637
|
-
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-
|
|
3871
|
+
const { isOrchestratorThread: isOrchestratorThread2 } = await import("./global-workspace-EPVNFQVC.js");
|
|
3638
3872
|
const isOrchestrator = isOrchestratorThread2(thread);
|
|
3639
3873
|
const rpc = worktreeAgentRpc(isOrchestrator);
|
|
3640
3874
|
const injectedServers = await buildInjectedMcpServers({
|
|
@@ -3871,7 +4105,7 @@ ${hint}` : hint;
|
|
|
3871
4105
|
return { file: claude, args, cwd: thread.worktreePath };
|
|
3872
4106
|
},
|
|
3873
4107
|
async listLinearIssues(_repoPath) {
|
|
3874
|
-
const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-
|
|
4108
|
+
const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-V3A57XBR.js");
|
|
3875
4109
|
return listAssignedLinearIssues2();
|
|
3876
4110
|
}
|
|
3877
4111
|
};
|
|
@@ -3879,7 +4113,7 @@ ${hint}` : hint;
|
|
|
3879
4113
|
// src/agents/codex.ts
|
|
3880
4114
|
import { existsSync as existsSync14, statSync as statSync2 } from "fs";
|
|
3881
4115
|
import { homedir as homedir9 } from "os";
|
|
3882
|
-
import { join as
|
|
4116
|
+
import { join as join14 } from "path";
|
|
3883
4117
|
|
|
3884
4118
|
// src/agents/codex-items.ts
|
|
3885
4119
|
function eventsFromCodexItem(eventType, item) {
|
|
@@ -3968,7 +4202,7 @@ function usageFromCodex(usage, asContext = false) {
|
|
|
3968
4202
|
return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
|
|
3969
4203
|
}
|
|
3970
4204
|
function codexHomeDir() {
|
|
3971
|
-
return process.env.CODEX_HOME?.trim() ||
|
|
4205
|
+
return process.env.CODEX_HOME?.trim() || join14(homedir9(), ".codex");
|
|
3972
4206
|
}
|
|
3973
4207
|
function unwrapCodexMcpResult(result) {
|
|
3974
4208
|
if (result == null) return void 0;
|
|
@@ -3990,14 +4224,14 @@ function unwrapCodexMcpResult(result) {
|
|
|
3990
4224
|
return String(result);
|
|
3991
4225
|
}
|
|
3992
4226
|
}
|
|
3993
|
-
function
|
|
4227
|
+
function asRecord5(value) {
|
|
3994
4228
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
3995
4229
|
return value;
|
|
3996
4230
|
}
|
|
3997
4231
|
return void 0;
|
|
3998
4232
|
}
|
|
3999
4233
|
function codexLooksAuthenticated() {
|
|
4000
|
-
const authPath =
|
|
4234
|
+
const authPath = join14(codexHomeDir(), "auth.json");
|
|
4001
4235
|
if (!existsSync14(authPath)) return false;
|
|
4002
4236
|
try {
|
|
4003
4237
|
return statSync2(authPath).size > 2;
|
|
@@ -4042,7 +4276,7 @@ var codexAdapter = {
|
|
|
4042
4276
|
authenticated,
|
|
4043
4277
|
linearMcp,
|
|
4044
4278
|
warnings,
|
|
4045
|
-
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${
|
|
4279
|
+
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${join14(codexHomeDir(), "auth.json")})`
|
|
4046
4280
|
};
|
|
4047
4281
|
},
|
|
4048
4282
|
async buildTurn(thread, input) {
|
|
@@ -4150,7 +4384,7 @@ var codexAdapter = {
|
|
|
4150
4384
|
}
|
|
4151
4385
|
if (itemType === "mcp_tool_call" && item.id && item.server && item.tool) {
|
|
4152
4386
|
const name = `mcp__${item.server}__${item.tool}`;
|
|
4153
|
-
const input =
|
|
4387
|
+
const input = asRecord5(item.arguments);
|
|
4154
4388
|
const events = [
|
|
4155
4389
|
{ type: "tool_use", id: item.id, name, input }
|
|
4156
4390
|
];
|
|
@@ -4272,27 +4506,27 @@ var codexAdapter = {
|
|
|
4272
4506
|
// src/agents/cursor.ts
|
|
4273
4507
|
import { existsSync as existsSync17 } from "fs";
|
|
4274
4508
|
import { createRequire as createRequire6 } from "module";
|
|
4275
|
-
import { dirname as dirname9, join as
|
|
4509
|
+
import { dirname as dirname9, join as join17 } from "path";
|
|
4276
4510
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
4277
4511
|
|
|
4278
4512
|
// src/agents/cursor-sdk-resolve.ts
|
|
4279
|
-
import { existsSync as existsSync15, readFileSync as
|
|
4513
|
+
import { existsSync as existsSync15, readFileSync as readFileSync8 } from "fs";
|
|
4280
4514
|
import { createRequire as createRequire4 } from "module";
|
|
4281
|
-
import { basename, dirname as dirname7, join as
|
|
4515
|
+
import { basename, dirname as dirname7, join as join15 } from "path";
|
|
4282
4516
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
4283
4517
|
var CURSOR_SDK_INSTALL_HINT = "Cursor SDK is not installed. Settings \u2192 Agents \u2192 Cursor \u2192 Install (`npm i -g @cursor/sdk`). Sideboard does not ship the SDK \u2014 update it anytime without a new Sideboard build.";
|
|
4284
4518
|
function thisModuleFile() {
|
|
4285
4519
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
4286
|
-
if (cjsDir) return
|
|
4520
|
+
if (cjsDir) return join15(cjsDir, "cursor-sdk-resolve.js");
|
|
4287
4521
|
try {
|
|
4288
4522
|
return fileURLToPath4(import.meta.url);
|
|
4289
4523
|
} catch {
|
|
4290
|
-
return
|
|
4524
|
+
return join15(process.cwd(), "package.json");
|
|
4291
4525
|
}
|
|
4292
4526
|
}
|
|
4293
4527
|
function packageRootLooksLikeSdk(dir) {
|
|
4294
4528
|
try {
|
|
4295
|
-
const raw =
|
|
4529
|
+
const raw = readFileSync8(join15(dir, "package.json"), "utf8");
|
|
4296
4530
|
const pkg = JSON.parse(raw);
|
|
4297
4531
|
return pkg.name === "@cursor/sdk" && existsSync15(dir);
|
|
4298
4532
|
} catch {
|
|
@@ -4317,10 +4551,10 @@ function resolveCursorSdkRoot(opts) {
|
|
|
4317
4551
|
}
|
|
4318
4552
|
const globalNm = npmGlobalNodeModules(env);
|
|
4319
4553
|
if (globalNm) {
|
|
4320
|
-
const globalRoot =
|
|
4554
|
+
const globalRoot = join15(globalNm, "@cursor/sdk");
|
|
4321
4555
|
if (packageRootLooksLikeSdk(globalRoot)) return globalRoot;
|
|
4322
4556
|
}
|
|
4323
|
-
const cwdPkg =
|
|
4557
|
+
const cwdPkg = join15(process.cwd(), "package.json");
|
|
4324
4558
|
return resolvedPackageRoot(thisModuleFile()) ?? resolvedPackageRoot(cwdPkg);
|
|
4325
4559
|
}
|
|
4326
4560
|
function isCursorSdkInstalled(opts) {
|
|
@@ -4336,12 +4570,12 @@ function exportTarget(value) {
|
|
|
4336
4570
|
}
|
|
4337
4571
|
function cursorSdkEsmEntry(root) {
|
|
4338
4572
|
try {
|
|
4339
|
-
const pkg = JSON.parse(
|
|
4573
|
+
const pkg = JSON.parse(readFileSync8(join15(root, "package.json"), "utf8"));
|
|
4340
4574
|
const exp = pkg.exports;
|
|
4341
4575
|
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
4342
4576
|
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
4343
4577
|
if (!rel) return null;
|
|
4344
|
-
const entry =
|
|
4578
|
+
const entry = join15(root, rel);
|
|
4345
4579
|
return existsSync15(entry) ? entry : null;
|
|
4346
4580
|
} catch {
|
|
4347
4581
|
return null;
|
|
@@ -4358,7 +4592,7 @@ async function importCursorSdk(opts) {
|
|
|
4358
4592
|
try {
|
|
4359
4593
|
let entry = cursorSdkEsmEntry(root);
|
|
4360
4594
|
if (!entry) {
|
|
4361
|
-
const req = createRequire4(
|
|
4595
|
+
const req = createRequire4(join15(root, "package.json"));
|
|
4362
4596
|
entry = req.resolve("@cursor/sdk");
|
|
4363
4597
|
}
|
|
4364
4598
|
return unwrapCursorSdkModule(await import(pathToFileURL(entry).href));
|
|
@@ -4379,9 +4613,9 @@ function cursorSdkRipgrepCandidate(opts) {
|
|
|
4379
4613
|
const nm = nodeModulesDirForPackageRoot(root);
|
|
4380
4614
|
const pkg = cursorSdkPlatformRipgrepPackage();
|
|
4381
4615
|
const bin = process.platform === "win32" ? "rg.exe" : "rg";
|
|
4382
|
-
const sibling =
|
|
4616
|
+
const sibling = join15(nm, pkg, "bin", bin);
|
|
4383
4617
|
if (existsSync15(sibling)) return sibling;
|
|
4384
|
-
const nested =
|
|
4618
|
+
const nested = join15(root, "node_modules", pkg, "bin", bin);
|
|
4385
4619
|
return existsSync15(nested) ? nested : null;
|
|
4386
4620
|
}
|
|
4387
4621
|
|
|
@@ -4430,20 +4664,20 @@ function turnCostUsdFromCursorUsage(before, after) {
|
|
|
4430
4664
|
if (!(delta >= 0) || !Number.isFinite(delta)) return void 0;
|
|
4431
4665
|
return delta / 100;
|
|
4432
4666
|
}
|
|
4433
|
-
function
|
|
4667
|
+
function asRecord6(value) {
|
|
4434
4668
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
4435
4669
|
return value;
|
|
4436
4670
|
}
|
|
4437
4671
|
return void 0;
|
|
4438
4672
|
}
|
|
4439
4673
|
function normalizeCursorToolCall(name, args) {
|
|
4440
|
-
const raw =
|
|
4674
|
+
const raw = asRecord6(args);
|
|
4441
4675
|
const toolName = typeof raw?.toolName === "string" && raw.toolName.trim() ? raw.toolName.trim() : null;
|
|
4442
|
-
const looksLikeMcp = name === "mcp" || toolName != null && (typeof raw?.providerIdentifier === "string" ||
|
|
4676
|
+
const looksLikeMcp = name === "mcp" || toolName != null && (typeof raw?.providerIdentifier === "string" || asRecord6(raw?.args) != null);
|
|
4443
4677
|
if (looksLikeMcp && toolName) {
|
|
4444
4678
|
const providerRaw = typeof raw.providerIdentifier === "string" && raw.providerIdentifier.trim() ? raw.providerIdentifier.trim() : "sideboard";
|
|
4445
4679
|
const provider = providerRaw.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
4446
|
-
const nested =
|
|
4680
|
+
const nested = asRecord6(raw.args);
|
|
4447
4681
|
return {
|
|
4448
4682
|
name: `mcp__${provider}__${toolName}`,
|
|
4449
4683
|
input: nested ?? { toolName }
|
|
@@ -4454,7 +4688,7 @@ function normalizeCursorToolCall(name, args) {
|
|
|
4454
4688
|
function unwrapCursorToolResult(result) {
|
|
4455
4689
|
if (result == null) return void 0;
|
|
4456
4690
|
if (typeof result === "string") return result;
|
|
4457
|
-
const rec =
|
|
4691
|
+
const rec = asRecord6(result);
|
|
4458
4692
|
if (!rec) {
|
|
4459
4693
|
try {
|
|
4460
4694
|
return JSON.stringify(result);
|
|
@@ -4465,18 +4699,18 @@ function unwrapCursorToolResult(result) {
|
|
|
4465
4699
|
const collectTexts = (items) => {
|
|
4466
4700
|
const texts = [];
|
|
4467
4701
|
for (const item of items) {
|
|
4468
|
-
const row =
|
|
4702
|
+
const row = asRecord6(item);
|
|
4469
4703
|
if (!row) continue;
|
|
4470
4704
|
if (typeof row.text === "string") {
|
|
4471
4705
|
texts.push(row.text);
|
|
4472
4706
|
continue;
|
|
4473
4707
|
}
|
|
4474
|
-
const nested =
|
|
4708
|
+
const nested = asRecord6(row.text);
|
|
4475
4709
|
if (typeof nested?.text === "string") texts.push(nested.text);
|
|
4476
4710
|
}
|
|
4477
4711
|
return texts;
|
|
4478
4712
|
};
|
|
4479
|
-
const value =
|
|
4713
|
+
const value = asRecord6(rec.value);
|
|
4480
4714
|
if (value && Array.isArray(value.content)) {
|
|
4481
4715
|
const texts = collectTexts(value.content);
|
|
4482
4716
|
if (texts.length) return texts.join("\n");
|
|
@@ -4493,10 +4727,10 @@ function unwrapCursorToolResult(result) {
|
|
|
4493
4727
|
}
|
|
4494
4728
|
function cursorToolResultIsError(status, result) {
|
|
4495
4729
|
if (status === "error") return true;
|
|
4496
|
-
const rec =
|
|
4730
|
+
const rec = asRecord6(result);
|
|
4497
4731
|
if (!rec) return false;
|
|
4498
4732
|
if (rec.status === "error") return true;
|
|
4499
|
-
const value =
|
|
4733
|
+
const value = asRecord6(rec.value);
|
|
4500
4734
|
return value?.isError === true;
|
|
4501
4735
|
}
|
|
4502
4736
|
function cursorSdkMessageToEvents(msg) {
|
|
@@ -4599,7 +4833,7 @@ function parseCursorRunnerLine(line) {
|
|
|
4599
4833
|
// src/agents/cursor-ripgrep.ts
|
|
4600
4834
|
import { existsSync as existsSync16 } from "fs";
|
|
4601
4835
|
import { createRequire as createRequire5 } from "module";
|
|
4602
|
-
import { dirname as dirname8, isAbsolute as
|
|
4836
|
+
import { dirname as dirname8, isAbsolute as isAbsolute3, join as join16, parse, resolve as resolvePath } from "path";
|
|
4603
4837
|
var RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
|
|
4604
4838
|
function rgBinaryName() {
|
|
4605
4839
|
return process.platform === "win32" ? "rg.exe" : "rg";
|
|
@@ -4609,7 +4843,7 @@ function platformRipgrepPackage() {
|
|
|
4609
4843
|
}
|
|
4610
4844
|
function usableRipgrepPath(candidate) {
|
|
4611
4845
|
const raw = candidate?.trim();
|
|
4612
|
-
if (!raw || !
|
|
4846
|
+
if (!raw || !isAbsolute3(raw)) return null;
|
|
4613
4847
|
const readable = nodeReadableScriptPath(raw);
|
|
4614
4848
|
if (!existsSync16(readable) || isAsarPath(readable)) return null;
|
|
4615
4849
|
return readable;
|
|
@@ -4621,7 +4855,7 @@ function walkForBundledRipgrep(startFile) {
|
|
|
4621
4855
|
let dir = dirname8(resolvePath(startFile));
|
|
4622
4856
|
const root = parse(dir).root;
|
|
4623
4857
|
while (dir !== root) {
|
|
4624
|
-
const hit = usableRipgrepPath(
|
|
4858
|
+
const hit = usableRipgrepPath(join16(dir, "node_modules", pkg, "bin", name));
|
|
4625
4859
|
if (hit) return hit;
|
|
4626
4860
|
const next = dirname8(dir);
|
|
4627
4861
|
if (next === dir) break;
|
|
@@ -4633,7 +4867,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
4633
4867
|
try {
|
|
4634
4868
|
const req = createRequire5(fromFile);
|
|
4635
4869
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
4636
|
-
return usableRipgrepPath(
|
|
4870
|
+
return usableRipgrepPath(join16(dirname8(pkgJson), "bin", rgBinaryName()));
|
|
4637
4871
|
} catch {
|
|
4638
4872
|
return null;
|
|
4639
4873
|
}
|
|
@@ -4722,14 +4956,14 @@ function cursorRunnerPath() {
|
|
|
4722
4956
|
if (packaged) return packaged;
|
|
4723
4957
|
const root = entryDir3();
|
|
4724
4958
|
const candidates = [
|
|
4725
|
-
|
|
4726
|
-
|
|
4959
|
+
join17(root, "agents", "cursor-runner.js"),
|
|
4960
|
+
join17(root, "agents", "cursor-runner.cjs"),
|
|
4727
4961
|
// If somehow resolved from package root instead of dist/
|
|
4728
|
-
|
|
4729
|
-
|
|
4962
|
+
join17(root, "dist", "agents", "cursor-runner.js"),
|
|
4963
|
+
join17(root, "dist", "agents", "cursor-runner.cjs"),
|
|
4730
4964
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
4731
|
-
|
|
4732
|
-
|
|
4965
|
+
join17(root, "cursor-runner.ts"),
|
|
4966
|
+
join17(root, "src", "agents", "cursor-runner.ts")
|
|
4733
4967
|
];
|
|
4734
4968
|
for (const candidate of candidates) {
|
|
4735
4969
|
if (existsSync17(candidate)) return candidate;
|
|
@@ -4844,8 +5078,8 @@ import { existsSync as existsSync19 } from "fs";
|
|
|
4844
5078
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
4845
5079
|
|
|
4846
5080
|
// src/agent-rpc/opencode-hook.ts
|
|
4847
|
-
import { existsSync as existsSync18, mkdirSync as
|
|
4848
|
-
import { join as
|
|
5081
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync9, renameSync, writeFileSync as writeFileSync6 } from "fs";
|
|
5082
|
+
import { join as join18 } from "path";
|
|
4849
5083
|
var OPENCODE_PLUGIN_SOURCE = `import { tool } from "@opencode-ai/plugin"
|
|
4850
5084
|
|
|
4851
5085
|
const RPC_URL = process.env[${JSON.stringify(AGENT_RPC_URL_ENV)}] || ""
|
|
@@ -4950,17 +5184,33 @@ export const SideboardRpc = async (ctx) => {
|
|
|
4950
5184
|
return job("job.stop", args)
|
|
4951
5185
|
},
|
|
4952
5186
|
}),
|
|
5187
|
+
computer_use: tool({
|
|
5188
|
+
description: ${JSON.stringify(PILOT_TOOL_DESCRIPTIONS.computer_use)},
|
|
5189
|
+
args: {
|
|
5190
|
+
action: tool.schema.enum(["screenshot", "click", "type", "key", "scroll"]),
|
|
5191
|
+
x: tool.schema.number().optional().describe("Screen x in points, not PNG pixels"),
|
|
5192
|
+
y: tool.schema.number().optional().describe("Screen y in points, not PNG pixels"),
|
|
5193
|
+
text: opt("Text to type"),
|
|
5194
|
+
key: opt("One key: return, tab, escape, arrows, delete, or one character"),
|
|
5195
|
+
modifiers: tool.schema.array(tool.schema.string()).optional().describe("command, shift, option, control"),
|
|
5196
|
+
dx: tool.schema.number().optional().describe("Horizontal scroll in points. Positive is right"),
|
|
5197
|
+
dy: tool.schema.number().optional().describe("Vertical scroll in points. Positive is down"),
|
|
5198
|
+
},
|
|
5199
|
+
async execute(args) {
|
|
5200
|
+
return job("computer.act", args)
|
|
5201
|
+
},
|
|
5202
|
+
}),
|
|
4953
5203
|
},
|
|
4954
5204
|
}
|
|
4955
5205
|
}
|
|
4956
5206
|
`;
|
|
4957
5207
|
function writeOpencodeRpcPlugin() {
|
|
4958
|
-
const pluginDir =
|
|
4959
|
-
|
|
4960
|
-
const pluginFile =
|
|
5208
|
+
const pluginDir = join18(appDataDir(), "agent-rpc", "opencode");
|
|
5209
|
+
mkdirSync5(pluginDir, { recursive: true });
|
|
5210
|
+
const pluginFile = join18(pluginDir, "sideboard-rpc.js");
|
|
4961
5211
|
if (existsSync18(pluginFile)) {
|
|
4962
5212
|
try {
|
|
4963
|
-
if (
|
|
5213
|
+
if (readFileSync9(pluginFile, "utf8") === OPENCODE_PLUGIN_SOURCE) return pluginFile;
|
|
4964
5214
|
} catch {
|
|
4965
5215
|
}
|
|
4966
5216
|
}
|
|
@@ -5014,7 +5264,7 @@ var FALLBACK_OPENCODE_MODELS = [
|
|
|
5014
5264
|
];
|
|
5015
5265
|
var cachedOpencodeModels = null;
|
|
5016
5266
|
var OPENCODE_MODEL_CACHE_MS = 5 * 60 * 1e3;
|
|
5017
|
-
function
|
|
5267
|
+
function asRecord7(value) {
|
|
5018
5268
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
5019
5269
|
return value;
|
|
5020
5270
|
}
|
|
@@ -5194,7 +5444,7 @@ var opencodeAdapter = {
|
|
|
5194
5444
|
const name = part?.tool ?? part?.name ?? obj.tool ?? obj.name ?? "tool";
|
|
5195
5445
|
const state = part?.state;
|
|
5196
5446
|
const input = (state?.input && typeof state.input === "object" ? state.input : void 0) ?? part?.input ?? obj.input;
|
|
5197
|
-
const metadata =
|
|
5447
|
+
const metadata = asRecord7(state?.metadata);
|
|
5198
5448
|
const id = opencodeToolId(
|
|
5199
5449
|
name,
|
|
5200
5450
|
part?.callID ?? part?.id ?? obj.id,
|
|
@@ -5229,7 +5479,7 @@ var opencodeAdapter = {
|
|
|
5229
5479
|
}
|
|
5230
5480
|
if (obj.type === "subtask_event") {
|
|
5231
5481
|
const parentId = str(obj.childSessionID) ?? str(obj.childSessionId);
|
|
5232
|
-
const part =
|
|
5482
|
+
const part = asRecord7(obj.part);
|
|
5233
5483
|
if (!parentId || !part) return null;
|
|
5234
5484
|
if (part.type === "text" && str(part.text)) {
|
|
5235
5485
|
return withTaskParent(
|
|
@@ -5240,8 +5490,8 @@ var opencodeAdapter = {
|
|
|
5240
5490
|
if (part.type === "tool" || str(part.tool)) {
|
|
5241
5491
|
const name = str(part.tool) ?? str(part.name) ?? "tool";
|
|
5242
5492
|
const id = str(part.callID) ?? str(part.id) ?? `${parentId}-${name}`;
|
|
5243
|
-
const state =
|
|
5244
|
-
const input =
|
|
5493
|
+
const state = asRecord7(part.state);
|
|
5494
|
+
const input = asRecord7(state?.input) ?? asRecord7(part.input);
|
|
5245
5495
|
const nested = [
|
|
5246
5496
|
withEventParentId({ type: "tool_use", id, name, input }, parentId)
|
|
5247
5497
|
];
|
|
@@ -5345,7 +5595,7 @@ var opencodeAdapter = {
|
|
|
5345
5595
|
};
|
|
5346
5596
|
},
|
|
5347
5597
|
async listLinearIssues(_repoPath) {
|
|
5348
|
-
const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-
|
|
5598
|
+
const { listAssignedLinearIssues: listAssignedLinearIssues2 } = await import("./linear-list-V3A57XBR.js");
|
|
5349
5599
|
return listAssignedLinearIssues2();
|
|
5350
5600
|
}
|
|
5351
5601
|
};
|
|
@@ -5587,6 +5837,10 @@ export {
|
|
|
5587
5837
|
PLAN_MODE_OFF_INSTRUCTION,
|
|
5588
5838
|
planModeTurnInstruction,
|
|
5589
5839
|
permissionMode,
|
|
5840
|
+
COMPUTER_USE_DESCRIPTION,
|
|
5841
|
+
performComputerUse,
|
|
5842
|
+
formatComputerUseHint,
|
|
5843
|
+
macosComputerUseRunner,
|
|
5590
5844
|
claudeAdapter,
|
|
5591
5845
|
listCodexModels,
|
|
5592
5846
|
codexAdapter,
|