@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
75 lines • 4.49 kB
TypeScript
import type { ApplicationService } from '@adonisjs/core/types';
import type { LucidDatabaseLike } from '../stores/lucid.js';
import type { AgoraDoctorCheck, AgoraDoctorResult } from './agora_doctor.js';
type AnyConfig = Record<string, unknown>;
/**
* The MCP config `mcp_provider` runs with, or `undefined` when nothing serves MCP. A missing
* `config/mcp.ts` is NOT "off": with the provider registered (its dev tools hub is bound) it runs
* on an empty config, i.e. every default — `/mcp` and the dev tools at `/mcp/agora`.
*/
export declare function mcpConfig(app: ApplicationService): AnyConfig | undefined;
/** `agent.console-gate`: the governance console has an `authorize`. */
export declare function checkConsoleGate(agent: AnyConfig | undefined, inProduction: boolean): AgoraDoctorResult;
/** `agent.actor-resolver`: the chat endpoints know who is calling. */
export declare function checkActorResolver(agent: AnyConfig | undefined, inProduction: boolean): AgoraDoctorResult;
/** `agent.mcp-open`: the product MCP endpoint runs with a fixed `actor` (no auth) in production. */
export declare function checkMcpOpen(mcp: AnyConfig | undefined, inProduction: boolean): AgoraDoctorResult;
/**
* `agent.mcp-execute`: action tools served over MCP without a per-caller check — the product
* endpoint without an `authorizer`, or `devTools.actions: 'execute'`.
*/
export declare function checkMcpExecute(mcp: AnyConfig | undefined): AgoraDoctorResult;
/** `agent.mcp-csrf`: every MCP path is exempt from shield's CSRF check. */
export declare function checkMcpCsrf(mcp: AnyConfig | undefined, shield: unknown): AgoraDoctorResult;
/** `agent.dev-tools-gate`: libs without a console are gated in production. */
export declare function checkDevToolsGate(mcp: AnyConfig | undefined, consoleless: readonly string[], inProduction: boolean): AgoraDoctorResult;
/** Whether authkit lets MCP clients sign in, as the doctor reads it from `config/authkit.ts`. */
export type AuthkitMcpOption = {
installed: false;
} | {
installed: true;
mcpClients: boolean;
} | {
installed: true;
unresolved: string;
};
/**
* Reads `mcpClients` from `config/authkit.ts` without importing authkit: the file's `defineConfig`
* is a config provider (`{ type: 'provider', resolver }`), resolved here the way the authkit
* provider resolves it; a plain object is read as is. No `config/authkit.ts` → authkit is not
* installed.
*/
export declare function readAuthkitMcpOption(app: ApplicationService): Promise<AuthkitMcpOption>;
/** `agent.dev-tools-authkit-mcp`: with authkit, MCP clients can sign in to the dev tools hub. */
export declare function checkDevToolsAuthkitMcp(mcp: AnyConfig | undefined, authkit: AuthkitMcpOption): AgoraDoctorResult;
/**
* `agent.dev-tools-auth`: how MCP clients sign in to the dev tools hub — `devTools.auth` (any
* authorization server), authkit, or header tokens only — and whether `devTools.auth` is usable.
*/
export declare function checkDevToolsAuth(mcp: AnyConfig | undefined, authkitInstalled: boolean): AgoraDoctorResult;
/** `agent.tenancy-store`: with organizations on, the store can scope threads and runs. */
export declare function checkTenancyStore(agent: AnyConfig | undefined, enabled: boolean, store: Record<string, unknown> | undefined): AgoraDoctorResult;
/** What {@link checkDbSchema} reads from the Lucid agent store. */
export interface SchemaStoreLike {
database: LucidDatabaseLike;
databaseSchema: string | undefined;
}
/**
* `agent.db-schema`: with a `schema` set, it exists, the agent tables are in it, and the connection
* can write there (one insert, rolled back). Only registered when a schema is configured.
*/
export declare function checkDbSchema(store: SchemaStoreLike | undefined): Promise<AgoraDoctorResult>;
/** The checks `@adonis-agora/agent`'s provider registers. */
export declare function agentDoctorChecks(deps?: {
/** The agent store the provider built, when it did. */
store?: () => Record<string, unknown> | undefined;
/** Libs registered on the dev tools hub without an `authorize` of their own. */
consolelessLibs?: () => Promise<string[]>;
/**
* The Lucid agent store, when it keeps its tables in a database `schema`. Absent → the
* `agent.db-schema` check is not registered at all (no schema, nothing new to report).
*/
schemaStore?: () => SchemaStoreLike | undefined;
}): AgoraDoctorCheck[];
export {};
//# sourceMappingURL=checks.d.ts.map