mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* Add opt-in browser tools for desktop tabs Adds the daemon opt-in, desktop tab routing, MCP tools, and real browser automation surfaces for Paseo desktop browser tabs. * Fix browser tools CI expectations * Address browser tools review findings * Restrict browser file automation paths * Fix browser upload test on Windows * Harden browser navigation inputs * Make browser tools create usable tabs * Update browser MCP empty-state test * Fail browser tab creation when registration times out * Fix browser screenshots for agents * Hide disabled browser tools from agents * Address browser tools architecture review * Replace browser tools review tests * Wrap browser tab registration errors * Mock Expo Router in app unit tests * Handle invalid browser automation requests * Return browser failure on desktop disconnect * Update browser disconnect websocket test * Relax browser timeout polling test * Handle invalid browser responses * Return browser failure when send fails * Remove local diagnostics and fixture paths * Fix dev service home fallback * Use worktree home for dev services * Use managed daemon in desktop dev * fix(browser): keep agent tabs addressable Track agent-active browser targets separately from human-focused tabs and keep resident webviews alive for automation. Browser tool visibility now comes from registration while the broker reports disabled execution. * refactor(browser): register tools through catalog Move browser tool registration onto the shared Paseo tool catalog so the MCP server remains only the transport adapter. * fix(settings): translate browser tools host error
88 lines
2.6 KiB
TypeScript
88 lines
2.6 KiB
TypeScript
import { beforeEach, describe, expect, it } from "vitest";
|
|
import {
|
|
clearAssistantImageMetadataCache,
|
|
estimateAssistantMessageHeightFromCache,
|
|
extractAssistantImageSources,
|
|
getAssistantImageLoadStateFromMetadata,
|
|
getAssistantImageMetadata,
|
|
setAssistantImageMetadata,
|
|
} from "./assistant-image-metadata";
|
|
|
|
describe("assistant image metadata", () => {
|
|
beforeEach(() => {
|
|
clearAssistantImageMetadataCache();
|
|
});
|
|
|
|
it("extracts markdown image sources", () => {
|
|
expect(
|
|
extractAssistantImageSources(
|
|
'Before\n\n\n\n',
|
|
),
|
|
).toEqual(["/tmp/paseo.png", "https://example.com/test.png"]);
|
|
});
|
|
|
|
it("reuses cached metadata across canonical and raw source keys", () => {
|
|
setAssistantImageMetadata(
|
|
{
|
|
source: "/tmp/paseo-codex-screenshot.png",
|
|
workspaceRoot: "/workspaces/paseo",
|
|
serverId: "server-1",
|
|
},
|
|
{ width: 1200, height: 800 },
|
|
);
|
|
|
|
expect(
|
|
getAssistantImageMetadata({
|
|
source: "/tmp/paseo-codex-screenshot.png",
|
|
}),
|
|
).toEqual({
|
|
width: 1200,
|
|
height: 800,
|
|
aspectRatio: 1.5,
|
|
});
|
|
});
|
|
|
|
it("maps missing metadata to the image loading state", () => {
|
|
expect(getAssistantImageLoadStateFromMetadata(null)).toEqual({ status: "loading" });
|
|
});
|
|
|
|
it("maps cached metadata to the image ready state", () => {
|
|
expect(
|
|
getAssistantImageLoadStateFromMetadata({
|
|
width: 900,
|
|
height: 1600,
|
|
aspectRatio: 9 / 16,
|
|
}),
|
|
).toEqual({
|
|
status: "ready",
|
|
aspectRatio: 9 / 16,
|
|
});
|
|
});
|
|
|
|
it("estimates assistant message height from cached image metadata", () => {
|
|
setAssistantImageMetadata(
|
|
{
|
|
source: "https://example.com/landscape.png",
|
|
},
|
|
{ width: 1200, height: 800 },
|
|
);
|
|
|
|
expect(
|
|
estimateAssistantMessageHeightFromCache(
|
|
"Here is the screenshot\n\n",
|
|
),
|
|
).toBeGreaterThan(220);
|
|
});
|
|
|
|
it("estimates image-only data-image markdown without caching the full payload as text", () => {
|
|
const source = `data:image/png;base64,${"a".repeat(512)}`;
|
|
setAssistantImageMetadata({ source }, { width: 1200, height: 800 });
|
|
|
|
const imageOnlyHeight = estimateAssistantMessageHeightFromCache(``);
|
|
const mixedHeight = estimateAssistantMessageHeightFromCache(`Text\n\n`);
|
|
|
|
expect(imageOnlyHeight).toBeGreaterThan(220);
|
|
expect(mixedHeight).toBeGreaterThan(imageOnlyHeight ?? 0);
|
|
});
|
|
});
|