refactor(FN-2161): standardize on createFnAgent naming

- Rename engine export and call sites to use createFnAgent consistently across runtime flows
- Update core lazy engine loader and dashboard agent-generation/planning/chat paths to reference createFnAgent
- Refresh affected unit and integration tests, including renaming pi-create-kb-agent.test.ts to pi-create-fn-agent.test.ts
- Update AGENTS.md documentation references to match the new createFnAgent name
This commit is contained in:
Fusion
2026-04-19 17:50:41 -07:00
committed by gsxdsm
parent 0df3234349
commit 6714f7654b
58 changed files with 425 additions and 425 deletions

View File

@@ -618,7 +618,7 @@ const AI_AUTOMATION_SYSTEM_PROMPT = [
].join("\n");
/**
* Create an AiPromptExecutor that uses createKbAgent for real AI execution.
* Create an AiPromptExecutor that uses createFnAgent for real AI execution.
*
* Each call creates a fresh agent session, runs the prompt, collects the
* text response, and disposes the session.
@@ -629,13 +629,13 @@ const AI_AUTOMATION_SYSTEM_PROMPT = [
export async function createAiPromptExecutor(cwd: string): Promise<AiPromptExecutor> {
// We import lazily to keep the factory self-contained and to avoid
// pulling pi.ts into the module graph when AI execution isn't used.
const { createKbAgent, promptWithFallback } = await import("./pi.js");
const { createFnAgent, promptWithFallback } = await import("./pi.js");
const disposeLog = createLogger("cron-runner");
return async (prompt: string, modelProvider?: string, modelId?: string): Promise<string> => {
let responseText = "";
const { session } = await createKbAgent({
const { session } = await createFnAgent({
cwd,
systemPrompt: AI_AUTOMATION_SYSTEM_PROMPT,
tools: "readonly",