dsh-browser-cdp 1.14.10 → 1.14.11

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/client.js CHANGED
@@ -1,5 +1,32 @@
1
1
  window.__ModuleLoader__.load({ id: "dsh-browser-cdp", factory: (require) => {
2
2
  var module = { exports: {} }; var exports = module.exports;
3
+ //#region rolldown:runtime
4
+ var __create = Object.create;
5
+ var __defProp = Object.defineProperty;
6
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+
25
+ //#endregion
26
+ let react = require("react");
27
+ react = __toESM(react);
28
+ let react_jsx_runtime = require("react/jsx-runtime");
29
+ react_jsx_runtime = __toESM(react_jsx_runtime);
3
30
 
4
31
  //#region src/client/fam-links.ts
5
32
  /**
@@ -314,6 +341,364 @@ function shouldShowGen1SettingsGear(hasConfigForms, hasOpenSettingsDocument) {
314
341
  return !hasConfigForms && !hasOpenSettingsDocument;
315
342
  }
316
343
 
344
+ //#endregion
345
+ //#region src/client/guide.tsx
346
+ /** 生态通用的十个语言码(与各插件 `locale/*.json`、README 的十语镜像同口径)。 */
347
+ const GUIDE_LOCALES = [
348
+ "zh",
349
+ "en",
350
+ "ja",
351
+ "ko",
352
+ "fr",
353
+ "de",
354
+ "it",
355
+ "ru",
356
+ "es",
357
+ "pt"
358
+ ];
359
+ /**
360
+ * 引导外壳词表(10 语)。
361
+ *
362
+ * 为什么不塞进各插件 locales:这七个词是**跨插件同一套**,塞进九个字典要重复翻译
363
+ * 9×10 次,且一旦措辞调整就得动九个仓。外壳留在本文件,正文留各插件。
364
+ */
365
+ const GUIDE_COPY = {
366
+ zh: {
367
+ title: "快速上手",
368
+ skip: "跳过引导",
369
+ next: "下一步",
370
+ prev: "上一步",
371
+ done: "开始使用",
372
+ restart: "重新查看引导",
373
+ stepOf: (current, total) => `第 ${current} / ${total} 步`
374
+ },
375
+ en: {
376
+ title: "Quick start",
377
+ skip: "Skip guide",
378
+ next: "Next",
379
+ prev: "Back",
380
+ done: "Get started",
381
+ restart: "Show guide again",
382
+ stepOf: (current, total) => `Step ${current} of ${total}`
383
+ },
384
+ ja: {
385
+ title: "クイックスタート",
386
+ skip: "ガイドをスキップ",
387
+ next: "次へ",
388
+ prev: "戻る",
389
+ done: "はじめる",
390
+ restart: "ガイドをもう一度表示",
391
+ stepOf: (current, total) => `ステップ ${current} / ${total}`
392
+ },
393
+ ko: {
394
+ title: "빠른 시작",
395
+ skip: "가이드 건너뛰기",
396
+ next: "다음",
397
+ prev: "이전",
398
+ done: "시작하기",
399
+ restart: "가이드 다시 보기",
400
+ stepOf: (current, total) => `${current} / ${total} 단계`
401
+ },
402
+ fr: {
403
+ title: "Démarrage rapide",
404
+ skip: "Ignorer le guide",
405
+ next: "Suivant",
406
+ prev: "Retour",
407
+ done: "Commencer",
408
+ restart: "Revoir le guide",
409
+ stepOf: (current, total) => `Étape ${current} sur ${total}`
410
+ },
411
+ de: {
412
+ title: "Schnellstart",
413
+ skip: "Anleitung überspringen",
414
+ next: "Weiter",
415
+ prev: "Zurück",
416
+ done: "Loslegen",
417
+ restart: "Anleitung erneut anzeigen",
418
+ stepOf: (current, total) => `Schritt ${current} von ${total}`
419
+ },
420
+ it: {
421
+ title: "Avvio rapido",
422
+ skip: "Salta la guida",
423
+ next: "Avanti",
424
+ prev: "Indietro",
425
+ done: "Inizia",
426
+ restart: "Rivedi la guida",
427
+ stepOf: (current, total) => `Passo ${current} di ${total}`
428
+ },
429
+ ru: {
430
+ title: "Быстрый старт",
431
+ skip: "Пропустить руководство",
432
+ next: "Далее",
433
+ prev: "Назад",
434
+ done: "Начать",
435
+ restart: "Показать руководство снова",
436
+ stepOf: (current, total) => `Шаг ${current} из ${total}`
437
+ },
438
+ es: {
439
+ title: "Inicio rápido",
440
+ skip: "Omitir la guía",
441
+ next: "Siguiente",
442
+ prev: "Atrás",
443
+ done: "Empezar",
444
+ restart: "Ver la guía de nuevo",
445
+ stepOf: (current, total) => `Paso ${current} de ${total}`
446
+ },
447
+ pt: {
448
+ title: "Início rápido",
449
+ skip: "Ignorar o guia",
450
+ next: "Próximo",
451
+ prev: "Voltar",
452
+ done: "Começar",
453
+ restart: "Ver o guia novamente",
454
+ stepOf: (current, total) => `Passo ${current} de ${total}`
455
+ }
456
+ };
457
+ /** 语言标签 → 语言码:只认主标签,认不出的落 null(由调用方回退 en)。 */
458
+ function normalizeGuideLocale(tag) {
459
+ const primary = tag.toLowerCase().trim().split(/[-_]/)[0] ?? "";
460
+ return GUIDE_LOCALES.includes(primary) ? primary : null;
461
+ }
462
+ function htmlLang() {
463
+ try {
464
+ return typeof document === "undefined" ? "" : document.documentElement?.lang ?? "";
465
+ } catch {
466
+ return "";
467
+ }
468
+ }
469
+ /**
470
+ * 当前引导语言:以宿主 `<html lang>` 为准(语言切换会改写这个属性)。
471
+ *
472
+ * 认不出 → en:引导是「帮助」面,宁可给英文也不能给空白或中文硬串。
473
+ */
474
+ function currentGuideLocale() {
475
+ return normalizeGuideLocale(htmlLang()) ?? "en";
476
+ }
477
+ /** 引导外壳取词。 */
478
+ function guideLabels(locale = currentGuideLocale()) {
479
+ return GUIDE_COPY[locale] ?? GUIDE_COPY.en;
480
+ }
481
+ /**
482
+ * 步骤正文取词:本语 → en → zh → 表里第一个可用。
483
+ *
484
+ * 为什么需要回退链:九插件分批补语种,某个插件可能只有 zh/en 而宿主是 ru;
485
+ * 这时给英文是可用的,给空白等于「引导坏了」。`undefined` 步骤表按空表处理。
486
+ */
487
+ function guideSteps(map) {
488
+ if (map === void 0) return [];
489
+ const order = [
490
+ currentGuideLocale(),
491
+ "en",
492
+ "zh"
493
+ ];
494
+ for (const key of order) {
495
+ const hit = key === void 0 ? void 0 : map[key];
496
+ if (hit !== void 0 && hit.length > 0) return hit;
497
+ }
498
+ for (const key of GUIDE_LOCALES) {
499
+ const hit = map[key];
500
+ if (hit !== void 0 && hit.length > 0) return hit;
501
+ }
502
+ return [];
503
+ }
504
+ function guideStorageKey(ns) {
505
+ return `dsh.guide.${ns}.skipped`;
506
+ }
507
+ /** 是否已跳过(存储不可用时按「未跳过」处理:宁可多教一次,不要静默不教)。 */
508
+ function isGuideSkipped(ns) {
509
+ try {
510
+ return typeof localStorage !== "undefined" && localStorage.getItem(guideStorageKey(ns)) === "1";
511
+ } catch {
512
+ return false;
513
+ }
514
+ }
515
+ /** 记下跳过;写失败不抛(隐私模式 / 存储禁用)。 */
516
+ function skipGuide(ns) {
517
+ try {
518
+ localStorage?.setItem(guideStorageKey(ns), "1");
519
+ } catch {}
520
+ }
521
+ /** 清标记 = 允许重新教学。 */
522
+ function resetGuide(ns) {
523
+ try {
524
+ localStorage?.removeItem(guideStorageKey(ns));
525
+ } catch {}
526
+ }
527
+ const GUIDE_CSS = `
528
+ .sgGuide{border:1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.28));background:var(--dsw-alias-bg-layer-2, rgba(127,127,127,.06));border-radius:12px;padding:14px 16px;margin:0 0 12px}
529
+ .sgGuideHead{display:flex;align-items:center;gap:8px;margin:0 0 10px}
530
+ .sgGuideTitle{font-size:14px;font-weight:600;color:var(--dsw-alias-label-primary, currentColor)}
531
+ .sgGuideStep{font-size:12px;color:var(--dsw-alias-label-tertiary, rgba(127,127,127,.9));margin-left:auto}
532
+ .sgGuideBody{font-size:13px;line-height:1.6;color:var(--dsw-alias-label-secondary, currentColor);min-height:52px}
533
+ .sgGuideBody b{color:var(--dsw-alias-label-primary, currentColor);font-weight:600}
534
+ .sgGuideDots{display:flex;gap:6px;margin:10px 0 0}
535
+ .sgGuideDot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-border-l2, rgba(127,127,127,.3))}
536
+ .sgGuideDot-on{background:var(--dsw-alias-button-primary-fill, #4d6bfe)}
537
+ .sgGuideFoot{display:flex;align-items:center;gap:8px;margin:12px 0 0}
538
+ .sgGuideBtn{appearance:none;font:inherit;font-size:12px;padding:5px 12px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2, rgba(127,127,127,.3));background:transparent;color:var(--dsw-alias-label-primary, currentColor);cursor:pointer}
539
+ .sgGuideBtn-primary{background:var(--dsw-alias-button-primary-fill, #4d6bfe);border-color:transparent;color:#fff}
540
+ .sgGuideBtn-skip{margin-right:auto;color:var(--dsw-alias-label-tertiary, rgba(127,127,127,.9));border-color:transparent;text-decoration:underline}
541
+ .sgGuideRestart{appearance:none;font:inherit;font-size:12px;padding:0;border:0;background:transparent;color:var(--dsw-alias-link-primary, #4d6bfe);cursor:pointer;text-decoration:underline}
542
+ `;
543
+ function injectGuideCss() {
544
+ try {
545
+ if (typeof document === "undefined") return;
546
+ if (typeof document.querySelector !== "function") return;
547
+ if (typeof document.createElement !== "function") return;
548
+ if (!document.head) return;
549
+ if (document.querySelector("style[data-plugin-css=\"guide-kit\"]") !== null) return;
550
+ const tag = document.createElement("style");
551
+ tag.dataset.pluginCss = "guide-kit";
552
+ tag.textContent = GUIDE_CSS;
553
+ document.head.appendChild(tag);
554
+ } catch {}
555
+ }
556
+ /** 语言变更订阅:语言切换后重渲染词表(引导是短生命周期,直接跟随 <html lang>)。 */
557
+ function useLangTick() {
558
+ const [, setTick] = (0, react.useState)(0);
559
+ (0, react.useEffect)(() => {
560
+ try {
561
+ if (typeof MutationObserver === "undefined" || typeof document === "undefined") return;
562
+ if (!document.documentElement) return;
563
+ const observer = new MutationObserver(() => setTick((n) => n + 1));
564
+ observer.observe(document.documentElement, {
565
+ attributes: true,
566
+ attributeFilter: ["lang"]
567
+ });
568
+ return () => observer.disconnect();
569
+ } catch {
570
+ return;
571
+ }
572
+ }, []);
573
+ }
574
+ /**
575
+ * 引导主体:3 步以内的小教学 + 恒定可见的 Skip。
576
+ *
577
+ * `onClose` 由宿主卡面传:Skip/Done 都会调用它(Skip 同时写标记)。
578
+ */
579
+ function GuidePanel(props) {
580
+ const { ns, steps, onClose } = props;
581
+ const [index, setIndex] = (0, react.useState)(0);
582
+ useLangTick();
583
+ const labels = guideLabels();
584
+ (0, react.useEffect)(() => {
585
+ injectGuideCss();
586
+ }, []);
587
+ if (steps.length === 0) return null;
588
+ const current = steps[Math.min(index, steps.length - 1)];
589
+ const last = index >= steps.length - 1;
590
+ const finish = () => {
591
+ skipGuide(ns);
592
+ onClose();
593
+ };
594
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
595
+ className: "sgGuide",
596
+ "aria-label": labels.title,
597
+ children: [
598
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
599
+ className: "sgGuideHead",
600
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
601
+ className: "sgGuideTitle",
602
+ children: labels.title
603
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
604
+ className: "sgGuideStep",
605
+ children: labels.stepOf(index + 1, steps.length)
606
+ })]
607
+ }),
608
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
609
+ className: "sgGuideBody",
610
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("b", { children: current.title }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: current.body })]
611
+ }),
612
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
613
+ className: "sgGuideDots",
614
+ "aria-hidden": "true",
615
+ children: steps.map((step, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "sgGuideDot" + (i === index ? " sgGuideDot-on" : "") }, step.title))
616
+ }),
617
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
618
+ className: "sgGuideFoot",
619
+ children: [
620
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
621
+ type: "button",
622
+ className: "sgGuideBtn sgGuideBtn-skip",
623
+ onClick: () => finish(),
624
+ children: labels.skip
625
+ }),
626
+ index > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
627
+ type: "button",
628
+ className: "sgGuideBtn",
629
+ onClick: () => setIndex(index - 1),
630
+ children: labels.prev
631
+ }),
632
+ last ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
633
+ type: "button",
634
+ className: "sgGuideBtn sgGuideBtn-primary",
635
+ onClick: () => finish(),
636
+ children: labels.done
637
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
638
+ type: "button",
639
+ className: "sgGuideBtn sgGuideBtn-primary",
640
+ onClick: () => setIndex(index + 1),
641
+ children: labels.next
642
+ })
643
+ ]
644
+ })
645
+ ]
646
+ });
647
+ }
648
+ /**
649
+ * 重启入口:清标记 + 就地重开引导。
650
+ *
651
+ * 统一件,避免九插件各写一份(措辞/样式/清标记时机容易走样)。跳过之后
652
+ * 用户想再看一次,不需要去清浏览器存储。
653
+ */
654
+ function GuideRestartButton(props) {
655
+ const { ns, onOpen, style } = props;
656
+ useLangTick();
657
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
658
+ type: "button",
659
+ className: "sgGuideRestart",
660
+ style,
661
+ onClick: () => {
662
+ resetGuide(ns);
663
+ onOpen();
664
+ },
665
+ children: guideLabels().restart
666
+ });
667
+ }
668
+
669
+ //#endregion
670
+ //#region src/client/guide-steps.ts
671
+ const BROWSER_CDP_GUIDE_STEPS = {
672
+ zh: [
673
+ {
674
+ title: "先连上一个浏览器",
675
+ body: "「工具封印」下面的连接目标决定每一次 bcdp_* 调用打谁,顺序即优先级。ego / Tabbit / 本机 Chrome / 远端 CDP 任选其一,先探测再激活;列表为空时点「新建」填端点。"
676
+ },
677
+ {
678
+ title: "工具是懒注入的,不要以为没装上",
679
+ body: "默认只常驻 bcdp_status(它是解锁入口),其余工具在你第一次调用 bcdp_* 之后才铺开;闲置回收后又收起。想一挂载就全给,把「工具注入模式」改成 always。"
680
+ },
681
+ {
682
+ title: "agent 在动页面时你能看见",
683
+ body: "右侧浮窗逐个页面显示网址、标题和实时截图;被驱动页面的右上角还会出现淡出角标。看到「检测到人机验证」就转人工处理,别硬刷。"
684
+ }
685
+ ],
686
+ en: [
687
+ {
688
+ title: "Attach a browser first",
689
+ body: "Under \"Tool sealing\", the connection targets decide who every bcdp_* call hits; order is priority. Pick ego / Tabbit / local Chrome / remote CDP, probe then activate; an empty list means \"New\" with an endpoint."
690
+ },
691
+ {
692
+ title: "Tools are lazily injected, not missing",
693
+ body: "Only bcdp_status stays resident by default (it is the unlock entry); the rest arrive after your first bcdp_* call and are sealed back on idle reaping. Want everything at mount? Set \"Injection mode\" to always."
694
+ },
695
+ {
696
+ title: "You can watch the agent drive pages",
697
+ body: "The right-hand bubble lists every live page with URL, title and a live thumbnail; the driven page also shows a fading corner badge. If you see \"captcha detected\", hand it back to a human instead of retrying."
698
+ }
699
+ ]
700
+ };
701
+
317
702
  //#endregion
