managarten/apps/api
Till JS 5aeae87474 feat(api/web): wire-format envelope versioning + Anthropic prompt-cache hints
Adds AI_SCHEMA_VERSION + AiResponseEnvelope<T> in @mana/shared-types so
every AI structured-output endpoint speaks { schemaVersion, data }.
Backend wraps via envelope() in each module routes.ts; frontend api.ts
unwraps via unwrapEnvelope<T>() which throws AiSchemaVersionMismatchError
on drift — actionable network-panel error instead of cascading
'field is undefined' bugs further down the stack.

Also adds providerOptions.anthropic.cacheControl on the system message
in nutriphi + planta routes via SYSTEM_CACHE_HINT. NO-OP today (Gemini
backend, ~50-token prompts under the 1024-token cache minimum) but
lights up automatically when mana-llm routes to Claude or prompts grow
past the threshold. ~5 lines per route, no risk.

System messages migrated from system: shorthand to a full messages[]
entry — the only way to attach providerOptions per-message in the AI SDK.

13 new tests in nutriphi/ai-schemas.test.ts cover the version constant,
the mismatch error shape, and Zod accept/reject for both schemas. Total
nutriphi + planta suite: 62/62.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 17:21:19 +02:00
..
drizzle/research feat(questions): deep-research module — mana-search + mana-llm pipeline 2026-04-08 22:15:35 +02:00
src feat(api/web): wire-format envelope versioning + Anthropic prompt-cache hints 2026-04-09 17:21:19 +02:00
Dockerfile fix(api/Dockerfile): switch builder stage to node:20-alpine 2026-04-09 14:10:59 +02:00
drizzle.config.ts feat(questions): deep-research module — mana-search + mana-llm pipeline 2026-04-08 22:15:35 +02:00
package.json feat(shared-types): add Zod schemas for AI structured outputs 2026-04-09 16:59:28 +02:00
tsconfig.json feat(api): create unified API server with first 3 modules 2026-04-02 21:12:15 +02:00