donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
42 lines • 2.29 kB
TypeScript
import type { PageAiCacheContents } from '../lib/ai/cache/cache';
import type { ToolRegistry } from '../managers/ToolRegistry';
import type { BrowserStorageState } from '../models/BrowserStorageState';
import type { CodeGenerationOptions } from '../models/CodeGenerationOptions';
import type { FlowMetadata } from '../models/FlowMetadata';
import type { GptConfigInput } from '../models/GptConfig';
import type { ProposedToolCall } from '../models/ProposedToolCall';
export interface ProjectFile {
path: string;
content: string;
}
export interface GeneratedProject {
files: ProjectFile[];
}
export type FlowAnnotation = {
type: string;
description: string;
};
/** Creates a Node.js Microsoft Playwright script to replay the given flow. */
export declare function getFlowAsPlaywrightScript(flowMetadata: FlowMetadata, toolCalls: ProposedToolCall[], options: CodeGenerationOptions | undefined, toolRegistry: ToolRegistry): Promise<string>;
/** Creates a Node.js Microsoft Playwright script to replay the given flow. */
export declare function getFlowAsAiPlaywrightScript(flowMetadata: FlowMetadata, toolCalls: ProposedToolCall[], options: CodeGenerationOptions, toolRegistry: ToolRegistry): Promise<string>;
/**
* Generates a complete Playwright project structure.
* Browser state dependencies are materialized as static JSON files
* and referenced via storageState paths in the Playwright config.
*/
export declare function generateProject(flowsWithToolCalls: Array<{
metadata: FlowMetadata;
toolCalls: ProposedToolCall[];
}>, resolvedBrowserStates: Map<string, BrowserStorageState>, gptConfig: GptConfigInput | undefined, options: CodeGenerationOptions, toolRegistry: ToolRegistry): Promise<GeneratedProject>;
export declare function buildCacheContents(flowsWithToolCalls: Array<{
metadata: FlowMetadata;
toolCalls: ProposedToolCall[];
}>, toolRegistry: ToolRegistry): Promise<PageAiCacheContents>;
/**
* Maps a proposed Donobu tool call to valid NodeJS Playwright code that uses
* the `DonobuExtendedPage` extension.
*/
export declare function convertProposedToolCallToPlaywrightCode(proposedToolCall: ProposedToolCall): string;
export declare function prettifyCode(code: string): Promise<string>;
//# sourceMappingURL=CodeGenerator.d.ts.map