feat(HAI-002): add scheduler config endpoint to dashboard API
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user