dsh-browser-cdp 0.17.23 → 0.17.25

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/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as launchLocalBrowser, s as stopLocalBrowser } from "./launcher-DBaxfIsF.js";
1
+ import { f as stopLocalBrowser, l as launchLocalBrowser } from "./launcher-BadIUjAx.js";
2
2
  import { defineTool } from "@deepseek-ai/dsh-tools";
3
3
  import { constants, createReadStream, createWriteStream, existsSync, readdirSync } from "node:fs";
4
4
  import { homedir, tmpdir } from "node:os";
@@ -792,6 +792,60 @@ async function discoverWebSocketUrl(raw, options = {}) {
792
792
  }
793
793
  }
794
794
 
795
+ //#endregion
796
+ //#region src/cdp/capabilities.ts
797
+ /**
798
+ * Recognize the engine from `/json/version`'s `Browser` field
799
+ * (`"Lightpanda/0.4.1"`, `"Chrome/153.0.0.0"`, `"Edg/153.0.0.0"`, …).
800
+ * Empty or unrecognized → `'unknown'` (never guesses).
801
+ */
802
+ function engineOf(browserField) {
803
+ const value = typeof browserField === "string" ? browserField.trim() : "";
804
+ if (value === "") return "unknown";
805
+ if (value.startsWith("Lightpanda/")) return "lightpanda";
806
+ if (value.startsWith("Chrome/") || value.startsWith("Chromium")) return "chrome";
807
+ if (value.startsWith("Edg/") || value.startsWith("Microsoft Edge ")) return "chrome";
808
+ return "unknown";
809
+ }
810
+ const FULL = {
811
+ engine: "chrome",
812
+ screencast: true,
813
+ overlay: true,
814
+ bindingCalled: true,
815
+ imageFormat: "jpeg",
816
+ loadEvent: true,
817
+ downloadEvents: true,
818
+ browserClose: true
819
+ };
820
+ /**
821
+ * The capability projection per engine. `chrome` / `unknown` → full
822
+ * capabilities (bit-for-bit today's behavior); `lightpanda` → the analysis
823
+ * (docs/plans/2026-10-04-lightpanda-backend-analysis.md §7) projection.
824
+ */
825
+ function capabilitiesFor(engine) {
826
+ if (engine === "lightpanda") return {
827
+ engine: "lightpanda",
828
+ screencast: false,
829
+ overlay: false,
830
+ bindingCalled: false,
831
+ imageFormat: "png",
832
+ loadEvent: false,
833
+ downloadEvents: false,
834
+ browserClose: false
835
+ };
836
+ return {
837
+ ...FULL,
838
+ engine
839
+ };
840
+ }
841
+ /**
842
+ * Env key the host half sets when spawning the cast / render workers
843
+ * (mirrors `EGO_LINUX_CDP_URL`'s injection pattern in cast-server). The child
844
+ * processes cannot see the host's attach cache, so the projected engine id
845
+ * travels as data — the host decides once, children only read.
846
+ */
847
+ const BCDP_CDP_ENGINE = "BCDP_CDP_ENGINE";
848
+
795
849
  //#endregion
796
850
  //#region src/cdp/cli-link.ts
797
851
  /** Upstream's own macOS location for the real CLI (verbatim, from its e2e runner). */
@@ -1102,6 +1156,14 @@ const EGO_CLI_KIND = "ego-cli";
1102
1156
  /** Default panel label for an ego-cli link (no endpoint to fall back to). */
1103
1157
  const EGO_CLI_LABEL = "本机 ego CLI";
1104
1158
  /**
1159
+ * Lightpanda backend — the managed-serve link kind (headless quick-trial
1160
+ * engine; headed kinds are the manual-fallback backstop). Local-only
1161
+ * singleton, same rules as `ego-cli`.
1162
+ */
1163
+ const LP_KIND = "lightpanda";
1164
+ /** Default panel label for a lightpanda link. */
1165
+ const LP_LABEL = "Lightpanda(受管)";
1166
+ /**
1105
1167
  * Build a stable target id. `randomUUID` is available on every supported
1106
1168
  * host (Node >= 22); the fallback exists only because cheap and steady beats
1107
1169
  * clever in a hot path that also runs inside tests.
@@ -1131,6 +1193,15 @@ function coerceLink(raw) {
1131
1193
  ...rec.useSdkPath === void 0 ? {} : { useSdkPath: Boolean(rec.useSdkPath) }
1132
1194
  };
1133
1195
  }
1196
+ if (rec.kind === LP_KIND) {
1197
+ const servePath = typeof rec.servePath === "string" ? rec.servePath.trim() : "";
1198
+ return {
1199
+ ...base,
1200
+ kind: LP_KIND,
1201
+ label: label === "" ? LP_LABEL : label,
1202
+ servePath
1203
+ };
1204
+ }
1134
1205
  const endpoint = normalizeEndpoint(rec.endpoint);
1135
1206
  if (!endpoint.ok) return null;
1136
1207
  return {
@@ -1144,21 +1215,24 @@ function coerceLink(raw) {
1144
1215
  * Sanitize the persisted sequence. Dirty data is expected here (a hand-edited
1145
1216
  * profile config on the settings page, older schema, unknown keys) so the rule
1146
1217
  * is DROP, never throw: every surviving entry is usable, duplicate ids get
1147
- * fresh ones so ordering/activation stay unambiguous, and the `ego-cli`
1148
- * singleton keeps the FIRST entry (dropping the rest and counting them for the
1149
- * doctor).
1218
+ * fresh ones so ordering/activation stay unambiguous, and the `ego-cli` /
1219
+ * `lightpanda` singletons keep the FIRST entry of their kind (dropping the
1220
+ * rest and counting them for the doctor).
1150
1221
  */
1151
1222
  function sanitizeLinks(raw, max = MAX_TARGETS) {
1152
1223
  if (!Array.isArray(raw)) return {
1153
1224
  links: [],
1154
1225
  droppedEgoCli: 0,
1226
+ droppedLightpanda: 0,
1155
1227
  droppedInvalid: 0
1156
1228
  };
1157
1229
  const out = [];
1158
1230
  const seen = /* @__PURE__ */ new Set();
1159
1231
  let droppedEgoCli = 0;
1232
+ let droppedLightpanda = 0;
1160
1233
  let droppedInvalid = 0;
1161
1234
  let sawEgoCli = false;
1235
+ let sawLightpanda = false;
1162
1236
  for (const entry of raw) {
1163
1237
  const link = coerceLink(entry);
1164
1238
  if (!link) {
@@ -1172,6 +1246,13 @@ function sanitizeLinks(raw, max = MAX_TARGETS) {
1172
1246
  }
1173
1247
  sawEgoCli = true;
1174
1248
  }
1249
+ if (link.kind === LP_KIND) {
1250
+ if (sawLightpanda) {
1251
+ droppedLightpanda += 1;
1252
+ continue;
1253
+ }
1254
+ sawLightpanda = true;
1255
+ }
1175
1256
  if (seen.has(link.id)) link.id = newTargetId();
1176
1257
  seen.add(link.id);
1177
1258
  out.push(link);
@@ -1180,6 +1261,7 @@ function sanitizeLinks(raw, max = MAX_TARGETS) {
1180
1261
  return {
1181
1262
  links: out,
1182
1263
  droppedEgoCli,
1264
+ droppedLightpanda,
1183
1265
  droppedInvalid
1184
1266
  };
1185
1267
  }
@@ -1221,6 +1303,7 @@ async function probeEndpoint(endpoint, options = {}) {
1221
1303
  code: "ok",
1222
1304
  message: "",
1223
1305
  wsUrl: result.wsUrl,
1306
+ engine: engineOf(result.browser),
1224
1307
  latencyMs: result.latencyMs
1225
1308
  };
1226
1309
  }
@@ -1254,10 +1337,10 @@ function decideAttach(input) {
1254
1337
  kind: "local",
1255
1338
  message: "local mode: using local browser control"
1256
1339
  };
1257
- if (input.mode === "remote" && input.linkKind === EGO_CLI_KIND) return {
1340
+ if (input.mode === "remote" && (input.linkKind === EGO_CLI_KIND || input.linkKind === LP_KIND)) return {
1258
1341
  kind: "error",
1259
1342
  code: "mode-kind-mismatch",
1260
- message: "cdpMode=remote requires a CDP endpoint link, but the activated link is the local ego CLI. Activate a CDP link, or switch cdpMode to auto."
1343
+ message: input.linkKind === LP_KIND ? "cdpMode=remote requires a CDP endpoint link, but the activated link is the local Lightpanda serve. Activate a CDP link, or switch cdpMode to auto." : "cdpMode=remote requires a CDP endpoint link, but the activated link is the local ego CLI. Activate a CDP link, or switch cdpMode to auto."
1261
1344
  };
1262
1345
  if (input.hasActive && input.linkKind === EGO_CLI_KIND) {
1263
1346
  if (input.status === "ready") return {
@@ -1275,6 +1358,24 @@ function decideAttach(input) {
1275
1358
  message: input.message === "" ? "the local ego CLI is not available" : input.message
1276
1359
  };
1277
1360
  }
1361
+ if (input.hasActive && input.linkKind === LP_KIND) {
1362
+ if (input.status === "ready" && input.wsUrl !== "") return {
1363
+ kind: "inject",
1364
+ wsUrl: input.wsUrl,
1365
+ targetId: "",
1366
+ source: "remote"
1367
+ };
1368
+ if (input.status === "idle" || input.status === "probing") return {
1369
+ kind: "error",
1370
+ code: "endpoint-unresolved",
1371
+ message: "The Lightpanda serve has not been probed yet. Wait for the probe to finish and retry the call."
1372
+ };
1373
+ return {
1374
+ kind: "error",
1375
+ code: input.code === "" ? "lightpanda-not-ready" : input.code,
1376
+ message: input.message === "" ? "the managed Lightpanda serve is not available" : input.message
1377
+ };
1378
+ }
1278
1379
  if (input.remoteDisabled) return {
1279
1380
  kind: "error",
1280
1381
  code: "remote-disabled",
@@ -1383,6 +1484,50 @@ async function refreshCliAttach(input, cache, suggested, link, now) {
1383
1484
  });
1384
1485
  }
1385
1486
  /**
1487
+ * Lightpanda backend — ensure the managed serve for an activated `lightpanda`
1488
+ * row, then probe its endpoint. The launcher owns launch/reuse/exclusivity
1489
+ * (a live managed Chrome loses the singleton slot to the serve and vice
1490
+ * versa); `engine` is stamped from the ROW — the source the user picked — and
1491
+ * `/json/version`'s `Browser: Lightpanda/…` merely re-confirms it.
1492
+ */
1493
+ async function refreshLightpandaAttach(input, cache, suggested, link, now) {
1494
+ const base = {
1495
+ ...suggested,
1496
+ targetId: link.id,
1497
+ endpoint: "",
1498
+ wsUrl: "",
1499
+ linkKind: LP_KIND
1500
+ };
1501
+ const launch = await launchLocalBrowser({
1502
+ engine: "lightpanda",
1503
+ lightpandaPath: link.servePath ?? "",
1504
+ lightpandaArgs: input.lightpandaArgs
1505
+ }, input.launcherIo);
1506
+ if (!launch.ok) return cache.patch({
1507
+ ...base,
1508
+ status: "unreachable",
1509
+ code: launch.code,
1510
+ message: launch.message,
1511
+ resolvedAt: now()
1512
+ });
1513
+ const probe = await probeEndpoint(launch.endpoint, {
1514
+ timeoutMs: input.timeoutMs,
1515
+ now
1516
+ });
1517
+ return cache.patch({
1518
+ ...base,
1519
+ status: probe.ok && probe.wsUrl ? "ready" : "unreachable",
1520
+ endpoint: launch.endpoint,
1521
+ wsUrl: probe.wsUrl ?? "",
1522
+ engine: "lightpanda",
1523
+ code: probe.ok ? "" : probe.code,
1524
+ message: probe.ok ? launch.reused ? "lightpanda serve reused" : "lightpanda serve launched" : `lightpanda serve is up but its endpoint did not answer: ${probe.message}`,
1525
+ latencyMs: probe.latencyMs,
1526
+ resolvedAt: now(),
1527
+ endpointSource: launch.reused ? "local" : "local-launch"
1528
+ });
1529
+ }
1530
+ /**
1386
1531
  * Re-probe the activated target and publish the outcome into the cache.
1387
1532
  *
1388
1533
  * `local` mode short-circuits: there is nothing to probe and nothing to write,
@@ -1422,6 +1567,7 @@ async function refreshAttach(input) {
1422
1567
  status: "ready",
1423
1568
  endpoint: launch.endpoint,
1424
1569
  wsUrl: localProbe.wsUrl,
1570
+ engine: localProbe.engine,
1425
1571
  code: "",
1426
1572
  message: launch.reused ? "local mode: reused managed browser" : "local mode: managed browser launched",
1427
1573
  latencyMs: localProbe.latencyMs,
@@ -1430,6 +1576,7 @@ async function refreshAttach(input) {
1430
1576
  return cache.patch({
1431
1577
  ...suggested,
1432
1578
  status: "unreachable",
1579
+ engine: void 0,
1433
1580
  code: "local-launch-not-ready",
1434
1581
  message: `managed local browser launched but its endpoint did not answer: ${localProbe.message}`
1435
1582
  });
@@ -1437,6 +1584,7 @@ async function refreshAttach(input) {
1437
1584
  return cache.patch({
1438
1585
  ...suggested,
1439
1586
  status: "unreachable",
1587
+ engine: void 0,
1440
1588
  code: `local-${launch.code}`,
1441
1589
  message: launch.message
1442
1590
  });
@@ -1454,7 +1602,7 @@ async function refreshAttach(input) {
1454
1602
  message: input.remoteEnabled === false ? "remote CDP is disabled by the remoteEnabled switch; the target sequence is preserved and can be re-enabled at any time" : "no activated target in the sequence",
1455
1603
  resolvedAt: now()
1456
1604
  });
1457
- if (input.remoteEnabled === false && target.kind !== EGO_CLI_KIND) return cache.patch({
1605
+ if (input.remoteEnabled === false && target.kind !== EGO_CLI_KIND && target.kind !== LP_KIND) return cache.patch({
1458
1606
  ...suggested,
1459
1607
  status: "no-active",
1460
1608
  targetId: input.activeTargetId,
@@ -1465,6 +1613,7 @@ async function refreshAttach(input) {
1465
1613
  resolvedAt: now()
1466
1614
  });
1467
1615
  if (target.kind === EGO_CLI_KIND) return refreshCliAttach(input, cache, suggested, target, now);
1616
+ if (target.kind === LP_KIND) return refreshLightpandaAttach(input, cache, suggested, target, now);
1468
1617
  const sameTarget = previous.targetId === target.id && previous.endpoint === target.endpoint;
1469
1618
  const suggestedProbe = {
1470
1619
  ...suggested,
@@ -1485,6 +1634,7 @@ async function refreshAttach(input) {
1485
1634
  if (outcome.ok && outcome.wsUrl) return cache.patch({
1486
1635
  status: "ready",
1487
1636
  wsUrl: outcome.wsUrl,
1637
+ engine: outcome.engine,
1488
1638
  code: "",
1489
1639
  message: "",
1490
1640
  latencyMs: outcome.latencyMs,
@@ -1505,6 +1655,7 @@ async function refreshAttach(input) {
1505
1655
  if (localProbe.ok && localProbe.wsUrl) return cache.patch({
1506
1656
  status: "ready",
1507
1657
  wsUrl: localProbe.wsUrl,
1658
+ engine: localProbe.engine,
1508
1659
  endpoint: launch.endpoint,
1509
1660
  code: "",
1510
1661
  message: "local fallback launched (activated endpoint unreachable)",
@@ -1516,6 +1667,7 @@ async function refreshAttach(input) {
1516
1667
  return cache.patch({
1517
1668
  status: "unreachable",
1518
1669
  wsUrl: "",
1670
+ engine: void 0,
1519
1671
  code: "local-launch-not-ready",
1520
1672
  message: `local fallback browser launched but its endpoint did not answer: ${localProbe.message}`,
1521
1673
  latencyMs: outcome.latencyMs,
@@ -1534,6 +1686,7 @@ async function refreshAttach(input) {
1534
1686
  return cache.patch({
1535
1687
  status: "unreachable",
1536
1688
  wsUrl: "",
1689
+ engine: outcome.ok ? outcome.engine : void 0,
1537
1690
  code: outcome.code,
1538
1691
  message: outcome.message,
1539
1692
  latencyMs: outcome.latencyMs,
@@ -1545,6 +1698,8 @@ async function refreshAttach(input) {
1545
1698
  //#region src/cast-server.ts
1546
1699
  const WORKER_BIN = fileURLToPath(new URL("../bin/cdp-cast-worker.mjs", import.meta.url));
1547
1700
  let attachWsUrl = null;
1701
+ /** Lightpanda backend — engine of the attached endpoint, published next to it. */
1702
+ let attachEngine = null;
1548
1703
  /** Logger captured in initCastServer so module-level helpers can report. */
1549
1704
  let castLogger;
1550
1705
  /**
@@ -1552,17 +1707,25 @@ let castLogger;
1552
1707
  * half whenever the ACTIVATED target changes (new target, new endpoint, or
1553
1708
  * mode switching away from remote). Returns true when the value actually
1554
1709
  * changed, which is the caller's signal that the worker must be recycled.
1710
+ * The engine rides along so a spawned worker gets its capability projection
1711
+ * via env (`BCDP_CDP_ENGINE`) instead of re-deriving it.
1555
1712
  */
1556
- function setAttachEndpoint(wsUrl) {
1713
+ function setAttachEndpoint(wsUrl, engine = null) {
1557
1714
  const next = wsUrl && wsUrl !== "" ? wsUrl : null;
1558
- if (next === attachWsUrl) return false;
1715
+ const nextEngine = next === null ? null : engine;
1716
+ if (next === attachWsUrl && nextEngine === attachEngine) return false;
1559
1717
  attachWsUrl = next;
1718
+ attachEngine = nextEngine;
1560
1719
  return true;
1561
1720
  }
1562
1721
  /** The endpoint the worker should attach to right now (null = none). */
1563
1722
  function getAttachEndpoint() {
1564
1723
  return attachWsUrl;
1565
1724
  }
1725
+ /** The engine of the attached endpoint (null = none attached). */
1726
+ function getAttachEngine() {
1727
+ return attachEngine;
1728
+ }
1566
1729
  /**
1567
1730
  * Stop a running worker so the next request respawns it with the new argv
1568
1731
  * seed (T2.4: an activation change must take effect on a live panel, not only
@@ -1898,6 +2061,9 @@ function workerEnv() {
1898
2061
  const ws = getAttachEndpoint();
1899
2062
  if (ws) base[EGO_LINUX_CDP_URL] = ws;
1900
2063
  else delete base[EGO_LINUX_CDP_URL];
2064
+ const engine = getAttachEngine();
2065
+ if (engine) base[BCDP_CDP_ENGINE] = engine;
2066
+ else delete base[BCDP_CDP_ENGINE];
1901
2067
  return base;
1902
2068
  }
1903
2069
  /** Ensure a single ego-cast worker is running (idempotent). Launches it via
@@ -2398,40 +2564,75 @@ const Config$1 = z.object({
2398
2564
  githubMirror: z.string().description("HTTPS base replacing https://github.com for managed downloads.").volatile(),
2399
2565
  runtimeArgs: z.string().description("Extra args appended to the vendored runtime argv. Takes effect on the next bcdp_* call.").volatile(),
2400
2566
  chromeArgs: z.string().description("Extra args appended to the Chrome launch argv. Takes effect on the next browser cold start (the browser is a singleton).").volatile(),
2401
- links: z.array(z.union([z.object({
2402
- kind: z.string(),
2403
- id: z.string(),
2404
- label: z.string(),
2405
- endpoint: z.string(),
2406
- enabled: z.boolean(),
2407
- note: z.string(),
2408
- probeStatus: z.union([
2409
- "unknown",
2410
- "ok",
2411
- "error"
2412
- ]),
2413
- probeLatencyMs: z.number(),
2414
- probeError: z.string(),
2415
- probeCode: z.string(),
2416
- probeAt: z.number()
2417
- }), z.object({
2418
- kind: z.string(),
2419
- id: z.string(),
2420
- label: z.string(),
2421
- cliPath: z.string(),
2422
- useSdkPath: z.boolean(),
2423
- enabled: z.boolean(),
2424
- note: z.string(),
2425
- probeStatus: z.union([
2426
- "unknown",
2427
- "ok",
2428
- "error"
2429
- ]),
2430
- probeLatencyMs: z.number(),
2431
- probeError: z.string(),
2432
- probeCode: z.string(),
2433
- probeAt: z.number()
2434
- })])).description("Ordered connection sequence: CDP endpoints and (at most one) local ego CLI link. Only the ACTIVATED and enabled entry receives every bcdp_* call. Order IS the priority order.").volatile(),
2567
+ links: z.array(z.union([
2568
+ z.object({
2569
+ kind: z.string(),
2570
+ id: z.string(),
2571
+ label: z.string(),
2572
+ endpoint: z.string(),
2573
+ enabled: z.boolean(),
2574
+ note: z.string(),
2575
+ probeStatus: z.union([
2576
+ "unknown",
2577
+ "ok",
2578
+ "error"
2579
+ ]),
2580
+ probeLatencyMs: z.number(),
2581
+ probeError: z.string(),
2582
+ probeCode: z.string(),
2583
+ probeAt: z.number(),
2584
+ probeEngine: z.union([
2585
+ "chrome",
2586
+ "lightpanda",
2587
+ "unknown"
2588
+ ])
2589
+ }),
2590
+ z.object({
2591
+ kind: z.string(),
2592
+ id: z.string(),
2593
+ label: z.string(),
2594
+ cliPath: z.string(),
2595
+ useSdkPath: z.boolean(),
2596
+ enabled: z.boolean(),
2597
+ note: z.string(),
2598
+ probeStatus: z.union([
2599
+ "unknown",
2600
+ "ok",
2601
+ "error"
2602
+ ]),
2603
+ probeLatencyMs: z.number(),
2604
+ probeError: z.string(),
2605
+ probeCode: z.string(),
2606
+ probeAt: z.number(),
2607
+ probeEngine: z.union([
2608
+ "chrome",
2609
+ "lightpanda",
2610
+ "unknown"
2611
+ ])
2612
+ }),
2613
+ z.object({
2614
+ kind: z.string(),
2615
+ id: z.string(),
2616
+ label: z.string(),
2617
+ servePath: z.string(),
2618
+ enabled: z.boolean(),
2619
+ note: z.string(),
2620
+ probeStatus: z.union([
2621
+ "unknown",
2622
+ "ok",
2623
+ "error"
2624
+ ]),
2625
+ probeLatencyMs: z.number(),
2626
+ probeError: z.string(),
2627
+ probeCode: z.string(),
2628
+ probeAt: z.number(),
2629
+ probeEngine: z.union([
2630
+ "chrome",
2631
+ "lightpanda",
2632
+ "unknown"
2633
+ ])
2634
+ })
2635
+ ])).description("Ordered connection sequence: CDP endpoints and (at most one) local ego CLI link. Only the ACTIVATED and enabled entry receives every bcdp_* call. Order IS the priority order.").volatile(),
2435
2636
  activeTargetId: z.string().description("Id of the activated entry in links. Empty = nothing activated.").volatile(),
2436
2637
  cdpMode: cdpMode.description("auto = use the activated target and never start a local browser silently; remote = only ever connect to the activated target; local = always use local browser control.").volatile(),
2437
2638
  cdpProbeTimeoutMs: z.number().min(200).max(3e4).step(100).description("Timeout for one CDP endpoint probe (http endpoints answer /json/version)."),
@@ -2442,6 +2643,7 @@ const Config$1 = z.object({
2442
2643
  localHeadless: z.boolean().description("Run the locally launched browser headless."),
2443
2644
  remoteEnabled: z.boolean().description("Master switch for REMOTE attach. Off = the configured target sequence is preserved but inert (nothing probes or connects remotely); flip back on any time. Does not affect cdpMode=local.").volatile(),
2444
2645
  localUserDataDir: z.string().description("Profile dir for the locally launched browser. Empty = managed dir; never point at your daily Chrome profile."),
2646
+ lightpandaArgs: z.string().description("Extra args appended to a managed `lightpanda serve` argv. --host/--port are managed and cannot be overridden.").volatile(),
2445
2647
  castFpsCap: z.number().min(0).max(60).step(1),
2446
2648
  screencastQuality: z.number().min(1).max(100).step(1),
2447
2649
  screencastMaxWidth: z.number().min(320).max(1920).step(40),
@@ -2695,6 +2897,7 @@ function resolveConfig(config = {}) {
2695
2897
  legacyEgoToolNames: Boolean(config.legacyEgoToolNames),
2696
2898
  localHeadless: config.localHeadless === void 0 ? false : Boolean(config.localHeadless),
2697
2899
  localUserDataDir: typeof config.localUserDataDir === "string" ? config.localUserDataDir : "",
2900
+ lightpandaArgs: trimmed(config.lightpandaArgs),
2698
2901
  remoteEnabled: config.remoteEnabled === void 0 ? true : Boolean(config.remoteEnabled),
2699
2902
  jevUrl: trimmed(config.jevUrl),
2700
2903
  jevKey: trimmed(config.jevKey),
@@ -2724,7 +2927,8 @@ function normalizeProbeState(link) {
2724
2927
  probeLatencyMs: typeof link.probeLatencyMs === "number" && Number.isFinite(link.probeLatencyMs) ? link.probeLatencyMs : 0,
2725
2928
  probeError: typeof link.probeError === "string" ? link.probeError : "",
2726
2929
  probeCode: typeof link.probeCode === "string" ? link.probeCode : "",
2727
- probeAt: typeof link.probeAt === "number" && Number.isFinite(link.probeAt) ? link.probeAt : 0
2930
+ probeAt: typeof link.probeAt === "number" && Number.isFinite(link.probeAt) ? link.probeAt : 0,
2931
+ probeEngine: link.probeEngine === "chrome" || link.probeEngine === "lightpanda" ? link.probeEngine : "unknown"
2728
2932
  };
2729
2933
  }
2730
2934
 
@@ -2823,9 +3027,10 @@ function registerEgoBrowserGateway(ctx, bridge, ffmpegManager, picks) {
2823
3027
  cache: defaultAttachCache,
2824
3028
  cliIo: createSubprocessCliIo(ctx.subprocess),
2825
3029
  sdkPath: fileURLToPath(new URL("../runtime/ego-browser/dist/out/index.js", import.meta.url)),
2826
- bundledCli: fileURLToPath(new URL("../runtime/ego-linux/bin/ego-browser.mjs", import.meta.url))
3030
+ bundledCli: fileURLToPath(new URL("../runtime/ego-linux/bin/ego-browser.mjs", import.meta.url)),
3031
+ lightpandaArgs: cfg.lightpandaArgs
2827
3032
  });
2828
- if (setAttachEndpoint(attach.status === "ready" && attach.wsUrl !== "" ? attach.wsUrl : null)) recycleWorker("cdp manual refresh").catch(() => null);
3033
+ if (setAttachEndpoint(attach.status === "ready" && attach.wsUrl !== "" ? attach.wsUrl : null, attach.status === "ready" ? attach.engine ?? "unknown" : null)) recycleWorker("cdp manual refresh").catch(() => null);
2829
3034
  writeJson(res, 200, envelopeOk({ attach }));
2830
3035
  } else if (method === "cdp-probe") {
2831
3036
  const endpoint = typeof body.endpoint === "string" ? body.endpoint : "";
@@ -2935,8 +3140,8 @@ function envelopeError(code, message) {
2935
3140
  * add/change a tool, remember to sync an entry here or bcdp_help won't find it.
2936
3141
  */
2937
3142
  const EGO_HELP_INDEX = {
2938
- overview: "CDP 浏览器代理:结构化浏览器工具。导航/交互/观察/表单/网络/等待/键鼠皆有专项工具,另提供 bcdp_help(本索引)、bcdp_doctor(体检)、bcdp_cli/bcdp_script(自由脚本逃生舱)。连接与激活见 topic=links。分类见: tools / navigate / observe / input / keyboard-mouse / form / wait / network / login / script / doctor。用 `topic` 查询,或直接给工具名。",
2939
- tools: "工具清单: bcdp_status, bcdp_space_open, bcdp_space_close, bcdp_snapshot, bcdp_navigate, bcdp_click(+double), bcdp_fill, bcdp_js, bcdp_cdp, bcdp_screenshot(+selector), bcdp_page_info, bcdp_wait, bcdp_wait_for_selector, bcdp_wait_for_url, bcdp_wait_for_response, bcdp_key(+text/type), bcdp_hover, bcdp_read_element, bcdp_select, bcdp_drag, bcdp_scroll, bcdp_upload, bcdp_check, bcdp_dialog, bcdp_download, bcdp_http, bcdp_captcha, bcdp_auth_flush, bcdp_login_import, bcdp_help, bcdp_doctor, bcdp_cli, bcdp_script, bcdp_jev_status, bcdp_jev_frame, bcdp_jev_ask, bcdp_jev_run。",
3143
+ overview: "CDP 浏览器代理:结构化浏览器工具。导航/交互/观察/表单/网络/等待/键鼠皆有专项工具,另提供 bcdp_help(本索引)、bcdp_doctor(体检)、bcdp_cli/bcdp_script(自由脚本逃生舱)。连接与激活见 topic=links。分类见: tools / navigate / observe / input / keyboard-mouse / form / wait / network / login / script / doctor / lightpanda。用 `topic` 查询,或直接给工具名。",
3144
+ tools: "工具清单: bcdp_status, bcdp_space_open, bcdp_space_close, bcdp_snapshot, bcdp_navigate, bcdp_click(+double), bcdp_fill, bcdp_js, bcdp_cdp, bcdp_screenshot(+selector), bcdp_page_info, bcdp_wait, bcdp_wait_for_selector, bcdp_wait_for_url, bcdp_wait_for_response, bcdp_key(+text/type), bcdp_hover, bcdp_read_element, bcdp_select, bcdp_drag, bcdp_scroll, bcdp_upload, bcdp_check, bcdp_dialog, bcdp_download, bcdp_http, bcdp_captcha, bcdp_auth_flush, bcdp_login_import, bcdp_help, bcdp_doctor, bcdp_cli, bcdp_script, bcdp_jev_status, bcdp_jev_frame, bcdp_jev_attempt, bcdp_jev_ask, bcdp_jev_run。",
2940
3145
  links: "连接序列(设置面板):有序列表,顺序即优先级,被激活的一项驱动每一次 bcdp_* 调用。两种类型——CDP 端点(注入 EGO_LINUX_CDP_URL,指向已开调试端口的浏览器)与 本机 ego CLI(不注入端点,由本机 ego CLI 直接驱动 ego-lite 浏览器;仅限本机,全局至多一条)。cdpMode: auto=按激活项;remote=仅接受 CDP 端点;local=受管本地启动器。cdpMode=remote 与「本机 ego CLI」组合会显式报 mode-kind-mismatch。remoteEnabled 只管远端 CDP,不影响本机 CLI 连接。",
2941
3146
  navigate: "bcdp_navigate: 打开URL或切tab(同任务复用当前tab)。bcdp_wait_for_url: 等跳转(登录/分页)。",
2942
3147
  observe: "bcdp_snapshot: 整页语义树(带[ref]/loc供点击); bcdp_page_info: url/标题/视口/滚动/对话框/人机验证; bcdp_read_element: 读单元素文本/HTML/值/属性/可见性/计数; bcdp_screenshot(+selector): 整页或元素截图。",
@@ -2949,7 +3154,8 @@ const EGO_HELP_INDEX = {
2949
3154
  captcha: "bcdp_captcha: 检测页面人机验证(CAPTCHA)并返回{detected,kind}; 检测到请让用户去 ego 浏览器完成; bcdp_page_info 也附带 humanCheck。",
2950
3155
  login: "bcdp_auth_flush: 把登录cookie落盘到ego profile; 观察窗登录引导条+『已登录,保存』按钮触发同一动作。bcdp_login_import: 从系统浏览器(Chrome/Edge/Brave)按域名导入登录cookie(source/domains/dryRun; 先dryRun看可导入项; ego浏览器须已在运行)。",
2951
3156
  script: "bcdp_cli / bcdp_script: 原样运行任意内置运行时 heredoc 脚本(page/browser/taskSpaces/site/fetch/cdp预载)。bcdp_script额外返回 duration/timedOut。",
2952
- doctor: "bcdp_doctor: 体检环境(浏览器候选、vendored runtime、状态目录、CDP端口、任务空间)。",
3157
+ doctor: "bcdp_doctor: 体检环境(浏览器候选、vendored runtime、状态目录、CDP端口、任务空间、引擎与降级清单)。",
3158
+ lightpanda: "Lightpanda 作为后端(无头文本渲染引擎,beta):设置面板「添加 Lightpanda(受管)」——受管 serve 行(本机单例,插件负责拉起/复用/停止;win32 经 WSL2,linux/mac 本机直装),激活后 probe 自动识别 engine 并全链降级;也可用普通 CDP 端点接已自起的 serve(http://127.0.0.1:9222)。**有头/无头与顺序语义**:CDP 端点/本机 Chrome/ego CLI 是有头类型——可人工兜底(手动输账号、过验证码),是兜底主力;Lightpanda 是无头类型——无法人工介入,只适合快速试验。顺序即优先级:把 Lightpanda 排在前面 = 快速场景优先用它;排在有头类型后面 = 有头兜底优先,Lightpanda 实际不会被启用。安装——linux/macOS:`curl -fsSL https://pkg.lightpanda.io/install.sh | bash`(装入 ~/.local/bin,确保 PATH 含它),`lightpanda serve --host 127.0.0.1 --port 9222`;Windows:无原生版,用 WSL2(管理员 `wsl --install`,WSL 内同上;WSL2 自动把端口映射到宿主 localhost)或 Docker(`docker run -d -p 127.0.0.1:9222:9222 lightpanda/browser:nightly`)。可用:navigate/js/click/fill/key/snapshot(AX树)/http/login_import 等;降级:截图=PNG 文本渲染(jev 输出带 engine/rendering 元数据);关闭:观察窗实时画面、面板点选、bcdp_download(调用即结构化报错)、auth_flush(返回 degraded)",
2953
3159
  judge: "JEV/Laya 判定(阶段 10):机械采集「截图 + 编号 DOM + 意图 + 操作进度」→ 组装问题 → 取选择 → 执行 → 验证。判定器只能回传编号,绝不给选择器(幻觉选择器在结构上不可能)。四件套:bcdp_jev_status(先跑这个:判定链可用性 + 配置体检,不发任何请求)/ bcdp_jev_frame(采一帧,看判定器会看到什么)/bcdp_jev_ask(组装请求体;dryRun 默认 true,可指定 round=control|chapter|pick|evaluate 逐级看)/ bcdp_jev_run(跑循环,返回逐步 trace)。bcdp_jev_attempt(平的尝试循环):给 url + goal,开页后每轮选项 = DOM 候选 + end 项,判定模型在 maxActions(默认 5)预算内行动或自选 end 结束,回执含每步 anchor;判定上下文只走 DOM 树文本(模型不读截图),完成后你用 bcdp_cdp/bcdp_screenshot 按 targetId 自行核验——回执是报告不是证明。**三级缩小**:control(要不要动手,固定 5 项)→ chapter(哪个章节,按 AX 容器聚簇)→ pick(章节内哪个编号 + 风险度)。分章节不是装饰:阈值按候选数分桶,把 20 选 1 拆成「几选 1 × 几选 1」会让两轮都落在更严的桶里。单章节时不问章节轮。**判定上下文是隔离的**:只允许 INTENT / PROGRESS / FRAME / HISTORY 四段,**绝不带 agent 会话 session 前缀**;多出任何一段都会在组装时直接抛错(不靠约定,靠断言)。PROGRESS 由循环自己机械生成,不让模型写(模型写的进度是第二个人幻觉通道)。**评估开关 jevEvaluate(默认开)**:每步执行后判定器再判进度 inprogress/done/fail;fail 或「未验真的 done」不猜下一步,直接 escalate——带有序 RecoveryOption(reload 排第一,因陈旧渲染会藏住已写入的确认),交回你来恢复或停手。被操作元素会保留 class 等定位特征(只剥离检视器外壳 token)随 escalate 回传,便于恢复。**默认链路是 laya -> rule**:JEV 目前无法注册,所以默认不写它;将来可用时把 jev 加回跳序并填 URL 即可。不可用的跳**跳过不调用**(laya-api 强制鉴权无匿名分支,缺 key 必然 401),每一跳的跳过与失败都记进 trace,绝不静默回落;refuse 是结果不是异常。阈值一律用选中项概率 top(不是 confidence:后者是归一化熵,2 选 1 与 20 选 1 不可比)。设置面板键:layaUrl/layaKey/layaModel(laya 端口 8000,不是 7789)、judgePrefer、jevChunkSize、jevMaxImageBytes、jevHistoryLimit、jevArchiveImage、jevStepBudget、jevWallMs;jevUrl/jevKey/jevModel 留空即可(JEV 未开放注册)。"
2954
3160
  };
2955
3161
 
@@ -5014,6 +5220,7 @@ function readAll$1(reader) {
5014
5220
  function makeJudgeEffects(deps) {
5015
5221
  const frames = [];
5016
5222
  let sequence = 0;
5223
+ const caps = capabilitiesFor(deps.engine ?? "unknown");
5017
5224
  let numbering = /* @__PURE__ */ new Map();
5018
5225
  let error = "";
5019
5226
  const captureWithWorker = async () => {
@@ -5024,8 +5231,8 @@ function makeJudgeEffects(deps) {
5024
5231
  steps: [{
5025
5232
  method: "capture",
5026
5233
  params: {
5027
- format: "jpeg",
5028
- quality: 72,
5234
+ format: caps.imageFormat,
5235
+ ...caps.imageFormat === "jpeg" ? { quality: 72 } : {},
5029
5236
  maxBytes: deps.maxImageBytes,
5030
5237
  limit: deps.candidateLimit,
5031
5238
  marks: true
@@ -5062,7 +5269,7 @@ function makeJudgeEffects(deps) {
5062
5269
  target,
5063
5270
  viewport: reply.viewport,
5064
5271
  image: {
5065
- format: "jpeg",
5272
+ format: caps.imageFormat,
5066
5273
  bytes: reply.bytes,
5067
5274
  dataBase64: reply.data,
5068
5275
  quality: reply.quality,
@@ -6854,6 +7061,13 @@ function defineEgoTool(ctx, cfg, opts) {
6854
7061
  timeoutMs: TOOL_TIMEOUT_MS,
6855
7062
  execute: async (args, exec) => withEgoLock(async () => {
6856
7063
  markEgoToolCall(callingSessionId(exec));
7064
+ if (typeof opts.gate === "function") {
7065
+ const blocked = opts.gate(args);
7066
+ if (blocked !== null && blocked !== "") return {
7067
+ ok: false,
7068
+ text: blocked
7069
+ };
7070
+ }
6857
7071
  const result = await runWithStaleSpaceRetry(ctx, cfg, exec, () => opts.buildScript(args));
6858
7072
  if (!result.ok) throw new Error(result.error);
6859
7073
  if (typeof opts.afterExecute === "function") opts.afterExecute(args, result.value);
@@ -6978,6 +7192,9 @@ function apply(ctx, config = {}) {
6978
7192
  get localUserDataDir() {
6979
7193
  return resolveConfig(bridge.source()).localUserDataDir;
6980
7194
  },
7195
+ get lightpandaArgs() {
7196
+ return resolveConfig(bridge.source()).lightpandaArgs;
7197
+ },
6981
7198
  get jevUrl() {
6982
7199
  return judgeSettingsOf(resolveConfig(bridge.source())).jevUrl;
6983
7200
  },
@@ -7068,11 +7285,12 @@ function apply(ctx, config = {}) {
7068
7285
  },
7069
7286
  remoteEnabled: resolved.remoteEnabled,
7070
7287
  useLauncher: true,
7288
+ lightpandaArgs: resolved.lightpandaArgs,
7071
7289
  cliIo: createSubprocessCliIo(ctx.subprocess),
7072
7290
  sdkPath: fileURLToPath(new URL("../runtime/ego-browser/dist/out/index.js", import.meta.url)),
7073
7291
  bundledCli: VENDORED_EGO_BIN
7074
7292
  });
7075
- if (setAttachEndpoint(attach.status === "ready" && attach.wsUrl !== "" ? attach.wsUrl : null)) recycleWorker("cdp activation change").catch(() => null);
7293
+ if (setAttachEndpoint(attach.status === "ready" && attach.wsUrl !== "" ? attach.wsUrl : null, attach.status === "ready" ? attach.engine ?? "unknown" : null)) recycleWorker("cdp activation change").catch(() => null);
7076
7294
  } catch {} finally {
7077
7295
  inFlight = false;
7078
7296
  if (pending) {
@@ -7126,7 +7344,7 @@ function apply(ctx, config = {}) {
7126
7344
  if (!shouldReapBrowser(Date.now(), last, cfg.idleTimeoutMin)) return;
7127
7345
  if (last <= reapedFor) return;
7128
7346
  try {
7129
- const { localBrowserInfo, stopLocalBrowser: stopLocalBrowser$1 } = await import("./launcher-CQyI8-By.js");
7347
+ const { localBrowserInfo, stopLocalBrowser: stopLocalBrowser$1 } = await import("./launcher-h0Ca5NV1.js");
7130
7348
  if (localBrowserInfo()) {
7131
7349
  await stopLocalBrowser$1();
7132
7350
  ctx.logger?.info?.("dsh-browser-cdp: idle reaper stopped the locally launched browser");
@@ -7267,6 +7485,7 @@ function registerAuthFlush(ctx, cfg, reg) {
7267
7485
  },
7268
7486
  total: { type: "integer" },
7269
7487
  flushed: { type: "integer" },
7488
+ degraded: { type: "boolean" },
7270
7489
  error: { type: "string" }
7271
7490
  }
7272
7491
  },
@@ -7297,11 +7516,16 @@ function registerAuthFlush(ctx, cfg, reg) {
7297
7516
  body: "{}",
7298
7517
  signal: AbortSignal.timeout(8e3)
7299
7518
  })).json();
7519
+ const degraded = defaultAttachCache.get().engine === "lightpanda";
7300
7520
  return {
7301
- ok: !!jbody.ok,
7521
+ ok: !!jbody.ok && !degraded,
7302
7522
  total: jbody.total ?? 0,
7303
7523
  flushed: jbody.flushed ?? 0,
7304
- error: jbody.error
7524
+ ...degraded ? {
7525
+ degraded: true,
7526
+ error: "engine-unsupported: Lightpanda has no Storage.flushCookies — cookies persist only while the engine process is alive"
7527
+ } : {},
7528
+ ...!degraded && jbody.error !== void 0 ? { error: jbody.error } : {}
7305
7529
  };
7306
7530
  } catch (err) {
7307
7531
  return {
@@ -7899,6 +8123,7 @@ function registerActionTools(ctx, cfg, reg) {
7899
8123
  },
7900
8124
  space: spaceParam
7901
8125
  },
8126
+ gate: () => defaultAttachCache.get().engine === "lightpanda" ? "engine-unsupported: the attached browser is Lightpanda, which has no Page download events — bcdp_download cannot capture files on this engine. Trigger the download another way (e.g. fetch() the URL in-page and return the bytes)." : null,
7902
8127
  buildScript: (args) => {
7903
8128
  const sel = str(args.triggerSelector, "");
7904
8129
  const script = str(args.triggerScript, "");
@@ -8065,7 +8290,9 @@ function registerHelpAndDoctor(ctx, cfg, reg) {
8065
8290
  type: "boolean",
8066
8291
  required: true
8067
8292
  },
8068
- kind: { oneOf: [{ type: "string" }, { type: "null" }] }
8293
+ kind: { oneOf: [{ type: "string" }, { type: "null" }] },
8294
+ engine: { type: "string" },
8295
+ rendering: { type: "string" }
8069
8296
  }
8070
8297
  },
8071
8298
  render: renderText
@@ -8084,7 +8311,11 @@ function registerHelpAndDoctor(ctx, cfg, reg) {
8084
8311
  return {
8085
8312
  ok: true,
8086
8313
  detected: !!hc?.detected,
8087
- kind: hc?.kind ?? null
8314
+ kind: hc?.kind ?? null,
8315
+ ...defaultAttachCache.get().engine === "lightpanda" ? {
8316
+ engine: "lightpanda",
8317
+ rendering: "text"
8318
+ } : {}
8088
8319
  };
8089
8320
  }),
8090
8321
  presentCall: () => ({
@@ -8180,9 +8411,16 @@ function registerHelpAndDoctor(ctx, cfg, reg) {
8180
8411
  const attachNow = defaultAttachCache.get();
8181
8412
  lines.push(`remote CDP: ${cfg.remoteEnabled === false ? "DISABLED by switch (sequence preserved)" : "enabled"}`);
8182
8413
  lines.push(`attach: ${attachNow.status}${attachNow.endpointSource ? ` (source: ${attachNow.endpointSource})` : ""}${attachNow.endpoint ? ` @ ${attachNow.endpoint}` : ""}`);
8414
+ if (attachNow.engine !== void 0) lines.push(`engine: ${attachNow.engine}`);
8415
+ if (attachNow.engine === "lightpanda") lines.push("degraded on this engine: live view (no screencast) · panel pick (no Overlay/bindingCalled) · bcdp_download (no Page download events) · screenshots are PNG text-renders · auth_flush is a no-op");
8416
+ if (attachNow.engine === "lightpanda" || process.platform === "win32") lines.push(process.platform === "win32" ? "lightpanda on win32: no native build — use WSL2: `wsl --install` (admin), then inside WSL: `curl -fsSL https://pkg.lightpanda.io/install.sh | bash` + `lightpanda serve --host 127.0.0.1 --port 9222`; WSL2 maps the port to Windows localhost, then add http://127.0.0.1:9222 as a CDP endpoint. Docker alternative: `docker run -d -p 127.0.0.1:9222:9222 lightpanda/browser:nightly`." : "lightpanda (linux/macOS): `curl -fsSL https://pkg.lightpanda.io/install.sh | bash` (installs to ~/.local/bin) then `lightpanda serve --host 127.0.0.1 --port 9222`.");
8183
8417
  const kindCount = (kind) => cfg.links.filter((link) => link.kind === kind).length;
8184
8418
  const dropped = cfg.droppedEgoCli;
8185
- lines.push(`links: ${cfg.links.length} (cdp ${kindCount("cdp")}, ego-cli ${kindCount(EGO_CLI_KIND)})${dropped > 0 ? ` — ${dropped} extra ego-cli row(s) dropped (local-only singleton)` : ""}`);
8419
+ lines.push(`links: ${cfg.links.length} (cdp ${kindCount("cdp")}, ego-cli ${kindCount(EGO_CLI_KIND)}, lightpanda ${kindCount(LP_KIND)})${dropped > 0 ? ` — ${dropped} extra ego-cli row(s) dropped (local-only singleton)` : ""}`);
8420
+ if (kindCount(LP_KIND) > 0) {
8421
+ const lpRow = cfg.links.find((link) => link.kind === LP_KIND);
8422
+ lines.push(`lightpanda row: servePath=${lpRow?.servePath === void 0 || lpRow.servePath === "" ? "(auto: PATH → ~/.local/bin; win32 via WSL2)" : lpRow.servePath} — headless quick-trial engine; headed kinds (CDP / local Chrome / ego CLI) are the manual-fallback backstop`);
8423
+ }
8186
8424
  const cliLink = cfg.links.find((link) => link.kind === EGO_CLI_KIND);
8187
8425
  if (cliLink && cliLink.kind === EGO_CLI_KIND) {
8188
8426
  const resolved = resolveCliBinary({
@@ -8374,6 +8612,7 @@ function registerHelpAndDoctor(ctx, cfg, reg) {
8374
8612
  workerPath: RENDER_WORKER_BIN,
8375
8613
  wsUrl: attach.wsUrl,
8376
8614
  targetId: attach.targetId,
8615
+ ...attach.engine === void 0 ? {} : { engine: attach.engine },
8377
8616
  judge,
8378
8617
  maxImageBytes: cfg.jevMaxImageBytes,
8379
8618
  candidateLimit: cfg.jevChunkSize,
@@ -8662,6 +8901,7 @@ function registerHelpAndDoctor(ctx, cfg, reg) {
8662
8901
  workerPath: RENDER_WORKER_BIN,
8663
8902
  wsUrl: defaultAttachCache.get().wsUrl,
8664
8903
  targetId: defaultAttachCache.get().targetId,
8904
+ engine: defaultAttachCache.get().engine,
8665
8905
  judge: judgeRuntimeOf(),
8666
8906
  maxImageBytes: num(args.maxBytes, judge.maxImageBytes),
8667
8907
  candidateLimit: num(args.limit, judge.chunkSize),
@@ -8686,6 +8926,7 @@ function registerHelpAndDoctor(ctx, cfg, reg) {
8686
8926
  `budget : ${frame.image === null || frame.image.maxBytes === 0 ? "unbounded" : frame.image.maxBytes + " B"}${frame.image?.overBudget === true ? " *** OVER BUDGET ***" : ""}`,
8687
8927
  `candidates : ${frame.dom.nodes.length} of ${frame.dom.total}${frame.dom.truncated ? " (TRUNCATED)" : ""}`
8688
8928
  ];
8929
+ if (defaultAttachCache.get().engine === "lightpanda") lines.push(`engine : lightpanda (rendering: text — screenshot fidelity differs from Chrome)`);
8689
8930
  if (frame.image?.overBudget === true) lines.push("", "The image exceeded the byte budget even at floor quality. Raise jevMaxImageBytes, or accept it and let the count drive chunking.");
8690
8931
  if (bool(args.showCandidates, true)) {
8691
8932
  lines.push("", "── candidates (the judge answers with these numbers) ──");