@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
62 lines • 3.36 kB
TypeScript
import type { HttpContext } from '@adonisjs/core/http';
import { type AgoraConsoleDecision, type AgoraConsoleSearchHit } from '../console-switcher.js';
import type { ActorResolver } from '../spi/actor-resolver.js';
import type { AgentGovernanceQueries } from '../spi/governance-queries.js';
import { type SignOutOption, type ViewerHook } from './console_shell.js';
import type { AgentDashboardAuthorize } from './define_config.js';
/** The agent console's id in the shared `'agora.consoles'` registry. */
export declare const AGENT_CONSOLE_ID = "agent";
/** The part of an Adonis application the switcher helpers touch. */
export interface SwitcherAppLike {
container: {
hasBinding(binding: string): boolean;
bindValue(binding: string, value: unknown): void;
make(binding: string): Promise<unknown>;
};
inProduction: boolean;
}
/** What the agent console needs to register itself into the switcher. */
export interface AgentConsoleRegistration {
/** Where the SPA shell is mounted (`/agent/dashboard`). */
mount: string;
actorResolver?: ActorResolver | undefined;
authorize?: AgentDashboardAuthorize | undefined;
/** The governance read-model the search reads; defaults to the one the agent provider resolved. */
governance?: () => AgentGovernanceQueries | undefined;
}
/**
* Register the agent governance console into the shared `'agora.consoles'` registry, so every other
* Agora console's switcher can link to it and its global search can find runs and threads here.
* Call from the provider that mounts the console shell, after the routes are registered.
*/
export declare function registerAgentConsole(app: SwitcherAppLike, options: AgentConsoleRegistration, logger?: {
warn(message: string): void;
debug?(message: string): void;
}): Promise<boolean>;
/** The agent console's own gate, as a switcher decision. Never throws. */
export declare function agentConsoleDecision(ctx: HttpContext, app: Pick<SwitcherAppLike, 'inProduction'>, options: Pick<AgentConsoleRegistration, 'actorResolver' | 'authorize'>): Promise<AgoraConsoleDecision>;
/**
* The agent console's search provider: a run id or a thread id opens it directly; otherwise the
* query is read as an actor ref or an agent name and their latest runs are listed.
*/
export declare function searchAgentConsole(governance: AgentGovernanceQueries, mount: string, query: string, limit: number): Promise<AgoraConsoleSearchHit[]>;
/** The `switcher` and `search` fields of the shell's data block, or `{}` when nothing to show. */
export declare function switcherShellConfig(app: SwitcherAppLike, apiBase: string): Promise<{
switcher?: {
endpoint: string;
others: number;
};
search?: {
endpoint: string;
};
}>;
/**
* Every console-shell field of the data block for this request: `switcher` / `search` (from the
* registry) plus `viewer` / `signOut` (from the `dashboard.viewer` / `dashboard.signOut` options,
* else `ctx.auth.user` and the sign-out authkit announced on the registry). Never throws.
*/
export declare function consoleShellConfig(app: SwitcherAppLike, ctx: HttpContext, apiBase: string, options: {
viewer?: ViewerHook | null | undefined;
signOut?: SignOutOption | null | undefined;
}): Promise<Record<string, unknown>>;
//# sourceMappingURL=switcher.d.ts.map