@axlsdk/axl 0.27.0 → 0.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -3867,6 +3867,12 @@ type ExecutionState = {
3867
3867
  status: 'waiting' | 'running';
3868
3868
  metadata?: Record<string, unknown>;
3869
3869
  };
3870
+ /**
3871
+ * Computes a session's new history from what's stored, for
3872
+ * {@link StateStore.updateSession}. Receives `null` when no session is stored.
3873
+ * Returns `null` to write nothing. May run more than once.
3874
+ */
3875
+ type SessionUpdate = (current: ChatMessage[] | null) => ChatMessage[] | null;
3870
3876
  /**
3871
3877
  * Pluggable state persistence interface.
3872
3878
  *
@@ -3877,6 +3883,18 @@ interface StateStore {
3877
3883
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
3878
3884
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
3879
3885
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
3886
+ /**
3887
+ * Replace a session's history based on what's stored at that moment, without
3888
+ * overwriting a write made by another process in between. Sessions use it to
3889
+ * save each turn. The built-in stores implement it; without it, a store gets
3890
+ * `saveSession`, where the last writer wins.
3891
+ *
3892
+ * **Custom store implementors:** the read and the write must be atomic. Use a
3893
+ * transaction or a compare-and-set, and call `update` again if another writer
3894
+ * got in first, so `update` may run more than once. It receives `null` when no
3895
+ * session is stored. When it returns `null`, write nothing.
3896
+ */
3897
+ updateSession?(sessionId: string, update: SessionUpdate): Promise<void>;
3880
3898
  getSession(sessionId: string): Promise<ChatMessage[]>;
3881
3899
  deleteSession(sessionId: string): Promise<void>;
3882
3900
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -4890,10 +4908,7 @@ type WorkflowContextInit = {
4890
4908
  * fn callbacks). Composed name: `__auto/<primitive>/<n>`.
4891
4909
  *
4892
4910
  * Root contexts default to a fresh `{ byAgent: new Map(), root: 0 }`. */
4893
- autoCheckpointCounters?: {
4894
- byAgent: Map<string, number>;
4895
- root: number;
4896
- };
4911
+ autoCheckpointCounters?: AutoCheckpointState;
4897
4912
  /** Internal: root-shared state for branch continuations that must settle
4898
4913
  * before the runtime emits the workflow terminal and snapshots cost. */
4899
4914
  branchDrainState?: BranchDrainState;
@@ -4923,6 +4938,13 @@ type PendingDecisionResolver = {
4923
4938
  * deleteExecution joins this barrier before its total store sweep. */
4924
4939
  cleanupFinished: Promise<void>;
4925
4940
  };
4941
+ /** Automatic checkpoint bookkeeping, shared by an execution's child contexts. */
4942
+ type AutoCheckpointState = {
4943
+ byAgent: Map<string, number>;
4944
+ root: number;
4945
+ /** An automatic checkpoint failed to save, so none are saved from here on. */
4946
+ saveFailed?: boolean;
4947
+ };
4926
4948
  /**
4927
4949
  * The central coordination object for all Axl primitives.
4928
4950
  * Carries execution state, tracing, budget tracking, and session history.
@@ -5626,22 +5648,6 @@ type SessionOptions = {
5626
5648
  /** Whether to persist session history to the state store. Default: true. */
5627
5649
  persist?: boolean;
5628
5650
  };
