refactor(api): extract assistant chat orchestration

This commit is contained in:
2026-03-31 22:44:54 +02:00
parent 1b5f19c72c
commit 64111a9013
6 changed files with 522 additions and 214 deletions
@@ -45,5 +45,25 @@ describe("assistant tool selection", () => {
expect(selectedNames).toContain("get_resource_holidays");
expect(selectedNames).toContain("list_holidays_by_region");
expect(selectedNames).toContain("list_holiday_calendars");
expect(selectedNames).toContain("get_vacation_balance");
expect(selectedNames).toContain("get_entitlement_summary");
expect(selectedNames).toContain("list_vacations_upcoming");
});
it("prioritizes report and dashboard tools for reporting requests", () => {
const allPermissions = Object.values(PermissionKey);
const selectedNames = getSelectedToolNames(
allPermissions,
[{ role: "user", content: "Build me a dashboard report for monthly SAH, budget forecast and project health." }],
SystemRole.ADMIN,
"/dashboard",
);
expect(selectedNames.length).toBeLessThanOrEqual(128);
expect(selectedNames).toContain("get_dashboard_detail");
expect(selectedNames).toContain("get_budget_forecast");
expect(selectedNames).toContain("get_project_health");
expect(selectedNames).toContain("run_report");
expect(selectedNames).toContain("get_statistics");
});
});