feat(queue): implement queue scheduler service and API routes

- Added QueueSchedulerService to manage task queue lifecycle, including state machine, dependency resolution, and session management.
- Implemented HTTP API endpoints for queue scheduling:
  - POST /api/queue/execute: Submit items to the scheduler.
  - GET /api/queue/scheduler/state: Retrieve full scheduler state.
  - POST /api/queue/scheduler/start: Start scheduling loop with items.
  - POST /api/queue/scheduler/pause: Pause scheduling.
  - POST /api/queue/scheduler/stop: Graceful stop of the scheduler.
  - POST /api/queue/scheduler/config: Update scheduler configuration.
- Introduced types for queue items, scheduler state, and WebSocket messages to ensure type safety and compatibility with the backend.
- Added static model lists for LiteLLM as a fallback for available models.
This commit is contained in:
catlog22
2026-02-27 20:53:46 +08:00
parent 5b54f38aa3
commit 75173312c1
47 changed files with 3813 additions and 307 deletions

View File

@@ -1197,3 +1197,30 @@ export function getToolSessionPath(tool: string): string | null {
const discoverer = discoverers[tool];
return discoverer?.basePath || null;
}
/**
* List all native sessions from all supported CLI tools
* Aggregates sessions from Gemini, Qwen, Codex, Claude, and OpenCode
* @param options - Optional filtering (workingDir, limit, afterTimestamp)
* @returns Combined sessions sorted by updatedAt descending
*/
export function listAllNativeSessions(options?: SessionDiscoveryOptions): NativeSession[] {
const allSessions: NativeSession[] = [];
// Collect sessions from all discoverers
for (const tool of Object.keys(discoverers)) {
const discoverer = discoverers[tool];
const sessions = discoverer.getSessions(options);
allSessions.push(...sessions);
}
// Sort by updatedAt descending
allSessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
// Apply limit if provided
if (options?.limit) {
return allSessions.slice(0, options.limit);
}
return allSessions;
}