feat(documents): per-egress notice + document-AI capability probe

Add GET /api/documents/inbound/capability (document provider order + vendor-blind
egress class), repoint the vault capability hook to it, and show a per-egress
notice in the detail sheet before a document read leaves the machine. Cover the
document provider order, the egress consent gate, and the notice with tests.
i18n x6 + OpenAPI regenerated.

Co-Authored-By: Marc-André Bombeck
This commit is contained in:
Marc-André BombeckandMarc-André Bombeck committed 2026-07-08 23:59:56 +02:00
1 parent c1e11e284a
commit c825d4b501
18 files changed
+427 -32

No files matched your search

+73
View File
@@ -8905,6 +8905,27 @@ paths:
$ref: "#/components/schemas/ErrorEnvelope"
"422": *a3
"429": *a4
/api/documents/inbound/capability:
get:
tags:
- Documents
summary: Probe document-AI availability + egress
description: "Cheap probe (no provider call) the vault uses to decide the AI transport and whether to warn before a read
leaves the machine. Resolved over the DOCUMENT provider order (local-first, ChatGPT-subscription OAuth last), so
`mode` / `pdfSupported` / `egress` match exactly what the document AI routes do. `egress` is vendor-blind:
`\"local\"` (a self-hosted model — the document never leaves the operator's machine) or `\"external\"` (a
third-party AI service). The vault shows a per-egress notice before any external document read; sending a
document to any external provider also requires an active AI-consent receipt."
responses:
"200":
description: Document-AI capability flags + egress class.
content:
application/json:
schema:
$ref: "#/components/schemas/DocumentAiCapabilityEnvelope"
"401": *a1
"422": *a3
"429": *a4
/api/documents/inbound/usage:
get:
tags:
@@ -26253,6 +26274,58 @@ components:
- data
- error
additionalProperties: false
DocumentAiCapabilityEnvelope:
type: object
properties:
data:
$ref: "#/components/schemas/DocumentAiCapability"
error:
type: "null"
meta:
type: object
properties:
requestId:
type: string
additionalProperties: false
required:
- data
- error
additionalProperties: false
DocumentAiCapability:
type: object
properties:
available:
type: boolean
mode:
anyOf:
- type: string
enum:
- vision
- text
- type: "null"
reason:
anyOf:
- type: string
enum:
- no-provider
- enable-local-ocr
- type: "null"
pdfSupported:
type: boolean
egress:
anyOf:
- type: string
enum:
- local
- external
- type: "null"
required:
- available
- mode
- reason
- pdfSupported
- egress
additionalProperties: false
DocumentUsageEnvelope:
type: object
properties: