@mastra/core
Version:
29 lines • 1.32 kB
TypeScript
import type { WorkflowRunState } from '../../../workflows/index.js';
/**
* Thread/resource memory info embedded in a persisted workflow-run snapshot.
*/
export type WorkflowSnapshotMemoryInfo = {
threadId?: string;
resourceId?: string;
};
/**
* Extracts the memory info (threadId/resourceId) embedded in a workflow-run
* snapshot. This is the canonical extraction: any storage adapter that
* implements the best-effort `threadId` filter on `listWorkflowRuns` MUST
* mirror these exact JSON paths in its query predicate (see
* `StorageListWorkflowRunsInput['threadId']`).
*
* The snapshot stores memory info at one of two locations depending on which
* loop produced it:
*
* 1. `agentic-loop` (dynamic step key):
* `context.<step where status === 'suspended'>.suspendPayload.__streamState.messageList.memoryInfo`
* 2. Durable agentic-loop (fixed path):
* `context.input.messageListState.memoryInfo`
*
* If either path changes, update the SQL predicates in `@mastra/pg` and
* `@mastra/libsql` (`listWorkflowRuns`) to match — otherwise they will wrongly
* exclude rows that this extraction would match.
*/
export declare function getSnapshotMemoryInfo(snapshot: WorkflowRunState | null | undefined): WorkflowSnapshotMemoryInfo | undefined;
//# sourceMappingURL=snapshot-memory-info.d.ts.map