/// declare namespace NodeJS { interface ProcessEnv { /** * The built directory structure * * ```tree * ├─┬─┬ dist * │ │ └── index.html * │ │ * │ ├─┬ dist-electron * │ │ ├── main.js * │ │ └── preload.js * │ * ``` */ APP_ROOT: string /** /dist/ or /public/ */ VITE_PUBLIC: string } } // ============================================================================ // ElectronAPI type definitions // ============================================================================ interface HubStatus { hubId: string status: string agentCount: number gatewayConnected: boolean gatewayUrl?: string defaultAgent?: { agentId: string status: string } | null } interface AgentInfo { agentId: string status: string } interface ToolInfo { name: string group: string enabled: boolean } interface SkillInfo { id: string name: string description: string version: string enabled: boolean source: 'bundled' | 'global' | 'profile' triggers: string[] } interface DeviceMeta { userAgent?: string platform?: string language?: string } interface DeviceEntryInfo { deviceId: string agentId: string addedAt: number meta?: DeviceMeta } interface SkillAddResult { ok: boolean message: string path?: string skills?: string[] } interface ProfileData { profileId: string | undefined name: string | undefined style: string | undefined userContent: string | undefined } interface LocalChatEvent { agentId: string streamId?: string type?: 'error' content?: string event?: { type: 'message_start' | 'message_update' | 'message_end' | 'tool_execution_start' | 'tool_execution_end' | 'compaction_start' | 'compaction_end' id?: string message?: { role: string content?: Array<{ type: string; text?: string }> } [key: string]: unknown } } interface LocalChatApproval { approvalId: string agentId: string command: string cwd?: string riskLevel: 'safe' | 'needs-review' | 'dangerous' riskReasons: string[] expiresAtMs: number } interface ProviderStatus { id: string name: string authMethod: 'api-key' | 'oauth' available: boolean configured: boolean current: boolean defaultModel: string models: string[] loginUrl?: string loginCommand?: string loginInstructions?: string } interface CurrentProviderInfo { provider: string model: string | undefined providerName: string | undefined available: boolean } interface ElectronAPI { hub: { init: () => Promise getStatus: () => Promise getAgentInfo: () => Promise info: () => Promise reconnect: (url: string) => Promise listAgents: () => Promise createAgent: (id?: string) => Promise getAgent: (id: string) => Promise closeAgent: (id: string) => Promise sendMessage: (agentId: string, content: string) => Promise registerToken: (token: string, agentId: string, expiresAt: number) => Promise onDeviceConfirmRequest: (callback: (deviceId: string, meta?: DeviceMeta) => void) => void offDeviceConfirmRequest: () => void deviceConfirmResponse: (deviceId: string, allowed: boolean) => void listDevices: () => Promise revokeDevice: (deviceId: string) => Promise<{ ok: boolean }> onConnectionStateChanged: (callback: (state: string) => void) => void offConnectionStateChanged: () => void onDevicesChanged: (callback: () => void) => void offDevicesChanged: () => void } tools: { list: () => Promise toggle: (name: string) => Promise setStatus: (name: string, enabled: boolean) => Promise active: () => Promise reload: () => Promise } skills: { list: () => Promise get: (id: string) => Promise toggle: (id: string) => Promise setStatus: (id: string, enabled: boolean) => Promise reload: () => Promise add: (source: string, options?: { name?: string; force?: boolean }) => Promise remove: (name: string) => Promise } agent: { status: () => Promise } profile: { get: () => Promise updateName: (name: string) => Promise updateStyle: (style: string) => Promise updateUser: (content: string) => Promise } provider: { list: () => Promise listAvailable: () => Promise current: () => Promise set: (providerId: string, modelId?: string) => Promise<{ ok: boolean; provider?: string; model?: string; error?: string }> getMeta: (providerId: string) => Promise isAvailable: (providerId: string) => Promise saveApiKey: (providerId: string, apiKey: string) => Promise<{ ok: boolean; error?: string }> importOAuth: (providerId: string) => Promise<{ ok: boolean; expiresAt?: number; error?: string }> } localChat: { subscribe: (agentId: string) => Promise<{ ok?: boolean; error?: string; alreadySubscribed?: boolean }> unsubscribe: (agentId: string) => Promise<{ ok: boolean }> getHistory: (agentId: string, options?: { offset?: number; limit?: number }) => Promise<{ messages: unknown[]; total: number; offset: number; limit: number }> send: (agentId: string, content: string) => Promise<{ ok?: boolean; error?: string }> resolveExecApproval: (approvalId: string, decision: string) => Promise<{ ok: boolean }> onEvent: (callback: (event: LocalChatEvent) => void) => void offEvent: () => void onApproval: (callback: (approval: LocalChatApproval) => void) => void offApproval: () => void } } // Used in Renderer process, expose in `preload.ts` interface Window { ipcRenderer: import('electron').IpcRenderer electronAPI: ElectronAPI }