UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

34 lines • 2.01 kB
import type { AgentPricingStore, CurrentModelPrice, ModelPriceInput } from '../spi/pricing-store.js'; import type { LucidDatabaseLike } from './lucid.js'; /** Options for {@link LucidPricingStore}. */ export interface LucidPricingStoreOptions { /** * Provision the shared agent tables on first use. Default `true` (the ecosystem convention). The * pricing store writes to `agent_model_pricing`, one of the six shared tables; auto-provisioning * here is what lets a pricing seed run before the first agent run. Set `false` to run the migration. */ autoCreateTables?: boolean; } /** * A production {@link AgentPricingStore} backed by AdonisJS **Lucid** (Knex) over the * `agent_model_pricing` table — the write side the loop's cost fold prices token usage against. Like * {@link import('./lucid.js').LucidAgentStore} it touches only the structural {@link LucidDatabaseLike} * slice, so `@adonisjs/lucid` stays an optional peer (the factory casts the real `db` in). * * Atomic supersede (mirrors the reference Drizzle/MikroORM stores): `upsertModelPrice` retires the * model's prior `is_current` row and inserts a fresh current one, so exactly one live price exists * per model. `effective_from` is stored as epoch-ms (matching the rest of the schema) and read back * as an ISO string. Booleans are `INTEGER` 0/1 for cross-dialect portability. */ export declare class LucidPricingStore implements AgentPricingStore { private readonly db; private readonly autoCreateTables; constructor(db: LucidDatabaseLike, options?: LucidPricingStoreOptions); /** Provision the shared schema on first use (no-op when disabled), memoized across the stores. */ private ready; /** Provision the shared schema now (what the agent provider calls at app start). Idempotent. */ ensureSchema(): Promise<void>; upsertModelPrice(input: ModelPriceInput): Promise<void>; listCurrentPrices(): Promise<CurrentModelPrice[]>; } //# sourceMappingURL=lucid-pricing.d.ts.map