feat(HAI-002): add scheduler config endpoint to dashboard API

This commit is contained in:
Dustin Byrne
2026-03-25 18:52:08 -04:00
parent aaa1f4bddb
commit f5dbcd5c81
3 changed files with 11 additions and 0 deletions

View File

@@ -39,3 +39,7 @@ export function deleteTask(id: string): Promise<Task> {
export function mergeTask(id: string): Promise<MergeResult> {
return api<MergeResult>(`/tasks/${id}/merge`, { method: "POST" });
}
export function fetchConfig(): Promise<{ maxConcurrent: number }> {
return api<{ maxConcurrent: number }>("/config");
}

View File

@@ -6,6 +6,11 @@ import type { ServerOptions } from "./server.js";
export function createApiRoutes(store: TaskStore, options?: ServerOptions): Router {
const router = Router();
// Scheduler config
router.get("/config", (_req, res) => {
res.json({ maxConcurrent: options?.maxConcurrent ?? 2 });
});
// List all tasks
router.get("/tasks", async (_req, res) => {
try {

View File

@@ -11,6 +11,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
export interface ServerOptions {
/** Custom merge handler — when provided, used instead of store.mergeTask */
onMerge?: (taskId: string) => Promise<MergeResult>;
/** Maximum concurrent worktrees / execution slots (default 2) */
maxConcurrent?: number;
}
export function createServer(store: TaskStore, options?: ServerOptions): ReturnType<typeof express> {