@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
41 lines • 1.94 kB
TypeScript
import type { ModelProvider, ModelTurnArgs, ModelTurnResult } from '../index.js';
/**
* One tool the scripted turn asks for. Its call id is `call-<turnIndex>-<name>`, suffixed `-2`, `-3`…
* when this provider already issued that id (another thread's turn, or a second call to the same tool
* in one turn): tool call ids are the store's primary key across every thread.
*/
export interface FakeToolCall {
name: string;
input: unknown;
}
export interface FakeTurn {
text: string;
/** If set, the turn asks to call this tool instead of finishing. */
toolCall?: FakeToolCall;
/** Several tools in ONE turn — what a model routinely does. Takes precedence over `toolCall`. */
toolCalls?: FakeToolCall[];
/** If set, the turn reports an actual USD cost — as a gateway provider would. */
costUsd?: number;
}
/**
* `turnIndex` = how many assistant turns have already happened this run (derived from the
* message history), so the script is a pure function of its inputs — deterministic and
* replay-safe with no internal counter.
*/
export type FakeScript = (args: ModelTurnArgs, turnIndex: number) => FakeTurn;
/**
* A deterministic, offline `ModelProvider`. Drives the agent loop without any API key,
* streaming the scripted text to the sink and optionally requesting one tool call.
*/
export declare class FakeModelProvider implements ModelProvider {
private readonly script;
/** Every call id this instance handed out, so none is issued twice. */
private readonly issued;
constructor(script: FakeScript);
/** `call-<turnIndex>-<name>` the first time, then the same with the first free `-<n>` suffix. */
private callId;
runTurn(args: ModelTurnArgs): Promise<ModelTurnResult>;
}
/** A trivial script: stream a fixed reply and never call a tool. */
export declare function echoScript(reply?: string): FakeScript;
//# sourceMappingURL=fake-model-provider.d.ts.map