@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
43 lines • 1.66 kB
TypeScript
import type { ToolResultField, ToolResultView } from '../../../index.js';
/** One labelled reading of a `metrics` view. */
export interface ResolvedReading {
label: string;
/** The value as text (`—` for nothing). */
value: string;
unit: string | null;
}
/**
* A tool's output resolved through its view into plain data a renderer draws — never the payload
* itself. `null` from {@link resolveResultView} means "draw nothing".
*/
export type ResolvedResultView = {
kind: 'metrics';
readings: ResolvedReading[];
} | {
kind: 'table';
columns: ToolResultField[];
rows: string[][];
empty: string | null;
} | {
kind: 'log';
lines: string[];
} | {
kind: 'note';
text: string;
};
/**
* A view for an output whose tool declared none, from its shape: an array of flat records is a
* table, an array of strings a log, a flat record a set of readings. `undefined` when nothing fits —
* a serialized payload is what a person-facing surface exists to avoid, so failing to infer must not
* fall back to one.
*/
export declare function inferResultView(output: unknown): ToolResultView | undefined;
/**
* Read `output` through `view` (or one inferred from its shape when `view` is omitted and `infer` is
* on). `null` when there is nothing to draw: an `elsewhere` view, an empty reading set, a missing
* array. A table whose rows array is present but empty resolves with no rows and its `empty` line.
*/
export declare function resolveResultView(output: unknown, view: ToolResultView | undefined, options?: {
infer?: boolean;
}): ResolvedResultView | null;
//# sourceMappingURL=result-view.d.ts.map