@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/index.cjs CHANGED
@@ -18202,7 +18202,147 @@ var init_rpc_env = __esm({
18202
18202
  }
18203
18203
  });
18204
18204
 
18205
+ // src/computer-use/bridge.ts
18206
+ function computerUseBridgePath() {
18207
+ return (0, import_node_path46.join)(appDataDir(), "computer-use-bridge.json");
18208
+ }
18209
+ function readComputerUseBridge(file = computerUseBridgePath()) {
18210
+ try {
18211
+ const raw = JSON.parse((0, import_node_fs43.readFileSync)(file, "utf8"));
18212
+ if (typeof raw.port !== "number" || !Number.isInteger(raw.port)) return null;
18213
+ if (raw.port < 1 || raw.port > 65535) return null;
18214
+ if (typeof raw.token !== "string" || raw.token.length < 16) return null;
18215
+ return { port: raw.port, token: raw.token };
18216
+ } catch {
18217
+ return null;
18218
+ }
18219
+ }
18220
+ function intIn(value, min, max) {
18221
+ if (typeof value !== "number" || !Number.isInteger(value)) return null;
18222
+ if (value < min || value > max) return null;
18223
+ return value;
18224
+ }
18225
+ function parseComputerUseInput(value) {
18226
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
18227
+ const rec = value;
18228
+ if (rec.type === "click") {
18229
+ const x = intIn(rec.x, -8e3, 2e4);
18230
+ const y = intIn(rec.y, -8e3, 2e4);
18231
+ if (x === null || y === null) return null;
18232
+ return { type: "click", x, y };
18233
+ }
18234
+ if (rec.type === "type") {
18235
+ if (typeof rec.text !== "string" || !rec.text || rec.text.length > 2e3) return null;
18236
+ return { type: "type", text: rec.text };
18237
+ }
18238
+ if (rec.type === "key") {
18239
+ if (typeof rec.key !== "string" || !rec.key || rec.key.length > 32) return null;
18240
+ if (!Array.isArray(rec.modifiers) || rec.modifiers.length > 4) return null;
18241
+ const modifiers = [];
18242
+ for (const item of rec.modifiers) {
18243
+ if (typeof item !== "string" || !MODIFIERS.has(item)) return null;
18244
+ modifiers.push(item);
18245
+ }
18246
+ return { type: "key", key: rec.key, modifiers };
18247
+ }
18248
+ if (rec.type === "scroll") {
18249
+ const x = intIn(rec.x, -8e3, 2e4);
18250
+ const y = intIn(rec.y, -8e3, 2e4);
18251
+ const dx = intIn(rec.dx, -4e3, 4e3);
18252
+ const dy = intIn(rec.dy, -4e3, 4e3);
18253
+ if (x === null || y === null || dx === null || dy === null) return null;
18254
+ if (dx === 0 && dy === 0) return null;
18255
+ return { type: "scroll", x, y, dx, dy };
18256
+ }
18257
+ return null;
18258
+ }
18259
+ function cgModifierFlags(modifiers) {
18260
+ let flags = 0;
18261
+ for (const name of modifiers) {
18262
+ if (name === "shift") flags |= 131072;
18263
+ else if (name === "ctrl" || name === "control") flags |= 262144;
18264
+ else if (name === "alt" || name === "option") flags |= 524288;
18265
+ else if (name === "cmd" || name === "command") flags |= 1048576;
18266
+ }
18267
+ return flags;
18268
+ }
18269
+ function cgScrollWheels(dx, dy) {
18270
+ return { wheel1: -dy, wheel2: -dx };
18271
+ }
18272
+ function modifierKeyCode(name) {
18273
+ const code = MODIFIER_KEY_CODES[name];
18274
+ return code === void 0 ? null : code;
18275
+ }
18276
+ async function bridgeError(res) {
18277
+ try {
18278
+ const body = await res.json();
18279
+ if (typeof body.error === "string" && body.error) return body.error;
18280
+ } catch {
18281
+ }
18282
+ return `computer use bridge returned ${res.status}`;
18283
+ }
18284
+ async function bridgeFetch(info, path2, init) {
18285
+ try {
18286
+ return await fetch(`http://127.0.0.1:${info.port}${path2}`, {
18287
+ ...init,
18288
+ headers: {
18289
+ authorization: `Bearer ${info.token}`,
18290
+ ...init.headers
18291
+ },
18292
+ signal: AbortSignal.timeout(15e3)
18293
+ });
18294
+ } catch {
18295
+ return null;
18296
+ }
18297
+ }
18298
+ async function postComputerUseBridge(event, file = computerUseBridgePath()) {
18299
+ const info = readComputerUseBridge(file);
18300
+ if (!info) return false;
18301
+ const res = await bridgeFetch(info, "/v1/event", {
18302
+ method: "POST",
18303
+ headers: { "content-type": "application/json" },
18304
+ body: JSON.stringify(event)
18305
+ });
18306
+ if (!res) return false;
18307
+ if (!res.ok) throw new Error(await bridgeError(res));
18308
+ return true;
18309
+ }
18310
+ async function fetchComputerUseScreenshot(file = computerUseBridgePath()) {
18311
+ const info = readComputerUseBridge(file);
18312
+ if (!info) return null;
18313
+ const res = await bridgeFetch(info, "/v1/screenshot", { method: "POST" });
18314
+ if (!res) return null;
18315
+ if (!res.ok) throw new Error(await bridgeError(res));
18316
+ const png = Buffer.from(await res.arrayBuffer());
18317
+ if (png.length < 24) throw new Error("screen capture was empty");
18318
+ const header2 = Number(res.headers.get("x-sideboard-scale"));
18319
+ return { png, scale: Number.isFinite(header2) && header2 > 0 ? header2 : 1 };
18320
+ }
18321
+ var import_node_fs43, import_node_path46, MODIFIERS, MODIFIER_KEY_CODES;
18322
+ var init_bridge = __esm({
18323
+ "src/computer-use/bridge.ts"() {
18324
+ "use strict";
18325
+ import_node_fs43 = require("fs");
18326
+ import_node_path46 = require("path");
18327
+ init_paths();
18328
+ MODIFIERS = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
18329
+ MODIFIER_KEY_CODES = {
18330
+ command: 55,
18331
+ cmd: 55,
18332
+ shift: 56,
18333
+ option: 58,
18334
+ alt: 58,
18335
+ control: 59,
18336
+ ctrl: 59
18337
+ };
18338
+ }
18339
+ });
18340
+
18205
18341
  // src/computer-use/computer-use.ts
