wulf-pulse/app/api/analyzer/jobs/[jobId]/route.ts
lorentz 8f8b5ab7be feat: AI ticket analyzer (phases 1-6)
Multi-stage LLM pipeline that produces structured analyses of Autotask
tickets from local Postgres. Migration 069 + Zod schemas, Stage 0
preprocessor, IT Glue redaction + search, Anthropic SDK wrapper, Stages
1/3/4 (Haiku/Sonnet/Opus), pipeline + cost circuit breaker, job worker
(opt-in autostart), 6 API routes, 3 frontend pages, share-row
persistence (email send deferred to phase 7). 128 vitest tests, tsc
clean. Build journal in docs/wulf-pulse-ticket-analyzer-build-notes.md.

Sync: adds syncTicketNotes() + ticket_notes to ordered/date-filtered
entities so the analyzer's local mirror stays current via scheduler.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 10:59:40 -04:00

25 lines
679 B
TypeScript

/**
* GET /api/analyzer/jobs/:jobId
*
* Returns the current status of an analyzer job. Frontend polls this every
* ~2 seconds during a run.
*/
import { NextResponse } from 'next/server';
import { requireAuth } from '@/lib/auth-utils';
import { getJob } from '@/lib/services/analyzer/persistence';
export async function GET(
_request: Request,
{ params }: { params: Promise<{ jobId: string }> }
) {
const { error } = await requireAuth();
if (error) return error;
const { jobId } = await params;
const job = await getJob(jobId);
if (!job) {
return NextResponse.json({ error: 'Job not found' }, { status: 404 });
}
return NextResponse.json({ job });
}