MCPcopy Create free account
hub / github.com/HKUDS/AgentSpace / selectQueuedTaskForRuntime

Function selectQueuedTaskForRuntime

packages/db/src/task-queue.ts:835–850  ·  view source on GitHub ↗
(
  db: ReturnType<typeof getDatabase>,
  runtimeId: string,
  workspaceId?: string,
)

Source from the content-addressed store, hash-verified

833}
834
835function 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
852function selectFallbackQueuedTaskForRuntime(
853 db: ReturnType<typeof getDatabase>,

Callers 1

Calls 2

getMethod · 0.80
prepareMethod · 0.80

Tested by

no test coverage detected