@mastra/core
Version:
57 lines • 2.53 kB
TypeScript
import type { MessageList, MastraDBMessage } from '../agent/message-list/index.js';
import type { ProcessInputStepArgs, Processor } from './index.js';
export interface ToolResultReminderOptions {
reminderText?: string;
maxTokens?: number;
pathExists?: (path: string) => boolean;
isDirectory?: (path: string) => boolean;
readFile?: (path: string) => string;
getIgnoredInstructionPaths?: (args: ProcessInputStepArgs) => string[];
/**
* When provided and returning false for a request, no instruction-file
* reminders are injected at all. Lets hosts suppress ingestion of
* instruction files from untrusted checkouts (e.g. a PR branch under
* review), where AGENTS.md content is attacker-controlled.
*/
isEnabled?: (args: ProcessInputStepArgs) => boolean;
/**
* Per-request override for how instruction files are located and read.
* When it returns a reader, that reader replaces the instance-level
* pathExists/isDirectory/readFile for this request — e.g. serving content
* from a trusted git ref instead of an untrusted working tree. Returning
* undefined keeps the instance defaults.
*/
getReader?: (args: ProcessInputStepArgs) => ReminderFileReader | undefined;
}
/** Filesystem-shaped read access used to locate and read instruction files. */
export interface ReminderFileReader {
pathExists: (path: string) => boolean;
isDirectory: (path: string) => boolean;
readFile: (path: string) => string;
}
/**
* Injects a persisted UI-visible reminder when the agent just interacted with
* a path whose directory ancestry contains an instruction file such as AGENTS.md.
*/
export declare class AgentsMDInjector implements Processor<'agents-md-injector'> {
id: "agents-md-injector";
name: string;
description: string;
processorIndex: number;
private readonly reminderText?;
private readonly maxTokens;
private readonly pathExists;
private readonly isDirectory;
private readonly readFile;
private readonly getIgnoredInstructionPaths?;
private readonly isEnabled?;
private readonly getReader?;
constructor(options: ToolResultReminderOptions);
processInputStep(args: ProcessInputStepArgs): Promise<MessageList | MastraDBMessage[]>;
private getReminderText;
private isIgnoredInstructionPath;
private findReferencedInstructionPath;
private findInstructionPathInInvocation;
private hasReminderAlready;
}
//# sourceMappingURL=tool-result-reminder.d.ts.map