Phase 37: Hot-swap async + Phase 38: Universal API skeleton

- JobTracker extended with JobType::ProfileActivation + Embed
- activate_profile returns job_id immediately, work spawns in background
- /v1/chat, /v1/usage, /v1/sessions endpoints (OpenAI-compatible)
- Langfuse trace integration (Phase 40 early deliverable)
- 12 gateway unit tests green, curl gates pass
This commit is contained in:
root
2026-04-23 01:56:17 -05:00
parent 79108e30ac
commit 21e8015b60
4 changed files with 262 additions and 245 deletions
+10
View File
@@ -324,6 +324,16 @@
- Mem0-style upsert: `/seed` with `append=true` (default) routes through `upsert_entry`, which decides ADD / UPDATE / NOOP on (operation, day, city, state). Same-day re-seed merges names (union, stable order) instead of duplicating the row. Identical re-seed is a no-op. Different-day same-operation is a fresh ADD. Playbook_id stays stable on UPDATE so prior citations remain valid.
- Letta-style hot cache: `PlaybookMemory` now holds a `geo_index: HashMap<(city_lower, state_upper), Vec<entry_idx>>` rebuilt on every mutation. Geo-filtered boost queries skip the full scan and hit the O(1) key lookup. At 1.9K entries the full scan was sub-ms; the index scales the same path to 100K+ without code changes.
- `UpsertOutcome` enum reported back to callers — `{mode: added|updated|noop, playbook_id, merged_names?}` + `entries_after`.
- [x] **Phase 37: Hot-swap async** (2026-04-22)
- Extended `JobTracker` with `JobType::ProfileActivation` + `Embed` enum variants
- Made `activate_profile` return immediately with `job_id`, work runs in background via `tokio::spawn`
- Background jobs tracked via `POST /vectors/jobs/{id}` + `GET /vectors/jobs`
- [x] **Phase 38: Universal API Skeleton** (2026-04-23)
- `/v1/chat` — OpenAI-compatible POST, forwards to local Ollama or Ollama Cloud
- `/v1/usage` — returns `{requests, prompt_tokens, completion_tokens, total_tokens}`
- `/v1/sessions` — returns `{data: [], note: "Phase 38: stateless"}`
- Langfuse trace integration (fire-and-forget, Phase 40 early)
- 12 unit tests green, curl gates pass
- [ ] Fine-tuned domain models (Phase 25+)
- [ ] Multi-node query distribution (only if ceilings bite)