UNPKG

@mastra/core

Version:
30 lines • 1.76 kB
import { RequestContext } from '../request-context/index.js'; /** * Reserved request-context key carrying `Record<runId, DurableExecutionClaim>`. * Keyed by runId so a delegated durable sub-agent sharing the parent's * RequestContext cannot overwrite the parent's claim. */ export declare const MASTRA_DURABLE_EXECUTIONS_KEY = "mastra__durableExecutions"; /** * JSON-safe snapshot of `requestContext.entries()`, for a run that continues * somewhere the live context can't follow: a durable step, or a claimed * thread owner in another process. Best-effort: entries that fail a JSON * round-trip are skipped so a single non-serializable value can't break the * snapshot. */ export declare function snapshotRequestContextEntries(requestContext: RequestContext | undefined): Record<string, unknown> | undefined; /** * Restore a RequestContext from a `snapshotRequestContextEntries` snapshot. * * `entries` is absent on a durable step input even when the run itself has a * context: the snapshot is propagated at the run level, not copied onto every * step. `runLevel` is that run-level context, which the execution engine has * already rebuilt in the step's scope — falling back to it is what keeps * request-scoped resolution (tenant/user, workspace, dynamic model/memory) * working for tools rebuilt on a cross-process worker, including a delegated * subagent's. */ export declare function restoreRequestContext(entries?: Record<string, unknown>, runLevel?: RequestContext): RequestContext; /** The token and user entries that `withoutLiveRequestKeys` drops, read from the live context. */ export declare function liveRequestEntries(runLevel?: RequestContext): [string, unknown][]; //# sourceMappingURL=request-context-snapshot.d.ts.map