feat(agent-browser): add opt-in preview data injection

This commit is contained in:
brother7 committed 2026-08-26 22:38:44 +08:00
1 parent 14fec70108
commit 38d63a9b7b
11 files changed
+1024 -3

No files matched your search

+27
View File
@@ -296,6 +296,33 @@ describe('PI-090 product tools', () => {
expect((await attachments.read('attachment-a')).data.toString()).toBe('png-data');
});
it('forwards the explicit preview data opt-in from the agent browser tool', async () => {
const root = await temporaryRoot('makelore-pi-browser-preview-tool-');
const attachments = new CodingAttachmentStore(path.join(root, 'attachments'));
const open = vi.fn().mockResolvedValue({
browserId: 'browser-a', projectId: 'project-a', projectPath: root,
state: 'attached', generation: 1, url: 'http://127.0.0.1:4173/', title: 'App',
visible: false, bounds: null, canGoBack: false, canGoForward: false, eventCursor: 0,
});
const browser = { open } as unknown as AgentBrowserModule;
const tools = new PiProductTools({
browser,
attachments,
bundledSkillsDir: path.resolve('resources/coding-skills'),
});
await tools.execute('agent_browser', {
conversationId: 'conversation-a', runId: 'run-a', resourceId: 'browser-a',
projectId: 'project-a', projectPath: root, skillIds: [],
}, { action: 'open', url: 'http://127.0.0.1:4173/', injectProjectData: true });
expect(open).toHaveBeenCalledWith(expect.objectContaining({
projectId: 'project-a', projectPath: root,
url: 'http://127.0.0.1:4173/', visible: false,
injectProjectData: true,
}));
});
it('loads game asset review state through the vendor-neutral product module', async () => {
const root = await temporaryRoot('makelore-pi-game-tool-');
await writeFile(path.join(root, 'ASSET_PLAN.md'), [