@buoy-gg/mcp 7.0.31 → 7.0.32

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.
@@ -613,7 +613,7 @@ async function waitForBroker(url, attempts = 20) {
613
613
  var delay = (ms) => new Promise((r) => setTimeout(r, ms));
614
614
 
615
615
  // src/version.ts
616
- var VERSION = "7.0.31" ? "7.0.31" : "0.0.0-dev";
616
+ var VERSION = "7.0.32" ? "7.0.32" : "0.0.0-dev";
617
617
  var PACKAGE_NAME = "@buoy-gg/mcp";
618
618
 
619
619
  // src/update/checkForUpdate.ts
@@ -1350,7 +1350,7 @@ ${JSON.stringify(summary, null, 2)}
1350
1350
  let sawActive = false;
1351
1351
  let idleStreak = 0;
1352
1352
  let lastCount = -1;
1353
- let resolved = null;
1353
+ let resolved2 = null;
1354
1354
  while (Date.now() - start < cap3) {
1355
1355
  let snap2;
1356
1356
  try {
@@ -1362,7 +1362,7 @@ ${JSON.stringify(summary, null, 2)}
1362
1362
  const completed = snap2.live?.automationCompleted;
1363
1363
  if (completed?.phase === "cancelled") return fail2(`Batch ${completed.batchId} was cancelled.`);
1364
1364
  if (completed?.phase === "done") {
1365
- resolved = { batchId: completed.batchId, failures: completed.failures ?? failuresFromIndex(snap2.index, completed.batchId) };
1365
+ resolved2 = { batchId: completed.batchId, failures: completed.failures ?? failuresFromIndex(snap2.index, completed.batchId) };
1366
1366
  break;
1367
1367
  }
1368
1368
  const phase = snap2.live?.automation?.phase ?? "idle";
@@ -1372,11 +1372,11 @@ ${JSON.stringify(summary, null, 2)}
1372
1372
  const count = runCountFor(snap2.index, newest);
1373
1373
  if (count === lastCount) {
1374
1374
  if (sawActive && ++idleStreak >= 3) {
1375
- resolved = { batchId: newest, failures: failuresFromIndex(snap2.index, newest) };
1375
+ resolved2 = { batchId: newest, failures: failuresFromIndex(snap2.index, newest) };
1376
1376
  break;
1377
1377
  }
1378
1378
  if (!sawActive && Date.now() - start > 4e3) {
1379
- resolved = { batchId: newest, failures: failuresFromIndex(snap2.index, newest) };
1379
+ resolved2 = { batchId: newest, failures: failuresFromIndex(snap2.index, newest) };
1380
1380
  break;
1381
1381
  }
1382
1382
  } else {
@@ -1388,11 +1388,11 @@ ${JSON.stringify(summary, null, 2)}
1388
1388
  }
1389
1389
  await delay2(POLL_INTERVAL_MS);
1390
1390
  }
1391
- if (!resolved) return fail2("No automation batch completed within the wait window.");
1391
+ if (!resolved2) return fail2("No automation batch completed within the wait window.");
1392
1392
  await sync.callAction(PERF_TOOL_ID, "refreshIndex", {}, target).catch(() => {
1393
1393
  });
1394
1394
  const snap = await readPerfSnapshot(sync, target);
1395
- const ranking = rankBatchFromIndex(snap.index ?? [], resolved.batchId, void 0, resolved.failures);
1395
+ const ranking = rankBatchFromIndex(snap.index ?? [], resolved2.batchId, void 0, resolved2.failures);
1396
1396
  await sync.callAction(PERF_TOOL_ID, "acknowledgeAutomation", {}, target).catch(() => {
1397
1397
  });
1398
1398
  return text(`${formatRankingMarkdown(ranking)}
@@ -2359,9 +2359,9 @@ function reasonMessage(res, query) {
2359
2359
  return res.reason ? `Locate failed: ${res.reason}` : "Couldn't locate that component.";
2360
2360
  }
2361
2361
  }
2362
- function candidatesText(candidates) {
2363
- if (!candidates || candidates.length === 0) return "";
2364
- const lines = candidates.map((c) => {
2362
+ function candidatesText(candidates2) {
2363
+ if (!candidates2 || candidates2.length === 0) return "";
2364
+ const lines = candidates2.map((c) => {
2365
2365
  const id = c.testID || c.nativeID;
2366
2366
  return `- ${c.componentName || c.viewType}${id ? ` (${id})` : ""} \u2014 nativeTag ${c.nativeTag}, rendered \xD7${c.renderCount}`;
2367
2367
  });
@@ -2462,7 +2462,7 @@ function registerScreenshotTools(server, sync) {
2462
2462
 
2463
2463
  // src/server.ts
2464
2464
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2465
- import { z as z23 } from "zod";
2465
+ import { z as z24 } from "zod";
2466
2466
 
2467
2467
  // src/tools/packs/network.ts
2468
2468
  import { z as z12 } from "zod";
@@ -2567,8 +2567,8 @@ _${skipped} more withheld ${skipped === 1 ? "body was" : "bodies were"} not fetc
2567
2567
  }
2568
2568
  function bodyLines(e, fetched) {
2569
2569
  const got = e.id ? fetched.get(e.id) : void 0;
2570
- const label = (inline, resolved, omitted) => {
2571
- const value = inline ?? resolved;
2570
+ const label = (inline, resolved2, omitted) => {
2571
+ const value = inline ?? resolved2;
2572
2572
  if (value !== void 0 && value !== null) return truncate2(value);
2573
2573
  if (!omitted) return "(none)";
2574
2574
  return got?.unresolved ? "(withheld \u2014 the device did not answer getEventBody)" : "(none)";
@@ -3406,14 +3406,383 @@ It is INERT and cannot run yet. Ask the user to open Scenarios on the device, re
3406
3406
  );
3407
3407
  }
3408
3408
 
3409
- // src/tools/packs/interact.ts
3409
+ // src/tools/packs/camera.ts
3410
3410
  import { z as z15 } from "zod";
3411
- var TOOL_ID2 = "highlight-updates";
3411
+
3412
+ // src/capture/camera.ts
3413
+ import { execFile as execFile2 } from "child_process";
3414
+ import { promisify as promisify2 } from "util";
3415
+ import { existsSync, readFileSync } from "fs";
3416
+ import os3 from "os";
3417
+ import path3 from "path";
3418
+ var execFileAsync2 = promisify2(execFile2);
3419
+ function candidates() {
3420
+ const fromEnv = process.env.BUOY_SIMCAM_DIR;
3421
+ const list = [
3422
+ ...fromEnv ? [path3.join(fromEnv, "buoycam")] : [],
3423
+ "/Applications/Buoy.app/Contents/Resources/simcam/buoycam",
3424
+ path3.join(os3.homedir(), "Applications/Buoy.app/Contents/Resources/simcam/buoycam")
3425
+ ];
3426
+ let dir = __dirname;
3427
+ for (let i = 0; i < 8; i++) {
3428
+ list.push(path3.join(dir, "apps/desktop/resources/simcam/buoycam"));
3429
+ const parent = path3.dirname(dir);
3430
+ if (parent === dir) break;
3431
+ dir = parent;
3432
+ }
3433
+ return list;
3434
+ }
3435
+ var resolved = null;
3436
+ function cliPath() {
3437
+ if (resolved) return resolved;
3438
+ resolved = candidates().find((c) => existsSync(c)) ?? null;
3439
+ return resolved;
3440
+ }
3441
+ async function run(args) {
3442
+ const cli = cliPath();
3443
+ if (!cli) {
3444
+ return {
3445
+ ok: false,
3446
+ error: "The simulator camera components were not found. They ship with the Buoy desktop app \u2014 install it, or set BUOY_SIMCAM_DIR to the directory holding `buoycam`."
3447
+ };
3448
+ }
3449
+ try {
3450
+ const { stdout } = await execFileAsync2(cli, [...args, "--json"], { timeout: 3e4 });
3451
+ return { ok: true, data: JSON.parse(stdout) };
3452
+ } catch (err) {
3453
+ const stdout = err.stdout ?? "";
3454
+ try {
3455
+ return { ok: false, data: JSON.parse(stdout) };
3456
+ } catch {
3457
+ return {
3458
+ ok: false,
3459
+ error: err.message || "the simulator camera CLI failed"
3460
+ };
3461
+ }
3462
+ }
3463
+ }
3464
+ function describeDiagnosis(checks) {
3465
+ const failed = checks.filter((c) => c.level === "fail");
3466
+ const warned = checks.filter((c) => c.level === "warn");
3467
+ if (failed.length === 0 && warned.length === 0) {
3468
+ return "The simulator camera is healthy \u2014 every check passed.";
3469
+ }
3470
+ const lines = [];
3471
+ for (const c of [...failed, ...warned]) {
3472
+ lines.push(`- **${c.name}** (${c.level}): ${c.detail}`);
3473
+ if (c.fix) lines.push(` ${c.fix}`);
3474
+ }
3475
+ const headline = failed.length > 0 ? `${failed.length} problem${failed.length === 1 ? "" : "s"} found.` : `No hard failures, but ${warned.length} thing${warned.length === 1 ? "" : "s"} worth knowing.`;
3476
+ return [headline, "", ...lines].join("\n");
3477
+ }
3478
+ function describeDevices(devices, apps) {
3479
+ if (devices.length === 0) {
3480
+ return "No booted simulators.\n\n_Boot one first \u2014 `xcrun simctl boot <udid>`, or open Simulator.app. The camera attaches to a simulator, so nothing else here works until one is running._";
3481
+ }
3482
+ const lines = [
3483
+ devices.length === 1 ? "1 booted simulator:" : `${devices.length} booted simulators:`,
3484
+ ...devices.map((d) => `- **${d.name}** (${d.runtime}) \u2014 \`${d.udid}\``)
3485
+ ];
3486
+ if (devices.length > 1 && apps === null) {
3487
+ lines.push(
3488
+ "",
3489
+ "_More than one is booted, so pass `udid` to list a specific one's apps \u2014 and to every other camera tool that takes one._"
3490
+ );
3491
+ return lines.join("\n");
3492
+ }
3493
+ if (apps === null) {
3494
+ lines.push("", "_Could not read the installed apps._");
3495
+ return lines.join("\n");
3496
+ }
3497
+ if (apps.length === 0) {
3498
+ lines.push("", "No apps installed on it.");
3499
+ return lines.join("\n");
3500
+ }
3501
+ lines.push(
3502
+ "",
3503
+ `${apps.length} installed app${apps.length === 1 ? "" : "s"}:`,
3504
+ ...apps.map((a) => `- ${a.name} \u2014 \`${a.bundleId}\``),
3505
+ "",
3506
+ "_Pass one of these bundle ids to `camera_launch` to relaunch it with the camera attached._"
3507
+ );
3508
+ return lines.join("\n");
3509
+ }
3510
+ function describeInputs(cameras, windows) {
3511
+ const lines = [];
3512
+ lines.push(cameras.length ? '**Mac cameras** (for `kind: "camera"`):' : "**Mac cameras**: none found.");
3513
+ if (cameras.length) {
3514
+ lines.push(...cameras.map((c) => `- ${c.name} \u2014 \`${c.uniqueId}\``));
3515
+ } else {
3516
+ lines.push(
3517
+ "_If this Mac has a webcam, Buoy has not been granted Camera permission (System Settings \u2192 Privacy & Security \u2192 Camera)._"
3518
+ );
3519
+ }
3520
+ lines.push("");
3521
+ lines.push(
3522
+ windows.length ? '**Capturable windows** (for `kind: "screen"`, `value: "window:<id>"`):' : "**Capturable windows**: none found."
3523
+ );
3524
+ if (windows.length) {
3525
+ lines.push(
3526
+ ...windows.map((w) => `- ${w.app}${w.title ? ` \u2014 ${w.title}` : ""} \u2014 \`window:${w.id}\``)
3527
+ );
3528
+ } else {
3529
+ lines.push(
3530
+ "_Screen Recording permission is almost certainly missing (System Settings \u2192 Privacy & Security \u2192 Screen & System Audio Recording)._"
3531
+ );
3532
+ }
3533
+ return lines.join("\n");
3534
+ }
3535
+ function entitlementPaths() {
3536
+ const fromEnv = process.env.BUOY_ENTITLEMENT_FILE;
3537
+ if (fromEnv) return [fromEnv];
3538
+ return [
3539
+ path3.join(os3.homedir(), "Library/Application Support/Buoy/entitlement.json"),
3540
+ path3.join(os3.homedir(), "Library/Application Support/buoy-desktop/entitlement.json")
3541
+ ];
3542
+ }
3543
+ function readEntitlement() {
3544
+ for (const p of entitlementPaths()) {
3545
+ try {
3546
+ if (!existsSync(p)) continue;
3547
+ const parsed = JSON.parse(readFileSync(p, "utf8"));
3548
+ return {
3549
+ tier: parsed.tier === "pro" || parsed.tier === "free" ? parsed.tier : "anonymous",
3550
+ isPro: parsed.isPro === true
3551
+ };
3552
+ } catch {
3553
+ }
3554
+ }
3555
+ return { tier: "anonymous", isPro: false };
3556
+ }
3557
+ function proRequired(tool) {
3558
+ return `\`${tool}\` is a Buoy Pro feature.
3559
+
3560
+ The simulator camera itself is free \u2014 the Mac camera, image, video, test-pattern and QR sources all work in the Buoy desktop panel without a licence. Pro adds the screen region, the non-QR symbologies (PDF417, Aztec, DataMatrix, Code 128), and driving any of it from an agent.
3561
+
3562
+ _Tell the user to enter a licence in Buoy Desktop, or see https://buoy.gg/pricing. Don't try to work around it \u2014 use the desktop panel by hand instead._`;
3563
+ }
3564
+
3565
+ // src/tools/packs/camera.ts
3412
3566
  var text13 = (s) => ({ content: [{ type: "text", text: s }] });
