@mastra/core
Version:
28 lines • 1.5 kB
TypeScript
import type { MastraDBMessage } from './message-list/types.js';
export declare function stampPartProducedAt(part: unknown, at: number): void;
export declare function getPartProducedAt(part: unknown): number | undefined;
type ThreadHistoryIndex = {
/** Latest stored change per message id. */
stamps: Map<string, number>;
/**
* Tool calls still waiting on the user (approval or suspension). Only the
* latest assistant message can still be owed an answer: a suspended run
* writes nothing after it. Resuming removes the entry, but calls that were
* never answered (a stopped run, or a run abandoned when a later message
* started a new run) stay in older metadata and must not be replayed.
*/
pendingToolCallIds: Set<string>;
};
export declare function indexThreadHistory(messages: MastraDBMessage[]): ThreadHistoryIndex;
/**
* Decides, per streamed part, whether stored history already covers it. Parts
* are attributed to the assistant message announced by the latest `start` /
* `step-start` of their run; a part no later than that message's newest
* stored change is dropped, including parts saved while history was being
* read. Approval and suspension chunks pending on the latest assistant message
* always pass: controllers build
* their prompts from them.
*/
export declare function createThreadHistoryFilter(messages: MastraDBMessage[]): (part: unknown, runId: string) => boolean;
export {};
//# sourceMappingURL=thread-history.d.ts.map