318
703
  //#region src/client/build.ts
319
704
  /**
@@ -326,7 +711,195 @@ function shouldShowGen1SettingsGear(hasConfigForms, hasOpenSettingsDocument) {
326
711
  *
327
712
  * Keep in sync with package.json — `node scripts/bump.mjs <version>` writes both.
328
713
  */
329
- const CLIENT_BUILD = "1.14.10";
714
+ const CLIENT_BUILD = "1.14.11";
715
+
716
+ //#endregion
717
+ //#region src/client/locales.ts
718
+ /**
719
+ * src/client/locales.ts — 侧栏元数据行的词条(zh/en 双份)。
720
+ *
721
+ * 为什么单独一个文件,而不直接写进 index.ts 的 `watchZh`/`watchEn`:
722
+ * 本仓的 locale 守卫(`tests/locale-guard.test.ts`)对客户端源码做**硬编码中文
723
+ * 棘轮**,`watchZh` 里每一条中文字面量都计入基线。把新词条搬进一个**字典文件**
724
+ * (守卫约定:文件名含 `locale`/`i18n`/`copy` 或位于 `locales/` 目录即视为译文
725
+ * 所在处)既不抬高基线,也不丢词条——index.ts 在启动时把它们 `Object.assign`
726
+ * 进两个字典,`wt()` 取词路径完全不变。
727
+ *
728
+ * 键名与 spec §7 一致;`{n}` 由 `wt(key, {n})` 的占位符替换填充。
729
+ */
730
+ /** 英文词条(缺 zh 时 `wt` 的最后回退)。 */
731
+ const SPACE_META_EN = {
732
+ capturingOff: "not capturing",
733
+ agoJustNow: "just now",
734
+ agoSeconds: "{n}s ago",
735
+ agoMinutes: "{n}m ago",
736
+ agoHours: "{n}h ago",
737
+ ownerAgent: "agent",
738
+ ownerYou: "you",
739
+ ownerSession: "session {n}",
740
+ zoomSuffix: "{n}%",
741
+ dprSuffix: "@{n}",
742
+ readyLoading: "loading",
743
+ captchaTabBadge: "⚠",
744
+ pagesCount: "{n} pages"
745
+ };
746
+ /** 中文词条。 */
747
+ const SPACE_META_ZH = {
748
+ capturingOff: "未截流",
749
+ agoJustNow: "刚刚",
750
+ agoSeconds: "{n}s 前",
751
+ agoMinutes: "{n}m 前",
752
+ agoHours: "{n}h 前",
753
+ ownerAgent: "agent",
754
+ ownerYou: "你",
755
+ ownerSession: "会话 {n}",
756
+ zoomSuffix: "{n}%",
757
+ dprSuffix: "@{n}",
758
+ readyLoading: "加载中",
759
+ captchaTabBadge: "⚠",
760
+ pagesCount: "{n} 页"
761
+ };
762
+
763
+ //#endregion
764
+ //#region src/client/space-meta.ts
765
+ /**
766
+ * 「最后动作距今」。四档:<3s 刚刚|<60s Ns 前|<1h Nm 前|其余 Nh 前。
767
+ *
768
+ * `lastActive <= 0` 返回 null:0 是「不知道」(worker 没采到帧),不是 1970 ——
769
+ * 显示「54 年前」比不显示更糟。
770
+ */
771
+ function formatElapsed(lastActive, now, t) {
772
+ const at = Number(lastActive);
773
+ if (!Number.isFinite(at) || at <= 0) return null;
774
+ const seconds = Math.max(0, now - at) / 1e3;
775
+ if (seconds < 3) return t("agoJustNow");
776
+ if (seconds < 60) return t("agoSeconds", { n: Math.floor(seconds) });
777
+ if (seconds < 3600) return t("agoMinutes", { n: Math.floor(seconds / 60) });
778
+ return t("agoHours", { n: Math.floor(seconds / 3600) });
779
+ }
780
+ /** `1280×720`。两个值都得是正整数,否则这一段缺席(不显示 0×0)。 */
781
+ function formatViewport(row) {
782
+ const w = Math.round(Number(row?.viewportW));
783
+ const h = Math.round(Number(row?.viewportH));
784
+ if (!Number.isInteger(w) || !Number.isInteger(h) || w <= 0 || h <= 0) return null;
785
+ return w + "×" + h;
786
+ }
787
+ /**
788
+ * `@1.25 · 80%`(DPR 与 zoom,任一缺席就只出另一半)。
789
+ *
790
+ * 只报「非常规」:100% 缩放与 DPR=1 是默认态,写出来只是噪声。
791
+ */
792
+ function formatZoom(dpr, zoom, t) {
793
+ const parts = [];
794
+ const ratio = Number(dpr);
795
+ if (Number.isFinite(ratio) && ratio > 0 && Math.abs(ratio - 1) >= .005) parts.push(t("dprSuffix", { n: Math.round(ratio * 100) / 100 }));
796
+ const percent = Number(zoom);
797
+ if (Number.isFinite(percent) && percent > 0 && Math.round(percent) !== 100) parts.push(t("zoomSuffix", { n: Math.round(percent) }));
798
+ return parts.length === 0 ? null : parts.join(" · ");
799
+ }
800
+ /** 加载态:只有 `loading` 值得说;interactive/complete 是正常态,不占位。 */
801
+ function formatReadyState(state, t) {
802
+ return state === "loading" ? t("readyLoading") : null;
803
+ }
804
+ /**
805
+ * 谁在驱动:`agent` / `你`,带会话时追加 `· 会话 a1b2`(会话 id 只取前 4 位——
806
+ * 全 id 会把这行撑爆,而侧栏要的是「是不是我刚发起的那轮」,不是可复制的句柄)。
807
+ */
808
+ function formatOwner(owner, t) {
809
+ const source = owner?.source;
810
+ const who = source === "agent" ? t("ownerAgent") : source === "operator" ? t("ownerYou") : null;
811
+ const raw = typeof owner?.sessionId === "string" ? owner.sessionId.trim() : "";
812
+ const session = raw === "" ? null : t("ownerSession", { n: raw.slice(0, 4) });
813
+ if (who === null && session === null) return null;
814
+ return [who, session].filter((part) => part !== null).join(" · ");
815
+ }
816
+ /** 该 tab 是否在被截流:只有明确的 `false` 值得说(`true`/未知都是常态)。 */
817
+ function formatCapturing(capturing, t) {
818
+ return capturing === false ? t("capturingOff") : null;
819
+ }
820
+ /**
821
+ * 一整行:viewport · 设备 · 距今 · 加载态 · 未截流 · 谁在驱动。
822
+ *
823
+ * 顺序是刻意的:越靠左越是「这页是什么」,越靠右越是「谁在动它」;窄面板下
824
+ * 尾部先被省略号吃掉,用户仍能读到尺寸与时间。
825
+ */
826
+ function formatSpaceMeta(input, now, t) {
827
+ const row = input.row ?? null;
828
+ const segments = [];
829
+ const viewport = formatViewport(row);
830
+ if (viewport !== null) segments.push({
831
+ key: "viewport",
832
+ text: viewport
833
+ });
834
+ const device = formatZoom(row?.dpr, row?.zoom, t);
835
+ if (device !== null) segments.push({
836
+ key: "device",
837
+ text: device
838
+ });
839
+ const elapsed = formatElapsed(row?.lastActive, now, t);
840
+ if (elapsed !== null) segments.push({
841
+ key: "elapsed",
842
+ text: elapsed
843
+ });
844
+ const ready = formatReadyState(row?.readyState, t);
845
+ if (ready !== null) segments.push({
846
+ key: "ready",
847
+ text: ready
848
+ });
849
+ const capturing = formatCapturing(row?.capturing, t);
850
+ if (capturing !== null) segments.push({
851
+ key: "capturing",
852
+ text: capturing
853
+ });
854
+ const owner = formatOwner(input.owner, t);
855
+ if (owner !== null) segments.push({
856
+ key: "owner",
857
+ text: owner
858
+ });
859
+ return segments;
860
+ }
861
+ /** 分段拼成一行(两处渲染共用,保证浮窗与 Tab 逐字一致)。 */
862
+ function joinMeta(segments) {
863
+ return segments.map((segment) => segment.text).filter((text) => text !== "").join(" · ");
864
+ }
865
+ /** tab 条尾部的 `N 页`。0 页时不显示(空态已经有自己的文案)。 */
866
+ function formatPageCount(count, t) {
867
+ const n = Math.floor(Number(count));
868
+ if (!Number.isFinite(n) || n <= 0) return null;
869
+ return t("pagesCount", { n });
870
+ }
871
+ /** `lastActive` 归一化到秒:spaces 每 ~500ms 一推,毫秒尾数只会让渲染白白比出差异。 */
872
+ function truncateLastActive(rows) {
873
+ for (const row of rows) {
874
+ const value = Number(row?.lastActive);
875
+ row.lastActive = Number.isFinite(value) && value > 0 ? Math.floor(value / 1e3) * 1e3 : 0;
876
+ }
877
+ return rows;
878
+ }
879
+ function createSpacesCoalescer(flush, delayMs = 300) {
880
+ let timer = null;
881
+ let pending = null;
882
+ const stop = () => {
883
+ if (timer !== null) clearTimeout(timer);
884
+ timer = null;
885
+ };
886
+ return {
887
+ push(rows) {
888
+ pending = rows;
889
+ stop();
890
+ timer = setTimeout(() => {
891
+ timer = null;
892
+ const next = pending;
893
+ pending = null;
894
+ if (next !== null) flush(next);
895
+ }, delayMs);
896
+ },
897
+ cancel() {
898
+ stop();
899
+ pending = null;
900
+ }
901
+ };
902
+ }
330
903
 
