feat: bootstrap secure cross-platform assistant

Establish the Electron foundation and pluggable agent runtime so desktop workflows can evolve safely across supported platforms.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
lofyer
2026-07-29 22:42:30 +08:00
co-authored by factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
commit 1b6178b841
30 changed files with 12017 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
import { z } from 'zod'
export const agentRequestSchema = z.object({
requestId: z.string().uuid(),
conversationId: z.string().min(1).max(128),
prompt: z.string().trim().min(1).max(100_000),
workspace: z.string().max(2_048).optional()
})
export type AgentRequest = z.infer<typeof agentRequestSchema>
export type AgentRuntimeStatus = {
id: 'demo' | 'bigtoken' | 'opencode'
label: string
available: boolean
detail: string
}
export type AgentEvent =
| {
requestId: string
type: 'status'
message: string
}
| {
requestId: string
type: 'text'
delta: string
}
| {
requestId: string
type: 'tool'
name: string
state: 'pending' | 'running' | 'completed' | 'failed'
summary: string
}
| {
requestId: string
type: 'done'
sessionId?: string
}
| {
requestId: string
type: 'error'
message: string
}
export type AppInfo = {
name: string
version: string
platform: string
arch: string
shortcut: string
}
export type DesktopApi = {
app: {
getInfo: () => Promise<AppInfo>
show: () => Promise<void>
hide: () => Promise<void>
onNewConversation: (listener: () => void) => () => void
}
agent: {
getStatus: () => Promise<AgentRuntimeStatus>
run: (request: AgentRequest) => Promise<void>
cancel: (requestId: string) => Promise<void>
onEvent: (listener: (event: AgentEvent) => void) => () => void
}
}