@linxin666/dsh-client-ui-browser-view 0.0.0-stage → 0.4.10
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/LICENSE +202 -0
- package/README.i18n.yaml +6 -0
- package/README.md +77 -2
- package/README.zh.md +78 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +974 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +10555 -0
- package/lib/types/client/guide-icon.d.ts +21 -0
- package/lib/types/client/index.d.ts +51 -0
- package/lib/types/client/live-title.d.ts +39 -0
- package/lib/types/client/locales.d.ts +37 -0
- package/lib/types/client/panel.d.ts +28 -0
- package/lib/types/client/semantic.d.ts +37 -0
- package/lib/types/client/socket.d.ts +114 -0
- package/lib/types/client/tab-title.d.ts +17 -0
- package/lib/types/client/tab-type.d.ts +59 -0
- package/lib/types/core/actions.d.ts +112 -0
- package/lib/types/core/cdp.d.ts +95 -0
- package/lib/types/core/chrome.d.ts +209 -0
- package/lib/types/core/protocol.d.ts +179 -0
- package/lib/types/core/snapshot.d.ts +106 -0
- package/lib/types/core/tabs.d.ts +229 -0
- package/lib/types/host/auth.d.ts +52 -0
- package/lib/types/host/loopback.d.ts +64 -0
- package/lib/types/host/routes.d.ts +73 -0
- package/lib/types/host/service.d.ts +395 -0
- package/lib/types/host/tools.d.ts +64 -0
- package/lib/types/index.d.ts +31 -0
- package/package.json +81 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["css","StateDot","IconRefreshOutlineRegular","css"],"sources":["../../../packages/dsh-browser-view/src/client/live-title.ts","../../../packages/dsh-browser-view/src/client/locales.ts","../../../packages/dsh-browser-view/src/core/protocol.ts","../../../packages/dsh-browser-view/src/client/semantic.ts","../../../packages/dsh-browser-view/src/client/socket.ts","../../../packages/dsh-browser-view/src/client/panel.tsx","../../../packages/dsh-browser-view/src/client/guide-icon.tsx","../../../packages/dsh-browser-view/src/client/tab-type.ts","../../../packages/dsh-browser-view/src/client/tab-title.tsx","../../../packages/dsh-browser-view/src/client/index.ts"],"sourcesContent":["/**\n * The page title the tab body last saw, published for the tab's chip.\n *\n * The chip is drawn by the shell beside a body this plugin owns, so the two\n * cannot exchange props: the body learns the streamed page's title from its\n * socket, and the title component reads it here. A chip that says \"Browser\n * view\" for a session whose page is called \"Checkout\" is the worse of the two\n * labels, so the body publishes and the title prefers what it published.\n *\n * One browser-view tab per session is what the kind declares (no `multiple`),\n * so the session id alone identifies the entry: there is no second tab whose\n * title could overwrite the first one's.\n */\n\n/** Cross-component title channel, keyed by session. */\nexport interface BrowserViewLiveTitleStore {\n /**\n * The last published title for a session.\n * @param sessionId - session key, or undefined when the component has none.\n * @returns the title, or undefined when nothing is published.\n */\n get(sessionId: string | undefined): string | undefined\n /**\n * Publish a session's page title, or clear it with undefined or an empty one.\n * @param sessionId - session key, or undefined to drop the write.\n * @param title - the page title, or undefined when the page has none.\n */\n set(sessionId: string | undefined, title: string | undefined): void\n /**\n * Observe publications.\n * @param listener - synchronous invalidation callback.\n * @returns unsubscribe.\n */\n subscribe(listener: () => void): () => void\n}\n\n/**\n * Create one store for the plugin's lifetime.\n * @returns the channel.\n */\nexport function createLiveTitleStore(): BrowserViewLiveTitleStore {\n const titles = new Map<string, string>()\n const listeners = new Set<() => void>()\n const notify = (): void => {\n // Copy first: a listener may unsubscribe while being notified.\n for (const listener of [...listeners]) listener()\n }\n return {\n get(sessionId: string | undefined): string | undefined {\n return sessionId === undefined ? undefined : titles.get(sessionId)\n },\n set(sessionId: string | undefined, title: string | undefined): void {\n if (sessionId === undefined) return\n const current = titles.get(sessionId)\n if (title === undefined || title.length === 0) {\n if (current === undefined) return\n titles.delete(sessionId)\n notify()\n return\n }\n if (current === title) return\n titles.set(sessionId, title)\n notify()\n },\n subscribe(listener: () => void): () => void {\n listeners.add(listener)\n return () => {\n listeners.delete(listener)\n }\n },\n }\n}\n","/**\n * Locale dictionaries for the browser-view plugin. `zh` is the key-set source\n * of truth; `en` keeps a full key-for-key mirror (packages/AGENTS.md bilingual\n * rules). Registered through ctx.locale.register(NS, { zh, en }); the components\n * read every string through the injected `t` seat, so no copy is hardcoded in\n * JSX.\n *\n * The page-title keys are gone with the page header: a right-sidebar tab is\n * named by the shell's chip, and the chip's text comes from the tab type and\n * the published page title instead ('panel.title' / 'panel.close' had no\n * reader left once the \"back to the conversation\" control was removed).\n *\n * 'panel.tabs.empty' went with the always-drawn tab strip: the controlled\n * browser's chips now appear only when it holds more than one page, so there is\n * no empty strip left to caption.\n */\n\n/** Simplified Chinese dictionary (key-set source of truth). */\nexport const zh = {\n 'tab.title': '浏览器视图',\n 'guide.description': '看 agent 正在操作的网页',\n 'panel.tab.untitled': '未命名页面',\n 'panel.url.empty': '还没有打开页面',\n 'panel.address.label': '页面地址',\n 'panel.toolbar.refresh': '刷新画面',\n 'panel.frame.alt': 'agent 正在操作的页面画面',\n 'panel.empty.title': '还没有画面',\n 'panel.empty.hint': '让 agent 打开一个页面后,这里会实时显示它正在看的网页。',\n 'panel.error.title': '浏览器视图出错',\n 'panel.trace.idle': '暂无工具动作',\n 'panel.status.connecting': '正在连接',\n 'panel.status.loading': '加载中',\n 'panel.status.live': '实时',\n}\n\n/** The browser-view namespace key union. */\nexport type BrowserViewKey = keyof typeof zh\n\n/** English dictionary, key-for-key complete against zh. */\nexport const en: Record<BrowserViewKey, string> = {\n 'tab.title': 'Browser view',\n 'guide.description': 'Watch the page the agent is driving',\n 'panel.tab.untitled': 'Untitled page',\n 'panel.url.empty': 'No page open yet',\n 'panel.address.label': 'Page address',\n 'panel.toolbar.refresh': 'Refresh the frame',\n 'panel.frame.alt': 'Live view of the page the agent is driving',\n 'panel.empty.title': 'No frames yet',\n 'panel.empty.hint': 'Once the agent opens a page, this tab shows the page it is looking at.',\n 'panel.error.title': 'Browser view error',\n 'panel.trace.idle': 'No tool actions yet',\n 'panel.status.connecting': 'Connecting',\n 'panel.status.loading': 'Loading',\n 'panel.status.live': 'Live',\n}\n","/**\n * The browser-view wire contract, shared by both halves.\n *\n * One source of truth for the host <-> browser messages and for the shapes the\n * agent tools return. Both halves compile this file (src/core is compiled into\n * the host program and the browser bundle), so a change here is a change to\n * both sides at once and needs no second definition.\n *\n * Transport: one WebSocket per mounted panel, created by the host half through\n * `ctx.webServer.registerUpgrade`. The host pushes events; the panel sends\n * commands. The browser itself is driven over CDP by the host half, so the\n * panel never speaks the devtools protocol.\n *\n * @module @linxin666/dsh-client-ui-browser-view/core/protocol\n */\n\n/** Version of the wire contract; a mismatch rejects the socket instead of guessing. */\nexport const BROWSER_VIEW_API_VERSION = 1\n\n/** Mount path of the panel socket, relative to the GUI origin. */\nexport const BROWSER_VIEW_SOCKET_PATH = '/api/dsh-browser-view/socket'\n\n/** JPEG quality the host asks CDP for; the panel only displays frames. */\nexport const DEFAULT_JPEG_QUALITY = 70\n\n/** Viewport the host pins on every tab it creates, in CSS pixels. */\nexport const DEFAULT_VIEWPORT = { width: 1280, height: 800 } as const\n\n/** How long a tab may live without any session binding before it is reaped. */\nexport const IDLE_TAB_TTL_MS = 10 * 60_000\n\n/** Deepest DOM snapshot walk the host will perform, in nodes. */\nexport const SNAPSHOT_NODE_LIMIT = 4000\n\n/** Ring size for captured console and network entries per tab. */\nexport const EVENT_RING_SIZE = 500\n\n/** One open tab as the panel and the tools see it. */\nexport interface BrowserTabView {\n /** Stable CDP target id, the handle tools accept. */\n id: string\n /** Current top-level URL. */\n url: string\n /** Current document title, empty when the page has none. */\n title: string\n /** Whether the tab is loading right now. */\n loading: boolean\n /** Session that last acted on the tab, when any. */\n sessionId?: string\n}\n\n/** What the header of the panel shows. */\nexport interface BrowserPanelState {\n /** Tabs in creation order. */\n tabs: BrowserTabView[]\n /** Tab the panel is watching, null when none is open. */\n activeTabId: string | null\n /** Whether the host half currently owns a live browser process. */\n running: boolean\n /** Last error text the host wants the panel to show instead of a frame. */\n message?: string\n}\n\n/** One line of the panel's \"what is the agent doing\" trace. */\nexport interface BrowserActionTrace {\n /** Tool name that produced the change, without its `browser_` prefix. */\n tool: string\n /** One-line human description, already localized by the host. */\n summary: string\n /** Millisecond timestamp of the action. */\n at: number\n}\n\n/** Host pushes one of these to every attached panel. */\nexport type BrowserViewEvent =\n | { v: 1; kind: 'hello'; state: BrowserPanelState }\n | { v: 1; kind: 'state'; state: BrowserPanelState }\n | {\n v: 1\n kind: 'frame'\n /** Tab the frame belongs to. */\n tabId: string\n /** Monotonic frame counter, so a slow panel can drop intermediate frames. */\n seq: number\n /** Frame size in CSS pixels. */\n width: number\n /** Frame size in CSS pixels. */\n height: number\n /** Base64 JPEG, no data: prefix. */\n data: string\n }\n | { v: 1; kind: 'action'; trace: BrowserActionTrace }\n | { v: 1; kind: 'error'; code: string; message: string }\n\n/** Panel sends one of these to the host. */\nexport type BrowserViewCommand =\n | { v: 1; kind: 'attach'; sessionId?: string }\n | { v: 1; kind: 'select-tab'; tabId: string }\n | { v: 1; kind: 'request-frame' }\n | { v: 1; kind: 'close-tab'; tabId: string }\n\n/** A console entry the host rang in while the tab was open. */\nexport interface BrowserConsoleEntry {\n /** Console level: log, info, warn, error, debug. */\n level: string\n /** Already-stringified arguments. */\n text: string\n /** Millisecond timestamp. */\n at: number\n}\n\n/** A network request the host observed, reduced to what verification needs. */\nexport interface BrowserNetworkEntry {\n /** Request URL. */\n url: string\n /** HTTP method. */\n method: string\n /** Response status, 0 while pending or on a transport failure. */\n status: number\n /** Response mime type when known. */\n mimeType?: string\n /** CDP failure text when the request failed. */\n failure?: string\n /** Millisecond timestamp of the request. */\n at: number\n}\n\n/** One node of the DOM snapshot the tools return. */\nexport interface BrowserSnapshotNode {\n /** Depth-first index, the handle `browser_click` accepts as `ref`. */\n ref: number\n /** Lowercase tag name. */\n tag: string\n /** Element id, when set. */\n id?: string\n /** Element classes, when set. */\n classes?: string[]\n /** Accessible role when Chrome reports one. */\n role?: string\n /** Accessible name when Chrome reports one. */\n name?: string\n /** Visible text for leaf nodes, truncated by the host. */\n text?: string\n /** Bounding box in CSS pixels, window-relative. */\n box?: { x: number; y: number; width: number; height: number }\n /** Depth in the walked tree. */\n depth: number\n}\n\n/** What `browser_snapshot` returns to the model. */\nexport interface BrowserSnapshot {\n /** Tab the snapshot came from. */\n tabId: string\n /** Top-level URL at snapshot time. */\n url: string\n /** Document title. */\n title: string\n /** Walked nodes, bounded by SNAPSHOT_NODE_LIMIT. */\n nodes: BrowserSnapshotNode[]\n /** True when the walk hit the node limit. */\n truncated: boolean\n}\n\n/** Whether a decoded JSON value is a command this version accepts. */\nexport function isBrowserViewCommand(value: unknown): value is BrowserViewCommand {\n if (typeof value !== 'object' || value === null) return false\n const candidate = value as Record<string, unknown>\n if (candidate.v !== BROWSER_VIEW_API_VERSION) return false\n switch (candidate.kind) {\n case 'attach':\n return candidate.sessionId === undefined || typeof candidate.sessionId === 'string'\n case 'select-tab':\n return typeof candidate.tabId === 'string'\n case 'close-tab':\n return typeof candidate.tabId === 'string'\n case 'request-frame':\n return true\n default:\n return false\n }\n}\n","/**\n * Semantic attributes for the browser-view surface (semantic-attrs-v1).\n *\n * The plugin name lives on the root element of each surface so part values stay\n * bare words; a theme anchors on the pair, never on a part name that repeats\n * the plugin. The right-sidebar chip and the shell's tab strip around it are\n * not ours, so only this plugin's own elements are stamped.\n *\n * The body's part names follow the shipped browser tab's structure - a toolbar\n * with an address display, the frame, and the action trace - so a theme that\n * already anchors on that chrome reaches this tab the same way.\n */\n\n/** Root plugin attribute value carried by every top-level browser-view element. */\nexport const BROWSER_VIEW_PLUGIN = 'browser-view'\n\n/** Part names this plugin emits, in surface order. */\nexport const BROWSER_VIEW_PARTS = {\n /** The tab body the sidebar mounts in its content area. */\n panel: 'panel',\n /** Top chrome row: address display, connection state, refresh. */\n toolbar: 'toolbar',\n /** The read-only address display of the streamed page. */\n address: 'address',\n /** The controlled browser's tab chips; drawn only when it holds several. */\n tabs: 'tabs',\n /** The live frame image. */\n frame: 'frame',\n /** Bottom action trace. */\n trace: 'trace',\n /** Connection state marker in the toolbar. */\n status: 'status',\n /** No-frame placeholder. */\n empty: 'empty',\n /** Host-reported failure placeholder. */\n error: 'error',\n /** This plugin's share of the right-sidebar chip. */\n tabTitle: 'tab-title',\n} as const\n","/**\n * Panel-side WebSocket client.\n *\n * The host half owns the CDP connection and pushes state, JPEG frames, tool\n * actions and errors over one socket per mounted panel (see ../core/protocol.ts\n * for the frozen wire contract). This module is the only place the browser half\n * touches the wire: it derives the page or shell-owned socket URL, narrows every\n * incoming message through the protocol's discriminant, drops stale frames,\n * and reconnects with exponential backoff.\n *\n * Nothing here imports the DOM's WebSocket type directly: the constructor is\n * injectable so the tests drive a fake transport instead of a network.\n *\n * @module @linxin666/dsh-client-ui-browser-view/client/socket\n */\nimport {\n BROWSER_VIEW_API_VERSION,\n BROWSER_VIEW_SOCKET_PATH,\n} from '../core/protocol.ts'\nimport type {\n BrowserActionTrace,\n BrowserPanelState,\n BrowserTabView,\n BrowserViewCommand,\n BrowserViewEvent,\n} from '../core/protocol.ts'\n\n/** Connection phase the panel renders in its status line. */\nexport type BrowserViewSocketStatus = 'connecting' | 'open' | 'reconnecting' | 'closed'\n\n/** First reconnect delay, doubled per failed attempt. */\nexport const RECONNECT_BASE_MS = 500\n\n/** Reconnect ceiling; a host that stays down must not spin the tab. */\nexport const RECONNECT_MAX_MS = 15_000\n\n/** One decoded frame, exactly as the panel needs it. */\nexport interface BrowserViewFrame {\n /** Tab the frame belongs to. */\n readonly tabId: string\n /** Host-side monotonic counter for this tab. */\n readonly seq: number\n /** Frame width in CSS pixels. */\n readonly width: number\n /** Frame height in CSS pixels. */\n readonly height: number\n /** Base64 JPEG, no data: prefix. */\n readonly data: string\n}\n\n/** Callbacks the panel installs on a connection. */\nexport interface BrowserViewSocketHandlers {\n /** Connection phase changed. */\n onStatus?(status: BrowserViewSocketStatus): void\n /** Tabs, active tab and running flag were (re)published. */\n onState(state: BrowserPanelState): void\n /** A fresh frame arrived, already filtered for staleness. */\n onFrame(frame: BrowserViewFrame): void\n /** The agent performed one tool action. */\n onAction(trace: BrowserActionTrace): void\n /** The host reported a failure the panel must show instead of a frame. */\n onError(code: string, message: string): void\n}\n\n/** The minimal socket face this client needs; the DOM WebSocket satisfies it. */\nexport interface BrowserViewWebSocketLike {\n send(data: string): void\n close(code?: number, reason?: string): void\n onopen: ((event: unknown) => void) | null\n onmessage: ((event: { data: unknown }) => void) | null\n onclose: ((event: unknown) => void) | null\n onerror: ((event: unknown) => void) | null\n}\n\n/** Constructor shape of the transport; injectable for tests. */\nexport type BrowserViewWebSocketCtor = new (url: string) => BrowserViewWebSocketLike\n\n/** Options for one connection. */\nexport interface BrowserViewSocketOptions {\n /** Transport constructor; defaults to the page's WebSocket. */\n readonly WebSocketImpl?: BrowserViewWebSocketCtor\n /** Origin source for the URL; defaults to `globalThis.location`. */\n readonly location?: { readonly protocol: string; readonly host: string }\n /** Session the panel attaches to, forwarded in the `attach` command. */\n readonly sessionId?: string\n /** Timer seam so backoff can be advanced deterministically in tests. */\n readonly setTimer?: (handler: () => void, ms: number) => unknown\n /** Timer cancellation seam paired with `setTimer`. */\n readonly clearTimer?: (handle: unknown) => void\n}\n\n/** The handle a panel keeps for the lifetime of one mounted connection. */\nexport interface BrowserViewSocket {\n /** Send one command, buffered while the socket is not open. */\n send(command: BrowserViewCommand): void\n /** Stop reconnecting and close the transport. */\n close(): void\n /** Current connection phase. */\n status(): BrowserViewSocketStatus\n}\n\n/** Commands held while the socket is down; the oldest drop first. */\nconst PENDING_COMMAND_LIMIT = 16\n\n/** The network authority of a shell-owned Host, without credentials or a path. */\nfunction hostAuthorityOf(base: string | undefined): { protocol: string; authority: string } | undefined {\n if (base === undefined || base === '') return undefined\n let url: URL\n try {\n url = new URL(base)\n } catch {\n return undefined\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return undefined\n if (url.username !== '' || url.password !== '' || url.host === '') return undefined\n return { protocol: url.protocol, authority: url.host }\n}\n\n/**\n * Derive the socket URL from a web page or its application shell's Host.\n *\n * A web page keeps its own origin even when a transport hook is present. An\n * application-delivered page such as the desktop shell's dsh-app: cannot carry\n * a WebSocket upgrade on that scheme, so it uses the Host authority the shell\n * publishes instead. The shell rewrites that handshake; the Host fence is unchanged.\n * @param location - origin the panel is rendered on.\n * @param streamBaseUrl - official `__DSH_TRANSPORT__.streamBaseUrl`, when published.\n * @returns the absolute ws/wss URL, or null when no safe Host authority is known.\n */\nexport function browserViewSocketUrl(\n location: { readonly protocol: string; readonly host: string },\n streamBaseUrl?: string,\n): string | null {\n const pageProtocol = location.protocol === 'https:'\n ? 'wss:'\n : location.protocol === 'http:'\n ? 'ws:'\n : null\n if (pageProtocol !== null) return `${pageProtocol}//${location.host}${BROWSER_VIEW_SOCKET_PATH}`\n const base = hostAuthorityOf(streamBaseUrl)\n if (base === undefined) return null\n const protocol = base.protocol === 'https:' ? 'wss:' : 'ws:'\n return `${protocol}//${base.authority}${BROWSER_VIEW_SOCKET_PATH}`\n}\n\n/**\n * Backoff for one reconnect attempt.\n * @param attempt - zero-based attempt index.\n * @returns delay in milliseconds, capped at RECONNECT_MAX_MS.\n */\nexport function reconnectDelay(attempt: number): number {\n const exponential = RECONNECT_BASE_MS * 2 ** Math.max(0, Math.floor(attempt))\n return Math.min(exponential, RECONNECT_MAX_MS)\n}\n\n/** Narrow a tab row from the wire. */\nfunction readTab(value: unknown): BrowserTabView | null {\n if (typeof value !== 'object' || value === null) return null\n const candidate = value as Record<string, unknown>\n if (typeof candidate.id !== 'string') return null\n if (typeof candidate.url !== 'string') return null\n if (typeof candidate.title !== 'string') return null\n if (typeof candidate.loading !== 'boolean') return null\n return {\n id: candidate.id,\n url: candidate.url,\n title: candidate.title,\n loading: candidate.loading,\n ...(typeof candidate.sessionId === 'string' ? { sessionId: candidate.sessionId } : {}),\n }\n}\n\n/** Narrow the panel state from the wire. */\nfunction readPanelState(value: unknown): BrowserPanelState | null {\n if (typeof value !== 'object' || value === null) return null\n const candidate = value as Record<string, unknown>\n if (!Array.isArray(candidate.tabs)) return null\n if (typeof candidate.running !== 'boolean') return null\n if (candidate.activeTabId !== null && typeof candidate.activeTabId !== 'string') return null\n const tabs: BrowserTabView[] = []\n for (const entry of candidate.tabs) {\n const tab = readTab(entry)\n if (tab === null) return null\n tabs.push(tab)\n }\n return {\n tabs,\n activeTabId: candidate.activeTabId as string | null,\n running: candidate.running,\n ...(typeof candidate.message === 'string' ? { message: candidate.message } : {}),\n }\n}\n\n/**\n * Narrow one decoded payload into a protocol event.\n *\n * The protocol is a discriminated union over `kind`, so an unknown kind or a\n * wrong field type is a shape this panel cannot render: it is dropped rather\n * than half-applied, which keeps one malformed push from corrupting the view.\n * @param value - parsed JSON value (or a raw frame string).\n * @returns the event, or null when the payload is not one this version reads.\n */\nexport function parseBrowserViewEvent(value: unknown): BrowserViewEvent | null {\n let payload = value\n if (typeof payload === 'string') {\n try {\n payload = JSON.parse(payload)\n } catch {\n return null\n }\n }\n if (typeof payload !== 'object' || payload === null) return null\n const candidate = payload as Record<string, unknown>\n if (candidate.v !== BROWSER_VIEW_API_VERSION) return null\n switch (candidate.kind) {\n case 'hello':\n case 'state': {\n const state = readPanelState(candidate.state)\n if (state === null) return null\n return { v: BROWSER_VIEW_API_VERSION, kind: candidate.kind, state }\n }\n case 'frame': {\n if (typeof candidate.tabId !== 'string') return null\n if (typeof candidate.seq !== 'number') return null\n if (typeof candidate.width !== 'number') return null\n if (typeof candidate.height !== 'number') return null\n if (typeof candidate.data !== 'string') return null\n return {\n v: BROWSER_VIEW_API_VERSION,\n kind: 'frame',\n tabId: candidate.tabId,\n seq: candidate.seq,\n width: candidate.width,\n height: candidate.height,\n data: candidate.data,\n }\n }\n case 'action': {\n const trace = candidate.trace\n if (typeof trace !== 'object' || trace === null) return null\n const row = trace as Record<string, unknown>\n if (typeof row.tool !== 'string' || typeof row.summary !== 'string' || typeof row.at !== 'number') return null\n return {\n v: BROWSER_VIEW_API_VERSION,\n kind: 'action',\n trace: { tool: row.tool, summary: row.summary, at: row.at },\n }\n }\n case 'error': {\n if (typeof candidate.code !== 'string' || typeof candidate.message !== 'string') return null\n return { v: BROWSER_VIEW_API_VERSION, kind: 'error', code: candidate.code, message: candidate.message }\n }\n default:\n return null\n }\n}\n\n/**\n * Open one connection to the host half and keep it alive.\n *\n * Sequencing: every successful open sends `attach` (the host answers with\n * `hello` plus frames), and the per-tab frame counter is cleared because the\n * host restarts its `seq` for a new connection — keeping the old high-water\n * mark would drop the whole fresh stream.\n * @param handlers - panel callbacks.\n * @param options - transport, origin, session and timer seams.\n * @returns the handle the panel closes on unmount.\n */\nexport function connectBrowserViewSocket(\n handlers: BrowserViewSocketHandlers,\n options: BrowserViewSocketOptions = {},\n): BrowserViewSocket {\n const globals = globalThis as {\n WebSocket?: BrowserViewWebSocketCtor\n location?: { protocol: string; host: string }\n __DSH_TRANSPORT__?: { streamBaseUrl?: unknown }\n }\n const WebSocketImpl = options.WebSocketImpl ?? globals.WebSocket\n const location = options.location ?? globals.location\n const setTimer = options.setTimer ?? ((handler, ms) => setTimeout(handler, ms))\n const clearTimer = options.clearTimer ?? ((handle) => { clearTimeout(handle as ReturnType<typeof setTimeout>) })\n const publishedBase = globals.__DSH_TRANSPORT__?.streamBaseUrl\n const streamBaseUrl = typeof publishedBase === 'string' ? publishedBase : undefined\n const url = location === undefined ? null : browserViewSocketUrl(location, streamBaseUrl)\n\n let status: BrowserViewSocketStatus = 'connecting'\n let socket: BrowserViewWebSocketLike | null = null\n let attempt = 0\n let disposed = false\n let timer: unknown = null\n const pending: BrowserViewCommand[] = []\n const lastSeqByTab = new Map<string, number>()\n\n /** Publish a phase change once. */\n const setStatus = (next: BrowserViewSocketStatus): void => {\n if (status === next) return\n status = next\n handlers.onStatus?.(next)\n }\n\n /** Send without buffering (open socket only). */\n const sendNow = (command: BrowserViewCommand): boolean => {\n if (socket === null) return false\n try {\n socket.send(JSON.stringify(command))\n return true\n } catch {\n return false\n }\n }\n\n /** Dispatch one decoded event, dropping frames older than what is on screen. */\n const dispatch = (event: BrowserViewEvent): void => {\n switch (event.kind) {\n case 'hello':\n case 'state':\n handlers.onState(event.state)\n return\n case 'frame': {\n const previous = lastSeqByTab.get(event.tabId)\n if (previous !== undefined && event.seq <= previous) return\n lastSeqByTab.set(event.tabId, event.seq)\n handlers.onFrame({\n tabId: event.tabId,\n seq: event.seq,\n width: event.width,\n height: event.height,\n data: event.data,\n })\n return\n }\n case 'action':\n handlers.onAction(event.trace)\n return\n case 'error':\n handlers.onError(event.code, event.message)\n return\n default:\n return\n }\n }\n\n /** Arm the next reconnect; each failure doubles the wait until the ceiling. */\n const scheduleReconnect = (): void => {\n if (disposed) return\n if (url === null || WebSocketImpl === undefined) {\n setStatus('closed')\n return\n }\n setStatus('reconnecting')\n if (timer !== null) clearTimer(timer)\n const delay = reconnectDelay(attempt)\n attempt += 1\n timer = setTimer(() => {\n timer = null\n connect()\n }, delay)\n }\n\n /** Open one transport and wire it to the handlers. */\n const connect = (): void => {\n if (disposed) return\n if (url === null || WebSocketImpl === undefined) {\n setStatus('closed')\n return\n }\n setStatus(attempt === 0 ? 'connecting' : 'reconnecting')\n let transport: BrowserViewWebSocketLike\n try {\n transport = new WebSocketImpl(url)\n } catch {\n socket = null\n scheduleReconnect()\n return\n }\n socket = transport\n transport.onopen = () => {\n if (disposed) return\n attempt = 0\n lastSeqByTab.clear()\n setStatus('open')\n while (pending.length > 0) {\n const command = pending.shift()\n if (command !== undefined) sendNow(command)\n }\n sendNow({ v: BROWSER_VIEW_API_VERSION, kind: 'attach', ...(options.sessionId === undefined ? {} : { sessionId: options.sessionId }) })\n }\n transport.onmessage = (event) => {\n if (disposed) return\n const parsed = parseBrowserViewEvent(event.data)\n if (parsed !== null) dispatch(parsed)\n }\n transport.onerror = () => {\n // A close event always follows a failed handshake; reconnection is armed there.\n }\n transport.onclose = () => {\n if (socket === transport) socket = null\n if (disposed) return\n scheduleReconnect()\n }\n }\n\n connect()\n\n return {\n send(command: BrowserViewCommand): void {\n if (sendNow(command)) return\n pending.push(command)\n if (pending.length > PENDING_COMMAND_LIMIT) pending.shift()\n },\n close(): void {\n if (disposed) return\n disposed = true\n if (timer !== null) {\n clearTimer(timer)\n timer = null\n }\n const transport = socket\n socket = null\n setStatus('closed')\n if (transport !== null) {\n try {\n transport.close()\n } catch {\n // A transport that already failed may throw on close; nothing left to do.\n }\n }\n },\n status(): BrowserViewSocketStatus {\n return status\n },\n }\n}\n","/**\n * The browser view tab's content, mounted by the right sidebar into its\n * content area under the 'browser-view' tab type.\n *\n * The shell owns the column, the chip, the close control and the switch between\n * tabs; this file owns what is drawn inside one tab and scrolls inside it. It\n * therefore has no title bar of its own and no \"back\" control - a page header\n * in a sidebar tab would repeat the chip right above it - and it fills the\n * height it is given instead of positioning itself against the viewport.\n *\n * The body is laid out like the shipped browser tab's chrome: one 38px toolbar\n * holding the address display, the connection marker and the one control this\n * plugin actually has - refresh the captured frame - then the frame itself,\n * then the action trace. Nothing here claims a capability the host does not\n * expose: there is no forward/back pair, no reload of the page (the host drives\n * navigation, this side only observes it) and no \"open in a new window\",\n * because the page lives in a Chromium process on the host.\n *\n * The refresh control and the state marker are the product's own atoms -\n * IconRefreshOutlineRegular and StateDot from @deepseek-ai/dsh-client-ui-primitives,\n * the same two the shipped browser tab's toolbar uses - so the chrome is drawn\n * from one source rather than redrawn beside it. The package's Vite config\n * inlines @deepseek-ai packages, which is what lets the jsdom body tests load\n * that entry point (it imports its own stylesheets).\n *\n * Frame rendering: an <img> fed a base64 JPEG data URL, not a <canvas>. The host\n * already decoded and re-encoded the frame (CDP gives it JPEG base64), so there\n * are no pixels for this side to compose - a canvas would add a drawImage hop,\n * a context lifecycle and an invalidation race for zero gain, while the image\n * element decodes off the main thread and lets CSS own the aspect-ratio fit.\n */\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport {\n IconRefreshOutlineRegular,\n StateDot,\n type StateDotState,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { BrowserActionTrace, BrowserPanelState } from '../core/protocol.ts'\nimport { BROWSER_VIEW_API_VERSION } from '../core/protocol.ts'\nimport type { BrowserViewLiveTitleStore } from './live-title.ts'\nimport { BROWSER_VIEW_PARTS, BROWSER_VIEW_PLUGIN } from './semantic.ts'\nimport {\n connectBrowserViewSocket,\n type BrowserViewFrame,\n type BrowserViewSocket,\n type BrowserViewSocketHandlers,\n type BrowserViewSocketStatus,\n} from './socket.ts'\nimport css from './panel.module.css'\n\n/** Page-side socket factory; tests inject a fake transport through it. */\nexport type BrowserViewSocketFactory = (handlers: BrowserViewSocketHandlers) => BrowserViewSocket\n\n/** Business face injected into the tab body. */\nexport interface BrowserViewPanelFace {\n /** Session whose screencast this body shows. */\n readonly sessionId?: string\n /** Channel the chip reads this body's page title from. */\n readonly liveTitle?: BrowserViewLiveTitleStore\n}\n\n/** Panel props: the locale seat, the injected face, and the seams a test may supply. */\nexport type BrowserViewPanelProps = PropsLocale<'browser-view'> & Partial<BrowserViewPanelFace> & {\n /** Socket factory override; defaults to the real same-origin connection. */\n readonly socketFactory?: BrowserViewSocketFactory\n /** Origin override; defaults to the page's own location. */\n readonly location?: { readonly protocol: string; readonly host: string }\n}\n\n/** Trace rows kept on screen; older tool calls scroll out of relevance. */\nconst TRACE_LIMIT = 5\n\n/** State before the host publishes anything. */\nconst EMPTY_STATE: BrowserPanelState = { tabs: [], activeTabId: null, running: false }\n\n/** Join truthy class names (CSS Modules maps are typed as plain records). */\nfunction cx(...names: ReadonlyArray<string | false | null | undefined>): string {\n return names.filter((name): name is string => typeof name === 'string' && name.length > 0).join(' ')\n}\n\n/**\n * Render the browser view tab body.\n * @param props - composed slot props.\n * @returns the tab content.\n */\nexport function BrowserViewPanel({ t, sessionId, liveTitle, socketFactory, location }: BrowserViewPanelProps) {\n const [state, setState] = useState<BrowserPanelState>(EMPTY_STATE)\n const [frame, setFrame] = useState<BrowserViewFrame | null>(null)\n const [traces, setTraces] = useState<ReadonlyArray<BrowserActionTrace>>([])\n const [error, setError] = useState<{ readonly code: string; readonly message: string } | null>(null)\n const [status, setStatus] = useState<BrowserViewSocketStatus>('connecting')\n const socketRef = useRef<BrowserViewSocket | null>(null)\n /** Last active tab seen in a state push; a tab switch invalidates the picture. */\n const lastActiveTabRef = useRef<string | null>(null)\n\n const factory = useMemo<BrowserViewSocketFactory>(\n () => socketFactory ?? ((handlers) => connectBrowserViewSocket(handlers, { location, sessionId })),\n [socketFactory, location, sessionId],\n )\n\n useEffect(() => {\n const instance = factory({\n onStatus: (next) => { setStatus(next) },\n onState: (next) => {\n // Compare outside the state updater: an updater must stay pure, and a\n // frame from the previous tab would otherwise stay on screen after the\n // page switched tabs.\n if (lastActiveTabRef.current !== next.activeTabId) {\n lastActiveTabRef.current = next.activeTabId\n setFrame(null)\n }\n setState(next)\n },\n onFrame: (next) => {\n setError(null)\n setFrame(next)\n },\n onAction: (trace) => {\n setTraces((current) => [trace, ...current].slice(0, TRACE_LIMIT))\n },\n onError: (code, message) => { setError({ code, message }) },\n })\n socketRef.current = instance\n return () => {\n socketRef.current = null\n instance.close()\n }\n }, [factory])\n\n const activeTab = state.tabs.find((tab) => tab.id === state.activeTabId) ?? null\n // Loading is per tab on the wire; the connection phase joins it so a page\n // that is still dialing never claims to be live.\n const loading = activeTab?.loading === true || status !== 'open'\n // The wire carries two failure channels: an explicit error push, and the\n // message a state push may use to say \"show this instead of a frame\". Both\n // land on the same block so the tab never shows a stale picture beside a host\n // complaint.\n const hostError = state.message !== undefined && state.message.length > 0\n ? { code: '', message: state.message }\n : null\n const effectiveError = error ?? hostError\n // One narrowed value for the stage: a frame is only paintable when the host\n // reported no error, which keeps the null check off the JSX branch.\n const visibleFrame = effectiveError === null ? frame : null\n const dataUrl = visibleFrame === null ? null : `data:image/jpeg;base64,${visibleFrame.data}`\n // The marker names what the viewer is actually looking at: the socket's phase\n // first (nothing is live before the host answers), then the page's own load\n // state. The same three strings the trace footer used to carry.\n const statusLabel = status !== 'open'\n ? t('panel.status.connecting')\n : loading ? t('panel.status.loading') : t('panel.status.live')\n // Three of the product's five dot states, in the order a viewer meets them:\n // nothing reached yet, a page still loading, a settled live picture.\n const dotState: StateDotState = status !== 'open' ? 'idle' : loading ? 'ongoing' : 'done'\n const pageTitle = activeTab === null || activeTab.title.length === 0 ? undefined : activeTab.title\n const url = activeTab?.url ?? ''\n\n // The chip beside this tab names the page being streamed, and only this body\n // can know that name. Publishing in an effect keeps render pure; the cleanup\n // clears the entry so a closed tab leaves no stale name behind.\n useEffect(() => {\n liveTitle?.set(sessionId, pageTitle)\n return () => { liveTitle?.set(sessionId, undefined) }\n }, [liveTitle, sessionId, pageTitle])\n\n return (\n <div className={css.root} data-dsh-plugin={BROWSER_VIEW_PLUGIN} data-dsh-part={BROWSER_VIEW_PARTS.panel}>\n <div className={css.toolbar} data-dsh-part={BROWSER_VIEW_PARTS.toolbar}>\n <div className={css.addressBox} data-dsh-part={BROWSER_VIEW_PARTS.address}>\n <input\n className={css.address}\n type=\"text\"\n readOnly\n value={url}\n title={url.length > 0 ? url : undefined}\n placeholder={t('panel.url.empty')}\n aria-label={t('panel.address.label')}\n spellCheck={false}\n // Selecting on click is the address bar's own gesture: the whole\n // address is ready to copy without a second control.\n onFocus={(event) => { event.currentTarget.select() }}\n onClick={(event) => { event.currentTarget.select() }}\n />\n </div>\n <span className={css.status} data-dsh-part={BROWSER_VIEW_PARTS.status} aria-live=\"polite\">\n <StateDot state={dotState} size={10} />\n <span className={css.statusText}>{statusLabel}</span>\n </span>\n <button\n type=\"button\"\n className={css.tool}\n title={t('panel.toolbar.refresh')}\n aria-label={t('panel.toolbar.refresh')}\n disabled={activeTab === null}\n onClick={() => {\n socketRef.current?.send({ v: BROWSER_VIEW_API_VERSION, kind: 'request-frame' })\n }}\n >\n <IconRefreshOutlineRegular />\n </button>\n </div>\n {state.tabs.length > 1 && (\n <div className={css.tabs} role=\"tablist\" data-dsh-part={BROWSER_VIEW_PARTS.tabs}>\n {state.tabs.map((tab) => (\n <button\n key={tab.id}\n type=\"button\"\n role=\"tab\"\n aria-selected={tab.id === state.activeTabId}\n className={cx(css.tab, tab.id === state.activeTabId && css.tabActive)}\n title={tab.url}\n onClick={() => {\n socketRef.current?.send({ v: BROWSER_VIEW_API_VERSION, kind: 'select-tab', tabId: tab.id })\n }}\n >\n {tab.title.length > 0 ? tab.title : t('panel.tab.untitled')}\n </button>\n ))}\n </div>\n )}\n <div className={css.content}>\n {effectiveError !== null ? (\n <div className={css.error} data-dsh-part={BROWSER_VIEW_PARTS.error} role=\"alert\">\n <span className={css.errorTitle}>{t('panel.error.title')}</span>\n <span className={css.errorBody}>{effectiveError.message}</span>\n {effectiveError.code.length > 0 && <span className={css.errorCode}>{effectiveError.code}</span>}\n </div>\n ) : dataUrl === null || visibleFrame === null ? (\n <div className={css.empty} data-dsh-part={BROWSER_VIEW_PARTS.empty}>\n <span className={css.emptyTitle}>{t('panel.empty.title')}</span>\n <span className={css.emptyHint}>{t('panel.empty.hint')}</span>\n </div>\n ) : (\n <img\n className={css.frame}\n data-dsh-part={BROWSER_VIEW_PARTS.frame}\n src={dataUrl}\n alt={t('panel.frame.alt')}\n width={visibleFrame.width}\n height={visibleFrame.height}\n draggable={false}\n />\n )}\n </div>\n <footer className={css.trace} data-dsh-part={BROWSER_VIEW_PARTS.trace}>\n <div className={css.traceList}>\n {traces.length === 0\n ? <span className={css.traceIdle}>{t('panel.trace.idle')}</span>\n : traces.map((trace, index) => (\n <div key={`${trace.at}-${index}`} className={css.traceRow}>\n <span className={css.traceTool}>{trace.tool}</span>\n <span className={css.traceSummary}>{trace.summary}</span>\n </div>\n ))}\n </div>\n </footer>\n </div>\n )\n}\n","/**\n * The guide capsule's glyph: this plugin's own mark, not a product artwork.\n *\n * The right sidebar's guide lists one capsule per registered tab type and draws\n * the type's `icon` (a `ComponentType<IconProps>`) at 22px, or 26px beside a\n * description. Drawing locally keeps the plugin free of icon-set coupling: the\n * only thing borrowed is the IconProps shape, as a type, and the glyph itself\n * inherits its colour from the capsule through currentColor.\n *\n * It restates the mark the chip already uses - a browser\n * window with the agent's cursor inside - so a user who has seen one recognises\n * the other. It is deliberately not the shipped browser tab's artwork: this tab\n * is a different implementation and does not pass itself off as that one.\n */\nimport type { IconProps } from '@deepseek-ai/dsh-client-ui-primitives'\n\n/**\n * Render the guide glyph.\n * @param props - square edge in px (the guide passes 22 or 26) and a layout class.\n * @returns the window-and-cursor mark.\n */\nexport function BrowserViewGuideGlyph({ size = 16, className }: IconProps) {\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n className={className}\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <rect x=\"1.75\" y=\"2.25\" width=\"12.5\" height=\"11.5\" rx=\"1.75\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <path d=\"M1.75 5.75h12.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.2\" />\n <circle cx=\"3.9\" cy=\"4\" r=\"0.7\" fill=\"currentColor\" />\n <path d=\"M7.4 8.15l3.85 1.7-1.6.65-.7 1.65z\" fill=\"currentColor\" />\n </svg>\n )\n}\n","/**\n * The right-sidebar tab type this plugin contributes: its kind, its identity,\n * the navigation parameters it accepts, and the guide capsule that opens it.\n *\n * A tab type is registered in two stages. Stage one is a purely static\n * declaration (ctx.sidebarRightTabs.register) naming the kind, the chip's\n * initial text and the guide entry; stage two is the keyed 'sidebar.right.pane.tab'\n * body and 'sidebar.right.pane.tab.title' registration under this same id, which\n * is what the seat dispatches on. The kind is what openTabIn/openTab name, and\n * it is also the key of the params map below.\n *\n * The `guide` entry is what puts this type on the right sidebar's guide page -\n * the list a user sees when the column has no page in front. It is the one place\n * that opens the tab now that the conversation header carries no entry of its\n * own, and the guide owns the click:\n * it renders one capsule per registered entry and opens the entry's own `kind`\n * (GuideBody: tab.actions.openTab(entry.kind, { replaceTab: true })), so this\n * plugin declares the capsule and never wires a handler of its own. No\n * commandId is declared: the plugin registers no keyboard shortcut, and the\n * guide would draw a key hint the shortcut table cannot honour.\n *\n * The kind is deliberately NOT 'browser': the shipped\n * @deepseek-ai/dsh-client-ui-sidebar-browser registers that kind, and a\n * registration in the extension band takes a kind over, so reusing it would\n * shadow the shipped browser tab out of existence - the one thing this\n * package's AGENTS.md forbids. A distinct kind is what lets both live in the\n * same column.\n */\nimport type { SidebarRightTabDefinition } from '@deepseek-ai/dsh-client-ui-sidebar-right/client'\nimport { BrowserViewGuideGlyph } from './guide-icon.tsx'\nimport type { BrowserViewKey } from './locales.ts'\n\n/** What this plugin's tabs are, and what openTabIn/openTab name. */\nexport const BROWSER_VIEW_TAB_KIND = 'browser-view'\n\n/** This implementation's identity in the tab system; also the keyed slot dispatch key. */\nexport const BROWSER_VIEW_TAB_ID = '@linxin666/dsh-client-ui-browser-view'\n\n/** Identity of this type's capsule on the guide page, stable within the provider. */\nexport const BROWSER_VIEW_GUIDE_ENTRY_ID = 'open'\n\n/**\n * Position of this type's capsule among every registered type's entries. The\n * shipped browser tab sits at 30; this one follows it instead of competing for\n * the same slot, because it is a companion view rather than a replacement.\n */\nexport const BROWSER_VIEW_GUIDE_ENTRY_ORDER = 40\n\n/** Navigation parameters this tab type accepts. */\nexport interface BrowserViewTabParams {\n /** Chrome tab the pane should stream first, when the opener knows one. */\n readonly tabId?: string\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-sidebar-right/client' {\n interface SidebarRightTabParamsMap {\n /** Parameters of a browser-view page. */\n 'browser-view': BrowserViewTabParams\n }\n}\n\n/**\n * Build stage one of the registration.\n * @param t - translate function of this plugin's dictionary.\n * @returns the static tab type the registry keeps.\n */\nexport function browserViewTabDefinition(t: (key: BrowserViewKey) => string): SidebarRightTabDefinition {\n return {\n id: BROWSER_VIEW_TAB_ID,\n kind: BROWSER_VIEW_TAB_KIND,\n // A visited body stays mounted while another chip is in front, so the\n // screencast socket survives a tab switch instead of redialing the host.\n keepMounted: true,\n // A type from outside the product: the honest band, and the default one.\n priority: 'extension',\n title: () => t('tab.title'),\n guide: [{\n id: BROWSER_VIEW_GUIDE_ENTRY_ID,\n order: BROWSER_VIEW_GUIDE_ENTRY_ORDER,\n // Thunked, like the type's own title: a language switch needs no\n // re-registration, and the guide reads the copy again on every use.\n title: () => t('tab.title'),\n description: () => t('guide.description'),\n icon: BrowserViewGuideGlyph,\n }],\n }\n}\n","/**\n * The browser view's chip text.\n *\n * The shell owns the right-sidebar chip: its box, its close and hidden\n * controls, the active highlight and the switch between tabs. This component\n * draws only what sits inside it - the browser mark and the name - which is why\n * it carries no state of its own.\n *\n * The name prefers the page the body is streaming, read from the published\n * channel (live-title.ts), and falls back to this plugin's own name before the\n * first state push: a chip that says \"Checkout\" is more useful than one that\n * says \"Browser view\", but an empty chip is worse than either.\n */\nimport { useCallback, useSyncExternalStore } from 'react'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { BrowserViewLiveTitleStore } from './live-title.ts'\nimport { BROWSER_VIEW_PARTS, BROWSER_VIEW_PLUGIN } from './semantic.ts'\nimport css from './panel.module.css'\n\n/** Business face injected into the chip. */\nexport interface BrowserViewTabTitleFace {\n /** Session whose tab this chip names. */\n readonly sessionId?: string\n /** Channel the body publishes the streamed page's title on. */\n readonly liveTitle?: BrowserViewLiveTitleStore\n}\n\n/** Chip props: the locale seat plus the injected face. */\nexport type BrowserViewTabTitleProps = PropsLocale<'browser-view'> & Partial<BrowserViewTabTitleFace>\n\n/**\n * Decorative browser-window mark; inline so the chip carries no icon dependency.\n * @returns the glyph.\n */\nfunction BrowserViewMark() {\n return (\n <svg className={css.tabTitleMark} viewBox=\"0 0 16 16\" aria-hidden=\"true\" focusable=\"false\">\n <rect x=\"1.75\" y=\"2.25\" width=\"12.5\" height=\"11.5\" rx=\"1.75\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M1.75 5.75h12.5\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" />\n <path d=\"M7.4 8.15l3.85 1.7-1.6.65-.7 1.65z\" fill=\"currentColor\" />\n </svg>\n )\n}\n\n/**\n * Render the chip contents.\n * @param props - composed slot props.\n * @returns the mark and the tab's name.\n */\nexport function BrowserViewTabTitle({ t, sessionId, liveTitle }: BrowserViewTabTitleProps) {\n const subscribe = useCallback(\n (listener: () => void) => liveTitle?.subscribe(listener) ?? (() => {}),\n [liveTitle],\n )\n const read = useCallback(() => liveTitle?.get(sessionId), [liveTitle, sessionId])\n const pageTitle = useSyncExternalStore(subscribe, read, () => undefined)\n const label = pageTitle !== undefined && pageTitle.length > 0 ? pageTitle : t('tab.title')\n return (\n <span\n className={css.tabTitle}\n data-dsh-plugin={BROWSER_VIEW_PLUGIN}\n data-dsh-part={BROWSER_VIEW_PARTS.tabTitle}\n >\n <BrowserViewMark />\n <span className={css.tabTitleText}>{label}</span>\n </span>\n )\n}\n","/**\n * Browser-half entry for the browser-view plugin - runs inside the dsh web GUI.\n *\n * The browser view is a tab in the official right sidebar, beside the\n * conversation, not a page that takes the whole window. It contributes exactly\n * the seats a tab type needs, and only those:\n * - `sidebarRightTabs.register` (stage one): the static tab type - its id, its\n * kind ('browser-view'), the band it ranks in, the chip's initial text and the\n * guide capsule that opens it from the column's own tab strip.\n * - 'sidebar.right.pane.tab' + 'sidebar.right.pane.tab.title' (stage two, one\n * keyed registration each under the SAME id): the tab's body and its chip\n * contents, which is exactly the shape the shipped terminal tab uses.\n *\n * The session-header shortcut is deliberately gone: the column's tab strip and\n * the guide capsule already open the tab, so a second entry in the conversation\n * header only crowded that row.\n *\n * `main` and 'sidebar.panellist' are deliberately NOT registered any more: the\n * first took the whole center column over, and the second put a row in the\n * shell's global panel list that addressed that column. A right-sidebar tab\n * needs neither.\n *\n * The two slot seats go through `ctx.slots.inject` so the contribution waits for\n * the owning plugin to declare the seat: load order between this plugin and the\n * sidebar plugin therefore does not matter, and a shell that cannot serve a seat\n * simply leaves the surface absent.\n *\n * Export discipline (packages/AGENTS.md): the /client surface carries only what\n * cordis loading needs plus types.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale) and its\n// LocaleNamespaceMap merge table.\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the renderer's ctx.slots merge (the slot registry).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the sidebar service's Context merge (ctx.sidebarRightTabs) and\n// the two pane SlotMap declarations it owns.\nimport type {} from '@deepseek-ai/dsh-client-ui-sidebar-right/client'\nimport { createLiveTitleStore } from './live-title.ts'\nimport { en, zh, type BrowserViewKey } from './locales.ts'\nimport { BrowserViewPanel } from './panel.tsx'\nimport { BROWSER_VIEW_TAB_ID, browserViewTabDefinition } from './tab-type.ts'\nimport { BrowserViewTabTitle } from './tab-title.tsx'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Browser-view surface copy. */\n 'browser-view': BrowserViewKey\n }\n}\n\n/** Dictionary namespace owned by this plugin. */\nconst NS = 'browser-view'\n\n/** Services required by this plugin. */\nexport const inject = ['slots', 'locale', 'sidebarRightTabs']\n\n/**\n * Register the browser-view tab type and its surfaces.\n * @param ctx - client root context.\n */\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => {\n try {\n return ctx.locale.register(NS, { zh, en })\n } catch {\n return () => {}\n }\n }, 'browser-view: dictionaries')\n\n // The tab type's chip text and the guide capsule's copy are resolved on every\n // read, so the thunk below must translate at call time rather than bake a\n // language in at boot.\n let translate: ((key: BrowserViewKey) => string) | undefined\n try {\n translate = ctx.locale.bind(NS)\n } catch {\n // A locale face that cannot bind leaves the chip on its source-language copy.\n }\n const copy = (key: BrowserViewKey): string => translate?.(key) ?? zh[key]\n\n // Stage one: the static type. Without it an open of this kind throws, so the\n // registration is the seat everything else depends on - the column's tab strip\n // and its guide capsule both read this definition to offer the tab.\n ctx.effect(() => {\n try {\n return ctx.sidebarRightTabs.register(browserViewTabDefinition(copy))\n } catch {\n return () => {}\n }\n }, 'browser-view: tab type')\n\n // The one channel between the tab body and its own chip: the body learns the\n // streamed page's title, the chip shows it.\n const liveTitle = createLiveTitleStore()\n\n // Stage two, body: the tab's content, under the type's own id.\n ctx.slots.inject('sidebar.right.pane.tab', () => {\n try {\n return ctx.slots.register(\n {\n name: 'sidebar.right.pane.tab',\n key: BROWSER_VIEW_TAB_ID,\n locale: NS,\n inject: (sessionId: string) => ({ sessionId, liveTitle }),\n },\n BrowserViewPanel,\n )\n } catch {\n return () => {}\n }\n })\n\n // Stage two, title: the chip's contents, same key, same face.\n ctx.slots.inject('sidebar.right.pane.tab.title', () => {\n try {\n return ctx.slots.register(\n {\n name: 'sidebar.right.pane.tab.title',\n key: BROWSER_VIEW_TAB_ID,\n locale: NS,\n inject: (sessionId: string) => ({ sessionId, liveTitle }),\n },\n BrowserViewTabTitle,\n )\n } catch {\n return () => {}\n }\n })\n}\n\nexport type { BrowserViewPanelFace, BrowserViewPanelProps, BrowserViewSocketFactory } from './panel.tsx'\nexport type { BrowserViewLiveTitleStore } from './live-title.ts'\nexport type { BrowserViewTabParams } from './tab-type.ts'\nexport type { BrowserViewTabTitleFace, BrowserViewTabTitleProps } from './tab-title.tsx'\nexport type { BrowserViewFrame, BrowserViewSocketStatus } from './socket.ts'\nexport type { BrowserViewKey } from './locales.ts'\n"],"mappings":";;;;;;;;;;;;;;EAwCA,SAAgB,uBAAkD;GAChE,MAAM,yBAAS,IAAI,IAAoB;GACvC,MAAM,4BAAY,IAAI,IAAgB;GACtC,MAAM,eAAqB;IAEzB,KAAK,MAAM,YAAY,CAAC,GAAG,SAAS,GAAG,SAAS;GAClD;GACA,OAAO;IACL,IAAI,WAAmD;KACrD,OAAO,cAAc,KAAA,IAAY,KAAA,IAAY,OAAO,IAAI,SAAS;IACnE;IACA,IAAI,WAA+B,OAAiC;KAClE,IAAI,cAAc,KAAA,GAAW;KAC7B,MAAM,UAAU,OAAO,IAAI,SAAS;KACpC,IAAI,UAAU,KAAA,KAAa,MAAM,WAAW,GAAG;MAC7C,IA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