331
904
  //#endregion
332
905
  //#region src/client/index.ts
@@ -550,146 +1123,158 @@ var watchEn = {
550
1123
  sizeApiOutdated: "Size API not ready — restart DSH to load the new host build",
551
1124
  actionFailed: "Action failed"
552
1125
  };
1126
+ var watchZh = {
1127
+ title: "CDP 浏览器",
1128
+ titleLive: "CDP 浏览器 · 实时",
1129
+ liveView: "只读观察窗",
1130
+ pinned: "已固定查看",
1131
+ realtime: "正在实时浏览",
1132
+ noScreenshot: "(暂无截图 — about:blank 或浏览器未渲染)",
1133
+ engineUnsupportedBanner: "(当前引擎不支持实时画面 — Lightpanda 为文本渲染,可用 bcdp_snapshot / bcdp_screenshot 查看)",
1134
+ engineUnsupportedPick: "当前引擎不支持面板点选(无 Overlay/无实时画面)— 请用 bcdp_snapshot 定位元素",
1135
+ streamMseUnsupported: "当前浏览器不支持此 H.264 流",
1136
+ streamDisconnected: "视频流已断开",
1137
+ streamConnectFailed: "视频流连接失败",
1138
+ noActivePages: "暂无活跃浏览器页",
1139
+ noActiveHint: "当 agent 开始用 bcdp_* 操作网页时,这里会实时显示",
1140
+ openExternal: "⧉ 打开真实页",
1141
+ raiseWindow: "弹出窗口",
1142
+ raiseWindowHint: "把 agent 浏览器弹出为真实窗口(无头实例会被同 Profile 的有头实例替换,标签页保留)",
1143
+ pickMode: "选择元素",
1144
+ pickModeHint: "在实时页面里点选一个元素,引用到对话",
1145
+ picking: "点选中…请点击页面里的元素",
1146
+ picked: "已捕获元素",
1147
+ pickFailed: "点选失败",
1148
+ pickQuoted: "✓ 已引用到输入框",
1149
+ pickBarQuote: "引用到对话 Ctrl+J",
1150
+ pickDeliverFailed: "投递失败",
1151
+ noUrl: "无可打开的地址",
1152
+ closeTab: "关闭标签",
1153
+ closeFailed: "关闭失败:",
1154
+ newTab: "(新标签页)",
1155
+ history: "历史浏览轨迹",
1156
+ historyHide: "收起历史轨迹",
1157
+ historyShow: "历史浏览轨迹",
1158
+ noHistory: "暂无浏览记录",
1159
+ current: "当前",
1160
+ atQuote: "将整页引用为锚点报告(@)",
1161
+ atQuoted: "✓ 整页锚点报告已引用",
1162
+ atQuoteFailed: "锚点报告失败",
1163
+ refresh: "刷新",
1164
+ backToLive: "← 返回实时",
1165
+ dragHint: "拖动移动面板",
1166
+ loginTitle: "需要账号登录时,请到桌面上那个 {where} 完成登录。",
1167
+ loginBtn: "已登录,保存",
1168
+ loginSaving: "保存中…",
1169
+ loginSaved: "已保存 {n} 条会话",
1170
+ loginNotConnected: "未连接浏览器",
1171
+ loginFailed: "保存失败",
1172
+ loginDismiss: "关闭提示",
1173
+ captchaTitle: "⚠️ 检测到人机验证",
1174
+ captchaHint: "请在桌面那个 {where} 手动完成验证,agent 会继续。",
1175
+ whereCdp: "「{label}」浏览器窗口",
1176
+ whereEgo: "ego 浏览器窗口",
1177
+ whereTabbit: "Tabbit 浏览器窗口",
1178
+ whereLocal: "本机 Chrome 窗口(受管启动)",
1179
+ whereGeneric: "agent 浏览器窗口",
1180
+ loginHeadless: "当前激活的是 Lightpanda(无头引擎),没有可登录/验证的窗口;请切换到有头目标(CDP 端点 / 本机 Chrome / ego CLI / Tabbit)。",
1181
+ loginSelfPersist: "登录态保存在该浏览器自己的 profile 里,无需手动落盘。",
1182
+ captchaDismiss: "关闭提示",
1183
+ hintReset: "已复位 · 滚轮滚动页面 · Ctrl+滚轮缩放 · 双击复位",
1184
+ liveImgHint: "滚轮缩放 · 按住拖动平移 · 缩小到最小或双击复位",
1185
+ hintPan: "Ctrl+滚轮缩放 · Ctrl+拖动平移 · 双击复位",
1186
+ hintScroll: "Ctrl+拖动平移 · 滚轮滚动页面",
1187
+ hintNotCaptured: "画面未接管 · 本次操作未送达 · 再点一次即可恢复",
1188
+ failed: "失败",
1189
+ stale: "⚠ 未接管",
1190
+ captured: "已接管",
1191
+ fabTitle: "CDP 浏览器实时视图",
1192
+ settingsTitle: "展开设置",
1193
+ settingsHide: "收起设置",
1194
+ famTitle: "CDP 浏览器",
1195
+ famIsolate: "空间隔离",
1196
+ famIsolateDesc: "关 = 持久化配置(重启保留登录态);开 = 每次隔离沙箱",
1197
+ famIdle: "空闲自动停止(分钟,0 = 不停)",
1198
+ famIdleDesc: "超过 N 分钟没有 bcdp_* 调用即停止后台浏览器,下次调用按需重启",
1199
+ linksTitle: "连接目标(顺序即优先级)",
1200
+ linksEmpty: "暂无目标——用下方表单添加第一个连接目标",
1201
+ linksEnabled: "启用",
1202
+ linksActive: "已激活",
1203
+ badgeLpHeadless: "LP·无头",
1204
+ linksAddCdp: "添加 CDP 端点",
1205
+ linksAddCli: "添加本机 ego CLI",
1206
+ linksAddLp: "添加 Lightpanda(受管)",
1207
+ linksAddLpExists: "Lightpanda 连接已存在——仅限本机,一台机器只允许一条",
1208
+ linksAddTabbit: "添加 Tabbit CLI",
1209
+ linksAddTabbitExists: "Tabbit 连接已存在——仅限本机,一台机器只允许一条",
1210
+ linksTabbitPathHint: "留空 = 自动检测 (%LOCALAPPDATA%\\Tabbit\\LocalAgent\\bin)",
1211
+ linksLpPathHint: "留空 = 自动检测(PATH → ~/.local/bin;Windows 经 WSL2)",
1212
+ linksLpHeadlessHint: "无头快速试验引擎:无法人工兜底(登录/验证码)。排前面 = 快速场景优先用它;排在有头类型(CDP/本机 Chrome/ego CLI)后 = 兜底优先。",
1213
+ linksLpRemoteWarn: "cdpMode=remote 时激活 Lightpanda 行会报 mode-kind-mismatch",
1214
+ linksAddCliExists: "本机 ego CLI 连接已存在——仅限本机,一台机器只允许一条",
1215
+ linksEndpoint: "端点",
1216
+ linksEndpointHint: "http(s)://主机:端口 或 ws(s)://…",
1217
+ linksEndpointInvalid: "端点无效,未保存",
1218
+ linksCliPath: "ego CLI 路径",
1219
+ linksCliPathHint: "留空 = 自动检测(PATH → 应用包 → 内置运行时)",
1220
+ linksLabel: "标签",
1221
+ linksRemove: "删除",
1222
+ linksMoveUp: "上移",
1223
+ linksMoveDown: "下移",
1224
+ linksProbe: "探测",
1225
+ linksProbing: "探测中…",
1226
+ linksProbeOk: "可达",
1227
+ linksProbeFail: "不可达",
1228
+ linksLimitReached: "连接序列最多 {n} 条",
1229
+ linksWriteFailed: "保存失败——设置层拒绝了这次写入",
1230
+ linksCliRemoteWarn: "cdpMode=remote 时激活 ego CLI 会报 mode-kind-mismatch",
1231
+ linksCliSdk: "使用内置 harness",
1232
+ linksDisabledHint: "已停用——先勾选启用才能激活",
1233
+ linksActivate: "激活",
1234
+ linksLocalRow: "本机 Chrome(受管启动)",
1235
+ linksLocalEnableHint: "勾选 = 允许 auto 模式在激活目标不可达时回落本机启动",
1236
+ pickCardTitle: "浏览器点选内容",
1237
+ pickCardElements: "已选 {n} 个元素",
1238
+ pickCardRemove: "移除这段点选",
1239
+ pickCardSnapshotTag: "(点击时快照)",
1240
+ pickCardRecapture: "重抓快照",
1241
+ pickCardRecaptureHint: "重新读取这个 tab 并覆盖引用的报告(@ token 不变)",
1242
+ pickCardLive: "实时",
1243
+ trackAllOn: "全模式 · 全部 tab",
1244
+ trackAllOff: "仅激活 tab",
1245
+ trackAllHintOn: "全模式:space 内每个 tab 都单独出图,外框标出当前激活的那个;再点一下回到仅激活。",
1246
+ trackAllHintOff: "仅激活:只出激活 tab 的图;点一下切到全模式(所有 tab 都跟踪)。",
1247
+ pageRefresh: "刷新页面",
1248
+ pageRefreshHint: "重新加载 agent 当前页面(Page.reload)",
1249
+ openUrl: "打开网址",
1250
+ openUrlHint: "让 agent 页面跳转到指定网址",
1251
+ openUrlPrompt: "要在 agent 浏览器里打开的网址",
1252
+ sizeSyncOff: "🔒 锁定尺寸",
1253
+ sizeSyncOn: "🔓 尺寸同步",
1254
+ sizeSyncHint: "解锁后拖动面板会直接改变 agent 浏览器真实窗口大小;再点一下锁定。",
1255
+ sizePresets: "尺寸预设",
1256
+ sizePresetsHint: "按固定比例设置 agent 浏览器窗口",
1257
+ maximizeWindow: "最大化",
1258
+ maximizeHint: "最大化真实 agent 浏览器窗口",
1259
+ resizeHint: "拖动调整 agent 浏览器窗口大小",
1260
+ sizeApiOutdated: "尺寸接口未就绪:请重启 DSH 以加载最新 host 构建",
1261
+ actionFailed: "操作失败"
1262
+ };
553
1263
  var watchDict = {
554
1264
  en: watchEn,
555
- zh: {
556
- title: "CDP 浏览器",
557
- titleLive: "CDP 浏览器 · 实时",
558
- liveView: "只读观察窗",
559
- pinned: "已固定查看",
560
- realtime: "正在实时浏览",
561
- noScreenshot: "(暂无截图 — about:blank 或浏览器未渲染)",
562
- engineUnsupportedBanner: "(当前引擎不支持实时画面 — Lightpanda 为文本渲染,可用 bcdp_snapshot / bcdp_screenshot 查看)",
563
- engineUnsupportedPick: "当前引擎不支持面板点选(无 Overlay/无实时画面)— 请用 bcdp_snapshot 定位元素",
564
- streamMseUnsupported: "当前浏览器不支持此 H.264 流",
565
- streamDisconnected: "视频流已断开",
566
- streamConnectFailed: "视频流连接失败",
567
- noActivePages: "暂无活跃浏览器页",
568
- noActiveHint: "当 agent 开始用 bcdp_* 操作网页时,这里会实时显示",
569
- openExternal: "⧉ 打开真实页",
570
- raiseWindow: "弹出窗口",
571
- raiseWindowHint: "把 agent 浏览器弹出为真实窗口(无头实例会被同 Profile 的有头实例替换,标签页保留)",
572
- pickMode: "选择元素",
573
- pickModeHint: "在实时页面里点选一个元素,引用到对话",
574
- picking: "点选中…请点击页面里的元素",
575
- picked: "已捕获元素",
576
- pickFailed: "点选失败",
577
- pickQuoted: "✓ 已引用到输入框",
578
- pickBarQuote: "引用到对话 Ctrl+J",
579
- pickDeliverFailed: "投递失败",
580
- noUrl: "无可打开的地址",
581
- closeTab: "关闭标签",
582
- closeFailed: "关闭失败:",
583
- newTab: "(新标签页)",
584
- history: "历史浏览轨迹",
585
- historyHide: "收起历史轨迹",
586
- historyShow: "历史浏览轨迹",
587
- noHistory: "暂无浏览记录",
588
- current: "当前",
589
- atQuote: "将整页引用为锚点报告(@)",
590
- atQuoted: "✓ 整页锚点报告已引用",
591
- atQuoteFailed: "锚点报告失败",
592
- refresh: "刷新",
593
- backToLive: "← 返回实时",
594
- dragHint: "拖动移动面板",
595
- loginTitle: "需要账号登录时,请到桌面上那个 {where} 完成登录。",
596
- loginBtn: "已登录,保存",
597
- loginSaving: "保存中…",
598
- loginSaved: "已保存 {n} 条会话",
599
- loginNotConnected: "未连接浏览器",
600
- loginFailed: "保存失败",
601
- loginDismiss: "关闭提示",
602
- captchaTitle: "⚠️ 检测到人机验证",
603
- captchaHint: "请在桌面那个 {where} 手动完成验证,agent 会继续。",
604
- whereCdp: "「{label}」浏览器窗口",
605
- whereEgo: "ego 浏览器窗口",
606
- whereTabbit: "Tabbit 浏览器窗口",
607
- whereLocal: "本机 Chrome 窗口(受管启动)",
608
- whereGeneric: "agent 浏览器窗口",
609
- loginHeadless: "当前激活的是 Lightpanda(无头引擎),没有可登录/验证的窗口;请切换到有头目标(CDP 端点 / 本机 Chrome / ego CLI / Tabbit)。",
610
- loginSelfPersist: "登录态保存在该浏览器自己的 profile 里,无需手动落盘。",
611
- captchaDismiss: "关闭提示",
612
- hintReset: "已复位 · 滚轮滚动页面 · Ctrl+滚轮缩放 · 双击复位",
613
- liveImgHint: "滚轮缩放 · 按住拖动平移 · 缩小到最小或双击复位",
614
- hintPan: "Ctrl+滚轮缩放 · Ctrl+拖动平移 · 双击复位",
615
- hintScroll: "Ctrl+拖动平移 · 滚轮滚动页面",
616
- hintNotCaptured: "画面未接管 · 本次操作未送达 · 再点一次即可恢复",
617
- failed: "失败",
618
- stale: "⚠ 未接管",
619
- captured: "已接管",
620
- fabTitle: "CDP 浏览器实时视图",
621
- settingsTitle: "展开设置",
622
- settingsHide: "收起设置",
623
- famTitle: "CDP 浏览器",
624
- famIsolate: "空间隔离",
625
- famIsolateDesc: "关 = 持久化配置(重启保留登录态);开 = 每次隔离沙箱",
626
- famIdle: "空闲自动停止(分钟,0 = 不停)",
627
- famIdleDesc: "超过 N 分钟没有 bcdp_* 调用即停止后台浏览器,下次调用按需重启",
628
- linksTitle: "连接目标(顺序即优先级)",
629
- linksEmpty: "暂无目标——用下方表单添加第一个连接目标",
630
- linksEnabled: "启用",
631
- linksActive: "已激活",
632
- badgeLpHeadless: "LP·无头",
633
- linksAddCdp: "添加 CDP 端点",
634
- linksAddCli: "添加本机 ego CLI",
635
- linksAddLp: "添加 Lightpanda(受管)",
636
- linksAddLpExists: "Lightpanda 连接已存在——仅限本机,一台机器只允许一条",
637
- linksAddTabbit: "添加 Tabbit CLI",
638
- linksAddTabbitExists: "Tabbit 连接已存在——仅限本机,一台机器只允许一条",
639
- linksTabbitPathHint: "留空 = 自动检测 (%LOCALAPPDATA%\\Tabbit\\LocalAgent\\bin)",
640
- linksLpPathHint: "留空 = 自动检测(PATH → ~/.local/bin;Windows 经 WSL2)",
641
- linksLpHeadlessHint: "无头快速试验引擎:无法人工兜底(登录/验证码)。排前面 = 快速场景优先用它;排在有头类型(CDP/本机 Chrome/ego CLI)后 = 兜底优先。",
642
- linksLpRemoteWarn: "cdpMode=remote 时激活 Lightpanda 行会报 mode-kind-mismatch",
643
- linksAddCliExists: "本机 ego CLI 连接已存在——仅限本机,一台机器只允许一条",
644
- linksEndpoint: "端点",
645
- linksEndpointHint: "http(s)://主机:端口 或 ws(s)://…",
646
- linksEndpointInvalid: "端点无效,未保存",
647
- linksCliPath: "ego CLI 路径",
648
- linksCliPathHint: "留空 = 自动检测(PATH → 应用包 → 内置运行时)",
649
- linksLabel: "标签",
650
- linksRemove: "删除",
651
- linksMoveUp: "上移",
652
- linksMoveDown: "下移",
653
- linksProbe: "探测",
654
- linksProbing: "探测中…",
655
- linksProbeOk: "可达",
656
- linksProbeFail: "不可达",
657
- linksLimitReached: "连接序列最多 {n} 条",
658
- linksWriteFailed: "保存失败——设置层拒绝了这次写入",
659
- linksCliRemoteWarn: "cdpMode=remote 时激活 ego CLI 会报 mode-kind-mismatch",
660
- linksCliSdk: "使用内置 harness",
661
- linksDisabledHint: "已停用——先勾选启用才能激活",
662
- linksActivate: "激活",
663
- linksLocalRow: "本机 Chrome(受管启动)",
664
- linksLocalEnableHint: "勾选 = 允许 auto 模式在激活目标不可达时回落本机启动",
665
- pickCardTitle: "浏览器点选内容",
666
- pickCardElements: "已选 {n} 个元素",
667
- pickCardRemove: "移除这段点选",
668
- pickCardSnapshotTag: "(点击时快照)",
669
- pickCardRecapture: "重抓快照",
670
- pickCardRecaptureHint: "重新读取这个 tab 并覆盖引用的报告(@ token 不变)",
671
- pickCardLive: "实时",
672
- trackAllOn: "全模式 · 全部 tab",
673
- trackAllOff: "仅激活 tab",
674
- trackAllHintOn: "全模式:space 内每个 tab 都单独出图,外框标出当前激活的那个;再点一下回到仅激活。",
675
- trackAllHintOff: "仅激活:只出激活 tab 的图;点一下切到全模式(所有 tab 都跟踪)。",
676
- pageRefresh: "刷新页面",
677
- pageRefreshHint: "重新加载 agent 当前页面(Page.reload)",
678
- openUrl: "打开网址",
679
- openUrlHint: "让 agent 页面跳转到指定网址",
680
- openUrlPrompt: "要在 agent 浏览器里打开的网址",
681
- sizeSyncOff: "🔒 锁定尺寸",
682
- sizeSyncOn: "🔓 尺寸同步",
683
- sizeSyncHint: "解锁后拖动面板会直接改变 agent 浏览器真实窗口大小;再点一下锁定。",
684
- sizePresets: "尺寸预设",
685
- sizePresetsHint: "按固定比例设置 agent 浏览器窗口",
686
- maximizeWindow: "最大化",
687
- maximizeHint: "最大化真实 agent 浏览器窗口",
688
- resizeHint: "拖动调整 agent 浏览器窗口大小",
689
- sizeApiOutdated: "尺寸接口未就绪:请重启 DSH 以加载最新 host 构建",
690
- actionFailed: "操作失败"
691
- }
1265
+ zh: watchZh
692
1266
  };
