char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
85d5703a3
char/aliceai-t5-moe
1import type { AgenticConfig } from '$lib/types/agentic' ; 2 3export const ATTACHMENT_SAVED_REGEX = / \[Attachment saved: ([^\]]+)\] / ; 4 5// JSON detection: an attachment placeholder also starts with `[`, but is 6// plain text (`[Attachment saved: ...]`), not an array literal. Require the 7// first array value (or the closing bracket for an empty array) to look like 8// a valid JSON token before attempting JSON.parse. 9export const TOOL_RESULT_JSON_OPEN_REGEX = / ^(?:\{|\[\s*(?:[[\]"{\-0-9]|true|false|null)) / ; 10 11// Search-summary wire format used by file-glob and grep tools: 12// <matches> 13// --- 14// Total matches: N 15export const SEARCH_SUMMARY = { 16SEPARATOR :'---\n' , 17TOTAL_REGEX :/ Total matches:\s*(\d+) / 18} as const ; 19 20// Separator rendered between stats in the tool-result footer (e.g. between a 21// result message and the byte/edit count). Plain ASCII spaces bracket a hyphen 22// so the whole " - " sits on one visual line even when the surrounding text 23// wraps mid-paragraph. 24export const RESULT_STAT_SEPARATOR = ' - ' ; 25 26// Separator between the assistant text sections of a grouped agentic 27// session when they are joined for the clipboard. 28export const AGENTIC_TEXT_COPY_SEPARATOR = '\n\n' ; 29 30export const DEFAULT_AGENTIC_CONFIG :AgenticConfig = { 31enabled :true , 32maxTurns :100 33} as const ; 34 35export const REASONING_TAGS = { 36END :'</think>' , 37START :'<think>' 38} as const ; 39 40/** 41* @deprecated Legacy marker tags - only used for migration of old stored messages. 42* New messages use structured fields (reasoningContent, toolCalls, toolCallId). 43*/ 44export const LEGACY_AGENTIC_TAGS = { 45TAG_SUFFIX :'>>>' , 46TOOL_ARGS_END :'<<<TOOL_ARGS_END>>>' , 47TOOL_ARGS_START :'<<<TOOL_ARGS_START>>>' , 48TOOL_CALL_END :'<<<AGENTIC_TOOL_CALL_END>>>' , 49TOOL_CALL_START :'<<<AGENTIC_TOOL_CALL_START>>>' , 50TOOL_NAME_PREFIX :'<<<TOOL_NAME:' 51} as const ; 52 53/** 54* @deprecated Legacy reasoning tags - only used for migration of old stored messages. 55* New messages use the dedicated reasoningContent field. 56*/ 57export const LEGACY_REASONING_TAGS = { 58END :'<<<reasoning_content_end>>>' , 59START :'<<<reasoning_content_start>>>' 60} as const ; 61 62/** 63* @deprecated Legacy regex patterns - only used for migration of old stored messages. 64*/ 65export const LEGACY_AGENTIC_REGEX = { 66AGENTIC_TOOL_CALL_BLOCK :/ \n*<<<AGENTIC_TOOL_CALL_START>>>[\s\S]*?<<<AGENTIC_TOOL_CALL_END>>> / g , 67AGENTIC_TOOL_CALL_OPEN :/ \n*<<<AGENTIC_TOOL_CALL_START>>>[\s\S]*$ / , 68COMPLETED_TOOL_CALL : 69/ <<<AGENTIC_TOOL_CALL_START>>>\n<<<TOOL_NAME:(.+?)>>>\n<<<TOOL_ARGS_START>>>([\s\S]*?)<<<TOOL_ARGS_END>>>([\s\S]*?)<<<AGENTIC_TOOL_CALL_END>>> / g , 70HAS_LEGACY_MARKERS :/ <<<(?:AGENTIC_TOOL_CALL_START|reasoning_content_start)>>> / , 71REASONING_BLOCK :/ <<<reasoning_content_start>>>[\s\S]*?<<<reasoning_content_end>>> / g , 72REASONING_EXTRACT :/ <<<reasoning_content_start>>>([\s\S]*?)<<<reasoning_content_end>>> / , 73REASONING_OPEN :/ <<<reasoning_content_start>>>[\s\S]*$ / 74} as const ;