char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
7077abbe1
char/aliceai-t5-moe
1/** 2* Browser fallback for the server's `get_info` tool, offered only when the 3* server does not serve one (llama-server without --agent). It tells the model 4* which OS the browser runs on and that there is no local file or shell access, 5* so it does not plan around tools that are not there. 6* 7* @see server_tool_get_info in tools/server/server-tools.cpp - the served variant 8* @see buildBrowserInfoToolDefinition in constants/browser-info.ts - tool schema sent to the LLM 9*/ 10 11import { browser } from '$app/environment' ; 12import { 13BROWSER_INFO_NOTE , 14BROWSER_INFO_OS_UA_PATTERNS , 15BROWSER_INFO_OS_UNKNOWN 16} from '$lib/constants' ; 17import type { ToolExecutionResult } from '$lib/types' ; 18 19function detectOs ( userAgent :string ) :string { 20for ( const [ pattern , os ] of BROWSER_INFO_OS_UA_PATTERNS ) { 21if ( pattern . test ( userAgent )) return os ; 22} 23 24return BROWSER_INFO_OS_UNKNOWN ; 25} 26 27/** 28* Result shape mirrors the server tool's JSON so the `get_info` renderer reads 29* `os` the same way, minus `cwd` - there is no working directory to report. 30*/ 31export function executeBrowserInfoTool () :ToolExecutionResult { 32return { 33content :JSON . stringify ({ 34note :BROWSER_INFO_NOTE , 35os :browser ?detectOs ( navigator . userAgent ) :BROWSER_INFO_OS_UNKNOWN 36}), 37isError :false 38}; 39}