@mastra/core
Version:
35 lines • 1.86 kB
TypeScript
import type { IMastraLogger } from '../../../logger/index.js';
import type { CoreTool } from '../../../tools/types.js';
import type { MessageList, MessageListInput } from '../../message-list/index.js';
/** Fire `onOutput` for correlated client-executed tool results on a follow-up request. */
export declare function fireClientToolOutputHooks({ messages, tools, abortSignal, logger, }: {
messages: MessageListInput;
tools?: Record<string, CoreTool>;
abortSignal?: AbortSignal;
logger?: Pick<IMastraLogger, 'error'>;
}): Promise<void>;
/**
* Apply a server-defined `toModelOutput` to client-supplied tool results.
*
* Client-side tools (no `execute`) never pass through the tool-execution step,
* so their results never get `toModelOutput` applied there. Mirror the AI SDK
* (`convertToModelMessages` maps every tool result, client-supplied included)
* by computing the mapping at ingestion and caching it at
* `providerMetadata.mastra.modelOutput` — the exact contract the execution
* path writes — so prompt conversion restores it with no downstream changes.
*
* Only this request's input messages are walked: results in memory-recalled
* history either already carry the cached mapping from the request that
* ingested them, or predate it and stay raw — re-mapping them here would
* re-run user code on every request without ever persisting.
*
* Mutates the MessageList's stored messages in place on purpose: prompt
* building reads these same part objects, and messages saved to memory carry
* the enrichment so reloads are cheap and idempotent.
*/
export declare function applyClientToolModelOutput({ messageList, tools, logger, }: {
messageList: MessageList;
tools?: Record<string, CoreTool>;
logger?: Pick<IMastraLogger, 'error'>;
}): Promise<void>;
//# sourceMappingURL=client-tool-output-hooks.d.ts.map