dsh模块、快捷键调整

This commit is contained in:
zhongluofeng committed 2026-09-28 18:05:29 +08:00
1 parent ff1d5cd517
commit 7e65825d3e
54 files changed
+7082 -109

No files matched your search

+138
View File
@@ -0,0 +1,138 @@
/**
* dsh 模块(DeepSeek Harness 外壳)的前端类型。
*
* 与 Rust 侧 `src-tauri/src/dsh/types.rs` 一一对应(camelCase)。
*
* 注意:这里手写类型是**过渡态**——specta 绑定只在 debug 构建启动时重新生成
* (`lib.rs::export_bindings`),新增命令在首次 `bun run tauri dev` 之前不存在于
* `src/lib/bindings.ts`。调用点全部收敛在 `@/stores/dshStore`,将来换成
* `commands.dshXxx` 时只改那一个文件。
*/
/** 模块设置(与 Rust `DshSettings` 对应) */
export interface DshSettings {
version: number
/** auto(系统优先,缺失回落托管)| system | managed */
nodeSource: string
/** 指定下载的 Node 版本(空 = 自动取满足要求的最新版) */
managedNodeVersion: string
/** Node 分发包镜像前缀(空 = 官方 nodejs.org) */
nodeMirror: string
/** npm registry(空 = 官方源) */
npmRegistry: string
/** 下载 Node / npm 安装是否走代理模块 */
useProxy: boolean
port: number
autoStart: boolean
/** 全局快捷键:打开 dsh Web 独立窗口(空 = 未启用),默认 Alt+D */
shortcut: string
/** managed(模块目录)| user(~/.dsh) */
dshHomeMode: string
/** 工作区目录(空 = 模块目录下的 workspace) */
workspace: string
/**
* dsh 本体的安装目录(npm `--prefix` 目标,即 node_modules 所在位置)。
* 空 = 模块目录。只有 dsh 本体跟随此设置;便携 Node、$DSH_HOME、日志与
* 模块设置仍在应用数据目录。
*/
installDir: string
/** 映射为 dsh 默认模型的 Thing AI 供应商 id */
providerId: string
aiSync: boolean
}
/** Node 运行环境状态 */
export interface DshNodeStatus {
/** system | managed | none */
source: string
path: string | null
version: string | null
satisfies: boolean
required: string
}
/** dsh 本体安装状态 */
export interface DshInstallStatus {
installed: boolean
version: string | null
entry: string | null
dir: string
}
/** 服务进程状态 */
export interface DshServerStatus {
running: boolean
ready: boolean
pid: number | null
port: number
/** 规范地址(不含令牌,用于展示) */
url: string
/**
* 带令牌的启动地址(**用于打开界面**)。
*
* dsh web 的鉴权是「进程级随机令牌 → 首次访问换 cookie」:直接访问 `url`
* 只会拿到 401。令牌每次启动都不同,只能从 dsh 输出里抓取,因此进程刚起来时
* 这里可能为 null(等它打印那一行)。
*/
launchUrl: string | null
startedAt: number | null
error: string | null
}
/** 环境总览 */
export interface DshEnvStatus {
node: DshNodeStatus
dsh: DshInstallStatus
server: DshServerStatus
settings: DshSettings
}
/** 安装/下载进度事件载荷 */
export interface DshInstallProgress {
/** download | extracting | installing | done | error */
stage: string
/** 0 表示「不确定进度」(npm 无百分比输出时前端显示动画条) */
percent: number
downloadedBytes: number
totalBytes: number | null
message: string
}
/** 版本更新信息 */
export interface DshUpdateInfo {
current: string | null
latest: string
hasUpdate: boolean
versions: string[]
}
/** npm 源信息:本次安装实际用哪个源、来自哪里 */
export interface DshNpmRegistryInfo {
/** 本次安装/查询实际会使用的源(已去掉末尾 `/`) */
effective: string
/** setting(模块设置指定)| npm(npm 自身配置链)| fallback(默认官方源) */
source: string
/** npm 自身解析出的源(含系统 Node 的 ~/.npmrc),未检测到时为 null */
npmRegistry: string | null
/** 模块设置里显式填写的值(空 = 未指定) */
setting: string
}
/** AI 供应商映射项(预览,不含明文密钥) */
export interface DshAiProvider {
id: string
name: string
envName: string
baseUrl: string
model: string
hasKey: boolean
}
/** settings.yaml 同步预览 */
export interface DshAiPreview {
yaml: string
providers: DshAiProvider[]
defaultProvider: string | null
defaultModel: string | null
settingsPath: string
}