3567
+ var gate = (tool) => readEntitlement().isPro ? null : fail15(proRequired(tool));
3413
3568
  var fail15 = (message) => ({
3414
3569
  isError: true,
3415
3570
  content: [{ type: "text", text: message }]
3416
3571
  });
3572
+ function registerCameraTools(server) {
3573
+ server.registerTool(
3574
+ "camera_source",
3575
+ {
3576
+ description: "Give the iOS Simulator a camera, and choose what it shows. Use this before testing anything that opens a camera \u2014 a QR or barcode scanner, document capture, an avatar picker. `barcode` generates the code from text, so testing a scanner needs no printed code and no second device; pdf417 is the barcode on a driver's licence. `screen` points the phone's camera at this Mac's screen. Needs no Buoy integration in the app under test.",
3577
+ inputSchema: {
3578
+ kind: z15.enum(["barcode", "image", "video", "camera", "screen", "pattern"]).describe("What the camera should show."),
3579
+ value: z15.string().optional().describe(
3580
+ "Text for `barcode`, a file path for `image`/`video`, a camera uniqueId for `camera` (see `camera_inputs`), or one of `behind` / `display` / `window:<id>` / `region:<id>[:<gutter>]` for `screen`."
3581
+ ),
3582
+ format: z15.enum(["qr", "pdf417", "aztec", "code128"]).optional().describe("Barcode symbology; defaults to qr.")
3583
+ }
3584
+ },
3585
+ async (args) => {
3586
+ const blocked = gate("camera_source");
3587
+ if (blocked) return blocked;
3588
+ const cmd = ["source", args.kind];
3589
+ if (args.value) cmd.push(args.value);
3590
+ if (args.format) cmd.push("--format", args.format);
3591
+ const result = await run(cmd);
3592
+ if (!result.ok) {
3593
+ return fail15(
3594
+ result.error ?? result.data?.error ?? "could not set the camera source"
3595
+ );
3596
+ }
3597
+ const what = args.kind === "barcode" ? `a ${args.format ?? "qr"} code reading "${args.value}"` : args.kind === "screen" ? `this Mac's screen (${args.value ?? "behind the simulator window"})` : args.value ?? args.kind;
3598
+ return text13(
3599
+ `The simulator camera is now showing ${what}, at ${result.data?.fps ?? 0} fps.
3600
+
3601
+ _Apps already running do not pick up a camera they started without \u2014 use \`camera_launch\` to relaunch one, or \`camera_zero_setup\` so that anything the simulator launches gets it._`
3602
+ );
3603
+ }
3604
+ );
3605
+ server.registerTool(
3606
+ "camera_status",
3607
+ {
3608
+ description: "Check what the simulator camera is doing and what it is currently decoding. Use this to confirm a scanner test is actually seeing a code before concluding the app is broken.",
3609
+ inputSchema: {}
3610
+ },
3611
+ async () => {
3612
+ const blocked = gate("camera_status");
3613
+ if (blocked) return blocked;
3614
+ const result = await run(["status"]);
3615
+ if (!result.ok || !result.data) {
3616
+ return fail15(result.error ?? "could not read the simulator camera status");
3617
+ }
3618
+ const { publishing, fps, codes } = result.data;
3619
+ if (!publishing) {
3620
+ return text13(
3621
+ "The simulator camera is not publishing anything.\n\n_Set a source with `camera_source` first._"
3622
+ );
3623
+ }
3624
+ return text13(
3625
+ [
3626
+ `Publishing at ${fps} fps.`,
3627
+ codes.length ? `Currently decoding: ${codes.map((c) => `\`${c}\``).join(", ")}` : "No barcode in the current frame.",
3628
+ "",
3629
+ "_A code shown here is what the app receives. If the app is not reacting to it, the problem is in the app, not the camera \u2014 `camera_diagnose` will say whether the app is even reading the feed._"
3630
+ ].join("\n")
3631
+ );
3632
+ }
3633
+ );
3634
+ server.registerTool(
3635
+ "camera_launch",
3636
+ {
3637
+ description: "Relaunch a simulator app with the camera attached. A camera can only be attached when a process starts, so an app that is already running cannot be given one \u2014 this terminates and relaunches it.",
3638
+ inputSchema: {
3639
+ bundleId: z15.string().describe("The app's bundle identifier."),
3640
+ udid: z15.string().optional().describe("Simulator udid, if more than one is booted.")
3641
+ }
3642
+ },
3643
+ async (args) => {
3644
+ const blocked = gate("camera_launch");
3645
+ if (blocked) return blocked;
3646
+ const cmd = ["launch", args.bundleId];
3647
+ if (args.udid) cmd.push("--udid", args.udid);
3648
+ const result = await run(cmd);
3649
+ if (!result.ok) {
3650
+ return fail15(result.error ?? result.data?.error ?? "could not launch the app");
3651
+ }
3652
+ return text13(
3653
+ `Relaunched \`${args.bundleId}\` with the camera attached${result.data?.pid ? ` (pid ${result.data.pid})` : ""}.`
3654
+ );
3655
+ }
3656
+ );
3657
+ server.registerTool(
3658
+ "camera_diagnose",
3659
+ {
3660
+ description: "Work out why the simulator camera is not working. Checks that the pieces are present, a simulator is booted, something is publishing, SOMETHING IS READING IT, the library is loaded in the target app, no other tool owns the injection, and no camera library in the project disables simulator cameras at compile time.",
3661
+ inputSchema: {
3662
+ bundleId: z15.string().optional().describe("Check a specific app \u2014 whether the library is actually loaded in it.")
3663
+ }
3664
+ },
3665
+ async (args) => {
3666
+ const cmd = ["diagnose"];
3667
+ if (args.bundleId) cmd.push(args.bundleId);
3668
+ const result = await run(cmd);
3669
+ if (!result.data?.checks) {
3670
+ return fail15(result.error ?? "could not run the simulator camera diagnosis");
3671
+ }
3672
+ const ent = readEntitlement();
3673
+ const tierNote = ent.isPro ? "" : "\n\n_This install is on the **free** tier, so the other `camera_*` tools are blocked. The camera still works by hand in the Buoy desktop panel._";
3674
+ return text13(describeDiagnosis(result.data.checks) + tierNote);
3675
+ }
3676
+ );
3677
+ server.registerTool(
3678
+ "camera_stop",
3679
+ {
3680
+ description: "Turn the simulator camera off and stop publishing frames. The camera stays on until stopped \u2014 across app relaunches and after a test finishes \u2014 so call this when done, or the next thing that opens a camera will still see the last source.",
3681
+ inputSchema: {}
3682
+ },
3683
+ async () => {
3684
+ const blocked = gate("camera_stop");
3685
+ if (blocked) return blocked;
3686
+ const result = await run(["stop"]);
3687
+ if (!result.ok) {
3688
+ return fail15(result.error ?? result.data?.error ?? "could not stop the camera");
3689
+ }
3690
+ return text13("The simulator camera is off.");
3691
+ }
3692
+ );
3693
+ server.registerTool(
3694
+ "camera_devices",
3695
+ {
3696
+ description: "List booted simulators and the apps installed on one. Use this to find the bundle id `camera_launch` needs, or the udid to pass when more than one simulator is booted. Lists every app on the simulator, not just Buoy-integrated ones \u2014 the camera works on any of them.",
3697
+ inputSchema: {
3698
+ udid: z15.string().optional().describe("Which simulator's apps to list. Only needed when several are booted.")
3699
+ }
3700
+ },
3701
+ async (args) => {
3702
+ const blocked = gate("camera_devices");
3703
+ if (blocked) return blocked;
3704
+ const devicesResult = await run(["devices"]);
3705
+ if (!devicesResult.ok || !devicesResult.data) {
3706
+ return fail15(devicesResult.error ?? "could not list booted simulators");
3707
+ }
3708
+ const devices = devicesResult.data.devices ?? [];
3709
+ let apps = null;
3710
+ if (devices.length === 1 || args.udid) {
3711
+ const appsResult = await run([
3712
+ "apps",
3713
+ ...args.udid ? ["--udid", args.udid] : []
3714
+ ]);
3715
+ apps = appsResult.ok ? appsResult.data?.apps ?? [] : null;
3716
+ }
3717
+ return text13(describeDevices(devices, apps));
3718
+ }
3719
+ );
3720
+ server.registerTool(
3721
+ "camera_inputs",
3722
+ {
3723
+ description: "List what this Mac can point the simulator camera at: its webcams (the uniqueId for `camera_source` with kind `camera`) and the windows the screen source can film (the id for `window:<id>`). Call this before choosing a `camera` or windowed `screen` source \u2014 those ids cannot be guessed.",
3724
+ inputSchema: {}
3725
+ },
3726
+ async () => {
3727
+ const blocked = gate("camera_inputs");
3728
+ if (blocked) return blocked;
3729
+ const [cams, wins] = await Promise.all([
3730
+ run(["cameras"]),
3731
+ run(["windows"])
3732
+ ]);
3733
+ if (!cams.ok && !wins.ok) {
3734
+ return fail15(
3735
+ cams.error ?? wins.error ?? "could not list the Mac's cameras or windows"
3736
+ );
3737
+ }
3738
+ return text13(
3739
+ describeInputs(cams.data?.cameras ?? [], wins.data?.windows ?? [])
3740
+ );
3741
+ }
3742
+ );
3743
+ server.registerTool(
3744
+ "camera_zero_setup",
3745
+ {
3746
+ description: "Make every app the simulator launches get a camera, however it was launched \u2014 `expo start`, `react-native run-ios`, Xcode, a test runner. Use this when you are not the one starting the app, so `camera_launch` is not an option. It loads Buoy's library into every process in that simulator, SpringBoard included, so turn it off when finished.",
3747
+ inputSchema: {
3748
+ action: z15.enum(["on", "off", "status"]).describe("Turn it on, off, or report the current state."),
3749
+ udid: z15.string().optional().describe("Which simulator. Only needed when several are booted.")
3750
+ }
3751
+ },
3752
+ async (args) => {
3753
+ const blocked = gate("camera_zero_setup");
3754
+ if (blocked) return blocked;
3755
+ const result = await run(["zero-setup", args.action, ...args.udid ? ["--udid", args.udid] : []]);
3756
+ if (!result.ok) {
3757
+ return fail15(
3758
+ result.error ?? result.data?.error ?? "could not change zero-setup mode"
3759
+ );
3760
+ }
3761
+ const d = result.data ?? {};
3762
+ if (args.action === "status") {
3763
+ if (!d.enabled) return text13("Zero-setup mode is **off**.");
3764
+ return text13(
3765
+ d.foreign ? `Zero-setup is on, but **another tool owns it** (\`${d.path}\`). Quit that tool before turning Buoy's on.` : "Zero-setup mode is **on** \u2014 anything this simulator launches gets the camera."
3766
+ );
3767
+ }
3768
+ if (args.action === "on") {
3769
+ return text13(
3770
+ "Zero-setup mode is **on**. Anything this simulator launches from now on gets the camera \u2014 start your app however you normally would.\n\n_This loads the library into every process in the simulator. Turn it off with `camera_zero_setup` action `off` when you are done._"
3771
+ );
3772
+ }
3773
+ return text13("Zero-setup mode is **off**.");
3774
+ }
3775
+ );
3776
+ }
3777
+
3778
+ // src/tools/packs/interact.ts
3779
+ import { z as z16 } from "zod";
3780
+ var TOOL_ID2 = "highlight-updates";
3781
+ var text14 = (s) => ({ content: [{ type: "text", text: s }] });
3782
+ var fail16 = (message) => ({
3783
+ isError: true,
3784
+ content: [{ type: "text", text: message }]
3785
+ });
3417
3786
  var errMsg15 = (e) => e instanceof Error ? e.message : String(e);
