mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
- Move parseFunctionCall/parseFunctionResponse to ResponseHelper - Enhance orphaned call/response filtering with detailed debug logs - Add toolId to conversation content for better tracking - Fix planning workflow execution mechanics and step numbering - Remove unused planning agent appendix and detailedAppendixForPlanningAgent - Add conversation save callbacks throughout AI controller loops - Improve multi-agent function handling to avoid exceptions - Update all tests to include toolId fields for proper filtering
69 lines
No EOL
2.6 KiB
TypeScript
69 lines
No EOL
2.6 KiB
TypeScript
import type { IAIFunctionDefinition } from "./IAIFunctionDefinition";
|
|
import { SearchVaultFiles } from "./Functions/SearchVaultFiles";
|
|
import { ReadVaultFiles } from "./Functions/ReadVaultFiles";
|
|
import { WriteVaultFile } from "./Functions/WriteVaultFile";
|
|
import { DeleteVaultFiles } from "./Functions/DeleteVaultFiles";
|
|
import { MoveVaultFiles } from "./Functions/MoveVaultFiles";
|
|
import { ListVaultFiles } from "./Functions/ListVaultFiles";
|
|
import { PatchVaultFile } from "./Functions/PatchVaultFile";
|
|
import { CreatePlan } from "./Functions/CreatePlan";
|
|
import { Replan } from "./Functions/Replan";
|
|
import { CompleteStep } from "./Functions/CompleteStep";
|
|
import { SubmitPlan } from "./Functions/SubmitPlan";
|
|
import { CancelPlan } from "./Functions/CancelPlan";
|
|
|
|
export abstract class AIFunctionDefinitions {
|
|
|
|
// Definitions list provides a list of function definitions that does not include any planning functions (used as reference in planning agent prompt)
|
|
private static readonly definitionsList = [SearchVaultFiles, ReadVaultFiles, ListVaultFiles, WriteVaultFile, PatchVaultFile, DeleteVaultFiles, MoveVaultFiles];
|
|
|
|
// Definitions for the main agent
|
|
public static agentDefinitions(destructive: boolean): IAIFunctionDefinition[] {
|
|
let actions = [
|
|
SearchVaultFiles,
|
|
ReadVaultFiles,
|
|
ListVaultFiles
|
|
];
|
|
|
|
if (destructive) {
|
|
actions = actions.concat([
|
|
WriteVaultFile,
|
|
PatchVaultFile,
|
|
DeleteVaultFiles,
|
|
MoveVaultFiles,
|
|
CreatePlan
|
|
]);
|
|
}
|
|
|
|
return actions;
|
|
}
|
|
|
|
// Definitions for the planning agent
|
|
public static planningAgentDefinitions(): IAIFunctionDefinition[] {
|
|
return [SearchVaultFiles, ReadVaultFiles, ListVaultFiles, SubmitPlan];
|
|
}
|
|
|
|
// Definitions for the main agent during plan execution
|
|
public static agentExecutionDefinitions() {
|
|
return [
|
|
SearchVaultFiles,
|
|
ReadVaultFiles,
|
|
ListVaultFiles,
|
|
WriteVaultFile,
|
|
PatchVaultFile,
|
|
DeleteVaultFiles,
|
|
MoveVaultFiles,
|
|
CompleteStep,
|
|
Replan,
|
|
CancelPlan
|
|
];
|
|
}
|
|
|
|
public static compactSummaryForPlanningAgent(): string {
|
|
return this.definitionsList.map(definition => {
|
|
// Extract first line of description as brief purpose
|
|
const description = definition.description.split('\n')[0].trim();
|
|
return `| ${definition.name} | ${description} |`;
|
|
}).join("\n");
|
|
}
|
|
} |