UNPKG

@mastra/core

Version:
168 lines • 6.59 kB
import { z } from 'zod'; import type { SpanTermination } from '../../../../observability/types/outcome.js'; export declare function isJsonSafe(value: unknown): boolean; /** * Schema for the serialized durable options carried in workflow input. These * options cross step boundaries (and processes) as JSON, so live objects such * as Zod schemas must be converted before they get here — otherwise they are * silently mangled by the round trip. */ export declare const durableOptionsSchema: z.ZodAny; /** * Schema for model configuration */ export declare const modelConfigSchema: z.ZodObject<{ provider: z.ZodString; modelId: z.ZodString; specificationVersion: z.ZodOptional<z.ZodString>; settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; }, z.core.$strip>; /** * Schema for model list entry (fallback support) */ export declare const modelListEntrySchema: z.ZodObject<{ id: z.ZodString; config: z.ZodObject<{ provider: z.ZodString; modelId: z.ZodString; specificationVersion: z.ZodOptional<z.ZodString>; originalConfig: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>; settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; }, z.core.$strip>; maxRetries: z.ZodNumber; enabled: z.ZodBoolean; }, z.core.$strip>; /** * Type for accumulated usage. Keys stay present in memory so the value can be * passed to usage consumers, while JSON serialization may omit unknown values. */ export type AccumulatedUsage = { inputTokens: number | undefined; outputTokens: number | undefined; totalTokens: number | undefined; cachedInputTokens?: number; cacheCreationInputTokens?: number; reasoningTokens?: number; }; /** * Schema for accumulated usage across iterations */ export declare const accumulatedUsageSchema: z.ZodType<AccumulatedUsage>; /** * Provider id and serving model of one response. */ export declare const responseRecordSchema: z.ZodObject<{ id: z.ZodOptional<z.ZodString>; modelId: z.ZodOptional<z.ZodString>; }, z.core.$strip>; export type ResponseRecord = z.infer<typeof responseRecordSchema>; /** * Schema for output from the durable agentic workflow */ export declare const durableAgenticOutputSchema: z.ZodObject<{ messageListState: z.ZodAny; messageId: z.ZodString; stepResult: z.ZodAny; output: z.ZodObject<{ text: z.ZodOptional<z.ZodString>; usage: z.ZodAny; steps: z.ZodArray<z.ZodAny>; }, z.core.$strip>; state: z.ZodAny; }, z.core.$strip>; /** * Base schema for durable agentic workflow input. * Implementations can extend this with additional fields. */ export declare const baseDurableAgenticInputSchema: z.ZodObject<{ runId: z.ZodString; agentId: z.ZodString; agentName: z.ZodOptional<z.ZodString>; messageListState: z.ZodAny; toolsMetadata: z.ZodArray<z.ZodAny>; modelConfig: z.ZodObject<{ provider: z.ZodString; modelId: z.ZodString; specificationVersion: z.ZodOptional<z.ZodString>; settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; }, z.core.$strip>; options: z.ZodAny; state: z.ZodAny; messageId: z.ZodString; inputTripwire: z.ZodOptional<z.ZodObject<{ reason: z.ZodString; retry: z.ZodOptional<z.ZodBoolean>; processorId: z.ZodOptional<z.ZodString>; metadata: z.ZodOptional<z.ZodUnknown>; }, z.core.$strip>>; }, z.core.$strip>; /** * Base schema for iteration state. * Implementations can extend this with additional fields. */ export declare const baseIterationStateSchema: z.ZodObject<{ runId: z.ZodString; agentId: z.ZodString; agentName: z.ZodOptional<z.ZodString>; messageListState: z.ZodOptional<z.ZodAny>; initialUntaggedSystemMessages: z.ZodOptional<z.ZodArray<z.ZodAny>>; toolsMetadata: z.ZodArray<z.ZodAny>; modelConfig: z.ZodAny; options: z.ZodAny; state: z.ZodAny; messageId: z.ZodString; requestContextEntries: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>; inputTripwire: z.ZodOptional<z.ZodObject<{ reason: z.ZodString; retry: z.ZodOptional<z.ZodBoolean>; processorId: z.ZodOptional<z.ZodString>; metadata: z.ZodOptional<z.ZodUnknown>; }, z.core.$strip>>; iterationCount: z.ZodNumber; accumulatedSteps: z.ZodOptional<z.ZodArray<z.ZodAny>>; accumulatedUsage: z.ZodType<AccumulatedUsage, unknown, z.core.$ZodTypeInternals<AccumulatedUsage, unknown>>; usageAggregationVersion: z.ZodOptional<z.ZodLiteral<1>>; lastStepResult: z.ZodOptional<z.ZodAny>; deferredStepFinishChunk: z.ZodOptional<z.ZodAny>; backgroundTaskPending: z.ZodOptional<z.ZodBoolean>; delegationBailed: z.ZodOptional<z.ZodBoolean>; deadlineTimeout: z.ZodOptional<z.ZodObject<{ timeoutType: z.ZodLiteral<"total">; timeoutMs: z.ZodNumber; }, z.core.$strip>>; runAborted: z.ZodOptional<z.ZodBoolean>; pendingFeedbackStop: z.ZodOptional<z.ZodBoolean>; responseMessagesCursor: z.ZodOptional<z.ZodObject<{ producer: z.ZodString; seq: z.ZodNumber; fingerprints: z.ZodArray<z.ZodString>; wholeListSize: z.ZodOptional<z.ZodNumber>; sentSinceWholeList: z.ZodOptional<z.ZodNumber>; }, z.core.$strip>>; agentSpanData: z.ZodOptional<z.ZodAny>; modelSpanData: z.ZodOptional<z.ZodAny>; completionStartTime: z.ZodOptional<z.ZodCoercedDate<unknown>>; timeToFirstTokenMs: z.ZodOptional<z.ZodNumber>; lastResponse: z.ZodOptional<z.ZodObject<{ id: z.ZodOptional<z.ZodString>; modelId: z.ZodOptional<z.ZodString>; }, z.core.$strip>>; tracingStopCause: z.ZodOptional<z.ZodEnum<{ delegation: "delegation"; feedback_complete: "feedback_complete"; iteration_hook: "iteration_hook"; max_steps: "max_steps"; model_finished: "model_finished"; stop_condition: "stop_condition"; }>>; tracingTermination: z.ZodOptional<z.ZodCustom<SpanTermination, SpanTermination>>; tracingDelegationFailure: z.ZodOptional<z.ZodCustom<SpanTermination, SpanTermination>>; }, z.core.$strip>; /** * Type for the base iteration state */ export type BaseIterationState = z.infer<typeof baseIterationStateSchema>; //# sourceMappingURL=schemas.d.ts.map