3418
3787
  function formatElement(e) {
3419
3788
  let line = e.interactive ? "\u2022 " : " ";
@@ -3437,8 +3806,8 @@ function registerInteractTools(server, sync) {
3437
3806
  {
3438
3807
  description: "List the interactive / labeled elements currently on screen \u2014 the app's live accessibility-style tree walked from the React fiber tree. Each row shows the component name, visible text/label, role, testID, a normalized tap point (tap: x,y in 0\u20131), and its #nativeTag. Rows marked with \u2022 are tappable (have an onPress). Use this to see what's on screen and pick something to tap with tap_element \u2014 no screenshot needed. If you already know the sequence you want to drive, `run_flow` does the whole thing (taps, waits, assertions) in one call instead. Re-run after navigating or when the screen changes, since positions move. Requires Buoy Pro.",
3439
3808
  inputSchema: {
3440
- interactiveOnly: z15.boolean().optional().describe("Only return tappable (onPress) elements. Default false (include labels/text for context)."),
3441
- deviceId: z15.string().optional().describe("Target device id (auto-selected if one is connected).")
3809
+ interactiveOnly: z16.boolean().optional().describe("Only return tappable (onPress) elements. Default false (include labels/text for context)."),
3810
+ deviceId: z16.string().optional().describe("Target device id (auto-selected if one is connected).")
3442
3811
  }
3443
3812
  },
3444
3813
  async (args) => {
@@ -3448,16 +3817,16 @@ function registerInteractTools(server, sync) {
3448
3817
  const all = res?.elements ?? [];
3449
3818
  const elements = args.interactiveOnly ? all.filter((e) => e.interactive) : all;
3450
3819
  if (elements.length === 0) {
3451
- return text13(
3820
+ return text14(
3452
3821
  "No elements found on screen. If the app just navigated, wait a moment and retry; make sure highlight-updates is enabled in the app."
3453
3822
  );
3454
3823
  }
3455
3824
  const header = `Screen ${res.screen.width}\xD7${res.screen.height} \u2014 ${elements.length} element${elements.length === 1 ? "" : "s"} (\u2022 = tappable). Tap with tap_element({ testID | query | nativeTag }).`;
3456
- return text13(`${header}
3825
+ return text14(`${header}
3457
3826
 
3458
3827
  ${elements.map(formatElement).join("\n")}`);
3459
3828
  } catch (e) {
3460
- return fail15(errMsg15(e));
3829
+ return fail16(errMsg15(e));
3461
3830
  }
3462
3831
  }
3463
3832
  );
@@ -3466,20 +3835,20 @@ ${elements.map(formatElement).join("\n")}`);
3466
3835
  {
3467
3836
  description: "Interact with an on-screen element by invoking its handler directly in JS (no screenshot, no coordinate math, works on real devices). Handles buttons (onPress + onLongPress), toggles/switches and sliders (onValueChange), and text inputs (onChangeText) \u2014 see each element's `control` in describe_screen. Identify the target with an exact `nativeTag` or `testID`, or a fuzzy `query`. Pass `longPress:true` to invoke onLongPress instead of onPress (elements that support it show {long-press} in describe_screen). For a toggle, pass `value:true/false` (omit to flip); for a slider, pass a numeric `value` (omit to jump to the far end); for a text input, pass `text`. If the element is off-screen it's scrolled into view first (scrollIntoView:false to skip). Call describe_screen first to see options + current values. Driving MORE THAN ONE step (reproducing a bug, verifying a fix)? Use `run_flow` instead \u2014 it runs the whole sequence in one call. Requires Buoy Pro.",
3468
3837
  inputSchema: {
3469
- nativeTag: z15.number().optional().describe("Exact nativeTag from describe_screen (most precise)."),
3470
- testID: z15.string().optional().describe("Exact testID of the element."),
3471
- query: z15.string().optional().describe('Fuzzy match against testID / label / visible text / component name \u2014 e.g. "Sign in".'),
3472
- value: z15.union([z15.number(), z15.boolean()]).optional().describe("For a toggle: true/false (omit to flip). For a slider: the numeric value (omit to jump to the far end)."),
3473
- text: z15.string().optional().describe("For a text input: the string to set via onChangeText."),
3474
- longPress: z15.boolean().optional().describe("Invoke the element's onLongPress instead of onPress. Fails with a clear reason if the element has no onLongPress handler."),
3475
- scrollIntoView: z15.boolean().optional().describe("Scroll the target into view first if it's off-screen. Default true."),
3476
- deviceId: z15.string().optional().describe("Target device id (auto-selected if one is connected).")
3838
+ nativeTag: z16.number().optional().describe("Exact nativeTag from describe_screen (most precise)."),
3839
+ testID: z16.string().optional().describe("Exact testID of the element."),
3840
+ query: z16.string().optional().describe('Fuzzy match against testID / label / visible text / component name \u2014 e.g. "Sign in".'),
3841
+ value: z16.union([z16.number(), z16.boolean()]).optional().describe("For a toggle: true/false (omit to flip). For a slider: the numeric value (omit to jump to the far end)."),
3842
+ text: z16.string().optional().describe("For a text input: the string to set via onChangeText."),
3843
+ longPress: z16.boolean().optional().describe("Invoke the element's onLongPress instead of onPress. Fails with a clear reason if the element has no onLongPress handler."),
3844
+ scrollIntoView: z16.boolean().optional().describe("Scroll the target into view first if it's off-screen. Default true."),
3845
+ deviceId: z16.string().optional().describe("Target device id (auto-selected if one is connected).")
3477
3846
  }
3478
3847
  },
3479
3848
  async (args) => {
3480
3849
  try {
3481
3850
  if (args.nativeTag == null && !args.testID && !args.query) {
3482
- return fail15("Provide one of: nativeTag, testID, or query (from describe_screen).");
3851
+ return fail16("Provide one of: nativeTag, testID, or query (from describe_screen).");
3483
3852
  }
3484
3853
  const target = sync.requireProDevice(args.deviceId);
3485
3854
  const res = await sync.callAction(
@@ -3504,25 +3873,25 @@ ${elements.map(formatElement).join("\n")}`);
3504
3873
  const id = m.testID ? ` [testID=${m.testID}]` : m.nativeTag != null ? ` #${m.nativeTag}` : "";
3505
3874
  const scrolledNote = res.scrolled ? " (scrolled into view)" : "";
3506
3875
  const verb = m.via === "onValueChange" ? `Set "${label}"${id} \u2192 ${JSON.stringify(m.value)}` : m.via === "onChangeText" ? `Typed ${JSON.stringify(m.value)} into "${label}"${id}` : m.via === "onLongPress" ? `Long-pressed "${label}"${id}` : `Tapped "${label}"${id}`;
3507
- return text13(`${verb}${scrolledNote}.${flowTip}`);
3876
+ return text14(`${verb}${scrolledNote}.${flowTip}`);
3508
3877
  }
3509
3878
  let msg = res?.reason ?? "Tap failed.";
3510
3879
  if (res?.candidates?.length) {
3511
3880
  msg += "\n\nTappable candidates:\n" + res.candidates.map((c) => `- ${c.name}${c.text ? ` "${c.text}"` : ""}${c.testID ? ` [testID=${c.testID}]` : ""}${c.nativeTag != null ? ` #${c.nativeTag}` : ""}`).join("\n");
3512
3881
  }
3513
- return fail15(msg);
3882
+ return fail16(msg);
3514
3883
  } catch (e) {
3515
- return fail15(errMsg15(e));
3884
+ return fail16(errMsg15(e));
3516
3885
  }
3517
3886
  }
3518
3887
  );
3519
3888
  }
3520
3889
 
3521
3890
  // src/tools/packs/jsThread.ts
3522
- import { z as z16 } from "zod";
3891
+ import { z as z17 } from "zod";
3523
3892
  var JS_TOP_TOOL_ID = "js-top";
3524
- var text14 = (s) => ({ content: [{ type: "text", text: s }] });
3525
- var fail16 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
3893
+ var text15 = (s) => ({ content: [{ type: "text", text: s }] });
3894
+ var fail17 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
3526
3895
  var errMsg16 = (e) => e instanceof Error ? e.message : String(e);
3527
3896
  var SPARK_CHARS = "\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";
3528
3897
  function sparkline(values) {
@@ -3594,9 +3963,9 @@ function registerJsThreadTools(server, sync) {
3594
3963
  {
3595
3964
  description: 'Task Manager for the React Native JS thread: sample for a few seconds and return a ranked table of which task origins (timers, Promise chains, rAF callbacks, bridge call-ins) consumed JS-thread time \u2014 plus thread busy% and freeze (50ms+ block) attribution. Use when JS FPS is low and you need to know WHAT is eating the thread. To profile one specific interaction, pass clearFirst:true, then drive the UI with tap_element while the sample runs. Drill into a row with get_js_thread_origin_detail. NOT the tool for React components re-rendering too often \u2014 this measures TASKS on the thread, not renders; for "the page re-renders constantly / typing lags / tapping one button re-renders everything" use measure_renders. Requires @buoy-gg/js-top on the device.',
3596
3965
  inputSchema: {
3597
- deviceId: z16.string().optional().describe("Target device id (auto-selected if one is connected)."),
3598
- durationMs: z16.number().optional().describe("How long to sample before reading the table. Default 3000, max 30000."),
3599
- clearFirst: z16.boolean().optional().describe("Reset all stats before sampling, so the result attributes only what happens during this sample.")
3966
+ deviceId: z17.string().optional().describe("Target device id (auto-selected if one is connected)."),
3967
+ durationMs: z17.number().optional().describe("How long to sample before reading the table. Default 3000, max 30000."),
3968
+ clearFirst: z17.boolean().optional().describe("Reset all stats before sampling, so the result attributes only what happens during this sample.")
3600
3969
  }
3601
3970
  },
3602
3971
  async ({ deviceId, durationMs, clearFirst }) => {
@@ -3609,7 +3978,7 @@ function registerJsThreadTools(server, sync) {
3609
3978
  { durationMs: duration, clearFirst: clearFirst === true },
3610
3979
  target
3611
3980
  );
3612
- if (!snap) return fail16("Device returned no snapshot \u2014 is @buoy-gg/js-top installed in the app?");
3981
+ if (!snap) return fail17("Device returned no snapshot \u2014 is @buoy-gg/js-top installed in the app?");
3613
3982
  const md = formatTopMarkdown(snap, duration);
3614
3983
  const slim = {
3615
3984
  busyPct: Math.round(snap.busyPct * 10) / 10,
@@ -3628,13 +3997,13 @@ function registerJsThreadTools(server, sync) {
3628
3997
  worstFreezeMs: r.worstFreezeMs
3629
3998
  }))
3630
3999
  };
3631
- return text14(`${md}
4000
+ return text15(`${md}
3632
4001
 
3633
4002
  \`\`\`json
3634
4003
  ${JSON.stringify(slim)}
3635
4004
  \`\`\``);
3636
4005
  } catch (e) {
3637
- return fail16(errMsg16(e));
4006
+ return fail17(errMsg16(e));
3638
4007
  }
3639
4008
  }
3640
4009
  );
@@ -3643,8 +4012,8 @@ ${JSON.stringify(slim)}
3643
4012
  {
3644
4013
  description: 'Inspect one js-top task origin in depth: schedules vs runs, avg/max/total exclusive ms, a 5s activity sparkline, freeze attribution, and the captured scheduling site (caller function + stack frames). Pass a row `key` from get_js_thread_top\'s JSON (e.g. "interval|pollFeed" or "unattributed" for the system row).',
3645
4014
  inputSchema: {
3646
- deviceId: z16.string().optional().describe("Target device id (auto-selected if one is connected)."),
3647
- key: z16.string().describe("Origin key from get_js_thread_top's JSON rows.")
4015
+ deviceId: z17.string().optional().describe("Target device id (auto-selected if one is connected)."),
4016
+ key: z17.string().describe("Origin key from get_js_thread_top's JSON rows.")
3648
4017
  }
3649
4018
  },
3650
4019
  async ({ deviceId, key }) => {
@@ -3657,18 +4026,18 @@ ${JSON.stringify(slim)}
3657
4026
  target
3658
4027
  );
3659
4028
  if (!detail) {
3660
- return fail16(
4029
+ return fail17(
3661
4030
  `Origin "${key}" is not tracked (cleared, evicted, or never existed). Re-run get_js_thread_top for current keys.`
3662
4031
  );
3663
4032
  }
3664
4033
  const md = formatDetailMarkdown(detail);
3665
- return text14(`${md}
4034
+ return text15(`${md}
3666
4035
 
3667
4036
  \`\`\`json
3668
4037
  ${JSON.stringify(detail)}
3669
4038
  \`\`\``);
3670
4039
  } catch (e) {
3671
- return fail16(errMsg16(e));
4040
+ return fail17(errMsg16(e));
3672
4041
  }
3673
4042
  }
3674
4043
  );
