@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
50 lines • 2.89 kB
TypeScript
/**
* What the agent runs on — its SQL connection, its Redis, its LLM providers, its vector store —
* described under the global `@adonis-agora/stack` symbol, so a stack view (telescope's
* Architecture page) reads it off `config/agent.ts` with no code in the app. Nothing here depends
* on telescope: the symbol is the whole contract. Never put a key, a secret or a URL in a `label`.
*/
/** The symbol a factory (or the config object) carries its {@link StackUse} list under. */
export declare const STACK_DESCRIPTOR: unique symbol;
/** One piece of infrastructure the agent uses. */
export interface StackUse {
/** `postgres`, `redis`, `anthropic`, `openai`, `qdrant`, … (lowercase, `[a-z0-9._-]`, ≤ 32). */
tech: string;
/** The Lucid or Redis connection it goes through. */
connection?: string;
/** What it is for, in a few words (`chat history`, `LLM`). */
purpose?: string;
/** For something with no connection: a model family, a collection, a table. */
label?: string;
/** For an API or a server: its host, only to tell two apart (hashed by the reader, never sent). */
host?: string;
}
/** Attach `use` to `target` (replacing what it carried). Returns `target`. */
export declare function describeStackUse<T extends object>(target: T, use: StackUse | StackUse[]): T;
/** The uses `value` carries, or `[]`. */
export declare function stackUsesOf(value: unknown): StackUse[];
/** A tech name the descriptor accepts, from a free-form one (`Amazon Bedrock` → `amazon-bedrock`). */
export declare function stackTech(raw: string | undefined, fallback: string): string;
/**
* A Lucid-backed factory's use, completed at boot once the `Database` is resolved: the connection
* an omitted `connection` falls back to, and the technology (`postgres`, `mysql`, `sqlite`) of the
* one it uses. Best effort — a `db` that does not look like Lucid's leaves the use as it was.
*/
export declare function refineLucidUse(target: object, db: unknown, connection: string | undefined, purpose: string, extra?: StackUse[]): void;
/**
* A model's family from its id, without the vendor prefix, the version date or the Bedrock suffix:
* `us-gov.anthropic.claude-sonnet-4-5-20250929-v1:0` → `claude-sonnet-4-5`,
* `openai/gpt-4o-2024-08-06` → `gpt-4o`, `gpt-4o-mini` → `gpt-4o-mini`.
*/
export declare function modelFamily(modelId: string): string;
/** The LLM uses of the models a provider runs: tech = the provider family, label = the model family. */
export declare function llmUses(models: ReadonlyArray<{
modelId: string;
provider?: string;
}>): StackUse[];
/**
* What a resolved model provider runs on: the descriptor it carries (`aiSdkModel` sets one), else
* its `describeModels()`. `[]` when it says nothing.
*/
export declare function modelProviderUses(provider: unknown): StackUse[];
//# sourceMappingURL=stack.d.ts.map