UNPKG

@adonis-agora/agent

Version:

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

38 lines • 1.8 kB
/** * Where a reasoning part carries how long the model thought, in ms. Both producers write it here — * the transport on the live `reasoning-end` chunk, `storedMessageToUiMessage` on a replayed part — * so a reader has one place to look whichever way the message arrived. */ export declare const REASONING_METADATA_KEY = "agent"; /** The `providerMetadata` a reasoning part is stamped with. */ export declare function reasoningDurationMetadata(reasoningMs: number): { [REASONING_METADATA_KEY]: { reasoningMs: number; }; }; /** The thinking time stamped on a reasoning part, or `null` when it carries none. */ export declare function readReasoningMs(part: { providerMetadata?: unknown; }): number | null; export interface UseElapsedOptions { /** How often the value re-renders while running. Default 1000 — a seconds label needs no more. */ intervalMs?: number; /** Injectable clock for tests. */ now?: () => number; } /** * Milliseconds since `running` last turned true — ticking while it stays true, frozen at the final * value once it turns false, `0` before it has ever run. Headless: pair it with * {@link formatElapsed} or any label of your own. * * For a reasoning block, prefer the duration the block already carries (`block.durationMs`, the * server's own measurement) and fall back to this only while the block streams: * `block.durationMs ?? elapsed`. */ export declare function useElapsed(running: boolean, options?: UseElapsedOptions): number; /** * `"<1s"`, `"4s"`, `"1m 5s"`, `"1h 2m"` — whole units, the shape a "Thought for …" label wants. * Negative or non-finite input reads as `"<1s"` rather than a nonsense figure. */ export declare function formatElapsed(ms: number): string; //# sourceMappingURL=timing.d.ts.map