import type { ChatMessage } from "../types/model.js"; import type { State } from "../types/state.js"; export interface TrajectoryProviderAttribution { providerName: string; sha256: string; /** * Character-based estimate (`ceil(len / 3.5)`), not a model tokenizer count. * Always paired with `tokenCountEstimated: true` from the runtime helpers. */ tokenCount: number; /** True when `tokenCount` is the length-based estimate, not billed usage. */ tokenCountEstimated?: boolean; position: number; /** Inclusive-exclusive offsets into the call's canonical prompt, when exact. */ spanStart?: number; spanEnd?: number; } /** Lowercase hex SHA-256 of UTF-8 text or raw bytes. */ export declare function sha256Hex(value: string | Uint8Array): string; /** * Length-based token estimate for trajectory diagnostics only. Do not treat * the result as billed or tokenizer-accurate usage. */ export declare function estimateTrajectoryTextTokens(text: string): number; export declare function flattenTrajectoryMessages(messages: readonly ChatMessage[] | readonly unknown[] | undefined): string; /** * Canonical prompt representation for a recorded model call. Prefer the * flattened `messages` array (the persisted source of truth); fall back to a * bare prompt string when messages are absent. */ export declare function canonicalPromptForModelCall(args: { messages?: readonly ChatMessage[] | readonly unknown[] | undefined; prompt?: string | null | undefined; }): string; /** * Drop span offsets that are not proven against a known prompt. Keeps hash, * order, and estimated token fields so consumers still see contribution * identity without a false exact-match claim. */ export declare function omitUnvalidatedProviderSpans(attributions: readonly TrajectoryProviderAttribution[] | undefined): TrajectoryProviderAttribution[] | undefined; export declare function buildProviderAttributionsFromState(args: { state?: State; /** * Exact canonical prompt for the consuming call. Spans are located only * inside this string; when a provider is not present, spans are omitted. */ prompt?: string; }): { providerOrder: string[]; providerAttributions: TrajectoryProviderAttribution[]; };