( db: ReturnType<typeof getDatabase>, runtimeId: string, workspaceId?: string, )
| 833 | } |
| 834 | |
| 835 | function selectQueuedTaskForRuntime( |
| 836 | db: ReturnType<typeof getDatabase>, |
| 837 | runtimeId: string, |
| 838 | workspaceId?: string, |
| 839 | ): Record<string, unknown> | undefined { |
| 840 | return db |
| 841 | .prepare( |
| 842 | `SELECT id |
| 843 | FROM agent_task_queue |
| 844 | WHERE runtime_id = ? AND status = 'queued' |
| 845 | ${typeof workspaceId === "string" ? "AND workspace_id = ?" : ""} |
| 846 | ORDER BY priority DESC, created_at ASC |
| 847 | LIMIT 1`, |
| 848 | ) |
| 849 | .get(...(typeof workspaceId === "string" ? [runtimeId, workspaceId] : [runtimeId])) as Record<string, unknown> | undefined; |
| 850 | } |
| 851 | |
| 852 | function selectFallbackQueuedTaskForRuntime( |
| 853 | db: ReturnType<typeof getDatabase>, |
no test coverage detected