Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
fix(browser): soften handoff UI and prevent preview overlay flicker
wizardchen8fbee673e69d
diff --git a/frontend/src/views/chat/components/BrowserTaskPreview.vue b/frontend/src/views/chat/components/BrowserTaskPreview.vueindex 423b99d07..0af04d638 100644--- a/frontend/src/views/chat/components/BrowserTaskPreview.vue+++ b/frontend/src/views/chat/components/BrowserTaskPreview.vue@@ -8,7 +8,7 @@<strong>{{ t('localBrowser.needHelp') }}</strong><p v-if="status.help_prompt" class="handoff-prompt">{{ status.help_prompt }}</p><p>{{ t(status.action === 'tab_borrow' ? 'localBrowser.borrowHint' : 'localBrowser.helpHint') }}</p>- <t-button v-if="status.action !== 'tab_borrow'" theme="primary" :disabled="!status.connected || !status.task_id || busy || status.stopping" @click="act('focus')"><t-icon name="jump" />{{ t('localBrowser.locateWindow') }}</t-button>+ <t-button v-if="status.action !== 'tab_borrow'" class="handoff-locate" theme="default" variant="outline" size="small" :disabled="!status.connected || !status.task_id || busy || status.stopping" @click="act('focus')"><t-icon name="jump" />{{ t('localBrowser.locateWindow') }}</t-button></section><button v-if="!(status.needs_help && status.action === 'tab_borrow')" class="preview-image" :disabled="!status.connected || !status.task_id || busy || status.stopping" :aria-label="t('localBrowser.locateWindow')" @click="act('focus')"><img v-if="preview" :src="preview" :alt="t('localBrowser.preview')" />@@ -122,12 +122,12 @@ onBeforeUnmount(() => { alive = false; document.removeEventListener('visibilityc.browser-task-preview.is-pip { position: static; width: 100%; max-width: none; min-height: 100%; max-height: none; border: 0; border-radius: 0; box-shadow: none; }.is-pip .preview-heading { cursor: default; }.is-pip .preview-image { height: clamp(126px, 45vh, 480px); }-.browser-task-preview.needs-help { width: 420px; border-color: var(--td-brand-color); }-.preview-handoff { padding: 12px; background: var(--td-brand-color-light); overflow-wrap: anywhere; }-.preview-handoff strong { font-size: 14px; color: var(--td-brand-color); }-.preview-handoff p { font-size: 12px; line-height: 1.6; margin: 8px 0; white-space: pre-wrap; }-.preview-handoff .handoff-prompt { max-height: 22vh; overflow-y: auto; }-.preview-handoff .t-button { width: 100%; }+.browser-task-preview.needs-help { width: 420px; }+.preview-handoff { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; border-top: 1px solid var(--td-component-border); background: var(--td-bg-color-secondarycontainer); overflow-wrap: anywhere; }+.preview-handoff strong { font-size: 13px; font-weight: 600; color: var(--td-text-color-primary); }+.preview-handoff p { font-size: 12px; line-height: 1.6; margin: 0; color: var(--td-text-color-secondary); white-space: pre-wrap; }+.preview-handoff .handoff-prompt { max-height: 22vh; overflow-y: auto; color: var(--td-text-color-primary); }+.preview-handoff .handoff-locate { align-self: flex-end; flex-shrink: 0; max-width: 100%; margin-top: 2px; }.needs-help .preview-image { height: clamp(140px, 30vh, 260px); }.needs-help .preview-heading { flex-wrap: wrap; }.browser-task-preview.is-pip.needs-help { width: 100%; }diff --git a/patches/browserskill/02-gateway-task-controls.patch b/patches/browserskill/02-gateway-task-controls.patchindex 1980bfb39..fd00b768e 100644--- a/patches/browserskill/02-gateway-task-controls.patch+++ b/patches/browserskill/02-gateway-task-controls.patch@@ -234,10 +234,10 @@ index 0000000..7eae50f+});diff --git a/apps/extension/src/lib/__tests__/task-preview.test.ts b/apps/extension/src/lib/__tests__/task-preview.test.tsnew file mode 100644-index 0000000..88fe91e+index 0000000..49d1e24--- /dev/null+++ b/apps/extension/src/lib/__tests__/task-preview.test.ts-@@ -0,0 +1,157 @@+@@ -0,0 +1,167 @@+import { afterEach, describe, expect, it, vi } from "vitest";+import type { ChromiumCdp } from "@/browser-driver/chromium-cdp";+import { runCdpCommand } from "@/browser-driver/command-deadline";@@ -245,9 +245,6 @@ index 0000000..88fe91e+import { TaskActivity } from "../task-activity";+import { captureTaskPreview } from "../task-preview";+-+vi.mock("@/lib/capture-suppress-bridge", () => ({-+ withExtensionOverlayHidden: (_tab: number, run: () => unknown) => run(),-+}));+afterEach(() => {+ vi.unstubAllGlobals();+ vi.useRealTimers();@@ -280,6 +277,7 @@ index 0000000..88fe91e+ tabs: {+ query: vi.fn(async () => [{ id: 5, windowId: 10, active: true }]),+ get: vi.fn(async () => ({ id: 5, windowId: 10, title: "task" })),++ sendMessage: vi.fn(async () => ({ ok: true })),+ },+ });+ vi.stubGlobal(@@ -307,6 +305,18 @@ index 0000000..88fe91e+ return { task, manager, cdp, sizes, close };+}+describe("independent task preview", () => {++ it("keeps control and help overlays visible across repeated preview captures", async () => {++ const f = fixture();++ for (let i = 0; i < 3; i++) {++ await expect(captureTaskPreview(f.manager, f.cdp, "visible")).resolves.toMatchObject({++ tab_id: 5,++ image_base64: btoa("thumbnail"),++ });++ }++ expect(f.cdp.send).toHaveBeenCalledTimes(3);++ expect(chrome.tabs.sendMessage).not.toHaveBeenCalled();++ });+++ it("lets turn-end release finish after a stuck screenshot times out", async () => {+ vi.useFakeTimers();+ vi.spyOn(console, "warn").mockImplementation(() => {});@@ -537,12 +547,11 @@ index 0000000..91bc85a+}diff --git a/apps/extension/src/lib/task-preview.ts b/apps/extension/src/lib/task-preview.tsnew file mode 100644-index 0000000..3a1a361+index 0000000..38d1917--- /dev/null+++ b/apps/extension/src/lib/task-preview.ts-@@ -0,0 +1,109 @@+@@ -0,0 +1,103 @@+import type { ChromiumCdp } from "@/browser-driver/chromium-cdp";-+import { withExtensionOverlayHidden } from "@/lib/capture-suppress-bridge";+import { isAgentControlledTab, type SessionManager } from "@/session-manager/manager";++const captures = new Map<string, Promise<unknown>>();@@ -574,20 +583,15 @@ index 0000000..3a1a361+ throw new Error("Task ended during capture");+ const attachment = cdp.getAttachmentId(tabId);+ const revision = task.refStore.documentRevision(tabId);-+ const shot = await withExtensionOverlayHidden(-+ tabId,-+ async () => {-+ // captureBeyondViewport=false already limits the image to the viewport.-+ // Avoid a separate layout read on every UI poll; resize the bitmap below.-+ return cdp.send<{ data: string }>(tabId, "Page.captureScreenshot", {-+ format: "jpeg",-+ quality: 50,-+ fromSurface: true,-+ captureBeyondViewport: false,-+ });-+ },-+ (id, message) => chrome.tabs.sendMessage(id, message),-+ );++ // UI previews retain overlays: hiding them on every poll makes the user's++ // control border and help prompts flicker. Agent screenshots hide them separately.++ // Capture only the viewport and resize the bitmap below without a layout read.++ const shot = await cdp.send<{ data: string }>(tabId, "Page.captureScreenshot", {++ format: "jpeg",++ quality: 50,++ fromSurface: true,++ captureBeyondViewport: false,++ });+ if (+ manager.get(sessionId) !== task ||+ !isAgentControlledTab(task, tabId) ||diff --git a/patches/browserskill/README.md b/patches/browserskill/README.mdindex 35ca36d02..602aff7f5 100644--- a/patches/browserskill/README.md+++ b/patches/browserskill/README.md@@ -39,6 +39,9 @@ enter the native daemon's automation queue:`title`, and `captured_at`. The encoded image is at most 640 pixels wide.Captures are coalesced and restricted to a concrete owned tab. Authorization,document revision and debugger identity are checked before returning a frame.+ UI previews include the extension's control and help overlays so periodic+ captures do not hide and restore them in the user's browser. Agent screenshots+ still suppress overlays to preserve unobstructed page content.- `gateway.task_focus`: explicitly activates an existing owned tab and its window;returns `{ "focused": true }`. It never creates a session.- `gateway.task_idle`: prevents further UI captures, waits for in-flight work,