/** * tools/index.ts โ€” Single entry point for all careless v2 tools. * * buildTools(settings) returns full tool array based on feature flags * AND per-tool enable/disable from settings.disabledTools. */ import type { Settings } from '../types/index' import { WRITING_TOOLS } from './time-tools' import { CORE_TOOLS } from './core' import { MEMORY_TOOLS } from './memory' import { CLIPBOARD_TOOLS } from './clipboard' import { VISION_TOOLS } from './vision' import { AUDIO_TOOLS } from './audio' import { KNOWLEDGE_GRAPH_TOOLS } from './knowledge-graph' import { NOTIFICATION_TOOLS } from './notification' import { GEOLOCATION_TOOLS } from './geolocation' import { TELEGRAM_TOOLS } from './telegram' import { PANEL_TOOLS } from './panel' import { GITHUB_TOOLS } from './github' import { OPENAI_IMAGE_TOOLS } from './openai-image' import { MESH_TOOLS as MESH_COORD_TOOLS } from './mesh' import { SELF_MODIFY_TOOLS, buildCustomTools } from './self-modify' import { SCHEDULER_TOOLS } from './scheduler' import { GALLERY_TOOLS } from './gallery' import { MANAGE_MESSAGES_TOOLS } from './manage-messages' import { MANAGE_TOOLS_TOOLS } from './manage-tools' import { MULTI_AGENT_TOOLS } from './multi-agent' // ๐Ÿงช Experimental (Tier 4) import { TRANSFORMERS_TOOLS } from './transformers-js' import { DOM_TOOLS } from './dom' import { WEBCONTAINER_TOOLS } from './webcontainer' import { WEBGPU_TOOLS } from './webgpu' import { NETWORK_INTERCEPT_TOOLS } from './network-intercept' import { FILE_SYSTEM_TOOLS } from './file-system' import { OFFSCREEN_CANVAS_TOOLS } from './offscreen-canvas' import { VIRTUAL_CURSOR_TOOLS } from './virtual-cursor' // ๐ŸŽฅ Streaming media (camera/mic/screen โ†’ Transformers.js with UI overlay) import { STREAMING_TOOLS } from './streaming-media' import { NPM_TOOLS } from './npm' export { buildCustomTools } from './self-modify' export { startScheduler } from './scheduler' /** Tool catalog โ€” grouped for UI enable/disable in Settings > Tools */ export const TOOL_GROUPS: { id: string; label: string; tools: any[] }[] = [ { id: 'self-modify', label: 'Self-modification (create_tool, update_self_prompt)', tools: SELF_MODIFY_TOOLS }, { id: 'manage', label: 'Self-management (manage_messages, manage_tools)', tools: [...MANAGE_MESSAGES_TOOLS, ...MANAGE_TOOLS_TOOLS] }, { id: 'scheduler', label: 'Scheduler (recurring tasks, notifications)', tools: SCHEDULER_TOOLS }, { id: 'gallery', label: 'Gallery (save/recall UI panels, charts, 3D scenes)', tools: GALLERY_TOOLS }, { id: 'mesh-coord', label: 'Mesh coordination (invoke, broadcast, ring context)', tools: MESH_COORD_TOOLS }, { id: 'multi-agent', label: 'Multi-agent (spawn, invoke, broadcast, list, kill, update)', tools: MULTI_AGENT_TOOLS }, { id: 'writing', label: 'Writing', tools: WRITING_TOOLS }, { id: 'core', label: 'Core (render_ui, eval, storage, fetch)', tools: CORE_TOOLS }, { id: 'memory', label: 'Memory', tools: MEMORY_TOOLS }, { id: 'clipboard', label: 'Clipboard', tools: CLIPBOARD_TOOLS }, { id: 'research', label: 'Research (github)', tools: GITHUB_TOOLS }, { id: 'knowledge', label: 'Knowledge graph', tools: KNOWLEDGE_GRAPH_TOOLS }, { id: 'vision', label: 'Vision (screenshot, camera)', tools: VISION_TOOLS }, { id: 'audio', label: 'Audio (speech)', tools: AUDIO_TOOLS }, { id: 'image-gen', label: 'Image generation', tools: OPENAI_IMAGE_TOOLS }, { id: 'messaging', label: 'Messaging (telegram)', tools: TELEGRAM_TOOLS }, { id: 'system', label: 'System (notifications, geolocation)', tools: [...NOTIFICATION_TOOLS, ...GEOLOCATION_TOOLS] }, { id: 'utility', label: 'Utility (panels)', tools: PANEL_TOOLS }, // ๐Ÿงช Experimental (Tier 4) โ€” browser-native superpowers { id: 'transformers', label: '๐Ÿงช Transformers.js (on-device ML: TTS, STT, VLM, embeddings, classification)', tools: TRANSFORMERS_TOOLS }, { id: 'dom', label: '๐Ÿงช DOM (query, mutate, observe โ€” agent manipulates its own page)', tools: DOM_TOOLS }, { id: 'virtual-cursor', label: '๐Ÿ–ฑ๏ธ Virtual cursor (visible, agent-controlled overlay โ€” move/click/type/highlight for demos)', tools: VIRTUAL_CURSOR_TOOLS }, { id: 'webcontainer', label: '๐Ÿงช WebContainer (full Node.js in the browser โ€” npm install, dev servers)', tools: WEBCONTAINER_TOOLS }, { id: 'webgpu', label: '๐Ÿงช WebGPU (compute shaders โ€” GPU math kernels)', tools: WEBGPU_TOOLS }, { id: 'network-intercept', label: '๐Ÿงช Network intercept (log/block/mock/delay fetch requests)', tools: NETWORK_INTERCEPT_TOOLS }, { id: 'file-system', label: '๐Ÿงช File System Access (real local disk โ€” read/write user files)', tools: FILE_SYSTEM_TOOLS }, { id: 'offscreen-canvas', label: '๐Ÿงช OffscreenCanvas (render PNGs off the main thread in a Worker)', tools: OFFSCREEN_CANVAS_TOOLS }, { id: 'streaming', label: '๐ŸŽฅ Live streaming (camera/mic/screen โ†’ Transformers.js, inline video panels + overlay drawing)', tools: STREAMING_TOOLS }, { id: 'npm', label: '๐Ÿ“ฆ npm packages (load any package via esm.sh, run Node-only ones via WebContainer)', tools: NPM_TOOLS }, ] /** Flat list of every tool name โ€” for the per-tool toggle UI. */ export function getAllToolNames(): string[] { const names: string[] = [] for (const g of TOOL_GROUPS) for (const t of g.tools) names.push(t.name) return Array.from(new Set(names)).sort() } export function buildTools(settings: Settings) { if (settings.enableTools === false) return [] const disabled = new Set(settings.disabledTools || []) const tools: any[] = [] for (const group of TOOL_GROUPS) { // Respect high-level feature flags if (group.id === 'vision' && settings.enableVision === false) continue if (group.id === 'mesh-coord' && settings.enableMesh === false) continue if (group.id === 'memory' && settings.enableMemory === false) continue for (const t of group.tools) { if (!disabled.has(t.name)) tools.push(t) } } return tools }