@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
65 lines • 3.4 kB
TypeScript
import type { ToolRegistry } from '../tool-registry.js';
import { type TwoStepConvention } from './config.js';
import { type PoppyConnections } from './service.js';
interface CompanyInput {
company: string;
}
export interface CallCompanyToolOptions {
prefix?: string;
/** The Company's two-step confirmation convention (default `confirm` / `confirmToken`); `false` = off. */
twoStep?: TwoStepConvention | false;
}
/**
* Runs a company MCP tool for `owner` and words the outcome for the model (`readOnly` refuses a
* tool the company does not mark `readOnlyHint`). For apps that build their own confirmed tools.
*
* A write (`readOnly: false`) to a tool that confirms in two steps (see `tools.twoStep`) is
* committed: the call is made for its preview, then again with `confirm` and the fresh token —
* call it only once the person has confirmed.
*/
export declare function callCompanyTool(connections: PoppyConnections, owner: string, input: CompanyInput & {
tool: string;
arguments?: Record<string, unknown>;
}, readOnly: boolean, options?: string | CallCompanyToolOptions): Promise<Record<string, unknown>>;
/**
* The Company's own preview of a two-step write, for the confirmation card — nothing is written.
* Null when the tool does not confirm in two steps, or the preview did not come back.
*/
export declare function previewCompanyWrite(connections: PoppyConnections, owner: string, input: CompanyInput & {
tool: string;
arguments?: Record<string, unknown>;
}, twoStep?: TwoStepConvention | false): Promise<{
summary: string | null;
} | null>;
/** One exchange with the company's agent for `owner`, worded for the model (`act: false` = read-only token). */
export declare function talkToCompany(connections: PoppyConnections, owner: string, input: CompanyInput & {
message: string;
}, act: boolean, prefix?: string): Promise<Record<string, unknown>>;
/**
* Registers the tools a turn uses to work with OTHER Poppy Companies for its user. Reads run at
* once; anything that can change something at a Company (`write`, `request`, `disconnect`) is an
* `action` — it goes through this app's confirmation (a card with Confirm/Cancel, or the channel's
* text approval), never silently. `connect` is an action too: its card carries the link, and
* completing the sign-in decides it, so the conversation resumes on its own.
*/
export declare function registerPoppyConnectionTools(registry: ToolRegistry, connections: PoppyConnections, options?: {
prefix?: string;
roles?: string[];
/** An authorization ability every tool declares (for an ability-aware `RolesPolicy`). */
ability?: string;
/**
* `'action'` (default): `connect` is an action whose card carries the link, and completing the
* sign-in decides it (the turn resumes). `'link'`: a read tool returning the link — for loops
* that do not park on approvals; the person says when they are done.
*/
connect?: 'action' | 'link';
/**
* Register `write`, `request` and `disconnect` (actions). `false` for a loop that confirms writes
* its own way: build them on {@link callCompanyTool} / {@link talkToCompany}.
*/
writes?: boolean;
/** The Companies' two-step confirmation convention (see `tools.twoStep`). */
twoStep?: TwoStepConvention | false;
}): string[];
export {};
//# sourceMappingURL=tools.d.ts.map