multica/apps/desktop/electron/electron-env.d.ts
Jiang Bohan a157c6546d feat(desktop): add profile IPC handlers
Add IPC handlers for profile management:
- profile:get - Get profile name and user content
- profile:updateName - Update agent display name
- profile:updateUser - Update user.md content

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 13:26:40 +08:00

117 lines
2.9 KiB
TypeScript

/// <reference types="vite-plugin-electron/electron-env" />
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 SkillAddResult {
ok: boolean
message: string
path?: string
skills?: string[]
}
interface ProfileData {
profileId: string | undefined
name: string | undefined
userContent: string | undefined
}
interface ElectronAPI {
hub: {
init: () => Promise<unknown>
getStatus: () => Promise<HubStatus>
getAgentInfo: () => Promise<AgentInfo | null>
info: () => Promise<unknown>
reconnect: (url: string) => Promise<unknown>
listAgents: () => Promise<unknown>
createAgent: (id?: string) => Promise<unknown>
getAgent: (id: string) => Promise<unknown>
closeAgent: (id: string) => Promise<unknown>
sendMessage: (agentId: string, content: string) => Promise<unknown>
}
tools: {
list: () => Promise<ToolInfo[]>
toggle: (name: string) => Promise<unknown>
setStatus: (name: string, enabled: boolean) => Promise<unknown>
active: () => Promise<unknown>
reload: () => Promise<unknown>
}
skills: {
list: () => Promise<SkillInfo[]>
get: (id: string) => Promise<unknown>
toggle: (id: string) => Promise<unknown>
setStatus: (id: string, enabled: boolean) => Promise<unknown>
reload: () => Promise<unknown>
add: (source: string, options?: { name?: string; force?: boolean }) => Promise<SkillAddResult>
remove: (name: string) => Promise<SkillAddResult>
}
agent: {
status: () => Promise<unknown>
}
profile: {
get: () => Promise<ProfileData>
updateName: (name: string) => Promise<unknown>
updateUser: (content: string) => Promise<unknown>
}
}
// Used in Renderer process, expose in `preload.ts`
interface Window {
ipcRenderer: import('electron').IpcRenderer
electronAPI: ElectronAPI
}