eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
19 lines (18 loc) • 851 B
TypeScript
import type { ModelMessage } from "ai";
/**
* Converts provider-executed tool outcomes into replay-safe model messages.
*
* Provider SDKs can return a tool call and its result inside one assistant
* message. Each matching call is rewritten as a normal call and consecutive
* results are moved into a tool message at their original position when the
* call lacks the matching marker or shares an assistant message with a local
* tool call. Native provider-only call/result pairs remain untouched. Text
* before a result remains before it; text after a result remains after it.
*/
export declare function normalizeProviderToolHistory(input: {
readonly messages: readonly ModelMessage[];
readonly providerExecutedOutcomeIds: ReadonlySet<string>;
}): {
readonly messages: ModelMessage[];
readonly outcomeEndsResponse: boolean;
};