0c38fcaf85e0fe49bd8f48281f6eadc0557f454b
Task 13 of the slice plan. Drives the pending → done/failed transitions: - enqueue() pushes a Job and kicks the loop; loadFromDb() rehydrates pending_jobs at startup so app restart resumes in-flight work. - drain() exposes a Promise for tests + graceful shutdown. - Concurrency 1: a single async loop awaits each provider call before the next, matching spec §2.2. - 3-attempt backoff (default [0, 30s, 120s]; tests inject [0,0,0]). Each failure logs ai.retry, increments pending_jobs.attempts, and on the final attempt calls markAiFailed and emits onUpdate. - emit() pushes the freshly-hydrated note to onUpdate (used by Task 30 to fan out IPC note:updated events). Verification: `npx vitest run tests/unit/AiWorker.test.ts` 4 passed. Suite total 41 / 41. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Description
No description provided
Releases
18
Languages
TypeScript
99.6%
HTML
0.3%
JavaScript
0.1%