ui: Constants refactor (#26908)

* refactor: Constants

* refactor: Constants/Enums cleanup

* refactor: Constant objects instead of multiple single value constants

* refactor: Cleanup constants
This commit is contained in:
Aleksander Grygier
2026-08-13 06:53:56 +02:00
committed by GitHub
parent 8e7f22b67e
commit e21152dc96
209 changed files with 1101 additions and 1137 deletions
@@ -0,0 +1,35 @@
/** HTTP header handling for API and MCP requests. */
export const HEADERS = {
/** Canonical casing for the Authorization header (RFC 7235) */
AUTHORIZATION: 'Authorization',
/** Bearer scheme prefix used for Authorization headers (RFC 6750) */
BEARER: 'Bearer ',
/** Content-Type HTTP header name */
CONTENT_TYPE: 'Content-Type',
/** Partial-redaction rules for MCP headers: header name -> visible trailing chars */
PARTIAL_REDACT: new Map<string, number>([['mcp-session-id', 5]]),
/** Header names whose values should be redacted in diagnostic logs */
REDACTED: new Set([
'authorization',
'api-key',
'cookie',
'mcp-session-id',
'proxy-authorization',
'set-cookie',
'x-auth-token',
'x-api-key'
]),
/** Header carrying the stream-session identity (conversation id, optionally with a model suffix) */
X_CONVERSATION_ID_HEADER: 'X-Conversation-Id',
/** Header asking the server to encode a tool's output differently, e.g. read_file returning base64. */
X_RESP_TYPE_HEADER: 'x-resp-type',
/** Header carrying the working directory a tool call runs in; the model cannot override it */
X_TOOL_CWD_HEADER: 'x-tool-cwd'
};
/** `X_RESP_TYPE_HEADER` value that makes read_file return raw bytes as base64 instead of text. */
export const RESP_TYPE_BASE64 = 'base64';