@@ -3677,26 +4046,26 @@ ${JSON.stringify(detail)}
3677
4046
  {
3678
4047
  description: "Reset the js-top task table, freeze history, and busy history on the device (fresh measurement window).",
3679
4048
  inputSchema: {
3680
- deviceId: z16.string().optional().describe("Target device id (auto-selected if one is connected).")
4049
+ deviceId: z17.string().optional().describe("Target device id (auto-selected if one is connected).")
3681
4050
  }
3682
4051
  },
3683
4052
  async ({ deviceId }) => {
3684
4053
  try {
3685
4054
  const target = sync.requireProDevice(deviceId);
3686
4055
  await sync.callAction(JS_TOP_TOOL_ID, "clear", {}, target);
3687
- return text14("Cleared js-top stats.");
4056
+ return text15("Cleared js-top stats.");
3688
4057
  } catch (e) {
3689
- return fail16(errMsg16(e));
4058
+ return fail17(errMsg16(e));
3690
4059
  }
3691
4060
  }
3692
4061
  );
3693
4062
  }
3694
4063
 
3695
4064
  // src/tools/packs/images.ts
3696
- import { z as z17 } from "zod";
4065
+ import { z as z18 } from "zod";
3697
4066
  var IMAGES_TOOL_ID = "images";
3698
- var text15 = (s) => ({ content: [{ type: "text", text: s }] });
3699
- var fail17 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
4067
+ var text16 = (s) => ({ content: [{ type: "text", text: s }] });
4068
+ var fail18 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
3700
4069
  var errMsg17 = (e) => e instanceof Error ? e.message : String(e);
3701
4070
  function uriTail(uri) {
3702
4071
  if (!uri) return "(no source)";
@@ -3785,9 +4154,9 @@ function registerImagesTools(server, sync) {
3785
4154
  {
3786
4155
  description: "Live image registry from the app: every RN <Image> and expo-image load with cache verdict (memory/disk/network), load ms, decoded vs displayed size with an oversize/upscale verdict and wasted-KB estimate, error details, and any active simulation overrides. Image HTTP never hits the JS network stack, so this is the only visibility into image loading. Requires @buoy-gg/images on the device.",
3787
4156
  inputSchema: {
3788
- deviceId: z17.string().optional().describe("Target device id (auto-selected if one is connected)."),
3789
- limit: z17.number().optional().describe("Max records to return (newest first). Default 30, max 200."),
3790
- status: z17.enum(["pending", "loading", "loaded", "error"]).optional().describe("Only records in this state (e.g. 'error' for the failure log).")
4157
+ deviceId: z18.string().optional().describe("Target device id (auto-selected if one is connected)."),
4158
+ limit: z18.number().optional().describe("Max records to return (newest first). Default 30, max 200."),
4159
+ status: z18.enum(["pending", "loading", "loaded", "error"]).optional().describe("Only records in this state (e.g. 'error' for the failure log).")
3791
4160
  }
3792
4161
  },
3793
4162
  async ({ deviceId, limit, status }) => {
@@ -3800,7 +4169,7 @@ function registerImagesTools(server, sync) {
3800
4169
  { limit: capped, status },
3801
4170
  target
3802
4171
  );
3803
- if (!list) return fail17("Device returned nothing \u2014 is @buoy-gg/images installed in the app?");
4172
+ if (!list) return fail18("Device returned nothing \u2014 is @buoy-gg/images installed in the app?");
3804
4173
  const md = formatListMarkdown(list, capped);
3805
4174
  const slim = {
3806
4175
  stats: list.stats,
@@ -3827,13 +4196,13 @@ function registerImagesTools(server, sync) {
3827
4196
  layoutShifts: r.layoutShifts
3828
4197
  }))
3829
4198
  };
3830
- return text15(`${md}
4199
+ return text16(`${md}
3831
4200
 
3832
4201
  \`\`\`json
3833
4202
  ${JSON.stringify(slim)}
3834
4203
  \`\`\``);
3835
4204
  } catch (e) {
3836
- return fail17(errMsg17(e));
4205
+ return fail18(errMsg17(e));
3837
4206
  }
3838
4207
  }
3839
4208
  );
@@ -3842,9 +4211,9 @@ ${JSON.stringify(slim)}
3842
4211
  {
3843
4212
  description: "Act on one image from get_images (by id): hard_reload (bypass caches + refetch), retry, evict_disk (expo disk entry), flash (red border to locate it on screen), prove_savings (re-encode at displayed size as WebP ON DEVICE and return real byte savings + a previewable file:// uri), or simulation overrides \u2014 force_error (instant offline-safe failure), force_loading (request hangs forever), force_blank, swap_url (requires url), restore (remove override). Returns the record's state after the action so the effect is visible.",
3844
4213
  inputSchema: {
3845
- deviceId: z17.string().optional().describe("Target device id (auto-selected if one is connected)."),
3846
- id: z17.number().describe("Record id from get_images."),
3847
- action: z17.enum([
4214
+ deviceId: z18.string().optional().describe("Target device id (auto-selected if one is connected)."),
4215
+ id: z18.number().describe("Record id from get_images."),
4216
+ action: z18.enum([
3848
4217
  "hard_reload",
3849
4218
  "retry",
3850
4219
  "evict_disk",
@@ -3856,7 +4225,7 @@ ${JSON.stringify(slim)}
3856
4225
  "swap_url",
3857
4226
  "restore"
3858
4227
  ]).describe("What to do."),
3859
- url: z17.string().optional().describe("Replacement URL (swap_url only).")
4228
+ url: z18.string().optional().describe("Replacement URL (swap_url only).")
3860
4229
  }
3861
4230
  },
3862
4231
  async ({ deviceId, id, action, url }) => {
@@ -3864,8 +4233,8 @@ ${JSON.stringify(slim)}
3864
4233
  const target = sync.requireProDevice(deviceId);
3865
4234
  if (action === "prove_savings") {
3866
4235
  const savings = await sync.callAction(IMAGES_TOOL_ID, "proveSavings", { id }, target);
3867
- if (!savings) return fail17("Device returned nothing for proveSavings.");
3868
- if (!savings.ok) return fail17(savings.message);
4236
+ if (!savings) return fail18("Device returned nothing for proveSavings.");
4237
+ if (!savings.ok) return fail18(savings.message);
3869
4238
  const parts = [`**prove_savings** on #${id}: ${savings.message}`];
3870
4239
  if (savings.originalBytes != null)
3871
4240
  parts.push(`Original: ${Math.round(savings.originalBytes / 1024)}KB (${savings.originalBytesSource})`);
@@ -3877,11 +4246,11 @@ ${JSON.stringify(slim)}
3877
4246
  parts.push(`**Saved: ${Math.round(savings.savedBytes / 1024)}KB (${savings.savedPct}%)**`);
3878
4247
  if (savings.optimizedUri)
3879
4248
  parts.push(`Preview in place: image_action {id:${id}, action:"swap_url", url:"${savings.optimizedUri}"}`);
3880
- return text15(parts.join("\n"));
4249
+ return text16(parts.join("\n"));
3881
4250
  }
3882
4251
  const entry = ACTION_MAP[action];
3883
- if (!entry) return fail17(`Unknown action: ${action}`);
3884
- if (action === "swap_url" && !url) return fail17("swap_url requires the `url` param.");
4252
+ if (!entry) return fail18(`Unknown action: ${action}`);
4253
+ if (action === "swap_url" && !url) return fail18("swap_url requires the `url` param.");
3885
4254
  const result = await sync.callAction(
3886
4255
  IMAGES_TOOL_ID,
3887
4256
  entry.action,
@@ -3901,9 +4270,9 @@ ${JSON.stringify(slim)}
3901
4270
  );
3902
4271
  if (detail.error) lines.push(`Error: ${detail.error}`);
3903
4272
  }
3904
- return text15(lines.join("\n"));
4273
+ return text16(lines.join("\n"));
3905
4274
  } catch (e) {
3906
- return fail17(errMsg17(e));
4275
+ return fail18(errMsg17(e));
3907
4276
  }
3908
4277
  }
