@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
37 lines • 2.28 kB
TypeScript
import type { ChannelChoiceLimits, GenuiChannelBase, GenuiChannels } from './genui/channels.js';
import type { Catalog } from './genui/index.js';
import type { SinkWriter } from './spi/token-stream-sink.js';
import type { ToolDescribeScope } from './spi/tool.js';
import type { AgentUiComponent } from './stream-events.js';
import { type UiCollector } from './tool-ui.js';
export type ResolveToolUiCatalog = (scope: ToolDescribeScope) => Catalog | Promise<Catalog>;
/**
* Per-channel words for the model, from genui's `channels`: the turn's prompt block on a channel the
* server draws for (WhatsApp, Telegram, email — `channelPrompt`), and what a tool's pushes were
* delivered there as (`describeChannelComponents`), which the tool's result carries as `delivered`.
* Both answer `undefined` on a web-like channel.
*/
export interface ToolUiChannelGuide {
prompt(scope: ToolDescribeScope): Promise<string | undefined>;
/** `limits`: the turn's adapter's buttons and list rows (`pageContext.channel.choices`). */
delivered(scope: ToolDescribeScope, components: readonly AgentUiComponent[], limits?: ChannelChoiceLimits): Promise<string | undefined>;
}
/** The adapter's choice limits a text channel stamped on the turn (`pageContext.channel.choices`). */
export declare function channelChoiceLimits(pageContext: unknown): ChannelChoiceLimits | undefined;
/** The {@link ToolUiChannelGuide} of a genui setup with `channels`. */
export declare function createToolUiChannelGuide(options: {
channels: GenuiChannels;
base?: GenuiChannelBase;
resolveCatalog: ResolveToolUiCatalog;
}): ToolUiChannelGuide;
/**
* A tool's output with what its pushes were delivered as on a messaging channel: `{ …output,
* delivered }` for an object output, `{ result: output, delivered }` for anything else (or an object
* that already has a `delivered` of its own).
*/
export declare function withDelivered(output: unknown, delivered: string): unknown;
export interface NegotiatedUiCollector extends UiCollector {
text(): string;
}
export declare function createNegotiatedUiCollector(toolCallId: string, scope: ToolDescribeScope, resolveCatalog?: ResolveToolUiCatalog, writer?: SinkWriter): NegotiatedUiCollector;
//# sourceMappingURL=negotiated-tool-ui.d.ts.map