UNPKG

@mastra/core

Version:
69 lines • 6.17 kB
/** * Typed {@link RunScopeKey} registry for the agentic loop + execution workflows. * * The agentic engine runs as evented workflow steps. Step input/output schemas * cross the wire (storage snapshots, `UnixSocketPubSub` frames), so they MUST * stay JSON-safe — see `serialization-invariants.test.ts`. Non-serializable * runtime state (live class instances, function closures, abort controllers, * stream transports) lives on the per-run `RunScope` held by `Mastra` instead. * * Each key here mirrors one slot on the legacy `StreamInternal` (`_internal`) * bag. During the migration, `loop.ts` hydrates the scope from `_internal` * before any step runs; step factories then prefer `scope.get(KEY)` and fall * back to `_internal` for the rare test path that constructs a step factory * directly without going through `loop()`. */ import type { IdGenerator, LanguageModelRequestMetadata, ModelMessage, ToolSet } from '../_types/@internal_ai-sdk-v5@0.0.98/dist/index.js'; import type { SaveQueueManager } from '../agent/save-queue/index.js'; import type { PendingSignalListener, CreatedAgentSignal } from '../agent/signals.js'; import type { AgentBackgroundConfig, BackgroundTaskManager, BackgroundTaskManagerConfig } from '../background-tasks/index.js'; import type { MastraMemory, MemoryConfigInternal } from '../memory/index.js'; import type { LanguageModelUsage, ProviderMetadata, StreamTransportRef } from '../stream/types.js'; import type { ToolPayloadTransformPolicy } from '../tools/index.js'; import type { Workspace } from '../workspace/workspace.js'; import type { EagerToolExecutionCoordinator } from './workflows/agentic-execution/eager-tool-execution.js'; export declare const NOW_KEY: import("../mastra/run-scope").RunScopeKey<() => number>; export declare const GENERATE_ID_KEY: import("../mastra/run-scope").RunScopeKey<IdGenerator>; export declare const CURRENT_DATE_KEY: import("../mastra/run-scope").RunScopeKey<() => Date>; export declare const SAVE_QUEUE_MANAGER_KEY: import("../mastra/run-scope").RunScopeKey<SaveQueueManager>; export declare const MEMORY_KEY: import("../mastra/run-scope").RunScopeKey<MastraMemory>; /** Whether `MEMORY_KEY` resolves to the same store on resume, so snapshots may reference recalled messages. */ export declare const FIXED_MEMORY_KEY: import("../mastra/run-scope").RunScopeKey<boolean>; export declare const MEMORY_CONFIG_KEY: import("../mastra/run-scope").RunScopeKey<MemoryConfigInternal>; export declare const THREAD_ID_KEY: import("../mastra/run-scope").RunScopeKey<string>; export declare const RESOURCE_ID_KEY: import("../mastra/run-scope").RunScopeKey<string>; export declare const THREAD_EXISTS_KEY: import("../mastra/run-scope").RunScopeKey<boolean>; export declare const STEP_TOOLS_KEY: import("../mastra/run-scope").RunScopeKey<ToolSet>; export declare const REQUEST_TOOLS_KEY: import("../mastra/run-scope").RunScopeKey<ToolSet>; export declare const STEP_ACTIVE_TOOLS_KEY: import("../mastra/run-scope").RunScopeKey<string[]>; export declare const STEP_WORKSPACE_KEY: import("../mastra/run-scope").RunScopeKey<Workspace<import("../workspace").WorkspaceFilesystem | undefined, import("../workspace").WorkspaceSandbox | undefined, undefined>>; export declare const TOOL_APPROVAL_VERDICTS_KEY: import("../mastra/run-scope").RunScopeKey<Map<string, boolean>>; /** * Usage of the current model step. A suspended step emits no `step-finish`, so the first * suspension chunk of the step carries (and consumes) this usage instead. */ export declare const STEP_USAGE_KEY: import("../mastra/run-scope").RunScopeKey<LanguageModelUsage | undefined>; /** Provider metadata of the current model step, carried and consumed like {@link STEP_USAGE_KEY}. */ export declare const STEP_PROVIDER_METADATA_KEY: import("../mastra/run-scope").RunScopeKey<ProviderMetadata | undefined>; export declare const STEP_MODEL_MESSAGES_KEY: import("../mastra/run-scope").RunScopeKey<ModelMessage[]>; /** * Response message the current step is writing into. A signal or a retry rotates the id * mid-iteration, so tool-emitted data chunks must use this instead of the run-level id. */ export declare const STEP_RESPONSE_MESSAGE_ID_KEY: import("../mastra/run-scope").RunScopeKey<string>; /** Latest provider request for local durable callers only; never serialized with a step. */ export declare const LOCAL_MODEL_REQUEST_KEY: import("../mastra/run-scope").RunScopeKey<LanguageModelRequestMetadata>; export declare const EAGER_TOOL_EXECUTION_KEY: import("../mastra/run-scope").RunScopeKey<EagerToolExecutionCoordinator>; export declare const DELEGATION_BAILED_KEY: import("../mastra/run-scope").RunScopeKey<boolean>; export declare const TRANSPORT_REF_KEY: import("../mastra/run-scope").RunScopeKey<StreamTransportRef>; export declare const BACKGROUND_TASK_MANAGER_KEY: import("../mastra/run-scope").RunScopeKey<BackgroundTaskManager>; export declare const AGENT_BACKGROUND_CONFIG_KEY: import("../mastra/run-scope").RunScopeKey<AgentBackgroundConfig>; export declare const BACKGROUND_TASK_MANAGER_CONFIG_KEY: import("../mastra/run-scope").RunScopeKey<BackgroundTaskManagerConfig>; export declare const SKIP_BG_TASK_WAIT_KEY: import("../mastra/run-scope").RunScopeKey<boolean>; export declare const DRAIN_PENDING_SIGNALS_KEY: import("../mastra/run-scope").RunScopeKey<(runId: string, scope?: 'pending' | 'pre-run') => CreatedAgentSignal[]>; export declare const SUBSCRIBE_PENDING_SIGNALS_KEY: import("../mastra/run-scope").RunScopeKey<(runId: string, listener: PendingSignalListener) => () => void>; export declare const INITIAL_SIGNAL_ECHOES_KEY: import("../mastra/run-scope").RunScopeKey<CreatedAgentSignal[]>; export declare const TOOL_PAYLOAD_TRANSFORM_KEY: import("../mastra/run-scope").RunScopeKey<ToolPayloadTransformPolicy>; export declare const CONTINUATION_STOP_CAUSE_KEY: import("../mastra/run-scope").RunScopeKey<"delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined>; export declare const DELEGATION_FAILURE_KEY: import("../mastra/run-scope").RunScopeKey<import("../observability").SpanTermination>; //# sourceMappingURL=run-scope-keys.d.ts.map