@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
95 lines • 5.16 kB
TypeScript
import type { ActionApprovalMode } from './action-proposal-receipt.js';
import type { AgentIntake } from './elicitation.js';
import type { MemoryConfig } from './memory.js';
import type { MessageTimestampsConfig } from './message-timestamps.js';
import type { ResolveToolUiCatalog, ToolUiChannelGuide } from './negotiated-tool-ui.js';
import type { SkillsConfig } from './skills.js';
import type { AgentStore } from './spi/agent-store.js';
import type { ApprovalPolicy } from './spi/approval-policy.js';
import type { HistoryWindow } from './spi/history-window.js';
import type { ModelProvider } from './spi/model-provider.js';
import type { AgentPricingStore } from './spi/pricing-store.js';
import type { InputProcessor, OutputProcessor } from './spi/processors.js';
import type { QuotaStore } from './spi/quota-store.js';
import type { Retriever } from './spi/retriever.js';
import type { RolesPolicy } from './spi/roles-policy.js';
import type { TokenStreamSink } from './spi/token-stream-sink.js';
import type { PresentationErrorHandler } from './spi/tool.js';
import type { ToolRegistry } from './tool-registry.js';
import type { ToolTransientRetrySetting } from './tool-retry.js';
import type { Actor, Persona, PromptBuilder } from './types.js';
/** Everything `runAgentLoop` needs, minus the per-run `day` the runner stamps. */
export interface AgentDeps {
actionApprovalMode?: ActionApprovalMode;
resolveUiCatalog?: ResolveToolUiCatalog;
/** genui `channels`: the channel's prompt block, and what tool pushes were delivered as. */
uiChannelGuide?: ToolUiChannelGuide;
/** Where a tool's failed `present` is reported. Undefined → a console warning. */
onPresentationError?: PresentationErrorHandler;
model: ModelProvider;
store: AgentStore;
registry: ToolRegistry;
rolesPolicy: RolesPolicy;
/** Who approves an `action` call, and for how long. Undefined → the requester, no expiry. */
approvalPolicy?: ApprovalPolicy;
quota?: QuotaStore;
/** Prices each turn's tokens into `usage.costUsd`. Omit → cost is always `null`. */
pricingStore?: AgentPricingStore;
sink: TokenStreamSink;
/** Fallback accounting label; the provider's turn result overrides it when set. */
modelId?: string;
systemPrompt: string | PromptBuilder;
maxSteps: number;
personas: Map<string, Persona>;
defaultPersona: string;
/** Agent-level tool allow-list (intersected with the persona's). Undefined → all tools. */
toolAllowList?: string[];
/** How deep a delegation chain starting here may go. Undefined → `MAX_DELEGATION_DEPTH`. */
maxDelegationDepth?: number;
/**
* How many times one agent may appear on a single delegation chain. Undefined →
* `DEFAULT_MAX_AGENT_APPEARANCES`, which is once: a chain reaching an agent it has already passed
* through is going in circles.
*/
maxAgentAppearances?: number;
/** Offer the model the built-in `ask` tool — see `AgentLoopDeps.ask`. Undefined → not offered. */
ask?: boolean;
/** The agent's authored intake question set — see `AgentLoopDeps.intake`. Undefined → none. */
intake?: AgentIntake;
/** Inject-mode retriever: when set, the loop retrieves + folds context into the prompt each run. */
retriever?: Retriever;
/** How many passages inject-mode retrieval requests. Undefined → 5. */
retrievalTopK?: number;
/**
* Derives the metadata filter applied to inject-mode RAG retrieval, from the run's actor.
* Without it, retrieval is UNSCOPED. See the doc comment on `AgentConfig.retrievalFilter`.
*/
retrievalFilter?: (actor: Actor) => Record<string, unknown>;
/**
* In-place transient-retry policy for a tool's own invocation (DB deadlock / lock-wait timeout /
* serialization failure). Undefined → the loop's default (`{ attempts: 2, backoffMs: 150 }`);
* `false` disables it.
*/
toolTransientRetry?: ToolTransientRetrySetting;
/** Bounds how much of the persisted thread rides the model call each turn. Omit → full history every turn. */
historyWindow?: HistoryWindow;
/** Show the model when each user message was sent. Omit → messages reach it as stored. */
messageTimestamps?: MessageTimestampsConfig;
/**
* Authored procedures the model can pull in mid-turn, scoped by the host's own tokens. Omit → no
* catalog block and no `skill` tool.
*/
skills?: SkillsConfig;
/**
* What the assistant has concluded about the actor, carried into every turn against the same scope
* tokens skills use. Omit → no memory block and no `remember` tool.
*/
memory?: MemoryConfig;
/** Rewrite every prompt before each model call — see `AgentLoopDeps.inputProcessors`. */
inputProcessors?: InputProcessor[];
/** Rule on every step's answer — see `AgentLoopDeps.outputProcessors`. */
outputProcessors?: OutputProcessor[];
}
/** The UTC calendar day (`YYYY-MM-DD`) a run is accounted against — deterministic for quota/day. */
export declare function utcDay(date?: Date): string;
//# sourceMappingURL=agent-deps.d.ts.map