1267
+ Object.assign(watchEn, SPACE_META_EN);
1268
+ Object.assign(watchZh, SPACE_META_ZH);
1269
+ /**
1270
+ * 动作药丸取词:host 送来的 {zh,en} 对,按当前界面语言挑一个。
1271
+ * 不塞进 watchEn/watchZh 是因为这些词**由 host 侧单一真源产生**
1272
+ * (`TOOL_ACTION_LABELS`),客户端只做选择,不做第二份表。
1273
+ */
1274
+ function pickActionLabel(label) {
1275
+ if (!label || typeof label !== "object") return "";
1276
+ return _egoLocale === "zh" ? label.zh || label.en || "" : label.en || label.zh || "";
1277
+ }
693
1278
  function wt(key, params = void 0) {
694
1279
  var text = (watchDict[_egoLocale] || watchEn)[key] || watchEn[key] || key;
695
1280
  if (params) for (var k in params) text = text.replace(new RegExp("{" + k + "}", "g"), String(params[k]));
@@ -1194,6 +1779,11 @@ const PANEL_CSS = `
1194
1779
  used to read as duplicated tabs; a W1/W2 badge explains them instead of hiding. */
1195
1780
  .dsh-ego-tab .dsh-ego-tabwin { flex-shrink:0; font-size:9.5px; line-height:14px; padding:0 3px;
1196
1781
  border-radius:4px; border:1px solid currentColor; opacity:.55; letter-spacing:.2px; }
1782
+ /* M4 — this tab is sitting on a human-verification screen. One glyph is all the
1783
+ room there is; the sentence lives in the title attribute. */
1784
+ .dsh-ego-tab .dsh-ego-tabwarn { flex-shrink:0; color:#ffcc00; font-size:11px; line-height:14px; }
1785
+ /* M8 — how many pages are open (tail of the strip). */
1786
+ .dsh-ego-tabcount { flex-shrink:0; align-self:center; font-size:10px; opacity:.55; padding-left:2px; }
1197
1787
  /* Transient failure text inside the strip (close refused, capture failed). */
1198
1788
  .dsh-ego-taberr { flex-shrink:0; font-size:10.5px; line-height:16px; padding:0 6px; border-radius:999px;
1199
1789
  color:#ff453a; border:1px solid rgba(255,69,58,.45); background: rgba(255,69,58,.12); }
@@ -2027,10 +2617,21 @@ function FamilySettingsCard(props) {
2027
2617
  var value = snapshot.value || {};
2028
2618
  var writable = snapshot.writable === true;
2029
2619
  var h = React.createElement;
2620
+ var guideState = React.useState(function() {
2621
+ return !isGuideSkipped("browser-cdp");
2622
+ });
2623
+ var guideOpen = guideState[0], setGuideOpen = guideState[1];
2030
2624
  return h("div", { style: {
2031
2625
  display: "grid",
2032
2626
  gap: "8px"
2033
- } }, h(FamLinks, {
2627
+ } }, guideOpen ? h(GuidePanel, {
2628
+ key: "guide",
2629
+ ns: "browser-cdp",
2630
+ steps: guideSteps(BROWSER_CDP_GUIDE_STEPS),
2631
+ onClose: function() {
2632
+ setGuideOpen(false);
2633
+ }
2634
+ }) : null, h(FamLinks, {
2034
2635
  key: "links",
2035
2636
  first: true,
2036
2637
  value,
@@ -2044,7 +2645,15 @@ function FamilySettingsCard(props) {
2044
2645
  writable,
2045
2646
  scope
2046
2647
  });
2047
- }));
2648
+ }), h("div", {
2649
+ key: "guide-restart",
2650
+ style: { paddingTop: "2px" }
2651
+ }, h(GuideRestartButton, {
2652
+ ns: "browser-cdp",
2653
+ onOpen: function() {
2654
+ setGuideOpen(true);
2655
+ }
2656
+ })));
2048
2657
  }
2049
2658
  function FamGroup(props) {
2050
2659
  var group = props.group;
@@ -2901,7 +3510,7 @@ function mountFloatingWatch(ctx) {
2901
3510
  panel.innerHTML = `
2902
3511
  <div id="dsh-ego-head">
2903
3512
  <span class="dsh-ego-grip" title="${wt("dragHint")}">${ICON_GRIP}</span>
2904
- <span id="dsh-ego-title">${ICON_GLOBE}<span style="margin-left:6px;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${wt("title")}</span><span id="dsh-ego-ver" style="margin-left:6px;font-size:10px;opacity:.5;flex-shrink:0;">v${CLIENT_BUILD}</span></span>
3513
+ <span id="dsh-ego-title">${ICON_GLOBE}<span style="margin-left:6px;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">${wt("title")}</span><span id="dsh-ego-ver" style="margin-left:6px;font-size:10px;opacity:.5;flex-shrink:0;">v${CLIENT_BUILD}</span><span id="dsh-ego-action" hidden style="margin-left:8px;flex-shrink:0;display:inline-flex;align-items:center;gap:5px;padding:2px 8px;border-radius:999px;font-size:10.5px;background:rgba(77,107,254,.14);color:var(--dsw-alias-label-primary,#4d6bfe);border:1px solid rgba(77,107,254,.32);"></span></span>
2905
3514
  <button id="dsh-ego-refresh" class="dsh-ego-iconbtn" title="${wt("refresh")}">${ICON_REFRESH}</button>
2906
3515
  <button id="dsh-ego-historybtn" class="dsh-ego-iconbtn off" title="${wt("historyShow")}">${ICON_CLOCK}</button>
2907
3516
  <button id="dsh-ego-close" class="dsh-ego-iconbtn" title="${wt("settingsHide")}">${ICON_CLOSE}</button>
@@ -3083,6 +3692,19 @@ function mountFloatingWatch(ctx) {
3083
3692
  let pendingLiveFrame = null;
3084
3693
  let liveFlushRaf = null;
3085
3694
  const pageMeta = /* @__PURE__ */ new Map();
3695
+ const owners = /* @__PURE__ */ new Map();
3696
+ let metaEl = null;
3697
+ let metaRow = null;
3698
+ const ownerOf = (targetId) => owners.get(targetId) || null;
3699
+ const metaLineOf = (row) => row ? joinMeta(formatSpaceMeta({
3700
+ row,
3701
+ owner: ownerOf(row.targetId)
3702
+ }, Date.now(), wt)) : "";
3703
+ const paintMeta = () => {
3704
+ if (!metaEl) return;
3705
+ metaEl.textContent = metaLineOf(metaRow);
3706
+ metaEl.hidden = metaEl.textContent === "";
3707
+ };
3086
3708
  const watchClientId = "floating-" + Math.random().toString(36).slice(2);
3087
3709
  let watchStarted = false, watchTargetId = null, watchRenewTimer = null, watchStopTimer = null, watchRequest = null;
3088
3710
  let watchUnsupported = false, watchRequestTarget = null, watchRequestPendingTarget = null, captureBackend = "cdp", streamGeneration = 0, streamState = "idle", streamMime = "video/mp4; codecs=\"avc1.42E01E\"", videoCleanup = null;
@@ -3483,6 +4105,13 @@ function mountFloatingWatch(ctx) {
3483
4105
  txt.style.overflow = "hidden";
3484
4106
  txt.style.textOverflow = "ellipsis";
3485
4107
  tab.appendChild(dot);
4108
+ if (s.humanCheck && s.humanCheck.detected) {
4109
+ const warn = document.createElement("span");
4110
+ warn.className = "dsh-ego-tabwarn";
4111
+ warn.textContent = wt("captchaTabBadge");
4112
+ warn.title = wt("captchaTitle");
4113
+ tab.appendChild(warn);
4114
+ }
3486
4115
  tab.appendChild(txt);
3487
4116
  const closeBtn$1 = document.createElement("span");
3488
4117
  closeBtn$1.className = "dsh-ego-tabclose";
@@ -3541,6 +4170,13 @@ function mountFloatingWatch(ctx) {
3541
4170
  });
3542
4171
  tabsEl.appendChild(tab);
3543
4172
  }
4173
+ const pageCount = formatPageCount(list.length, wt);
4174
+ if (pageCount !== null) {
4175
+ const tail = document.createElement("span");
4176
+ tail.className = "dsh-ego-tabcount";
4177
+ tail.textContent = pageCount;
4178
+ strip.appendChild(tail);
4179
+ }
3544
4180
  };
