UNPKG

@ai2070/l0

Version:

L0: The Missing Reliability Substrate for AI

87 lines 13.9 kB
export { l0, getText, consumeStream, StateMachine, RuntimeStates, Metrics, enableDriftDetection, enableMonitoring, enableInterceptors, enableAdapterRegistry, } from "./runtime/l0"; export type { RuntimeState } from "./runtime/state-machine"; export type { MetricsSnapshot } from "./runtime/metrics"; export { runStages, createPipelineContext } from "./runtime/pipeline"; export type { Stage, PipelineContext } from "./runtime/pipeline"; export { runAsyncGuardrailCheck, runGuardrailCheckAsync, } from "./guardrails/async"; export type { GuardrailCheckResult } from "./guardrails/async"; export { runAsyncDriftCheck, runDriftCheckAsync } from "./runtime/async-drift"; export type { DriftCheckResult } from "./runtime/async-drift"; export { structured, structuredObject, structuredArray, structuredStream, } from "./structured"; export type { StructuredOptions, StructuredResult, StructuredState, StructuredTelemetry, CorrectionInfo, CorrectionType, AutoCorrectOptions, AutoCorrectResult, } from "./types/structured"; export { minimalStructured, recommendedStructured, strictStructured, } from "./types/structured"; export { autoCorrectJSON, extractJSON, isValidJSON, describeJSONError, repairJSON, safeJSONParse, } from "./utils/autoCorrect"; export { createWindow, processWithWindow, l0WithWindow, mergeResults, getProcessingStats, DocumentWindowImpl, } from "./window"; export type { WindowOptions, DocumentWindow, DocumentChunk, WindowStats, WindowProcessResult, L0WindowOptions, ChunkStrategy, ContextRestorationOptions, ContextRestorationStrategy, WindowPreset, } from "./types/window"; export { smallWindow, mediumWindow, largeWindow, paragraphWindow, sentenceWindow, } from "./types/window"; export { chunkDocument, chunkByTokens, chunkByChars, chunkByParagraphs, chunkBySentences, splitIntoSentences, estimateTokenCount, getChunkOverlap, mergeChunks, } from "./utils/chunking"; export type { L0Options, L0Result, L0State, L0Event, L0Telemetry, L0Adapter, CategorizedNetworkError, L0Interceptor, RetryOptions, CheckpointValidationResult, GuardrailRule, GuardrailViolation, GuardrailContext, GuardrailResult, L0ContentType, L0DataPayload, L0Progress, } from "./types"; export { EventDispatcher, createEventDispatcher, } from "./runtime/event-dispatcher"; export { EventType, EventCategory, EventTypesByCategory, SessionEvents, StreamEvents, AdapterEvents, TimeoutEvents, NetworkEvents, AbortEvents, GuardrailEvents, DriftEvents, CheckpointEvents, ResumeEvents, RetryEvents, FallbackEvents, StructuredEvents, ContinuationEvents, ToolEvents, CompletionEvents, serializeEvent, deserializeEvent, } from "./types/observability"; export type { FailureType, RecoveryStrategy, RecoveryPolicy, L0ObservabilityEvent, L0EventHandler, L0Event as L0ObservabilityEventUnion, SessionStartEvent, SessionEndEvent, SessionSummaryEvent, StreamInitEvent, StreamReadyEvent, AdapterDetectedEvent, AdapterWrapStartEvent, AdapterWrapEndEvent, TimeoutStartEvent, TimeoutResetEvent, TimeoutTriggeredEvent, NetworkErrorEvent, NetworkRecoveryEvent, ConnectionDroppedEvent, ConnectionRestoredEvent, AbortRequestedEvent, AbortCompletedEvent, GuardrailPhaseStartEvent, GuardrailRuleStartEvent, GuardrailRuleResultEvent, GuardrailRuleEndEvent, GuardrailPhaseEndEvent, GuardrailCallbackStartEvent, GuardrailCallbackEndEvent, DriftCheckStartEvent, DriftCheckResultEvent, DriftCheckEndEvent, DriftCheckSkippedEvent, CheckpointSavedEvent, ResumeStartEvent, RetryStartEvent, RetryAttemptEvent, RetryEndEvent, RetryGiveUpEvent, FallbackStartEvent, FallbackModelSelectedEvent, FallbackEndEvent, StructuredParseStartEvent, StructuredParseEndEvent, StructuredParseErrorEvent, StructuredValidationStartEvent, StructuredValidationEndEvent, StructuredValidationErrorEvent, StructuredAutoCorrectStartEvent, StructuredAutoCorrectEndEvent, ContinuationStartEvent, ToolRequestedEvent, ToolStartEvent, ToolResultEvent, ToolErrorEvent, ToolCompletedEvent, ToolErrorType, CompleteEvent, ErrorEvent, } from "./types/observability"; export { GuardrailEngine, createGuardrailEngine, checkGuardrails, jsonRule, strictJsonRule, markdownRule, latexRule, patternRule, customPatternRule, zeroOutputRule, minimalGuardrails, recommendedGuardrails, strictGuardrails, jsonOnlyGuardrails, markdownOnlyGuardrails, latexOnlyGuardrails, } from "./guardrails"; export { minimalRetry, recommendedRetry, strictRetry, exponentialRetry, } from "./types/l0"; export { RetryManager, createRetryManager, isRetryableError, getErrorCategory, } from "./runtime/retry"; export { DriftDetector, createDriftDetector, checkDrift, } from "./runtime/drift"; export { detectZeroToken, detectZeroTokenBeforeFirstMeaningful, detectInstantFinish, analyzeZeroToken, } from "./runtime/zeroToken"; export { normalizeStreamEvent, normalizeStreamEvents, createTokenEvent, createMessageEvent, createCompleteEvent, createErrorEvent, filterEventsByType, extractTokens, reconstructText, } from "./runtime/events"; export { L0Monitor, createMonitor, TelemetryExporter, } from "./runtime/monitoring"; export type { MonitoringConfig } from "./runtime/monitoring"; export { combineEvents, filterEvents, excludeEvents, debounceEvents, batchEvents, } from "./runtime/event-handlers"; export type { EventHandler } from "./runtime/event-handlers"; export { L0Sentry, createSentryIntegration, createSentryHandler, withSentry, } from "./runtime/sentry"; export type { SentryClient, SentryConfig } from "./runtime/sentry"; export { L0OpenTelemetry, createOpenTelemetry, createOpenTelemetryHandler, SemanticAttributes, SpanStatusCode, SpanKind, } from "./runtime/opentelemetry"; export type { OpenTelemetryConfig } from "./runtime/opentelemetry"; export { InterceptorManager, createInterceptorManager, loggingInterceptor, metadataInterceptor, authInterceptor, timingInterceptor, validationInterceptor, rateLimitInterceptor, cachingInterceptor, transformInterceptor, analyticsInterceptor, } from "./runtime/interceptors"; export type { InterceptorContext } from "./runtime/interceptors"; export { parallel, parallelAll, sequential, batched, race, OperationPool, createPool, } from "./runtime/parallel"; export type { ParallelOptions, ParallelResult, RaceResult, AggregatedTelemetry, } from "./runtime/parallel"; export { consensus, quickConsensus, getConsensusValue, validateConsensus, } from "./consensus"; export type { ConsensusOptions, ConsensusResult, ConsensusOutput, ConsensusAnalysis, ConsensusStrategy, ConflictResolution, Agreement, Disagreement, FieldConsensus, FieldAgreement, } from "./types/consensus"; export { strictConsensus, standardConsensus, lenientConsensus, bestConsensus, } from "./types/consensus"; export { pipe, createPipeline, createStep, chainPipelines, parallelPipelines, createBranchStep, } from "./pipeline"; export type { PipelineStep, PipelineOptions, PipelineResult, StepContext, StepResult, Pipeline, } from "./types/pipeline"; export { fastPipeline, reliablePipeline, productionPipeline, } from "./types/pipeline"; export { formatContext, formatMultipleContexts, formatDocument, formatInstructions, escapeDelimiters, unescapeDelimiters, } from "./format/context"; export { formatMemory, createMemoryEntry, mergeMemory, filterMemoryByRole, getLastNEntries, calculateMemorySize, truncateMemory, } from "./format/memory"; export { formatJsonOutput, formatStructuredOutput, formatOutputConstraints, createOutputFormatSection, extractJsonFromOutput, cleanOutput, } from "./format/output"; export { formatTool, formatTools, createTool, createParameter, validateTool, formatFunctionArguments, parseFunctionCall, } from "./format/tools"; export { trim, escape, unescape, escapeHtml, unescapeHtml, escapeRegex, sanitize, truncate, truncateWords, wrap, pad, removeAnsi, } from "./format/utils"; export type { FormatContextOptions, FormatMemoryOptions, MemoryEntry, FormatJsonOutputOptions, ToolDefinition, ToolParameter, FormatToolOptions, } from "./format"; export { normalizeNewlines, normalizeWhitespace, normalizeIndentation, normalizeForModel, dedent, indent, trimText, normalizeText, } from "./utils/normalize"; export { repairJson, balanceBraces, balanceBrackets, removeTrailingCommas, repairMarkdownFences, repairLatexEnvironments, repairToolCallArguments, isValidJson, parseOrRepairJson, extractJson, ensureJson, } from "./utils/repair"; export { isMeaningfulToken, hasMeaningfulContent, countMeaningfulTokens, extractMeaningfulTokens, detectRepeatedTokens, endsAbruptly, detectOverlap, deduplicateContinuation, } from "./utils/tokens"; export type { OverlapDetectionResult } from "./utils/tokens"; export { exponentialBackoff, linearBackoff, fixedBackoff, fixedJitterBackoff, fullJitterBackoff, calculateBackoff, sleep, timeout, withTimeout, Timer, } from "./utils/timers"; export type { RetryReason, BackoffStrategy, CategorizedError, ErrorTypeDelays, } from "./types/retry"; export { ErrorCategory, RETRY_DEFAULTS, ERROR_TYPE_DELAY_DEFAULTS, } from "./types/retry"; export type { DriftResult, DriftType, DriftConfig } from "./runtime/drift"; export { NetworkErrorType, isNetworkError, analyzeNetworkError, isConnectionDropped, isFetchTypeError, isECONNRESET, isECONNREFUSED, isSSEAborted, isNoBytes, isPartialChunks, isRuntimeKilled, isBackgroundThrottle, isDNSError, isSSLError, isTimeoutError, isStreamInterrupted, describeNetworkError, suggestRetryDelay, L0Error, isL0Error, L0ErrorCodes, } from "./utils/errors"; export type { NetworkErrorAnalysis, L0ErrorCode, L0ErrorContext, } from "./utils/errors"; export { registerAdapter, unregisterAdapter, unregisterAllExcept, getAdapter, getRegisteredStreamAdapters, clearAdapters, detectAdapter, hasMatchingAdapter, } from "./adapters/registry"; export { toL0Events, toL0EventsWithMessages, toMultimodalL0Events, createAdapterTokenEvent, createAdapterDoneEvent, createAdapterErrorEvent, createAdapterMessageEvent, createAdapterDataEvent, createAdapterProgressEvent, createImageEvent, createAudioEvent, createJsonDataEvent, } from "./adapters/helpers"; export { openaiAdapter, openaiStream, openaiText, openaiJSON, openaiWithTools, wrapOpenAIStream, isOpenAIChunk, isOpenAIStream, extractOpenAIText, } from "./adapters/openai"; export type { OpenAIAdapterOptions, OpenAIStream } from "./adapters/openai"; export { anthropicAdapter, anthropicStream, anthropicText, wrapAnthropicStream, isAnthropicStream, isAnthropicStreamEvent, } from "./adapters/anthropic"; export type { AnthropicStream, AnthropicAdapterOptions, RawMessageStreamEvent, RawMessageStartEvent, RawMessageDeltaEvent, RawContentBlockStartEvent, RawContentBlockDeltaEvent, RawContentBlockStopEvent, MessageCreateParamsBase, } from "./adapters/anthropic"; export { mastraAdapter, mastraStream, mastraText, mastraStructured, wrapMastraStream, wrapMastraFullStream, isMastraStream, extractMastraText, extractMastraObject, } from "./adapters/mastra"; export type { MastraAdapterOptions, MastraMessageInput, } from "./adapters/mastra"; export { InMemoryEventStore, L0EventRecorder, L0EventReplayer, createInMemoryEventStore, createEventRecorder, createEventReplayer, } from "./runtime/eventStore"; export type { ReplayedState } from "./runtime/eventStore"; export { replay, compareReplays, getStreamMetadata } from "./runtime/replay"; export type { L0ReplayResult, ReplayCallbacks, ReplayComparison, StreamMetadata, } from "./runtime/replay"; export type { L0RecordedEvent, L0StartEvent, L0TokenEvent, L0CheckpointEvent, L0GuardrailEvent, L0DriftEvent, L0RetryEvent, L0FallbackEvent, L0ContinuationEvent, L0CompleteEvent, L0ErrorEvent, L0EventEnvelope, L0EventStore, L0EventStoreWithSnapshots, L0Snapshot, L0ExecutionMode, L0ReplayOptions, L0RecordOptions, SerializedOptions, SerializedError, GuardrailEventResult, DriftEventResult, L0RecordedEventType, } from "./types/events"; export { serializeError, deserializeError, generateStreamId, L0RecordedEventTypes, } from "./types/events"; export { registerStorageAdapter, unregisterStorageAdapter, getRegisteredAdapters, createEventStore, BaseEventStore, BaseEventStoreWithSnapshots, FileEventStore, LocalStorageEventStore, CompositeEventStore, TTLEventStore, createCompositeStore, withTTL, } from "./runtime/storageAdapters"; export type { StorageAdapterConfig, StorageAdapterFactory, } from "./runtime/storageAdapters"; export { isZodSchema, isZodError, safeParse, getZodErrorMessages, flattenZodError, } from "./utils/zodCompat"; export type { AnyZodSchema, ZodObjectSchema, ZodArraySchema, ZodValidationError, InferSchema, } from "./utils/zodCompat"; export { isEffectSchema, isEffectParseError, isEffectRight, isEffectLeft, registerEffectSchemaAdapter, unregisterEffectSchemaAdapter, hasEffectSchemaAdapter, getEffectSchemaAdapter, safeDecodeEffectSchema, getEffectErrorMessage, wrapEffectSchema, } from "./utils/effectSchemaCompat"; export type { EffectSchema, EffectParseError, EffectParseResult, EffectSchemaAdapter, EffectDecodeOptions, InferEffectSchema, InferEffectSchemaEncoded, UnifiedSchema, } from "./utils/effectSchemaCompat"; export { isJSONSchema, registerJSONSchemaAdapter, unregisterJSONSchemaAdapter, hasJSONSchemaAdapter, getJSONSchemaAdapter, validateJSONSchema, wrapJSONSchema, createSimpleJSONSchemaAdapter, } from "./utils/jsonSchemaCompat"; export type { JSONSchemaDefinition, JSONSchemaValidationError, JSONSchemaValidationResult, JSONSchemaAdapter, } from "./utils/jsonSchemaCompat"; export { compareStrings, levenshteinSimilarity, levenshteinDistance, jaroWinklerSimilarity, cosineSimilarity, compareNumbers, compareArrays, compareObjects, compareValues, getType, deepEqual, calculateSimilarityScore, countFields, } from "./utils/comparison"; export { calculateSimilarityMatrix, calculateOutputSimilarity, calculateStructuralSimilarity, findAgreements, findDisagreements, calculateFieldConsensus, resolveMajority, resolveBest, resolveMerge, meetsMinimumAgreement, } from "./utils/consensusUtils"; export { shallowClone, shallowCopy } from "./utils/shallow"; //# sourceMappingURL=index.d.ts.map