@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
925 lines • 85.4 kB
TypeScript
import { z } from 'zod/v4';
import { SpanType } from '../../../observability/types/index.js';
import { traceIdField, spanIdField } from '../shared.js';
export { traceIdField, spanIdField };
/** Derived status of a trace, computed from the root span's error and endedAt fields. */
export declare enum TraceStatus {
SUCCESS = "success",
ERROR = "error",
RUNNING = "running"
}
/** Shape containing trace and span identifier fields */
export declare const spanIds: {
readonly traceId: z.ZodString;
readonly spanId: z.ZodString;
};
/** Schema for span identifiers (traceId and spanId) */
export declare const spanIdsSchema: z.ZodObject<{
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>;
/** Span identifier pair (traceId and spanId) */
export type SpanIds = z.infer<typeof spanIdsSchema>;
/** Schema for a complete span record as stored in the database */
export declare const spanRecordSchema: z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>;
/** Complete span record as stored in the database */
export type SpanRecord = z.infer<typeof spanRecordSchema>;
/**
* Computes the trace status from a root span's error and endedAt fields.
* - ERROR: if error is present (regardless of endedAt)
* - RUNNING: if endedAt is null/undefined and no error
* - SUCCESS: if endedAt is present and no error
*/
export declare function computeTraceStatus(span: {
error?: unknown;
endedAt?: Date | string | null;
}): TraceStatus;
/** Schema for a trace span (root span with computed status) */
export declare const traceSpanSchema: z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
status: z.ZodEnum<typeof TraceStatus>;
}, z.core.$strip>;
/** Trace span (root span with computed status) */
export type TraceSpan = z.infer<typeof traceSpanSchema>;
/**
* Converts a SpanRecord to a TraceSpan by adding computed status.
* Used when returning root spans from listTraces.
*/
export declare function toTraceSpan(span: SpanRecord): TraceSpan;
/**
* Converts an array of SpanRecords to TraceSpans by adding computed status.
* Used when returning root spans from listTraces.
*/
export declare function toTraceSpans(spans: SpanRecord[]): TraceSpan[];
/**
* Schema for creating a span (without db timestamps)
*/
export declare const createSpanRecordSchema: z.ZodObject<{
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
traceId: z.ZodString;
spanId: z.ZodString;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>;
/** Span record for creation (excludes db timestamps) */
export type CreateSpanRecord = z.infer<typeof createSpanRecordSchema>;
/**
* Schema for createSpan operation arguments
*/
export declare const createSpanArgsSchema: z.ZodObject<{
span: z.ZodObject<{
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
traceId: z.ZodString;
spanId: z.ZodString;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>;
}, z.core.$strip>;
/** Arguments for creating a single span */
export type CreateSpanArgs = z.infer<typeof createSpanArgsSchema>;
/**
* Schema for batchCreateSpans operation arguments
*/
export declare const batchCreateSpansArgsSchema: z.ZodObject<{
records: z.ZodArray<z.ZodObject<{
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
traceId: z.ZodString;
spanId: z.ZodString;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, z.core.$strip>>;
}, z.core.$strip>;
/** Arguments for batch creating multiple spans */
export type BatchCreateSpansArgs = z.infer<typeof batchCreateSpansArgsSchema>;
/**
* Schema for getSpan operation arguments
*/
export declare const getSpanArgsSchema: z.ZodObject<{
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>;
/** Arguments for retrieving a single span */
export type GetSpanArgs = z.infer<typeof getSpanArgsSchema>;
/**
* Response schema for getSpan operation
*/
export declare const getSpanResponseSchema: z.ZodObject<{
span: z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
/** Response containing a single span */
export type GetSpanResponse = z.infer<typeof getSpanResponseSchema>;
/**
* Schema for getSpans (batch) operation arguments.
*
* Fetches multiple spans in a trace by spanId in one call. Used to power the
* progressive-disclosure path in {@link getBranchArgsSchema}: walk the
* lightweight {@link getStructureResponseSchema} to find which spanIds belong
* to a branch, then fetch only those with full data instead of pulling the
* entire trace.
*/
export declare const getSpansArgsSchema: z.ZodObject<{
traceId: z.ZodString;
spanIds: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
/** Arguments for batch-fetching spans by spanId */
export type GetSpansArgs = z.infer<typeof getSpansArgsSchema>;
/** Response schema for getSpans operation */
export declare const getSpansResponseSchema: z.ZodObject<{
traceId: z.ZodString;
spans: z.ZodArray<z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
/** Response containing the requested spans (order is not guaranteed) */
export type GetSpansResponse = z.infer<typeof getSpansResponseSchema>;
/**
* Schema for getRootSpan operation arguments
*/
export declare const getRootSpanArgsSchema: z.ZodObject<{
traceId: z.ZodString;
}, z.core.$strip>;
/** Arguments for retrieving a root span */
export type GetRootSpanArgs = z.infer<typeof getRootSpanArgsSchema>;
/**
* Response schema for getRootSpan operation
*/
export declare const getRootSpanResponseSchema: z.ZodObject<{
span: z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>;
}, z.core.$strip>;
/** Response containing a single root span */
export type GetRootSpanResponse = z.infer<typeof getRootSpanResponseSchema>;
/**
* Schema for getTrace operation arguments
*/
export declare const getTraceArgsSchema: z.ZodObject<{
traceId: z.ZodString;
}, z.core.$strip>;
/** Arguments for retrieving a single trace */
export type GetTraceArgs = z.infer<typeof getTraceArgsSchema>;
/**
* Response schema for getTrace operation
*/
export declare const getTraceResponseSchema: z.ZodObject<{
traceId: z.ZodString;
spans: z.ZodArray<z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
/** Response containing a trace with all its spans */
export type GetTraceResponse = z.infer<typeof getTraceResponseSchema>;
/** Alias for GetTraceResponse -- a trace with all its spans. */
export type TraceRecord = GetTraceResponse;
/**
* Schema for getBranch operation arguments.
*
* Returns the subtree rooted at `spanId`. When `depth` is omitted the full
* descendant subtree is returned; with a finite `depth` only that many levels
* below the anchor are returned (depth: 0 → only the anchor span; depth: 1 →
* anchor plus immediate children; etc).
*/
export declare const getBranchArgsSchema: z.ZodObject<{
traceId: z.ZodString;
spanId: z.ZodString;
depth: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
}, z.core.$strip>;
/** Arguments for retrieving the subtree rooted at a span */
export type GetBranchArgs = z.input<typeof getBranchArgsSchema>;
/**
* Response schema for getBranch operation. Mirrors getTrace -- a flat list of
* spans, traversal-agnostic. The anchor span is included as the first matching
* span; callers reconstruct the tree via parentSpanId.
*/
export declare const getBranchResponseSchema: z.ZodObject<{
traceId: z.ZodString;
spans: z.ZodArray<z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
attributes: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
links: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
input: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
output: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
requestContext: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
/** Response containing the subtree rooted at a span */
export type GetBranchResponse = z.infer<typeof getBranchResponseSchema>;
/**
* Extracts the subtree rooted at `anchorSpanId` from a flat list of trace
* spans. The anchor itself is included as the first element; descendants are
* walked via `parentSpanId` and returned sorted by `startedAt` ascending after
* the anchor. When `maxDepth` is provided, only that many levels of
* descendants are returned (anchor counts as depth 0).
*
* Cycles in `parentSpanId` (which shouldn't happen in well-formed traces but
* could surface from corrupted data) are handled by tracking visited spanIds
* and skipping any span seen during this walk.
*
* Returns an empty array if the anchor isn't in the input.
*
* Generic over the span shape so it works on both full {@link SpanRecord}
* lists (e.g. result of `getTrace`) and lightweight skeletons (result of
* `getStructure`).
*/
export declare function extractBranchSpans<T extends {
spanId: string;
parentSpanId?: string | null | undefined;
startedAt: Date;
}>(spans: T[], anchorSpanId: string, maxDepth?: number): T[];
/**
* Lightweight span record containing only the fields needed for timeline rendering.
* Excludes heavy fields: input, output, attributes, metadata, tags, links.
* This reduces per-span payload from ~17KB to ~370 bytes (~97% reduction).
*/
export declare const lightSpanRecordSchema: z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>;
/** Lightweight span record for timeline rendering */
export type LightSpanRecord = z.infer<typeof lightSpanRecordSchema>;
/**
* Response schema for getStructure operation.
* Returns a trace with lightweight spans (only fields needed for timeline).
*/
export declare const getStructureResponseSchema: z.ZodObject<{
traceId: z.ZodString;
spans: z.ZodArray<z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
/** Response containing a trace with lightweight spans for timeline rendering */
export type GetStructureResponse = z.infer<typeof getStructureResponseSchema>;
/** @deprecated Use {@link getStructureResponseSchema} instead. */
export declare const getTraceLightResponseSchema: z.ZodObject<{
traceId: z.ZodString;
spans: z.ZodArray<z.ZodObject<{
createdAt: z.ZodDate;
updatedAt: z.ZodNullable<z.ZodDate>;
name: z.ZodString;
spanType: z.ZodEnum<typeof SpanType>;
isEvent: z.ZodBoolean;
startedAt: z.ZodDate;
parentSpanId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
endedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
traceId: z.ZodString;
spanId: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>;
/** @deprecated Use {@link GetStructureResponse} instead. */
export type GetTraceLightResponse = GetStructureResponse;
/** Schema for filtering traces in list queries */
export declare const tracesFilterSchema: z.ZodObject<{
status: z.ZodOptional<z.ZodEnum<typeof TraceStatus>>;
hasChildError: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
startedAt: z.ZodOptional<z.ZodObject<{
start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
startExclusive: z.ZodOptional<z.ZodBoolean>;
endExclusive: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
endedAt: z.ZodOptional<z.ZodObject<{
start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
startExclusive: z.ZodOptional<z.ZodBoolean>;
endExclusive: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
spanType: z.ZodOptional<z.ZodEnum<typeof SpanType>>;
traceId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
/**
* Fields available for ordering trace results
*/
export declare const tracesOrderByFieldSchema: z.ZodEnum<{
startedAt: "startedAt";
endedAt: "endedAt";
}>;
/**
* Order by configuration for trace queries
* Follows the existing StorageOrderBy pattern
* Defaults to startedAt desc (newest first)
*/
export declare const tracesOrderBySchema: z.ZodObject<{
field: z.ZodDefault<z.ZodEnum<{
startedAt: "startedAt";
endedAt: "endedAt";
}>>;
direction: z.ZodDefault<z.ZodEnum<{
ASC: "ASC";
DESC: "DESC";
}>>;
}, z.core.$strip>;
/**
* Arguments for listing traces
*/
export declare const listTracesArgsSchema: z.ZodPipe<z.ZodObject<{
mode: z.ZodOptional<z.ZodEnum<{
page: "page";
delta: "delta";
}>>;
filters: z.ZodOptional<z.ZodObject<{
status: z.ZodOptional<z.ZodEnum<typeof TraceStatus>>;
hasChildError: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>;
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
entityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
entityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
parentEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityType: z.ZodOptional<z.ZodNullable<z.ZodEnum<typeof import("../../../_types/@internal_core/dist/index.js").EntityType>>>;
rootEntityId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
organizationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
resourceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
runId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
environment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
serviceName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
scope: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
entityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
parentEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
rootEntityVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
experimentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
startedAt: z.ZodOptional<z.ZodObject<{
start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
startExclusive: z.ZodOptional<z.ZodBoolean>;
endExclusive: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
endedAt: z.ZodOptional<z.ZodObject<{
start: z.ZodOptional<z.ZodCoercedDate<unknown>>;
end: z.ZodOptional<z.ZodCoercedDate<unknown>>;
startExclusive: z.ZodOptional<z.ZodBoolean>;
endExclusive: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>>;
spanType: z.ZodOptional<z.ZodEnum<typeof SpanType>>;
traceId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
pagination: z.ZodOptional<z.ZodObject<{
page: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
perPage: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
}, z.core.$strip>>;
orderBy: z.ZodOptional<z.ZodObject<{
field: z.ZodDefault<z.ZodEnum<{
startedAt: "startedAt";
endedAt: "endedAt";
}>>;
direction: z.ZodDefault<z.ZodEnum<{
ASC: "ASC";
DESC: "DESC";
}>>;
}, z.core.$strip>>;
after: z.ZodOptional<z.ZodString>;
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
}, z.core.$strict>, z.ZodTransform<{
mode: "page" | "delta";
filters: {
status?: TraceStatus | undefined;
hasChildError?: boolean | undefined;
metadata?: Record<string, unknown> | null | undefined;
tags?: string[] | null | undefined;
source?: string | null | undefined;
entityType?: import("../../../_types/@internal_core/dist/index.js").EntityType | null | undefined;
entityId?: string | null | undefined;
entityName?: string | null | undefined;
parentEntityType?: import("../../../_types/@internal_core/dist/index.js").EntityType | null | undefined;
parentEntityId?: string | null | undefined;
parentEntityName?: string | null | undefined;
rootEntityType?: import("../../../_types/@internal_core/dist/index.js").EntityType | null | undefined;
rootEntityId?: string | null | undefined;
rootEntityName?: string | null | undefined;
userId?: string | null | undefined;
organizationId?: string | null | undefined;
resourceId?: string | null | undefined;
runId?: string | null | undefined;
sessionId?: string | null | undefined;
threadId?: string | null | undefined;
requestId?: string | null | undefined;
environment?: string | null | undefined;
serviceName?: string | null | undefined;
scope?: Record<string, unknown> | null | undefined;
entityVersionId?: string | null | undefined;
parentEntityVersionId?: string | null | undefined;
rootEntityVersionId?: string | null | undefined;
experimentId?: string | null | undefined;
startedAt?: {
start?: Date | undefined;
end?: Date | undefined;
startExclusive?: boolean | undefined;
endExclusive?: boolean | undefined;
} | undefined;
endedAt?: {
start?: Date | undefined;
end?: Date | undefined;
startExclusive?: boolean | undefined;
endExclusive?: boolean | undefined;
} | undefined;
spanType?: SpanType | undefined;
traceId?: string | undefined;
} | undefined;
pagination: {
page: number;
perPage: number;
};
orderBy: {
field: "startedAt" | "endedAt";
direction: "ASC" | "DESC";
};
after: import("../../../_types/@internal_core/dist/index.js").DeltaCursor | undefined;
limit: number;
}, {
mode?: "page" | "delta" | undefined;
filters?: {
status?: TraceStatus | undefined;
hasChildError?: boolean | undefined;
metadata?: Record<string, unknown> | null | undefined;
tags?: string[] | null | undefined;
source?: string | null | undefined;
entityType?: import("../../../_types/@internal_core/dist/index.js").EntityType | null | undefined;
entityId?: string | null | undefined;
entityName?: string | null | undefined;
parentEntityType?: import("../../../_types/@internal_core/dist/index.js").EntityType | null | undefined;
parentEntityId?: string | null | undefined;
parentEntityName?: string | null | undefined;
rootEntityType?: import("../../../_types/@internal_core/dist/index.js").EntityType | null | undefined;
rootEntityId?: string | null | undefined;
rootEntityName?: string | null | undefined;
userId?: string | null | undefined;
organizationId?: string | null | undefined;
resourceId?: string | null | undefined;
runId?: string | null | undefined;
sessionId?: string | null | undefined;
threadId?: string | null | undefined;
requestId?: string | null | undefined;
environment?: string | null | undefined;
serviceName?: string | null | undefined;
scope?: Record<string, unknown> | null | undefined;
entityVersionId?: string | null | undefined;
parentEntityVersionId?: string | null | undefined;
rootEntityVersionId?: string | null | undefined;
experimentId?: string | null | undefined;
startedAt?: {
start?: Date | undefined;
end?: Date | undefined;
startExclusive?: boolean | undefined;
endExclusive?: boolean | undefined;
} | undefined;
endedAt?: {
start?: Date | undefined;
end?: Date | undefined;
startExclusive?: boolean | undefined;
endExclusive?: boolean | undefined;
} | undefined;
spanType?: SpanType | undefined;
traceId?: string |