← Files Frontier InfraARCHIVED FILE

evals/fixtures/typescript-agent-service/src/service.ts

657 Bytes · Oct 3, 2026 · 06:31 UTC

↓ Download file

export interface ExistingQueue {
  claim(): Promise<{ id: string; prompt: string } | null>;
  acknowledge(id: string): Promise<void>;
}

export interface ExistingDatabase {
  recordResult(id: string, result: string): Promise<void>;
}

export interface ExistingWorker {
  run(prompt: string): Promise<string>;
}

export async function processNext(
  queue: ExistingQueue,
  database: ExistingDatabase,
  worker: ExistingWorker,
): Promise<boolean> {
  const job = await queue.claim();
  if (!job) return false;

  const result = await worker.run(job.prompt);
  await database.recordResult(job.id, result);
  await queue.acknowledge(job.id);
  return true;
}

SHA-256: e00222031d0f49ede26e65437bf376f433db32320c33788a57807c0631b85c0e