@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
48 lines (47 loc) • 1.72 kB
TypeScript
import { type Credentials } from "../credentials";
/**
* Schema of one action record. Mirrors `ReplayActionRecord` in
* `packages/service/codegen/replay/types.ts` — kept inline here to keep
* the published `@builder.io/dev-tools` package free of cross-package
* type imports.
*
* Only the user-visible content is captured: assistant `text` blocks
* and `thinking` blocks. Tool calls and chapter markers are
* deliberately excluded.
*/
export interface ReplayActionRecord {
/** Wall-clock timestamp in ms epoch. */
ts: number;
type: "text" | "thinking" | "checkpoint";
content?: string;
label?: string;
imageUrl?: string;
}
/**
* Buffers user-visible agent blocks (`text`, `thinking`) during a
* `browser-testing` run and POSTs them as JSON to
* `/codegen/replay/:uuid/actions`. The main service appends them to
* `replay.actionsStr` on the Firestore doc inside a transaction, so
* concurrent uploads can't drop entries.
*
* Failures are intentionally swallowed: replay is a nice-to-have and
* must never affect the agent run.
*/
export declare class ReplayActionUploader {
#private;
constructor(opts: {
credentials: Credentials;
replayId: string;
debug?: boolean;
});
/**
* `ts` should be the moment the assistant *began* streaming this
* block, not when it finished. Defaults to `Date.now()` for
* back-compat but callers are expected to pass an earlier timestamp.
*/
recordText(content: string, ts?: number): void;
recordReasoning(content: string, ts?: number): void;
recordCheckpoint(ts?: number, label?: string, imageUrl?: string): void;
flush(): Promise<void>;
close(): Promise<void>;
}