@mastra/core
Version:
64 lines • 2.59 kB
TypeScript
/**
* Topics and event types of an agent's resumable run stream.
*/
/**
* Generate the pubsub topic name for agent streaming events
* @param runId - The unique run identifier
* @returns The topic name for subscribing/publishing agent stream events
*/
export declare const AGENT_STREAM_TOPIC: (runId: string) => string;
/**
* Generate the pubsub topic name for agent control messages.
*
* Separate from {@link AGENT_STREAM_TOPIC} because control messages travel the
* opposite direction: stream events flow worker -> consumer, control messages
* flow caller -> worker. Keeping them apart means stream consumers never see
* control traffic and vice versa.
*
* @param runId - The unique run identifier
* @returns The topic name for publishing/subscribing agent control events
*/
export declare const AGENT_CONTROL_TOPIC: (runId: string) => string;
/**
* Event type constants for agent control events
*/
export declare const AgentControlEventTypes: {
/**
* Request that a run abort itself. Published by `abort()` in whichever
* process the caller lives in; handled by whichever process is actually
* executing the run's steps.
*/
readonly ABORT_REQUEST: 'abort-request';
};
/**
* Event type constants for agent stream events
*/
export declare const AgentStreamEventTypes: {
/** Chunk of streaming data (text, tool call, etc.) */
readonly CHUNK: 'chunk';
/** Internal boundary preceding all output from an LLM execution step. */
readonly ITERATION_START: 'iteration-start';
/** Start of a new step in the agentic loop */
readonly STEP_START: 'step-start';
/** End of a step in the agentic loop */
readonly STEP_FINISH: 'step-finish';
/** Agent execution completed successfully */
readonly FINISH: 'finish';
/** Error occurred during execution */
readonly ERROR: 'error';
/** Workflow suspended (e.g., for tool approval) */
readonly SUSPENDED: 'suspended';
/** Execution aborted by abortSignal */
readonly ABORT: 'abort';
/** Single agentic-loop iteration completed (observability hook) */
readonly ITERATION_COMPLETE: 'iteration-complete';
/**
* A new execution claimed the run. Carries no chunk: consumers only raise
* their generation so events the superseded execution still publishes are
* dropped.
*/
readonly OWNERSHIP_CLAIMED: 'ownership-claimed';
};
/** How long a finished run's stream stays replayable before it is cleaned up. */
export declare const DEFAULT_STREAM_CLEANUP_TIMEOUT_MS = 30000;
//# sourceMappingURL=constants.d.ts.map