5629
- /**
5630
- * A stateful conversation session.
5631
- * Persists message history across multiple interactions.
5632
- *
5633
- * **Concurrency contract:** `send`, `stream`, `end`, and `fork` are
5634
- * serialized per session id within one runtime instance. Two
5635
- * `runtime.session('x')` handles share the same lock (it lives on
5636
- * `AxlRuntime`, not the `Session` instance). `history()` and
5637
- * `handoffs()` bypass the lock and return the last persisted snapshot.
5638
- *
5639
- * **⚠️ Cross-process locking is NOT provided.** Multiple Node workers
5640
- * behind a load balancer hitting the same Redis-backed `sessionId`
5641
- * will still race. Pin sessions to workers (sticky routing) or use
5642
- * distinct ids per request. See `docs/api-reference.md` →
5643
- * Sessions → Concurrency.
5644
- */
5645
5651
  declare class Session {
5646
5652
  private sessionId;
5647
5653
  private runtime;
@@ -5668,6 +5674,8 @@ declare class Session {
5668
5674
  * push has no agent context and so leaves `agent` undefined — see the
5669
5675
  * `ChatMessage.agent` field doc. */
5670
5676
  private commitHistory;
5677
+ /** The turn is already saved, so a listener that throws can't be allowed to fail it. */
5678
+ private notify;
5671
5679
  stream(workflowName: string, input: unknown, options?: {
5672
5680
  signal?: AbortSignal;
5673
5681
  events?: EventStreamOptions;
@@ -9774,6 +9782,7 @@ declare class MemoryStore implements StateStore {
9774
9782
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
9775
9783
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
9776
9784
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
9785
+ updateSession(sessionId: string, update: SessionUpdate): Promise<void>;
9777
9786
  getSession(sessionId: string): Promise<ChatMessage[]>;
9778
9787
  deleteSession(sessionId: string): Promise<void>;
9779
9788
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -9942,6 +9951,7 @@ declare class SQLiteStore implements StateStore {
9942
9951
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
9943
9952
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
9944
9953
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
9954
+ updateSession(sessionId: string, update: SessionUpdate): Promise<void>;
9945
9955
  getSession(sessionId: string): Promise<ChatMessage[]>;
9946
9956
  deleteSession(sessionId: string): Promise<void>;
9947
9957
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -10012,6 +10022,20 @@ declare class SQLiteStore implements StateStore {
10012
10022
  deleteCheckpoints(executionId: string): Promise<void>;
10013
10023
  }
10014
10024
 
10025
+ /**
10026
+ * A change in a {@link RedisStore}'s connection, passed to
10027
+ * {@link RedisStoreOptions.onConnectionEvent}.
10028
+ *
10029
+ * - `error`: the connection was lost or a reconnect attempt failed. Arrives
10030
+ * once per attempt while Redis is down.
10031
+ * - `reconnected`: the store is connected again and commands work.
10032
+ */
10033
+ type RedisConnectionEvent = {
10034
+ type: 'error';
10035
+ error: Error;
10036
+ } | {
10037
+ type: 'reconnected';
10038
+ };
10015
10039
  /** Options accepted by {@link RedisStore.create}. */
10016
10040
  interface RedisStoreOptions {
10017
10041
  /** Redis connection URL (e.g. `redis://localhost:6379`). Defaults to `redis://localhost:6379`. */
@@ -10036,6 +10060,44 @@ interface RedisStoreOptions {
10036
10060
  * operator experience.
10037
10061
  */
10038
10062
  keyPrefix?: string;
10063
+ /**
10064
+ * Called when the connection is lost, a reconnect attempt fails, or the
10065
+ * connection comes back, for routing to a logger, metrics, or a health check.
10066
+ * Replaces the default logging of one line per outage and one on recovery.
10067
+ *
10068
+ * Not called for a failed `create()`, whose rejection reports the failure,
10069
+ * or after `close()`. A callback that throws or rejects is reported with
10070
+ * `console.error` and otherwise ignored.
10071
+ */
10072
+ onConnectionEvent?: (event: RedisConnectionEvent) => void;
10073
+ /**
10074
+ * Reconnect when Redis stops answering, in milliseconds. Off by default.
10075
+ *
10076
+ * The store sends a `PING` about every third of this time. If one goes
10077
+ * unanswered for this long, it drops the connection and reconnects: calls in
10078
+ * flight reject, and calls made until it reconnects reject with
10079
+ * `REDIS_UNAVAILABLE`. `create()` also rejects if Redis hasn't finished
10080
+ * connecting within this time.
10081
+ *
10082
+ * It's a limit on the whole connection, not on one command, because replies
10083
+ * come back in order. Set it above your slowest expected command, or a large
10084
+ * save or busy server looks like a stall. A call that rejects this way may
10085
+ * still have been applied by Redis.
10086
+ */
10087
+ responseTimeoutMs?: number;
10088
+ /**
10089
+ * Set to `false` so that `create()` returns right away and the store connects
10090
+ * in the background, retrying until Redis is available. Calls reject with
10091
+ * `REDIS_UNAVAILABLE` until then. Defaults to `true`, where `create()` rejects
10092
+ * if Redis is unavailable, which surfaces bad configuration at startup.
10093
+ *
10094
+ * Requires {@link responseTimeoutMs}, so that a server that accepts the
10095
+ * connection but never answers can't leave it connecting forever. Nothing
10096
+ * rejects if the configuration is wrong: failed attempts go to
10097
+ * {@link onConnectionEvent}, and `isConnected` stays `false`. The startup
10098
+ * backfill runs after the first connection instead of during `create()`.
10099
+ */
10100
+ waitForConnection?: boolean;
10039
10101
  /**
10040
10102
  * Skip the lazy backfill of legacy execution / eval-history entries into
10041
10103
  * the sorted-set indexes during `RedisStore.create()`. Default `false`
@@ -10139,10 +10201,34 @@ interface RedisStoreOptions {
10139
10201
  * async `RedisStore.create()` factory, which connects before returning.
10140
10202
  */
10141
10203
  declare class RedisStore implements StateStore {
10142
- private client;
10204
+ private connection;
10143
10205
  private keyPrefix;
10144
10206
  private ttls;
10207
+ /** Set when `close()` starts, while the connection is still open. */
10208
+ private closing;
10209
+ /** Where the next save's check of listed sessions picks up. */
10210
+ private sessionSweepCursor;
10211
+ /** Overlapping saves would all check the same page, so only one checks at a time. */
10212
+ private sessionSweepRunning;
10145
10213
  private constructor();
10214
+ /**
10215
+ * Whether the store can send commands right now, for a health check or for
10216
+ * telling an outage from other failures when a call rejects. `false` while
10217
+ * reconnecting and after `close()`.
10218
+ */
10219
+ get isConnected(): boolean;
10220
+ /**
10221
+ * The client for sending a command, failing immediately while disconnected.
10222
+ *
10223
+ * Every command goes through here because node-redis's `disableOfflineQueue`
10224
+ * rejects single commands but not `multi().exec()`, which would wait for a
10225
+ * reconnect attempt to fail or succeed. Nothing may `await` between
10226
+ * `client.multi()` and `.exec()`, or a transaction could get past this check.
10227
+ *
10228
+ * A closed store isn't "unavailable": it falls through to node-redis's own
10229
+ * "The client is closed" rejection.
10230
+ */
10231
+ private get client();
10146
10232
  /**
10147
10233
  * History kinds with a prune running in this process. A save skips its
10148
10234
  * prune while another one of the same kind is in flight: the running one
@@ -10150,6 +10236,8 @@ declare class RedisStore implements StateStore {
10150
10236
  * instance needs no constructor state.
10151
10237
  */
10152
10238
  private prunesInFlight?;
10239
+ /** Stops the `responseTimeoutMs` health checks; unset when the option is off. */
10240
+ private stopResponseWatch?;
10153
10241
  /**
10154
10242
  * Supports `listExecutions(limit, { cursor })`. A getter rather than a
10155
10243
  * field so it lives on the prototype.
@@ -10185,6 +10273,12 @@ declare class RedisStore implements StateStore {
10185
10273
  * ```
10186
10274
  */
10187
10275
  static create(options?: string | RedisStoreOptions): Promise<RedisStore>;
10276
+ /**
10277
+ * Run the startup backfill when a connection becomes ready, until it succeeds.
10278
+ * Nothing is waiting on it, and listings work without it, so a failure is
10279
+ * reported and the next connection tries again.
10280
+ */
10281
+ private backfillOnceConnected;
10188
10282
  /**
10189
10283
  * Backfill the execution-history sorted-set from the legacy ID set.
10190
10284
  * Idempotent — runs only if the ZSET is missing entries the SET has.
@@ -10198,6 +10292,10 @@ declare class RedisStore implements StateStore {
10198
10292
  * Shared implementation for both backfill paths. Reads SET members,
10199
10293
  * batch-MGETs their data blobs in chunks, and ZADDs each into the new
10200
10294
  * sorted-set inside a single MULTI per chunk.
10295
+ *
10296
+ * Ids with no data blob are removed from the id set. Left there, the set stays
10297
+ * larger than the sorted set, so every startup repeats this walk and listing
10298
+ * stays on its slow path.
10201
10299
  */
10202
10300
  private backfillHistoryIndex;
10203
10301
  private checkpointKey;
@@ -10228,6 +10326,7 @@ declare class RedisStore implements StateStore {
10228
10326
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
10229
10327
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
10230
10328
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
10329
+ updateSession(sessionId: string, update: SessionUpdate): Promise<void>;
10231
10330
  getSession(sessionId: string): Promise<ChatMessage[]>;
10232
10331
  deleteSession(sessionId: string): Promise<void>;
10233
10332
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -10340,6 +10439,7 @@ declare class RedisStore implements StateStore {
10340
10439
  * covers a Redis user whose ACL denies `EVAL`.
10341
10440
  */
10342
10441
  private pruneHistoryAfterSave;
10442
+ private warnPruneFailed;
10343
10443
  private pruneHistory;
10344
10444
  /**
10345
10445
  * Run {@link PRUNE_HISTORY_INDEX_SCRIPT} over `ids`, at most PRUNE_BATCH
@@ -10383,6 +10483,16 @@ declare class RedisStore implements StateStore {
10383
10483
  */
10384
10484
  private readRetentionBatch;
10385
10485
  listSessions(): Promise<string[]>;
10486
+ /**
10487
+ * Check a few listed sessions after a save, so ids of expired sessions go
10488
+ * away for apps that never list. Sessions without a TTL don't expire, so
10489
+ * there's nothing to do. The save has already succeeded, so failing here
10490
+ * can't fail it.
10491
+ */
10492
+ private sweepSessionIds;
10493
+ /** Returns the ids removed. Without permission to run the script, removes none and warns. */
10494
+ private pruneSessionIds;
10495
+ private warnSessionPruneFailed;
10386
10496
  appendStreamingEvents(executionId: string, events: AxlEvent[]): Promise<void>;
10387
10497
  finalizeStreamingEvents(executionId: string): Promise<void>;
10388
10498
  listStreamingExecutions(): Promise<string[]>;
@@ -10395,6 +10505,14 @@ declare class RedisStore implements StateStore {
10395
10505
  * must not get a rejected promise for it. `MemoryStore.close()` and
10396
10506
  * better-sqlite3's `close()` are both no-ops the second time; node-redis
10397
10507
  * instead rejects with "The client is closed", so absorb that here.
10508
+ *
10509
+ * Bounded, so a shutdown can't hang on Redis. Replies arrive in order, so a
10510
+ * reply to this PING means every earlier command has finished.
10511
+ *
10512
+ * Not `quit()`: it marks the client closed before the server answers, and
10513
+ * `destroy()` then throws without touching the socket, so a stalled server's
10514
+ * socket could never be closed. There's no other public way to close it. A
10515
+ * closed socket is all Redis needs to clean up, so nothing is lost.
10398
10516
  */
10399
10517
  close(): Promise<void>;
10400
10518
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -10467,4 +10585,4 @@ declare class NoopSpanManager implements SpanManager {
10467
10585
  */
10468
10586
  declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
10469
10587
 
10470
- export { AXL_EVENT_TYPES, AXL_EVENT_TYPES_V2, AXL_TOOL_LIFECYCLE_TYPES_V2, AZURE_PROFILE, type Accounting, type AccountingCompleteness, type AccountingReason, type AccountingUsage, AdmissionController, AdmissionDeniedError, type Agent, type AgentCallEndData, type AgentCallInfo, type AgentCallParams, type AgentCallStartData, type AgentConfig, AnthropicProvider, type AnyWorkflow, type ApiKeySource, type ArtifactManifest, type ArtifactOwner, type ArtifactStatus, type ArtifactWriteResult, type AskOptions, type AskScoped, type AuthHeader, type AwaitHumanData, type AwaitHumanOptions, type AwaitHumanResolvedData, type AxlConfig, AxlError, type AxlEvent, type AxlEventBase, AxlEventBus, type AxlEventOf, type AxlEventType, type AxlEventV2, type AxlEventV2Of, AxlRuntime, AxlStream, BEDROCK_PROFILE, BUILTIN_PROFILES, BudgetExceededError, type BudgetOptions, type BudgetResult, CONFIG_CANDIDATES, COST_BEARING_LEAF_TYPES, type CallTiming, type CapabilityFlags, type CaptureCorrelation, type CapturedCorrection, type CapturedError, type CapturedExternalRequestRecord, type CapturedJsonValue, type CapturedMessage, type CapturedModelRequestRecord, type CapturedOperationRef, type CapturedPhase, type CapturedRequest, type CapturedRequestRecord, type CapturedResponse, type ChatMessage, type ChatOptions, type CheckpointEventData, type CoalescedPartialObject, type CostProvenance, type CreateContextOptions, DEEPSEEK_PROFILE, DEFAULT_MAX_QUEUE_BYTES, DEFAULT_MAX_RECORD_BYTES, DEFAULT_MAX_RUN_BYTES, type DecisionCleanupFailedEvent, type DelegateData, type DelegateOptions, type DiagnosticArtifactStore, type DiagnosticArtifactsConfig, type DiagnosticsConfig, type DispatchAdmission, type Effort, type EffortResolution, type EmbedResult, type EmbedUsage, type Embedder, type EvalExecuteWorkflow, type EvalHistoryEntry, type EvalProgressEventShape, type EventStreamOptions, EventStreamOverflowError, type ExecuteOptions, type ExecutionCursor, type ExecutionInfo, type ExecutionInfoV1, type ExecutionInfoV2, type ExecutionState, type ExternalOperationDescriptor, type ExternalOperationRecord, type ExternalOperationReport, FileDiagnosticArtifactStore, type FinishReason, type FoldedOperationRecord, GROQ_PROFILE, GeminiProvider, GeminiTranscriptionProvider, type GuardrailBlockHandler, type GuardrailData, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HandoffReturnData, type HandoffStartData, type HistoricalAxlEvent, type HistoricalExecutionInfo, type HistoryRetentionCursor, type HistoryRetentionKind, type HistoryRetentionOptions, type HistoryRetentionResult, type HistoryTtls, type HumanDecision, InMemoryVectorStore, type InputAudioPart, type InputContentPart, type InputGuardrail, type InputImagePart, type InputMediaSource, type InputModalitySupport, type InputTextPart, InvalidModelInputError, InvalidTranscriptionInputError, LLAMACPP_PROFILE, LMSTUDIO_PROFILE, type LegacyAxlEventV1, type LegacyExecutionInfoV1, MAX_INLINE_MODEL_INPUT_BYTES, MAX_INLINE_TRANSCRIPTION_BYTES, MISTRAL_PROFILE, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, type MemoryEventData, MemoryManager, MemoryStore, type MemoryStoreOptions, type ModelCallRecord, type ModelInput, type ModelInputDescriptor, type ModelTimingRollup, NoConsensus, NoopSpanManager, OLLAMA_PROFILE, OPENAI_PRICING, OPENAI_PROFILE, OPENROUTER_PROFILE, type ObservationStatus, type OpenAICompatibleOptions, OpenAICompatibleProvider, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, OpenAITranscriptionProvider, OpenRouterTranscriptionProvider, type OpenedArtifact, type OperationKind, type OperationPurpose, type OutputGuardrail, type OutputValidator, type PendingDecision, type PerModel, type PricingSource, type PricingTable, type ProfileInputModalities, type Provider, type ProviderAdapter, type ProviderDiagnosticData, ProviderError, type ProviderInputValidationRequest, type ProviderInputValidationResult, type ProviderProfile, ProviderRegistry, type ProviderResponse, QuorumNotMet, REDACTED, REDACTION_RULES, type RaceOptions, type RateLimitConfig, RateLimiter, type ReasoningCapture, type ReasoningContextReset, type ReasoningEmit, type ReasoningProfile, type ReasoningRoundTrip, type RecallOptions, type RecallResult, type RecordedAudioSource, RedisStore, type RememberOptions, type RememberResult, RequestCaptureChannel, type RequestCaptureOptions, type RequestCaptureSink, type RequestCaptureStatus, type ResolvedThinkingOptions, type Result, type RetryFeedbackHook, type RetryFeedbackInfo, type RetryFeedbackResult, type RetryPolicy, type RuntimeEvalConfigShape, SGLANG_PROFILE, SQLiteStore, type SQLiteStoreOptions, type SchemaCheckData, type SchemaDiagnosticData, type SchemaPromptOption, Session, type SessionOptions, type SpanAttributeValue, type SpanAttributes, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StagedArtifact, StallTimeoutError, type StateStore, type StreamChunk, type StringDeltaData, type StringStreamEvent, type StringStreamFilter, type TelemetryConfig, ThinkTagScanner, type TimeoutBreakdown, TimeoutError, type Tool, type ToolApprovalData, type ToolArgumentIssue, type ToolCallCancellation, type ToolCallData, type ToolCallEndData, type ToolCallFailure, type ToolCallMessage, type ToolCallOutcome, type ToolCallRejectedData, type ToolCallRejectedEvent, type ToolCallStartData, type ToolCallStartDataV2, type ToolChoice, type ToolConfig, type ToolDeniedData, type ToolEventError, ToolFailure, type ToolFailureConstructor, type ToolFailureOptions, type ToolHooks, type ToolLifecycleEventV2, type ToolModelOutput, ToolModelOutputError, type TrackExecutionMetadata, type TrackExecutionResult, type TrackOutcomeOptions, type TrackedOutcome, type Transcript, type TranscriptionCapabilities, TranscriptionOperationError, type TranscriptionProvider, TranscriptionProviderRegistry, type TranscriptionProviderRequest, type TranscriptionProviderResult, type TranscriptionRequest, UnsupportedEventSchemaVersionError, UnsupportedModelInputError, UnsupportedModelOptionError, UnsupportedTranscriptionInputError, VLLM_PROFILE, type ValidateData, type ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, type VerifyData, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, type WorkflowEndData, type WorkflowStartData, XAI_PROFILE, agent, capturedJournalLineSchema, createSpanManager, defineConfig, estimateOpenAICost, eventCostContribution, expandGlob, externalOperation, externalOperationRecordSchema, extractJson, extractThinkTags, findConfig, foldJournal, foldedOperationRecordSchema, getEventSchemaVersion, getExecutionEventSchemaVersion, hasPositiveBillableWork, hasPositiveTokens, importModule, inputText, isAdmissionDeniedError, isCostBearingLeaf, isRetryableStatus, isRootLevel, isUnpricedLeaf, isUsableCost, modelCallRecordSchema, needsTsxLoader, normalizeStoredExecution, openaiReasoningEmit, parsePartialJson, pickDefault, pickExport, priceFromTable, reasoningEffortEmit, reasoningObjectEmit, redactCapturedRequest, redactEvent, redactHistoricalEvent, redactModelCallRecord, registerConditions, resolveApiKey, resolvePerModel, resolveRuntime, resolveThinkingOptions, stringStreamFromEvents, summarizeModelInput, tool, workflow, zodToJsonSchema };
10588
+ export { AXL_EVENT_TYPES, AXL_EVENT_TYPES_V2, AXL_TOOL_LIFECYCLE_TYPES_V2, AZURE_PROFILE, type Accounting, type AccountingCompleteness, type AccountingReason, type AccountingUsage, AdmissionController, AdmissionDeniedError, type Agent, type AgentCallEndData, type AgentCallInfo, type AgentCallParams, type AgentCallStartData, type AgentConfig, AnthropicProvider, type AnyWorkflow, type ApiKeySource, type ArtifactManifest, type ArtifactOwner, type ArtifactStatus, type ArtifactWriteResult, type AskOptions, type AskScoped, type AuthHeader, type AwaitHumanData, type AwaitHumanOptions, type AwaitHumanResolvedData, type AxlConfig, AxlError, type AxlEvent, type AxlEventBase, AxlEventBus, type AxlEventOf, type AxlEventType, type AxlEventV2, type AxlEventV2Of, AxlRuntime, AxlStream, BEDROCK_PROFILE, BUILTIN_PROFILES, BudgetExceededError, type BudgetOptions, type BudgetResult, CONFIG_CANDIDATES, COST_BEARING_LEAF_TYPES, type CallTiming, type CapabilityFlags, type CaptureCorrelation, type CapturedCorrection, type CapturedError, type CapturedExternalRequestRecord, type CapturedJsonValue, type CapturedMessage, type CapturedModelRequestRecord, type CapturedOperationRef, type CapturedPhase, type CapturedRequest, type CapturedRequestRecord, type CapturedResponse, type ChatMessage, type ChatOptions, type CheckpointEventData, type CoalescedPartialObject, type CostProvenance, type CreateContextOptions, DEEPSEEK_PROFILE, DEFAULT_MAX_QUEUE_BYTES, DEFAULT_MAX_RECORD_BYTES, DEFAULT_MAX_RUN_BYTES, type DecisionCleanupFailedEvent, type DelegateData, type DelegateOptions, type DiagnosticArtifactStore, type DiagnosticArtifactsConfig, type DiagnosticsConfig, type DispatchAdmission, type Effort, type EffortResolution, type EmbedResult, type EmbedUsage, type Embedder, type EvalExecuteWorkflow, type EvalHistoryEntry, type EvalProgressEventShape, type EventStreamOptions, EventStreamOverflowError, type ExecuteOptions, type ExecutionCursor, type ExecutionInfo, type ExecutionInfoV1, type ExecutionInfoV2, type ExecutionState, type ExternalOperationDescriptor, type ExternalOperationRecord, type ExternalOperationReport, FileDiagnosticArtifactStore, type FinishReason, type FoldedOperationRecord, GROQ_PROFILE, GeminiProvider, GeminiTranscriptionProvider, type GuardrailBlockHandler, type GuardrailData, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HandoffReturnData, type HandoffStartData, type HistoricalAxlEvent, type HistoricalExecutionInfo, type HistoryRetentionCursor, type HistoryRetentionKind, type HistoryRetentionOptions, type HistoryRetentionResult, type HistoryTtls, type HumanDecision, InMemoryVectorStore, type InputAudioPart, type InputContentPart, type InputGuardrail, type InputImagePart, type InputMediaSource, type InputModalitySupport, type InputTextPart, InvalidModelInputError, InvalidTranscriptionInputError, LLAMACPP_PROFILE, LMSTUDIO_PROFILE, type LegacyAxlEventV1, type LegacyExecutionInfoV1, MAX_INLINE_MODEL_INPUT_BYTES, MAX_INLINE_TRANSCRIPTION_BYTES, MISTRAL_PROFILE, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, type MemoryEventData, MemoryManager, MemoryStore, type MemoryStoreOptions, type ModelCallRecord, type ModelInput, type ModelInputDescriptor, type ModelTimingRollup, NoConsensus, NoopSpanManager, OLLAMA_PROFILE, OPENAI_PRICING, OPENAI_PROFILE, OPENROUTER_PROFILE, type ObservationStatus, type OpenAICompatibleOptions, OpenAICompatibleProvider, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, OpenAITranscriptionProvider, OpenRouterTranscriptionProvider, type OpenedArtifact, type OperationKind, type OperationPurpose, type OutputGuardrail, type OutputValidator, type PendingDecision, type PerModel, type PricingSource, type PricingTable, type ProfileInputModalities, type Provider, type ProviderAdapter, type ProviderDiagnosticData, ProviderError, type ProviderInputValidationRequest, type ProviderInputValidationResult, type ProviderProfile, ProviderRegistry, type ProviderResponse, QuorumNotMet, REDACTED, REDACTION_RULES, type RaceOptions, type RateLimitConfig, RateLimiter, type ReasoningCapture, type ReasoningContextReset, type ReasoningEmit, type ReasoningProfile, type ReasoningRoundTrip, type RecallOptions, type RecallResult, type RecordedAudioSource, type RedisConnectionEvent, RedisStore, type RedisStoreOptions, type RememberOptions, type RememberResult, RequestCaptureChannel, type RequestCaptureOptions, type RequestCaptureSink, type RequestCaptureStatus, type ResolvedThinkingOptions, type Result, type RetryFeedbackHook, type RetryFeedbackInfo, type RetryFeedbackResult, type RetryPolicy, type RuntimeEvalConfigShape, SGLANG_PROFILE, SQLiteStore, type SQLiteStoreOptions, type SchemaCheckData, type SchemaDiagnosticData, type SchemaPromptOption, Session, type SessionOptions, type SessionUpdate, type SpanAttributeValue, type SpanAttributes, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StagedArtifact, StallTimeoutError, type StateStore, type StreamChunk, type StringDeltaData, type StringStreamEvent, type StringStreamFilter, type TelemetryConfig, ThinkTagScanner, type TimeoutBreakdown, TimeoutError, type Tool, type ToolApprovalData, type ToolArgumentIssue, type ToolCallCancellation, type ToolCallData, type ToolCallEndData, type ToolCallFailure, type ToolCallMessage, type ToolCallOutcome, type ToolCallRejectedData, type ToolCallRejectedEvent, type ToolCallStartData, type ToolCallStartDataV2, type ToolChoice, type ToolConfig, type ToolDeniedData, type ToolEventError, ToolFailure, type ToolFailureConstructor, type ToolFailureOptions, type ToolHooks, type ToolLifecycleEventV2, type ToolModelOutput, ToolModelOutputError, type TrackExecutionMetadata, type TrackExecutionResult, type TrackOutcomeOptions, type TrackedOutcome, type Transcript, type TranscriptionCapabilities, TranscriptionOperationError, type TranscriptionProvider, TranscriptionProviderRegistry, type TranscriptionProviderRequest, type TranscriptionProviderResult, type TranscriptionRequest, UnsupportedEventSchemaVersionError, UnsupportedModelInputError, UnsupportedModelOptionError, UnsupportedTranscriptionInputError, VLLM_PROFILE, type ValidateData, type ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, type VerifyData, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, type WorkflowEndData, type WorkflowStartData, XAI_PROFILE, agent, capturedJournalLineSchema, createSpanManager, defineConfig, estimateOpenAICost, eventCostContribution, expandGlob, externalOperation, externalOperationRecordSchema, extractJson, extractThinkTags, findConfig, foldJournal, foldedOperationRecordSchema, getEventSchemaVersion, getExecutionEventSchemaVersion, hasPositiveBillableWork, hasPositiveTokens, importModule, inputText, isAdmissionDeniedError, isCostBearingLeaf, isRetryableStatus, isRootLevel, isUnpricedLeaf, isUsableCost, modelCallRecordSchema, needsTsxLoader, normalizeStoredExecution, openaiReasoningEmit, parsePartialJson, pickDefault, pickExport, priceFromTable, reasoningEffortEmit, reasoningObjectEmit, redactCapturedRequest, redactEvent, redactHistoricalEvent, redactModelCallRecord, registerConditions, resolveApiKey, resolvePerModel, resolveRuntime, resolveThinkingOptions, stringStreamFromEvents, summarizeModelInput, tool, workflow, zodToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -3867,6 +3867,12 @@ type ExecutionState = {
3867
3867
  status: 'waiting' | 'running';
3868
3868
  metadata?: Record<string, unknown>;
3869
3869
  };
3870
+ /**
3871
+ * Computes a session's new history from what's stored, for
3872
+ * {@link StateStore.updateSession}. Receives `null` when no session is stored.
3873
+ * Returns `null` to write nothing. May run more than once.
3874
+ */
3875
+ type SessionUpdate = (current: ChatMessage[] | null) => ChatMessage[] | null;
3870
3876
  /**
3871
3877
  * Pluggable state persistence interface.
3872
3878
  *
@@ -3877,6 +3883,18 @@ interface StateStore {
3877
3883
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
3878
3884
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
3879
3885
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
3886
+ /**
3887
+ * Replace a session's history based on what's stored at that moment, without
3888
+ * overwriting a write made by another process in between. Sessions use it to
3889
+ * save each turn. The built-in stores implement it; without it, a store gets
3890
+ * `saveSession`, where the last writer wins.
3891
+ *
3892
+ * **Custom store implementors:** the read and the write must be atomic. Use a
3893
+ * transaction or a compare-and-set, and call `update` again if another writer
3894
+ * got in first, so `update` may run more than once. It receives `null` when no
3895
+ * session is stored. When it returns `null`, write nothing.
3896
+ */
3897
+ updateSession?(sessionId: string, update: SessionUpdate): Promise<void>;
3880
3898
  getSession(sessionId: string): Promise<ChatMessage[]>;
3881
3899
  deleteSession(sessionId: string): Promise<void>;
3882
3900
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -4890,10 +4908,7 @@ type WorkflowContextInit = {
4890
4908
  * fn callbacks). Composed name: `__auto/<primitive>/<n>`.
4891
4909
  *
4892
4910
  * Root contexts default to a fresh `{ byAgent: new Map(), root: 0 }`. */
4893
- autoCheckpointCounters?: {
4894
- byAgent: Map<string, number>;
4895
- root: number;
4896
- };
4911
+ autoCheckpointCounters?: AutoCheckpointState;
4897
4912
  /** Internal: root-shared state for branch continuations that must settle
4898
4913
  * before the runtime emits the workflow terminal and snapshots cost. */
4899
4914
  branchDrainState?: BranchDrainState;
@@ -4923,6 +4938,13 @@ type PendingDecisionResolver = {
4923
4938
  * deleteExecution joins this barrier before its total store sweep. */
4924
4939
  cleanupFinished: Promise<void>;
4925
4940
  };
4941
+ /** Automatic checkpoint bookkeeping, shared by an execution's child contexts. */
4942
+ type AutoCheckpointState = {
4943
+ byAgent: Map<string, number>;
4944
+ root: number;
4945
+ /** An automatic checkpoint failed to save, so none are saved from here on. */
4946
+ saveFailed?: boolean;
4947
+ };
4926
4948
  /**
4927
4949
  * The central coordination object for all Axl primitives.
4928
4950
  * Carries execution state, tracing, budget tracking, and session history.
@@ -5626,22 +5648,6 @@ type SessionOptions = {
5626
5648
  /** Whether to persist session history to the state store. Default: true. */
5627
5649
  persist?: boolean;
5628
5650
  };
5629
- /**
5630
- * A stateful conversation session.
5631
- * Persists message history across multiple interactions.
5632
- *
5633
- * **Concurrency contract:** `send`, `stream`, `end`, and `fork` are
5634
- * serialized per session id within one runtime instance. Two
5635
- * `runtime.session('x')` handles share the same lock (it lives on
5636
- * `AxlRuntime`, not the `Session` instance). `history()` and
5637
- * `handoffs()` bypass the lock and return the last persisted snapshot.
5638
- *
5639
- * **⚠️ Cross-process locking is NOT provided.** Multiple Node workers
5640
- * behind a load balancer hitting the same Redis-backed `sessionId`
5641
- * will still race. Pin sessions to workers (sticky routing) or use
5642
- * distinct ids per request. See `docs/api-reference.md` →
5643
- * Sessions → Concurrency.
5644
- */
5645
5651
  declare class Session {
5646
5652
  private sessionId;
5647
5653
  private runtime;
@@ -5668,6 +5674,8 @@ declare class Session {
5668
5674
  * push has no agent context and so leaves `agent` undefined — see the
5669
5675
  * `ChatMessage.agent` field doc. */
5670
5676
  private commitHistory;
5677
+ /** The turn is already saved, so a listener that throws can't be allowed to fail it. */
5678
+ private notify;
5671
5679
  stream(workflowName: string, input: unknown, options?: {
5672
5680
  signal?: AbortSignal;
5673
5681
  events?: EventStreamOptions;
@@ -9774,6 +9782,7 @@ declare class MemoryStore implements StateStore {
9774
9782
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
9775
9783
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
9776
9784
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
9785
+ updateSession(sessionId: string, update: SessionUpdate): Promise<void>;
9777
9786
  getSession(sessionId: string): Promise<ChatMessage[]>;
9778
9787
  deleteSession(sessionId: string): Promise<void>;
9779
9788
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -9942,6 +9951,7 @@ declare class SQLiteStore implements StateStore {
9942
9951
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
9943
9952
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
9944
9953
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
9954
+ updateSession(sessionId: string, update: SessionUpdate): Promise<void>;
9945
9955
  getSession(sessionId: string): Promise<ChatMessage[]>;
9946
9956
  deleteSession(sessionId: string): Promise<void>;
9947
9957
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -10012,6 +10022,20 @@ declare class SQLiteStore implements StateStore {
10012
10022
  deleteCheckpoints(executionId: string): Promise<void>;
10013
10023
  }
10014
10024
 
10025
+ /**
10026
+ * A change in a {@link RedisStore}'s connection, passed to
10027
+ * {@link RedisStoreOptions.onConnectionEvent}.
10028
+ *
10029
+ * - `error`: the connection was lost or a reconnect attempt failed. Arrives
10030
+ * once per attempt while Redis is down.
10031
+ * - `reconnected`: the store is connected again and commands work.
10032
+ */
10033
+ type RedisConnectionEvent = {
10034
+ type: 'error';
10035
+ error: Error;
10036
+ } | {
10037
+ type: 'reconnected';
10038
+ };
10015
10039
  /** Options accepted by {@link RedisStore.create}. */
10016
10040
  interface RedisStoreOptions {
10017
10041
  /** Redis connection URL (e.g. `redis://localhost:6379`). Defaults to `redis://localhost:6379`. */
@@ -10036,6 +10060,44 @@ interface RedisStoreOptions {
10036
10060
  * operator experience.
10037
10061
  */
10038
10062
  keyPrefix?: string;
10063
+ /**
10064
+ * Called when the connection is lost, a reconnect attempt fails, or the
10065
+ * connection comes back, for routing to a logger, metrics, or a health check.
10066
+ * Replaces the default logging of one line per outage and one on recovery.
10067
+ *
10068
+ * Not called for a failed `create()`, whose rejection reports the failure,
10069
+ * or after `close()`. A callback that throws or rejects is reported with
10070
+ * `console.error` and otherwise ignored.
10071
+ */
10072
+ onConnectionEvent?: (event: RedisConnectionEvent) => void;
10073
+ /**
10074
+ * Reconnect when Redis stops answering, in milliseconds. Off by default.
10075
+ *
10076
+ * The store sends a `PING` about every third of this time. If one goes
10077
+ * unanswered for this long, it drops the connection and reconnects: calls in
10078
+ * flight reject, and calls made until it reconnects reject with
10079
+ * `REDIS_UNAVAILABLE`. `create()` also rejects if Redis hasn't finished
10080
+ * connecting within this time.
10081
+ *
10082
+ * It's a limit on the whole connection, not on one command, because replies
10083
+ * come back in order. Set it above your slowest expected command, or a large
10084
+ * save or busy server looks like a stall. A call that rejects this way may
10085
+ * still have been applied by Redis.
10086
+ */
10087
+ responseTimeoutMs?: number;
10088
+ /**
10089
+ * Set to `false` so that `create()` returns right away and the store connects
10090
+ * in the background, retrying until Redis is available. Calls reject with
10091
+ * `REDIS_UNAVAILABLE` until then. Defaults to `true`, where `create()` rejects
10092
+ * if Redis is unavailable, which surfaces bad configuration at startup.
10093
+ *
10094
+ * Requires {@link responseTimeoutMs}, so that a server that accepts the
10095
+ * connection but never answers can't leave it connecting forever. Nothing
10096
+ * rejects if the configuration is wrong: failed attempts go to
10097
+ * {@link onConnectionEvent}, and `isConnected` stays `false`. The startup
10098
+ * backfill runs after the first connection instead of during `create()`.
10099
+ */
10100
+ waitForConnection?: boolean;
10039
10101
  /**
10040
10102
  * Skip the lazy backfill of legacy execution / eval-history entries into
10041
10103
  * the sorted-set indexes during `RedisStore.create()`. Default `false`
@@ -10139,10 +10201,34 @@ interface RedisStoreOptions {
10139
10201
  * async `RedisStore.create()` factory, which connects before returning.
10140
10202
  */
10141
10203
  declare class RedisStore implements StateStore {
10142
- private client;
10204
+ private connection;
10143
10205
  private keyPrefix;
10144
10206
  private ttls;
10207
+ /** Set when `close()` starts, while the connection is still open. */
10208
+ private closing;
10209
+ /** Where the next save's check of listed sessions picks up. */
10210
+ private sessionSweepCursor;
10211
+ /** Overlapping saves would all check the same page, so only one checks at a time. */
10212
+ private sessionSweepRunning;
10145
10213
  private constructor();
10214
+ /**
10215
+ * Whether the store can send commands right now, for a health check or for
10216
+ * telling an outage from other failures when a call rejects. `false` while
10217
+ * reconnecting and after `close()`.
10218
+ */
10219
+ get isConnected(): boolean;
10220
+ /**
10221
+ * The client for sending a command, failing immediately while disconnected.
10222
+ *
10223
+ * Every command goes through here because node-redis's `disableOfflineQueue`
10224
+ * rejects single commands but not `multi().exec()`, which would wait for a
10225
+ * reconnect attempt to fail or succeed. Nothing may `await` between
10226
+ * `client.multi()` and `.exec()`, or a transaction could get past this check.
10227
+ *
10228
+ * A closed store isn't "unavailable": it falls through to node-redis's own
10229
+ * "The client is closed" rejection.
10230
+ */
10231
+ private get client();
10146
10232
  /**
10147
10233
  * History kinds with a prune running in this process. A save skips its
10148
10234
  * prune while another one of the same kind is in flight: the running one
@@ -10150,6 +10236,8 @@ declare class RedisStore implements StateStore {
10150
10236
  * instance needs no constructor state.
10151
10237
  */
10152
10238
  private prunesInFlight?;
10239
+ /** Stops the `responseTimeoutMs` health checks; unset when the option is off. */
10240
+ private stopResponseWatch?;
10153
10241
  /**
10154
10242
  * Supports `listExecutions(limit, { cursor })`. A getter rather than a
10155
10243
  * field so it lives on the prototype.
@@ -10185,6 +10273,12 @@ declare class RedisStore implements StateStore {
10185
10273
  * ```
10186
10274
  */
10187
10275
  static create(options?: string | RedisStoreOptions): Promise<RedisStore>;
10276
+ /**
10277
+ * Run the startup backfill when a connection becomes ready, until it succeeds.
10278
+ * Nothing is waiting on it, and listings work without it, so a failure is
10279
+ * reported and the next connection tries again.
10280
+ */
10281
+ private backfillOnceConnected;
10188
10282
  /**
10189
10283
  * Backfill the execution-history sorted-set from the legacy ID set.
10190
10284
  * Idempotent — runs only if the ZSET is missing entries the SET has.
@@ -10198,6 +10292,10 @@ declare class RedisStore implements StateStore {
10198
10292
  * Shared implementation for both backfill paths. Reads SET members,
10199
10293
  * batch-MGETs their data blobs in chunks, and ZADDs each into the new
10200
10294
  * sorted-set inside a single MULTI per chunk.
10295
+ *
10296
+ * Ids with no data blob are removed from the id set. Left there, the set stays
10297
+ * larger than the sorted set, so every startup repeats this walk and listing
10298
+ * stays on its slow path.
10201
10299
  */
10202
10300
  private backfillHistoryIndex;
10203
10301
  private checkpointKey;
@@ -10228,6 +10326,7 @@ declare class RedisStore implements StateStore {
10228
10326
  saveCheckpoint(executionId: string, name: string, data: unknown): Promise<void>;
10229
10327
  getCheckpoint(executionId: string, name: string): Promise<unknown | null>;
10230
10328
  saveSession(sessionId: string, history: ChatMessage[]): Promise<void>;
10329
+ updateSession(sessionId: string, update: SessionUpdate): Promise<void>;
10231
10330
  getSession(sessionId: string): Promise<ChatMessage[]>;
10232
10331
  deleteSession(sessionId: string): Promise<void>;
10233
10332
  saveSessionMeta(sessionId: string, key: string, value: unknown): Promise<void>;
@@ -10340,6 +10439,7 @@ declare class RedisStore implements StateStore {
10340
10439
  * covers a Redis user whose ACL denies `EVAL`.
10341
10440
  */
10342
10441
  private pruneHistoryAfterSave;
10442
+ private warnPruneFailed;
10343
10443
  private pruneHistory;
10344
10444
  /**
10345
10445
  * Run {@link PRUNE_HISTORY_INDEX_SCRIPT} over `ids`, at most PRUNE_BATCH
@@ -10383,6 +10483,16 @@ declare class RedisStore implements StateStore {
10383
10483
  */
10384
10484
  private readRetentionBatch;
10385
10485
  listSessions(): Promise<string[]>;
10486
+ /**
10487
+ * Check a few listed sessions after a save, so ids of expired sessions go
10488
+ * away for apps that never list. Sessions without a TTL don't expire, so
10489
+ * there's nothing to do. The save has already succeeded, so failing here
10490
+ * can't fail it.
10491
+ */
10492
+ private sweepSessionIds;
10493
+ /** Returns the ids removed. Without permission to run the script, removes none and warns. */
10494
+ private pruneSessionIds;
10495
+ private warnSessionPruneFailed;
10386
10496
  appendStreamingEvents(executionId: string, events: AxlEvent[]): Promise<void>;
10387
10497
  finalizeStreamingEvents(executionId: string): Promise<void>;
10388
10498
  listStreamingExecutions(): Promise<string[]>;
@@ -10395,6 +10505,14 @@ declare class RedisStore implements StateStore {
10395
10505
  * must not get a rejected promise for it. `MemoryStore.close()` and
10396
10506
  * better-sqlite3's `close()` are both no-ops the second time; node-redis
10397
10507
  * instead rejects with "The client is closed", so absorb that here.
10508
+ *
10509
+ * Bounded, so a shutdown can't hang on Redis. Replies arrive in order, so a
10510
+ * reply to this PING means every earlier command has finished.
10511
+ *
10512
+ * Not `quit()`: it marks the client closed before the server answers, and
10513
+ * `destroy()` then throws without touching the socket, so a stalled server's
10514
+ * socket could never be closed. There's no other public way to close it. A
10515
+ * closed socket is all Redis needs to clean up, so nothing is lost.
10398
10516
  */
10399
10517
  close(): Promise<void>;
10400
10518
  deleteCheckpoints(executionId: string): Promise<void>;
@@ -10467,4 +10585,4 @@ declare class NoopSpanManager implements SpanManager {
10467
10585
  */
10468
10586
  declare function createSpanManager(config?: TelemetryConfig): Promise<SpanManager>;
10469
10587
 
10470
- export { AXL_EVENT_TYPES, AXL_EVENT_TYPES_V2, AXL_TOOL_LIFECYCLE_TYPES_V2, AZURE_PROFILE, type Accounting, type AccountingCompleteness, type AccountingReason, type AccountingUsage, AdmissionController, AdmissionDeniedError, type Agent, type AgentCallEndData, type AgentCallInfo, type AgentCallParams, type AgentCallStartData, type AgentConfig, AnthropicProvider, type AnyWorkflow, type ApiKeySource, type ArtifactManifest, type ArtifactOwner, type ArtifactStatus, type ArtifactWriteResult, type AskOptions, type AskScoped, type AuthHeader, type AwaitHumanData, type AwaitHumanOptions, type AwaitHumanResolvedData, type AxlConfig, AxlError, type AxlEvent, type AxlEventBase, AxlEventBus, type AxlEventOf, type AxlEventType, type AxlEventV2, type AxlEventV2Of, AxlRuntime, AxlStream, BEDROCK_PROFILE, BUILTIN_PROFILES, BudgetExceededError, type BudgetOptions, type BudgetResult, CONFIG_CANDIDATES, COST_BEARING_LEAF_TYPES, type CallTiming, type CapabilityFlags, type CaptureCorrelation, type CapturedCorrection, type CapturedError, type CapturedExternalRequestRecord, type CapturedJsonValue, type CapturedMessage, type CapturedModelRequestRecord, type CapturedOperationRef, type CapturedPhase, type CapturedRequest, type CapturedRequestRecord, type CapturedResponse, type ChatMessage, type ChatOptions, type CheckpointEventData, type CoalescedPartialObject, type CostProvenance, type CreateContextOptions, DEEPSEEK_PROFILE, DEFAULT_MAX_QUEUE_BYTES, DEFAULT_MAX_RECORD_BYTES, DEFAULT_MAX_RUN_BYTES, type DecisionCleanupFailedEvent, type DelegateData, type DelegateOptions, type DiagnosticArtifactStore, type DiagnosticArtifactsConfig, type DiagnosticsConfig, type DispatchAdmission, type Effort, type EffortResolution, type EmbedResult, type EmbedUsage, type Embedder, type EvalExecuteWorkflow, type EvalHistoryEntry, type EvalProgressEventShape, type EventStreamOptions, EventStreamOverflowError, type ExecuteOptions, type ExecutionCursor, type ExecutionInfo, type ExecutionInfoV1, type ExecutionInfoV2, type ExecutionState, type ExternalOperationDescriptor, type ExternalOperationRecord, type ExternalOperationReport, FileDiagnosticArtifactStore, type FinishReason, type FoldedOperationRecord, GROQ_PROFILE, GeminiProvider, GeminiTranscriptionProvider, type GuardrailBlockHandler, type GuardrailData, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HandoffReturnData, type HandoffStartData, type HistoricalAxlEvent, type HistoricalExecutionInfo, type HistoryRetentionCursor, type HistoryRetentionKind, type HistoryRetentionOptions, type HistoryRetentionResult, type HistoryTtls, type HumanDecision, InMemoryVectorStore, type InputAudioPart, type InputContentPart, type InputGuardrail, type InputImagePart, type InputMediaSource, type InputModalitySupport, type InputTextPart, InvalidModelInputError, InvalidTranscriptionInputError, LLAMACPP_PROFILE, LMSTUDIO_PROFILE, type LegacyAxlEventV1, type LegacyExecutionInfoV1, MAX_INLINE_MODEL_INPUT_BYTES, MAX_INLINE_TRANSCRIPTION_BYTES, MISTRAL_PROFILE, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, type MemoryEventData, MemoryManager, MemoryStore, type MemoryStoreOptions, type ModelCallRecord, type ModelInput, type ModelInputDescriptor, type ModelTimingRollup, NoConsensus, NoopSpanManager, OLLAMA_PROFILE, OPENAI_PRICING, OPENAI_PROFILE, OPENROUTER_PROFILE, type ObservationStatus, type OpenAICompatibleOptions, OpenAICompatibleProvider, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, OpenAITranscriptionProvider, OpenRouterTranscriptionProvider, type OpenedArtifact, type OperationKind, type OperationPurpose, type OutputGuardrail, type OutputValidator, type PendingDecision, type PerModel, type PricingSource, type PricingTable, type ProfileInputModalities, type Provider, type ProviderAdapter, type ProviderDiagnosticData, ProviderError, type ProviderInputValidationRequest, type ProviderInputValidationResult, type ProviderProfile, ProviderRegistry, type ProviderResponse, QuorumNotMet, REDACTED, REDACTION_RULES, type RaceOptions, type RateLimitConfig, RateLimiter, type ReasoningCapture, type ReasoningContextReset, type ReasoningEmit, type ReasoningProfile, type ReasoningRoundTrip, type RecallOptions, type RecallResult, type RecordedAudioSource, RedisStore, type RememberOptions, type RememberResult, RequestCaptureChannel, type RequestCaptureOptions, type RequestCaptureSink, type RequestCaptureStatus, type ResolvedThinkingOptions, type Result, type RetryFeedbackHook, type RetryFeedbackInfo, type RetryFeedbackResult, type RetryPolicy, type RuntimeEvalConfigShape, SGLANG_PROFILE, SQLiteStore, type SQLiteStoreOptions, type SchemaCheckData, type SchemaDiagnosticData, type SchemaPromptOption, Session, type SessionOptions, type SpanAttributeValue, type SpanAttributes, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StagedArtifact, StallTimeoutError, type StateStore, type StreamChunk, type StringDeltaData, type StringStreamEvent, type StringStreamFilter, type TelemetryConfig, ThinkTagScanner, type TimeoutBreakdown, TimeoutError, type Tool, type ToolApprovalData, type ToolArgumentIssue, type ToolCallCancellation, type ToolCallData, type ToolCallEndData, type ToolCallFailure, type ToolCallMessage, type ToolCallOutcome, type ToolCallRejectedData, type ToolCallRejectedEvent, type ToolCallStartData, type ToolCallStartDataV2, type ToolChoice, type ToolConfig, type ToolDeniedData, type ToolEventError, ToolFailure, type ToolFailureConstructor, type ToolFailureOptions, type ToolHooks, type ToolLifecycleEventV2, type ToolModelOutput, ToolModelOutputError, type TrackExecutionMetadata, type TrackExecutionResult, type TrackOutcomeOptions, type TrackedOutcome, type Transcript, type TranscriptionCapabilities, TranscriptionOperationError, type TranscriptionProvider, TranscriptionProviderRegistry, type TranscriptionProviderRequest, type TranscriptionProviderResult, type TranscriptionRequest, UnsupportedEventSchemaVersionError, UnsupportedModelInputError, UnsupportedModelOptionError, UnsupportedTranscriptionInputError, VLLM_PROFILE, type ValidateData, type ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, type VerifyData, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, type WorkflowEndData, type WorkflowStartData, XAI_PROFILE, agent, capturedJournalLineSchema, createSpanManager, defineConfig, estimateOpenAICost, eventCostContribution, expandGlob, externalOperation, externalOperationRecordSchema, extractJson, extractThinkTags, findConfig, foldJournal, foldedOperationRecordSchema, getEventSchemaVersion, getExecutionEventSchemaVersion, hasPositiveBillableWork, hasPositiveTokens, importModule, inputText, isAdmissionDeniedError, isCostBearingLeaf, isRetryableStatus, isRootLevel, isUnpricedLeaf, isUsableCost, modelCallRecordSchema, needsTsxLoader, normalizeStoredExecution, openaiReasoningEmit, parsePartialJson, pickDefault, pickExport, priceFromTable, reasoningEffortEmit, reasoningObjectEmit, redactCapturedRequest, redactEvent, redactHistoricalEvent, redactModelCallRecord, registerConditions, resolveApiKey, resolvePerModel, resolveRuntime, resolveThinkingOptions, stringStreamFromEvents, summarizeModelInput, tool, workflow, zodToJsonSchema };
10588
+ export { AXL_EVENT_TYPES, AXL_EVENT_TYPES_V2, AXL_TOOL_LIFECYCLE_TYPES_V2, AZURE_PROFILE, type Accounting, type AccountingCompleteness, type AccountingReason, type AccountingUsage, AdmissionController, AdmissionDeniedError, type Agent, type AgentCallEndData, type AgentCallInfo, type AgentCallParams, type AgentCallStartData, type AgentConfig, AnthropicProvider, type AnyWorkflow, type ApiKeySource, type ArtifactManifest, type ArtifactOwner, type ArtifactStatus, type ArtifactWriteResult, type AskOptions, type AskScoped, type AuthHeader, type AwaitHumanData, type AwaitHumanOptions, type AwaitHumanResolvedData, type AxlConfig, AxlError, type AxlEvent, type AxlEventBase, AxlEventBus, type AxlEventOf, type AxlEventType, type AxlEventV2, type AxlEventV2Of, AxlRuntime, AxlStream, BEDROCK_PROFILE, BUILTIN_PROFILES, BudgetExceededError, type BudgetOptions, type BudgetResult, CONFIG_CANDIDATES, COST_BEARING_LEAF_TYPES, type CallTiming, type CapabilityFlags, type CaptureCorrelation, type CapturedCorrection, type CapturedError, type CapturedExternalRequestRecord, type CapturedJsonValue, type CapturedMessage, type CapturedModelRequestRecord, type CapturedOperationRef, type CapturedPhase, type CapturedRequest, type CapturedRequestRecord, type CapturedResponse, type ChatMessage, type ChatOptions, type CheckpointEventData, type CoalescedPartialObject, type CostProvenance, type CreateContextOptions, DEEPSEEK_PROFILE, DEFAULT_MAX_QUEUE_BYTES, DEFAULT_MAX_RECORD_BYTES, DEFAULT_MAX_RUN_BYTES, type DecisionCleanupFailedEvent, type DelegateData, type DelegateOptions, type DiagnosticArtifactStore, type DiagnosticArtifactsConfig, type DiagnosticsConfig, type DispatchAdmission, type Effort, type EffortResolution, type EmbedResult, type EmbedUsage, type Embedder, type EvalExecuteWorkflow, type EvalHistoryEntry, type EvalProgressEventShape, type EventStreamOptions, EventStreamOverflowError, type ExecuteOptions, type ExecutionCursor, type ExecutionInfo, type ExecutionInfoV1, type ExecutionInfoV2, type ExecutionState, type ExternalOperationDescriptor, type ExternalOperationRecord, type ExternalOperationReport, FileDiagnosticArtifactStore, type FinishReason, type FoldedOperationRecord, GROQ_PROFILE, GeminiProvider, GeminiTranscriptionProvider, type GuardrailBlockHandler, type GuardrailData, GuardrailError, type GuardrailResult, type GuardrailsConfig, type HandoffDescriptor, type HandoffRecord, type HandoffReturnData, type HandoffStartData, type HistoricalAxlEvent, type HistoricalExecutionInfo, type HistoryRetentionCursor, type HistoryRetentionKind, type HistoryRetentionOptions, type HistoryRetentionResult, type HistoryTtls, type HumanDecision, InMemoryVectorStore, type InputAudioPart, type InputContentPart, type InputGuardrail, type InputImagePart, type InputMediaSource, type InputModalitySupport, type InputTextPart, InvalidModelInputError, InvalidTranscriptionInputError, LLAMACPP_PROFILE, LMSTUDIO_PROFILE, type LegacyAxlEventV1, type LegacyExecutionInfoV1, MAX_INLINE_MODEL_INPUT_BYTES, MAX_INLINE_TRANSCRIPTION_BYTES, MISTRAL_PROFILE, type MapOptions, MaxTurnsError, McpManager, type McpServer, type McpServerConfig, type McpToolDefinition, type McpToolResult, type MemoryConfig, type MemoryEventData, MemoryManager, MemoryStore, type MemoryStoreOptions, type ModelCallRecord, type ModelInput, type ModelInputDescriptor, type ModelTimingRollup, NoConsensus, NoopSpanManager, OLLAMA_PROFILE, OPENAI_PRICING, OPENAI_PROFILE, OPENROUTER_PROFILE, type ObservationStatus, type OpenAICompatibleOptions, OpenAICompatibleProvider, OpenAIEmbedder, OpenAIProvider, OpenAIResponsesProvider, OpenAITranscriptionProvider, OpenRouterTranscriptionProvider, type OpenedArtifact, type OperationKind, type OperationPurpose, type OutputGuardrail, type OutputValidator, type PendingDecision, type PerModel, type PricingSource, type PricingTable, type ProfileInputModalities, type Provider, type ProviderAdapter, type ProviderDiagnosticData, ProviderError, type ProviderInputValidationRequest, type ProviderInputValidationResult, type ProviderProfile, ProviderRegistry, type ProviderResponse, QuorumNotMet, REDACTED, REDACTION_RULES, type RaceOptions, type RateLimitConfig, RateLimiter, type ReasoningCapture, type ReasoningContextReset, type ReasoningEmit, type ReasoningProfile, type ReasoningRoundTrip, type RecallOptions, type RecallResult, type RecordedAudioSource, type RedisConnectionEvent, RedisStore, type RedisStoreOptions, type RememberOptions, type RememberResult, RequestCaptureChannel, type RequestCaptureOptions, type RequestCaptureSink, type RequestCaptureStatus, type ResolvedThinkingOptions, type Result, type RetryFeedbackHook, type RetryFeedbackInfo, type RetryFeedbackResult, type RetryPolicy, type RuntimeEvalConfigShape, SGLANG_PROFILE, SQLiteStore, type SQLiteStoreOptions, type SchemaCheckData, type SchemaDiagnosticData, type SchemaPromptOption, Session, type SessionOptions, type SessionUpdate, type SpanAttributeValue, type SpanAttributes, type SpanHandle, type SpanManager, type SpawnOptions, SqliteVectorStore, type StagedArtifact, StallTimeoutError, type StateStore, type StreamChunk, type StringDeltaData, type StringStreamEvent, type StringStreamFilter, type TelemetryConfig, ThinkTagScanner, type TimeoutBreakdown, TimeoutError, type Tool, type ToolApprovalData, type ToolArgumentIssue, type ToolCallCancellation, type ToolCallData, type ToolCallEndData, type ToolCallFailure, type ToolCallMessage, type ToolCallOutcome, type ToolCallRejectedData, type ToolCallRejectedEvent, type ToolCallStartData, type ToolCallStartDataV2, type ToolChoice, type ToolConfig, type ToolDeniedData, type ToolEventError, ToolFailure, type ToolFailureConstructor, type ToolFailureOptions, type ToolHooks, type ToolLifecycleEventV2, type ToolModelOutput, ToolModelOutputError, type TrackExecutionMetadata, type TrackExecutionResult, type TrackOutcomeOptions, type TrackedOutcome, type Transcript, type TranscriptionCapabilities, TranscriptionOperationError, type TranscriptionProvider, TranscriptionProviderRegistry, type TranscriptionProviderRequest, type TranscriptionProviderResult, type TranscriptionRequest, UnsupportedEventSchemaVersionError, UnsupportedModelInputError, UnsupportedModelOptionError, UnsupportedTranscriptionInputError, VLLM_PROFILE, type ValidateData, type ValidateResult, ValidationError, type VectorEntry, type VectorResult, type VectorStore, type VerifyData, VerifyError, type VerifyOptions, type VerifyRetry, type VoteOptions, type Workflow, type WorkflowConfig, WorkflowContext, type WorkflowContextInit, type WorkflowEndData, type WorkflowStartData, XAI_PROFILE, agent, capturedJournalLineSchema, createSpanManager, defineConfig, estimateOpenAICost, eventCostContribution, expandGlob, externalOperation, externalOperationRecordSchema, extractJson, extractThinkTags, findConfig, foldJournal, foldedOperationRecordSchema, getEventSchemaVersion, getExecutionEventSchemaVersion, hasPositiveBillableWork, hasPositiveTokens, importModule, inputText, isAdmissionDeniedError, isCostBearingLeaf, isRetryableStatus, isRootLevel, isUnpricedLeaf, isUsableCost, modelCallRecordSchema, needsTsxLoader, normalizeStoredExecution, openaiReasoningEmit, parsePartialJson, pickDefault, pickExport, priceFromTable, reasoningEffortEmit, reasoningObjectEmit, redactCapturedRequest, redactEvent, redactHistoricalEvent, redactModelCallRecord, registerConditions, resolveApiKey, resolvePerModel, resolveRuntime, resolveThinkingOptions, stringStreamFromEvents, summarizeModelInput, tool, workflow, zodToJsonSchema };