ui: Refactor Built-In Tools naming (Server/Browser) (#27271)

* server: rename built-in tools to server tools

* ui: rename built-in tools to server/browser tools
This commit is contained in:
Aleksander Grygier
2026-08-17 22:23:22 +02:00
committed by GitHub
parent 058df671b2
commit 0021a77de0
49 changed files with 315 additions and 286 deletions
-13
View File
@@ -1,13 +0,0 @@
import { BUILTIN_TOOL_UI } from '$lib/constants';
import type { BuiltinToolUiEntry } from '$lib/types';
/**
* Resolve the UI metadata (label + icon) for a built-in tool by its name.
* Falls back to null for unknown or non-built-in tools so callers can render
* a generic chrome instead.
*/
export function getBuiltinToolUi(toolName: string | undefined): BuiltinToolUiEntry | null {
if (!toolName) return null;
return (BUILTIN_TOOL_UI as Record<string, BuiltinToolUiEntry>)[toolName] ?? null;
}
+1 -1
View File
@@ -1,5 +1,5 @@
/**
* Frontend executor for the `get_datetime` tool. It runs in the browser, so it
* Browser executor for the `get_datetime` tool. It runs in the browser, so it
* reports the user's own clock and time zone instead of the server's UTC time -
* a chat about "tomorrow" means the user's tomorrow, not the host's.
*
+1 -1
View File
@@ -42,7 +42,7 @@ export async function runGlobSearch(
}
const res = await ToolsService.executeToolRaw(
BuiltInTool.FILE_GLOB_SEARCH,
BuiltInTool.SERVER_FILE_GLOB_SEARCH,
{ include: args.include, limit, max_depth: args.maxDepth, path: args.path, type },
signal
);
+4 -4
View File
@@ -127,7 +127,7 @@ export { sanitizeKeyValuePairKey, sanitizeKeyValuePairValue } from './sanitize';
// Image error fallback utilities
export { getImageErrorFallbackHtml } from './image-error-fallback';
// SSE-with-JSON stream iterator (used by built-in tool streaming, decoupled
// SSE-with-JSON stream iterator (used by server tool streaming, decoupled
// from chat.service.ts which embeds its own SSE parser for resume support)
export { parseSseJsonStream } from './sse';
@@ -310,7 +310,7 @@ export {
withAbortSignal
} from './abort';
// Tool-call meta utilities. Parsers for each built-in tool live next to
// Tool-call meta utilities. Parsers for each server tool live next to
// their renderer family under
// `src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/`.
// This module only carries the helpers that genuinely cross tool
@@ -321,7 +321,7 @@ export { tryParseToolResultObject } from './tool-call-meta';
// Per-tool UI metadata (label + icon) used by the tool-call chrome.
// Re-exported through $lib/utils so renderer components can read the
// label without depending on $lib/constants directly.
export { getBuiltinToolUi } from './built-in-tools';
export { getToolUi } from './tool-ui';
// Chat command picker
@@ -331,7 +331,7 @@ export { getChatCommands } from './chat-commands';
// SANDBOX_TOOL_DEFINITION is deprecated; kept for backward compatibility.
export { buildSandboxToolDefinition, SANDBOX_TOOL_DEFINITION } from './sandbox-tool';
// Frontend `get_datetime` executor (the browser clock, not the server's)
// Browser `get_datetime` executor (the browser clock, not the server's)
export { executeGetDatetimeTool } from './get-datetime';
// Browser fallback for the server's get_info tool
+13
View File
@@ -0,0 +1,13 @@
import { TOOL_UI } from '$lib/constants';
import type { ToolUiEntry } from '$lib/types';
/**
* Resolve the UI metadata (label + icon) for a server or browser tool by its
* name. Falls back to null for unknown tools so callers can render a generic
* chrome instead.
*/
export function getToolUi(toolName: string | undefined): ToolUiEntry | null {
if (!toolName) return null;
return (TOOL_UI as Record<string, ToolUiEntry>)[toolName] ?? null;
}