n8n
Version:
n8n Workflow Automation Tool
41 lines (40 loc) • 1.33 kB
TypeScript
export declare const AGENT_KNOWLEDGE_COMMANDS: readonly ["git_grep", "cat", "sed"];
export type AgentKnowledgeCommand = (typeof AGENT_KNOWLEDGE_COMMANDS)[number];
export type AgentKnowledgeCommandRequest = {
command: 'git_grep';
pattern: string;
outputMode?: 'count';
caseInsensitive?: boolean;
fixedStrings?: boolean;
context?: number;
files?: string[];
} | {
command: 'cat';
file: string;
} | {
command: 'sed';
file: string;
startLine: number;
endLine: number;
};
export interface AgentKnowledgeCommandResult {
command: AgentKnowledgeCommand;
exitCode: number | null;
stdout: string;
stderr: string;
truncated: boolean;
}
export declare class AgentKnowledgeCommandService {
private readonly cachedWorkspaces;
private readonly workspaceLocks;
run(workspaceRoot: string, request: AgentKnowledgeCommandRequest): Promise<AgentKnowledgeCommandResult>;
withCachedWorkspace<T>(cacheKey: string, materialize: (workspaceRoot: string) => Promise<void>, operation: (workspaceRoot: string) => Promise<T>): Promise<T>;
private serializeByKey;
private ensureCachedWorkspace;
private evictStaleWorkspaces;
private directoryExists;
private toSpawnArgs;
private safePath;
private hasControlCharacters;
private spawnCommand;
}