/** * Versioned-by-package contract for tools that may be described to the * remote inference gateway. The server imports this allow-list as well as * the local Agent, so a newly registered local/plugin tool fails closed until * it is deliberately added here. */ export type OnlineToolCategory = | 'workspace' | 'web' | 'computer' | 'subagents' | 'integrations'; /** * Shared availability vocabulary for the server catalog and local clients. * `offline` and `disabled` are retained as client-side fallback states; the * server uses the more specific states when it can determine the cause. */ export type OnlineModelAvailabilityState = | 'available' | 'quota_exhausted' | 'concurrency_exceeded' | 'not_authorized' | 'model_disabled' | 'server_offline' | 'device_expired' | 'offline' | 'disabled'; export interface OnlineModelAvailability { state: OnlineModelAvailabilityState; reason?: string; remainingRequests?: number; remainingInputTokens?: number; remainingOutputTokens?: number; activeRequests?: number; maxConcurrent?: number; } export const ONLINE_TOOL_CATEGORIES = [ 'workspace', 'web', 'computer', 'subagents', 'integrations', ] as const satisfies readonly OnlineToolCategory[]; export const ONLINE_TOOL_CATEGORY_BY_NAME = { Read: 'workspace', Edit: 'workspace', MultiEdit: 'workspace', Write: 'workspace', NotebookEdit: 'workspace', Glob: 'workspace', Grep: 'workspace', LSP: 'workspace', Bash: 'workspace', PowerShell: 'workspace', ApplyPatch: 'workspace', Trash: 'workspace', EnterWorktree: 'workspace', ExitWorktree: 'workspace', TerminalCapture: 'workspace', TaskCreate: 'workspace', Schedule: 'workspace', TaskGet: 'workspace', TaskUpdate: 'workspace', TaskList: 'workspace', TaskOutput: 'workspace', TaskStop: 'workspace', PresentResult: 'workspace', Snip: 'workspace', RecallMemory: 'workspace', RememberMemory: 'workspace', UpdateMemory: 'workspace', ListMemories: 'workspace', ForgetMemory: 'workspace', SetPersona: 'workspace', ClearPersona: 'workspace', ConfirmMemory: 'workspace', ReviewMemories: 'workspace', SearchConversations: 'workspace', AskUserQuestion: 'workspace', Skill: 'workspace', WebSearch: 'web', WebFetch: 'web', WebBrowser: 'web', BrowserBatch: 'web', BrowserCDP: 'web', Download: 'web', ComputerUse: 'computer', Agent: 'subagents', AgentMessage: 'subagents', AgentList: 'subagents', AgentWait: 'subagents', AgentInterrupt: 'subagents', AgentFollowup: 'subagents', Advisor: 'subagents', GenerateImage: 'integrations', GenerateSpeech: 'integrations', } as const satisfies Readonly>; export function onlineToolCategory( name: string, ): OnlineToolCategory | undefined { return ONLINE_TOOL_CATEGORY_BY_NAME[ name as keyof typeof ONLINE_TOOL_CATEGORY_BY_NAME ]; }