donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
102 lines • 4.08 kB
TypeScript
import { CustomTool } from './CustomTool';
import { JSONSchema7 } from 'json-schema';
import { BrowserConfig } from './BrowserConfig';
/**
* Metadata type of the details/status/state of a Donobu flow.
*/
export type FlowMetadata = {
/** The unique ID of this flow. */
readonly id: string;
/** The name of this flow. */
readonly name: string | null;
/** The version of Donobu that created the flow. */
readonly createdWithDonobuVersion: string;
/**
* The configuration of the browser to use for the flow.
*/
readonly browser: BrowserConfig;
/** The name of the specific GPT configuration used for the flow. */
readonly gptConfigName: string | null;
/**
* If true, means that the `gptConfigName` was explicitly overwritten when the
* flow was created.
*/
readonly hasGptConfigNameOverride: boolean;
/** Custom tools available for the flow. */
readonly customTools: CustomTool[] | null;
/** The default amount of time a tool tip should show. */
readonly defaultToolTipDurationMilliseconds: number | null;
/** The run mode of the flow. */
runMode: RunMode;
/** Set to true if the in-browser control panel should be enabled. */
isControlPanelEnabled: boolean;
/**
* The URL to HTTP POST to when the flow completes. The
* body will contain a JSON object with single field, "id", of which is
* the ID of the flow that completed.
*/
readonly callbackUrl: string | null;
/** The website URL to start the flow at. */
readonly targetWebsite: string;
/** The overall objective to pursue. */
readonly overallObjective: string | null;
/** The set of allowed tools (by Tool.name()) for this flow. */
readonly allowedTools: string[];
/** If non-null, the JSON schema that the result field will conform to. */
resultJsonSchema: JSONSchema7 | null;
/**
* The result of the flow. If terminated successfully and resultJsonSchema is non-null,
* this field will conform to resultJsonSchema. Otherwise, matches the value of the last
* tool call's ToolCallResult.metadata.
*/
result: Record<string, unknown> | null;
/** The number of LLM input tokens used during this flow. */
inputTokensUsed: number;
/** The number of LLM completion tokens used during this flow. */
completionTokensUsed: number;
/** Number of overall iterations done (LLM calls made or simulated in replay). */
iterations: number;
/** The maximum number of iterations allowed for this flow. */
readonly maxIterations: number;
/** The Unix epoch millisecond timestamp of when the flow started. */
startedAt: number | null;
/** The Unix epoch millisecond timestamp of when the flow completed. */
completedAt: number | null;
/** The current state of the flow. */
state: State;
/** The planned next state of the flow. */
nextState: State | null;
};
/**
* Represents the possible states of a flow.
*/
export type State = 'UNSTARTED' | 'INITIALIZING' | 'QUERYING_LLM_FOR_NEXT_ACTION' | 'WAITING_ON_USER_FOR_NEXT_ACTION' | 'PAUSED' | 'RESUMING' | 'RUNNING_ACTION' | 'FAILED' | 'SUCCESS';
export declare const States: State[];
/**
* Checks if a flow state represents completion (either success or failure).
*
* @param state - The state to check
* @returns True if the state represents completion
*/
export declare const isComplete: (state: State) => boolean;
/**
* Represents the possible run modes for a flow.
*/
export type RunMode =
/**
* The flow is being directed by a non-human agent. The flow ends when the
* agent decides to end it, or if explicitly directed to end the flow.
*/
'AUTONOMOUS'
/**
* The flow is being directed by a human agent. The flow only ends when
* the human agent decides to end it.
*/
| 'INSTRUCT'
/**
* The flow is on rails and has no agent. Once all tool calls have been run,
* the flow will be automatically marked as complete.
*/
| 'DETERMINISTIC';
export declare const RunModes: RunMode[];
//# sourceMappingURL=FlowMetadata.d.ts.map