3909
4278
  );
@@ -3912,12 +4281,12 @@ ${JSON.stringify(slim)}
3912
4281
  {
3913
4282
  description: "App-wide image simulation modes: network 'offline' (every NETWORK image load fails immediately, both libs \u2014 bundled assets still load; reload/remount on-screen images to see it), 'cold' (every image bypasses caches \u2014 first-launch behavior, nothing cleared), 'normal' to reset. blankImages renders every image without a source. massAction applies per-image simulations to everything mounted. Also clears the registry or expo caches when asked.",
3914
4283
  inputSchema: {
3915
- deviceId: z17.string().optional().describe("Target device id (auto-selected if one is connected)."),
3916
- network: z17.enum(["normal", "offline", "cold"]).optional().describe("Network simulation mode."),
3917
- blankImages: z17.boolean().optional().describe("Render all images without a source."),
3918
- massAction: z17.enum(["error", "loading", "blank", "reload", "flash", "restore"]).optional().describe("Apply to EVERY mounted image at once: force error/loading/blank overrides, hard-reload all, flash all, or restore all overrides."),
3919
- clearRegistry: z17.boolean().optional().describe("Clear the captured image log."),
3920
- clearExpoCaches: z17.boolean().optional().describe("Clear expo-image memory + disk caches.")
4284
+ deviceId: z18.string().optional().describe("Target device id (auto-selected if one is connected)."),
4285
+ network: z18.enum(["normal", "offline", "cold"]).optional().describe("Network simulation mode."),
4286
+ blankImages: z18.boolean().optional().describe("Render all images without a source."),
4287
+ massAction: z18.enum(["error", "loading", "blank", "reload", "flash", "restore"]).optional().describe("Apply to EVERY mounted image at once: force error/loading/blank overrides, hard-reload all, flash all, or restore all overrides."),
4288
+ clearRegistry: z18.boolean().optional().describe("Clear the captured image log."),
4289
+ clearExpoCaches: z18.boolean().optional().describe("Clear expo-image memory + disk caches.")
3921
4290
  }
3922
4291
  },
3923
4292
  async ({ deviceId, network, blankImages, massAction, clearRegistry, clearExpoCaches }) => {
@@ -3944,17 +4313,17 @@ ${JSON.stringify(slim)}
3944
4313
  const r = await sync.callAction(IMAGES_TOOL_ID, "clearExpoCaches", {}, target);
3945
4314
  done.push(r?.message ?? "expo caches cleared");
3946
4315
  }
3947
- if (done.length === 0) return fail17("Pass at least one of: network, blankImages, massAction, clearRegistry, clearExpoCaches.");
3948
- return text15(`Applied: ${done.join(" \xB7 ")}`);
4316
+ if (done.length === 0) return fail18("Pass at least one of: network, blankImages, massAction, clearRegistry, clearExpoCaches.");
4317
+ return text16(`Applied: ${done.join(" \xB7 ")}`);
3949
4318
  } catch (e) {
3950
- return fail17(errMsg17(e));
4319
+ return fail18(errMsg17(e));
3951
4320
  }
3952
4321
  }
3953
4322
  );
3954
4323
  }
3955
4324
 
3956
4325
  // src/tools/packs/assets.ts
3957
- import { z as z18 } from "zod";
4326
+ import { z as z19 } from "zod";
3958
4327
 
3959
4328
  // src/tools/packs/assetsGraphNote.ts
3960
4329
  function graphUnavailableNote(ss) {
@@ -3969,8 +4338,8 @@ function graphUnavailableNote(ss) {
3969
4338
 
3970
4339
  // src/tools/packs/assets.ts
3971
4340
  var ASSETS_TOOL_ID = "assets";
3972
- var text16 = (s) => ({ content: [{ type: "text", text: s }] });
3973
- var fail18 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
4341
+ var text17 = (s) => ({ content: [{ type: "text", text: s }] });
4342
+ var fail19 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
3974
4343
  var errMsg18 = (e) => e instanceof Error ? e.message : String(e);
3975
4344
  function kb2(bytes) {
3976
4345
  if (bytes == null || bytes <= 0) return "\u2013";
@@ -4059,10 +4428,10 @@ function registerAssetsTools(server, sync) {
4059
4428
  {
4060
4429
  description: "Bundled-asset inventory from the app: every asset (images, fonts, video, audio) with dimensions, @1x/@2x/@3x scale coverage, byte sizes (measured from the Metro server in dev), loaded vs never-loaded state, and audit findings \u2014 duplicates (by content hash), shipped-but-never-loaded, WebP candidates, images decoding larger than the screen, heavy GIFs/fonts, scale gaps \u2014 plus the change vs a saved baseline. This is what the app SHIPS; use get_images for what it RENDERS. Requires @buoy-gg/assets on the device.",
4061
4430
  inputSchema: {
4062
- deviceId: z18.string().optional().describe("Target device id (auto-selected if one is connected)."),
4063
- limit: z18.number().optional().describe("Max records to return (largest first). Default 40, max 500."),
4064
- kind: z18.enum(["image", "font", "video", "audio", "data", "other"]).optional().describe("Only assets of this kind."),
4065
- unusedOnly: z18.boolean().optional().describe("Only assets shipped in the bundle but never loaded at runtime.")
4431
+ deviceId: z19.string().optional().describe("Target device id (auto-selected if one is connected)."),
4432
+ limit: z19.number().optional().describe("Max records to return (largest first). Default 40, max 500."),
4433
+ kind: z19.enum(["image", "font", "video", "audio", "data", "other"]).optional().describe("Only assets of this kind."),
4434
+ unusedOnly: z19.boolean().optional().describe("Only assets shipped in the bundle but never loaded at runtime.")
4066
4435
  }
4067
4436
  },
4068
4437
  async ({ deviceId, limit, kind, unusedOnly }) => {
@@ -4075,7 +4444,7 @@ function registerAssetsTools(server, sync) {
4075
4444
  { limit: unusedOnly ? 500 : capped, kind, loadedOnly: false },
4076
4445
  target
4077
4446
  );
4078
- if (!list) return fail18("Device returned nothing \u2014 is @buoy-gg/assets installed in the app?");
4447
+ if (!list) return fail19("Device returned nothing \u2014 is @buoy-gg/assets installed in the app?");
4079
4448
  if (unusedOnly) {
4080
4449
  list.records = list.records.filter((r) => !r.loaded).slice(0, capped);
4081
4450
  }
@@ -4099,13 +4468,13 @@ function registerAssetsTools(server, sync) {
4099
4468
  sizeSource: r.sizeSource
4100
4469
  }))
4101
4470
  };
4102
- return text16(`${md}
4471
+ return text17(`${md}
4103
4472
 
4104
4473
  \`\`\`json
4105
4474
  ${JSON.stringify(slim)}
4106
4475
  \`\`\``);
4107
4476
  } catch (e) {
4108
- return fail18(errMsg18(e));
4477
+ return fail19(errMsg18(e));
4109
4478
  }
4110
4479
  }
4111
4480
  );
@@ -4114,9 +4483,9 @@ ${JSON.stringify(slim)}
4114
4483
  {
4115
4484
  description: "Drive the assets tool: rescan (re-walk the registry + merge the Metro bundle graph + refresh fonts + measure sizes \u2014 run this first if the inventory looks stale or empty), measure_sizes (re-measure byte sizes only), detail (full metadata for one asset by id: source dir, per-scale sizes, resolved URI, per-file graph paths), save_baseline (persist the current inventory for before/after comparison \u2014 save, make your change, then get_assets shows added/removed/grown/net bytes), clear_baseline, clear_records (wipe + rescan rebuilds).",
4116
4485
  inputSchema: {
4117
- deviceId: z18.string().optional().describe("Target device id (auto-selected if one is connected)."),
4118
- action: z18.enum(["rescan", "measure_sizes", "detail", "save_baseline", "clear_baseline", "clear_records"]).describe("What to do."),
4119
- id: z18.number().optional().describe("Asset id from get_assets (detail only).")
4486
+ deviceId: z19.string().optional().describe("Target device id (auto-selected if one is connected)."),
4487
+ action: z19.enum(["rescan", "measure_sizes", "detail", "save_baseline", "clear_baseline", "clear_records"]).describe("What to do."),
4488
+ id: z19.number().optional().describe("Asset id from get_assets (detail only).")
4120
4489
  }
4121
4490
  },
4122
4491
  async ({ deviceId, action, id }) => {
@@ -4126,19 +4495,19 @@ ${JSON.stringify(slim)}
4126
4495
  case "rescan": {
4127
4496
  const result = await sync.callAction(ASSETS_TOOL_ID, "rescan", {}, target);
4128
4497
  const ss = result?.scanStatus;
4129
- if (!ss) return fail18("Device returned nothing for rescan.");
4130
- return text16(
4498
+ if (!ss) return fail19("Device returned nothing for rescan.");
4499
+ return text17(
4131
4500
  `Rescan done: ${ss.registryCount} registered at runtime` + (ss.graphCount != null ? ` \xB7 ${ss.graphCount} in the bundle graph` : " \xB7 no bundle graph") + (ss.graphError ? ` (graph: ${ss.graphError})` : "") + ` \xB7 ${ss.fontFamilies.length} font families` + (ss.measuring ? " \xB7 size measurement running \u2014 get_assets in a moment" : "")
4132
4501
  );
4133
4502
  }
4134
4503
  case "measure_sizes": {
4135
4504
  const result = await sync.callAction(ASSETS_TOOL_ID, "measureSizes", {}, target);
4136
- return text16(`Measured ${result?.measured ?? 0} of ${result?.total ?? 0} assets.`);
4505
+ return text17(`Measured ${result?.measured ?? 0} of ${result?.total ?? 0} assets.`);
4137
4506
  }
4138
4507
  case "detail": {
4139
- if (id == null) return fail18("detail requires the `id` param (from get_assets).");
4508
+ if (id == null) return fail19("detail requires the `id` param (from get_assets).");
4140
4509
  const detail = await sync.callAction(ASSETS_TOOL_ID, "getDetail", { id }, target);
4141
- if (!detail) return fail18(`Asset ${id} not found \u2014 re-run get_assets for current ids.`);
4510
+ if (!detail) return fail19(`Asset ${id} not found \u2014 re-run get_assets for current ids.`);
4142
4511
  const lines = [
4143
4512
  `## ${detail.name}.${detail.type} (#${detail.id})`,
4144
4513
  "",
@@ -4156,32 +4525,32 @@ ${JSON.stringify(slim)}
4156
4525
  if (detail.fileSystemLocation) lines.push(`- Source dir: ${detail.fileSystemLocation}`);
4157
4526
  if (detail.files?.length) lines.push(`- Files: ${detail.files.join(", ")}`);
4158
4527
  if (detail.uri) lines.push(`- Resolved URI: ${detail.uri}`);
4159
- return text16(lines.join("\n"));
4528
+ return text17(lines.join("\n"));
4160
4529
  }
4161
4530
  case "save_baseline": {
4162
4531
  const result = await sync.callAction(ASSETS_TOOL_ID, "saveBaseline", {}, target);
4163
- return text16(
4532
+ return text17(
4164
4533
  `Baseline saved (${result?.assets ?? 0} assets). Make your change, then get_assets reports added/removed/grown/net bytes against it.`
4165
4534
  );
4166
4535
  }
4167
4536
  case "clear_baseline": {
4168
4537
  await sync.callAction(ASSETS_TOOL_ID, "clearBaseline", {}, target);
4169
- return text16("Baseline cleared.");
4538
+ return text17("Baseline cleared.");
4170
4539
  }
4171
4540
  case "clear_records": {
4172
4541
  const result = await sync.callAction(ASSETS_TOOL_ID, "clearRecords", {}, target);
4173
- return text16(result?.message ?? "Inventory cleared.");
4542
+ return text17(result?.message ?? "Inventory cleared.");
4174
4543
  }
4175
4544
  }
4176
4545
  } catch (e) {
4177
- return fail18(errMsg18(e));
4546
+ return fail19(errMsg18(e));
4178
4547
  }
4179
4548
  }
4180
4549
  );
