feat(settings): replicate the WorkBuddy general settings panel (TODO 10)

This commit is contained in:
xiaohan.yuan committed 2026-10-17 08:53:34 +08:00
1 parent 401926d7eb
commit 7b68d9eb25
21 files changed
+1150 -11

No files matched your search

+14 -1
View File
@@ -11,7 +11,9 @@ import type {
WorkspaceInfo,
WindowState,
AppInfo,
GitBranchInfo
GitBranchInfo,
GeneralSettingsPatch,
GeneralSettingsView
} from './types'
import type { DownloadPayload, DownloadResult, ResourceEntry, ResourceRange, WorkspaceResource } from './resources'
import type { ChatAttachment, InteractionResponse, MessageQuote, PermissionMode } from './conversation'
@@ -100,6 +102,17 @@ export interface YCodeApi {
get(): Ipc<GatewayConfigView>
update(patch: ConfigPatchLike): Ipc<GatewayConfigView>
}
/** 设置 → 通用:真实可接入的能力。 */
general: {
get(options?: { refreshUsage?: boolean }): Ipc<GeneralSettingsView>
update(patch: GeneralSettingsPatch): Ipc<GeneralSettingsView>
/** 打开数据目录 / 默认工作空间目录 */
openFolder(kind: 'data' | 'workspace'): Ipc<void>
/** 修改默认工作空间存储路径;传入 path 时不弹系统对话框(验收用)。 */
changeWorkspaceRoot(path?: string): Ipc<GeneralSettingsView>
/** 打开系统通知设置页。 */
openSystemNotificationSettings(): Ipc<void>
}
workspace: {
get(): Ipc<WorkspaceInfo>
choose(): Ipc<WorkspaceInfo & { changed: boolean }>
+25
View File
@@ -117,6 +117,31 @@ export interface GatewayConfigView {
keyStorage: 'encrypted' | 'plaintext' | 'none'
}
/** 设置 → 通用:真实状态视图(未接入项不下发数据)。 */
export interface GeneralSettingsView {
/** 系统登录项的真实状态 */
autoLaunch: boolean
/** 运行任务时阻止系统休眠(偏好) */
preventSleep: boolean
/** 当前是否有 powerSaveBlocker 生效 */
preventSleepActive: boolean
/** 数据目录(存放对话记录、运行缓存与临时文件) */
dataDir: string
/** 数据目录占用字节 */
dataBytes: number
/** 扫描是否因预算被截断 */
dataUsagePartial: boolean
/** 数据目录所在磁盘容量 */
disk: { totalBytes: number; freeBytes: number }
/** 默认工作空间存储路径 */
workspaceRoot: string
}
export interface GeneralSettingsPatch {
autoLaunch?: boolean
preventSleep?: boolean
}
/** 主进程 → 渲染进程的流式事件 */
export type ChatEvent = { sessionId?: string; turnDurationMs?: number } & (
| { runId: string; type: 'started'; messageId: string }