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>
This commit is contained in:
lorentz 2026-04-29 10:59:40 -04:00
parent ea3471d38d
commit 8f8b5ab7be
53 changed files with 9377 additions and 33 deletions

View file

@ -63,6 +63,7 @@ export function getAllEntitiesInOrder(): EntityType[] {
EntityType.PROJECTS,
EntityType.PROJECT_PHASES,
EntityType.TICKETS,
EntityType.TICKET_NOTES,
EntityType.TASKS,
EntityType.CONFIGURATION_ITEMS,
EntityType.CONTRACTS,
@ -289,6 +290,7 @@ export function buildDateRangeFilter(
// Note: TIME_ENTRIES removed because Autotask API doesn't support date filtering on TimeEntry
const timeBasedEntities = [
EntityType.TICKETS,
EntityType.TICKET_NOTES,
EntityType.TASKS,
];
@ -310,7 +312,7 @@ export function buildDateRangeFilter(
[EntityType.RESOURCES]: null,
[EntityType.CONTACTS]: null,
[EntityType.CONFIGURATION_ITEMS]: null,
[EntityType.TICKET_NOTES]: null,
[EntityType.TICKET_NOTES]: 'lastActivityDate',
[EntityType.TAG_GROUPS]: null,
[EntityType.TAGS]: null,
[EntityType.STATUSES]: null,