feat(webui): support document attachments with ingress safeguards (#4771)
* feat: support document attachments in webui * fix(webui): normalize document attachment MIME * refactor(webui): move attachment policy out of channel * fix(webui): reject oversized attachments before send * fix(webui): align Portuguese attachment errors * refactor(webui): separate ingress and transport limits * fix(webui): reject malformed attachment payloads
This commit is contained in:
@@ -81,8 +81,8 @@ type RunStatusHandler = (chatId: string, startedAt: number | null) => void;
|
||||
*/
|
||||
export type StreamError =
|
||||
/** Server rejected the inbound frame as too large (WS close code 1009).
|
||||
* Typically means the user attached images whose base64 size exceeded
|
||||
* ``maxMessageBytes`` on the server. */
|
||||
* This is the transport fallback after text and attachment policies have
|
||||
* already been checked independently. */
|
||||
| { kind: "message_too_big" }
|
||||
| { kind: "workspace_scope_rejected"; reason?: string; chatId?: string };
|
||||
|
||||
|
||||
+26
-5
@@ -308,11 +308,33 @@ export interface BootstrapResponse {
|
||||
ws_path: string;
|
||||
ws_url?: string | null;
|
||||
expires_in: number;
|
||||
limits?: WebUIIngressLimits;
|
||||
model_name?: string | null;
|
||||
runtime_surface?: RuntimeSurface;
|
||||
runtime_capabilities?: RuntimeCapabilities;
|
||||
}
|
||||
|
||||
export interface WebUITransportLimits {
|
||||
max_frame_bytes: number;
|
||||
envelope_reserve_bytes: number;
|
||||
}
|
||||
|
||||
export interface WebUIMessageLimits {
|
||||
max_text_bytes: number;
|
||||
}
|
||||
|
||||
export interface WebUIAttachmentLimits {
|
||||
max_count: number;
|
||||
max_file_bytes: number;
|
||||
max_total_bytes: number;
|
||||
}
|
||||
|
||||
export interface WebUIIngressLimits {
|
||||
transport: WebUITransportLimits;
|
||||
message: WebUIMessageLimits;
|
||||
attachments: WebUIAttachmentLimits;
|
||||
}
|
||||
|
||||
export type RuntimeSurface = "browser" | "native";
|
||||
export type RestartBehavior = "none" | "nextTurn" | "engineRestart" | "appRestart";
|
||||
export type SettingsApplyStatus =
|
||||
@@ -1050,12 +1072,11 @@ export type InboundEvent =
|
||||
}
|
||||
| { event: "error"; chat_id?: string; detail?: string; reason?: string };
|
||||
|
||||
/** Base64-encoded image attached to an outbound ``message`` envelope.
|
||||
/** Base64-encoded file attached to an outbound ``message`` envelope.
|
||||
*
|
||||
* ``data_url`` must be a ``data:image/<png|jpeg|webp|gif>;base64,...`` string
|
||||
* — the server whitelists those MIME types and rejects everything else
|
||||
* (including SVG, to avoid an XSS surface). ``name`` is advisory: it's
|
||||
* preserved for the file on disk and surfaced as the placeholder label when
|
||||
* ``data_url`` must use a server-whitelisted image, video, or document MIME
|
||||
* type. SVG remains rejected on ingress to avoid an embedded-script XSS
|
||||
* surface. ``name`` is advisory and is surfaced as the placeholder label when
|
||||
* the session is replayed.
|
||||
*/
|
||||
export interface OutboundMedia {
|
||||
|
||||
Reference in New Issue
Block a user