3545
4181
  const renderSingleView = (s) => {
3546
4182
  body.innerHTML = "";
@@ -3596,7 +4232,9 @@ function mountFloatingWatch(ctx) {
3596
4232
  };
3597
4233
  const renderSpaces = (spaces) => {
3598
4234
  if (disposed) return;
3599
- const incoming = Array.isArray(spaces) ? spaces : [];
4235
+ const incoming = truncateLastActive(Array.isArray(spaces) ? spaces : []);
4236
+ const liveAll = new Set(incoming.map((s) => s && s.targetId));
4237
+ for (const id of [...owners.keys()]) if (!liveAll.has(id)) owners.delete(id);
3600
4238
  lastList = trackAll ? incoming : incoming.filter((s) => s && s.active === true).slice(0, 1);
3601
4239
  if (lastList.length === 0 && incoming.length > 0) lastList = incoming.slice(0, 1);
3602
4240
  for (const s of lastList) {
@@ -3807,6 +4445,14 @@ function mountFloatingWatch(ctx) {
3807
4445
  }
3808
4446
  view.appendChild(t);
3809
4447
  view.appendChild(u);
4448
+ metaEl = document.createElement("div");
4449
+ metaEl.className = "dsh-ego-liveurl";
4450
+ metaEl.style.fontSize = "10.5px";
4451
+ metaEl.style.opacity = ".7";
4452
+ metaRow = current;
4453
+ metaEl.textContent = metaLineOf(current);
4454
+ metaEl.hidden = metaEl.textContent === "";
4455
+ view.appendChild(metaEl);
3810
4456
  body.appendChild(view);
3811
4457
  };
3812
4458
  let lastSawActive = false;
@@ -3900,6 +4546,9 @@ function mountFloatingWatch(ctx) {
3900
4546
  }
3901
4547
  }
3902
4548
  };
4549
+ const spacesCoalescer = createSpacesCoalescer((list) => {
4550
+ renderSpaces(list);
4551
+ }, 300);
3903
4552
  let reconnectFallbackTimer = null;
3904
4553
  const openStream = () => {
3905
4554
  if (disposed) return;
@@ -3931,7 +4580,23 @@ function mountFloatingWatch(ctx) {
3931
4580
  if (disposed) return;
3932
4581
  try {
3933
4582
  const list = JSON.parse(ev.data);
3934
- if (Array.isArray(list)) renderSpaces(list);
4583
+ if (Array.isArray(list)) spacesCoalescer.push(list);
4584
+ } catch {}
4585
+ });
4586
+ sse.addEventListener("focus", (ev) => {
4587
+ if (disposed) return;
4588
+ try {
4589
+ const f = JSON.parse(ev.data);
4590
+ if (!f || typeof f.targetId !== "string") {
4591
+ owners.clear();
4592
+ paintMeta();
4593
+ return;
4594
+ }
4595
+ owners.set(f.targetId, {
4596
+ source: typeof f.source === "string" ? f.source : void 0,
4597
+ sessionId: typeof f.sessionId === "string" ? f.sessionId : void 0
4598
+ });
4599
+ paintMeta();
3935
4600
  } catch {}
3936
4601
  });
