UNPKG

@mastra/core

Version:
219 lines • 11.4 kB
import { z } from 'zod/v4'; export declare const DATASET_SNAPSHOT_DEFAULT_MAX_BYTES: number; export declare const DATASET_SNAPSHOT_MAX_DEPTH = 100; declare const snapshotOptionsSchema: z.ZodObject<{ maxBytes: z.ZodDefault<z.ZodNumber>; }, z.core.$strip>; export type DatasetSnapshotOptions = z.input<typeof snapshotOptionsSchema>; type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; }; declare const contentSchema: z.ZodObject<{ formatVersion: z.ZodLiteral<1>; datasetIdentity: z.ZodUUID; configuration: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional<z.ZodNullable<z.ZodString>>; metadata: z.ZodOptional<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>; inputSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; groundTruthSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; requestContextSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; targetType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{ agent: "agent"; processor: "processor"; scorer: "scorer"; workflow: "workflow"; }>>>; targetIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; scorerIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; }, z.core.$strict>; items: z.ZodArray<z.ZodObject<{ itemIdentity: z.ZodUUID; createdAt: z.ZodISODateTime; updatedAt: z.ZodISODateTime; payload: z.ZodObject<{ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>; input: z.ZodCustom<JsonValue, JsonValue>; groundTruth: z.ZodOptional<z.ZodCustom<JsonValue, JsonValue>>; expectedTrajectory: z.ZodOptional<z.ZodCustom<JsonValue, JsonValue>>; toolMocks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{ toolName: z.ZodString; args: z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>; output: z.ZodCustom<JsonValue, JsonValue>; matchArgs: z.ZodOptional<z.ZodEnum<{ ignore: "ignore"; strict: "strict"; }>>; }, z.core.$strict>>>>; unmockedToolPolicy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{ allow: "allow"; deny: "deny"; }>>>; scorerIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; requestContext: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; metadata: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; source: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<{ "candidate-screener": "candidate-screener"; csv: "csv"; "experiment-result": "experiment-result"; json: "json"; llm: "llm"; trace: "trace"; }>; referenceId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; }, z.core.$strict>; }, z.core.$strict>>; provenance: z.ZodObject<{ exportedAt: z.ZodISODateTime; sourceDatasetId: z.ZodString; itemVersion: z.ZodNumber; configurationBasis: z.ZodLiteral<"export-time">; }, z.core.$strict>; }, z.core.$strict>; export type DatasetSnapshotContent = z.infer<typeof contentSchema>; /** Validates unsigned artifact content, including portable identity uniqueness. */ export declare const datasetSnapshotContentSchema: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodObject<{ formatVersion: z.ZodLiteral<1>; datasetIdentity: z.ZodUUID; configuration: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional<z.ZodNullable<z.ZodString>>; metadata: z.ZodOptional<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>; inputSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; groundTruthSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; requestContextSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; targetType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{ agent: "agent"; processor: "processor"; scorer: "scorer"; workflow: "workflow"; }>>>; targetIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; scorerIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; }, z.core.$strict>; items: z.ZodArray<z.ZodObject<{ itemIdentity: z.ZodUUID; createdAt: z.ZodISODateTime; updatedAt: z.ZodISODateTime; payload: z.ZodObject<{ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>; input: z.ZodCustom<JsonValue, JsonValue>; groundTruth: z.ZodOptional<z.ZodCustom<JsonValue, JsonValue>>; expectedTrajectory: z.ZodOptional<z.ZodCustom<JsonValue, JsonValue>>; toolMocks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{ toolName: z.ZodString; args: z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>; output: z.ZodCustom<JsonValue, JsonValue>; matchArgs: z.ZodOptional<z.ZodEnum<{ ignore: "ignore"; strict: "strict"; }>>; }, z.core.$strict>>>>; unmockedToolPolicy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{ allow: "allow"; deny: "deny"; }>>>; scorerIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; requestContext: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; metadata: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; source: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<{ "candidate-screener": "candidate-screener"; csv: "csv"; "experiment-result": "experiment-result"; json: "json"; llm: "llm"; trace: "trace"; }>; referenceId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; }, z.core.$strict>; }, z.core.$strict>>; provenance: z.ZodObject<{ exportedAt: z.ZodISODateTime; sourceDatasetId: z.ZodString; itemVersion: z.ZodNumber; configurationBasis: z.ZodLiteral<"export-time">; }, z.core.$strict>; }, z.core.$strict>>; /** Validates the complete v1 artifact and SHA-256 digest, independently of deployment size limits. */ export declare const datasetSnapshotSchema: z.ZodPipe<z.ZodCustom<JsonValue, JsonValue>, z.ZodObject<{ formatVersion: z.ZodLiteral<1>; datasetIdentity: z.ZodUUID; configuration: z.ZodObject<{ name: z.ZodString; description: z.ZodOptional<z.ZodNullable<z.ZodString>>; metadata: z.ZodOptional<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>; inputSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; groundTruthSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; requestContextSchema: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; targetType: z.ZodOptional<z.ZodNullable<z.ZodEnum<{ agent: "agent"; processor: "processor"; scorer: "scorer"; workflow: "workflow"; }>>>; targetIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; scorerIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; }, z.core.$strict>; items: z.ZodArray<z.ZodObject<{ itemIdentity: z.ZodUUID; createdAt: z.ZodISODateTime; updatedAt: z.ZodISODateTime; payload: z.ZodObject<{ externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>; input: z.ZodCustom<JsonValue, JsonValue>; groundTruth: z.ZodOptional<z.ZodCustom<JsonValue, JsonValue>>; expectedTrajectory: z.ZodOptional<z.ZodCustom<JsonValue, JsonValue>>; toolMocks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{ toolName: z.ZodString; args: z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>; output: z.ZodCustom<JsonValue, JsonValue>; matchArgs: z.ZodOptional<z.ZodEnum<{ ignore: "ignore"; strict: "strict"; }>>; }, z.core.$strict>>>>; unmockedToolPolicy: z.ZodOptional<z.ZodNullable<z.ZodEnum<{ allow: "allow"; deny: "deny"; }>>>; scorerIds: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>; requestContext: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; metadata: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, JsonValue>, Record<string, JsonValue>>>>; source: z.ZodOptional<z.ZodNullable<z.ZodObject<{ type: z.ZodEnum<{ "candidate-screener": "candidate-screener"; csv: "csv"; "experiment-result": "experiment-result"; json: "json"; llm: "llm"; trace: "trace"; }>; referenceId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; }, z.core.$strict>; }, z.core.$strict>>; provenance: z.ZodObject<{ exportedAt: z.ZodISODateTime; sourceDatasetId: z.ZodString; itemVersion: z.ZodNumber; configurationBasis: z.ZodLiteral<"export-time">; }, z.core.$strict>; digest: z.ZodString; }, z.core.$strict>>; export type DatasetSnapshot = z.infer<typeof datasetSnapshotSchema>; /** * Seals authored content and limits its compact JSON byte size. Does not read or write storage. * The size check follows validation, cloning, and hashing; it does not bound CPU time or peak memory. */ export declare function createDatasetSnapshot(content: DatasetSnapshotContent, options?: DatasetSnapshotOptions): DatasetSnapshot; /** Limits raw UTF-8 bytes before parsing untrusted JSON. Destination checks belong to import preflight. */ export declare function parseDatasetSnapshot(text: string, options?: DatasetSnapshotOptions): DatasetSnapshot; export {}; //# sourceMappingURL=snapshot.d.ts.map