UNPKG

donobu

Version:

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

83 lines 3.33 kB
import z from 'zod/v4'; import type { GptMessage } from '../models/GptMessage'; export declare class MiscUtils { private constructor(); static readonly DONOBU_VERSION: string; static errName(error: unknown): string; static capitalize(s: string): string; /** * Force a true/false/undefined value for a given value. This is a stripped down * version of th 'yn' library. */ static yn(value: any): boolean | undefined; /** * 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(environ?: import("env-struct").Env<{ APPDATA: z.ZodOptional<z.ZodString>; BASE_WORKING_DIR: z.ZodOptional<z.ZodString>; XDG_CONFIG_HOME: z.ZodOptional<z.ZodString>; }, { APPDATA?: string | undefined; BASE_WORKING_DIR?: string | undefined; XDG_CONFIG_HOME?: string | undefined; }>): string; static detectImageType(buffer: Uint8Array): 'png' | 'jpeg'; /** * Updates token counts in flow metadata based on GPT response */ static updateTokenCounts(gptResponse: { promptTokensUsed: number; completionTokensUsed: number; }, flowMetadata: { inputTokensUsed: number; completionTokensUsed: number; }): void; /** * Resolves the absolute path to a file in the assets directory. * Works from both `src/` (dev) and `dist/` (compiled). */ static getResourceFilePath(fileName: string): string; /** * Loads a resource file from the assets directory as a string */ static getResourceFileAsString(fileName: string): string; private static getPackageVersion; /** * 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; /** * Merges adjacent user messages (some LLMs like Gemini's or Anthropic's require this). */ static mergeAdjacentUserMessages(messages: GptMessage[]): GptMessage[]; /** * Infers a MIME type from a file ID / filename extension. */ static inferMimeType(fileId: string): string; } //# sourceMappingURL=MiscUtils.d.ts.map