@sideboard-ai/core 0.1.352 → 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/agents/claude-runner.cjs +32 -28
- package/dist/agents/claude-runner.js +1 -1
- package/dist/agents/cursor-runner.cjs +20 -14
- package/dist/agents/cursor-runner.js +2 -2
- package/dist/{agents-4DQDWMSX.js → agents-5LFUHPSA.js} +2 -2
- package/dist/{agents-IV454BNN.js → agents-6B2HHICJ.js} +1 -1
- package/dist/{chunk-V2G6AGWM.js → chunk-AF5K6GQU.js} +1 -1
- package/dist/{chunk-PS6TD5MQ.js → chunk-EAV2ZF5S.js} +190 -20
- package/dist/{chunk-US2PGV3X.js → chunk-HMSXKV53.js} +18 -14
- package/dist/{chunk-PR5TOSRD.js → chunk-MX2XU4BS.js} +151 -58
- package/dist/{chunk-CQDJ4RX4.js → chunk-PKH3DRA6.js} +20 -16
- package/dist/{chunk-UDTFOKVX.js → chunk-Z3CGD5HC.js} +1 -1
- package/dist/index.cjs +700 -482
- package/dist/index.d.cts +109 -1
- package/dist/index.d.ts +109 -1
- package/dist/index.js +44 -7
- package/dist/mcp/run-stdio.cjs +569 -458
- package/dist/mcp/run-stdio.js +2 -2
- package/dist/{orchestrator-EY6GCYQG.js → orchestrator-UFHS2FOC.js} +3 -3
- package/dist/{orchestrator-5BCHUAFG.js → orchestrator-YCGWSIHF.js} +2 -2
- package/package.json +1 -1
|
@@ -3173,18 +3173,86 @@ function agentRpcChildEnv(rpc, cwd) {
|
|
|
3173
3173
|
// src/agents/claude-host.ts
|
|
3174
3174
|
import { existsSync as existsSync12 } from "fs";
|
|
3175
3175
|
import { createRequire as createRequire3 } from "module";
|
|
3176
|
-
import { dirname as dirname5, join as
|
|
3176
|
+
import { dirname as dirname5, join as join14 } from "path";
|
|
3177
3177
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3178
3178
|
|
|
3179
3179
|
// src/computer-use/computer-use.ts
|
|
3180
3180
|
import { execFile } from "child_process";
|
|
3181
|
-
import { mkdirSync as mkdirSync4, readFileSync as
|
|
3181
|
+
import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
3182
3182
|
import { tmpdir as tmpdir2 } from "os";
|
|
3183
|
-
import { isAbsolute as isAbsolute2, join as
|
|
3183
|
+
import { isAbsolute as isAbsolute2, join as join13 } from "path";
|
|
3184
3184
|
import { promisify } from "util";
|
|
3185
|
+
|
|
3186
|
+
// src/computer-use/bridge.ts
|
|
3187
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
3188
|
+
import { join as join12 } from "path";
|
|
3189
|
+
function computerUseBridgePath() {
|
|
3190
|
+
return join12(appDataDir(), "computer-use-bridge.json");
|
|
3191
|
+
}
|
|
3192
|
+
function readComputerUseBridge(file = computerUseBridgePath()) {
|
|
3193
|
+
try {
|
|
3194
|
+
const raw = JSON.parse(readFileSync7(file, "utf8"));
|
|
3195
|
+
if (typeof raw.port !== "number" || !Number.isInteger(raw.port)) return null;
|
|
3196
|
+
if (raw.port < 1 || raw.port > 65535) return null;
|
|
3197
|
+
if (typeof raw.token !== "string" || raw.token.length < 16) return null;
|
|
3198
|
+
return { port: raw.port, token: raw.token };
|
|
3199
|
+
} catch {
|
|
3200
|
+
return null;
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
function cgScrollWheels(dx, dy) {
|
|
3204
|
+
return { wheel1: -dy, wheel2: -dx };
|
|
3205
|
+
}
|
|
3206
|
+
async function bridgeError(res) {
|
|
3207
|
+
try {
|
|
3208
|
+
const body = await res.json();
|
|
3209
|
+
if (typeof body.error === "string" && body.error) return body.error;
|
|
3210
|
+
} catch {
|
|
3211
|
+
}
|
|
3212
|
+
return `computer use bridge returned ${res.status}`;
|
|
3213
|
+
}
|
|
3214
|
+
async function bridgeFetch(info, path, init) {
|
|
3215
|
+
try {
|
|
3216
|
+
return await fetch(`http://127.0.0.1:${info.port}${path}`, {
|
|
3217
|
+
...init,
|
|
3218
|
+
headers: {
|
|
3219
|
+
authorization: `Bearer ${info.token}`,
|
|
3220
|
+
...init.headers
|
|
3221
|
+
},
|
|
3222
|
+
signal: AbortSignal.timeout(15e3)
|
|
3223
|
+
});
|
|
3224
|
+
} catch {
|
|
3225
|
+
return null;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3228
|
+
async function postComputerUseBridge(event, file = computerUseBridgePath()) {
|
|
3229
|
+
const info = readComputerUseBridge(file);
|
|
3230
|
+
if (!info) return false;
|
|
3231
|
+
const res = await bridgeFetch(info, "/v1/event", {
|
|
3232
|
+
method: "POST",
|
|
3233
|
+
headers: { "content-type": "application/json" },
|
|
3234
|
+
body: JSON.stringify(event)
|
|
3235
|
+
});
|
|
3236
|
+
if (!res) return false;
|
|
3237
|
+
if (!res.ok) throw new Error(await bridgeError(res));
|
|
3238
|
+
return true;
|
|
3239
|
+
}
|
|
3240
|
+
async function fetchComputerUseScreenshot(file = computerUseBridgePath()) {
|
|
3241
|
+
const info = readComputerUseBridge(file);
|
|
3242
|
+
if (!info) return null;
|
|
3243
|
+
const res = await bridgeFetch(info, "/v1/screenshot", { method: "POST" });
|
|
3244
|
+
if (!res) return null;
|
|
3245
|
+
if (!res.ok) throw new Error(await bridgeError(res));
|
|
3246
|
+
const png = Buffer.from(await res.arrayBuffer());
|
|
3247
|
+
if (png.length < 24) throw new Error("screen capture was empty");
|
|
3248
|
+
const header = Number(res.headers.get("x-sideboard-scale"));
|
|
3249
|
+
return { png, scale: Number.isFinite(header) && header > 0 ? header : 1 };
|
|
3250
|
+
}
|
|
3251
|
+
|
|
3252
|
+
// src/computer-use/computer-use.ts
|
|
3185
3253
|
var execFileAsync = promisify(execFile);
|
|
3186
3254
|
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
|
|
3255
|
+
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. 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.";
|
|
3188
3256
|
var KEY_CODES = {
|
|
3189
3257
|
return: 36,
|
|
3190
3258
|
enter: 36,
|
|
@@ -3200,6 +3268,10 @@ var KEY_CODES = {
|
|
|
3200
3268
|
up: 126
|
|
3201
3269
|
};
|
|
3202
3270
|
var MODIFIERS = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
|
|
3271
|
+
function macKeyCode(key) {
|
|
3272
|
+
const code = KEY_CODES[key];
|
|
3273
|
+
return code === void 0 ? null : code;
|
|
3274
|
+
}
|
|
3203
3275
|
var PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
3204
3276
|
function appleScriptString(text) {
|
|
3205
3277
|
return `"${text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
@@ -3267,8 +3339,7 @@ function scrollWheelSwift(x, y, dx, dy) {
|
|
|
3267
3339
|
for (const n of [x, y, dx, dy]) {
|
|
3268
3340
|
if (!Number.isInteger(n)) throw new Error("scroll coordinates must be integers");
|
|
3269
3341
|
}
|
|
3270
|
-
const wheel1 =
|
|
3271
|
-
const wheel2 = -dx;
|
|
3342
|
+
const { wheel1, wheel2 } = cgScrollWheels(dx, dy);
|
|
3272
3343
|
return `import CoreGraphics
|
|
3273
3344
|
let src = CGEventSource(stateID: .hidSystemState)
|
|
3274
3345
|
let p = CGPoint(x: ${x}, y: ${y})
|
|
@@ -3300,9 +3371,13 @@ function scrollDelta(value) {
|
|
|
3300
3371
|
}
|
|
3301
3372
|
function screenshotFile(cwd, now) {
|
|
3302
3373
|
const root = isAbsolute2(cwd) ? cwd : tmpdir2();
|
|
3303
|
-
const dir =
|
|
3374
|
+
const dir = join13(root, ".context", "cli");
|
|
3304
3375
|
mkdirSync4(dir, { recursive: true });
|
|
3305
|
-
return
|
|
3376
|
+
return join13(dir, `computer-use-${now}.png`);
|
|
3377
|
+
}
|
|
3378
|
+
async function posted(runner, event) {
|
|
3379
|
+
if (!runner.postInput) return false;
|
|
3380
|
+
return runner.postInput(event);
|
|
3306
3381
|
}
|
|
3307
3382
|
function screenshotMessage(width, height, scale) {
|
|
3308
3383
|
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.`;
|
|
@@ -3333,17 +3408,21 @@ async function performComputerUse(opts) {
|
|
|
3333
3408
|
const px = point(x);
|
|
3334
3409
|
const py = point(y);
|
|
3335
3410
|
if (px === null || py === null) return { ok: false, error: "click point is out of range" };
|
|
3336
|
-
await opts.runner
|
|
3337
|
-
|
|
3338
|
-
|
|
3411
|
+
if (!await posted(opts.runner, { type: "click", x: px, y: py })) {
|
|
3412
|
+
await opts.runner.runAppleScript(
|
|
3413
|
+
`tell application "System Events" to click at {${px}, ${py}}`
|
|
3414
|
+
);
|
|
3415
|
+
}
|
|
3339
3416
|
return { ok: true, action, message: `Clicked ${px}, ${py}.` };
|
|
3340
3417
|
}
|
|
3341
3418
|
if (action === "type") {
|
|
3342
3419
|
const text = typeof rec.text === "string" ? rec.text : "";
|
|
3343
3420
|
if (!text) return { ok: false, error: "type requires text" };
|
|
3344
3421
|
if (text.length > 2e3) return { ok: false, error: "type text is longer than 2000 characters" };
|
|
3345
|
-
|
|
3346
|
-
|
|
3422
|
+
if (!await posted(opts.runner, { type: "type", text })) {
|
|
3423
|
+
for (const script of typeScripts(text)) {
|
|
3424
|
+
await opts.runner.runAppleScript(script);
|
|
3425
|
+
}
|
|
3347
3426
|
}
|
|
3348
3427
|
return { ok: true, action, message: `Typed ${text.length} characters.` };
|
|
3349
3428
|
}
|
|
@@ -3354,11 +3433,14 @@ async function performComputerUse(opts) {
|
|
|
3354
3433
|
if (modifiers.some((name) => !MODIFIERS.has(name.toLowerCase()))) {
|
|
3355
3434
|
return { ok: false, error: "key modifiers are command, shift, option, and control" };
|
|
3356
3435
|
}
|
|
3357
|
-
const
|
|
3358
|
-
const
|
|
3359
|
-
const
|
|
3436
|
+
const mods = modifiers.map((name) => name.toLowerCase());
|
|
3437
|
+
const using = modifierClause(mods);
|
|
3438
|
+
const code = macKeyCode(key);
|
|
3439
|
+
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}` : "";
|
|
3360
3440
|
if (!script) return { ok: false, error: `unsupported key ${key}` };
|
|
3361
|
-
await opts.runner
|
|
3441
|
+
if (!await posted(opts.runner, { type: "key", key, modifiers: mods })) {
|
|
3442
|
+
await opts.runner.runAppleScript(script);
|
|
3443
|
+
}
|
|
3362
3444
|
return { ok: true, action, message: `Pressed ${key}.` };
|
|
3363
3445
|
}
|
|
3364
3446
|
if (action === "scroll") {
|
|
@@ -3374,7 +3456,9 @@ async function performComputerUse(opts) {
|
|
|
3374
3456
|
const sdy = scrollDelta(dy);
|
|
3375
3457
|
if (sdx === null || sdy === null) return { ok: false, error: "scroll delta is out of range" };
|
|
3376
3458
|
if (sdx === 0 && sdy === 0) return { ok: false, error: "scroll requires dx or dy" };
|
|
3377
|
-
await opts.runner
|
|
3459
|
+
if (!await posted(opts.runner, { type: "scroll", x: px, y: py, dx: sdx, dy: sdy })) {
|
|
3460
|
+
await opts.runner.scroll(px, py, sdx, sdy);
|
|
3461
|
+
}
|
|
3378
3462
|
return {
|
|
3379
3463
|
ok: true,
|
|
3380
3464
|
action,
|
|
@@ -3395,14 +3479,23 @@ function formatComputerUseHint(enabled) {
|
|
|
3395
3479
|
}
|
|
3396
3480
|
var macosComputerUseRunner = {
|
|
3397
3481
|
async screenshot(file) {
|
|
3482
|
+
const via = await fetchComputerUseScreenshot();
|
|
3483
|
+
if (via) {
|
|
3484
|
+
writeFileSync6(file, via.png);
|
|
3485
|
+
const info = pngPointSize(via.png);
|
|
3486
|
+
return { ...info, scale: via.scale > 0 ? via.scale : info.scale };
|
|
3487
|
+
}
|
|
3398
3488
|
await execFileAsync("screencapture", ["-x", "-m", file]);
|
|
3399
|
-
return pngPointSize(
|
|
3489
|
+
return pngPointSize(readFileSync8(file));
|
|
3400
3490
|
},
|
|
3401
3491
|
async runAppleScript(script) {
|
|
3402
3492
|
await execFileAsync("osascript", ["-e", script]);
|
|
3403
3493
|
},
|
|
3404
3494
|
async scroll(x, y, dx, dy) {
|
|
3405
3495
|
await execFileAsync("swift", ["-e", scrollWheelSwift(x, y, dx, dy)]);
|
|
3496
|
+
},
|
|
3497
|
+
postInput(event) {
|
|
3498
|
+
return postComputerUseBridge(event);
|
|
3406
3499
|
}
|
|
3407
3500
|
};
|
|
3408
3501
|
|
|
@@ -3450,17 +3543,17 @@ function entryDir2() {
|
|
|
3450
3543
|
function claudeRunnerPath() {
|
|
3451
3544
|
const packagedDir = packagedCursorRuntimeDir();
|
|
3452
3545
|
if (packagedDir) {
|
|
3453
|
-
const packaged =
|
|
3546
|
+
const packaged = join14(packagedDir, "core-dist", "agents", "claude-runner.js");
|
|
3454
3547
|
if (existsSync12(packaged)) return packaged;
|
|
3455
3548
|
}
|
|
3456
3549
|
const root = entryDir2();
|
|
3457
3550
|
const candidates = [
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3551
|
+
join14(root, "agents", "claude-runner.js"),
|
|
3552
|
+
join14(root, "agents", "claude-runner.cjs"),
|
|
3553
|
+
join14(root, "dist", "agents", "claude-runner.js"),
|
|
3554
|
+
join14(root, "dist", "agents", "claude-runner.cjs"),
|
|
3555
|
+
join14(root, "claude-runner.ts"),
|
|
3556
|
+
join14(root, "src", "agents", "claude-runner.ts")
|
|
3464
3557
|
];
|
|
3465
3558
|
for (const candidate of candidates) {
|
|
3466
3559
|
if (existsSync12(candidate)) return candidate;
|
|
@@ -4113,7 +4206,7 @@ ${hint}` : hint;
|
|
|
4113
4206
|
// src/agents/codex.ts
|
|
4114
4207
|
import { existsSync as existsSync14, statSync as statSync2 } from "fs";
|
|
4115
4208
|
import { homedir as homedir9 } from "os";
|
|
4116
|
-
import { join as
|
|
4209
|
+
import { join as join15 } from "path";
|
|
4117
4210
|
|
|
4118
4211
|
// src/agents/codex-items.ts
|
|
4119
4212
|
function eventsFromCodexItem(eventType, item) {
|
|
@@ -4202,7 +4295,7 @@ function usageFromCodex(usage, asContext = false) {
|
|
|
4202
4295
|
return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
|
|
4203
4296
|
}
|
|
4204
4297
|
function codexHomeDir() {
|
|
4205
|
-
return process.env.CODEX_HOME?.trim() ||
|
|
4298
|
+
return process.env.CODEX_HOME?.trim() || join15(homedir9(), ".codex");
|
|
4206
4299
|
}
|
|
4207
4300
|
function unwrapCodexMcpResult(result) {
|
|
4208
4301
|
if (result == null) return void 0;
|
|
@@ -4231,7 +4324,7 @@ function asRecord5(value) {
|
|
|
4231
4324
|
return void 0;
|
|
4232
4325
|
}
|
|
4233
4326
|
function codexLooksAuthenticated() {
|
|
4234
|
-
const authPath =
|
|
4327
|
+
const authPath = join15(codexHomeDir(), "auth.json");
|
|
4235
4328
|
if (!existsSync14(authPath)) return false;
|
|
4236
4329
|
try {
|
|
4237
4330
|
return statSync2(authPath).size > 2;
|
|
@@ -4276,7 +4369,7 @@ var codexAdapter = {
|
|
|
4276
4369
|
authenticated,
|
|
4277
4370
|
linearMcp,
|
|
4278
4371
|
warnings,
|
|
4279
|
-
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${
|
|
4372
|
+
reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${join15(codexHomeDir(), "auth.json")})`
|
|
4280
4373
|
};
|
|
4281
4374
|
},
|
|
4282
4375
|
async buildTurn(thread, input) {
|
|
@@ -4506,27 +4599,27 @@ var codexAdapter = {
|
|
|
4506
4599
|
// src/agents/cursor.ts
|
|
4507
4600
|
import { existsSync as existsSync17 } from "fs";
|
|
4508
4601
|
import { createRequire as createRequire6 } from "module";
|
|
4509
|
-
import { dirname as dirname9, join as
|
|
4602
|
+
import { dirname as dirname9, join as join18 } from "path";
|
|
4510
4603
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
4511
4604
|
|
|
4512
4605
|
// src/agents/cursor-sdk-resolve.ts
|
|
4513
|
-
import { existsSync as existsSync15, readFileSync as
|
|
4606
|
+
import { existsSync as existsSync15, readFileSync as readFileSync9 } from "fs";
|
|
4514
4607
|
import { createRequire as createRequire4 } from "module";
|
|
4515
|
-
import { basename, dirname as dirname7, join as
|
|
4608
|
+
import { basename, dirname as dirname7, join as join16 } from "path";
|
|
4516
4609
|
import { fileURLToPath as fileURLToPath4, pathToFileURL } from "url";
|
|
4517
4610
|
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.";
|
|
4518
4611
|
function thisModuleFile() {
|
|
4519
4612
|
const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
|
|
4520
|
-
if (cjsDir) return
|
|
4613
|
+
if (cjsDir) return join16(cjsDir, "cursor-sdk-resolve.js");
|
|
4521
4614
|
try {
|
|
4522
4615
|
return fileURLToPath4(import.meta.url);
|
|
4523
4616
|
} catch {
|
|
4524
|
-
return
|
|
4617
|
+
return join16(process.cwd(), "package.json");
|
|
4525
4618
|
}
|
|
4526
4619
|
}
|
|
4527
4620
|
function packageRootLooksLikeSdk(dir) {
|
|
4528
4621
|
try {
|
|
4529
|
-
const raw =
|
|
4622
|
+
const raw = readFileSync9(join16(dir, "package.json"), "utf8");
|
|
4530
4623
|
const pkg = JSON.parse(raw);
|
|
4531
4624
|
return pkg.name === "@cursor/sdk" && existsSync15(dir);
|
|
4532
4625
|
} catch {
|
|
@@ -4551,10 +4644,10 @@ function resolveCursorSdkRoot(opts) {
|
|
|
4551
4644
|
}
|
|
4552
4645
|
const globalNm = npmGlobalNodeModules(env);
|
|
4553
4646
|
if (globalNm) {
|
|
4554
|
-
const globalRoot =
|
|
4647
|
+
const globalRoot = join16(globalNm, "@cursor/sdk");
|
|
4555
4648
|
if (packageRootLooksLikeSdk(globalRoot)) return globalRoot;
|
|
4556
4649
|
}
|
|
4557
|
-
const cwdPkg =
|
|
4650
|
+
const cwdPkg = join16(process.cwd(), "package.json");
|
|
4558
4651
|
return resolvedPackageRoot(thisModuleFile()) ?? resolvedPackageRoot(cwdPkg);
|
|
4559
4652
|
}
|
|
4560
4653
|
function isCursorSdkInstalled(opts) {
|
|
@@ -4570,12 +4663,12 @@ function exportTarget(value) {
|
|
|
4570
4663
|
}
|
|
4571
4664
|
function cursorSdkEsmEntry(root) {
|
|
4572
4665
|
try {
|
|
4573
|
-
const pkg = JSON.parse(
|
|
4666
|
+
const pkg = JSON.parse(readFileSync9(join16(root, "package.json"), "utf8"));
|
|
4574
4667
|
const exp = pkg.exports;
|
|
4575
4668
|
const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
|
|
4576
4669
|
const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
|
|
4577
4670
|
if (!rel) return null;
|
|
4578
|
-
const entry =
|
|
4671
|
+
const entry = join16(root, rel);
|
|
4579
4672
|
return existsSync15(entry) ? entry : null;
|
|
4580
4673
|
} catch {
|
|
4581
4674
|
return null;
|
|
@@ -4592,7 +4685,7 @@ async function importCursorSdk(opts) {
|
|
|
4592
4685
|
try {
|
|
4593
4686
|
let entry = cursorSdkEsmEntry(root);
|
|
4594
4687
|
if (!entry) {
|
|
4595
|
-
const req = createRequire4(
|
|
4688
|
+
const req = createRequire4(join16(root, "package.json"));
|
|
4596
4689
|
entry = req.resolve("@cursor/sdk");
|
|
4597
4690
|
}
|
|
4598
4691
|
return unwrapCursorSdkModule(await import(pathToFileURL(entry).href));
|
|
@@ -4613,9 +4706,9 @@ function cursorSdkRipgrepCandidate(opts) {
|
|
|
4613
4706
|
const nm = nodeModulesDirForPackageRoot(root);
|
|
4614
4707
|
const pkg = cursorSdkPlatformRipgrepPackage();
|
|
4615
4708
|
const bin = process.platform === "win32" ? "rg.exe" : "rg";
|
|
4616
|
-
const sibling =
|
|
4709
|
+
const sibling = join16(nm, pkg, "bin", bin);
|
|
4617
4710
|
if (existsSync15(sibling)) return sibling;
|
|
4618
|
-
const nested =
|
|
4711
|
+
const nested = join16(root, "node_modules", pkg, "bin", bin);
|
|
4619
4712
|
return existsSync15(nested) ? nested : null;
|
|
4620
4713
|
}
|
|
4621
4714
|
|
|
@@ -4833,7 +4926,7 @@ function parseCursorRunnerLine(line) {
|
|
|
4833
4926
|
// src/agents/cursor-ripgrep.ts
|
|
4834
4927
|
import { existsSync as existsSync16 } from "fs";
|
|
4835
4928
|
import { createRequire as createRequire5 } from "module";
|
|
4836
|
-
import { dirname as dirname8, isAbsolute as isAbsolute3, join as
|
|
4929
|
+
import { dirname as dirname8, isAbsolute as isAbsolute3, join as join17, parse, resolve as resolvePath } from "path";
|
|
4837
4930
|
var RIPGREP_ENV = "CURSOR_RIPGREP_PATH";
|
|
4838
4931
|
function rgBinaryName() {
|
|
4839
4932
|
return process.platform === "win32" ? "rg.exe" : "rg";
|
|
@@ -4855,7 +4948,7 @@ function walkForBundledRipgrep(startFile) {
|
|
|
4855
4948
|
let dir = dirname8(resolvePath(startFile));
|
|
4856
4949
|
const root = parse(dir).root;
|
|
4857
4950
|
while (dir !== root) {
|
|
4858
|
-
const hit = usableRipgrepPath(
|
|
4951
|
+
const hit = usableRipgrepPath(join17(dir, "node_modules", pkg, "bin", name));
|
|
4859
4952
|
if (hit) return hit;
|
|
4860
4953
|
const next = dirname8(dir);
|
|
4861
4954
|
if (next === dir) break;
|
|
@@ -4867,7 +4960,7 @@ function requireResolveBundledRipgrep(fromFile) {
|
|
|
4867
4960
|
try {
|
|
4868
4961
|
const req = createRequire5(fromFile);
|
|
4869
4962
|
const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
|
|
4870
|
-
return usableRipgrepPath(
|
|
4963
|
+
return usableRipgrepPath(join17(dirname8(pkgJson), "bin", rgBinaryName()));
|
|
4871
4964
|
} catch {
|
|
4872
4965
|
return null;
|
|
4873
4966
|
}
|
|
@@ -4956,14 +5049,14 @@ function cursorRunnerPath() {
|
|
|
4956
5049
|
if (packaged) return packaged;
|
|
4957
5050
|
const root = entryDir3();
|
|
4958
5051
|
const candidates = [
|
|
4959
|
-
|
|
4960
|
-
|
|
5052
|
+
join18(root, "agents", "cursor-runner.js"),
|
|
5053
|
+
join18(root, "agents", "cursor-runner.cjs"),
|
|
4961
5054
|
// If somehow resolved from package root instead of dist/
|
|
4962
|
-
|
|
4963
|
-
|
|
5055
|
+
join18(root, "dist", "agents", "cursor-runner.js"),
|
|
5056
|
+
join18(root, "dist", "agents", "cursor-runner.cjs"),
|
|
4964
5057
|
// Source tree (dev): packages/core/src/agents/cursor-runner.ts
|
|
4965
|
-
|
|
4966
|
-
|
|
5058
|
+
join18(root, "cursor-runner.ts"),
|
|
5059
|
+
join18(root, "src", "agents", "cursor-runner.ts")
|
|
4967
5060
|
];
|
|
4968
5061
|
for (const candidate of candidates) {
|
|
4969
5062
|
if (existsSync17(candidate)) return candidate;
|
|
@@ -5078,8 +5171,8 @@ import { existsSync as existsSync19 } from "fs";
|
|
|
5078
5171
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
5079
5172
|
|
|
5080
5173
|
// src/agent-rpc/opencode-hook.ts
|
|
5081
|
-
import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as
|
|
5082
|
-
import { join as
|
|
5174
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync10, renameSync, writeFileSync as writeFileSync7 } from "fs";
|
|
5175
|
+
import { join as join19 } from "path";
|
|
5083
5176
|
var OPENCODE_PLUGIN_SOURCE = `import { tool } from "@opencode-ai/plugin"
|
|
5084
5177
|
|
|
5085
5178
|
const RPC_URL = process.env[${JSON.stringify(AGENT_RPC_URL_ENV)}] || ""
|
|
@@ -5205,17 +5298,17 @@ export const SideboardRpc = async (ctx) => {
|
|
|
5205
5298
|
}
|
|
5206
5299
|
`;
|
|
5207
5300
|
function writeOpencodeRpcPlugin() {
|
|
5208
|
-
const pluginDir =
|
|
5301
|
+
const pluginDir = join19(appDataDir(), "agent-rpc", "opencode");
|
|
5209
5302
|
mkdirSync5(pluginDir, { recursive: true });
|
|
5210
|
-
const pluginFile =
|
|
5303
|
+
const pluginFile = join19(pluginDir, "sideboard-rpc.js");
|
|
5211
5304
|
if (existsSync18(pluginFile)) {
|
|
5212
5305
|
try {
|
|
5213
|
-
if (
|
|
5306
|
+
if (readFileSync10(pluginFile, "utf8") === OPENCODE_PLUGIN_SOURCE) return pluginFile;
|
|
5214
5307
|
} catch {
|
|
5215
5308
|
}
|
|
5216
5309
|
}
|
|
5217
5310
|
const tmp = `${pluginFile}.${process.pid}.tmp`;
|
|
5218
|
-
|
|
5311
|
+
writeFileSync7(tmp, OPENCODE_PLUGIN_SOURCE);
|
|
5219
5312
|
renameSync(tmp, pluginFile);
|
|
5220
5313
|
return pluginFile;
|
|
5221
5314
|
}
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
parseSessionQuotaResetAt,
|
|
22
22
|
planModeTurnInstruction,
|
|
23
23
|
resolveQuotaFallbackAgent
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-Z3CGD5HC.js";
|
|
25
25
|
import {
|
|
26
26
|
applyWorktreePkgCacheEnv,
|
|
27
27
|
buildBrightsySessionSeed,
|
|
@@ -242,7 +242,7 @@ import {
|
|
|
242
242
|
} from "./chunk-R4W4VQJZ.js";
|
|
243
243
|
import {
|
|
244
244
|
formatComputerUseHint
|
|
245
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-EAV2ZF5S.js";
|
|
246
246
|
import {
|
|
247
247
|
HISTORY_CLEANUP_INTERVAL_HOURS_DEFAULT,
|
|
248
248
|
applyTurnUsage,
|
|
@@ -832,8 +832,6 @@ async function removeWorktreeDroppingLeftovers(thread, deleteBranch) {
|
|
|
832
832
|
}
|
|
833
833
|
|
|
834
834
|
// src/git/agent-git-actions.ts
|
|
835
|
-
import { existsSync } from "fs";
|
|
836
|
-
import { join as join2 } from "path";
|
|
837
835
|
var 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.";
|
|
838
836
|
var AGENT_GIT_ACTIONS = [
|
|
839
837
|
"commit-push",
|
|
@@ -967,10 +965,6 @@ function entireGitActionExpansion(action, base) {
|
|
|
967
965
|
return "This phrase is the explicit ask to merge this thread's Trail change with `entire trail merge`. Do not force-push main/master or merge locally into the main checkout. Do not use `gh`.";
|
|
968
966
|
}
|
|
969
967
|
}
|
|
970
|
-
function worktreeHasAnnounceSkill(worktreePath) {
|
|
971
|
-
const root = worktreePath?.trim();
|
|
972
|
-
return !!root && existsSync(join2(root, ".claude/skills/announce-on-x/SKILL.md"));
|
|
973
|
-
}
|
|
974
968
|
function expandCanonicalGitRequest(prompt, opts) {
|
|
975
969
|
const trimmed = prompt.trim();
|
|
976
970
|
let action = null;
|
|
@@ -1004,7 +998,7 @@ function expandCanonicalGitRequest(prompt, opts) {
|
|
|
1004
998
|
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.";
|
|
1005
999
|
}
|
|
1006
1000
|
if (!expansion) return prompt;
|
|
1007
|
-
if (action === "merge" && (!base || isMainishPrBase(base)) &&
|
|
1001
|
+
if (action === "merge" && (!base || isMainishPrBase(base)) && opts?.hasAnnounceSkill) {
|
|
1008
1002
|
expansion = `${expansion} ${ANNOUNCE_AFTER_MERGE}`;
|
|
1009
1003
|
}
|
|
1010
1004
|
if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
|
|
@@ -1026,6 +1020,14 @@ function expansionPushes(action, prompt) {
|
|
|
1026
1020
|
return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
|
|
1027
1021
|
}
|
|
1028
1022
|
|
|
1023
|
+
// src/git/announce-skill.ts
|
|
1024
|
+
import { existsSync } from "fs";
|
|
1025
|
+
import { join as join2 } from "path";
|
|
1026
|
+
function announceSkillPresent(worktreePath) {
|
|
1027
|
+
const root = worktreePath?.trim();
|
|
1028
|
+
return !!root && existsSync(join2(root, ".claude/skills/announce-on-x/SKILL.md"));
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1029
1031
|
// src/git/pr-merge-archive.ts
|
|
1030
1032
|
function normalizePrState(state) {
|
|
1031
1033
|
return (state ?? "").trim().toUpperCase();
|
|
@@ -3594,7 +3596,7 @@ async function createThread(input, _onSetupLine) {
|
|
|
3594
3596
|
return readThread(thread.id) ?? thread;
|
|
3595
3597
|
}
|
|
3596
3598
|
async function listLinearIssues(agent, repoPath) {
|
|
3597
|
-
const { getAdapter: getAdapter2 } = await import("./agents-
|
|
3599
|
+
const { getAdapter: getAdapter2 } = await import("./agents-5LFUHPSA.js");
|
|
3598
3600
|
await requireAgent(agent, { requireLinear: true });
|
|
3599
3601
|
const adapter = getAdapter2(agent);
|
|
3600
3602
|
if (!adapter.listLinearIssues) {
|
|
@@ -6590,7 +6592,8 @@ function promptForJoinedSteer(input) {
|
|
|
6590
6592
|
input.worktreePath,
|
|
6591
6593
|
expandCanonicalGitRequest(input.latestPrompt, {
|
|
6592
6594
|
forge: input.gitForge,
|
|
6593
|
-
worktreePath: input.worktreePath
|
|
6595
|
+
worktreePath: input.worktreePath,
|
|
6596
|
+
hasAnnounceSkill: announceSkillPresent(input.worktreePath)
|
|
6594
6597
|
}),
|
|
6595
6598
|
{ attachments: latestAttachments }
|
|
6596
6599
|
);
|
|
@@ -8045,11 +8048,11 @@ function realDeps() {
|
|
|
8045
8048
|
parentIdForThread,
|
|
8046
8049
|
designatedId: designatedOrchestratorId,
|
|
8047
8050
|
send: async (threadId, prompt) => {
|
|
8048
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
8051
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-UFHS2FOC.js");
|
|
8049
8052
|
await getOrchestrator2().send(threadId, prompt, { followUp: "queue" });
|
|
8050
8053
|
},
|
|
8051
8054
|
startOrchestration: async (prompt) => {
|
|
8052
|
-
const { startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
8055
|
+
const { startOrchestration: startOrchestration2 } = await import("./orchestrator-UFHS2FOC.js");
|
|
8053
8056
|
const defaults = resolveOrchestratorDefaults();
|
|
8054
8057
|
await startOrchestration2({
|
|
8055
8058
|
goal: prompt,
|
|
@@ -8076,7 +8079,7 @@ function formatScheduledPrompt(name, prompt) {
|
|
|
8076
8079
|
${prompt}`;
|
|
8077
8080
|
}
|
|
8078
8081
|
async function defaultDeps() {
|
|
8079
|
-
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-
|
|
8082
|
+
const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-UFHS2FOC.js");
|
|
8080
8083
|
const orch = getOrchestrator2();
|
|
8081
8084
|
return {
|
|
8082
8085
|
findThread: (id) => findThreadByRef(id),
|
|
@@ -8277,7 +8280,7 @@ ${item.prompt}`);
|
|
|
8277
8280
|
}
|
|
8278
8281
|
}
|
|
8279
8282
|
async function defaultSend(id, prompt) {
|
|
8280
|
-
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-
|
|
8283
|
+
const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-UFHS2FOC.js");
|
|
8281
8284
|
await getOrchestrator2().send(id, prompt, { followUp: "join" });
|
|
8282
8285
|
}
|
|
8283
8286
|
function armChatFollowUps() {
|
|
@@ -9193,7 +9196,8 @@ var Orchestrator = class {
|
|
|
9193
9196
|
const turnOrigin = thread.worktreePath?.trim() ? await resolveOriginRemote(thread.worktreePath).catch(() => null) : null;
|
|
9194
9197
|
const gitPrompt = expandCanonicalGitRequest(promptText, {
|
|
9195
9198
|
forge: turnOrigin?.forge,
|
|
9196
|
-
worktreePath: thread.worktreePath
|
|
9199
|
+
worktreePath: thread.worktreePath,
|
|
9200
|
+
hasAnnounceSkill: announceSkillPresent(thread.worktreePath)
|
|
9197
9201
|
});
|
|
9198
9202
|
const expandedAttachments = openSteerTurnAttachments(this.openSteerPrompt.get(threadId), turnAttachments, autoContinue);
|
|
9199
9203
|
const { agentPrompt: expandedPrompt } = expandComposerPrompt(
|