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

@@ -11,7 +11,7 @@ const cronLoggerSpies = vi.hoisted(() => ({
}));
const piModuleMocks = vi.hoisted(() => ({
createKbAgent: vi.fn(),
createFnAgent: vi.fn(),
promptWithFallback: vi.fn(),
}));
@@ -24,7 +24,7 @@ vi.mock("./logger.js", () => ({
}));
vi.mock("./pi.js", () => ({
createKbAgent: piModuleMocks.createKbAgent,
createFnAgent: piModuleMocks.createFnAgent,
promptWithFallback: piModuleMocks.promptWithFallback,
}));
@@ -99,7 +99,7 @@ describe("CronRunner", () => {
beforeEach(() => {
vi.clearAllMocks();
piModuleMocks.promptWithFallback.mockResolvedValue(undefined);
piModuleMocks.createKbAgent.mockResolvedValue({
piModuleMocks.createFnAgent.mockResolvedValue({
session: {
dispose: vi.fn(),
},
@@ -145,7 +145,7 @@ describe("CronRunner", () => {
describe("createAiPromptExecutor", () => {
it("returns response text even when session disposal throws", async () => {
piModuleMocks.createKbAgent.mockImplementation(async (options: { onText?: (delta: string) => void }) => {
piModuleMocks.createFnAgent.mockImplementation(async (options: { onText?: (delta: string) => void }) => {
options.onText?.("hello ");
options.onText?.("world");
return {