import { Schema } from "effect"; import { Response } from "effect/unstable/ai"; import { type ModelProviderUsage as ModelProviderUsageValue } from "./model-attempt-observation.js"; export { Delivery, DeliveryFailed, InvocationCoordinationFailed, InvocationCoordinator, generateId, isInvocationCoordinationFailed, layerInvocationCoordinatorNoop, layerNoop, type DeliveryInterface, type InvocationCoordinatorInterface, } from "./model-telemetry-services.js"; export { CurrentCompactionId, CurrentInstrumentation, CurrentPurpose, CurrentSummaryCall, type Instrumentation, type SummaryCallCell, } from "./model-telemetry-context.js"; /** @experimental */ export declare const ModelProviderUsage: Schema.Struct<{ readonly inputTokens: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>; /** @experimental */ export type ModelProviderUsage = ModelProviderUsageValue; /** @experimental Bounded purpose of one model call issued by the loop. */ export declare const ModelCallPurpose: Schema.Literals; /** @experimental */ export type ModelCallPurpose = typeof ModelCallPurpose.Type; /** @experimental Bounded provider-neutral model failure category. */ export declare const ModelFailureCategory: Schema.Literals; /** @experimental */ export type ModelFailureCategory = typeof ModelFailureCategory.Type; /** @experimental Classification a retry decision was based on. */ export declare const ModelFailureClassification: Schema.Literals; /** @experimental */ export type ModelFailureClassification = typeof ModelFailureClassification.Type; /** @experimental Decision taken after a provider attempt failed. */ export declare const ModelFailureDisposition: Schema.Literals; /** @experimental */ export type ModelFailureDisposition = typeof ModelFailureDisposition.Type; /** * @experimental Bounded reason a model attempt retry was scheduled. */ export declare const ModelRetryReason: Schema.Literals; /** @experimental */ export type ModelRetryReason = typeof ModelRetryReason.Type; /** @experimental Kind of the first output part produced by a model attempt. */ export declare const ModelFirstOutputKind: Schema.Literals; /** @experimental */ export type ModelFirstOutputKind = typeof ModelFirstOutputKind.Type; /** @experimental What caused a compaction pass to run. */ export declare const CompactionTrigger: Schema.Literals; /** @experimental */ export type CompactionTrigger = typeof CompactionTrigger.Type; /** @experimental How a completed compaction pass reduced context. */ export declare const CompactionKind: Schema.Literals; /** @experimental */ export type CompactionKind = typeof CompactionKind.Type; export declare const ModelInvocationMethod: Schema.Literals; export type ModelInvocationMethod = typeof ModelInvocationMethod.Type; export declare const ModelInvocationStarted: Schema.Struct<{ readonly logicalOperationId: Schema.String; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly callOrdinal: Schema.Int; readonly attempt: Schema.Int; readonly turn: Schema.Finite; readonly purpose: Schema.Literals; readonly method: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly startedAt: Schema.Finite; }>; export type ModelInvocationStarted = typeof ModelInvocationStarted.Type; export declare const ModelInvocationCompleted: Schema.Struct<{ readonly logicalOperationId: Schema.String; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: typeof Response.Usage; readonly finishReason: Schema.Literals<["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>; readonly requestId: Schema.optionalKey; readonly responseModel: Schema.optionalKey; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; }>; export type ModelInvocationCompleted = typeof ModelInvocationCompleted.Type; export declare const ModelInvocationFailed: Schema.Struct<{ readonly logicalOperationId: Schema.String; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly disposition: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; }>; export type ModelInvocationFailed = typeof ModelInvocationFailed.Type; /** * @experimental A model call began. One call spans every provider attempt made * for one prepared input. All timestamps are epoch milliseconds sampled from * the Effect Clock at the operation boundary. */ export declare const ModelCallStarted: Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly compactionId: Schema.optionalKey; readonly startedAt: Schema.Finite; }>; /** @experimental */ export type ModelCallStarted = typeof ModelCallStarted.Type; /** @experimental One provider invocation within a model call began. `attempt` is 0-based. */ export declare const ModelAttemptStarted: Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly startedAt: Schema.Finite; }>; /** @experimental */ export type ModelAttemptStarted = typeof ModelAttemptStarted.Type; /** @experimental The first reasoning, text, or tool-call output of one attempt; at most one event per kind. */ export declare const ModelAttemptFirstOutput: Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptFirstOutput">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly kind: Schema.Literals; readonly at: Schema.Finite; }>; /** @experimental */ export type ModelAttemptFirstOutput = typeof ModelAttemptFirstOutput.Type; /** * @experimental A provider invocation finished. A completed attempt always * carries the provider's terminal `finish` part, so usage, `usageAt`, and * `finishReason` are required; an attempt whose stream ended without one is * reported as `ModelAttemptFailed` with category `truncated-stream`. Absent * request correlation and service tier fields mean unknown, never zero. * `usageAt` is sampled when provider-reported usage was received, which can * precede stream completion. */ export declare const ModelAttemptCompleted: Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptCompleted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: typeof Response.Usage; readonly usageAt: Schema.Finite; readonly finishReason: Schema.Literals<["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly requestId: Schema.optionalKey; readonly responseModel: Schema.optionalKey; readonly serviceTier: Schema.optionalKey; }>; /** @experimental */ export type ModelAttemptCompleted = typeof ModelAttemptCompleted.Type; /** @experimental A provider invocation failed with a bounded category. */ export declare const ModelAttemptFailed: Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly disposition: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly providerUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; }>; /** @experimental */ export type ModelAttemptFailed = typeof ModelAttemptFailed.Type; /** @experimental An unavailable candidate was exhausted before any replay-sensitive output escaped. */ export declare const ModelFallbackScheduled: Schema.Struct<{ readonly _tag: Schema.tag<"ModelFallbackScheduled">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly attempt: Schema.Int; readonly fromCandidate: Schema.Int; readonly fromProvider: Schema.String; readonly fromModel: Schema.String; readonly fromRegistrationKey: Schema.optionalKey; readonly toCandidate: Schema.Int; readonly toProvider: Schema.String; readonly toModel: Schema.String; readonly toRegistrationKey: Schema.optionalKey; readonly category: Schema.Literals; readonly at: Schema.Finite; }>; /** @experimental */ export type ModelFallbackScheduled = typeof ModelFallbackScheduled.Type; /** @experimental Atomic checkpoint record joining a compaction pass to its telemetry and projection. */ export declare const CompactionCommit: Schema.Struct<{ readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly summaryModelCallId: Schema.optionalKey; readonly contextTokensBefore: Schema.optionalKey; readonly contextTokensAfter: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; readonly entriesAfter: Schema.optionalKey; }>; /** @experimental */ export type CompactionCommit = typeof CompactionCommit.Type; /** * @experimental A retry of the model call was accepted. `attempt` is the * 0-based ordinal of the attempt that failed; emitted before the backoff * sleep. `delayMillis` is the accepted backoff delay. */ export declare const ModelRetryScheduled: Schema.Struct<{ readonly _tag: Schema.tag<"ModelRetryScheduled">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly attempt: Schema.Int; readonly reason: Schema.Literals; readonly category: Schema.Literals; readonly delayMillis: Schema.Finite; readonly at: Schema.Finite; }>; /** @experimental */ export type ModelRetryScheduled = typeof ModelRetryScheduled.Type; /** @experimental The model call reached a successful terminal outcome. */ export declare const ModelCallCompleted: Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallCompleted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly attempts: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: Schema.optionalKey; readonly failedAttemptUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; readonly finishReason: Schema.optionalKey>; }>; /** @experimental */ export type ModelCallCompleted = typeof ModelCallCompleted.Type; /** * @experimental The model call reached a failed terminal outcome. `category` * and `classification` are decided the same way as on `ModelAttemptFailed`, so * a consumer never has to infer retryability from an absent field. The two * levels differ only when resilience refuses to replay a retryable failure * because output already escaped: the attempt reports the failure's own * classification while the call reports `terminal`. */ export declare const ModelCallFailed: Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly attempts: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly failedAttemptUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; }>; /** @experimental */ export type ModelCallFailed = typeof ModelCallFailed.Type; /** @experimental A compaction pass that decided to do work began. */ export declare const CompactionStarted: Schema.Struct<{ readonly _tag: Schema.tag<"CompactionStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly trigger: Schema.Literals; readonly startedAt: Schema.Finite; readonly contextTokensBefore: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; }>; /** @experimental */ export type CompactionStarted = typeof CompactionStarted.Type; /** @experimental A started compaction pass found no projection change to apply. */ export declare const CompactionSkipped: Schema.Struct<{ readonly _tag: Schema.tag<"CompactionSkipped">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly skippedAt: Schema.Finite; }>; /** @experimental */ export type CompactionSkipped = typeof CompactionSkipped.Type; /** * @experimental A compaction pass produced its result. Session checkpoint and * projection application follow, and their failure fails the run typed. * `summaryModelCallId` names the summary model call when one ran; that call * also carries this pass's `compactionId` on its `ModelCallStarted` event. */ export declare const CompactionApplied: Schema.Struct<{ readonly _tag: Schema.tag<"CompactionApplied">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly kind: Schema.Literals; readonly appliedAt: Schema.Finite; readonly commit: Schema.Struct<{ readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly summaryModelCallId: Schema.optionalKey; readonly contextTokensBefore: Schema.optionalKey; readonly contextTokensAfter: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; readonly entriesAfter: Schema.optionalKey; }>; }>; /** @experimental */ export type CompactionApplied = typeof CompactionApplied.Type; /** @experimental A compaction pass failed or was interrupted after work began. */ export declare const CompactionFailed: Schema.Struct<{ readonly _tag: Schema.tag<"CompactionFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly failedAt: Schema.Finite; }>; /** @experimental */ export type CompactionFailed = typeof CompactionFailed.Type; /** * @experimental Closed union of model-call, retry, and compaction telemetry * events. Events carry timestamps sampled at their real operation boundary and * are delivered in causal order within the agent event stream, flushed at the * next event boundary or at stream end. */ export declare const Event: Schema.Union; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly compactionId: Schema.optionalKey; readonly startedAt: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly startedAt: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptFirstOutput">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly kind: Schema.Literals; readonly at: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptCompleted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: typeof Response.Usage; readonly usageAt: Schema.Finite; readonly finishReason: Schema.Literals<["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly requestId: Schema.optionalKey; readonly responseModel: Schema.optionalKey; readonly serviceTier: Schema.optionalKey; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly disposition: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly providerUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelRetryScheduled">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly attempt: Schema.Int; readonly reason: Schema.Literals; readonly category: Schema.Literals; readonly delayMillis: Schema.Finite; readonly at: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelFallbackScheduled">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly attempt: Schema.Int; readonly fromCandidate: Schema.Int; readonly fromProvider: Schema.String; readonly fromModel: Schema.String; readonly fromRegistrationKey: Schema.optionalKey; readonly toCandidate: Schema.Int; readonly toProvider: Schema.String; readonly toModel: Schema.String; readonly toRegistrationKey: Schema.optionalKey; readonly category: Schema.Literals; readonly at: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallCompleted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly attempts: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: Schema.optionalKey; readonly failedAttemptUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; readonly finishReason: Schema.optionalKey>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly attempts: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly failedAttemptUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly trigger: Schema.Literals; readonly startedAt: Schema.Finite; readonly contextTokensBefore: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionSkipped">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly skippedAt: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionApplied">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly kind: Schema.Literals; readonly appliedAt: Schema.Finite; readonly commit: Schema.Struct<{ readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly summaryModelCallId: Schema.optionalKey; readonly contextTokensBefore: Schema.optionalKey; readonly contextTokensAfter: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; readonly entriesAfter: Schema.optionalKey; }>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly failedAt: Schema.Finite; }>]>; /** @experimental */ export type Event = typeof Event.Type; /** @experimental One ordered telemetry delivery batch scoped to its agent session. */ export declare const DeliveryBatch: Schema.Struct<{ readonly sessionId: Schema.String; readonly events: Schema.$Array; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly compactionId: Schema.optionalKey; readonly startedAt: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly startedAt: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptFirstOutput">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly kind: Schema.Literals; readonly at: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptCompleted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: typeof Response.Usage; readonly usageAt: Schema.Finite; readonly finishReason: Schema.Literals<["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly requestId: Schema.optionalKey; readonly responseModel: Schema.optionalKey; readonly serviceTier: Schema.optionalKey; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelAttemptFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly modelAttemptId: Schema.String; readonly attempt: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly disposition: Schema.Literals; readonly provider: Schema.optionalKey; readonly model: Schema.optionalKey; readonly registrationKey: Schema.optionalKey; readonly candidate: Schema.optionalKey; readonly providerUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelRetryScheduled">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly attempt: Schema.Int; readonly reason: Schema.Literals; readonly category: Schema.Literals; readonly delayMillis: Schema.Finite; readonly at: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelFallbackScheduled">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly attempt: Schema.Int; readonly fromCandidate: Schema.Int; readonly fromProvider: Schema.String; readonly fromModel: Schema.String; readonly fromRegistrationKey: Schema.optionalKey; readonly toCandidate: Schema.Int; readonly toProvider: Schema.String; readonly toModel: Schema.String; readonly toRegistrationKey: Schema.optionalKey; readonly category: Schema.Literals; readonly at: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallCompleted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly attempts: Schema.Int; readonly completedAt: Schema.Finite; readonly usage: Schema.optionalKey; readonly failedAttemptUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; readonly finishReason: Schema.optionalKey>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"ModelCallFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly modelCallId: Schema.String; readonly purpose: Schema.Literals; readonly attempts: Schema.Int; readonly failedAt: Schema.Finite; readonly category: Schema.Literals; readonly classification: Schema.Literals; readonly failedAttemptUsage: Schema.optionalKey; readonly outputTokens: Schema.optionalKey; readonly totalTokens: Schema.optionalKey; }>>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionStarted">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly trigger: Schema.Literals; readonly startedAt: Schema.Finite; readonly contextTokensBefore: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionSkipped">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly skippedAt: Schema.Finite; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionApplied">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly kind: Schema.Literals; readonly appliedAt: Schema.Finite; readonly commit: Schema.Struct<{ readonly compactionId: Schema.String; readonly checkpointId: Schema.String; readonly summaryModelCallId: Schema.optionalKey; readonly contextTokensBefore: Schema.optionalKey; readonly contextTokensAfter: Schema.optionalKey; readonly entriesBefore: Schema.optionalKey; readonly entriesAfter: Schema.optionalKey; }>; }>, Schema.Struct<{ readonly _tag: Schema.tag<"CompactionFailed">; readonly deliveryId: Schema.String; readonly turn: Schema.Finite; readonly compactionId: Schema.String; readonly failedAt: Schema.Finite; }>]>>; }>; /** @experimental */ export type DeliveryBatch = typeof DeliveryBatch.Type; type WithoutDeliveryId = T extends Event ? Omit : never; /** @experimental Lifecycle payload before the run assigns its stable delivery identifier. */ export type EventPayload = WithoutDeliveryId; /** @experimental Map a model failure onto the bounded cross-provider category. */ export declare const classifyFailureCategory: (error: unknown) => ModelFailureCategory;