@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
26 lines • 1.56 kB
TypeScript
import type { ActorDirectory } from './spi/actor-directory.js';
/** A row a governance surface renders that carries an opaque `actorRef`. */
export interface ActorRefRow {
actorRef: string;
}
/**
* A row decorated with the display label an {@link ActorDirectory} resolved for its `actorRef`. The
* field is optional and absent (never `null`, never the raw ref) when the directory knows no label,
* so a consumer's `row.actorLabel ?? row.actorRef` fallback stays the one rendering rule.
*/
export type WithActorLabel<T> = T & {
actorLabel?: string;
};
/**
* Decorate every row with `actorLabel`, resolved from ONE batched {@link ActorDirectory} lookup over
* the distinct refs in the page — not one lookup per row, which is what turns a 200-row governance
* page into 200 queries against the host's user table.
*
* Fail-soft by design: no directory bound, or a directory that throws, leaves the rows exactly as
* they came out of the read-model. A label is cosmetic, and a governance page that renders raw refs
* is strictly better than one that 500s because the host's user service is down.
*/
export declare function withActorLabels<T extends ActorRefRow>(rows: T[], directory: ActorDirectory | null | undefined): Promise<WithActorLabel<T>[]>;
/** {@link withActorLabels} for a single row (or `null`, which passes straight through). */
export declare function withActorLabel<T extends ActorRefRow>(row: T | null, directory: ActorDirectory | null | undefined): Promise<WithActorLabel<T> | null>;
//# sourceMappingURL=actor-labels.d.ts.map