UNPKG

@mastra/core

Version:
26 lines 1.73 kB
import type { ToolPayloadTransformPhase } from '../tools/types.js'; import type { TokenUsage } from './types.js'; /** * Pure transforms shared by the run engine for folding raw agent-stream chunk * payloads into the `MastraDBMessage` shape a Session renders, plus terminal * finish-reason and server-side-fallback diagnostics. They hold no * AgentController or Session state, so they live in their own module. */ export declare function getDisplayTransform(metadata: unknown, phase: ToolPayloadTransformPhase, fallback: unknown): unknown; /** * Map a non-success terminal finish reason (content-filter, error, length) to a * user-facing message, or `undefined` for success reasons. A non-success finish * must become an explicit terminal error rather than a silent `complete`. */ export declare function describeNonSuccessFinishReason(reason: string, providerMetadata: unknown): string | undefined; /** * Build a user-facing notice when a turn was served by an Anthropic server-side * fallback model instead of the primary model. Without a notice the user has no * way to tell the response did not come from the model they selected. */ export declare function describeServerSideFallback(providerMetadata: unknown): string | undefined; /** Coerce a usage field to a finite number, accepting numeric strings. */ export declare function getUsageNumber(usage: Record<string, unknown>, key: string): number | undefined; /** Fold an optional usage field into a tally when present. */ export declare function addOptionalUsageField(usage: TokenUsage, key: keyof Pick<TokenUsage, 'reasoningTokens' | 'cachedInputTokens' | 'cacheCreationInputTokens'>, value: number | undefined): void; //# sourceMappingURL=stream-content.d.ts.map