UNPKG

@adonis-agora/agent

Version:

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

67 lines • 4.6 kB
import type { DataProvider } from './telescope-sdk.js'; /** Shift a `YYYY-MM-DD` UTC day by `deltaDays` (negative goes back in time). */ export declare function shiftUtcDay(day: string, deltaDays: number): string; /** * Derive the query range: honour explicit `fromDay`/`toDay` (validated ISO days), otherwise default * to the trailing {@link DEFAULT_TREND_WINDOW_DAYS}-day window ending today (UTC). */ export declare function resolveRange(query: Record<string, unknown> | undefined): { fromDay: string; toDay: string; }; /** Cap a run's error message to {@link ERROR_MESSAGE_CAP} characters. `resolve()` output bypasses * Telescope's entry redaction pipeline (that only runs on Watcher-recorded entries) — this cap is a * stopgap so an unbounded stack trace never rides straight into a table cell unbounded. */ export declare function capErrorMessage(message: string | null): string; /** stat → authoritative total spend (USD) over the range. */ export declare function agentSpendTotalProvider(): DataProvider; /** stat → authoritative total tokens (input + output) over the range. */ export declare function agentTokensTotalProvider(): DataProvider; /** breakdown → spend share per model (models with zero cost dropped from the donut). */ export declare function agentSpendByModelProvider(): DataProvider; /** table → per-model requests / in+out tokens / cost. */ export declare function agentModelSpendTableProvider(): DataProvider; /** timeseries → daily spend + tokens trend. */ export declare function agentUsageTrendProvider(): DataProvider; /** table → spend per acting ref (user/tenant). */ export declare function agentActorSpendTableProvider(): DataProvider; /** breakdown → spend share per actor (actors with zero cost dropped). */ export declare function agentSpendByActorProvider(): DataProvider; /** stat → total runs over the range. */ export declare function agentRunsTotalProvider(): DataProvider; /** stat → completed/total success rate over the range. */ export declare function agentRunsSuccessRateProvider(): DataProvider; /** stat → failed run count over the range. */ export declare function agentRunsFailedProvider(): DataProvider; /** * stat → MEAN settled-run duration over the range. Not a percentile: `RunReliability` exposes only * `avgDurationMs` (see this file's header) — there is no p50/p95 to select between, unlike the Nest * reference's `query.metric` switch. `null` (no settled runs) resolves to 0. */ export declare function agentRunsDurationProvider(): DataProvider; /** table → run/failure rollup per agent (empty when the adapter predates `byAgent`). */ export declare function agentRunsByAgentTableProvider(): DataProvider; /** timeseries → daily runs + failures trend (empty when the adapter predates `trend`). */ export declare function agentRunsTrendProvider(): DataProvider; /** table → most recent runs (newest first), via `listRuns`' first page — see this file's header for * why this isn't the paged-table protocol. errorMessage capped per {@link capErrorMessage}. */ export declare function agentRecentRunsTableProvider(): DataProvider; /** table → most recent tool calls (newest first), from the durable read-model. */ export declare function agentRecentToolCallsTableProvider(): DataProvider; /** table → most recently active threads, with rolled-up message/token counts. */ export declare function agentRecentThreadsTableProvider(): DataProvider; /** * stat → an APPROXIMATE count of tool calls sitting `pending_approval`, capped at * {@link MAX_RECENT_LIMIT}. `AgentGovernanceQueries.pendingApprovals` has no `total` — unlike the * Nest reference's exact `approvalsPage({ page: 1, pageSize: 1 }).total`, there is no cheap "how * many, without listing them" query on this SPI (see this file's header). A backlog past the cap * undercounts here exactly the way Nest's OLD `pendingApprovals(500).length` did before it got an * exact query — that regression is accepted, not fixed, until `AgentGovernanceQueries` grows one. */ export declare function agentPendingApprovalsCountProvider(): DataProvider; /** table → the pending-approvals inbox, oldest request first. */ export declare function agentPendingApprovalsTableProvider(): DataProvider; /** table → per-tool call/failure/rejection/latency rollup over the range. Only ONE latency column * (`avgDurationMs`) — `PerToolStatRow` has no p50/p95 split, unlike the Nest reference's table. */ export declare function agentToolStatsTableProvider(): DataProvider; //# sourceMappingURL=agent-governance-providers.d.ts.map