18342
+ function macKeyCode(key) {
18343
+ const code = KEY_CODES[key];
18344
+ return code === void 0 ? null : code;
18345
+ }
18206
18346
  function appleScriptString(text8) {
18207
18347
  return `"${text8.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
18208
18348
  }
@@ -18269,8 +18409,7 @@ function scrollWheelSwift(x, y, dx, dy) {
18269
18409
  for (const n of [x, y, dx, dy]) {
18270
18410
  if (!Number.isInteger(n)) throw new Error("scroll coordinates must be integers");
18271
18411
  }
18272
- const wheel1 = -dy;
18273
- const wheel2 = -dx;
18412
+ const { wheel1, wheel2 } = cgScrollWheels(dx, dy);
18274
18413
  return `import CoreGraphics
18275
18414
  let src = CGEventSource(stateID: .hidSystemState)
18276
18415
  let p = CGPoint(x: ${x}, y: ${y})
@@ -18301,10 +18440,14 @@ function scrollDelta(value) {
18301
18440
  return n;
18302
18441
  }
18303
18442
  function screenshotFile(cwd, now) {
18304
- const root = (0, import_node_path46.isAbsolute)(cwd) ? cwd : (0, import_node_os20.tmpdir)();
18305
- const dir = (0, import_node_path46.join)(root, ".context", "cli");
18306
- (0, import_node_fs43.mkdirSync)(dir, { recursive: true });
18307
- return (0, import_node_path46.join)(dir, `computer-use-${now}.png`);
18443
+ const root = (0, import_node_path47.isAbsolute)(cwd) ? cwd : (0, import_node_os20.tmpdir)();
18444
+ const dir = (0, import_node_path47.join)(root, ".context", "cli");
18445
+ (0, import_node_fs44.mkdirSync)(dir, { recursive: true });
18446
+ return (0, import_node_path47.join)(dir, `computer-use-${now}.png`);
18447
+ }
18448
+ async function posted(runner, event) {
18449
+ if (!runner.postInput) return false;
18450
+ return runner.postInput(event);
18308
18451
  }
18309
18452
  function screenshotMessage(width, height, scale) {
18310
18453
  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.`;
@@ -18335,17 +18478,21 @@ async function performComputerUse(opts) {
18335
18478
  const px = point(x);
18336
18479
  const py = point(y);
18337
18480
  if (px === null || py === null) return { ok: false, error: "click point is out of range" };
18338
- await opts.runner.runAppleScript(
18339
- `tell application "System Events" to click at {${px}, ${py}}`
18340
- );
18481
+ if (!await posted(opts.runner, { type: "click", x: px, y: py })) {
18482
+ await opts.runner.runAppleScript(
18483
+ `tell application "System Events" to click at {${px}, ${py}}`
18484
+ );
18485
+ }
18341
18486
  return { ok: true, action, message: `Clicked ${px}, ${py}.` };
18342
18487
  }
18343
18488
  if (action === "type") {
18344
18489
  const text8 = typeof rec.text === "string" ? rec.text : "";
18345
18490
  if (!text8) return { ok: false, error: "type requires text" };
18346
18491
  if (text8.length > 2e3) return { ok: false, error: "type text is longer than 2000 characters" };
18347
- for (const script of typeScripts(text8)) {
18348
- await opts.runner.runAppleScript(script);
18492
+ if (!await posted(opts.runner, { type: "type", text: text8 })) {
18493
+ for (const script of typeScripts(text8)) {
18494
+ await opts.runner.runAppleScript(script);
18495
+ }
18349
18496
  }
18350
18497
  return { ok: true, action, message: `Typed ${text8.length} characters.` };
18351
18498
  }
@@ -18353,14 +18500,17 @@ async function performComputerUse(opts) {
18353
18500
  const key = typeof rec.key === "string" ? rec.key.trim().toLowerCase() : "";
18354
18501
  const modifiers = Array.isArray(rec.modifiers) ? rec.modifiers.filter((item) => typeof item === "string") : [];
18355
18502
  if (!key) return { ok: false, error: "key requires key" };
18356
- if (modifiers.some((name) => !MODIFIERS.has(name.toLowerCase()))) {
18503
+ if (modifiers.some((name) => !MODIFIERS2.has(name.toLowerCase()))) {
18357
18504
  return { ok: false, error: "key modifiers are command, shift, option, and control" };
18358
18505
  }
18359
- const using = modifierClause(modifiers.map((name) => name.toLowerCase()));
18360
- const code = KEY_CODES[key];
18361
- 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}` : "";
18506
+ const mods = modifiers.map((name) => name.toLowerCase());
18507
+ const using = modifierClause(mods);
18508
+ const code = macKeyCode(key);
18509
+ 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}` : "";
18362
18510
  if (!script) return { ok: false, error: `unsupported key ${key}` };
18363
- await opts.runner.runAppleScript(script);
18511
+ if (!await posted(opts.runner, { type: "key", key, modifiers: mods })) {
18512
+ await opts.runner.runAppleScript(script);
18513
+ }
18364
18514
  return { ok: true, action, message: `Pressed ${key}.` };
18365
18515
  }
18366
18516
  if (action === "scroll") {
@@ -18376,7 +18526,9 @@ async function performComputerUse(opts) {
18376
18526
  const sdy = scrollDelta(dy);
18377
18527
  if (sdx === null || sdy === null) return { ok: false, error: "scroll delta is out of range" };
18378
18528
  if (sdx === 0 && sdy === 0) return { ok: false, error: "scroll requires dx or dy" };
18379
- await opts.runner.scroll(px, py, sdx, sdy);
18529
+ if (!await posted(opts.runner, { type: "scroll", x: px, y: py, dx: sdx, dy: sdy })) {
18530
+ await opts.runner.scroll(px, py, sdx, sdy);
18531
+ }
18380
18532
  return {
18381
18533
  ok: true,
18382
18534
  action,
@@ -18395,18 +18547,19 @@ function formatComputerUseHint(enabled) {
18395
18547
  }
18396
18548
  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.";
18397
18549
  }
18398
- var import_node_child_process6, import_node_fs43, import_node_os20, import_node_path46, import_node_util, execFileAsync, COMPUTER_USE_OFF, COMPUTER_USE_DESCRIPTION, KEY_CODES, MODIFIERS, PNG_SIG, macosComputerUseRunner;
18550
+ var import_node_child_process6, import_node_fs44, import_node_os20, import_node_path47, import_node_util, execFileAsync, COMPUTER_USE_OFF, COMPUTER_USE_DESCRIPTION, KEY_CODES, MODIFIERS2, PNG_SIG, macosComputerUseRunner;
18399
18551
  var init_computer_use = __esm({
18400
18552
  "src/computer-use/computer-use.ts"() {
18401
18553
  "use strict";
18402
18554
  import_node_child_process6 = require("child_process");
18403
- import_node_fs43 = require("fs");
18555
+ import_node_fs44 = require("fs");
18404
18556
  import_node_os20 = require("os");
18405
- import_node_path46 = require("path");
18557
+ import_node_path47 = require("path");
18406
18558
  import_node_util = require("util");
18559
+ init_bridge();
18407
18560
  execFileAsync = (0, import_node_util.promisify)(import_node_child_process6.execFile);
18408
18561
  COMPUTER_USE_OFF = "Computer use is off. Turn it on in Settings \u2192 Advanced.";
18409
- 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.";
18562
+ 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.";
18410
18563
  KEY_CODES = {
18411
18564
  return: 36,
18412
18565
  enter: 36,
@@ -18421,18 +18574,27 @@ var init_computer_use = __esm({
18421
18574
  down: 125,
18422
18575
  up: 126
18423
18576
  };
18424
- MODIFIERS = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
18577
+ MODIFIERS2 = /* @__PURE__ */ new Set(["command", "cmd", "shift", "option", "alt", "control", "ctrl"]);
18425
18578
  PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
18426
18579
  macosComputerUseRunner = {
18427
18580
  async screenshot(file) {
18581
+ const via = await fetchComputerUseScreenshot();
18582
+ if (via) {
18583
+ (0, import_node_fs44.writeFileSync)(file, via.png);
18584
+ const info = pngPointSize(via.png);
18585
+ return { ...info, scale: via.scale > 0 ? via.scale : info.scale };
18586
+ }
18428
18587
  await execFileAsync("screencapture", ["-x", "-m", file]);
18429
- return pngPointSize((0, import_node_fs43.readFileSync)(file));
18588
+ return pngPointSize((0, import_node_fs44.readFileSync)(file));
18430
18589
  },
18431
18590
  async runAppleScript(script) {
18432
18591
  await execFileAsync("osascript", ["-e", script]);
18433
18592
  },
18434
18593
  async scroll(x, y, dx, dy) {
18435
18594
  await execFileAsync("swift", ["-e", scrollWheelSwift(x, y, dx, dy)]);
18595
+ },
18596
+ postInput(event) {
18597
+ return postComputerUseBridge(event);
18436
18598
  }
18437
18599
  };
18438
18600
  }
@@ -18485,11 +18647,11 @@ function entryDir2() {
18485
18647
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
18486
18648
  if (cjsDir) return cjsDir;
18487
18649
  try {
18488
- return (0, import_node_path47.dirname)((0, import_node_url3.fileURLToPath)(import_meta6.url));
18650
+ return (0, import_node_path48.dirname)((0, import_node_url3.fileURLToPath)(import_meta6.url));
18489
18651
  } catch {
18490
18652
  try {
18491
18653
  const req = (0, import_node_module3.createRequire)(process.cwd() + "/");
18492
- return (0, import_node_path47.dirname)(req.resolve("@sideboard-ai/core"));
18654
+ return (0, import_node_path48.dirname)(req.resolve("@sideboard-ai/core"));
18493
18655
  } catch {
18494
18656
  return process.cwd();
18495
18657
  }
@@ -18498,20 +18660,20 @@ function entryDir2() {
18498
18660
  function claudeRunnerPath() {
18499
18661
  const packagedDir = packagedCursorRuntimeDir();
18500
18662
  if (packagedDir) {
18501
- const packaged = (0, import_node_path47.join)(packagedDir, "core-dist", "agents", "claude-runner.js");
18502
- if ((0, import_node_fs44.existsSync)(packaged)) return packaged;
18663
+ const packaged = (0, import_node_path48.join)(packagedDir, "core-dist", "agents", "claude-runner.js");
18664
+ if ((0, import_node_fs45.existsSync)(packaged)) return packaged;
18503
18665
  }
18504
18666
  const root = entryDir2();
18505
18667
  const candidates = [
18506
- (0, import_node_path47.join)(root, "agents", "claude-runner.js"),
18507
- (0, import_node_path47.join)(root, "agents", "claude-runner.cjs"),
18508
- (0, import_node_path47.join)(root, "dist", "agents", "claude-runner.js"),
18509
- (0, import_node_path47.join)(root, "dist", "agents", "claude-runner.cjs"),
18510
- (0, import_node_path47.join)(root, "claude-runner.ts"),
18511
- (0, import_node_path47.join)(root, "src", "agents", "claude-runner.ts")
18668
+ (0, import_node_path48.join)(root, "agents", "claude-runner.js"),
18669
+ (0, import_node_path48.join)(root, "agents", "claude-runner.cjs"),
18670
+ (0, import_node_path48.join)(root, "dist", "agents", "claude-runner.js"),
18671
+ (0, import_node_path48.join)(root, "dist", "agents", "claude-runner.cjs"),
18672
+ (0, import_node_path48.join)(root, "claude-runner.ts"),
18673
+ (0, import_node_path48.join)(root, "src", "agents", "claude-runner.ts")
18512
18674
  ];
18513
18675
  for (const candidate of candidates) {
18514
- if ((0, import_node_fs44.existsSync)(candidate)) return candidate;
18676
+ if ((0, import_node_fs45.existsSync)(candidate)) return candidate;
18515
18677
  }
18516
18678
  return candidates[0];
18517
18679
  }
@@ -18535,13 +18697,13 @@ async function buildClaudeRpcTurnCommand(req) {
18535
18697
  }
18536
18698
  };
18537
18699
  }
18538
- var import_node_fs44, import_node_module3, import_node_path47, import_node_url3, import_meta6;
18700
+ var import_node_fs45, import_node_module3, import_node_path48, import_node_url3, import_meta6;
18539
18701
  var init_claude_host = __esm({
18540
18702
  "src/agents/claude-host.ts"() {
18541
18703
  "use strict";
18542
- import_node_fs44 = require("fs");
18704
+ import_node_fs45 = require("fs");
18543
18705
  import_node_module3 = require("module");
18544
- import_node_path47 = require("path");
18706
+ import_node_path48 = require("path");
18545
18707
  import_node_url3 = require("url");
18546
18708
  init_protocol2();
18547
18709
  init_pilot_tools();
@@ -18633,11 +18795,11 @@ function issueAttachmentWorktreePath(repoPath) {
18633
18795
  return raw || process.cwd();
18634
18796
  }
18635
18797
  function ensureIssueAttachmentsDir(worktreePath) {
18636
- const dir = (0, import_node_path48.join)(worktreePath, ATTACHMENTS_DIR);
18637
- (0, import_node_fs45.mkdirSync)(dir, { recursive: true });
18638
- const gi = (0, import_node_path48.join)(dir, ".gitignore");
18639
- if (!(0, import_node_fs45.existsSync)(gi)) {
18640
- (0, import_node_fs45.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
18798
+ const dir = (0, import_node_path49.join)(worktreePath, ATTACHMENTS_DIR);
18799
+ (0, import_node_fs46.mkdirSync)(dir, { recursive: true });
18800
+ const gi = (0, import_node_path49.join)(dir, ".gitignore");
18801
+ if (!(0, import_node_fs46.existsSync)(gi)) {
18802
+ (0, import_node_fs46.writeFileSync)(gi, attachmentsGitignoreBody(), "utf8");
18641
18803
  }
18642
18804
  return dir;
18643
18805
  }
@@ -18667,7 +18829,7 @@ function looksLikeFileUrl(url) {
18667
18829
  function filenameFromUrl(url, fallback = "attachment") {
18668
18830
  try {
18669
18831
  const parsed = new URL(url);
18670
- const last = decodeURIComponent((0, import_node_path48.basename)(parsed.pathname)).replace(/[/\\]/g, "_");
18832
+ const last = decodeURIComponent((0, import_node_path49.basename)(parsed.pathname)).replace(/[/\\]/g, "_");
18671
18833
  if (last && last !== "/" && last !== ".") return last;
18672
18834
  } catch {
18673
18835
  }
@@ -18689,12 +18851,12 @@ function filenameFromContentDisposition(header2) {
18689
18851
  }
18690
18852
  function uniqueAttachmentFileName(dir, originalName) {
18691
18853
  const safe = originalName.replace(/[/\\]/g, "_").replace(/^\.+/, "") || "file";
18692
- if (!(0, import_node_fs45.existsSync)((0, import_node_path48.join)(dir, safe))) return safe;
18693
- const ext = (0, import_node_path48.extname)(safe);
18854
+ if (!(0, import_node_fs46.existsSync)((0, import_node_path49.join)(dir, safe))) return safe;
18855
+ const ext = (0, import_node_path49.extname)(safe);
18694
18856
  const stem = ext ? safe.slice(0, -ext.length) : safe;
18695
18857
  for (let i = 1; i < 1e4; i++) {
18696
18858
  const candidate = `${stem}-${i}${ext}`;
18697
- if (!(0, import_node_fs45.existsSync)((0, import_node_path48.join)(dir, candidate))) return candidate;
18859
+ if (!(0, import_node_fs46.existsSync)((0, import_node_path49.join)(dir, candidate))) return candidate;
18698
18860
  }
18699
18861
  return `${stem}-${(0, import_node_crypto15.randomUUID)()}${ext}`;
18700
18862
  }
@@ -18742,7 +18904,7 @@ function mergeIssueAttachments(items) {
18742
18904
  return out;
18743
18905
  }
18744
18906
  function extensionForContentType(contentType, name) {
18745
- if ((0, import_node_path48.extname)(name)) return name;
18907
+ if ((0, import_node_path49.extname)(name)) return name;
18746
18908
  const mime = (contentType ?? "").split(";")[0]?.trim().toLowerCase() ?? "";
18747
18909
  const ext = EXT_BY_MIME[mime];
18748
18910
  return ext ? `${name}${ext}` : name;
@@ -18794,7 +18956,7 @@ async function downloadAuthenticatedFile(opts) {
18794
18956
  const dir = ensureIssueAttachmentsDir(opts.worktreePath);
18795
18957
  const hinted = opts.name?.trim() || filenameFromContentDisposition(res.headers.get("content-disposition")) || filenameFromUrl(url);
18796
18958
  const name = uniqueAttachmentFileName(dir, extensionForContentType(contentType, hinted));
18797
- (0, import_node_fs45.writeFileSync)((0, import_node_path48.join)(dir, name), buf);
18959
+ (0, import_node_fs46.writeFileSync)((0, import_node_path49.join)(dir, name), buf);
18798
18960
  return {
18799
18961
  name,
18800
18962
  path: `${ATTACHMENTS_DIR}/${name}`,
@@ -18802,12 +18964,12 @@ async function downloadAuthenticatedFile(opts) {
18802
18964
  ...contentType ? { contentType } : {}
18803
18965
  };
18804
18966
  }
18805
- var import_node_fs45, import_node_path48, import_node_crypto15, ISSUE_ATTACHMENT_MAX_BYTES, MARKDOWN_IMAGE_RE, MARKDOWN_LINK_RE, HTML_SRC_RE, BARE_URL_RE, EXT_BY_MIME;
18967
+ var import_node_fs46, import_node_path49, import_node_crypto15, ISSUE_ATTACHMENT_MAX_BYTES, MARKDOWN_IMAGE_RE, MARKDOWN_LINK_RE, HTML_SRC_RE, BARE_URL_RE, EXT_BY_MIME;
18806
18968
  var init_issue_attachments = __esm({
18807
18969
  "src/integrations/issue-attachments.ts"() {
18808
18970
  "use strict";
18809
- import_node_fs45 = require("fs");
18810
- import_node_path48 = require("path");
18971
+ import_node_fs46 = require("fs");
18972
+ import_node_path49 = require("path");
18811
18973
  import_node_crypto15 = require("crypto");
18812
18974
  init_fetch();
18813
18975
  init_workspace_scratch();
@@ -20634,12 +20796,12 @@ function compactMetadataFromClaude(obj) {
20634
20796
  const postTokens = typeof post === "number" && Number.isFinite(post) && post > 0 ? Math.round(post) : void 0;
20635
20797
  return { trigger, postTokens };
20636
20798
  }
20637
- var import_node_fs46, import_node_path49, CLAUDE_PROMPT_ARG_MAX, claudeAdapter;
20799
+ var import_node_fs47, import_node_path50, CLAUDE_PROMPT_ARG_MAX, claudeAdapter;
20638
20800
  var init_claude = __esm({
20639
20801
  "src/agents/claude.ts"() {
20640
20802
  "use strict";
20641
- import_node_fs46 = require("fs");
20642
- import_node_path49 = require("path");
20803
+ import_node_fs47 = require("fs");
20804
+ import_node_path50 = require("path");
20643
20805
  init_run();
20644
20806
  init_app_settings();
20645
20807
  init_claude_mcp_status();
@@ -20659,7 +20821,7 @@ var init_claude = __esm({
20659
20821
  async detect() {
20660
20822
  const claude = resolveClaudeExecutable();
20661
20823
  if (claude !== "claude") {
20662
- if (!(0, import_node_fs46.existsSync)(claude)) {
20824
+ if (!(0, import_node_fs47.existsSync)(claude)) {
20663
20825
  return {
20664
20826
  agent: "claude",
20665
20827
  installed: false,
@@ -20817,7 +20979,7 @@ ${hint}` : hint;
20817
20979
  cwd: thread.worktreePath,
20818
20980
  stdin: useStdin ? `${promptText}
20819
20981
  ` : void 0,
20820
- ...mcpConfigPath ? { cleanupDirs: [(0, import_node_path49.dirname)(mcpConfigPath)] } : {},
20982
+ ...mcpConfigPath ? { cleanupDirs: [(0, import_node_path50.dirname)(mcpConfigPath)] } : {},
20821
20983
  // Nested Task/Agent thinking+text in stream-json (Claude Code 2.1.211+).
20822
20984
  // Raise the -p background-agent wait so long TaskOutput polls are not
20823
20985
  // abandoned at Claude Code’s 10-minute default.
@@ -20997,7 +21159,7 @@ async function listCodexModels() {
20997
21159
  if (codex === "codex") {
20998
21160
  const which = await run("which", ["codex"], { reject: false });
20999
21161
  if (which.exitCode !== 0) return FALLBACK_CODEX_MODELS;
21000
- } else if (!(0, import_node_fs47.existsSync)(codex)) {
21162
+ } else if (!(0, import_node_fs48.existsSync)(codex)) {
21001
21163
  return FALLBACK_CODEX_MODELS;
21002
21164
  }
21003
21165
  const listed = await run(codex, ["debug", "models"], { reject: false });
@@ -21034,7 +21196,7 @@ function usageFromCodex(usage, asContext = false) {
21034
21196
  return occ > 0 ? { ...mapped, lastRequestTokens: occ } : mapped;
21035
21197
  }
21036
21198
  function codexHomeDir() {
21037
- return process.env.CODEX_HOME?.trim() || (0, import_node_path50.join)((0, import_node_os21.homedir)(), ".codex");
21199
+ return process.env.CODEX_HOME?.trim() || (0, import_node_path51.join)((0, import_node_os21.homedir)(), ".codex");
21038
21200
  }
21039
21201
  function unwrapCodexMcpResult(result) {
21040
21202
  if (result == null) return void 0;
@@ -21063,21 +21225,21 @@ function asRecord7(value) {
21063
21225
  return void 0;
21064
21226
  }
21065
21227
  function codexLooksAuthenticated() {
21066
- const authPath = (0, import_node_path50.join)(codexHomeDir(), "auth.json");
21067
- if (!(0, import_node_fs47.existsSync)(authPath)) return false;
21228
+ const authPath = (0, import_node_path51.join)(codexHomeDir(), "auth.json");
21229
+ if (!(0, import_node_fs48.existsSync)(authPath)) return false;
21068
21230
  try {
21069
- return (0, import_node_fs47.statSync)(authPath).size > 2;
21231
+ return (0, import_node_fs48.statSync)(authPath).size > 2;
21070
21232
  } catch {
21071
21233
  return false;
21072
21234
  }
21073
21235
  }
21074
- var import_node_fs47, import_node_os21, import_node_path50, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
21236
+ var import_node_fs48, import_node_os21, import_node_path51, CODEX_PROMPT_ARG_MAX, FALLBACK_CODEX_MODELS, cachedCodexModels, CODEX_MODEL_CACHE_MS, codexAdapter;
21075
21237
  var init_codex = __esm({
21076
21238
  "src/agents/codex.ts"() {
21077
21239
  "use strict";
21078
- import_node_fs47 = require("fs");
21240
+ import_node_fs48 = require("fs");
21079
21241
  import_node_os21 = require("os");
21080
- import_node_path50 = require("path");
21242
+ import_node_path51 = require("path");
21081
21243
  init_run();
21082
21244
  init_app_settings();
21083
21245
  init_global_workspace();
@@ -21106,7 +21268,7 @@ var init_codex = __esm({
21106
21268
  async detect() {
21107
21269
  const codex = resolveAgentExecutable("codex");
21108
21270
  if (codex !== "codex") {
21109
- if (!(0, import_node_fs47.existsSync)(codex)) {
21271
+ if (!(0, import_node_fs48.existsSync)(codex)) {
21110
21272
  return {
21111
21273
  agent: "codex",
21112
21274
  installed: false,
@@ -21138,7 +21300,7 @@ var init_codex = __esm({
21138
21300
  authenticated,
21139
21301
  linearMcp,
21140
21302
  warnings,
21141
- reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${(0, import_node_path50.join)(codexHomeDir(), "auth.json")})`
21303
+ reason: authenticated ? void 0 : `Codex auth not found \u2014 run \`codex login\` (expected ${(0, import_node_path51.join)(codexHomeDir(), "auth.json")})`
21142
21304
  };
21143
21305
  },
21144
21306
  async buildTurn(thread, input) {
@@ -21370,18 +21532,18 @@ var init_codex = __esm({
21370
21532
  // src/agents/cursor-sdk-resolve.ts
21371
21533
  function thisModuleFile() {
21372
21534
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
21373
- if (cjsDir) return (0, import_node_path51.join)(cjsDir, "cursor-sdk-resolve.js");
21535
+ if (cjsDir) return (0, import_node_path52.join)(cjsDir, "cursor-sdk-resolve.js");
21374
21536
  try {
21375
21537
  return (0, import_node_url4.fileURLToPath)(import_meta7.url);
21376
21538
  } catch {
21377
- return (0, import_node_path51.join)(process.cwd(), "package.json");
21539
+ return (0, import_node_path52.join)(process.cwd(), "package.json");
21378
21540
  }
21379
21541
  }
21380
21542
  function packageRootLooksLikeSdk(dir) {
21381
21543
  try {
21382
- const raw = (0, import_node_fs48.readFileSync)((0, import_node_path51.join)(dir, "package.json"), "utf8");
21544
+ const raw = (0, import_node_fs49.readFileSync)((0, import_node_path52.join)(dir, "package.json"), "utf8");
21383
21545
  const pkg = JSON.parse(raw);
21384
- return pkg.name === "@cursor/sdk" && (0, import_node_fs48.existsSync)(dir);
21546
+ return pkg.name === "@cursor/sdk" && (0, import_node_fs49.existsSync)(dir);
21385
21547
  } catch {
21386
21548
  return false;
21387
21549
  }
@@ -21390,7 +21552,7 @@ function resolvedPackageRoot(fromFile) {
21390
21552
  try {
21391
21553
  const req = (0, import_node_module4.createRequire)(fromFile);
21392
21554
  const pkgJson = req.resolve("@cursor/sdk/package.json");
21393
- const root = (0, import_node_path51.dirname)(pkgJson);
21555
+ const root = (0, import_node_path52.dirname)(pkgJson);
21394
21556
  return packageRootLooksLikeSdk(root) ? root : null;
21395
21557
  } catch {
21396
21558
  return null;
@@ -21404,10 +21566,10 @@ function resolveCursorSdkRoot(opts) {
21404
21566
  }
21405
21567
  const globalNm = npmGlobalNodeModules(env);
21406
21568
  if (globalNm) {
21407
- const globalRoot = (0, import_node_path51.join)(globalNm, "@cursor/sdk");
21569
+ const globalRoot = (0, import_node_path52.join)(globalNm, "@cursor/sdk");
21408
21570
  if (packageRootLooksLikeSdk(globalRoot)) return globalRoot;
21409
21571
  }
21410
- const cwdPkg = (0, import_node_path51.join)(process.cwd(), "package.json");
21572
+ const cwdPkg = (0, import_node_path52.join)(process.cwd(), "package.json");
21411
21573
  return resolvedPackageRoot(thisModuleFile()) ?? resolvedPackageRoot(cwdPkg);
21412
21574
  }
21413
21575
  function isCursorSdkInstalled(opts) {
@@ -21423,13 +21585,13 @@ function exportTarget(value) {
21423
21585
  }
21424
21586
  function cursorSdkEsmEntry(root) {
21425
21587
  try {
21426
- const pkg = JSON.parse((0, import_node_fs48.readFileSync)((0, import_node_path51.join)(root, "package.json"), "utf8"));
21588
+ const pkg = JSON.parse((0, import_node_fs49.readFileSync)((0, import_node_path52.join)(root, "package.json"), "utf8"));
21427
21589
  const exp = pkg.exports;
21428
21590
  const dot = exp && typeof exp === "object" && !Array.isArray(exp) && "." in exp ? exp["."] : exp;
21429
21591
  const rel = exportTarget(dot) ?? (typeof pkg.module === "string" ? pkg.module : null);
21430
21592
  if (!rel) return null;
21431
- const entry = (0, import_node_path51.join)(root, rel);
21432
- return (0, import_node_fs48.existsSync)(entry) ? entry : null;
21593
+ const entry = (0, import_node_path52.join)(root, rel);
21594
+ return (0, import_node_fs49.existsSync)(entry) ? entry : null;
21433
21595
  } catch {
21434
21596
  return null;
21435
21597
  }
@@ -21445,7 +21607,7 @@ async function importCursorSdk(opts) {
21445
21607
  try {
21446
21608
  let entry = cursorSdkEsmEntry(root);
21447
21609
  if (!entry) {
21448
- const req = (0, import_node_module4.createRequire)((0, import_node_path51.join)(root, "package.json"));
21610
+ const req = (0, import_node_module4.createRequire)((0, import_node_path52.join)(root, "package.json"));
21449
21611
  entry = req.resolve("@cursor/sdk");
21450
21612
  }
21451
21613
  return unwrapCursorSdkModule(await import((0, import_node_url4.pathToFileURL)(entry).href));
@@ -21457,8 +21619,8 @@ function cursorSdkPlatformRipgrepPackage() {
21457
21619
  return `@cursor/sdk-${process.platform}-${process.arch}`;
21458
21620
  }
21459
21621
  function nodeModulesDirForPackageRoot(packageRoot) {
21460
- const parent = (0, import_node_path51.dirname)(packageRoot);
21461
- return (0, import_node_path51.basename)(parent).startsWith("@") ? (0, import_node_path51.dirname)(parent) : parent;
21622
+ const parent = (0, import_node_path52.dirname)(packageRoot);
21623
+ return (0, import_node_path52.basename)(parent).startsWith("@") ? (0, import_node_path52.dirname)(parent) : parent;
21462
21624
  }
21463
21625
  function cursorSdkRipgrepCandidate(opts) {
21464
21626
  const root = resolveCursorSdkRoot(opts);
@@ -21466,18 +21628,18 @@ function cursorSdkRipgrepCandidate(opts) {
21466
21628
  const nm = nodeModulesDirForPackageRoot(root);
21467
21629
  const pkg = cursorSdkPlatformRipgrepPackage();
21468
21630
  const bin = process.platform === "win32" ? "rg.exe" : "rg";
21469
- const sibling = (0, import_node_path51.join)(nm, pkg, "bin", bin);
21470
- if ((0, import_node_fs48.existsSync)(sibling)) return sibling;
21471
- const nested = (0, import_node_path51.join)(root, "node_modules", pkg, "bin", bin);
21472
- return (0, import_node_fs48.existsSync)(nested) ? nested : null;
21631
+ const sibling = (0, import_node_path52.join)(nm, pkg, "bin", bin);
21632
+ if ((0, import_node_fs49.existsSync)(sibling)) return sibling;
21633
+ const nested = (0, import_node_path52.join)(root, "node_modules", pkg, "bin", bin);
21634
+ return (0, import_node_fs49.existsSync)(nested) ? nested : null;
21473
21635
  }
21474
- var import_node_fs48, import_node_module4, import_node_path51, import_node_url4, import_meta7, CURSOR_SDK_INSTALL_HINT;
21636
+ var import_node_fs49, import_node_module4, import_node_path52, import_node_url4, import_meta7, CURSOR_SDK_INSTALL_HINT;
21475
21637
  var init_cursor_sdk_resolve = __esm({
21476
21638
  "src/agents/cursor-sdk-resolve.ts"() {
21477
21639
  "use strict";
21478
- import_node_fs48 = require("fs");
21640
+ import_node_fs49 = require("fs");
21479
21641
  import_node_module4 = require("module");
21480
- import_node_path51 = require("path");
21642
+ import_node_path52 = require("path");
21481
21643
  import_node_url4 = require("url");
21482
21644
  init_path();
21483
21645
  import_meta7 = {};
@@ -21711,21 +21873,21 @@ function platformRipgrepPackage() {
21711
21873
  }
21712
21874
  function usableRipgrepPath(candidate) {
21713
21875
  const raw = candidate?.trim();
21714
- if (!raw || !(0, import_node_path52.isAbsolute)(raw)) return null;
21876
+ if (!raw || !(0, import_node_path53.isAbsolute)(raw)) return null;
21715
21877
  const readable = nodeReadableScriptPath(raw);
21716
- if (!(0, import_node_fs49.existsSync)(readable) || isAsarPath(readable)) return null;
21878
+ if (!(0, import_node_fs50.existsSync)(readable) || isAsarPath(readable)) return null;
21717
21879
  return readable;
21718
21880
  }
21719
21881
  function walkForBundledRipgrep(startFile) {
21720
21882
  if (!startFile) return null;
21721
21883
  const pkg = platformRipgrepPackage();
21722
21884
  const name = rgBinaryName();
21723
- let dir = (0, import_node_path52.dirname)((0, import_node_path52.resolve)(startFile));
21724
- const root = (0, import_node_path52.parse)(dir).root;
21885
+ let dir = (0, import_node_path53.dirname)((0, import_node_path53.resolve)(startFile));
21886
+ const root = (0, import_node_path53.parse)(dir).root;
21725
21887
  while (dir !== root) {
21726
- const hit = usableRipgrepPath((0, import_node_path52.join)(dir, "node_modules", pkg, "bin", name));
21888
+ const hit = usableRipgrepPath((0, import_node_path53.join)(dir, "node_modules", pkg, "bin", name));
21727
21889
  if (hit) return hit;
21728
- const next = (0, import_node_path52.dirname)(dir);
21890
+ const next = (0, import_node_path53.dirname)(dir);
21729
21891
  if (next === dir) break;
21730
21892
  dir = next;
21731
21893
  }
@@ -21735,7 +21897,7 @@ function requireResolveBundledRipgrep(fromFile) {
21735
21897
  try {
21736
21898
  const req = (0, import_node_module5.createRequire)(fromFile);
21737
21899
  const pkgJson = req.resolve(`${platformRipgrepPackage()}/package.json`);
21738
- return usableRipgrepPath((0, import_node_path52.join)((0, import_node_path52.dirname)(pkgJson), "bin", rgBinaryName()));
21900
+ return usableRipgrepPath((0, import_node_path53.join)((0, import_node_path53.dirname)(pkgJson), "bin", rgBinaryName()));
21739
21901
  } catch {
21740
21902
  return null;
21741
21903
  }
@@ -21757,13 +21919,13 @@ function cursorRipgrepEnv(opts) {
21757
21919
  const path2 = resolveCursorRipgrepPath(opts);
21758
21920
  return path2 ? { [RIPGREP_ENV]: path2 } : {};
21759
21921
  }
21760
- var import_node_fs49, import_node_module5, import_node_path52, RIPGREP_ENV;
21922
+ var import_node_fs50, import_node_module5, import_node_path53, RIPGREP_ENV;
21761
21923
  var init_cursor_ripgrep = __esm({
21762
21924
  "src/agents/cursor-ripgrep.ts"() {
21763
21925
  "use strict";
21764
- import_node_fs49 = require("fs");
21926
+ import_node_fs50 = require("fs");
21765
21927
  import_node_module5 = require("module");
21766
- import_node_path52 = require("path");
21928
+ import_node_path53 = require("path");
21767
21929
  init_cursor_sdk_resolve();
21768
21930
  init_node_launch();
21769
21931
  init_packaged_runtime();
@@ -21815,11 +21977,11 @@ function entryDir3() {
21815
21977
  const cjsDir = typeof __dirname !== "undefined" ? __dirname : "";
21816
21978
  if (cjsDir) return cjsDir;
21817
21979
  try {
21818
- return (0, import_node_path53.dirname)((0, import_node_url5.fileURLToPath)(import_meta8.url));
21980
+ return (0, import_node_path54.dirname)((0, import_node_url5.fileURLToPath)(import_meta8.url));
21819
21981
  } catch {
21820
21982
  try {
21821
21983
  const req = (0, import_node_module6.createRequire)(process.cwd() + "/");
21822
- return (0, import_node_path53.dirname)(req.resolve("@sideboard-ai/core"));
21984
+ return (0, import_node_path54.dirname)(req.resolve("@sideboard-ai/core"));
21823
21985
  } catch {
21824
21986
  return process.cwd();
21825
21987
  }
@@ -21830,27 +21992,27 @@ function cursorRunnerPath() {
21830
21992
  if (packaged) return packaged;
21831
21993
  const root = entryDir3();
21832
21994
  const candidates = [
21833
- (0, import_node_path53.join)(root, "agents", "cursor-runner.js"),
21834
- (0, import_node_path53.join)(root, "agents", "cursor-runner.cjs"),
21995
+ (0, import_node_path54.join)(root, "agents", "cursor-runner.js"),
21996
+ (0, import_node_path54.join)(root, "agents", "cursor-runner.cjs"),
21835
21997
  // If somehow resolved from package root instead of dist/
21836
- (0, import_node_path53.join)(root, "dist", "agents", "cursor-runner.js"),
21837
- (0, import_node_path53.join)(root, "dist", "agents", "cursor-runner.cjs"),
21998
+ (0, import_node_path54.join)(root, "dist", "agents", "cursor-runner.js"),
21999
+ (0, import_node_path54.join)(root, "dist", "agents", "cursor-runner.cjs"),
21838
22000
  // Source tree (dev): packages/core/src/agents/cursor-runner.ts
21839
- (0, import_node_path53.join)(root, "cursor-runner.ts"),
21840
- (0, import_node_path53.join)(root, "src", "agents", "cursor-runner.ts")
22001
+ (0, import_node_path54.join)(root, "cursor-runner.ts"),
22002
+ (0, import_node_path54.join)(root, "src", "agents", "cursor-runner.ts")
21841
22003
  ];
21842
22004
  for (const candidate of candidates) {
21843
- if ((0, import_node_fs50.existsSync)(candidate)) return candidate;
22005
+ if ((0, import_node_fs51.existsSync)(candidate)) return candidate;
21844
22006
  }
21845
22007
  return candidates[0];
21846
22008
  }
21847
- var import_node_fs50, import_node_module6, import_node_path53, import_node_url5, import_meta8, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
22009
+ var import_node_fs51, import_node_module6, import_node_path54, import_node_url5, import_meta8, FALLBACK_CURSOR_MODELS, cachedModels, MODEL_CACHE_MS, cursorAdapter;
21848
22010
  var init_cursor = __esm({
21849
22011
  "src/agents/cursor.ts"() {
21850
22012
  "use strict";
21851
- import_node_fs50 = require("fs");
22013
+ import_node_fs51 = require("fs");
21852
22014
  import_node_module6 = require("module");
21853
- import_node_path53 = require("path");
22015
+ import_node_path54 = require("path");
21854
22016
  import_node_url5 = require("url");
21855
22017
  init_run();
21856
22018
  init_app_settings();
@@ -21977,26 +22139,26 @@ var init_cursor = __esm({
21977
22139
 
21978
22140
  // src/agent-rpc/opencode-hook.ts
21979
22141
  function writeOpencodeRpcPlugin() {
21980
- const pluginDir = (0, import_node_path54.join)(appDataDir(), "agent-rpc", "opencode");
21981
- (0, import_node_fs51.mkdirSync)(pluginDir, { recursive: true });
21982
- const pluginFile = (0, import_node_path54.join)(pluginDir, "sideboard-rpc.js");
21983
- if ((0, import_node_fs51.existsSync)(pluginFile)) {
22142
+ const pluginDir = (0, import_node_path55.join)(appDataDir(), "agent-rpc", "opencode");
22143
+ (0, import_node_fs52.mkdirSync)(pluginDir, { recursive: true });
22144
+ const pluginFile = (0, import_node_path55.join)(pluginDir, "sideboard-rpc.js");
22145
+ if ((0, import_node_fs52.existsSync)(pluginFile)) {
21984
22146
  try {
21985
- if ((0, import_node_fs51.readFileSync)(pluginFile, "utf8") === OPENCODE_PLUGIN_SOURCE) return pluginFile;
22147
+ if ((0, import_node_fs52.readFileSync)(pluginFile, "utf8") === OPENCODE_PLUGIN_SOURCE) return pluginFile;
21986
22148
  } catch {
21987
22149
  }
21988
22150
  }
21989
22151
  const tmp = `${pluginFile}.${process.pid}.tmp`;
21990
- (0, import_node_fs51.writeFileSync)(tmp, OPENCODE_PLUGIN_SOURCE);
21991
- (0, import_node_fs51.renameSync)(tmp, pluginFile);
22152
+ (0, import_node_fs52.writeFileSync)(tmp, OPENCODE_PLUGIN_SOURCE);
22153
+ (0, import_node_fs52.renameSync)(tmp, pluginFile);
21992
22154
  return pluginFile;
21993
22155
  }
21994
- var import_node_fs51, import_node_path54, OPENCODE_PLUGIN_SOURCE;
22156
+ var import_node_fs52, import_node_path55, OPENCODE_PLUGIN_SOURCE;
21995
22157
  var init_opencode_hook = __esm({
21996
22158
  "src/agent-rpc/opencode-hook.ts"() {
21997
22159
  "use strict";
21998
- import_node_fs51 = require("fs");
21999
- import_node_path54 = require("path");
22160
+ import_node_fs52 = require("fs");
22161
+ import_node_path55 = require("path");
22000
22162
  init_paths();
22001
22163
  init_pilot_tools();
22002
22164
  init_protocol2();
@@ -22215,7 +22377,7 @@ async function listOpencodeModels() {
22215
22377
  if (opencode === "opencode") {
22216
22378
  const which = await run("which", ["opencode"], { reject: false });
22217
22379
  if (which.exitCode !== 0) return FALLBACK_OPENCODE_MODELS;
22218
- } else if (!(0, import_node_fs52.existsSync)(opencode)) {
22380
+ } else if (!(0, import_node_fs53.existsSync)(opencode)) {
22219
22381
  return FALLBACK_OPENCODE_MODELS;
22220
22382
  }
22221
22383
  const listed = await run(opencode, ["models"], { reject: false });
@@ -22245,11 +22407,11 @@ function usageFromOpencode(tokens) {
22245
22407
  cacheWriteTokens: tokens.cache?.write ? Number(tokens.cache.write) : void 0
22246
22408
  };
22247
22409
  }
22248
- var import_node_fs52, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
22410
+ var import_node_fs53, FALLBACK_OPENCODE_MODELS, cachedOpencodeModels, OPENCODE_MODEL_CACHE_MS, opencodeAdapter;
22249
22411
  var init_opencode = __esm({
22250
22412
  "src/agents/opencode.ts"() {
22251
22413
  "use strict";
22252
- import_node_fs52 = require("fs");
22414
+ import_node_fs53 = require("fs");
22253
22415
  init_run();
22254
22416
  init_app_settings();
22255
22417
  init_error_detail();
@@ -22275,7 +22437,7 @@ var init_opencode = __esm({
22275
22437
  async detect() {
22276
22438
  const opencode = resolveAgentExecutable("opencode");
22277
22439
  if (opencode !== "opencode") {
22278
- if (!(0, import_node_fs52.existsSync)(opencode)) {
22440
+ if (!(0, import_node_fs53.existsSync)(opencode)) {
22279
22441
  return {
22280
22442
  agent: "opencode",
22281
22443
  installed: false,
@@ -22946,10 +23108,10 @@ async function resolveCliAfterNpmInstall(cliBin) {
22946
23108
  if (prefix.exitCode !== 0) return null;
22947
23109
  const root = prefix.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.startsWith("/")).pop();
22948
23110
  if (!root) return null;
22949
- const candidate = (0, import_node_path55.join)(root, "bin", cliBin);
22950
- if (!(0, import_node_fs53.existsSync)(candidate)) return null;
23111
+ const candidate = (0, import_node_path56.join)(root, "bin", cliBin);
23112
+ if (!(0, import_node_fs54.existsSync)(candidate)) return null;
22951
23113
  try {
22952
- (0, import_node_fs53.chmodSync)(candidate, 493);
23114
+ (0, import_node_fs54.chmodSync)(candidate, 493);
22953
23115
  } catch {
22954
23116
  }
22955
23117
  enrichPathWithNpmGlobalBin();
@@ -22958,7 +23120,7 @@ async function resolveCliAfterNpmInstall(cliBin) {
22958
23120
  async function resolveExistingCli(agent) {
22959
23121
  if (agent === "cursor" || agent === "acp") return null;
22960
23122
  const exe = resolveAgentExecutable(agent);
22961
- if ((exe.includes("/") || exe.includes("\\")) && (0, import_node_fs53.existsSync)(exe)) return exe;
23123
+ if ((exe.includes("/") || exe.includes("\\")) && (0, import_node_fs54.existsSync)(exe)) return exe;
22962
23124
  enrichPathWithNpmGlobalBin();
22963
23125
  return whichOnPath(CLI_BIN[agent]);
22964
23126
  }
@@ -23087,12 +23249,12 @@ async function loginManagedAccount(accountId) {
23087
23249
  message: `Opened Terminal to run: ${prefixed}`
23088
23250
  };
23089
23251
  }
23090
- var import_node_fs53, import_node_path55, SETUP, CLI_BIN, CLI_LOGIN_AGENTS;
23252
+ var import_node_fs54, import_node_path56, SETUP, CLI_BIN, CLI_LOGIN_AGENTS;
23091
23253
  var init_install = __esm({
23092
23254
  "src/agents/install.ts"() {
23093
23255
  "use strict";
23094
- import_node_fs53 = require("fs");
23095
- import_node_path55 = require("path");
23256
+ import_node_fs54 = require("fs");
23257
+ import_node_path56 = require("path");
23096
23258
  init_run();
23097
23259
  init_app_settings();
23098
23260
  init_acp_harness();
@@ -23360,7 +23522,7 @@ function isAgentHostEnvKey(key) {
23360
23522
  }
23361
23523
  function stripHostToolingPath(pathValue) {
23362
23524
  if (!pathValue?.trim()) return "";
23363
- return pathValue.split(import_node_path56.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path56.delimiter);
23525
+ return pathValue.split(import_node_path57.delimiter).filter((part) => part && !HOST_PATH_NOISE.test(part.replace(/\\/g, "/"))).join(import_node_path57.delimiter);
23364
23526
  }
23365
23527
  function sanitizeAgentHostEnv(env, cwd) {
23366
23528
  for (const key of Object.keys(env)) {
@@ -23374,11 +23536,11 @@ function sanitizeAgentHostEnv(env, cwd) {
23374
23536
  }
23375
23537
  return env;
23376
23538
  }
23377
- var import_node_path56, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
23539
+ var import_node_path57, DROP_EXACT, DROP_PREFIXES, HOST_PATH_NOISE;
23378
23540
  var init_agent_host_env = __esm({
23379
23541
  "src/hook/agent-host-env.ts"() {
23380
23542
  "use strict";
23381
- import_node_path56 = require("path");
23543
+ import_node_path57 = require("path");
23382
23544
  DROP_EXACT = /* @__PURE__ */ new Set([
23383
23545
  "NODE_PATH",
23384
23546
  "NODE_ENV_ELECTRON_VITE",
@@ -23417,15 +23579,15 @@ var init_agent_host_env = __esm({
23417
23579
 
23418
23580
  // src/hook/worktree-pkg-cache.ts
23419
23581
  function worktreePkgCacheRoot(worktreePath) {
23420
- return (0, import_node_path57.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
23582
+ return (0, import_node_path58.join)(worktreePath, WORKTREE_PKG_CACHE_REL);
23421
23583
  }
23422
23584
  function worktreePkgCacheEnv(worktreePath) {
23423
23585
  const root = worktreePkgCacheRoot(worktreePath);
23424
- const store = (0, import_node_path57.join)(root, "pnpm-store");
23425
- const pnpmCache = (0, import_node_path57.join)(root, "pnpm");
23426
- const npmCache = (0, import_node_path57.join)(root, "npm");
23427
- const nodeGyp = (0, import_node_path57.join)(root, "node-gyp");
23428
- const electron = (0, import_node_path57.join)(root, "electron");
23586
+ const store = (0, import_node_path58.join)(root, "pnpm-store");
23587
+ const pnpmCache = (0, import_node_path58.join)(root, "pnpm");
23588
+ const npmCache = (0, import_node_path58.join)(root, "npm");
23589
+ const nodeGyp = (0, import_node_path58.join)(root, "node-gyp");
23590
+ const electron = (0, import_node_path58.join)(root, "electron");
23429
23591
  return {
23430
23592
  npm_config_store_dir: store,
23431
23593
  PNPM_STORE_DIR: store,
@@ -23447,8 +23609,8 @@ function fillGroup(env, keys, values) {
23447
23609
  }
23448
23610
  }
23449
23611
  function ensureWorktreePkgCacheDirs(worktreePath) {
23450
- if (!(0, import_node_fs54.existsSync)(worktreePath)) return;
23451
- (0, import_node_fs54.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
23612
+ if (!(0, import_node_fs55.existsSync)(worktreePath)) return;
23613
+ (0, import_node_fs55.mkdirSync)(worktreePkgCacheRoot(worktreePath), { recursive: true });
23452
23614
  }
23453
23615
  function applyWorktreePkgCacheEnv(env, worktreePath) {
23454
23616
  const cwd = worktreePath.trim();
@@ -23461,12 +23623,12 @@ function applyWorktreePkgCacheEnv(env, worktreePath) {
23461
23623
  fillGroup(env, ["electron_config_cache"], next);
23462
23624
  ensureWorktreePkgCacheDirs(cwd);
23463
23625
  }
23464
- var import_node_fs54, import_node_path57, WORKTREE_PKG_CACHE_REL;
23626
+ var import_node_fs55, import_node_path58, WORKTREE_PKG_CACHE_REL;
23465
23627
  var init_worktree_pkg_cache = __esm({
23466
23628
  "src/hook/worktree-pkg-cache.ts"() {
23467
23629
  "use strict";
23468
- import_node_fs54 = require("fs");
23469
- import_node_path57 = require("path");
23630
+ import_node_fs55 = require("fs");
23631
+ import_node_path58 = require("path");
23470
23632
  WORKTREE_PKG_CACHE_REL = ".context/.sideboard/pkg-cache";
23471
23633
  }
23472
23634
  });
@@ -23726,7 +23888,7 @@ async function spawnAgentTurn(thread, input, onEvent) {
23726
23888
  }).finally(() => {
23727
23889
  for (const dir of cmd.cleanupDirs ?? []) {
23728
23890
  try {
23729
- (0, import_node_fs55.rmSync)(dir, { recursive: true, force: true });
23891
+ (0, import_node_fs56.rmSync)(dir, { recursive: true, force: true });
23730
23892
  } catch {
23731
23893
  }
23732
23894
  }
@@ -23760,11 +23922,11 @@ async function spawnAgentTurn(thread, input, onEvent) {
23760
23922
  done
23761
23923
  };
23762
23924
  }
23763
- var import_node_fs55, import_node_readline2, import_execa3;
23925
+ var import_node_fs56, import_node_readline2, import_execa3;
23764
23926
  var init_spawn = __esm({
23765
23927
  "src/agents/spawn.ts"() {
23766
23928
  "use strict";
23767
- import_node_fs55 = require("fs");
23929
+ import_node_fs56 = require("fs");
23768
23930
  import_node_readline2 = require("readline");
23769
23931
  import_execa3 = require("execa");
23770
23932
  init_worktree();
@@ -24006,10 +24168,6 @@ function entireGitActionExpansion(action, base) {
24006
24168
  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`.";
24007
24169
  }
24008
24170
  }
24009
- function worktreeHasAnnounceSkill(worktreePath) {
24010
- const root = worktreePath?.trim();
24011
- return !!root && (0, import_node_fs56.existsSync)((0, import_node_path58.join)(root, ".claude/skills/announce-on-x/SKILL.md"));
24012
- }
24013
24171
  function expandCanonicalGitRequest(prompt, opts) {
24014
24172
  const trimmed = prompt.trim();
24015
24173
  let action = null;
@@ -24043,7 +24201,7 @@ function expandCanonicalGitRequest(prompt, opts) {
24043
24201
  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.";
24044
24202
  }
24045
24203
  if (!expansion) return prompt;
24046
- if (action === "merge" && (!base || isMainishPrBase(base)) && worktreeHasAnnounceSkill(opts?.worktreePath)) {
24204
+ if (action === "merge" && (!base || isMainishPrBase(base)) && opts?.hasAnnounceSkill) {
24047
24205
  expansion = `${expansion} ${ANNOUNCE_AFTER_MERGE}`;
24048
24206
  }
24049
24207
  if (expansionPushes(action, trimmed)) expansion = withPushReview(expansion);
@@ -24061,12 +24219,10 @@ function expansionPushes(action, prompt) {
24061
24219
  if (action) return true;
24062
24220
  return prompt === "Address review comments." || FIX_CI_RE.test(prompt);
24063
24221
  }
24064
- var import_node_fs56, import_node_path58, ANNOUNCE_AFTER_MERGE, AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
24222
+ var ANNOUNCE_AFTER_MERGE, AGENT_GIT_ACTIONS, RESOLVE_CONFLICTS_RE, MERGE_INTO_RE, FIX_CI_RE, PUSH_WAKES_REVIEW, CHECKS_LOOP_UNLESS_GOAL;
24065
24223
  var init_agent_git_actions = __esm({
24066
24224
  "src/git/agent-git-actions.ts"() {
24067
24225
  "use strict";
24068
- import_node_fs56 = require("fs");
24069
- import_node_path58 = require("path");
24070
24226
  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.";
24071
24227
  AGENT_GIT_ACTIONS = [
24072
24228
  "commit-push",
@@ -24084,6 +24240,20 @@ var init_agent_git_actions = __esm({
24084
24240
  }
24085
24241
  });
24086
24242
 
24243
+ // src/git/announce-skill.ts
24244
+ function announceSkillPresent(worktreePath) {
24245
+ const root = worktreePath?.trim();
24246
+ return !!root && (0, import_node_fs57.existsSync)((0, import_node_path59.join)(root, ".claude/skills/announce-on-x/SKILL.md"));
24247
+ }
24248
+ var import_node_fs57, import_node_path59;
24249
+ var init_announce_skill = __esm({
24250
+ "src/git/announce-skill.ts"() {
24251
+ "use strict";
24252
+ import_node_fs57 = require("fs");
24253
+ import_node_path59 = require("path");
24254
+ }
24255
+ });
24256
+
24087
24257
  // src/git/pr-merge-archive.ts
24088
24258
  function normalizePrState(state) {
24089
24259
  return (state ?? "").trim().toUpperCase();
@@ -25065,21 +25235,21 @@ function shouldRefreshReviewRequestTemplate(content) {
25065
25235
  return LEGACY_REVIEW_TEMPLATE_MARKERS.every((m) => trimmed.includes(m));
25066
25236
  }
25067
25237
  function readTextIfPresent(abs) {
25068
- if (!(0, import_node_fs57.existsSync)(abs)) return null;
25238
+ if (!(0, import_node_fs58.existsSync)(abs)) return null;
25069
25239
  try {
25070
- const content = (0, import_node_fs57.readFileSync)(abs, "utf8");
25240
+ const content = (0, import_node_fs58.readFileSync)(abs, "utf8");
25071
25241
  return content.trim() ? content : null;
25072
25242
  } catch {
25073
25243
  return null;
25074
25244
  }
25075
25245
  }
25076
25246
  function readLocalGuidelines(worktreePath) {
25077
- const localAbs = (0, import_node_path59.join)(worktreePath, REVIEW_REQUEST_PATH);
25247
+ const localAbs = (0, import_node_path60.join)(worktreePath, REVIEW_REQUEST_PATH);
25078
25248
  const localContent = readTextIfPresent(localAbs);
25079
25249
  if (localContent && !shouldRefreshReviewRequestTemplate(localContent)) {
25080
25250
  return { path: REVIEW_REQUEST_PATH, content: localContent };
25081
25251
  }
25082
- const legacyAbs = (0, import_node_path59.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
25252
+ const legacyAbs = (0, import_node_path60.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH);
25083
25253
  const legacyContent = readTextIfPresent(legacyAbs);
25084
25254
  if (legacyContent && !shouldRefreshReviewRequestTemplate(legacyContent)) {
25085
25255
  return { path: LEGACY_REVIEW_REQUEST_PATH, content: legacyContent };
@@ -25103,27 +25273,27 @@ function contextGuidelines(content, source) {
25103
25273
  };
25104
25274
  }
25105
25275
  function writeContextGuidelines(worktreePath, content) {
25106
- const abs = (0, import_node_path59.join)(worktreePath, CONTEXT_REVIEW_PATH);
25107
- (0, import_node_fs57.mkdirSync)((0, import_node_path59.dirname)(abs), { recursive: true });
25276
+ const abs = (0, import_node_path60.join)(worktreePath, CONTEXT_REVIEW_PATH);
25277
+ (0, import_node_fs58.mkdirSync)((0, import_node_path60.dirname)(abs), { recursive: true });
25108
25278
  const body = content.endsWith("\n") ? content : `${content}
25109
25279
  `;
25110
- (0, import_node_fs57.writeFileSync)(abs, body, "utf8");
25280
+ (0, import_node_fs58.writeFileSync)(abs, body, "utf8");
25111
25281
  return body;
25112
25282
  }
25113
25283
  function readSideboardReview(worktreePath, repoPath) {
25114
- const fromWorktree = readTextIfPresent((0, import_node_path59.join)(worktreePath, REPO_REVIEW_PATH));
25284
+ const fromWorktree = readTextIfPresent((0, import_node_path60.join)(worktreePath, REPO_REVIEW_PATH));
25115
25285
  if (fromWorktree) return fromWorktree;
25116
25286
  const repo = repoPath?.replace(/\/+$/, "");
25117
25287
  const wt = worktreePath.replace(/\/+$/, "");
25118
25288
  if (!repo || repo === wt) return null;
25119
- return readTextIfPresent((0, import_node_path59.join)(repo, REPO_REVIEW_PATH));
25289
+ return readTextIfPresent((0, import_node_path60.join)(repo, REPO_REVIEW_PATH));
25120
25290
  }
25121
25291
  function ensureReviewGuidelinesFile(worktreePath, repoPath) {
25122
- const skillContent = readTextIfPresent((0, import_node_path59.join)(worktreePath, REVIEW_SKILL_PATH));
25292
+ const skillContent = readTextIfPresent((0, import_node_path60.join)(worktreePath, REVIEW_SKILL_PATH));
25123
25293
  if (skillContent) {
25124
25294
  return { ...skillGuidelines(skillContent, "skill"), wrote: false };
25125
25295
  }
25126
- const contextContent = readTextIfPresent((0, import_node_path59.join)(worktreePath, CONTEXT_REVIEW_PATH));
25296
+ const contextContent = readTextIfPresent((0, import_node_path60.join)(worktreePath, CONTEXT_REVIEW_PATH));
25127
25297
  if (contextContent && !shouldRefreshReviewRequestTemplate(contextContent)) {
25128
25298
  return { ...contextGuidelines(contextContent, "local"), wrote: false };
25129
25299
  }
@@ -25161,7 +25331,7 @@ function buildReviewRequestAttachment(content, opts) {
25161
25331
  };
25162
25332
  }
25163
25333
  function readExistingReviewRequestFile(worktreePath) {
25164
- return readTextIfPresent((0, import_node_path59.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path59.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path59.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path59.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path59.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
25334
+ return readTextIfPresent((0, import_node_path60.join)(worktreePath, REVIEW_SKILL_PATH)) ?? readTextIfPresent((0, import_node_path60.join)(worktreePath, CONTEXT_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path60.join)(worktreePath, REPO_REVIEW_PATH)) ?? readTextIfPresent((0, import_node_path60.join)(worktreePath, REVIEW_REQUEST_PATH)) ?? readTextIfPresent((0, import_node_path60.join)(worktreePath, LEGACY_REVIEW_REQUEST_PATH));
25165
25335
  }
25166
25336
  function canReuseIdleWorktreeAgentForReview(from, siblings) {
25167
25337
  const live = siblings.filter((t) => t.status !== "archived");
@@ -25209,13 +25379,13 @@ async function requestReview(threadRef, send4) {
25209
25379
  const started = await send4(tab.id, REVIEW_REQUEST_PREFILL);
25210
25380
  return { tab: started, from };
25211
25381
  }
25212
- var import_node_crypto18, import_node_fs57, import_node_path59, 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;
25382
+ var import_node_crypto18, import_node_fs58, import_node_path60, 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;
25213
25383
  var init_request_review = __esm({
25214
25384
  "src/review/request-review.ts"() {
25215
25385
  "use strict";
25216
25386
  import_node_crypto18 = require("crypto");
25217
- import_node_fs57 = require("fs");
25218
- import_node_path59 = require("path");
25387
+ import_node_fs58 = require("fs");
25388
+ import_node_path60 = require("path");
25219
25389
  init_global_workspace();
25220
25390
  init_chat_tabs();
25221
25391
  init_thread_store();
@@ -25238,7 +25408,7 @@ var init_request_review = __esm({
25238
25408
 
25239
25409
  // src/hook/worktree-run-ports.ts
25240
25410
  function worktreeRunPortsPath(worktreePath) {
25241
- return (0, import_node_path60.join)(worktreePath, RUN_PORTS_REL);
25411
+ return (0, import_node_path61.join)(worktreePath, RUN_PORTS_REL);
25242
25412
  }
25243
25413
  function isPort(value) {
25244
25414
  return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= 65535;
@@ -25263,7 +25433,7 @@ function parseFile(raw) {
25263
25433
  function readScripts(worktreePath) {
25264
25434
  if (!worktreePath.trim()) return {};
25265
25435
  try {
25266
- const raw = (0, import_node_fs58.readFileSync)(worktreeRunPortsPath(worktreePath), "utf8");
25436
+ const raw = (0, import_node_fs59.readFileSync)(worktreeRunPortsPath(worktreePath), "utf8");
25267
25437
  return parseFile(raw).scripts ?? {};
25268
25438
  } catch {
25269
25439
  return {};
@@ -25290,22 +25460,22 @@ function saveWorktreeRunPorts(worktreePath, scriptName, ports) {
25290
25460
  const path2 = worktreeRunPortsPath(worktreePath);
25291
25461
  let current = {};
25292
25462
  try {
25293
- current = parseFile((0, import_node_fs58.readFileSync)(path2, "utf8"));
25463
+ current = parseFile((0, import_node_fs59.readFileSync)(path2, "utf8"));
25294
25464
  } catch {
25295
25465
  current = {};
25296
25466
  }
25297
25467
  const scripts = { ...current.scripts ?? {} };
25298
25468
  scripts[scriptName] = cleaned;
25299
- (0, import_node_fs58.mkdirSync)((0, import_node_path60.dirname)(path2), { recursive: true });
25300
- (0, import_node_fs58.writeFileSync)(path2, `${JSON.stringify({ scripts }, null, 2)}
25469
+ (0, import_node_fs59.mkdirSync)((0, import_node_path61.dirname)(path2), { recursive: true });
25470
+ (0, import_node_fs59.writeFileSync)(path2, `${JSON.stringify({ scripts }, null, 2)}
25301
25471
  `, "utf8");
25302
25472
  }
25303
- var import_node_fs58, import_node_path60, RUN_PORTS_REL;
25473
+ var import_node_fs59, import_node_path61, RUN_PORTS_REL;
25304
25474
  var init_worktree_run_ports = __esm({
25305
25475
  "src/hook/worktree-run-ports.ts"() {
25306
25476
  "use strict";
25307
- import_node_fs58 = require("fs");
25308
- import_node_path60 = require("path");
25477
+ import_node_fs59 = require("fs");
25478
+ import_node_path61 = require("path");
25309
25479
  RUN_PORTS_REL = ".context/.sideboard/run-ports.json";
25310
25480
  }
25311
25481
  });
@@ -25403,24 +25573,24 @@ function sanitizeDetachedJobId(id) {
25403
25573
  return s;
25404
25574
  }
25405
25575
  function readIntFile(file) {
25406
- if (!(0, import_node_fs59.existsSync)(file)) return null;
25407
- const n = Number.parseInt((0, import_node_fs59.readFileSync)(file, "utf8").trim(), 10);
25576
+ if (!(0, import_node_fs60.existsSync)(file)) return null;
25577
+ const n = Number.parseInt((0, import_node_fs60.readFileSync)(file, "utf8").trim(), 10);
25408
25578
  return Number.isInteger(n) ? n : null;
25409
25579
  }
25410
25580
  function jobDir(root, id, legacy = false) {
25411
- return (0, import_node_path61.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
25581
+ return (0, import_node_path62.join)(root, legacy ? LEGACY_DETACHED_JOBS_DIR : DETACHED_JOBS_DIR, id);
25412
25582
  }
25413
25583
  function resolveJobDir(root, id) {
25414
25584
  const modern = jobDir(root, id, false);
25415
- if ((0, import_node_fs59.existsSync)(modern)) return modern;
25585
+ if ((0, import_node_fs60.existsSync)(modern)) return modern;
25416
25586
  const legacy = jobDir(root, id, true);
25417
- if ((0, import_node_fs59.existsSync)(legacy)) return legacy;
25587
+ if ((0, import_node_fs60.existsSync)(legacy)) return legacy;
25418
25588
  return modern;
25419
25589
  }
25420
25590
  function listJobIdsIn(root, rel) {
25421
- const dir = (0, import_node_path61.join)(root, rel);
25422
- if (!(0, import_node_fs59.existsSync)(dir)) return [];
25423
- return (0, import_node_fs59.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
25591
+ const dir = (0, import_node_path62.join)(root, rel);
25592
+ if (!(0, import_node_fs60.existsSync)(dir)) return [];
25593
+ return (0, import_node_fs60.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && JOB_ID_RE.test(e.name)).map((e) => e.name);
25424
25594
  }
25425
25595
  function listRunningDetachedJobs(worktreePath) {
25426
25596
  const root = worktreePath.trim();
@@ -25432,7 +25602,7 @@ function listRunningDetachedJobs(worktreePath) {
25432
25602
  const running2 = [];
25433
25603
  for (const id of ids) {
25434
25604
  const dir = resolveJobDir(root, id);
25435
- const pid = readIntFile((0, import_node_path61.join)(dir, "pid"));
25605
+ const pid = readIntFile((0, import_node_path62.join)(dir, "pid"));
25436
25606
  if (jobTreeAlive(pid)) running2.push(id);
25437
25607
  }
25438
25608
  return running2.sort();
@@ -25514,8 +25684,8 @@ function planJobContinue(opts) {
25514
25684
  return { action: "none" };
25515
25685
  }
25516
25686
  function tailProgress(logFile, maxLines = 12) {
25517
- if (!(0, import_node_fs59.existsSync)(logFile)) return "(no log yet)";
25518
- const lines = (0, import_node_fs59.readFileSync)(logFile, "utf8").split("\n");
25687
+ if (!(0, import_node_fs60.existsSync)(logFile)) return "(no log yet)";
25688
+ const lines = (0, import_node_fs60.readFileSync)(logFile, "utf8").split("\n");
25519
25689
  return lines.slice(-maxLines).join("\n");
25520
25690
  }
25521
25691
  function lastProgressLine(progress) {
@@ -25523,8 +25693,8 @@ function lastProgressLine(progress) {
25523
25693
  return last ? last.slice(0, 72) : void 0;
25524
25694
  }
25525
25695
  function readLogLines(file) {
25526
- if (!(0, import_node_fs59.existsSync)(file)) return [];
25527
- const lines = (0, import_node_fs59.readFileSync)(file, "utf8").split("\n");
25696
+ if (!(0, import_node_fs60.existsSync)(file)) return [];
25697
+ const lines = (0, import_node_fs60.readFileSync)(file, "utf8").split("\n");
25528
25698
  if (lines.length && lines[lines.length - 1] === "") lines.pop();
25529
25699
  return lines;
25530
25700
  }
@@ -25535,15 +25705,15 @@ function takeDelta(logFile, cursorFile) {
25535
25705
  return { delta: capJobLogDelta(lines.slice(start).join("\n")), nextCursor: lines.length };
25536
25706
  }
25537
25707
  function snapshotJob(dir) {
25538
- const pid = readIntFile((0, import_node_path61.join)(dir, "pid"));
25708
+ const pid = readIntFile((0, import_node_path62.join)(dir, "pid"));
25539
25709
  const running2 = jobTreeAlive(pid);
25540
25710
  return {
25541
25711
  pid,
25542
25712
  running: running2,
25543
- exitCode: readIntFile((0, import_node_path61.join)(dir, "exit")),
25544
- log: (0, import_node_path61.join)(dir, "log"),
25545
- cursor: (0, import_node_path61.join)(dir, "present.cursor"),
25546
- progress: tailProgress((0, import_node_path61.join)(dir, "log"))
25713
+ exitCode: readIntFile((0, import_node_path62.join)(dir, "exit")),
25714
+ log: (0, import_node_path62.join)(dir, "log"),
25715
+ cursor: (0, import_node_path62.join)(dir, "present.cursor"),
25716
+ progress: tailProgress((0, import_node_path62.join)(dir, "log"))
25547
25717
  };
25548
25718
  }
25549
25719
  function toResult(id, snap, extra) {
@@ -25552,8 +25722,8 @@ function toResult(id, snap, extra) {
25552
25722
  const stillRunning = snap.running && !ok;
25553
25723
  const { delta, nextCursor } = takeDelta(snap.log, snap.cursor);
25554
25724
  try {
25555
- (0, import_node_fs59.mkdirSync)((0, import_node_path61.dirname)(snap.cursor), { recursive: true });
25556
- (0, import_node_fs59.writeFileSync)(snap.cursor, `${nextCursor}
25725
+ (0, import_node_fs60.mkdirSync)((0, import_node_path62.dirname)(snap.cursor), { recursive: true });
25726
+ (0, import_node_fs60.writeFileSync)(snap.cursor, `${nextCursor}
25557
25727
  `);
25558
25728
  } catch {
25559
25729
  }
@@ -25582,7 +25752,7 @@ async function waitForDetachedJob(cwd, id, opts) {
25582
25752
  const dir = resolveJobDir(root, jobId);
25583
25753
  const timeoutMs = mcpWaitForJobTimeoutMs(opts?.timeoutMs);
25584
25754
  const sleep3 = opts?.sleep ?? sleepMs;
25585
- if (!(0, import_node_fs59.existsSync)(dir)) {
25755
+ if (!(0, import_node_fs60.existsSync)(dir)) {
25586
25756
  return {
25587
25757
  stillRunning: false,
25588
25758
  ok: false,
@@ -25628,10 +25798,10 @@ function killProcessTree(pid, signal) {
25628
25798
  }
25629
25799
  function appendJobLog(logFile, line) {
25630
25800
  try {
25631
- (0, import_node_fs59.mkdirSync)((0, import_node_path61.dirname)(logFile), { recursive: true });
25801
+ (0, import_node_fs60.mkdirSync)((0, import_node_path62.dirname)(logFile), { recursive: true });
25632
25802
  const body = line.endsWith("\n") ? line : `${line}
25633
25803
  `;
25634
- (0, import_node_fs59.appendFileSync)(logFile, body);
25804
+ (0, import_node_fs60.appendFileSync)(logFile, body);
25635
25805
  } catch {
25636
25806
  }
25637
25807
  }
@@ -25641,7 +25811,7 @@ async function stopDetachedJob(cwd, id, opts) {
25641
25811
  const dir = resolveJobDir(root, jobId);
25642
25812
  const sleep3 = opts?.sleep ?? sleepMs;
25643
25813
  const why = opts?.reason?.trim() ?? "";
25644
- if (!(0, import_node_fs59.existsSync)(dir)) {
25814
+ if (!(0, import_node_fs60.existsSync)(dir)) {
25645
25815
  return {
25646
25816
  stillRunning: false,
25647
25817
  ok: false,
@@ -25677,10 +25847,10 @@ async function stopDetachedJob(cwd, id, opts) {
25677
25847
  killProcessTree(targetPid, "SIGKILL");
25678
25848
  await sleep3(100);
25679
25849
  }
25680
- const exitFile = (0, import_node_path61.join)(dir, "exit");
25681
- if (!(0, import_node_fs59.existsSync)(exitFile)) {
25850
+ const exitFile = (0, import_node_path62.join)(dir, "exit");
25851
+ if (!(0, import_node_fs60.existsSync)(exitFile)) {
25682
25852
  try {
25683
- (0, import_node_fs59.writeFileSync)(exitFile, "1\n");
25853
+ (0, import_node_fs60.writeFileSync)(exitFile, "1\n");
25684
25854
  } catch {
25685
25855
  }
25686
25856
  }
@@ -25700,12 +25870,12 @@ async function stopDetachedJob(cwd, id, opts) {
25700
25870
  hint: stopped ? MCP_STOP_JOB_HINT : MCP_WAIT_JOB_STILL_RUNNING_HINT
25701
25871
  };
25702
25872
  }
25703
- var import_node_fs59, import_node_path61, 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;
25873
+ var import_node_fs60, import_node_path62, 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;
25704
25874
  var init_wait_for_job = __esm({
25705
25875
  "src/mcp/wait-for-job.ts"() {
25706
25876
  "use strict";
25707
- import_node_fs59 = require("fs");
25708
- import_node_path61 = require("path");
25877
+ import_node_fs60 = require("fs");
25878
+ import_node_path62 = require("path");
25709
25879
  init_workspace_scratch();
25710
25880
  init_job_process();
25711
25881
  init_wait_for_turn();
@@ -25982,9 +26152,9 @@ function matchSimpleGlob(pattern, name) {
25982
26152
  return new RegExp(`^${escaped}$`).test(name);
25983
26153
  }
25984
26154
  function readWorktreeInclude(repoPath) {
25985
- const path2 = (0, import_node_path62.join)(repoPath, ".worktreeinclude");
25986
- if (!(0, import_node_fs60.existsSync)(path2)) return [];
25987
- return (0, import_node_fs60.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
26155
+ const path2 = (0, import_node_path63.join)(repoPath, ".worktreeinclude");
26156
+ if (!(0, import_node_fs61.existsSync)(path2)) return [];
26157
+ return (0, import_node_fs61.readFileSync)(path2, "utf8").split("\n").map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
25988
26158
  }
25989
26159
  function resolveFilesToCopy(repoPath) {
25990
26160
  const fromInclude = readWorktreeInclude(repoPath);
@@ -25994,10 +26164,10 @@ function resolveFilesToCopy(repoPath) {
25994
26164
  if (settings?.fileIncludeGlobs?.length) {
25995
26165
  const matched = [];
25996
26166
  try {
25997
- for (const entry of (0, import_node_fs60.readdirSync)(repoPath, { withFileTypes: true })) {
26167
+ for (const entry of (0, import_node_fs61.readdirSync)(repoPath, { withFileTypes: true })) {
25998
26168
  if (!entry.isFile()) continue;
25999
26169
  for (const glob of settings.fileIncludeGlobs) {
26000
- if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path62.basename)(glob), entry.name)) {
26170
+ if (matchSimpleGlob(glob, entry.name) || matchSimpleGlob((0, import_node_path63.basename)(glob), entry.name)) {
26001
26171
  matched.push(entry.name);
26002
26172
  break;
26003
26173
  }
@@ -26009,7 +26179,7 @@ function resolveFilesToCopy(repoPath) {
26009
26179
  }
26010
26180
  const defaults = [];
26011
26181
  try {
26012
- for (const entry of (0, import_node_fs60.readdirSync)(repoPath, { withFileTypes: true })) {
26182
+ for (const entry of (0, import_node_fs61.readdirSync)(repoPath, { withFileTypes: true })) {
26013
26183
  if (entry.isFile() && entry.name.startsWith(".env")) {
26014
26184
  defaults.push(entry.name);
26015
26185
  }
@@ -26023,11 +26193,11 @@ function copyConfiguredFiles(repoPath, worktreePath) {
26023
26193
  const patterns = resolveFilesToCopy(repoPath);
26024
26194
  const copied = [];
26025
26195
  for (const rel of patterns) {
26026
- const src = (0, import_node_path62.join)(repoPath, rel);
26027
- if (!(0, import_node_fs60.existsSync)(src)) continue;
26028
- const dest = (0, import_node_path62.join)(worktreePath, rel);
26029
- (0, import_node_fs60.mkdirSync)((0, import_node_path62.dirname)(dest), { recursive: true });
26030
- (0, import_node_fs60.copyFileSync)(src, dest);
26196
+ const src = (0, import_node_path63.join)(repoPath, rel);
26197
+ if (!(0, import_node_fs61.existsSync)(src)) continue;
26198
+ const dest = (0, import_node_path63.join)(worktreePath, rel);
26199
+ (0, import_node_fs61.mkdirSync)((0, import_node_path63.dirname)(dest), { recursive: true });
26200
+ (0, import_node_fs61.copyFileSync)(src, dest);
26031
26201
  copied.push(rel);
26032
26202
  }
26033
26203
  linkSharedDirectories(repoPath, worktreePath);
@@ -26040,19 +26210,19 @@ function linkSharedDirectories(repoPath, worktreePath) {
26040
26210
  for (const rel of dirs) {
26041
26211
  if (!isSafeRelativeDir(rel)) continue;
26042
26212
  if (!isGitignored(repoPath, rel)) continue;
26043
- const src = (0, import_node_path62.join)(repoPath, rel);
26213
+ const src = (0, import_node_path63.join)(repoPath, rel);
26044
26214
  let srcStat;
26045
26215
  try {
26046
- srcStat = (0, import_node_fs60.lstatSync)(src);
26216
+ srcStat = (0, import_node_fs61.lstatSync)(src);
26047
26217
  } catch {
26048
26218
  continue;
26049
26219
  }
26050
26220
  if (!srcStat.isDirectory()) continue;
26051
- const dest = (0, import_node_path62.join)(worktreePath, rel);
26052
- if ((0, import_node_fs60.existsSync)(dest)) continue;
26053
- (0, import_node_fs60.mkdirSync)((0, import_node_path62.dirname)(dest), { recursive: true });
26221
+ const dest = (0, import_node_path63.join)(worktreePath, rel);
26222
+ if ((0, import_node_fs61.existsSync)(dest)) continue;
26223
+ (0, import_node_fs61.mkdirSync)((0, import_node_path63.dirname)(dest), { recursive: true });
26054
26224
  try {
26055
- (0, import_node_fs60.symlinkSync)(src, dest);
26225
+ (0, import_node_fs61.symlinkSync)(src, dest);
26056
26226
  } catch {
26057
26227
  continue;
26058
26228
  }
@@ -26062,13 +26232,13 @@ function linkSharedDirectories(repoPath, worktreePath) {
26062
26232
  }
26063
26233
  function samePath2(a, b) {
26064
26234
  try {
26065
- return (0, import_node_fs60.realpathSync)(a) === (0, import_node_fs60.realpathSync)(b);
26235
+ return (0, import_node_fs61.realpathSync)(a) === (0, import_node_fs61.realpathSync)(b);
26066
26236
  } catch {
26067
- return (0, import_node_path62.resolve)(a) === (0, import_node_path62.resolve)(b);
26237
+ return (0, import_node_path63.resolve)(a) === (0, import_node_path63.resolve)(b);
26068
26238
  }
26069
26239
  }
26070
26240
  function isSafeRelativeDir(rel) {
26071
- if (!rel || (0, import_node_path62.isAbsolute)(rel)) return false;
26241
+ if (!rel || (0, import_node_path63.isAbsolute)(rel)) return false;
26072
26242
  const parts = rel.split(/[\\/]/).filter(Boolean);
26073
26243
  return parts.length > 0 && parts.every((part) => part !== "." && part !== "..");
26074
26244
  }
@@ -26110,7 +26280,7 @@ function buildWorkspaceScriptEnv(opts, baseEnv) {
26110
26280
  const env = stripNestedElectronEnv({
26111
26281
  ...baseEnv ?? process.env
26112
26282
  });
26113
- const name = opts.workspaceName ?? (0, import_node_path62.basename)(opts.worktreePath);
26283
+ const name = opts.workspaceName ?? (0, import_node_path63.basename)(opts.worktreePath);
26114
26284
  const ports = opts.ports ?? [];
26115
26285
  const primary = ports[0];
26116
26286
  env.SIDEBOARD_WORKSPACE_NAME = name;
@@ -26179,20 +26349,20 @@ function listenerCwd(pid) {
26179
26349
  }
26180
26350
  function realpathOrResolve(path2) {
26181
26351
  try {
26182
- return (0, import_node_fs60.realpathSync)(path2);
26352
+ return (0, import_node_fs61.realpathSync)(path2);
26183
26353
  } catch {
26184
- return (0, import_node_path62.resolve)(path2);
26354
+ return (0, import_node_path63.resolve)(path2);
26185
26355
  }
26186
26356
  }
26187
26357
  function isOtherWorktreeListenerCwd(cwd, worktreePath) {
26188
26358
  const wt = realpathOrResolve(worktreePath);
26189
26359
  const c = realpathOrResolve(cwd);
26190
- if (c === wt || c.startsWith(wt + import_node_path62.sep)) return false;
26191
- const parent = (0, import_node_path62.dirname)(wt);
26192
- const thisName = (0, import_node_path62.basename)(wt);
26360
+ if (c === wt || c.startsWith(wt + import_node_path63.sep)) return false;
26361
+ const parent = (0, import_node_path63.dirname)(wt);
26362
+ const thisName = (0, import_node_path63.basename)(wt);
26193
26363
  if (!thisName || c === parent) return false;
26194
- if (!c.startsWith(parent + import_node_path62.sep)) return false;
26195
- const first = c.slice(parent.length + 1).split(import_node_path62.sep)[0];
26364
+ if (!c.startsWith(parent + import_node_path63.sep)) return false;
26365
+ const first = c.slice(parent.length + 1).split(import_node_path63.sep)[0];
26196
26366
  return Boolean(first) && first !== thisName;
26197
26367
  }
26198
26368
  function signalPid(pid, signal) {
@@ -26204,7 +26374,7 @@ function signalPid(pid, signal) {
26204
26374
  function isThisWorktreeListenerCwd(cwd, worktreePath) {
26205
26375
  const wt = realpathOrResolve(worktreePath);
26206
26376
  const c = realpathOrResolve(cwd);
26207
- return c === wt || c.startsWith(wt + import_node_path62.sep);
26377
+ return c === wt || c.startsWith(wt + import_node_path63.sep);
26208
26378
  }
26209
26379
  function killDetachedRunTree(pid, worktreePath) {
26210
26380
  if (!Number.isFinite(pid) || pid <= 1 || pid === process.pid) return;
@@ -26456,13 +26626,13 @@ async function startDevServer(repoPath, worktreePath, onLine, opts) {
26456
26626
  throw err;
26457
26627
  }
26458
26628
  }
26459
- var import_node_fs60, import_node_child_process7, import_node_path62, import_execa4, import_node_readline3, cachedLoginEnv;
26629
+ var import_node_fs61, import_node_child_process7, import_node_path63, import_execa4, import_node_readline3, cachedLoginEnv;
26460
26630
  var init_conductor = __esm({
26461
26631
  "src/hook/conductor.ts"() {
26462
26632
  "use strict";
26463
- import_node_fs60 = require("fs");
26633
+ import_node_fs61 = require("fs");
26464
26634
  import_node_child_process7 = require("child_process");
26465
- import_node_path62 = require("path");
26635
+ import_node_path63 = require("path");
26466
26636
  import_execa4 = require("execa");
26467
26637
  import_node_readline3 = require("readline");
26468
26638
  init_settings();
@@ -26493,9 +26663,9 @@ async function findOrphanWorktrees(repoPaths) {
26493
26663
  repoPaths?.length ? repoPaths : threads.map((t) => t.repoPath).filter(Boolean)
26494
26664
  );
26495
26665
  const homeRoot = sideboardWorkspacesDir();
26496
- if ((0, import_node_fs61.existsSync)(homeRoot)) {
26666
+ if ((0, import_node_fs62.existsSync)(homeRoot)) {
26497
26667
  try {
26498
- for (const entry of (0, import_node_fs61.readdirSync)(homeRoot, { withFileTypes: true })) {
26668
+ for (const entry of (0, import_node_fs62.readdirSync)(homeRoot, { withFileTypes: true })) {
26499
26669
  if (!entry.isDirectory()) continue;
26500
26670
  void entry;
26501
26671
  }
@@ -26505,7 +26675,7 @@ async function findOrphanWorktrees(repoPaths) {
26505
26675
  const orphans = [];
26506
26676
  const seen = /* @__PURE__ */ new Set();
26507
26677
  for (const repoPath of repos) {
26508
- if (!repoPath || !(0, import_node_fs61.existsSync)(repoPath)) continue;
26678
+ if (!repoPath || !(0, import_node_fs62.existsSync)(repoPath)) continue;
26509
26679
  try {
26510
26680
  const wts = await listWorktrees(repoPath);
26511
26681
  for (const wt of wts) {
@@ -26516,7 +26686,7 @@ async function findOrphanWorktrees(repoPaths) {
26516
26686
  seen.add(path2);
26517
26687
  let mtimeMs = 0;
26518
26688
  try {
26519
- mtimeMs = (0, import_node_fs61.statSync)(path2).mtimeMs;
26689
+ mtimeMs = (0, import_node_fs62.statSync)(path2).mtimeMs;
26520
26690
  } catch {
26521
26691
  mtimeMs = 0;
26522
26692
  }
@@ -26526,16 +26696,16 @@ async function findOrphanWorktrees(repoPaths) {
26526
26696
  }
26527
26697
  try {
26528
26698
  const root = worktreesRoot(repoPath);
26529
- if ((0, import_node_fs61.existsSync)(root)) {
26530
- for (const entry of (0, import_node_fs61.readdirSync)(root, { withFileTypes: true })) {
26699
+ if ((0, import_node_fs62.existsSync)(root)) {
26700
+ for (const entry of (0, import_node_fs62.readdirSync)(root, { withFileTypes: true })) {
26531
26701
  if (!entry.isDirectory()) continue;
26532
- const path2 = (0, import_node_path63.join)(root, entry.name).replace(/\/$/, "");
26702
+ const path2 = (0, import_node_path64.join)(root, entry.name).replace(/\/$/, "");
26533
26703
  if (known.has(path2) || seen.has(path2)) continue;
26534
- if (!(0, import_node_fs61.existsSync)((0, import_node_path63.join)(path2, ".git"))) continue;
26704
+ if (!(0, import_node_fs62.existsSync)((0, import_node_path64.join)(path2, ".git"))) continue;
26535
26705
  seen.add(path2);
26536
26706
  let mtimeMs = 0;
26537
26707
  try {
26538
- mtimeMs = (0, import_node_fs61.statSync)(path2).mtimeMs;
26708
+ mtimeMs = (0, import_node_fs62.statSync)(path2).mtimeMs;
26539
26709
  } catch {
26540
26710
  mtimeMs = Date.now();
26541
26711
  }
@@ -26596,12 +26766,12 @@ function worktreeCleanupSettings() {
26596
26766
  autoCleanupOrphans: a.autoCleanupOrphans
26597
26767
  };
26598
26768
  }
26599
- var import_node_fs61, import_node_path63;
26769
+ var import_node_fs62, import_node_path64;
26600
26770
  var init_orphan_cleanup = __esm({
26601
26771
  "src/git/orphan-cleanup.ts"() {
26602
26772
  "use strict";
26603
- import_node_fs61 = require("fs");
26604
- import_node_path63 = require("path");
26773
+ import_node_fs62 = require("fs");
26774
+ import_node_path64 = require("path");
26605
26775
  init_worktree();
26606
26776
  init_thread_store();
26607
26777
  init_paths();
@@ -26777,12 +26947,12 @@ async function cloneRepoIntoSideboard(opts) {
26777
26947
  if (!url) throw new Error("Clone URL is required");
26778
26948
  let name = opts.name?.trim();
26779
26949
  if (!name) {
26780
- const leaf = (0, import_node_path64.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
26950
+ const leaf = (0, import_node_path65.basename)(url.replace(/\/$/, "").replace(/\.git$/, ""));
26781
26951
  name = leaf || "repo";
26782
26952
  }
26783
26953
  name = name.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "repo";
26784
- const dest = (0, import_node_path64.join)(sideboardReposDir(), name);
26785
- if ((0, import_node_fs62.existsSync)(dest)) {
26954
+ const dest = (0, import_node_path65.join)(sideboardReposDir(), name);
26955
+ if ((0, import_node_fs63.existsSync)(dest)) {
26786
26956
  const repoPath2 = await resolveRepoRoot(dest);
26787
26957
  const workspace2 = await addWorkspace(repoPath2);
26788
26958
  return { repoPath: repoPath2, workspace: workspace2 };
@@ -26797,12 +26967,12 @@ async function cloneRepoIntoSideboard(opts) {
26797
26967
  const workspace = await addWorkspace(repoPath);
26798
26968
  return { repoPath, workspace };
26799
26969
  }
26800
- var import_node_fs62, import_node_path64, import_execa6;
26970
+ var import_node_fs63, import_node_path65, import_execa6;
26801
26971
  var init_clone_repo = __esm({
26802
26972
  "src/git/clone-repo.ts"() {
26803
26973
  "use strict";
26804
- import_node_fs62 = require("fs");
26805
- import_node_path64 = require("path");
26974
+ import_node_fs63 = require("fs");
26975
+ import_node_path65 = require("path");
26806
26976
  import_execa6 = require("execa");
26807
26977
  init_paths();
26808
26978
  init_workspaces();
@@ -29396,7 +29566,7 @@ function reuseLiveThread(input, repoPath, match) {
29396
29566
  }
29397
29567
  async function createThread(input, _onSetupLine) {
29398
29568
  const repoPath = await resolveRepoRoot(input.repoPath);
29399
- if (!(0, import_node_fs63.existsSync)(repoPath)) {
29569
+ if (!(0, import_node_fs64.existsSync)(repoPath)) {
29400
29570
  throw new Error(`Repo not found: ${repoPath}`);
29401
29571
  }
29402
29572
  if (isRemovedWorkspace(repoPath)) throw new Error(`Project was removed: ${repoPath}`);
@@ -29596,11 +29766,11 @@ async function listLinearIssues(agent, repoPath) {
29596
29766
  }
29597
29767
  return adapter.listLinearIssues(repoPath);
29598
29768
  }
29599
- var import_node_fs63;
29769
+ var import_node_fs64;
29600
29770
  var init_create = __esm({
29601
29771
  "src/threads/create.ts"() {
29602
29772
  "use strict";
29603
- import_node_fs63 = require("fs");
29773
+ import_node_fs64 = require("fs");
29604
29774
  init_acp_harness();
29605
29775
  init_detect();
29606
29776
  init_worktree();
@@ -29690,7 +29860,7 @@ function stampOf(thread) {
29690
29860
  function repoLabel(thread) {
29691
29861
  if (isOrchestratorThread(thread)) return "Orchestration";
29692
29862
  const path2 = thread.repoPath?.trim() ?? "";
29693
- return path2 && (0, import_node_path65.basename)(path2) || path2 || "project";
29863
+ return path2 && (0, import_node_path66.basename)(path2) || path2 || "project";
29694
29864
  }
29695
29865
  function toAgent(thread, flags) {
29696
29866
  const prUrl = thread.prUrl?.trim();
@@ -29889,11 +30059,11 @@ function formatFleetArchive(view) {
29889
30059
  }
29890
30060
  return lines.join("\n");
29891
30061
  }
29892
- var import_node_path65, DEFAULT_LIMIT, MAX_LIMIT;
30062
+ var import_node_path66, DEFAULT_LIMIT, MAX_LIMIT;
29893
30063
  var init_fleet_archive = __esm({
29894
30064
  "src/archive/fleet-archive.ts"() {
29895
30065
  "use strict";
29896
- import_node_path65 = require("path");
30066
+ import_node_path66 = require("path");
29897
30067
  init_global_workspace();
29898
30068
  init_worktree_labels();
29899
30069
  DEFAULT_LIMIT = 40;
@@ -30068,11 +30238,11 @@ function writeTurnLive(threadId, progress) {
30068
30238
  const path2 = threadLivePath(threadId);
30069
30239
  const tmp = `${path2}.${process.pid}.tmp`;
30070
30240
  try {
30071
- (0, import_node_fs64.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
30072
- (0, import_node_fs64.renameSync)(tmp, path2);
30241
+ (0, import_node_fs65.writeFileSync)(tmp, JSON.stringify(progress), "utf8");
30242
+ (0, import_node_fs65.renameSync)(tmp, path2);
30073
30243
  } catch {
30074
30244
  try {
30075
- (0, import_node_fs64.unlinkSync)(tmp);
30245
+ (0, import_node_fs65.unlinkSync)(tmp);
30076
30246
  } catch {
30077
30247
  }
30078
30248
  }
@@ -30082,9 +30252,9 @@ function readTurnLiveParts(threadId) {
30082
30252
  }
30083
30253
  function readTurnLive(threadId) {
30084
30254
  const path2 = threadLivePath(threadId);
30085
- if (!(0, import_node_fs64.existsSync)(path2)) return null;
30255
+ if (!(0, import_node_fs65.existsSync)(path2)) return null;
30086
30256
  try {
30087
- const raw = JSON.parse((0, import_node_fs64.readFileSync)(path2, "utf8"));
30257
+ const raw = JSON.parse((0, import_node_fs65.readFileSync)(path2, "utf8"));
30088
30258
  if (!raw || typeof raw.summary !== "string") return null;
30089
30259
  return raw;
30090
30260
  } catch {
@@ -30096,17 +30266,17 @@ function clearTurnLive(threadId) {
30096
30266
  if (buf?.timer) clearTimeout(buf.timer);
30097
30267
  buffers.delete(threadId);
30098
30268
  const path2 = threadLivePath(threadId);
30099
- if (!(0, import_node_fs64.existsSync)(path2)) return;
30269
+ if (!(0, import_node_fs65.existsSync)(path2)) return;
30100
30270
  try {
30101
- (0, import_node_fs64.unlinkSync)(path2);
30271
+ (0, import_node_fs65.unlinkSync)(path2);
30102
30272
  } catch {
30103
30273
  }
30104
30274
  }
30105
- var import_node_fs64, buffers, FLUSH_MS, MAX_PARTS;
30275
+ var import_node_fs65, buffers, FLUSH_MS, MAX_PARTS;
30106
30276
  var init_turn_live = __esm({
30107
30277
  "src/store/turn-live.ts"() {
30108
30278
  "use strict";
30109
- import_node_fs64 = require("fs");
30279
+ import_node_fs65 = require("fs");
30110
30280
  init_message_parts();
30111
30281
  init_paths();
30112
30282
  init_agent_block();
@@ -30394,7 +30564,7 @@ var init_quota_failover = __esm({
30394
30564
  // src/threads/adopt.ts
30395
30565
  function thisModuleFile2() {
30396
30566
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
30397
- return cjsFile || process.argv[1] || (0, import_node_path66.join)(process.cwd(), "package.json");
30567
+ return cjsFile || process.argv[1] || (0, import_node_path67.join)(process.cwd(), "package.json");
30398
30568
  }
30399
30569
  function openReadonlySqlite(file) {
30400
30570
  const req = (0, import_node_module7.createRequire)(thisModuleFile2());
@@ -30412,21 +30582,21 @@ function mapAgentType(raw) {
30412
30582
  return null;
30413
30583
  }
30414
30584
  function resolveConductorCursorAgentId(workspacePath) {
30415
- if (!workspacePath || !(0, import_node_fs65.existsSync)(CURSOR_SDK_STORE)) return null;
30585
+ if (!workspacePath || !(0, import_node_fs66.existsSync)(CURSOR_SDK_STORE)) return null;
30416
30586
  const normalized = workspacePath.replace(/\/$/, "");
30417
30587
  let best = null;
30418
30588
  let hashes;
30419
30589
  try {
30420
- hashes = (0, import_node_fs65.readdirSync)(CURSOR_SDK_STORE);
30590
+ hashes = (0, import_node_fs66.readdirSync)(CURSOR_SDK_STORE);
30421
30591
  } catch {
30422
30592
  return null;
30423
30593
  }
30424
30594
  for (const hash of hashes) {
30425
- const agentsFile = (0, import_node_path66.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
30426
- if (!(0, import_node_fs65.existsSync)(agentsFile)) continue;
30595
+ const agentsFile = (0, import_node_path67.join)(CURSOR_SDK_STORE, hash, "agents.ndjson");
30596
+ if (!(0, import_node_fs66.existsSync)(agentsFile)) continue;
30427
30597
  let text8;
30428
30598
  try {
30429
- text8 = (0, import_node_fs65.readFileSync)(agentsFile, "utf8");
30599
+ text8 = (0, import_node_fs66.readFileSync)(agentsFile, "utf8");
30430
30600
  } catch {
30431
30601
  continue;
30432
30602
  }
@@ -30450,7 +30620,7 @@ function resolveConductorCursorAgentId(workspacePath) {
30450
30620
  return best?.agentId ?? null;
30451
30621
  }
30452
30622
  async function adoptThread(input) {
30453
- if (!(0, import_node_fs65.existsSync)(input.worktreePath)) {
30623
+ if (!(0, import_node_fs66.existsSync)(input.worktreePath)) {
30454
30624
  throw new Error(`Worktree not found: ${input.worktreePath}`);
30455
30625
  }
30456
30626
  const repoPath = await resolveRepoRoot(input.worktreePath);
@@ -30482,18 +30652,18 @@ function conductorDbPath() {
30482
30652
  return CONDUCTOR_DB;
30483
30653
  }
30484
30654
  function listConductorWorkspaces() {
30485
- if (!(0, import_node_fs65.existsSync)(CONDUCTOR_DB)) {
30655
+ if (!(0, import_node_fs66.existsSync)(CONDUCTOR_DB)) {
30486
30656
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
30487
30657
  }
30488
- const tmp = (0, import_node_fs65.mkdtempSync)((0, import_node_path66.join)((0, import_node_os22.tmpdir)(), "sideboard-conductor-"));
30489
- const snapshot = (0, import_node_path66.join)(tmp, "conductor.db");
30658
+ const tmp = (0, import_node_fs66.mkdtempSync)((0, import_node_path67.join)((0, import_node_os22.tmpdir)(), "sideboard-conductor-"));
30659
+ const snapshot = (0, import_node_path67.join)(tmp, "conductor.db");
30490
30660
  try {
30491
- (0, import_node_fs65.copyFileSync)(CONDUCTOR_DB, snapshot);
30661
+ (0, import_node_fs66.copyFileSync)(CONDUCTOR_DB, snapshot);
30492
30662
  for (const suffix of ["-wal", "-shm"]) {
30493
30663
  const src = `${CONDUCTOR_DB}${suffix}`;
30494
- if ((0, import_node_fs65.existsSync)(src)) {
30664
+ if ((0, import_node_fs66.existsSync)(src)) {
30495
30665
  try {
30496
- (0, import_node_fs65.copyFileSync)(src, `${snapshot}${suffix}`);
30666
+ (0, import_node_fs66.copyFileSync)(src, `${snapshot}${suffix}`);
30497
30667
  } catch {
30498
30668
  }
30499
30669
  }
@@ -30569,22 +30739,22 @@ function listConductorWorkspaces() {
30569
30739
  db.close();
30570
30740
  }
30571
30741
  } finally {
30572
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
30742
+ (0, import_node_fs66.rmSync)(tmp, { recursive: true, force: true });
30573
30743
  }
30574
30744
  }
30575
30745
  function importConductorWorkspace(workspaceId) {
30576
- if (!(0, import_node_fs65.existsSync)(CONDUCTOR_DB)) {
30746
+ if (!(0, import_node_fs66.existsSync)(CONDUCTOR_DB)) {
30577
30747
  throw new Error(`Conductor DB not found at ${CONDUCTOR_DB}`);
30578
30748
  }
30579
- const tmp = (0, import_node_fs65.mkdtempSync)((0, import_node_path66.join)((0, import_node_os22.tmpdir)(), "sideboard-conductor-"));
30580
- const snapshot = (0, import_node_path66.join)(tmp, "conductor.db");
30749
+ const tmp = (0, import_node_fs66.mkdtempSync)((0, import_node_path67.join)((0, import_node_os22.tmpdir)(), "sideboard-conductor-"));
30750
+ const snapshot = (0, import_node_path67.join)(tmp, "conductor.db");
30581
30751
  try {
30582
- (0, import_node_fs65.copyFileSync)(CONDUCTOR_DB, snapshot);
30752
+ (0, import_node_fs66.copyFileSync)(CONDUCTOR_DB, snapshot);
30583
30753
  for (const suffix of ["-wal", "-shm"]) {
30584
30754
  const src = `${CONDUCTOR_DB}${suffix}`;
30585
- if ((0, import_node_fs65.existsSync)(src)) {
30755
+ if ((0, import_node_fs66.existsSync)(src)) {
30586
30756
  try {
30587
- (0, import_node_fs65.copyFileSync)(src, `${snapshot}${suffix}`);
30757
+ (0, import_node_fs66.copyFileSync)(src, `${snapshot}${suffix}`);
30588
30758
  } catch {
30589
30759
  }
30590
30760
  }
@@ -30602,7 +30772,7 @@ function importConductorWorkspace(workspaceId) {
30602
30772
  ).get(workspaceId);
30603
30773
  if (!row2) throw new Error(`Conductor workspace not found: ${workspaceId}`);
30604
30774
  const worktreePath = String(row2.workspacePath);
30605
- if (!(0, import_node_fs65.existsSync)(worktreePath)) {
30775
+ if (!(0, import_node_fs66.existsSync)(worktreePath)) {
30606
30776
  throw new Error(`Conductor worktree missing on disk: ${worktreePath}`);
30607
30777
  }
30608
30778
  let sessionId = null;
@@ -30665,31 +30835,31 @@ function importConductorWorkspace(workspaceId) {
30665
30835
  db.close();
30666
30836
  }
30667
30837
  } finally {
30668
- (0, import_node_fs65.rmSync)(tmp, { recursive: true, force: true });
30838
+ (0, import_node_fs66.rmSync)(tmp, { recursive: true, force: true });
30669
30839
  }
30670
30840
  }
30671
30841
  async function importConductorWorkspaceAsync(workspaceId) {
30672
30842
  return importConductorWorkspace(workspaceId);
30673
30843
  }
30674
- var import_node_child_process8, import_node_fs65, import_node_os22, import_node_path66, import_node_module7, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
30844
+ var import_node_child_process8, import_node_fs66, import_node_os22, import_node_path67, import_node_module7, CONDUCTOR_APP_SUPPORT, CONDUCTOR_DB, CURSOR_SDK_STORE;
30675
30845
  var init_adopt = __esm({
30676
30846
  "src/threads/adopt.ts"() {
30677
30847
  "use strict";
30678
30848
  import_node_child_process8 = require("child_process");
30679
- import_node_fs65 = require("fs");
30849
+ import_node_fs66 = require("fs");
30680
30850
  import_node_os22 = require("os");
30681
- import_node_path66 = require("path");
30851
+ import_node_path67 = require("path");
30682
30852
  import_node_module7 = require("module");
30683
30853
  init_worktree();
30684
30854
  init_thread_store();
30685
- CONDUCTOR_APP_SUPPORT = (0, import_node_path66.join)(
30855
+ CONDUCTOR_APP_SUPPORT = (0, import_node_path67.join)(
30686
30856
  process.env.HOME ?? "",
30687
30857
  "Library",
30688
30858
  "Application Support",
30689
30859
  "com.conductor.app"
30690
30860
  );
30691
- CONDUCTOR_DB = (0, import_node_path66.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
30692
- CURSOR_SDK_STORE = (0, import_node_path66.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
30861
+ CONDUCTOR_DB = (0, import_node_path67.join)(CONDUCTOR_APP_SUPPORT, "conductor.db");
30862
+ CURSOR_SDK_STORE = (0, import_node_path67.join)(CONDUCTOR_APP_SUPPORT, "cursor-sdk-store");
30693
30863
  }
30694
30864
  });
30695
30865
 
@@ -30756,7 +30926,7 @@ async function openStackLayer(input, _onSetupLine) {
30756
30926
  let createdWorktree = false;
30757
30927
  const trees = await listWorktrees(repoPath);
30758
30928
  const checkedOut = trees.find((w) => w.branch === branchName);
30759
- if (checkedOut?.path && (0, import_node_fs66.existsSync)(checkedOut.path)) {
30929
+ if (checkedOut?.path && (0, import_node_fs67.existsSync)(checkedOut.path)) {
30760
30930
  if (input.reuseExistingWorktree !== false) {
30761
30931
  worktreePath = checkedOut.path;
30762
30932
  } else {
@@ -30898,7 +31068,7 @@ async function initStackFromThread(input, onSetupLine) {
30898
31068
  async function createPrStack(input, onSetupLine) {
30899
31069
  await requireAgent(input.agent);
30900
31070
  const repoPath = await resolveRepoRoot(input.repoPath);
30901
- if (!(0, import_node_fs66.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
31071
+ if (!(0, import_node_fs67.existsSync)(repoPath)) throw new Error(`Repo not found: ${repoPath}`);
30902
31072
  if (!input.branches.length) throw new Error("At least one branch name required");
30903
31073
  const status = await detectGhStack(repoPath);
30904
31074
  if (!status.available) throw new Error(status.reason);
@@ -30965,7 +31135,7 @@ async function createPrStack(input, onSetupLine) {
30965
31135
  }
30966
31136
  }
30967
31137
  const claimed = new Set(threads.map((t) => t.worktreePath));
30968
- if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs66.existsSync)(bootstrap.worktreePath)) {
31138
+ if (!claimed.has(bootstrap.worktreePath) && (0, import_node_fs67.existsSync)(bootstrap.worktreePath)) {
30969
31139
  try {
30970
31140
  await removeWorktree(repoPath, bootstrap.worktreePath, {
30971
31141
  deleteBranch: bootstrap.branchName
@@ -30985,11 +31155,11 @@ function stackAgentDefaultsFrom(input) {
30985
31155
  planMode: input.planMode
30986
31156
  };
30987
31157
  }
30988
- var import_node_fs66;
31158
+ var import_node_fs67;
30989
31159
  var init_stack_layers = __esm({
30990
31160
  "src/threads/stack-layers.ts"() {
30991
31161
  "use strict";
30992
- import_node_fs66 = require("fs");
31162
+ import_node_fs67 = require("fs");
30993
31163
  init_detect();
30994
31164
  init_run();
30995
31165
  init_stack();
@@ -31029,11 +31199,11 @@ async function formatPrCreateFailure(raw, cwd, ctx) {
31029
31199
  }
31030
31200
  async function createCursorPullRequest(worktreePath, slug, opts) {
31031
31201
  const bodyText = (opts.body ?? opts.title).trim() || opts.title;
31032
- const bodyFile = (0, import_node_path67.join)(
31202
+ const bodyFile = (0, import_node_path68.join)(
31033
31203
  (0, import_node_os23.tmpdir)(),
31034
31204
  `sideboard-pr-body-${process.pid}-${(0, import_node_crypto22.randomBytes)(6).toString("hex")}.md`
31035
31205
  );
31036
- (0, import_node_fs67.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
31206
+ (0, import_node_fs68.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
31037
31207
  `, "utf8");
31038
31208
  try {
31039
31209
  return await createOrUpdateCursorPr(worktreePath, slug, {
@@ -31045,7 +31215,7 @@ async function createCursorPullRequest(worktreePath, slug, opts) {
31045
31215
  });
31046
31216
  } finally {
31047
31217
  try {
31048
- (0, import_node_fs67.unlinkSync)(bodyFile);
31218
+ (0, import_node_fs68.unlinkSync)(bodyFile);
31049
31219
  } catch {
31050
31220
  }
31051
31221
  }
@@ -31071,11 +31241,11 @@ async function createOrUpdatePr(worktreePath, opts) {
31071
31241
  const headRef = ghHeadRef(slug, opts.head);
31072
31242
  const branchOnly = opts.head.trim().replace(/^refs\/heads\//, "");
31073
31243
  const bodyText = clampGithubPrBody(opts.body ?? opts.title);
31074
- const bodyFile = (0, import_node_path67.join)(
31244
+ const bodyFile = (0, import_node_path68.join)(
31075
31245
  (0, import_node_os23.tmpdir)(),
31076
31246
  `sideboard-pr-body-${process.pid}-${(0, import_node_crypto22.randomBytes)(6).toString("hex")}.md`
31077
31247
  );
31078
- (0, import_node_fs67.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
31248
+ (0, import_node_fs68.writeFileSync)(bodyFile, bodyText.endsWith("\n") ? bodyText : `${bodyText}
31079
31249
  `, "utf8");
31080
31250
  const bodyArgs = ["--body-file", bodyFile];
31081
31251
  try {
@@ -31089,7 +31259,7 @@ async function createOrUpdatePr(worktreePath, opts) {
31089
31259
  });
31090
31260
  } finally {
31091
31261
  try {
31092
- (0, import_node_fs67.unlinkSync)(bodyFile);
31262
+ (0, import_node_fs68.unlinkSync)(bodyFile);
31093
31263
  } catch {
31094
31264
  }
31095
31265
  }
@@ -31164,14 +31334,14 @@ async function createOrUpdatePrWithBodyFile(worktreePath, opts) {
31164
31334
  const url = created.stdout.trim().split("\n").find((l) => l.startsWith("http")) ?? created.stdout.trim();
31165
31335
  return url;
31166
31336
  }
31167
- var import_node_crypto22, import_node_fs67, import_node_os23, import_node_path67;
31337
+ var import_node_crypto22, import_node_fs68, import_node_os23, import_node_path68;
31168
31338
  var init_pr_write = __esm({
31169
31339
  "src/git/pr-write.ts"() {
31170
31340
  "use strict";
31171
31341
  import_node_crypto22 = require("crypto");
31172
- import_node_fs67 = require("fs");
31342
+ import_node_fs68 = require("fs");
31173
31343
  import_node_os23 = require("os");
31174
- import_node_path67 = require("path");
31344
+ import_node_path68 = require("path");
31175
31345
  init_gh_errors();
31176
31346
  init_run();
31177
31347
  init_cursor_pr();
@@ -31181,7 +31351,7 @@ var init_pr_write = __esm({
31181
31351
 
31182
31352
  // src/diff/diff.ts
31183
31353
  async function inspectGitWorktree(worktreePath) {
31184
- if (!worktreePath || !(0, import_node_fs68.existsSync)(worktreePath)) return "missing_worktree";
31354
+ if (!worktreePath || !(0, import_node_fs69.existsSync)(worktreePath)) return "missing_worktree";
31185
31355
  const check = await git(["rev-parse", "--is-inside-work-tree"], worktreePath, {
31186
31356
  reject: false
31187
31357
  });
@@ -31189,7 +31359,7 @@ async function inspectGitWorktree(worktreePath) {
31189
31359
  return "ok";
31190
31360
  }
31191
31361
  async function initializeGitRepository(worktreePath) {
31192
- if (!worktreePath || !(0, import_node_fs68.existsSync)(worktreePath)) {
31362
+ if (!worktreePath || !(0, import_node_fs69.existsSync)(worktreePath)) {
31193
31363
  throw new Error("Worktree not found");
31194
31364
  }
31195
31365
  const status = await inspectGitWorktree(worktreePath);
@@ -31323,11 +31493,11 @@ new file mode 100644
31323
31493
  };
31324
31494
  }
31325
31495
  async function untrackedPatch(worktreePath, path2, maxHunk) {
31326
- const abs = (0, import_node_path68.join)(worktreePath, path2);
31496
+ const abs = (0, import_node_path69.join)(worktreePath, path2);
31327
31497
  try {
31328
- const st = (0, import_node_fs68.statSync)(abs);
31498
+ const st = (0, import_node_fs69.statSync)(abs);
31329
31499
  if (st.isFile() && st.size > maxHunk) {
31330
- const buf = (0, import_node_fs68.readFileSync)(abs).subarray(0, maxHunk);
31500
+ const buf = (0, import_node_fs69.readFileSync)(abs).subarray(0, maxHunk);
31331
31501
  return syntheticAddPatch(path2, buf.toString("utf8"), maxHunk);
31332
31502
  }
31333
31503
  } catch {
@@ -31794,9 +31964,9 @@ async function getDiff(worktreePath, repoPath, opts) {
31794
31964
  }
31795
31965
  function statWorktreePath(worktreePath, relativePath) {
31796
31966
  assertSafeRelativePath(relativePath);
31797
- const abs = (0, import_node_path68.join)(worktreePath, relativePath);
31798
- if (!(0, import_node_fs68.existsSync)(abs)) return "missing";
31799
- const st = (0, import_node_fs68.statSync)(abs);
31967
+ const abs = (0, import_node_path69.join)(worktreePath, relativePath);
31968
+ if (!(0, import_node_fs69.existsSync)(abs)) return "missing";
31969
+ const st = (0, import_node_fs69.statSync)(abs);
31800
31970
  if (st.isDirectory()) return "dir";
31801
31971
  if (st.isFile()) return "file";
31802
31972
  return "missing";
@@ -31825,8 +31995,8 @@ function isImageRelativePath(relativePath) {
31825
31995
  function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
31826
31996
  assertSafeRelativePath(relativePath);
31827
31997
  const maxBytes = opts?.maxBytes ?? DEFAULT_UPLOAD_MAX_BYTES;
31828
- const abs = (0, import_node_path68.join)(worktreePath, relativePath);
31829
- const st = (0, import_node_fs68.statSync)(abs);
31998
+ const abs = (0, import_node_path69.join)(worktreePath, relativePath);
31999
+ const st = (0, import_node_fs69.statSync)(abs);
31830
32000
  if (!st.isFile()) {
31831
32001
  throw new Error(`Not a file: ${relativePath}`);
31832
32002
  }
@@ -31835,7 +32005,7 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
31835
32005
  `File too large to upload (${st.size} bytes; max ${maxBytes})`
31836
32006
  );
31837
32007
  }
31838
- const buf = (0, import_node_fs68.readFileSync)(abs);
32008
+ const buf = (0, import_node_fs69.readFileSync)(abs);
31839
32009
  return {
31840
32010
  path: relativePath,
31841
32011
  contentBase64: buf.toString("base64"),
@@ -31845,12 +32015,12 @@ function readWorktreeFileForUpload(worktreePath, relativePath, opts) {
31845
32015
  function readWorktreeFile(worktreePath, relativePath, opts) {
31846
32016
  assertSafeRelativePath(relativePath);
31847
32017
  const maxBytes = opts?.maxBytes ?? 2e5;
31848
- const abs = (0, import_node_path68.join)(worktreePath, relativePath);
31849
- const st = (0, import_node_fs68.statSync)(abs);
32018
+ const abs = (0, import_node_path69.join)(worktreePath, relativePath);
32019
+ const st = (0, import_node_fs69.statSync)(abs);
31850
32020
  if (!st.isFile()) {
31851
32021
  throw new Error(`Not a file: ${relativePath}`);
31852
32022
  }
31853
- const buf = (0, import_node_fs68.readFileSync)(abs);
32023
+ const buf = (0, import_node_fs69.readFileSync)(abs);
31854
32024
  if (isImageRelativePath(relativePath)) {
31855
32025
  const maxImageBytes = Math.max(maxBytes, 15e6);
31856
32026
  const truncated2 = buf.length > maxImageBytes;
@@ -31893,9 +32063,9 @@ function assertSafeRelativePath(relativePath) {
31893
32063
  }
31894
32064
  function writeWorktreeFile(worktreePath, relativePath, content) {
31895
32065
  assertSafeRelativePath(relativePath);
31896
- const abs = (0, import_node_path68.join)(worktreePath, relativePath);
31897
- (0, import_node_fs68.mkdirSync)((0, import_node_path68.dirname)(abs), { recursive: true });
31898
- (0, import_node_fs68.writeFileSync)(abs, content, "utf8");
32066
+ const abs = (0, import_node_path69.join)(worktreePath, relativePath);
32067
+ (0, import_node_fs69.mkdirSync)((0, import_node_path69.dirname)(abs), { recursive: true });
32068
+ (0, import_node_fs69.writeFileSync)(abs, content, "utf8");
31899
32069
  return { path: relativePath };
31900
32070
  }
31901
32071
  async function getWorktreeDirtyStat(worktreePath) {
@@ -31935,12 +32105,12 @@ async function getDiffSummary(worktreePath, repoPath, opts) {
31935
32105
  truncated: full.files.length > maxFiles
31936
32106
  };
31937
32107
  }
31938
- var import_node_fs68, import_node_path68, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
32108
+ var import_node_fs69, import_node_path69, mergeBaseCache, MERGE_BASE_TTL_MS, SHA_RE, IMAGE_EXTENSIONS2, DEFAULT_UPLOAD_MAX_BYTES;
31939
32109
  var init_diff = __esm({
31940
32110
  "src/diff/diff.ts"() {
31941
32111
  "use strict";
31942
- import_node_fs68 = require("fs");
31943
- import_node_path68 = require("path");
32112
+ import_node_fs69 = require("fs");
32113
+ import_node_path69 = require("path");
31944
32114
  init_run();
31945
32115
  init_worktree();
31946
32116
  mergeBaseCache = /* @__PURE__ */ new Map();
@@ -32163,16 +32333,16 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
32163
32333
  if (!relativePath || relativePath.includes("..") || relativePath.startsWith("/")) {
32164
32334
  throw new Error("Invalid path");
32165
32335
  }
32166
- const abs = (0, import_node_path69.join)(worktreePath, relativePath);
32167
- const fd = (0, import_node_fs69.openSync)(abs, "r");
32336
+ const abs = (0, import_node_path70.join)(worktreePath, relativePath);
32337
+ const fd = (0, import_node_fs70.openSync)(abs, "r");
32168
32338
  try {
32169
- const st = (0, import_node_fs69.fstatSync)(fd);
32339
+ const st = (0, import_node_fs70.fstatSync)(fd);
32170
32340
  if (!st.isFile()) throw new Error(`Not a file: ${relativePath}`);
32171
32341
  const size = st.size;
32172
32342
  const start = Math.max(0, size - maxBytes);
32173
32343
  const length = size - start;
32174
32344
  const buf = Buffer.alloc(length);
32175
- if (length > 0) (0, import_node_fs69.readSync)(fd, buf, 0, length, start);
32345
+ if (length > 0) (0, import_node_fs70.readSync)(fd, buf, 0, length, start);
32176
32346
  if (buf.subarray(0, Math.min(buf.length, 8e3)).includes(0)) {
32177
32347
  return {
32178
32348
  path: relativePath,
@@ -32190,15 +32360,15 @@ function readWorktreeFileTail(worktreePath, relativePath, maxBytes = WORKTREE_TA
32190
32360
  }
32191
32361
  return { path: relativePath, content, truncated, binary: false, encoding: "utf8" };
32192
32362
  } finally {
32193
- (0, import_node_fs69.closeSync)(fd);
32363
+ (0, import_node_fs70.closeSync)(fd);
32194
32364
  }
32195
32365
  }
32196
- var import_node_fs69, import_node_path69, WORKTREE_TAIL_BYTES;
32366
+ var import_node_fs70, import_node_path70, WORKTREE_TAIL_BYTES;
32197
32367
  var init_read_worktree_tail = __esm({
32198
32368
  "src/diff/read-worktree-tail.ts"() {
32199
32369
  "use strict";
32200
- import_node_fs69 = require("fs");
32201
- import_node_path69 = require("path");
32370
+ import_node_fs70 = require("fs");
32371
+ import_node_path70 = require("path");
32202
32372
  WORKTREE_TAIL_BYTES = 2e5;
32203
32373
  }
32204
32374
  });
@@ -32347,7 +32517,7 @@ function parseFrontmatter(content) {
32347
32517
  }
32348
32518
  function readSkill(skillMd, source) {
32349
32519
  try {
32350
- const content = (0, import_node_fs70.readFileSync)(skillMd, "utf8");
32520
+ const content = (0, import_node_fs71.readFileSync)(skillMd, "utf8");
32351
32521
  const { name: fmName, description } = parseFrontmatter(content);
32352
32522
  const dirName = skillMd.split("/").slice(-2, -1)[0] || "skill";
32353
32523
  const name = fmName || dirName;
@@ -32366,19 +32536,19 @@ function readSkill(skillMd, source) {
32366
32536
  }
32367
32537
  }
32368
32538
  function scanSkillsDir(dir, source, out) {
32369
- if (!(0, import_node_fs70.existsSync)(dir)) return;
32539
+ if (!(0, import_node_fs71.existsSync)(dir)) return;
32370
32540
  let entries;
32371
32541
  try {
32372
- entries = (0, import_node_fs70.readdirSync)(dir);
32542
+ entries = (0, import_node_fs71.readdirSync)(dir);
32373
32543
  } catch {
32374
32544
  return;
32375
32545
  }
32376
32546
  for (const entry of entries) {
32377
32547
  if (entry.startsWith(".")) continue;
32378
- const skillMd = (0, import_node_path70.join)(dir, entry, "SKILL.md");
32379
- if (!(0, import_node_fs70.existsSync)(skillMd)) continue;
32548
+ const skillMd = (0, import_node_path71.join)(dir, entry, "SKILL.md");
32549
+ if (!(0, import_node_fs71.existsSync)(skillMd)) continue;
32380
32550
  try {
32381
- if (!(0, import_node_fs70.statSync)(skillMd).isFile()) continue;
32551
+ if (!(0, import_node_fs71.statSync)(skillMd).isFile()) continue;
32382
32552
  } catch {
32383
32553
  continue;
32384
32554
  }
@@ -32387,24 +32557,24 @@ function scanSkillsDir(dir, source, out) {
32387
32557
  }
32388
32558
  }
32389
32559
  function scanClaudePluginSkills(pluginsRoot, out) {
32390
- if (!(0, import_node_fs70.existsSync)(pluginsRoot)) return;
32560
+ if (!(0, import_node_fs71.existsSync)(pluginsRoot)) return;
32391
32561
  const walk = (dir, depth, lookingForSkillsDir) => {
32392
32562
  if (depth > 7) return;
32393
32563
  let entries;
32394
32564
  try {
32395
- entries = (0, import_node_fs70.readdirSync)(dir);
32565
+ entries = (0, import_node_fs71.readdirSync)(dir);
32396
32566
  } catch {
32397
32567
  return;
32398
32568
  }
32399
32569
  if (lookingForSkillsDir && entries.includes("SKILL.md")) {
32400
- const skill = readSkill((0, import_node_path70.join)(dir, "SKILL.md"), "cli");
32570
+ const skill = readSkill((0, import_node_path71.join)(dir, "SKILL.md"), "cli");
32401
32571
  if (skill) out.push(skill);
32402
32572
  }
32403
32573
  for (const entry of entries) {
32404
32574
  if (entry === "node_modules" || entry === ".git") continue;
32405
- const full = (0, import_node_path70.join)(dir, entry);
32575
+ const full = (0, import_node_path71.join)(dir, entry);
32406
32576
  try {
32407
- if (!(0, import_node_fs70.statSync)(full).isDirectory()) continue;
32577
+ if (!(0, import_node_fs71.statSync)(full).isDirectory()) continue;
32408
32578
  } catch {
32409
32579
  continue;
32410
32580
  }
@@ -32422,17 +32592,17 @@ function discoverSkills(worktreePath) {
32422
32592
  const home = (0, import_node_os24.homedir)();
32423
32593
  const collected = [];
32424
32594
  for (const rel of [".claude/skills", ".cursor/skills", ".sideboard/skills", ".brightsy/skills", "skills"]) {
32425
- scanSkillsDir((0, import_node_path70.join)(worktreePath, rel), "workspace", collected);
32595
+ scanSkillsDir((0, import_node_path71.join)(worktreePath, rel), "workspace", collected);
32426
32596
  }
32427
32597
  for (const abs of [
32428
- (0, import_node_path70.join)(home, ".claude/skills"),
32429
- (0, import_node_path70.join)(home, ".cursor/skills"),
32430
- (0, import_node_path70.join)(home, ".sideboard/skills"),
32431
- (0, import_node_path70.join)(home, ".brightsy/skills")
32598
+ (0, import_node_path71.join)(home, ".claude/skills"),
32599
+ (0, import_node_path71.join)(home, ".cursor/skills"),
32600
+ (0, import_node_path71.join)(home, ".sideboard/skills"),
32601
+ (0, import_node_path71.join)(home, ".brightsy/skills")
32432
32602
  ]) {
32433
32603
  scanSkillsDir(abs, "user", collected);
32434
32604
  }
32435
- scanClaudePluginSkills((0, import_node_path70.join)(home, ".claude/plugins"), collected);
32605
+ scanClaudePluginSkills((0, import_node_path71.join)(home, ".claude/plugins"), collected);
32436
32606
  collected.push(...bundledSkills());
32437
32607
  const rank = {
32438
32608
  workspace: 0,
@@ -32458,7 +32628,7 @@ function readSkillBody(skillPath, maxChars = 12e3) {
32458
32628
  \u2026(truncated)` : body;
32459
32629
  }
32460
32630
  }
32461
- const raw = (0, import_node_fs70.readFileSync)(skillPath, "utf8");
32631
+ const raw = (0, import_node_fs71.readFileSync)(skillPath, "utf8");
32462
32632
  if (raw.startsWith("---")) {
32463
32633
  const end = raw.indexOf("\n---", 3);
32464
32634
  if (end >= 0) {
@@ -32472,13 +32642,13 @@ function readSkillBody(skillPath, maxChars = 12e3) {
32472
32642
 
32473
32643
  \u2026(truncated)` : raw;
32474
32644
  }
32475
- var import_node_fs70, import_node_os24, import_node_path70, BUNDLED_SKILL_PREFIX;
32645
+ var import_node_fs71, import_node_os24, import_node_path71, BUNDLED_SKILL_PREFIX;
32476
32646
  var init_discover = __esm({
32477
32647
  "src/skills/discover.ts"() {
32478
32648
  "use strict";
32479
- import_node_fs70 = require("fs");
32649
+ import_node_fs71 = require("fs");
32480
32650
  import_node_os24 = require("os");
32481
- import_node_path70 = require("path");
32651
+ import_node_path71 = require("path");
32482
32652
  init_long_running();
32483
32653
  BUNDLED_SKILL_PREFIX = "bundled:";
32484
32654
  }
@@ -32766,7 +32936,8 @@ function promptForJoinedSteer(input) {
32766
32936
  input.worktreePath,
32767
32937
  expandCanonicalGitRequest(input.latestPrompt, {
32768
32938
  forge: input.gitForge,
32769
- worktreePath: input.worktreePath
32939
+ worktreePath: input.worktreePath,
32940
+ hasAnnounceSkill: announceSkillPresent(input.worktreePath)
32770
32941
  }),
32771
32942
  { attachments: latestAttachments }
32772
32943
  );
@@ -32792,10 +32963,10 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
32792
32963
  throw new Error(`Thread is archived: ${thread.id}`);
32793
32964
  }
32794
32965
  const requested = opts?.followUp;
32795
- const join77 = requested === "join";
32966
+ const join78 = requested === "join";
32796
32967
  const followUp = resolveSendFollowUp(
32797
32968
  current,
32798
- join77 ? "steer" : requested
32969
+ join78 ? "steer" : requested
32799
32970
  );
32800
32971
  const explicit = opts?.attachments;
32801
32972
  const consumed = explicit !== void 0 ? { attachments: current.attachments, consumed: explicit } : consumeComposerAttachments(current);
@@ -32804,7 +32975,7 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
32804
32975
  const draft = host.openSteerPrompt.get(current.id);
32805
32976
  const queuedHead = !inFlightEarly && current.status === "queued" && current.queue.length > 0 ? current.queue[0] : null;
32806
32977
  const joinCanMerge = draft != null && !draft.spawned || !inFlightEarly && queuedHead != null;
32807
- const unanswered = followUp === "steer" && !agentHasRepliedEarly && (!join77 || joinCanMerge) ? draft?.text ?? (inFlightEarly ? trailingUnansweredUserText(current.messages) : queuedHead) : null;
32978
+ const unanswered = followUp === "steer" && !agentHasRepliedEarly && (!join78 || joinCanMerge) ? draft?.text ?? (inFlightEarly ? trailingUnansweredUserText(current.messages) : queuedHead) : null;
32808
32979
  if (unanswered != null && (draft ? !draft.spawned : queuedHead != null)) {
32809
32980
  clearSendBookkeeping(host, thread.id);
32810
32981
  const combined = joinSteerPrompt(unanswered, prompt);
@@ -32856,7 +33027,7 @@ async function enqueueThreadSend(host, threadRef, prompt, opts) {
32856
33027
  clearSendBookkeeping(host, thread.id);
32857
33028
  const inFlight = host.activeTurns.has(thread.id) || host.startingTurns.has(thread.id) || current.status === "running";
32858
33029
  shouldSteer = sendFollowUpInterrupts(
32859
- join77 ? "join" : followUp,
33030
+ join78 ? "join" : followUp,
32860
33031
  inFlight || current.queue.length > 0
32861
33032
  );
32862
33033
  const patch = queued;
@@ -32884,6 +33055,7 @@ var init_enqueue_thread_send = __esm({
32884
33055
  "src/orchestrator/enqueue-thread-send.ts"() {
32885
33056
  "use strict";
32886
33057
  init_agent_git_actions();
33058
+ init_announce_skill();
32887
33059
  init_agent_has_replied();
32888
33060
  init_expand();
32889
33061
  init_consume_attachments();
@@ -32929,7 +33101,7 @@ function compiledModuleDir() {
32929
33101
  try {
32930
33102
  const url = import_meta9.url;
32931
33103
  if (typeof url === "string" && url.length > 0) {
32932
- return (0, import_node_path71.dirname)((0, import_node_url7.fileURLToPath)(url));
33104
+ return (0, import_node_path72.dirname)((0, import_node_url7.fileURLToPath)(url));
32933
33105
  }
32934
33106
  } catch {
32935
33107
  }
@@ -32937,8 +33109,8 @@ function compiledModuleDir() {
32937
33109
  }
32938
33110
  function detachedJobScriptIn(dir) {
32939
33111
  for (const name of DETACHED_JOB_FILENAMES) {
32940
- const script = (0, import_node_path71.join)(dir, "scripts", name);
32941
- if ((0, import_node_fs71.existsSync)(script)) return script;
33112
+ const script = (0, import_node_path72.join)(dir, "scripts", name);
33113
+ if ((0, import_node_fs72.existsSync)(script)) return script;
32942
33114
  }
32943
33115
  return null;
32944
33116
  }
@@ -32955,7 +33127,7 @@ function resolveDetachedJobScript() {
32955
33127
  for (let i = 0; i < 8; i++) {
32956
33128
  const candidate = detachedJobScriptIn(dir);
32957
33129
  if (candidate) return candidate;
32958
- const parent = (0, import_node_path71.dirname)(dir);
33130
+ const parent = (0, import_node_path72.dirname)(dir);
32959
33131
  if (parent === dir) break;
32960
33132
  dir = parent;
32961
33133
  }
@@ -32966,12 +33138,12 @@ function formatDetachedJobInvoke(scriptPath) {
32966
33138
  if (resolved) return `node ${JSON.stringify(resolved)}`;
32967
33139
  return "node scripts/detached-job.cjs";
32968
33140
  }
32969
- var import_node_fs71, import_node_path71, import_node_url7, import_meta9, DETACHED_JOB_FILENAMES;
33141
+ var import_node_fs72, import_node_path72, import_node_url7, import_meta9, DETACHED_JOB_FILENAMES;
32970
33142
  var init_detached_job_path = __esm({
32971
33143
  "src/skills/detached-job-path.ts"() {
32972
33144
  "use strict";
32973
- import_node_fs71 = require("fs");
32974
- import_node_path71 = require("path");
33145
+ import_node_fs72 = require("fs");
33146
+ import_node_path72 = require("path");
32975
33147
  import_node_url7 = require("url");
32976
33148
  init_packaged_runtime();
32977
33149
  import_meta9 = {};
@@ -33074,7 +33246,7 @@ function formatWorktreeDirective(thread, opts) {
33074
33246
  lines.push(
33075
33247
  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`)."
33076
33248
  );
33077
- if ((0, import_node_fs72.existsSync)((0, import_node_path72.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.");
33249
+ if ((0, import_node_fs73.existsSync)((0, import_node_path73.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.");
33078
33250
  if (thread.prUrl) {
33079
33251
  lines.push(
33080
33252
  `- A PR already exists (${thread.prUrl}). Update it (push + edit title/body if the purpose drifted) instead of opening a duplicate.`
@@ -33232,16 +33404,16 @@ function formatPrGateDirective() {
33232
33404
  }
33233
33405
  function formatProcessGuideDirective(opts) {
33234
33406
  const worktree = opts?.worktreePath?.trim();
33235
- const hasGraphSkill = !!worktree && (0, import_node_fs72.existsSync)((0, import_node_path72.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
33236
- const hasReviewSkill = !!worktree && (0, import_node_fs72.existsSync)((0, import_node_path72.join)(worktree, ".claude/skills/review/SKILL.md"));
33237
- const hasInstallSkill = !!worktree && (0, import_node_fs72.existsSync)((0, import_node_path72.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
33407
+ const hasGraphSkill = !!worktree && (0, import_node_fs73.existsSync)((0, import_node_path73.join)(worktree, ".claude/skills/graph-engineering/SKILL.md"));
33408
+ const hasReviewSkill = !!worktree && (0, import_node_fs73.existsSync)((0, import_node_path73.join)(worktree, ".claude/skills/review/SKILL.md"));
33409
+ const hasInstallSkill = !!worktree && (0, import_node_fs73.existsSync)((0, import_node_path73.join)(worktree, ".claude/skills/worktree-install/SKILL.md"));
33238
33410
  return [
33239
33411
  "Process guides (recurring work only):",
33240
33412
  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,
33241
33413
  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,
33242
33414
  "- 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`.",
33243
33415
  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.",
33244
- !!worktree && (0, import_node_fs72.existsSync)((0, import_node_path72.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."
33416
+ !!worktree && (0, import_node_fs73.existsSync)((0, import_node_path73.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."
33245
33417
  ].filter(Boolean).join("\n");
33246
33418
  }
33247
33419
  function formatLongRunningDirective(opts) {
@@ -33274,12 +33446,12 @@ function formatArtifactDirective() {
33274
33446
  function formatUiReminder() {
33275
33447
  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.";
33276
33448
  }
33277
- var import_node_fs72, import_node_path72, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
33449
+ var import_node_fs73, import_node_path73, PR_GOAL_RE, GITHUB_TICKET_REF, KEYED_TICKET_REF;
33278
33450
  var init_instructions = __esm({
33279
33451
  "src/agents/instructions.ts"() {
33280
33452
  "use strict";
33281
- import_node_fs72 = require("fs");
33282
- import_node_path72 = require("path");
33453
+ import_node_fs73 = require("fs");
33454
+ import_node_path73 = require("path");
33283
33455
  init_git_auth_mode();
33284
33456
  init_forge_git_directives();
33285
33457
  init_branch_prefix();
@@ -34100,40 +34272,40 @@ __export(plan_file_exports, {
34100
34272
  writePlanFile: () => writePlanFile
34101
34273
  });
34102
34274
  function ensureAttachmentsGitignore(worktreePath) {
34103
- const gitignoreAbs = (0, import_node_path73.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
34104
- if ((0, import_node_fs73.existsSync)(gitignoreAbs)) return;
34105
- (0, import_node_fs73.mkdirSync)((0, import_node_path73.dirname)(gitignoreAbs), { recursive: true });
34106
- (0, import_node_fs73.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
34275
+ const gitignoreAbs = (0, import_node_path74.join)(worktreePath, ATTACHMENTS_DIR, ".gitignore");
34276
+ if ((0, import_node_fs74.existsSync)(gitignoreAbs)) return;
34277
+ (0, import_node_fs74.mkdirSync)((0, import_node_path74.dirname)(gitignoreAbs), { recursive: true });
34278
+ (0, import_node_fs74.writeFileSync)(gitignoreAbs, attachmentsGitignoreBody(), "utf8");
34107
34279
  }
34108
34280
  function planFileAbs(worktreePath) {
34109
- return (0, import_node_path73.join)(worktreePath, PLAN_FILE_REL);
34281
+ return (0, import_node_path74.join)(worktreePath, PLAN_FILE_REL);
34110
34282
  }
34111
34283
  function readTextIfPresent2(abs) {
34112
- if (!(0, import_node_fs73.existsSync)(abs)) return null;
34284
+ if (!(0, import_node_fs74.existsSync)(abs)) return null;
34113
34285
  try {
34114
- const content = (0, import_node_fs73.readFileSync)(abs, "utf8");
34286
+ const content = (0, import_node_fs74.readFileSync)(abs, "utf8");
34115
34287
  return content.trim() ? content : null;
34116
34288
  } catch {
34117
34289
  return null;
34118
34290
  }
34119
34291
  }
34120
34292
  function readPlanFile(worktreePath) {
34121
- return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path73.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path73.join)(worktreePath, LEGACY_PLAN_FILE_REL));
34293
+ return readTextIfPresent2(planFileAbs(worktreePath)) ?? readTextIfPresent2((0, import_node_path74.join)(worktreePath, `${LEGACY_ATTACHMENTS_DIR}/plan.md`)) ?? readTextIfPresent2((0, import_node_path74.join)(worktreePath, LEGACY_PLAN_FILE_REL));
34122
34294
  }
34123
34295
  function writePlanFile(worktreePath, content) {
34124
34296
  ensureAttachmentsGitignore(worktreePath);
34125
34297
  const abs = planFileAbs(worktreePath);
34126
- (0, import_node_fs73.mkdirSync)((0, import_node_path73.dirname)(abs), { recursive: true });
34298
+ (0, import_node_fs74.mkdirSync)((0, import_node_path74.dirname)(abs), { recursive: true });
34127
34299
  const body = content.trimEnd() + (content.endsWith("\n") ? "" : "\n");
34128
- (0, import_node_fs73.writeFileSync)(abs, body, "utf8");
34300
+ (0, import_node_fs74.writeFileSync)(abs, body, "utf8");
34129
34301
  return PLAN_FILE_REL;
34130
34302
  }
34131
- var import_node_fs73, import_node_path73;
34303
+ var import_node_fs74, import_node_path74;
34132
34304
  var init_plan_file = __esm({
34133
34305
  "src/plan/plan-file.ts"() {
34134
34306
  "use strict";
34135
- import_node_fs73 = require("fs");
34136
- import_node_path73 = require("path");
34307
+ import_node_fs74 = require("fs");
34308
+ import_node_path74 = require("path");
34137
34309
  init_workspace_scratch();
34138
34310
  init_plan_present();
34139
34311
  init_plan_present();
@@ -34439,13 +34611,13 @@ var init_github_edge = __esm({
34439
34611
 
34440
34612
  // src/orchestrator/github-edge-watch.ts
34441
34613
  function githubEdgeSnapshotPath() {
34442
- return (0, import_node_path74.join)(appDataDir(), "github-edge-watch.json");
34614
+ return (0, import_node_path75.join)(appDataDir(), "github-edge-watch.json");
34443
34615
  }
34444
34616
  function loadGithubEdgeSnapshot() {
34445
34617
  try {
34446
34618
  const path2 = githubEdgeSnapshotPath();
34447
- if (!(0, import_node_fs74.existsSync)(path2)) return emptyGithubEdgeSnapshot();
34448
- return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs74.readFileSync)(path2, "utf8")));
34619
+ if (!(0, import_node_fs75.existsSync)(path2)) return emptyGithubEdgeSnapshot();
34620
+ return coerceGithubEdgeSnapshot(JSON.parse((0, import_node_fs75.readFileSync)(path2, "utf8")));
34449
34621
  } catch {
34450
34622
  return emptyGithubEdgeSnapshot();
34451
34623
  }
@@ -34760,12 +34932,12 @@ function realDeps() {
34760
34932
  now: () => Date.now()
34761
34933
  };
34762
34934
  }
34763
- var import_node_fs74, import_node_path74, timer, polling, needsBaseline;
34935
+ var import_node_fs75, import_node_path75, timer, polling, needsBaseline;
34764
34936
  var init_github_edge_watch = __esm({
34765
34937
  "src/orchestrator/github-edge-watch.ts"() {
34766
34938
  "use strict";
34767
- import_node_fs74 = require("fs");
34768
- import_node_path74 = require("path");
34939
+ import_node_fs75 = require("fs");
34940
+ import_node_path75 = require("path");
34769
34941
  init_pr_gates();
34770
34942
  init_pr_merge_archive();
34771
34943
  init_worktree();
@@ -34879,9 +35051,9 @@ function recoverFinishedCursorRun(opts) {
34879
35051
  return best;
34880
35052
  }
34881
35053
  function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
34882
- if (!(0, import_node_fs75.existsSync)(runsPath)) return null;
35054
+ if (!(0, import_node_fs76.existsSync)(runsPath)) return null;
34883
35055
  try {
34884
- const lines = (0, import_node_fs75.readFileSync)(runsPath, "utf8").split("\n");
35056
+ const lines = (0, import_node_fs76.readFileSync)(runsPath, "utf8").split("\n");
34885
35057
  let best = null;
34886
35058
  for (const line of lines) {
34887
35059
  const trimmed = line.trim();
@@ -34907,11 +35079,11 @@ function scanFinishedCursorRuns(runsPath, agentId, startedAfterMs) {
34907
35079
  return null;
34908
35080
  }
34909
35081
  }
34910
- var import_node_fs75;
35082
+ var import_node_fs76;
34911
35083
  var init_cursor_recover = __esm({
34912
35084
  "src/agents/cursor-recover.ts"() {
34913
35085
  "use strict";
34914
- import_node_fs75 = require("fs");
35086
+ import_node_fs76 = require("fs");
34915
35087
  init_cursor_store();
34916
35088
  }
34917
35089
  });
@@ -35015,7 +35187,7 @@ async function startOrchestration(opts) {
35015
35187
  }
35016
35188
  return ready;
35017
35189
  }
35018
- var import_node_events, import_node_crypto23, import_node_fs76, LIVE_TURN_SPAWN_GRACE_MS, RUN_SCRIPT_DESKTOP_ADOPT_MS, STALE_AGENT_PID_WAIT_MS, LIGHT_RECONCILE_THROTTLE_MS, Orchestrator, singleton2;
35190
+ var import_node_events, import_node_crypto23, import_node_fs77, LIVE_TURN_SPAWN_GRACE_MS, RUN_SCRIPT_DESKTOP_ADOPT_MS, STALE_AGENT_PID_WAIT_MS, LIGHT_RECONCILE_THROTTLE_MS, Orchestrator, singleton2;
35019
35191
  var init_orchestrator = __esm({
35020
35192
  "src/orchestrator/orchestrator.ts"() {
35021
35193
  "use strict";
@@ -35024,7 +35196,7 @@ var init_orchestrator = __esm({
35024
35196
  init_task_state();
35025
35197
  init_wait_for_turn();
35026
35198
  import_node_crypto23 = require("crypto");
35027
- import_node_fs76 = require("fs");
35199
+ import_node_fs77 = require("fs");
35028
35200
  init_error_detail();
35029
35201
  init_run();
35030
35202
  init_stale_lock();
@@ -35036,6 +35208,7 @@ var init_orchestrator = __esm({
35036
35208
  init_worktree_leftovers();
35037
35209
  init_stack();
35038
35210
  init_agent_git_actions();
35211
+ init_announce_skill();
35039
35212
  init_pr_merge_archive();
35040
35213
  init_pr_gates();
35041
35214
  init_conductor();
@@ -35228,7 +35401,7 @@ var init_orchestrator = __esm({
35228
35401
  this.lightReconcileAt.set(repoPath, Date.now());
35229
35402
  for (const thread of listThreads()) {
35230
35403
  if (isGlobalThread(thread) || thread.repoPath !== repoPath) continue;
35231
- if (!(0, import_node_fs76.existsSync)(thread.worktreePath)) {
35404
+ if (!(0, import_node_fs77.existsSync)(thread.worktreePath)) {
35232
35405
  setStatus(thread.id, "broken", "Worktree missing on disk");
35233
35406
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
35234
35407
  }
@@ -35257,7 +35430,7 @@ var init_orchestrator = __esm({
35257
35430
  }
35258
35431
  continue;
35259
35432
  }
35260
- if (!(0, import_node_fs76.existsSync)(thread.worktreePath)) {
35433
+ if (!(0, import_node_fs77.existsSync)(thread.worktreePath)) {
35261
35434
  setStatus(thread.id, "broken", "Worktree missing on disk");
35262
35435
  this.emit({ type: "status_changed", threadId: thread.id, status: "broken" });
35263
35436
  continue;
@@ -35987,7 +36160,8 @@ var init_orchestrator = __esm({
35987
36160
  const turnOrigin = thread.worktreePath?.trim() ? await resolveOriginRemote(thread.worktreePath).catch(() => null) : null;
35988
36161
  const gitPrompt = expandCanonicalGitRequest(promptText, {
35989
36162
  forge: turnOrigin?.forge,
35990
- worktreePath: thread.worktreePath
36163
+ worktreePath: thread.worktreePath,
36164
+ hasAnnounceSkill: announceSkillPresent(thread.worktreePath)
35991
36165
  });
35992
36166
  const expandedAttachments = openSteerTurnAttachments(this.openSteerPrompt.get(threadId), turnAttachments, autoContinue);
35993
36167
  const { agentPrompt: expandedPrompt } = expandComposerPrompt(
@@ -37746,7 +37920,7 @@ ${formatEnvReminder(projectNameForRepoPath(thread.repoPath || thread.worktreePat
37746
37920
  this.emit({ type: "status_changed", threadId: restored2.id, status: restored2.status });
37747
37921
  return restored2;
37748
37922
  }
37749
- if (!(0, import_node_fs76.existsSync)(thread.worktreePath)) {
37923
+ if (!(0, import_node_fs77.existsSync)(thread.worktreePath)) {
37750
37924
  if (isCowboyThread(thread) || isPrimaryCheckoutThread(thread)) {
37751
37925
  throw new Error(
37752
37926
  `Cowboy checkout missing: ${thread.worktreePath}. Re-add the project folder, then restore.`
@@ -38045,6 +38219,8 @@ __export(index_exports, {
38045
38219
  CLOUD_COORDINATOR_STOPPED_REPLY: () => CLOUD_COORDINATOR_STOPPED_REPLY,
38046
38220
  CLOUD_COORDINATOR_TIMEOUT_REPLY: () => CLOUD_COORDINATOR_TIMEOUT_REPLY,
38047
38221
  CLOUD_ORCHESTRATOR_GOAL: () => CLOUD_ORCHESTRATOR_GOAL,
38222
+ COMPUTER_USE_DESCRIPTION: () => COMPUTER_USE_DESCRIPTION,
38223
+ COMPUTER_USE_OFF: () => COMPUTER_USE_OFF,
38048
38224
  CONTEXT_COMPACT_CHARS: () => CONTEXT_COMPACT_CHARS,
38049
38225
  CONTEXT_KEEP_RECENT_CHARS: () => CONTEXT_KEEP_RECENT_CHARS,
38050
38226
  CONTEXT_KEEP_RECENT_MESSAGES: () => CONTEXT_KEEP_RECENT_MESSAGES,
@@ -38206,6 +38382,7 @@ __export(index_exports, {
38206
38382
  appendIndexedGitConfig: () => appendIndexedGitConfig,
38207
38383
  appendMessage: () => appendMessage,
38208
38384
  appendQueuedItem: () => appendQueuedItem,
38385
+ appleScriptString: () => appleScriptString,
38209
38386
  applyAgentEvent: () => applyAgentEvent,
38210
38387
  applyAgentRunnerHeapEnv: () => applyAgentRunnerHeapEnv,
38211
38388
  applyAppEnvironment: () => applyAppEnvironment,
@@ -38271,6 +38448,8 @@ __export(index_exports, {
38271
38448
  canonicalizeRepoPath: () => canonicalizeRepoPath,
38272
38449
  captureLoginEnv: () => captureLoginEnv,
38273
38450
  captureTurnBaseline: () => captureTurnBaseline,
38451
+ cgModifierFlags: () => cgModifierFlags,
38452
+ cgScrollWheels: () => cgScrollWheels,
38274
38453
  chatLinkUrl: () => chatLinkUrl,
38275
38454
  chatTextScale: () => chatTextScale,
38276
38455
  checkoutPrStackLayer: () => checkoutPrStackLayer,
@@ -38314,6 +38493,7 @@ __export(index_exports, {
38314
38493
  compactPartsForSummaryMessage: () => compactPartsForSummaryMessage,
38315
38494
  compactSummaryPart: () => compactSummaryPart,
38316
38495
  computeNextRunAt: () => computeNextRunAt,
38496
+ computerUseBridgePath: () => computerUseBridgePath,
38317
38497
  computerUseEnabled: () => computerUseEnabled,
38318
38498
  conductorBundledBinDir: () => conductorBundledBinDir,
38319
38499
  conductorDbPath: () => conductorDbPath,
@@ -38421,6 +38601,7 @@ __export(index_exports, {
38421
38601
  extractPresentedPlan: () => extractPresentedPlan,
38422
38602
  extractiveSummary: () => extractiveSummary,
38423
38603
  fastForwardMainCheckoutIfSafe: () => fastForwardMainCheckoutIfSafe,
38604
+ fetchComputerUseScreenshot: () => fetchComputerUseScreenshot,
38424
38605
  fetchOriginForWorktree: () => fetchOriginForWorktree,
38425
38606
  fetchPrHead: () => fetchPrHead,
38426
38607
  finalizeParts: () => finalizeParts,
@@ -38460,6 +38641,7 @@ __export(index_exports, {
38460
38641
  formatClaudeUsageResetClock: () => formatClaudeUsageResetClock,
38461
38642
  formatClaudeUsageTooltip: () => formatClaudeUsageTooltip,
38462
38643
  formatCloudTurnReply: () => formatCloudTurnReply,
38644
+ formatComputerUseHint: () => formatComputerUseHint,
38463
38645
  formatConnectedOrchestratorReminder: () => formatConnectedOrchestratorReminder,
38464
38646
  formatCursorGitDirective: () => formatCursorGitDirective,
38465
38647
  formatDetachedJobInvoke: () => formatDetachedJobInvoke,
@@ -38776,6 +38958,8 @@ __export(index_exports, {
38776
38958
  looksLikeIncompleteSkillDump: () => looksLikeIncompleteSkillDump,
38777
38959
  looksLikeSkillBody: () => looksLikeSkillBody,
38778
38960
  lookupSoccerTeam: () => lookupSoccerTeam,
38961
+ macKeyCode: () => macKeyCode,
38962
+ macosComputerUseRunner: () => macosComputerUseRunner,
38779
38963
  managedAccountConfigDir: () => managedAccountConfigDir,
38780
38964
  mapAbleTimeTask: () => mapAbleTimeTask,
38781
38965
  markPrReady: () => markPrReady,
@@ -38804,6 +38988,8 @@ __export(index_exports, {
38804
38988
  messagesSinceLastBrightsyContextSummary: () => messagesSinceLastBrightsyContextSummary,
38805
38989
  messagesWithRewrittenUserPrompt: () => messagesWithRewrittenUserPrompt,
38806
38990
  mirrorHostConfig: () => mirrorHostConfig,
38991
+ modifierClause: () => modifierClause,
38992
+ modifierKeyCode: () => modifierKeyCode,
38807
38993
  moveQueuedItemToFront: () => moveQueuedItemToFront,
38808
38994
  needsCoordinatorAction: () => needsCoordinatorAction,
38809
38995
  nextManagedAccount: () => nextManagedAccount,
@@ -38853,6 +39039,7 @@ __export(index_exports, {
38853
39039
  parseAbleTimeOAuthCallbackUrl: () => parseAbleTimeOAuthCallbackUrl,
38854
39040
  parseChatLink: () => parseChatLink,
38855
39041
  parseClaudeUsagePayload: () => parseClaudeUsagePayload,
39042
+ parseComputerUseInput: () => parseComputerUseInput,
38856
39043
  parseCursorRunnerLine: () => parseCursorRunnerLine,
38857
39044
  parseDevPreview: () => parseDevPreview,
38858
39045
  parseDurationMs: () => parseDurationMs,
@@ -38877,6 +39064,7 @@ __export(index_exports, {
38877
39064
  patchReadAloudSettings: () => patchReadAloudSettings,
38878
39065
  pendingInjectedNotices: () => pendingInjectedNotices,
38879
39066
  pendingSlackExternalReplies: () => pendingSlackExternalReplies,
39067
+ performComputerUse: () => performComputerUse,
38880
39068
  permissionMode: () => permissionMode,
38881
39069
  persistPendingFileAttachments: () => persistPendingFileAttachments,
38882
39070
  persistVaultKeyInKeychain: () => persistVaultKeyInKeychain,
@@ -38885,9 +39073,12 @@ __export(index_exports, {
38885
39073
  planHistoryRetention: () => planHistoryRetention,
38886
39074
  planModeTurnInstruction: () => planModeTurnInstruction,
38887
39075
  planQuestionsSignature: () => planQuestionsSignature,
39076
+ pngPointSize: () => pngPointSize,
38888
39077
  pnpmFilterPackage: () => pnpmFilterPackage,
39078
+ pointGeometry: () => pointGeometry,
38889
39079
  pollSlackOutboundWatches: () => pollSlackOutboundWatches,
38890
39080
  posixShellSingleQuote: () => posixShellSingleQuote,
39081
+ postComputerUseBridge: () => postComputerUseBridge,
38891
39082
  posthogOAuthAuthorizeUrl: () => posthogOAuthAuthorizeUrl,
38892
39083
  posthogOAuthClientId: () => posthogOAuthClientId,
38893
39084
  posthogOAuthScopeParam: () => posthogOAuthScopeParam,
@@ -38901,6 +39092,7 @@ __export(index_exports, {
38901
39092
  pushBranch: () => pushBranch,
38902
39093
  readAgentDoneCustomSound: () => readAgentDoneCustomSound,
38903
39094
  readAgentRuntimeMetadata: () => readAgentRuntimeMetadata,
39095
+ readComputerUseBridge: () => readComputerUseBridge,
38904
39096
  readExistingReviewRequestFile: () => readExistingReviewRequestFile,
38905
39097
  readKeychainVaultKey: () => readKeychainVaultKey,
38906
39098
  readPlanFile: () => readPlanFile,
@@ -39025,6 +39217,7 @@ __export(index_exports, {
39025
39217
  saveWorktreeRunPorts: () => saveWorktreeRunPorts,
39026
39218
  scheduleNeedsCaffeinate: () => scheduleNeedsCaffeinate,
39027
39219
  schedulesPath: () => schedulesPath,
39220
+ scrollWheelSwift: () => scrollWheelSwift,
39028
39221
  scrubGithubTokensFromChildEnv: () => scrubGithubTokensFromChildEnv,
39029
39222
  searchAbleTimeTasks: () => searchAbleTimeTasks,
39030
39223
  secureFileUnlocksWith: () => secureFileUnlocksWith,
@@ -39138,6 +39331,7 @@ __export(index_exports, {
39138
39331
  tryReservePorts: () => tryReservePorts,
39139
39332
  turnCostUsdFromCursorUsage: () => turnCostUsdFromCursorUsage,
39140
39333
  turnCostUsdFromProviderSnapshot: () => turnCostUsdFromProviderSnapshot,
39334
+ typeScripts: () => typeScripts,
39141
39335
  updateAbleTimeTask: () => updateAbleTimeTask,
39142
39336
  updateAdvancedSettings: () => updateAdvancedSettings,
39143
39337
  updateAgentExecutable: () => updateAgentExecutable,
@@ -42484,8 +42678,8 @@ init_message_parts();
42484
42678
  init_turn_live();
42485
42679
 
42486
42680
  // src/remote/phone-media.ts
42487
- var import_node_fs77 = require("fs");
42488
- var import_node_path75 = require("path");
42681
+ var import_node_fs78 = require("fs");
42682
+ var import_node_path76 = require("path");
42489
42683
  init_diff();
42490
42684
  var PHONE_IMAGE_MAX_BYTES = 15e5;
42491
42685
  var PHONE_TEXT_MAX_BYTES = 18e4;
@@ -42538,7 +42732,7 @@ function phoneImageDataUrl(worktreePath, raw) {
42538
42732
  }
42539
42733
  function phoneDirectoryListing(worktreePath, relative2) {
42540
42734
  try {
42541
- const entries = (0, import_node_fs77.readdirSync)((0, import_node_path75.join)(worktreePath, relative2), { withFileTypes: true });
42735
+ const entries = (0, import_node_fs78.readdirSync)((0, import_node_path76.join)(worktreePath, relative2), { withFileTypes: true });
42542
42736
  const dirs = new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
42543
42737
  const names = entries.map((entry) => entry.name).filter((name) => name && !name.includes("/") && !name.includes("\0")).sort((a, b) => a.localeCompare(b));
42544
42738
  const shown = names.slice(0, PHONE_DIR_MAX);
@@ -42564,7 +42758,7 @@ function phoneFilePreview(worktreePath, relative2, kind) {
42564
42758
  }
42565
42759
  if (relative2.toLowerCase().endsWith(".svg")) {
42566
42760
  try {
42567
- const buf = (0, import_node_fs77.readFileSync)((0, import_node_path75.join)(worktreePath, relative2));
42761
+ const buf = (0, import_node_fs78.readFileSync)((0, import_node_path76.join)(worktreePath, relative2));
42568
42762
  const truncated = buf.length > PHONE_TEXT_MAX_BYTES;
42569
42763
  return {
42570
42764
  content: buf.subarray(0, PHONE_TEXT_MAX_BYTES).toString("utf8"),
@@ -44115,7 +44309,7 @@ function handleRemoteInbound(text8, opts) {
44115
44309
  }
44116
44310
 
44117
44311
  // src/remote/phone-board-sync.ts
44118
- var import_node_path76 = require("path");
44312
+ var import_node_path77 = require("path");
44119
44313
  var import_chokidar = require("chokidar");
44120
44314
  init_orchestrator();
44121
44315
  init_paths();
@@ -44172,7 +44366,7 @@ function subscribePhoneBoard(notify) {
44172
44366
  threads.on("error", () => void 0);
44173
44367
  const data = (0, import_chokidar.watch)(appDataDir(), { ignoreInitial: true, depth: 0 });
44174
44368
  const onData = (changed) => {
44175
- const name = (0, import_node_path76.basename)(changed);
44369
+ const name = (0, import_node_path77.basename)(changed);
44176
44370
  if (name !== "workspaces.json" && name !== "removed-workspaces.json" && name !== "settings.json") return;
44177
44371
  notify();
44178
44372
  };
@@ -45255,11 +45449,11 @@ function clientIdFromOAuthState(state) {
45255
45449
  init_app_settings();
45256
45450
 
45257
45451
  // src/slack/workspaces.ts
45258
- var import_node_path77 = require("path");
45452
+ var import_node_path78 = require("path");
45259
45453
  init_paths();
45260
45454
  init_secure_file();
45261
45455
  function storePath2() {
45262
- return (0, import_node_path77.join)(appDataDir(), "slack-workspaces.json");
45456
+ return (0, import_node_path78.join)(appDataDir(), "slack-workspaces.json");
45263
45457
  }
45264
45458
  function readStore2() {
45265
45459
  try {
@@ -45805,15 +45999,15 @@ function sendJson(res, status, body) {
45805
45999
 
45806
46000
  // src/relay/slack-apps.ts
45807
46001
  var import_node_crypto28 = require("crypto");
45808
- var import_node_fs78 = require("fs");
46002
+ var import_node_fs79 = require("fs");
45809
46003
  var import_node_module8 = require("module");
45810
- var import_node_path78 = require("path");
46004
+ var import_node_path79 = require("path");
45811
46005
  var SlackAppStore = class {
45812
46006
  db;
45813
46007
  key;
45814
46008
  constructor(filePath, key) {
45815
46009
  if (key.length !== 32) throw new Error("Slack token key must be 32 bytes");
45816
- (0, import_node_fs78.mkdirSync)((0, import_node_path78.dirname)(filePath), { recursive: true });
46010
+ (0, import_node_fs79.mkdirSync)((0, import_node_path79.dirname)(filePath), { recursive: true });
45817
46011
  this.key = key;
45818
46012
  this.db = openDatabase(filePath);
45819
46013
  this.db.exec(`
@@ -45974,7 +46168,7 @@ function sameHash(stored, presented) {
45974
46168
  }
45975
46169
  function thisModuleFile3() {
45976
46170
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
45977
- return cjsFile || process.argv[1] || (0, import_node_path78.join)(process.cwd(), "package.json");
46171
+ return cjsFile || process.argv[1] || (0, import_node_path79.join)(process.cwd(), "package.json");
45978
46172
  }
45979
46173
  function openDatabase(filePath) {
45980
46174
  const req = (0, import_node_module8.createRequire)(thisModuleFile3());
@@ -45986,9 +46180,9 @@ function openDatabase(filePath) {
45986
46180
 
45987
46181
  // src/relay/slack-grants.ts
45988
46182
  var import_node_crypto30 = require("crypto");
45989
- var import_node_fs79 = require("fs");
46183
+ var import_node_fs80 = require("fs");
45990
46184
  var import_node_module9 = require("module");
45991
- var import_node_path79 = require("path");
46185
+ var import_node_path80 = require("path");
45992
46186
 
45993
46187
  // src/slack/listen-grant.ts
45994
46188
  var import_node_crypto29 = require("crypto");
@@ -46028,7 +46222,7 @@ function hashListenGrant(grant) {
46028
46222
  var SlackListenGrantStore = class {
46029
46223
  db;
46030
46224
  constructor(filePath) {
46031
- (0, import_node_fs79.mkdirSync)((0, import_node_path79.dirname)(filePath), { recursive: true });
46225
+ (0, import_node_fs80.mkdirSync)((0, import_node_path80.dirname)(filePath), { recursive: true });
46032
46226
  this.db = openDatabase2(filePath);
46033
46227
  this.db.exec(`
46034
46228
  CREATE TABLE IF NOT EXISTS slack_listen_grants (
@@ -46071,7 +46265,7 @@ var SlackListenGrantStore = class {
46071
46265
  };
46072
46266
  function thisModuleFile4() {
46073
46267
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
46074
- return cjsFile || process.argv[1] || (0, import_node_path79.join)(process.cwd(), "package.json");
46268
+ return cjsFile || process.argv[1] || (0, import_node_path80.join)(process.cwd(), "package.json");
46075
46269
  }
46076
46270
  function openDatabase2(filePath) {
46077
46271
  const req = (0, import_node_module9.createRequire)(thisModuleFile4());
@@ -46597,9 +46791,9 @@ var SlackRelayHub = class {
46597
46791
  };
46598
46792
 
46599
46793
  // src/relay/static.ts
46600
- var import_node_fs80 = require("fs");
46794
+ var import_node_fs81 = require("fs");
46601
46795
  var import_promises = require("fs/promises");
46602
- var import_node_path80 = __toESM(require("path"), 1);
46796
+ var import_node_path81 = __toESM(require("path"), 1);
46603
46797
  var TYPES = {
46604
46798
  ".css": "text/css; charset=utf-8",
46605
46799
  ".html": "text/html; charset=utf-8",
@@ -46659,7 +46853,7 @@ async function directorySlashLocation(root, requestUrl) {
46659
46853
  const candidate = resolveStaticPath(root, requestUrl);
46660
46854
  if (!candidate) return null;
46661
46855
  if (await fileSize(candidate) != null) return null;
46662
- if (await fileSize(import_node_path80.default.join(candidate, "index.html")) == null) return null;
46856
+ if (await fileSize(import_node_path81.default.join(candidate, "index.html")) == null) return null;
46663
46857
  return `${url.pathname}/${url.search}`;
46664
46858
  }
46665
46859
  function resolveStaticPath(root, requestUrl) {
@@ -46670,9 +46864,9 @@ function resolveStaticPath(root, requestUrl) {
46670
46864
  return null;
46671
46865
  }
46672
46866
  if (!pathname.startsWith("/") || pathname.includes("\0")) return null;
46673
- const rootResolved = import_node_path80.default.resolve(root);
46674
- const candidate = import_node_path80.default.resolve(rootResolved, `.${pathname}`);
46675
- if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path80.default.sep)) {
46867
+ const rootResolved = import_node_path81.default.resolve(root);
46868
+ const candidate = import_node_path81.default.resolve(rootResolved, `.${pathname}`);
46869
+ if (candidate !== rootResolved && !candidate.startsWith(rootResolved + import_node_path81.default.sep)) {
46676
46870
  return null;
46677
46871
  }
46678
46872
  return candidate;
@@ -46686,7 +46880,7 @@ async function fileSize(file) {
46686
46880
  }
46687
46881
  }
46688
46882
  function sendFile(req, res, file, size) {
46689
- const ext = import_node_path80.default.extname(file).toLowerCase();
46883
+ const ext = import_node_path81.default.extname(file).toLowerCase();
46690
46884
  res.writeHead(200, {
46691
46885
  "Content-Type": TYPES[ext] ?? "application/octet-stream",
46692
46886
  "Content-Length": size,
@@ -46696,7 +46890,7 @@ function sendFile(req, res, file, size) {
46696
46890
  res.end();
46697
46891
  return true;
46698
46892
  }
46699
- (0, import_node_fs80.createReadStream)(file).pipe(res);
46893
+ (0, import_node_fs81.createReadStream)(file).pipe(res);
46700
46894
  return true;
46701
46895
  }
46702
46896
  async function serveMarketingSite(req, res, opts) {
@@ -46734,7 +46928,7 @@ async function tryServeStatic(req, res, root) {
46734
46928
  if (!candidate) return false;
46735
46929
  const direct = await fileSize(candidate);
46736
46930
  if (direct != null) return sendFile(req, res, candidate, direct);
46737
- const asIndex = import_node_path80.default.join(candidate, "index.html");
46931
+ const asIndex = import_node_path81.default.join(candidate, "index.html");
46738
46932
  const indexSize = await fileSize(asIndex);
46739
46933
  if (indexSize != null) return sendFile(req, res, asIndex, indexSize);
46740
46934
  return false;
@@ -47160,15 +47354,15 @@ init_protocol();
47160
47354
 
47161
47355
  // src/relay/accounts.ts
47162
47356
  var import_node_crypto33 = require("crypto");
47163
- var import_node_fs81 = require("fs");
47357
+ var import_node_fs82 = require("fs");
47164
47358
  var import_node_module10 = require("module");
47165
- var import_node_path81 = require("path");
47359
+ var import_node_path82 = require("path");
47166
47360
  var GITHUB_ACCOUNT_ISSUER = "https://github.com";
47167
47361
  var CURSOR_ACCOUNT_ISSUER = "https://api.cursor.com/v1/origin";
47168
47362
  var RELAY_DEVICE_CAP = 3;
47169
47363
  function thisModuleFile5() {
47170
47364
  const cjsFile = typeof __filename !== "undefined" ? __filename : "";
47171
- return cjsFile || process.argv[1] || (0, import_node_path81.join)(process.cwd(), "package.json");
47365
+ return cjsFile || process.argv[1] || (0, import_node_path82.join)(process.cwd(), "package.json");
47172
47366
  }
47173
47367
  function openDatabase3(filePath) {
47174
47368
  const req = (0, import_node_module10.createRequire)(thisModuleFile5());
@@ -47205,8 +47399,8 @@ function assertRelayAccountsDurable(filePath) {
47205
47399
  if (process.env.SIDEBOARD_RELAY_ACCOUNTS_EPHEMERAL === "1") return;
47206
47400
  if (process.env.NODE_ENV !== "production") return;
47207
47401
  if (process.platform !== "linux") return;
47208
- const dir = (0, import_node_fs81.realpathSync)((0, import_node_path81.dirname)(filePath));
47209
- const mounts = (0, import_node_fs81.readFileSync)("/proc/mounts", "utf8");
47402
+ const dir = (0, import_node_fs82.realpathSync)((0, import_node_path82.dirname)(filePath));
47403
+ const mounts = (0, import_node_fs82.readFileSync)("/proc/mounts", "utf8");
47210
47404
  const point2 = longestMountPoint(dir, mounts);
47211
47405
  if (point2 === "/") {
47212
47406
  throw new Error(
@@ -47217,7 +47411,7 @@ function assertRelayAccountsDurable(filePath) {
47217
47411
  var RelayAccountStore = class {
47218
47412
  db;
47219
47413
  constructor(filePath) {
47220
- (0, import_node_fs81.mkdirSync)((0, import_node_path81.dirname)(filePath), { recursive: true });
47414
+ (0, import_node_fs82.mkdirSync)((0, import_node_path82.dirname)(filePath), { recursive: true });
47221
47415
  this.db = openDatabase3(filePath);
47222
47416
  this.db.exec(`
47223
47417
  CREATE TABLE IF NOT EXISTS accounts (
@@ -49095,22 +49289,22 @@ init_error_detail();
49095
49289
  init_cursor_stream_cutoff();
49096
49290
 
49097
49291
  // src/agents/tool-result-clip.ts
49098
- var import_node_fs82 = require("fs");
49099
- var import_node_path82 = require("path");
49292
+ var import_node_fs83 = require("fs");
49293
+ var import_node_path83 = require("path");
49100
49294
  init_workspace_scratch();
49101
49295
  init_error_detail();
49102
49296
  function spillPath(cwd, prefix) {
49103
49297
  const stamp = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
49104
49298
  const safe = prefix.replace(/[^a-zA-Z0-9_-]+/g, "-").slice(0, 40) || "tool";
49105
- return (0, import_node_path82.join)(cwd, CLI_DIR, `${safe}-${stamp}.txt`);
49299
+ return (0, import_node_path83.join)(cwd, CLI_DIR, `${safe}-${stamp}.txt`);
49106
49300
  }
49107
49301
  function spillToolResultToCli(content, opts) {
49108
49302
  const cwd = opts?.cwd?.trim();
49109
49303
  if (!cwd || !content) return null;
49110
49304
  const file = spillPath(cwd, opts?.prefix ?? "tool-result");
49111
49305
  try {
49112
- (0, import_node_fs82.mkdirSync)((0, import_node_path82.join)(cwd, CLI_DIR), { recursive: true });
49113
- (0, import_node_fs82.writeFileSync)(file, content, "utf8");
49306
+ (0, import_node_fs83.mkdirSync)((0, import_node_path83.join)(cwd, CLI_DIR), { recursive: true });
49307
+ (0, import_node_fs83.writeFileSync)(file, content, "utf8");
49114
49308
  return file;
49115
49309
  } catch {
49116
49310
  return null;
@@ -49197,7 +49391,7 @@ function createClippedMcpServer() {
49197
49391
  // src/mcp/server.ts
49198
49392
  var import_zod14 = require("zod");
49199
49393
  var import_node_crypto40 = require("crypto");
49200
- var import_node_path86 = require("path");
49394
+ var import_node_path87 = require("path");
49201
49395
  init_orchestrator();
49202
49396
  init_task_state();
49203
49397
  init_worktree();
@@ -51310,7 +51504,7 @@ function registerOrderTools(server) {
51310
51504
 
51311
51505
  // src/agent-rpc/handlers.ts
51312
51506
  var import_node_crypto38 = require("crypto");
51313
- var import_node_path83 = require("path");
51507
+ var import_node_path84 = require("path");
51314
51508
  init_wait_for_job();
51315
51509
  init_wait_for_turn();
51316
51510
  init_computer_use();
@@ -51419,7 +51613,7 @@ function invalidParams2(message) {
51419
51613
  function jobCwd(rec) {
51420
51614
  const raw = str7(rec.cwd).trim();
51421
51615
  if (!raw) throw invalidParams2("cwd is required");
51422
- if (!(0, import_node_path83.isAbsolute)(raw)) throw invalidParams2("cwd must be an absolute path");
51616
+ if (!(0, import_node_path84.isAbsolute)(raw)) throw invalidParams2("cwd must be an absolute path");
51423
51617
  return raw;
51424
51618
  }
51425
51619
  async function handleRuntimePing(_params, _ctx) {
@@ -51564,27 +51758,27 @@ init_gh_errors();
51564
51758
  init_git_auth_mode();
51565
51759
 
51566
51760
  // src/board/load-home-board.ts
51567
- var import_node_fs84 = require("fs");
51568
- var import_node_path85 = require("path");
51761
+ var import_node_fs85 = require("fs");
51762
+ var import_node_path86 = require("path");
51569
51763
  init_worktree();
51570
51764
  init_paths();
51571
51765
 
51572
51766
  // src/board/board-pins.ts
51573
51767
  var import_node_crypto39 = require("crypto");
51574
- var import_node_fs83 = require("fs");
51575
- var import_node_path84 = require("path");
51768
+ var import_node_fs84 = require("fs");
51769
+ var import_node_path85 = require("path");
51576
51770
  init_paths();
51577
51771
  init_home_board();
51578
51772
  var FILE = "home-board-pins.json";
51579
51773
  var VERSION2 = 1;
51580
51774
  function pinsFile() {
51581
- return (0, import_node_path84.join)(appDataDir(), FILE);
51775
+ return (0, import_node_path85.join)(appDataDir(), FILE);
51582
51776
  }
51583
51777
  function readDisk() {
51584
51778
  const path2 = pinsFile();
51585
- if (!(0, import_node_fs83.existsSync)(path2)) return [];
51779
+ if (!(0, import_node_fs84.existsSync)(path2)) return [];
51586
51780
  try {
51587
- const raw = JSON.parse((0, import_node_fs83.readFileSync)(path2, "utf8"));
51781
+ const raw = JSON.parse((0, import_node_fs84.readFileSync)(path2, "utf8"));
51588
51782
  if (raw?.version !== VERSION2 || !Array.isArray(raw.items)) return [];
51589
51783
  return raw.items.filter((item) => item?.id && item.kind && item.ref);
51590
51784
  } catch {
@@ -51592,8 +51786,8 @@ function readDisk() {
51592
51786
  }
51593
51787
  }
51594
51788
  function writeDisk(items) {
51595
- (0, import_node_fs83.mkdirSync)(appDataDir(), { recursive: true });
51596
- (0, import_node_fs83.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION2, items }, null, 2), "utf8");
51789
+ (0, import_node_fs84.mkdirSync)(appDataDir(), { recursive: true });
51790
+ (0, import_node_fs84.writeFileSync)(pinsFile(), JSON.stringify({ version: VERSION2, items }, null, 2), "utf8");
51597
51791
  }
51598
51792
  function listBoardPins() {
51599
51793
  return readDisk();
@@ -51645,7 +51839,7 @@ function replaceBoardPins(items) {
51645
51839
  }
51646
51840
  function clearBoardPins() {
51647
51841
  try {
51648
- (0, import_node_fs83.unlinkSync)(pinsFile());
51842
+ (0, import_node_fs84.unlinkSync)(pinsFile());
51649
51843
  } catch {
51650
51844
  }
51651
51845
  }
@@ -51662,7 +51856,7 @@ function homeBoardWorkspaceKey(workspaces) {
51662
51856
  return workspaces.map((w) => w.path).filter(Boolean).sort().join("\n");
51663
51857
  }
51664
51858
  function cacheFile() {
51665
- return (0, import_node_path85.join)(appDataDir(), "home-board-cache.json");
51859
+ return (0, import_node_path86.join)(appDataDir(), "home-board-cache.json");
51666
51860
  }
51667
51861
  function emptyInputs() {
51668
51862
  return {
@@ -51688,9 +51882,9 @@ function shouldCacheHomeBoardInputs(inputs) {
51688
51882
  }
51689
51883
  function readDiskCache() {
51690
51884
  const path2 = cacheFile();
51691
- if (!(0, import_node_fs84.existsSync)(path2)) return null;
51885
+ if (!(0, import_node_fs85.existsSync)(path2)) return null;
51692
51886
  try {
51693
- const raw = JSON.parse((0, import_node_fs84.readFileSync)(path2, "utf8"));
51887
+ const raw = JSON.parse((0, import_node_fs85.readFileSync)(path2, "utf8"));
51694
51888
  if (raw?.version !== CACHE_VERSION || typeof raw.fetchedAt !== "number") {
51695
51889
  return null;
51696
51890
  }
@@ -51704,14 +51898,14 @@ function readDiskCache() {
51704
51898
  }
51705
51899
  function writeDiskCache(entry) {
51706
51900
  try {
51707
- (0, import_node_fs84.mkdirSync)(appDataDir(), { recursive: true });
51708
- (0, import_node_fs84.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
51901
+ (0, import_node_fs85.mkdirSync)(appDataDir(), { recursive: true });
51902
+ (0, import_node_fs85.writeFileSync)(cacheFile(), JSON.stringify(entry), "utf8");
51709
51903
  } catch {
51710
51904
  }
51711
51905
  }
51712
51906
  function deleteDiskCache() {
51713
51907
  try {
51714
- (0, import_node_fs84.unlinkSync)(cacheFile());
51908
+ (0, import_node_fs85.unlinkSync)(cacheFile());
51715
51909
  } catch {
51716
51910
  }
51717
51911
  }
@@ -51927,7 +52121,7 @@ async function startMcpServer() {
51927
52121
  async () => {
51928
52122
  const threads = orch.getThreads();
51929
52123
  const lines = threads.map((t) => {
51930
- const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0, import_node_path86.basename)(t.repoPath) || t.repoPath;
52124
+ const repo = t.repoPath === GLOBAL_WORKSPACE_ID2 ? "Orchestration" : (0, import_node_path87.basename)(t.repoPath) || t.repoPath;
51931
52125
  const live = orch.threadLooksLive(t) ? readTurnLive(t.id) : null;
51932
52126
  const parent = t.parentThreadId ? ` parent:${t.parentThreadId.slice(0, 8)}` : "";
51933
52127
  const preview = lastMessagePreview(t.messages, 80);
@@ -54113,19 +54307,19 @@ init_turn_live();
54113
54307
  init_thread_store();
54114
54308
 
54115
54309
  // src/slack/reply-target.ts
54116
- var import_node_fs85 = require("fs");
54117
- var import_node_path87 = require("path");
54310
+ var import_node_fs86 = require("fs");
54311
+ var import_node_path88 = require("path");
54118
54312
  init_paths();
54119
54313
  init_private_file();
54120
54314
  init_secure_file();
54121
54315
  function storePath3() {
54122
- return (0, import_node_path87.join)(appDataDir(), "slack-reply-to.json");
54316
+ return (0, import_node_path88.join)(appDataDir(), "slack-reply-to.json");
54123
54317
  }
54124
54318
  function readStore3() {
54125
54319
  const path2 = storePath3();
54126
- if (!(0, import_node_fs85.existsSync)(path2)) return {};
54320
+ if (!(0, import_node_fs86.existsSync)(path2)) return {};
54127
54321
  try {
54128
- const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs85.readFileSync)(path2, "utf8"));
54322
+ const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs86.readFileSync)(path2, "utf8"));
54129
54323
  return parsed?.targets && typeof parsed.targets === "object" ? parsed.targets : {};
54130
54324
  } catch {
54131
54325
  return {};
@@ -54588,8 +54782,8 @@ function startSlackTurnProgress(msg, threadId, opts) {
54588
54782
  const summary = readTurnLive(threadId())?.summary ?? SLACK_PROGRESS_PLACEHOLDER;
54589
54783
  const body = formatSlackWorkingText(summary);
54590
54784
  try {
54591
- const posted = await postSlackText(target, signForThisMac(body), opts);
54592
- postedTs = posted?.ts ?? postedTs;
54785
+ const posted2 = await postSlackText(target, signForThisMac(body), opts);
54786
+ postedTs = posted2?.ts ?? postedTs;
54593
54787
  lastBody = body;
54594
54788
  if (postedTs && !stopped && !editTimer) {
54595
54789
  editTimer = setInterval(() => {
@@ -55128,8 +55322,8 @@ async function forgetRemoteAccountMac(opts) {
55128
55322
  }
55129
55323
 
55130
55324
  // src/slack/outbound-watch.ts
55131
- var import_node_fs86 = require("fs");
55132
- var import_node_path88 = require("path");
55325
+ var import_node_fs87 = require("fs");
55326
+ var import_node_path89 = require("path");
55133
55327
  init_paths();
55134
55328
  init_private_file();
55135
55329
  init_secure_file();
@@ -55142,7 +55336,7 @@ var POLL_INTERVAL_MS = 12e3;
55142
55336
  var lastPollMs = 0;
55143
55337
  var nameCache = /* @__PURE__ */ new Map();
55144
55338
  function storePath4() {
55145
- return (0, import_node_path88.join)(appDataDir(), "slack-outbound-watch.json");
55339
+ return (0, import_node_path89.join)(appDataDir(), "slack-outbound-watch.json");
55146
55340
  }
55147
55341
  function watchId(teamId, channelId, ts) {
55148
55342
  return `${teamId}:${channelId}:${ts}`;
@@ -55155,9 +55349,9 @@ function tsNewer(a, b) {
55155
55349
  }
55156
55350
  function readStore4() {
55157
55351
  const path2 = storePath4();
55158
- if (!(0, import_node_fs86.existsSync)(path2)) return [];
55352
+ if (!(0, import_node_fs87.existsSync)(path2)) return [];
55159
55353
  try {
55160
- const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs86.readFileSync)(path2, "utf8"));
55354
+ const parsed = isSecureFileEncrypted(path2) ? readSecureJson(path2) : JSON.parse((0, import_node_fs87.readFileSync)(path2, "utf8"));
55161
55355
  return Array.isArray(parsed?.watches) ? parsed.watches : [];
55162
55356
  } catch {
55163
55357
  return [];
@@ -55171,8 +55365,8 @@ function writeStore3(watches) {
55171
55365
  function pruneWatches(watches, nowMs = Date.now()) {
55172
55366
  const cutoff = nowMs - WATCH_TTL_MS;
55173
55367
  const kept = watches.filter((w) => {
55174
- const posted = Date.parse(w.postedAt);
55175
- return Number.isFinite(posted) ? posted >= cutoff : true;
55368
+ const posted2 = Date.parse(w.postedAt);
55369
+ return Number.isFinite(posted2) ? posted2 >= cutoff : true;
55176
55370
  });
55177
55371
  if (kept.length <= MAX_WATCHES) return kept;
55178
55372
  return kept.slice().sort((a, b) => b.postedAt.localeCompare(a.postedAt)).slice(0, MAX_WATCHES);
@@ -55467,6 +55661,10 @@ async function pollSlackOutboundWatches(opts) {
55467
55661
  }
55468
55662
  if (changed) writeStore3(watches);
55469
55663
  }
55664
+
55665
+ // src/index.ts
55666
+ init_bridge();
55667
+ init_computer_use();
55470
55668
  // Annotate the CommonJS export names for ESM import in node:
55471
55669
  0 && (module.exports = {
55472
55670
  ABLETIME_MCP_PATH,
@@ -55521,6 +55719,8 @@ async function pollSlackOutboundWatches(opts) {
55521
55719
  CLOUD_COORDINATOR_STOPPED_REPLY,
55522
55720
  CLOUD_COORDINATOR_TIMEOUT_REPLY,
55523
55721
  CLOUD_ORCHESTRATOR_GOAL,
55722
+ COMPUTER_USE_DESCRIPTION,
55723
+ COMPUTER_USE_OFF,
55524
55724
  CONTEXT_COMPACT_CHARS,
55525
55725
  CONTEXT_KEEP_RECENT_CHARS,
55526
55726
  CONTEXT_KEEP_RECENT_MESSAGES,
@@ -55682,6 +55882,7 @@ async function pollSlackOutboundWatches(opts) {
55682
55882
  appendIndexedGitConfig,
55683
55883
  appendMessage,
55684
55884
  appendQueuedItem,
55885
+ appleScriptString,
55685
55886
  applyAgentEvent,
55686
55887
  applyAgentRunnerHeapEnv,
55687
55888
  applyAppEnvironment,
@@ -55747,6 +55948,8 @@ async function pollSlackOutboundWatches(opts) {
55747
55948
  canonicalizeRepoPath,
55748
55949
  captureLoginEnv,
55749
55950
  captureTurnBaseline,
55951
+ cgModifierFlags,
55952
+ cgScrollWheels,
55750
55953
  chatLinkUrl,
55751
55954
  chatTextScale,
55752
55955
  checkoutPrStackLayer,
@@ -55790,6 +55993,7 @@ async function pollSlackOutboundWatches(opts) {
55790
55993
  compactPartsForSummaryMessage,
55791
55994
  compactSummaryPart,
55792
55995
  computeNextRunAt,
55996
+ computerUseBridgePath,
55793
55997
  computerUseEnabled,
55794
55998
  conductorBundledBinDir,
55795
55999
  conductorDbPath,
@@ -55897,6 +56101,7 @@ async function pollSlackOutboundWatches(opts) {
55897
56101
  extractPresentedPlan,
55898
56102
  extractiveSummary,
55899
56103
  fastForwardMainCheckoutIfSafe,
56104
+ fetchComputerUseScreenshot,
55900
56105
  fetchOriginForWorktree,
55901
56106
  fetchPrHead,
55902
56107
  finalizeParts,
@@ -55936,6 +56141,7 @@ async function pollSlackOutboundWatches(opts) {
55936
56141
  formatClaudeUsageResetClock,
55937
56142
  formatClaudeUsageTooltip,
55938
56143
  formatCloudTurnReply,
56144
+ formatComputerUseHint,
55939
56145
  formatConnectedOrchestratorReminder,
55940
56146
  formatCursorGitDirective,
55941
56147
  formatDetachedJobInvoke,
@@ -56252,6 +56458,8 @@ async function pollSlackOutboundWatches(opts) {
56252
56458
  looksLikeIncompleteSkillDump,
56253
56459
  looksLikeSkillBody,
56254
56460
  lookupSoccerTeam,
56461
+ macKeyCode,
56462
+ macosComputerUseRunner,
56255
56463
  managedAccountConfigDir,
56256
56464
  mapAbleTimeTask,
56257
56465
  markPrReady,
@@ -56280,6 +56488,8 @@ async function pollSlackOutboundWatches(opts) {
56280
56488
  messagesSinceLastBrightsyContextSummary,
56281
56489
  messagesWithRewrittenUserPrompt,
56282
56490
  mirrorHostConfig,
56491
+ modifierClause,
56492
+ modifierKeyCode,
56283
56493
  moveQueuedItemToFront,
56284
56494
  needsCoordinatorAction,
56285
56495
  nextManagedAccount,
@@ -56329,6 +56539,7 @@ async function pollSlackOutboundWatches(opts) {
56329
56539
  parseAbleTimeOAuthCallbackUrl,
56330
56540
  parseChatLink,
56331
56541
  parseClaudeUsagePayload,
56542
+ parseComputerUseInput,
56332
56543
  parseCursorRunnerLine,
56333
56544
  parseDevPreview,
56334
56545
  parseDurationMs,
@@ -56353,6 +56564,7 @@ async function pollSlackOutboundWatches(opts) {
56353
56564
  patchReadAloudSettings,
56354
56565
  pendingInjectedNotices,
56355
56566
  pendingSlackExternalReplies,
56567
+ performComputerUse,
56356
56568
  permissionMode,
56357
56569
  persistPendingFileAttachments,
56358
56570
  persistVaultKeyInKeychain,
@@ -56361,9 +56573,12 @@ async function pollSlackOutboundWatches(opts) {
56361
56573
  planHistoryRetention,
56362
56574
  planModeTurnInstruction,
56363
56575
  planQuestionsSignature,
56576
+ pngPointSize,
56364
56577
  pnpmFilterPackage,
56578
+ pointGeometry,
56365
56579
  pollSlackOutboundWatches,
56366
56580
  posixShellSingleQuote,
56581
+ postComputerUseBridge,
56367
56582
  posthogOAuthAuthorizeUrl,
56368
56583
  posthogOAuthClientId,
56369
56584
  posthogOAuthScopeParam,
@@ -56377,6 +56592,7 @@ async function pollSlackOutboundWatches(opts) {
56377
56592
  pushBranch,
56378
56593
  readAgentDoneCustomSound,
56379
56594
  readAgentRuntimeMetadata,
56595
+ readComputerUseBridge,
56380
56596
  readExistingReviewRequestFile,
56381
56597
  readKeychainVaultKey,
56382
56598
  readPlanFile,
@@ -56501,6 +56717,7 @@ async function pollSlackOutboundWatches(opts) {
56501
56717
  saveWorktreeRunPorts,
56502
56718
  scheduleNeedsCaffeinate,
56503
56719
  schedulesPath,
56720
+ scrollWheelSwift,
56504
56721
  scrubGithubTokensFromChildEnv,
56505
56722
  searchAbleTimeTasks,
56506
56723
  secureFileUnlocksWith,
@@ -56614,6 +56831,7 @@ async function pollSlackOutboundWatches(opts) {
56614
56831
  tryReservePorts,
56615
56832
  turnCostUsdFromCursorUsage,
56616
56833
  turnCostUsdFromProviderSnapshot,
56834
+ typeScripts,
56617
56835
  updateAbleTimeTask,
56618
56836
  updateAdvancedSettings,
56619
56837
  updateAgentExecutable,