3937
4602
  sse.addEventListener("capture-status", (ev) => {
@@ -3939,6 +4604,29 @@ function mountFloatingWatch(ctx) {
3939
4604
  applyCaptureStatus(JSON.parse(ev.data));
3940
4605
  } catch {}
3941
4606
  });
4607
+ let actionTimer = null;
4608
+ sse.addEventListener("tool-call", (ev) => {
4609
+ if (disposed) return;
4610
+ try {
4611
+ const m = JSON.parse(ev.data);
4612
+ const label = m && m.label;
4613
+ if (!label) return;
4614
+ const el = panel.querySelector("#dsh-ego-action");
4615
+ if (!el) return;
4616
+ const text = pickActionLabel(label);
4617
+ if (text === "") return;
4618
+ el.textContent = "DSH · " + text;
4619
+ el.title = "DSH · " + text;
4620
+ el.hidden = false;
4621
+ if (actionTimer) clearTimeout(actionTimer);
4622
+ actionTimer = setTimeout(() => {
4623
+ actionTimer = null;
4624
+ try {
4625
+ el.hidden = true;
4626
+ } catch {}
4627
+ }, 4e3);
4628
+ } catch {}
4629
+ });
3942
4630
  sse.onerror = () => {
3943
4631
  doConnected = false;
3944
4632
  if (reconnectFallbackTimer) return;
@@ -4194,6 +4882,7 @@ function mountFloatingWatch(ctx) {
4194
4882
  document.addEventListener("visibilitychange", onVisibility);
4195
4883
  return () => {
4196
4884
  disposed = true;
4885
+ spacesCoalescer.cancel();
4197
4886
  if (liveFlushRaf != null) try {
4198
4887
  window.cancelAnimationFrame(liveFlushRaf);
4199
4888
  } catch {}
@@ -4481,6 +5170,9 @@ var TAB_CSS = `
4481
5170
  flex-shrink: 0; font-size: 9px; line-height: 12px; padding: 0 3px; border-radius: 4px;
4482
5171
  border: 1px solid currentColor; opacity: .55; letter-spacing: .2px;
4483
5172
  }
5173
+ /* M4 — human-verification glyph on the row; M8 — open-page count at the tail. */
5174
+ .dsh-ego-side-tab > .dsh-ego-side-tabwarn { flex-shrink: 0; color: #e0a520; font-size: 10px; }
5175
+ .dsh-ego-side-tabcount { flex-shrink: 0; align-self: center; font-size: 10px; opacity: .55; padding-left: 2px; }
4484
5176
  .dsh-ego-side-tab:hover { opacity: 1; background: rgba(128,128,128,.2); }
4485
5177
  .dsh-ego-side-tab.active {
4486
5178
  background: #0a84ff; color: #fff; border-color: transparent; opacity: 1;
@@ -5350,6 +6042,8 @@ function LivePreviewController(ctx, sessionId) {
5350
6042
  this.store = ensureSnapshotStoreCreator()(this._initialState());
5351
6043
  this.frameCache = /* @__PURE__ */ new Map();
5352
6044
  this.pageMeta = /* @__PURE__ */ new Map();
6045
+ this.owners = /* @__PURE__ */ new Map();
6046
+ this.spacesCoalescer = null;
5353
6047
  this.lastList = [];
5354
6048
  this.pinned = null;
5355
6049
  this.currentActiveId = null;
@@ -5408,6 +6102,8 @@ function LivePreviewController(ctx, sessionId) {
5408
6102
  this._pick = "off";
5409
6103
  this._pickMessage = "";
5410
6104
  this._pickTargetId = null;
6105
+ this._actionLabel = null;
6106
+ this._actionTimer = null;
5411
6107
  this.pickControl = createPickControl(function(pick, message) {
5412
6108
  self._setPickState(pick, message);
5413
6109
  }, function(el, a) {
@@ -5431,6 +6127,7 @@ LivePreviewController.prototype._initialState = function() {
5431
6127
  historyOpen: false,
5432
6128
  zoomHint: null,
5433
6129
  wiringStale: false,
6130
+ spaceMeta: "",
5434
6131
  backend: "cdp",
5435
6132
  streamState: "idle",
5436
6133
  streamMessage: "",
@@ -5438,7 +6135,8 @@ LivePreviewController.prototype._initialState = function() {
5438
6135
  streamMime: "video/mp4; codecs=\"avc1.42E01E\"",
5439
6136
  engineUnsupported: false,
5440
6137
  pick: "off",
5441
- pickMessage: ""
6138
+ pickMessage: "",
6139
+ actionLabel: null
5442
6140
  };
5443
6141
  };
5444
6142
  LivePreviewController.prototype.subscribe = function(cb) {
@@ -5497,6 +6195,10 @@ LivePreviewController.prototype._recompute = function() {
5497
6195
  }
5498
6196
  }
5499
6197
  this.currentActiveId = currentTargetId;
6198
+ var metaLine = currentSpace ? joinMeta(formatSpaceMeta({
6199
+ row: currentSpace,
6200
+ owner: self.owners.get(currentTargetId) || null
6201
+ }, Date.now(), wt)) : "";
5500
6202
  this.wiringStale = currentTargetId != null && this.liveImgTargetId !== currentTargetId;
5501
6203
  var showLogin = hasPage && !captchaHit && !this.dismissedGuides.login;
5502
6204
  var captchaKind = captchaHit && !this.dismissedGuides.captcha ? captchaHit.humanCheck.kind || "captcha" : null;
@@ -5525,6 +6227,7 @@ LivePreviewController.prototype._recompute = function() {
5525
6227
  s.link = self.link;
5526
6228
  s.trackAll = self.trackAll;
5527
6229
  s.agentActiveId = self.agentActiveId;
6230
+ s.spaceMeta = metaLine;
5528
6231
  });
5529
6232
  this._syncWatch(currentTargetId);
5530
6233
  };
@@ -5567,6 +6270,7 @@ LivePreviewController.prototype.togglePick = function() {
5567
6270
  LivePreviewController.prototype.dispose = function() {
5568
6271
  this.keyboardProxy.dispose();
5569
6272
  this.disposed = true;
6273
+ if (this.spacesCoalescer) this.spacesCoalescer.cancel();
5570
6274
  try {
5571
6275
  this.pickControl.disable();
5572
6276
  } catch (e) {}
@@ -5755,7 +6459,14 @@ LivePreviewController.prototype._renderEmpty = function() {
5755
6459
  };
5756
6460
  LivePreviewController.prototype._processSpaces = function(spaces) {
5757
6461
  if (this.disposed) return;
5758
- var incoming = Array.isArray(spaces) ? spaces : [];
6462
+ var incoming = truncateLastActive(Array.isArray(spaces) ? spaces : []);
6463
+ var liveAll = new Set(incoming.map(function(s$1) {
6464
+ return s$1 && s$1.targetId;
6465
+ }));
6466
+ var own = this.owners;
6467
+ own.forEach(function(_, id) {
6468
+ if (!liveAll.has(id)) own.delete(id);
6469
+ });
5759
6470
  this.lastList = this.trackAll ? incoming : incoming.filter(function(s$1) {
5760
6471
  return s$1 && s$1.active === true;
5761
6472
  }).slice(0, 1);
@@ -5799,10 +6510,40 @@ LivePreviewController.prototype._processSpaces = function(spaces) {
5799
6510
  if (busy !== this.lastSawActive) this.lastSawActive = busy;
5800
6511
  this._recompute();
5801
6512
  };
6513
+ /**
6514
+ * M5/M6 — 记下「谁在驱动这个 tab」(焦点事件累积)。
6515
+ *
6516
+ * focus 每次工具调用都会推一条(高频),所以同值不重算:一次白重渲染的
6517
+ * 代价在这里被幂等写入吃掉(R6)。
6518
+ */
6519
+ LivePreviewController.prototype._noteFocus = function(f) {
6520
+ var changed = false;
6521
+ if (!f || typeof f.targetId !== "string") {
6522
+ if (this.owners.size > 0) {
6523
+ this.owners.clear();
6524
+ changed = true;
6525
+ }
6526
+ } else {
6527
+ var next = {
6528
+ source: typeof f.source === "string" ? f.source : void 0,
6529
+ sessionId: typeof f.sessionId === "string" ? f.sessionId : void 0
6530
+ };
6531
+ var prev = this.owners.get(f.targetId);
6532
+ if (!prev || prev.source !== next.source || prev.sessionId !== next.sessionId) {
6533
+ this.owners.set(f.targetId, next);
6534
+ changed = true;
6535
+ }
6536
+ }
6537
+ if (changed) this._recompute();
6538
+ };
5802
6539
  LivePreviewController.prototype.openStream = function() {
5803
6540
  if (this.disposed || !this.visible) return;
5804
6541
  this.closeStream();
5805
6542
  var self = this;
6543
+ if (this.spacesCoalescer) this.spacesCoalescer.cancel();
6544
+ this.spacesCoalescer = createSpacesCoalescer(function(list) {
6545
+ self._processSpaces(list);
6546
+ }, 300);
5806
6547
  fetch(WATCH_STATUS_ROUTE, { cache: "no-store" }).then(function(res) {
5807
6548
  return res.ok ? res.json() : null;
5808
6549
  }).then(function(status) {
@@ -5831,7 +6572,36 @@ LivePreviewController.prototype.openStream = function() {
5831
6572
  if (self.disposed) return;
5832
6573
  try {
5833
6574
  var list = JSON.parse(ev.data);
5834
- if (Array.isArray(list)) self._processSpaces(list);
6575
+ if (Array.isArray(list)) if (self.spacesCoalescer) self.spacesCoalescer.push(list);
6576
+ else self._processSpaces(list);
6577
+ } catch (e) {}
6578
+ });
6579
+ this.sse.addEventListener("focus", function(ev) {
6580
+ if (self.disposed) return;
6581
+ try {
6582
+ self._noteFocus(JSON.parse(ev.data));
6583
+ } catch (e) {}
6584
+ });
6585
+ this.sse.addEventListener("tool-call", function(ev) {
6586
+ if (self.disposed) return;
6587
+ try {
6588
+ var m = JSON.parse(ev.data);
6589
+ var label = m && m.label;
6590
+ if (!label || typeof label.zh !== "string" && typeof label.en !== "string") return;
6591
+ self._actionLabel = label;
6592
+ self.store.update(function(st) {
6593
+ st.actionLabel = label;
6594
+ });
6595
+ if (self._actionTimer) clearTimeout(self._actionTimer);
6596
+ self._actionTimer = setTimeout(function() {
6597
+ self._actionTimer = null;
6598
+ self._actionLabel = null;
6599
+ try {
6600
+ self.store.update(function(st) {
6601
+ st.actionLabel = null;
6602
+ });
6603
+ } catch (e) {}
6604
+ }, 4e3);
5835
6605
  } catch (e) {}
5836
6606
  });
5837
6607
  this.sse.addEventListener("capture-status", function(ev) {
@@ -6403,7 +7173,28 @@ function EgoBrowserTab(props) {
6403
7173
  fontSize: "9.5px",
6404
7174
  opacity: ".5",
6405
7175
  flexShrink: "0"
6406
- } }, "v" + CLIENT_BUILD)), h("button", {
7176
+ } }, "v" + CLIENT_BUILD), state.actionLabel ? h("span", {
7177
+ style: {
7178
+ marginLeft: "8px",
7179
+ flexShrink: "0",
7180
+ display: "inline-flex",
7181
+ alignItems: "center",
7182
+ gap: "5px",
7183
+ padding: "2px 8px",
7184
+ borderRadius: "999px",
7185
+ fontSize: "10.5px",
7186
+ background: "rgba(77,107,254,.14)",
7187
+ color: "var(--dsw-alias-label-primary, #4d6bfe)",
7188
+ border: "1px solid rgba(77,107,254,.32)"
7189
+ },
7190
+ title: "DSH · " + pickActionLabel(state.actionLabel)
7191
+ }, h("span", { style: {
7192
+ width: "5px",
7193
+ height: "5px",
7194
+ borderRadius: "50%",
7195
+ background: "#4d6bfe",
7196
+ display: "inline-block"
7197
+ } }), "DSH · " + pickActionLabel(state.actionLabel)) : null), h("button", {
6407
7198
  className: "dsh-ego-side-iconbtn" + (state.busy ? " spinning" : ""),
6408
7199
  title: wt("refresh"),
6409
7200
  onClick: function() {
@@ -6511,7 +7302,10 @@ function EgoBrowserTab(props) {
6511
7302
  onClick: function() {
6512
7303
  controller.selectTab(s.targetId);
6513
7304
  }
6514
- }, badge !== "" ? h("span", { className: "dsh-ego-side-tabwin" }, badge) : null, h("span", { className: "dsh-ego-side-tabdot" }), h("span", {
7305
+ }, badge !== "" ? h("span", { className: "dsh-ego-side-tabwin" }, badge) : null, h("span", { className: "dsh-ego-side-tabdot" }), s.humanCheck && s.humanCheck.detected ? h("span", {
7306
+ className: "dsh-ego-side-tabwarn",
7307
+ title: wt("captchaTitle")
7308
+ }, wt("captchaTabBadge")) : null, h("span", {
6515
7309
  className: "dsh-ego-side-tabtxt",
6516
7310
  style: {
6517
7311
  maxWidth: "150px",
@@ -6526,7 +7320,7 @@ function EgoBrowserTab(props) {
6526
7320
  controller.closeTab(s.targetId);
6527
7321
  }
6528
7322
  }, "×"));
6529
- })) : null;
7323
+ }), formatPageCount(state.spaces.length, wt) !== null ? h("span", { className: "dsh-ego-side-tabcount" }, formatPageCount(state.spaces.length, wt)) : null) : null;
6530
7324
  var body;
6531
7325
  var currentSpace = state.currentSpace;
6532
7326
  if (!currentSpace) body = h("div", { className: "dsh-ego-side-body" }, h("div", { className: "dsh-ego-side-empty" }, h("div", null, wt("noActivePages")), h("div", { style: { fontSize: "11px" } }, wt("noActiveHint"))));
@@ -6576,7 +7370,7 @@ function EgoBrowserTab(props) {
6576
7370
  controller.handleDoubleClick(e);
6577
7371
  }
6578
7372
  }) : h("div", { className: "dsh-ego-side-liveurl" }, state.engineUnsupported ? wt("engineUnsupportedBanner") : state.streamMessage || wt("noScreenshot"));
6579
- body = h("div", { className: "dsh-ego-side-body" }, h("div", { className: "dsh-ego-side-liveview" }, h("div", { className: "dsh-ego-side-livebadge" }, h("span", { className: "dsh-ego-side-state-dot" + (state.pinned ? " pin" : state.busy ? " busy" : "") }), h("span", { style: { flex: 1 } }, (state.backend === "ffmpeg" ? "FFmpeg · H.264" : "CDP") + " · " + (state.streamState === "failed" ? state.streamMessage || wt("failed") : state.streamState === "unsupported" ? wt("engineUnsupportedBanner") : state.streamState) + (state.currentTargetId ? state.wiringStale ? " · " + wt("stale") : " · " + wt("captured") : "")), state.pinned ? h("button", {
7373
+ body = h("div", { className: "dsh-ego-side-body" }, h("div", { className: "dsh-ego-side-liveview" }, h("div", { className: "dsh-ego-side-livebadge" }, h("span", { className: "dsh-ego-side-state-dot" + (state.pinned ? " pin" : state.busy ? " busy" : "") }), h("span", { style: { flex: 1 } }, (state.backend === "ffmpeg" ? "FFmpeg · H.264" : "CDP") + " · " + (state.streamState === "failed" ? state.streamMessage || wt("failed") : state.streamState === "unsupported" ? wt("engineUnsupportedBanner") : state.streamState) + (state.currentTargetId ? state.wiringStale ? " · " + wt("stale") : " · " + wt("captured") : "") + (state.spaceMeta ? " · " + state.spaceMeta : "")), state.pinned ? h("button", {
6580
7374
  className: "dsh-ego-side-back",
6581
7375
  type: "button",
6582
7376
  onClick: function() {