framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
54 lines • 2.38 kB
TypeScript
import type { Driver, DriverPromptOptions, DriverSession, DriverStartOptions, DriverTurn, DriverUsage } from './types.js';
/** One scripted turn the {@link FakeDriver} replays. */
export interface FakeTurn {
/** The final assistant text. */
text: string;
/** Tool names to emit as `action` events before the result (visual only). */
actions?: string[];
/** Token + cost accounting to report for this turn (#322). Omitted = no usage. */
usage?: DriverUsage;
}
/** Options for {@link FakeDriver}. */
export interface FakeDriverOptions {
/**
* Scripted turns, consumed in order across all `prompt` calls of a session.
* Once exhausted the last one repeats, so a short script never starves a
* longer run. Ignored when {@link respond} is set.
*/
turns?: FakeTurn[];
/** Answer dynamically from the prompt. Takes precedence over {@link turns}. */
respond?: (prompt: string, index: number) => FakeTurn | string;
/** Files each session is pre-seeded with, exposed via {@link DriverSession.readCode}. */
files?: Record<string, string>;
/** Session id to report (default `"fake-session"`). */
sessionId?: string;
}
/**
* An in-memory {@link Driver} for tests and `FRAMEWORK_FAKE` runs: it never spawns a
* process, replays scripted turns deterministically, and emits the same
* {@link DriverEvent} shape a real driver does. Mirrors `AiFake` /
* `FakeRunner`, so the whole flow runs offline with no CLI and no model.
*/
export declare class FakeDriver implements Driver {
private readonly opts;
readonly id = "fake";
constructor(opts?: FakeDriverOptions);
start(opts: DriverStartOptions): Promise<FakeDriverSession>;
}
/** A single {@link FakeDriver} session. Records every prompt for assertions. */
export declare class FakeDriverSession implements DriverSession {
private readonly config;
private readonly startOpts;
readonly id: string;
readonly cwd: string;
/** Every prompt this session received, in order. */
readonly prompts: string[];
private index;
constructor(config: FakeDriverOptions, startOpts: DriverStartOptions);
prompt(text: string, opts?: DriverPromptOptions): Promise<DriverTurn>;
readCode(path: string): Promise<string>;
dispose(): Promise<void>;
private resolveTurn;
private emit;
}
//# sourceMappingURL=fake.d.ts.map