4181
4550
  }
4182
4551
 
4183
4552
  // src/tools/packs/reload.ts
4184
- import { z as z19 } from "zod";
4553
+ import { z as z20 } from "zod";
4185
4554
 
4186
4555
  // src/capture/devServerReload.ts
4187
4556
  import { WebSocket } from "ws";
@@ -4244,8 +4613,8 @@ var DEFAULT_WAIT_MS = 3e4;
4244
4613
  var TEARDOWN_GRACE_MS = 1200;
4245
4614
  var PROBE_TIMEOUT_MS = 1500;
4246
4615
  var PROBE_INTERVAL_MS = 400;
4247
- var text17 = (s) => ({ content: [{ type: "text", text: s }] });
4248
- var fail19 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
4616
+ var text18 = (s) => ({ content: [{ type: "text", text: s }] });
4617
+ var fail20 = (message) => ({ isError: true, content: [{ type: "text", text: message }] });
4249
4618
  var errMsg19 = (e) => e instanceof Error ? e.message : String(e);
4250
4619
  var delay3 = (ms) => new Promise((r) => setTimeout(r, ms));
4251
4620
  async function ping(sync, deviceId, timeoutMs) {
@@ -4285,12 +4654,12 @@ function registerReloadTools(server, sync) {
4285
4654
  {
4286
4655
  description: "Reload the running app's JS bundle (Expo Go, dev client, or RN CLI) \u2014 the equivalent of shaking the device and hitting Reload, but from here. Use it to pick up a change Fast Refresh didn't apply, to clear leaked in-memory state before a measurement, to re-run app startup, or to RECOVER A CRASHED APP: after a fatal error the other tools stop answering, and reloading is how you get them back (it falls through to the dev server when the app is too broken to reload itself). In dev builds it uses React Native's DevSettings.reload(); otherwise it falls back to expo-updates (if the app installs it). All in-memory state is lost \u2014 read anything you need from get_console/get_storage BEFORE reloading. By default this waits for the app to come back up and reports how long the reload took. Works on any app running @buoy-gg/core \u2014 no particular tool package needed. Requires Buoy Pro.",
4287
4656
  inputSchema: {
4288
- strategy: z19.enum(["auto", "dev-settings", "expo-updates"]).optional().describe(
4657
+ strategy: z20.enum(["auto", "dev-settings", "expo-updates"]).optional().describe(
4289
4658
  "Reload mechanism. 'auto' (default) uses DevSettings in dev builds and expo-updates otherwise. Force one only when debugging the reload itself."
4290
4659
  ),
4291
- wait: z19.boolean().optional().describe("Wait for the app to come back before returning. Default true \u2014 turn off for fire-and-forget."),
4292
- timeoutMs: z19.number().optional().describe("How long to wait for the app to reconnect, in ms. Default 30000."),
4293
- deviceId: z19.string().optional().describe('Target device id (auto-selected if one is connected). Use "All" to reload every connected app.')
4660
+ wait: z20.boolean().optional().describe("Wait for the app to come back before returning. Default true \u2014 turn off for fire-and-forget."),
4661
+ timeoutMs: z20.number().optional().describe("How long to wait for the app to reconnect, in ms. Default 30000."),
4662
+ deviceId: z20.string().optional().describe('Target device id (auto-selected if one is connected). Use "All" to reload every connected app.')
4294
4663
  }
4295
4664
  },
4296
4665
  async (args) => {
@@ -4332,28 +4701,28 @@ function registerReloadTools(server, sync) {
4332
4701
  }
4333
4702
  const via = recovered ? ` via the dev server (the app was unresponsive \u2014 its own reload could not be reached)` : ack?.strategy ? ` via ${ack.strategy}` : "";
4334
4703
  if (args.wait === false) {
4335
- return text17(`Reload requested${via}. The app is restarting \u2014 its in-memory state is gone; re-read anything you cached.`);
4704
+ return text18(`Reload requested${via}. The app is restarting \u2014 its in-memory state is gone; re-read anything you cached.`);
4336
4705
  }
4337
4706
  const elapsed = await waitForAppBack(sync, target, args.timeoutMs ?? DEFAULT_WAIT_MS, previousRealm);
4338
4707
  if (elapsed == null) {
4339
- return fail19(
4708
+ return fail20(
4340
4709
  `Reload was accepted${via}, but the app hasn't reconnected yet. It may still be building the bundle (a cold Metro rebuild can take a while) \u2014 check the device, then run list_devices.`
4341
4710
  );
4342
4711
  }
4343
- return text17(
4712
+ return text18(
4344
4713
  `Reloaded the app${via} \u2014 back and connected after ${(elapsed / 1e3).toFixed(1)}s. All in-memory state was reset, so re-read any state you cached before this.`
4345
4714
  );
4346
4715
  } catch (e) {
4347
- return fail19(errMsg19(e));
4716
+ return fail20(errMsg19(e));
4348
4717
  }
4349
4718
  }
4350
4719
  );
4351
4720
  }
4352
4721
 
4353
4722
  // src/tools/packs/triage.ts
4354
- import { z as z20 } from "zod";
4355
- var text18 = (s) => ({ content: [{ type: "text", text: s }] });
4356
- var fail20 = (message) => ({
4723
+ import { z as z21 } from "zod";
4724
+ var text19 = (s) => ({ content: [{ type: "text", text: s }] });
4725
+ var fail21 = (message) => ({
4357
4726
  isError: true,
4358
4727
  content: [{ type: "text", text: message }]
4359
4728
  });
@@ -4388,9 +4757,9 @@ async function otherBackends(sync, target, opts) {
4388
4757
  return notes.length ? `
4389
4758
  ${notes.join(" \xB7 ")} \u2014 read with get_storage` : "";
4390
4759
  }
4391
- async function section(title, run) {
4760
+ async function section(title, run2) {
4392
4761
  try {
4393
- const body = await run();
4762
+ const body = await run2();
4394
4763
  return body ? `${title}
4395
4764
  ${body}` : null;
4396
4765
  } catch (e) {
@@ -4409,7 +4778,7 @@ function registerTriageTools(server, sync) {
4409
4778
  {
4410
4779
  description: "START HERE when debugging a running app. One call = the app's current runtime state: connected device, recent console errors (including [FATAL] crashes), recent network requests with statuses, persisted storage values, and what's on screen right now. Use it as the first step for ANY 'why is the app doing X' question \u2014 it is far cheaper than calling get_console + get_network_requests + get_storage + describe_screen separately, and it tells you which of those to drill into next. If the app has crashed it says so and shows the crash. Requires Buoy Pro.",
4411
4780
  inputSchema: {
4412
- deviceId: z20.string().optional().describe("Target device id (auto-selected if one is connected).")
4781
+ deviceId: z21.string().optional().describe("Target device id (auto-selected if one is connected).")
4413
4782
  }
4414
4783
  },
4415
4784
  async (args) => {
@@ -4516,7 +4885,7 @@ _Values: get_storage includeValues:true_`;
4516
4885
 
4517
4886
  \u{1F6D1} ${sync.unresponsiveNote(target)}` : "";
4518
4887
  const body = [consoleSec, netSec, storeSec, screenSec].filter(Boolean).join("\n\n");
4519
- return text18(
4888
+ return text19(
4520
4889
  `${head}${banner}
4521
4890
 
4522
4891
  ${body}
@@ -4524,18 +4893,18 @@ ${body}
4524
4893
  _Drill in with get_console, get_network_requests (includeBodies:true for response bodies), get_storage (includeValues:true), describe_screen._`
4525
4894
  );
4526
4895
  } catch (e) {
4527
- return fail20(errMsg20(e));
4896
+ return fail21(errMsg20(e));
4528
4897
  }
4529
4898
  }
4530
4899
  );
4531
4900
  }
4532
4901
 
4533
4902
  // src/tools/packs/flow.ts
4534
- import { z as z21 } from "zod";
4903
+ import { z as z22 } from "zod";
4535
4904
  var UI_TOOL_ID = "highlight-updates";
4536
4905
  var APP_TOOL_ID2 = "app";
4537
- var text19 = (s) => ({ content: [{ type: "text", text: s }] });
4538
- var fail21 = (message) => ({
4906
+ var text20 = (s) => ({ content: [{ type: "text", text: s }] });
4907
+ var fail22 = (message) => ({
4539
4908
  isError: true,
4540
4909
  content: [{ type: "text", text: message }]
4541
4910
  });
@@ -4556,19 +4925,19 @@ function formatElement2(e) {
4556
4925
  const display = e.text ?? e.label;
4557
4926
  return `${e.interactive ? "\u2022 " : " "}${e.name}${display ? ` "${display}"` : ""}${e.testID ? ` [testID=${e.testID}]` : ""}`;
4558
4927
  }
4559
- var stepSchema = z21.object({
4560
- tap: z21.string().optional().describe("Tap this element: exact testID, or fuzzy visible text."),
4561
- longPress: z21.boolean().optional().describe("Make `tap` a long-press instead."),
4562
- type: z21.string().optional().describe("Text to type (needs `into`)."),
4563
- into: z21.string().optional().describe("Target text input for `type`: testID or fuzzy text."),
4564
- set: z21.union([z21.number(), z21.boolean()]).optional().describe("Set a toggle (true/false) or slider (number) \u2014 pair with `tap` as the target."),
4565
- reload: z21.boolean().optional().describe("Reload the JS bundle before this step's action."),
4566
- waitMs: z21.number().min(0).max(3e4).optional().describe("Fixed pause after the action, in ms (max 30000)."),
4567
- waitFor: z21.string().optional().describe("Wait until an element matching this appears (default 5s)."),
4568
- waitGone: z21.string().optional().describe("Wait until no element matches this (default 5s)."),
4569
- expect: z21.string().optional().describe("Assert an element matching this IS on screen (waits up to 2s for it); fails the flow if not."),
4570
- expectGone: z21.string().optional().describe("Assert nothing matches this (waits up to 2s for it to go); fails the flow if something does."),
4571
- timeoutMs: z21.number().min(0).max(6e4).optional().describe("Budget for this step's waitFor/waitGone/expect, max 60000. Default 5000 (2000 for expect).")
4928
+ var stepSchema = z22.object({
4929
+ tap: z22.string().optional().describe("Tap this element: exact testID, or fuzzy visible text."),
4930
+ longPress: z22.boolean().optional().describe("Make `tap` a long-press instead."),
4931
+ type: z22.string().optional().describe("Text to type (needs `into`)."),
4932
+ into: z22.string().optional().describe("Target text input for `type`: testID or fuzzy text."),
4933
+ set: z22.union([z22.number(), z22.boolean()]).optional().describe("Set a toggle (true/false) or slider (number) \u2014 pair with `tap` as the target."),
4934
+ reload: z22.boolean().optional().describe("Reload the JS bundle before this step's action."),
4935
+ waitMs: z22.number().min(0).max(3e4).optional().describe("Fixed pause after the action, in ms (max 30000)."),
4936
+ waitFor: z22.string().optional().describe("Wait until an element matching this appears (default 5s)."),
4937
+ waitGone: z22.string().optional().describe("Wait until no element matches this (default 5s)."),
4938
+ expect: z22.string().optional().describe("Assert an element matching this IS on screen (waits up to 2s for it); fails the flow if not."),
4939
+ expectGone: z22.string().optional().describe("Assert nothing matches this (waits up to 2s for it to go); fails the flow if something does."),
4940
+ timeoutMs: z22.number().min(0).max(6e4).optional().describe("Budget for this step's waitFor/waitGone/expect, max 60000. Default 5000 (2000 for expect).")
4572
4941
  }).describe("One flow step. Order within a step: reload \u2192 tap/type/set \u2192 waitMs \u2192 waitFor/waitGone \u2192 expect.");
4573
4942
  function registerFlowTools(server, sync) {
4574
4943
  server.registerTool(
@@ -4576,10 +4945,10 @@ function registerFlowTools(server, sync) {
4576
4945
  {
4577
4946
  description: "Run a scripted sequence of UI interactions in ONE call and report what happened: per-step results, the final screen, plus the network requests and console errors the flow produced. Use this instead of alternating describe_screen/tap_element \u2014 reproducing a bug ('open cart, checkout, submit') or verifying a fix after an edit is one call, not a dozen. Steps run in order and stop at the first failure, returning the screen at that point so you can see WHERE it broke. Each step can tap, type, set a toggle/slider, reload, wait for an element, and assert. Requires Buoy Pro.",
4578
4947
  inputSchema: {
4579
- steps: z21.array(stepSchema).min(1).describe("Steps to run, in order."),
4580
- include: z21.enum(["all", "screen", "none"]).optional().describe("What to report after the flow: 'all' (default) = final screen + network/console produced by the flow; 'screen' = final screen only; 'none' = step results only."),
4581
- continueOnFailure: z21.boolean().optional().describe("Keep going after a failed step instead of stopping. Default false."),
4582
- deviceId: z21.string().optional().describe("Target device id (auto-selected if one is connected).")
4948
+ steps: z22.array(stepSchema).min(1).describe("Steps to run, in order."),
4949
+ include: z22.enum(["all", "screen", "none"]).optional().describe("What to report after the flow: 'all' (default) = final screen + network/console produced by the flow; 'screen' = final screen only; 'none' = step results only."),
4950
+ continueOnFailure: z22.boolean().optional().describe("Keep going after a failed step instead of stopping. Default false."),
4951
+ deviceId: z22.string().optional().describe("Target device id (auto-selected if one is connected).")
4583
4952
  }
4584
4953
  },
4585
4954
  async (args) => {
@@ -4803,9 +5172,9 @@ ${shown.map(formatElement2).join("\n")}`
4803
5172
  }
4804
5173
  }
4805
5174
  }
4806
- return text19(parts.join("\n\n"));
5175
+ return text20(parts.join("\n\n"));
4807
5176
  } catch (e) {
4808
- return fail21(errMsg21(e));
5177
+ return fail22(errMsg21(e));
4809
5178
  }
4810
5179
  }
4811
5180
  );
@@ -4826,10 +5195,10 @@ var cap2 = (s, n = 160) => s.length > n ? `${s.slice(0, n)}\u2026` : s;
4826
5195
  var firstLines = (s, n = 3) => s.split("\n").map((l) => l.trim()).filter(Boolean).slice(0, n).join(" \u23CE ");
4827
5196
 
4828
5197
  // src/tools/packs/renders.ts
4829
- import { z as z22 } from "zod";
5198
+ import { z as z23 } from "zod";
4830
5199
  var UI_TOOL_ID2 = "highlight-updates";
4831
- var text20 = (s) => ({ content: [{ type: "text", text: s }] });
4832
- var fail22 = (message) => ({
5200
+ var text21 = (s) => ({ content: [{ type: "text", text: s }] });
5201
+ var fail23 = (message) => ({
4833
5202
  isError: true,
4834
5203
  content: [{ type: "text", text: message }]
4835
5204
  });
@@ -4839,12 +5208,12 @@ var DEFAULT_IDLE_MS = 3e3;
4839
5208
  var SETTLE_MS = 400;
4840
5209
  var DEFAULT_TOP = 12;
4841
5210
  var lastCapture = /* @__PURE__ */ new Map();
4842
- var stepSchema2 = z22.object({
4843
- tap: z22.string().optional().describe("Tap this element: exact testID, or fuzzy visible text."),
4844
- type: z22.string().optional().describe("Text to type (needs `into`)."),
4845
- into: z22.string().optional().describe("Target text input for `type`: testID or fuzzy text."),
4846
- waitMs: z22.number().min(0).max(1e4).optional().describe("Pause after the action, in ms."),
4847
- repeat: z22.number().min(1).max(20).optional().describe("Do this step N times (default 1). Useful for 'tap it five times'.")
5211
+ var stepSchema2 = z23.object({
5212
+ tap: z23.string().optional().describe("Tap this element: exact testID, or fuzzy visible text."),
5213
+ type: z23.string().optional().describe("Text to type (needs `into`)."),
5214
+ into: z23.string().optional().describe("Target text input for `type`: testID or fuzzy text."),
5215
+ waitMs: z23.number().min(0).max(1e4).optional().describe("Pause after the action, in ms."),
5216
+ repeat: z23.number().min(1).max(20).optional().describe("Do this step N times (default 1). Useful for 'tap it five times'.")
4848
5217
  }).describe("One interaction to measure. Keep it to the thing you're asking about.");
4849
5218
  function selector2(needle) {
4850
5219
  return /\s/.test(needle) ? { query: needle } : { testID: needle, query: needle };
@@ -4937,14 +5306,14 @@ function registerRenderTools(server, sync) {
4937
5306
  {
4938
5307
  description: "Find out WHAT re-rendered on the current screen and WHY, in one call \u2014 no test route, no scaffolding. THE tool for 'this page is slow/laggy/janky', 'typing lags', 'the whole page re-renders when I tap one button'. Give it `steps` to measure a specific interaction (tap a button, type in a field) \u2014 measuring an idle window instead tells you nothing about what taps cost, which is how re-render fixes usually go wrong. Returns per-component render COST in ms (sorted by it \u2014 a component rendering 40x for 0.4ms is noise, one rendering 4x for 38ms is the answer), the CAUSE of each (parent cascade / own state / changed props), which parent dragged it along, and which props changed. `wasted` counts renders that produced nothing new \u2014 that's the removable part. AFTER YOU EDIT, call it again with the same steps and compareToPrevious:true to prove the fix landed and didn't move the cost somewhere else. (For choosing between several implementations of a screen, use run_benchmark_batch instead \u2014 that ranks variants; this explains one screen.) Requires Buoy Pro and @buoy-gg/highlight-updates.",
4939
5308
  inputSchema: {
4940
- steps: z22.array(stepSchema2).max(20).optional().describe(
5309
+ steps: z23.array(stepSchema2).max(20).optional().describe(
4941
5310
  "The interaction to measure, e.g. [{tap:'favorite-deal-2', repeat:5}] or [{type:'bench', into:'deals-search'}]. Omit to sample the screen idle \u2014 only useful for churn that happens with nobody touching it."
4942
5311
  ),
4943
- idleMs: z22.number().min(500).max(2e4).optional().describe(`Idle sample length when no steps are given. Default ${DEFAULT_IDLE_MS}.`),
4944
- label: z22.string().optional().describe('Name this measurement, e.g. "before fix". Shown in the next comparison.'),
4945
- compareToPrevious: z22.boolean().optional().describe("Diff against the previous measure_renders on this device. Use after an edit to prove the fix."),
4946
- top: z22.number().min(1).max(40).optional().describe(`Components to list. Default ${DEFAULT_TOP}.`),
4947
- deviceId: z22.string().optional().describe("Target device id (auto-selected if one is connected).")
5312
+ idleMs: z23.number().min(500).max(2e4).optional().describe(`Idle sample length when no steps are given. Default ${DEFAULT_IDLE_MS}.`),
5313
+ label: z23.string().optional().describe('Name this measurement, e.g. "before fix". Shown in the next comparison.'),
5314
+ compareToPrevious: z23.boolean().optional().describe("Diff against the previous measure_renders on this device. Use after an edit to prove the fix."),
5315
+ top: z23.number().min(1).max(40).optional().describe(`Components to list. Default ${DEFAULT_TOP}.`),
5316
+ deviceId: z23.string().optional().describe("Target device id (auto-selected if one is connected).")
4948
5317
  }
4949
5318
  },
4950
5319
  async (args) => {
@@ -4953,18 +5322,18 @@ function registerRenderTools(server, sync) {
4953
5322
  const device = sync.connectedDevices().find((d) => d.deviceId === target);
4954
5323
  const uiTool = (device?.tools ?? []).find((t) => t.toolId === UI_TOOL_ID2);
4955
5324
  if (!uiTool) {
4956
- return fail22(
5325
+ return fail23(
4957
5326
  "This app doesn't expose the highlight-updates tool, so renders can't be measured. Install @buoy-gg/highlight-updates."
4958
5327
  );
4959
5328
  }
4960
5329
  if (!(uiTool.actions ?? []).includes("beginMeasurement")) {
4961
- return fail22(
5330
+ return fail23(
4962
5331
  "This app's @buoy-gg/highlight-updates is too old to measure renders (needs the version with beginMeasurement). Upgrade it, then try again. Meanwhile run_benchmark_batch with captureRenders can still give counts if you have a test route."
4963
5332
  );
4964
5333
  }
4965
5334
  const began = await sync.callAction(UI_TOOL_ID2, "beginMeasurement", {}, target);
4966
5335
  if (began && began.ok === false) {
4967
- return fail22(`Can't measure renders: ${began.reason ?? "capture unavailable"}`);
5336
+ return fail23(`Can't measure renders: ${began.reason ?? "capture unavailable"}`);
4968
5337
  }
4969
5338
  await delay5(SETTLE_MS);
4970
5339
  const startedAt = Date.now();
@@ -5009,7 +5378,7 @@ function registerRenderTools(server, sync) {
5009
5378
  const ended = await sync.callAction(UI_TOOL_ID2, "endMeasurement", {}, target);
5010
5379
  const summary = ended?.summary;
5011
5380
  if (!summary) {
5012
- return fail22(
5381
+ return fail23(
5013
5382
  "The capture window closed without returning anything. If the app reloaded mid-measurement, try again."
5014
5383
  );
5015
5384
  }
@@ -5034,9 +5403,9 @@ function registerRenderTools(server, sync) {
5034
5403
  } else if (!args.compareToPrevious) {
5035
5404
  parts.push("", "_Fixed something? Call this again with the same steps and `compareToPrevious:true` to prove it landed._");
5036
5405
  }
5037
- return text20(parts.join("\n"));
5406
+ return text21(parts.join("\n"));
5038
5407
  } catch (e) {
5039
- return fail22(errMsg22(e));
5408
+ return fail23(errMsg22(e));
5040
5409
  }
5041
5410
  }
5042
5411
  );
@@ -5044,7 +5413,7 @@ function registerRenderTools(server, sync) {
5044
5413
 
5045
5414
  // src/verify/editWatcher.ts
5046
5415
  import fs3 from "fs";
5047
- import path3 from "path";
5416
+ import path4 from "path";
5048
5417
  var WATCHED_EXT = /* @__PURE__ */ new Set([
5049
5418
  ".ts",
5050
5419
  ".tsx",
@@ -5093,8 +5462,8 @@ var EditWatcher = class {
5093
5462
  (_event, filename) => {
5094
5463
  if (!filename) return;
5095
5464
  const rel2 = String(filename);
5096
- if (rel2.split(path3.sep).some((seg) => IGNORED_DIRS.has(seg))) return;
5097
- if (!WATCHED_EXT.has(path3.extname(rel2))) return;
5465
+ if (rel2.split(path4.sep).some((seg) => IGNORED_DIRS.has(seg))) return;
5466
+ if (!WATCHED_EXT.has(path4.extname(rel2))) return;
5098
5467
  this.noteEdit(rel2);
5099
5468
  }
5100
5469
  );
@@ -5194,6 +5563,19 @@ requests the DEVELOPER kept: those are snapshots that outlive Clear, the 500-req
5194
5563
  restarts, so treat a pinned request as "a human flagged this as the problem". \`network_action\`
5195
5564
  pins/saves one \u2014 pin the failing call you want a human to see, or keep one before the log rolls over.
5196
5565
 
5566
+ Testing anything that opens a CAMERA \u2014 a QR/barcode scanner, document capture, an avatar
5567
+ picker? The iOS Simulator has no camera, so those screens normally cannot be exercised at
5568
+ all. \`camera_source\` gives it one: \`barcode\` generates the code from text you supply
5569
+ (pdf417 is what a driver's licence carries), \`image\`/\`video\` play a file, \`screen\` points
5570
+ the phone at this Mac. \`camera_devices\` lists the booted simulators and their apps when
5571
+ you need a bundle id; \`camera_inputs\` lists this Mac's cameras and windows when you need
5572
+ one of those ids. Then \`camera_launch\` to relaunch the app with it attached \u2014 a camera
5573
+ can only be attached at process start \u2014 or \`camera_zero_setup\` when something else starts
5574
+ the app. \`camera_status\` shows what is being decoded right now, which separates "the
5575
+ scanner is broken" from "it never saw the code", \`camera_diagnose\` says why when nothing
5576
+ works, and \`camera_stop\` turns it off when you are done. These need no device connection
5577
+ and no Buoy integration in the app.
5578
+
5197
5579
  Need to SEE a component (verify a UI change, check styling/layout)? Use \`screenshot_component\` with
5198
5580
  a testID/name \u2014 it locates the live component on-device and returns a cropped screenshot inline.
5199
5581
  iOS Simulator only, and only works when this MCP server runs on the same Mac as the booted Simulator.
@@ -5310,6 +5692,7 @@ function createMcpServer(sync) {
5310
5692
  registerTimeMachineTools(server, sync);
5311
5693
  registerScenariosTools(server, sync);
5312
5694
  registerScreenshotTools(server, sync);
5695
+ registerCameraTools(server);
5313
5696
  registerInteractTools(server, sync);
5314
5697
  registerJsThreadTools(server, sync);
5315
5698
  registerImagesTools(server, sync);
@@ -5318,7 +5701,7 @@ function createMcpServer(sync) {
5318
5701
  return server;
5319
5702
  }
5320
5703
  var deviceIdField = {
5321
- deviceId: z23.string().optional().describe(
5704
+ deviceId: z24.string().optional().describe(
5322
5705
  'Target device id (from list_devices). Omit to auto-select when exactly one device is connected. Use "All" to broadcast.'
5323
5706
  )
5324
5707
  };
@@ -5326,8 +5709,8 @@ var deviceIdField = {
5326
5709
  // src/init.ts
5327
5710
  import { spawnSync } from "child_process";
5328
5711
  import fs4 from "fs";
5329
- import os3 from "os";
5330
- import path4 from "path";
5712
+ import os4 from "os";
5713
+ import path5 from "path";
5331
5714
  function defaultEnv() {
5332
5715
  return { BUOY_VERIFY: "auto" };
5333
5716
  }
@@ -5335,19 +5718,19 @@ var PUBLIC_REGISTRY = "https://registry.npmjs.org";
5335
5718
  var PROBE_TIMEOUT_MS3 = 3e3;
5336
5719
  function runInit(opts = {}) {
5337
5720
  const cwd = opts.cwd ?? process.cwd();
5338
- const skillSrcDir = opts.skillSrcDir ?? path4.resolve(__dirname, "../skill");
5721
+ const skillSrcDir = opts.skillSrcDir ?? path5.resolve(__dirname, "../skill");
5339
5722
  const log = opts.log ?? ((m) => process.stdout.write(m + "\n"));
5340
5723
  const entry = resolveEntry(opts, log);
5341
5724
  const done = [];
5342
- upsertMcpConfig(path4.join(cwd, ".mcp.json"), "mcpServers", entry, cwd, done);
5343
- fs4.mkdirSync(path4.join(cwd, ".cursor"), { recursive: true });
5344
- upsertMcpConfig(path4.join(cwd, ".cursor", "mcp.json"), "mcpServers", entry, cwd, done);
5345
- if (fs4.existsSync(path4.join(cwd, ".vscode"))) {
5346
- upsertMcpConfig(path4.join(cwd, ".vscode", "mcp.json"), "servers", entry, cwd, done);
5725
+ upsertMcpConfig(path5.join(cwd, ".mcp.json"), "mcpServers", entry, cwd, done);
5726
+ fs4.mkdirSync(path5.join(cwd, ".cursor"), { recursive: true });
5727
+ upsertMcpConfig(path5.join(cwd, ".cursor", "mcp.json"), "mcpServers", entry, cwd, done);
5728
+ if (fs4.existsSync(path5.join(cwd, ".vscode"))) {
5729
+ upsertMcpConfig(path5.join(cwd, ".vscode", "mcp.json"), "servers", entry, cwd, done);
5347
5730
  }
5348
5731
  installSkills(skillSrcDir, cwd, done);
5349
- appendDebuggingGuide(path4.join(cwd, "CLAUDE.md"), cwd, done);
5350
- appendDebuggingGuide(path4.join(cwd, "AGENTS.md"), cwd, done);
5732
+ appendDebuggingGuide(path5.join(cwd, "CLAUDE.md"), cwd, done);
5733
+ appendDebuggingGuide(path5.join(cwd, "AGENTS.md"), cwd, done);
5351
5734
  log("Buoy MCP installed:");
5352
5735
  for (const line of done) log(" \u2022 " + line);
5353
5736
  log("");
@@ -5389,11 +5772,11 @@ function npxEntry() {
5389
5772
  return { type: "stdio", command: "npx", args: ["-y", `${PACKAGE_NAME}@latest`], env: defaultEnv() };
5390
5773
  }
5391
5774
  function localEntry(opts, log) {
5392
- const installDir = opts.installDir ?? process.env.BUOY_MCP_HOME ?? path4.join(os3.homedir(), ".buoy-mcp");
5775
+ const installDir = opts.installDir ?? process.env.BUOY_MCP_HOME ?? path5.join(os4.homedir(), ".buoy-mcp");
5393
5776
  const registry = opts.registry ?? PUBLIC_REGISTRY;
5394
- const cliPath = installLocalCopy(installDir, registry, log);
5395
- if (cliPath) {
5396
- return { type: "stdio", command: "node", args: [cliPath], env: defaultEnv() };
5777
+ const cliPath2 = installLocalCopy(installDir, registry, log);
5778
+ if (cliPath2) {
5779
+ return { type: "stdio", command: "node", args: [cliPath2], env: defaultEnv() };
5397
5780
  }
5398
5781
  log("\u26A0 local install failed \u2014 writing the npx entry instead (see the error above).");
5399
5782
  return npxEntry();
@@ -5423,12 +5806,12 @@ function installLocalCopy(installDir, registry, log) {
5423
5806
  log(`\u26A0 npm install exited with code ${res.status ?? "?"}${res.error ? ` (${res.error.message})` : ""}.`);
5424
5807
  return null;
5425
5808
  }
5426
- const cliPath = path4.join(installDir, "node_modules", PACKAGE_NAME, "dist", "cli.js");
5427
- if (!fs4.existsSync(cliPath)) {
5428
- log(`\u26A0 install finished but ${cliPath} is missing.`);
5809
+ const cliPath2 = path5.join(installDir, "node_modules", PACKAGE_NAME, "dist", "cli.js");
5810
+ if (!fs4.existsSync(cliPath2)) {
5811
+ log(`\u26A0 install finished but ${cliPath2} is missing.`);
5429
5812
  return null;
5430
5813
  }
5431
- return cliPath;
5814
+ return cliPath2;
5432
5815
  }
5433
5816
  function probeRegistry() {
5434
5817
  const registry = effectiveRegistry();
@@ -5485,7 +5868,7 @@ function upsertMcpConfig(file, key, entry, cwd, done) {
5485
5868
  json3 = {};
5486
5869
  }
5487
5870
  } else {
5488
- fs4.mkdirSync(path4.dirname(file), { recursive: true });
5871
+ fs4.mkdirSync(path5.dirname(file), { recursive: true });
5489
5872
  }
5490
5873
  const servers = json3[key] && typeof json3[key] === "object" ? json3[key] : {};
5491
5874
  const existed = "buoy" in servers;
@@ -5576,29 +5959,29 @@ function installSkills(skillSrcDir, cwd, done) {
5576
5959
  done.push("\u26A0 no bundled skills found \u2014 skipped");
5577
5960
  return;
5578
5961
  }
5579
- const skills = fs4.readdirSync(skillSrcDir, { withFileTypes: true }).filter((e) => e.isDirectory() && fs4.existsSync(path4.join(skillSrcDir, e.name, "SKILL.md")));
5962
+ const skills = fs4.readdirSync(skillSrcDir, { withFileTypes: true }).filter((e) => e.isDirectory() && fs4.existsSync(path5.join(skillSrcDir, e.name, "SKILL.md")));
5580
5963
  if (skills.length === 0) {
5581
5964
  done.push("\u26A0 no skills with a SKILL.md found \u2014 skipped");
5582
5965
  return;
5583
5966
  }
5584
5967
  for (const skill of skills) {
5585
- const from = path4.join(skillSrcDir, skill.name);
5586
- const to = path4.join(cwd, ".claude", "skills", skill.name);
5968
+ const from = path5.join(skillSrcDir, skill.name);
5969
+ const to = path5.join(cwd, ".claude", "skills", skill.name);
5587
5970
  copyDir(from, to);
5588
- done.push(`installed the ${skill.name} skill \u2192 ${rel(path4.join(to, "SKILL.md"), cwd)}`);
5971
+ done.push(`installed the ${skill.name} skill \u2192 ${rel(path5.join(to, "SKILL.md"), cwd)}`);
5589
5972
  }
5590
5973
  }
5591
5974
  function copyDir(from, to) {
5592
5975
  fs4.mkdirSync(to, { recursive: true });
5593
5976
  for (const entry of fs4.readdirSync(from, { withFileTypes: true })) {
5594
- const s = path4.join(from, entry.name);
5595
- const d = path4.join(to, entry.name);
5977
+ const s = path5.join(from, entry.name);
5978
+ const d = path5.join(to, entry.name);
5596
5979
  if (entry.isDirectory()) copyDir(s, d);
5597
5980
  else fs4.copyFileSync(s, d);
5598
5981
  }
5599
5982
  }
5600
5983
  function rel(file, cwd) {
5601
- const r = path4.relative(cwd, file);
5984
+ const r = path5.relative(cwd, file);
5602
5985
  return r && !r.startsWith("..") ? r : file;
5603
5986
  }
5604
5987