UNPKG

donobu

Version:

Create browser automations with an LLM agent and replay them as Playwright scripts.

73 lines 3.15 kB
export declare class MiscUtils { private constructor(); static readonly DONOBU_VERSION: string; /** * This is the base working directory for the entire application. Care is made * to ensure we do not access data outside of this directory to maintain * proper permissions across platforms. * * Returns platform-specific application data directories: * - macOS: ~/Library/Application Support/Donobu * - Windows: %APPDATA%/Donobu * - Linux: ~/.config/Donobu * * If the BASE_WORKING_DIR environment variable is set, its value is returned. */ static baseWorkingDirectory(): string; /** * Updates token counts in flow metadata based on GPT response */ static updateTokenCounts(gptResponse: { promptTokensUsed: number; completionTokensUsed: number; }, flowMetadata: { inputTokensUsed: number; completionTokensUsed: number; }): void; /** * Loads a resource file from the assets directory as a string */ static getResourceFileAsString(fileName: string): string; /** * Loads a resource file from the assets directory as a Buffer */ static getResourceFileAsBytes(fileName: string): Buffer; /** * Reduces the resolution of a PNG image by half. * * @param inputImageBytes - The input PNG image as a Buffer. * @returns A Promise that resolves to the resized PNG image as a Buffer. * @throws Error if image processing fails */ static resizePngByHalf(inputImageBytes: Buffer): Promise<Buffer>; /** * Resizes a PNG image until its file size is below a specified maximum size. * * @param inputImageBytes - The input PNG image as a Buffer. * @param maxSizeInBytes - The maximum allowed file size in bytes. * @param minDimension - Minimum dimension (width or height) to prevent excessive resizing, default is 50px. * @returns A Promise that resolves to the resized PNG image as a Buffer. * @throws Error if the image cannot be resized to meet the size requirements or if processing fails. */ static resizePngToMaxFileSize(inputImageBytes: Buffer, maxSizeInBytes: number): Promise<Buffer>; /** * Returns a duration (in milliseconds) that represents a statistically * plausible human mouse-click press duration. */ static generateHumanLikeClickDurationInMs(): number; /** * Returns a duration (in milliseconds) that represents a statistically * plausible human key press duration. */ static generateHumanLikeKeyPressDurationInMs(key: string): number; /** * Creates a new random tool call ID. This is useful for registering ProposedToolCall and * ToolCalls that were proposed and/or invoked by a user rather than by a GPT, or by GPT * APIs that do not natively use tool call IDs (i.e. Google Gemini). Note OpenAI constrains the * length of tool call IDs to no longer than 40 characters. * * @returns A string representing a unique tool call ID. */ static createAdHocToolCallId(): string; } //# sourceMappingURL=MiscUtils.d.ts.map