char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: Refactor data-attrs constants, enum for bool strings (#27002)bdffafa5d

char/aliceai-t5-moe
1.4 KiB38 linesraw
1/** Number of trailing characters to keep visible when partially redacting mcp-session-id */
2const MCP_SESSION_ID_VISIBLE_CHARS = 5;
3
4/** HTTP header handling for API and MCP requests. */
5export const HEADERS = {
6	/** Canonical casing for the Authorization header (RFC 7235) */
7	AUTHORIZATION: 'Authorization',
8	/** Bearer scheme prefix used for Authorization headers (RFC 6750) */
9	BEARER: 'Bearer ',
10	/** Content-Type HTTP header name */
11	CONTENT_TYPE: 'Content-Type',
12	/** Partial-redaction rules for MCP headers: header name -> visible trailing chars */
13	PARTIAL_REDACT: new Map<string, number>([['mcp-session-id', MCP_SESSION_ID_VISIBLE_CHARS]]),
14
15	/** Header names whose values should be redacted in diagnostic logs */
16	REDACTED: new Set([
17		'authorization',
18		'api-key',
19		'cookie',
20		'mcp-session-id',
21		'proxy-authorization',
22		'set-cookie',
23		'x-auth-token',
24		'x-api-key'
25	]),
26
27	/** Header carrying the stream-session identity (conversation id, optionally with a model suffix) */
28	X_CONVERSATION_ID_HEADER: 'X-Conversation-Id',
29
30	/** Header asking the server to encode a tool's output differently, e.g. read_file returning base64. */
31	X_RESP_TYPE_HEADER: 'x-resp-type',
32
33	/** Header carrying the working directory a tool call runs in; the model cannot override it */
34	X_TOOL_CWD_HEADER: 'x-tool-cwd'
35};
36
37/** `X_RESP_TYPE_HEADER` value that makes read_file return raw bytes as base64 instead of text. */
38export const RESP_TYPE_BASE64 = 'base64';