feat: Add torch MCP tools for multi-browser control
- Add torchHandlers.ts with 5 tools: - list_torch_clients: list connected browsers with metadata - get_torch_status: show current torch holder - transfer_torch: transfer control to another browser - request_torch: request MCP control - release_torch: release MCP control - Add 'transfer' message type to server torch-handler - Add torch category to all pages - Export helper functions from torch.ts
This commit is contained in:
@@ -24,6 +24,7 @@ import {
|
||||
createTerminalHandlers,
|
||||
createResponseHandlers,
|
||||
createGitHandlers,
|
||||
createTorchHandlers,
|
||||
type ToolConfig
|
||||
} from './tools/handlers'
|
||||
import { setRouter } from './tools/handlers/globalHandlers'
|
||||
@@ -125,7 +126,8 @@ function getToolConfigs(): Map<string, ToolConfig> {
|
||||
...createSourceCodeHandlers(),
|
||||
...createTerminalHandlers(),
|
||||
...createResponseHandlers(),
|
||||
...createGitHandlers()
|
||||
...createGitHandlers(),
|
||||
...createTorchHandlers()
|
||||
]
|
||||
|
||||
for (const config of allHandlers) {
|
||||
@@ -145,22 +147,23 @@ const categoryTools: Record<ToolCategory, string[]> = {
|
||||
source: ['get_repo_info', 'list_repo_files', 'read_repo_file', 'search_repo_code'],
|
||||
project: ['list_canvases', 'create_canvas', 'get_canvas', 'update_canvas', 'delete_canvas', 'clone_canvas', 'add_component_to_canvas', 'remove_component_from_canvas', 'get_canvas_components'],
|
||||
terminal: ['terminal_open', 'terminal_close', 'terminal_toggle', 'terminal_move', 'terminal_resize', 'bubbleResponse'],
|
||||
git: ['get_git_status', 'get_git_diff', 'compare_commits', 'git_log', 'get_git_branches']
|
||||
git: ['get_git_status', 'get_git_diff', 'compare_commits', 'git_log', 'get_git_branches'],
|
||||
torch: ['list_torch_clients', 'get_torch_status', 'transfer_torch', 'request_torch', 'release_torch']
|
||||
}
|
||||
|
||||
// Page to categories mapping
|
||||
const pageCategories: Record<PageName, ToolCategory[]> = {
|
||||
home: ['global', 'canvas', 'component', 'project', 'terminal'],
|
||||
canvas: ['global', 'canvas', 'component', 'terminal'],
|
||||
'project-canvas': ['global', 'canvas', 'component', 'project', 'terminal'],
|
||||
projects: ['global', 'project', 'terminal'],
|
||||
components: ['global', 'component', 'terminal'],
|
||||
themes: ['global', 'theme', 'terminal'],
|
||||
database: ['global', 'database', 'terminal'],
|
||||
source: ['global', 'source', 'terminal'],
|
||||
terminal: ['global', 'terminal'],
|
||||
tools: ['global', 'terminal'],
|
||||
git: ['global', 'git', 'terminal']
|
||||
home: ['global', 'torch', 'canvas', 'component', 'project', 'terminal'],
|
||||
canvas: ['global', 'torch', 'canvas', 'component', 'terminal'],
|
||||
'project-canvas': ['global', 'torch', 'canvas', 'component', 'project', 'terminal'],
|
||||
projects: ['global', 'torch', 'project', 'terminal'],
|
||||
components: ['global', 'torch', 'component', 'terminal'],
|
||||
themes: ['global', 'torch', 'theme', 'terminal'],
|
||||
database: ['global', 'torch', 'database', 'terminal'],
|
||||
source: ['global', 'torch', 'source', 'terminal'],
|
||||
terminal: ['global', 'torch', 'terminal'],
|
||||
tools: ['global', 'torch', 'terminal'],
|
||||
git: ['global', 'torch', 'git', 'terminal']
|
||||
}
|
||||
|
||||
let currentPage: PageName | null = null
|
||||
|
||||
Reference in New Issue
Block a user