Merge origin/release/v1.46.0 into feat/v146-ai

This commit is contained in:
Marc-André Bombeck committed 2026-10-24 11:03:44 +02:00
commit 96eeec6080
47 files changed
+2588 -1122

No files matched your search

@@ -76,9 +76,9 @@ vi.mock("@/lib/ai/coach/budget", () => ({
resolveDailyCapFor: vi.fn(() => 1000),
resolveCostOwner: vi.fn(() => "operator" as const),
}));
vi.mock("@/lib/documents/extract", () => ({
vi.mock("@/lib/documents/extract", async (importOriginal) => ({
...(await importOriginal<typeof import("@/lib/documents/extract")>()),
runInboundExtraction: vi.fn(),
InboundExtractError: class InboundExtractError extends Error {},
}));
vi.mock("@/lib/modules/gate", () => ({
@@ -6,9 +6,11 @@
* It carries the entire ingest gauntlet that upload used to run inline —
* requireAiCapability("documentAi") → resolve document provider (local-first,
* codex last) and re-check the capability for that pick, consent receipt
* included → rate-limit → reserveBudget → runInboundExtraction → reconcileSpend → stage
* facts — but now against a row that already exists. Absent a provider this 422s
* the ENHANCEMENT only; the stored document is untouched and remains filed.
* included → rate-limit → reserveBudget → runInboundExtraction (the document
* read a page or a part at a time, every read after the first reserved on its
* own) → reconcileSpend → stage facts — but now against a row that already
* exists. Absent a provider this 422s the ENHANCEMENT only; the stored
* document is untouched and remains filed.
*
* Three modes:
* - VISION (no JSON body): decrypt the stored original, re-derive its MIME,
@@ -244,17 +246,18 @@ async function runNow(
origin: { ipAddress: getClientIp(request), worker: false },
});
if (!outcome.ok) return outcomeResponse(outcome);
const { document: staged } = outcome.data;
return apiSuccess(
serialiseDocumentDetail(
outcome.data,
outcome.data.facts,
staged,
staged.facts,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
await markerIndexForFacts(userId, outcome.data.facts),
await markerIndexForFacts(userId, staged.facts),
),
);
}