UNPKG

donobu

Version:

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

69 lines 3.85 kB
import type { AiQuery } from '../../models/AiQuery'; import { type BrowserStorageState } from '../../models/BrowserStorageState'; import type { FlowMetadata, FlowsQuery } from '../../models/FlowMetadata'; import type { PaginatedResult } from '../../models/PaginatedResult'; import type { ToolCall } from '../../models/ToolCall'; import type { VideoSegment } from '../../models/VideoSegment'; import type { FlowsPersistence } from './FlowsPersistence'; /** * A {@link FlowsPersistence} implementation that persists flow data via the * Donobu API. The API stores the SDK's data models as opaque JSON blobs, * meaning the SDK owns the shape of the data and can evolve independently * of the API schema. * * File uploads (`setFlowFile`, `setVideo`, `saveScreenShot`) are async with * a local-first cache: bytes are written synchronously to * `<baseWorkingDirectory>/uploads/donobu/<flowId>/<fileId>` and a * {@link FileUploadWorker} drains the upload to the API in the background * with retry + backoff. Reads (`getFlowFile`, `getVideoSegment`) check the * cache first and only hit the network on cache miss (cross-machine reads). * Other write methods (metadata, tool calls, ai queries, browser state) * remain synchronous — they're small JSON, no bandwidth concern. */ export declare class FlowsPersistenceDonobuApi implements FlowsPersistence { private readonly baseUrl; private readonly apiKey; private readonly fileCache; private readonly fileWorker; constructor(baseUrl: string, apiKey: string, baseWorkingDirectory?: string); private request; private jsonRequest; setFlowMetadata(flowMetadata: FlowMetadata): Promise<void>; getFlowMetadataById(flowId: string): Promise<FlowMetadata>; getFlowMetadataByName(flowName: string): Promise<FlowMetadata>; getFlowsMetadata(query: FlowsQuery): Promise<PaginatedResult<FlowMetadata>>; deleteFlow(flowId: string): Promise<void>; setToolCall(flowId: string, toolCall: ToolCall): Promise<void>; getToolCalls(flowId: string): Promise<ToolCall[]>; deleteToolCall(flowId: string, toolCallId: string): Promise<void>; setAiQuery(flowId: string, aiQuery: AiQuery): Promise<void>; getAiQueries(flowId: string): Promise<AiQuery[]>; saveScreenShot(flowId: string, bytes: Buffer): Promise<string>; getScreenShot(flowId: string, screenShotId: string): Promise<Buffer | null>; setVideo(flowId: string, bytes: Buffer): Promise<void>; getVideoSegment(flowId: string, startOffset: number, length: number): Promise<VideoSegment | null>; /** * Returns bytes for a flow file. Tries the local cache first (instant * playback for files this machine recently uploaded; warm cache for * cross-machine reads after the first download). On cache miss, fetches * from the API and populates the cache so subsequent reads are local. */ getFlowFile(flowId: string, fileId: string): Promise<Buffer | null>; /** * Writes bytes to the local file cache and returns immediately. The * actual HTTP upload to the Donobu API runs asynchronously in the * {@link FileUploadWorker} with retry + backoff. Same-machine reads * during the upload window hit the local cache (no 404). */ setFlowFile(flowId: string, fileId: string, fileBytes: Buffer): Promise<void>; /** * Performs the actual HTTP PUT against the Donobu API. Called by the * {@link FileUploadWorker} when draining the upload queue. Not part of * the public {@link FlowsPersistence} surface — callers go through * {@link setFlowFile}. */ private uploadFlowFileViaHttp; setBrowserState(flowId: string, browserState: BrowserStorageState): Promise<void>; getBrowserState(flowId: string): Promise<BrowserStorageState | null>; } //# sourceMappingURL=FlowsPersistenceDonobuApi.d.ts.map