@mastra/core
Version:
36 lines • 1.7 kB
TypeScript
import type { MessageList } from '../agent/message-list/index.js';
import type { ProcessInputStepArgs } from '../processors/index.js';
import type { ChatChannelRenderContext } from './output-processor.js';
import type { ChannelContext } from './types.js';
/** Rebuilds a channel-backed thread's channel context; `AgentChannels` provides it. */
interface ChannelThreadResolver {
buildChannelContextForThread(threadId: string): Promise<{
channel: ChannelContext;
render: ChatChannelRenderContext;
} | null>;
}
/**
* Input processor that injects channel context (platform, bot identity, DM vs.
* public-channel guidance) into the agent's system prompt on every step.
*
* Every run on a channel-backed thread gets the same system message, whether
* it came in over the channel or not (a schedule, a Studio prompt, a signal
* waking the agent). Messages that came in over the channel carry a `platform`
* attribute, which is how the model tells them apart, so the prompt never has
* to change and stays cached when a thread switches between the two.
*
* Added automatically by `AgentChannels` unless you provide your own input
* processor with `id === 'chat-channel-context'`. Output rendering (tool cards,
* text messages, approval prompts) is handled separately by
* `AgentChannels.consumeAgentStream`.
*/
export declare class ChatChannelProcessor {
#private;
readonly id = "chat-channel-context";
constructor(channels?: ChannelThreadResolver);
processInputStep({ messageList, requestContext, tools, state, }: ProcessInputStepArgs): Promise<{
messageList: MessageList;
} | undefined>;
}
export {};
//# sourceMappingURL=processor.d.ts.map