Files
deepseek-harness/apps/desktop-host/src/cli.ts
T
yudshj 498d436db5 fix(office): 技能文件缺失时不再阻止 Desktop Host 启动,Office 改由 Desktop profile 挂载
- skill-office 在技能文件缺失或元数据解析失败时降级为持久失败,不再阻止 Desktop Host 启动
- Office 改由 Desktop profile 的 yaml 挂载,载体路径由 Desktop 壳通过 Host 环境传入
- 升级 LibreOffice Kit 到 rc.4,移除 Desktop Host 的引擎钩子,runtimeArchivePath 内联到 cli.ts 并删除 office-engine.ts
- 按平台原生路径和当前 Host 参数布局更新 web-app 与 desktop-host 测试夹具
2026-11-04 18:17:57 +08:00

44 lines
1.7 KiB
TypeScript

/** Public dsh commands using the immutable runtime carried by the Desktop installation. */
import { basename, delimiter, dirname, join, resolve } from 'node:path'
import { runCli } from '@deepseek-ai/dsh/lib/bin.js'
/**
* Locate the archive containing a packaged runtime.
* @param runtimeDir - Prepared or ASAR-contained runtime directory.
* @returns Parent archive path, or undefined for a prepared directory.
*/
export function runtimeArchivePath(runtimeDir: string): string | undefined {
const parent = dirname(runtimeDir)
return basename(parent) === 'app.asar' ? parent : undefined
}
/**
* Run the ordinary CLI with Desktop's bundled package manager and reserved-profile plugin access.
* @param supportDir - Physical Desktop runtime directory containing the primary-runtime payload and Node launchers.
* @returns Completion of the selected CLI command; profile plugins own their process lifetime.
*/
export async function runDesktopCli(supportDir: string): Promise<void> {
await runCli({
manageDesktopProfile: true,
packageManager: {
command: process.execPath,
args: ['--expose-internals', join(supportDir, 'primary-runtime', 'dependencies', 'pnpm', 'bin', 'pnpm.mjs')],
env: {
ELECTRON_RUN_AS_NODE: '1',
DSH_DESKTOP_NODE_EXECUTABLE: process.execPath,
PATH: `${join(supportDir, 'bin')}${delimiter}${process.env.PATH ?? ''}`,
},
},
})
}
if (import.meta.main) {
if (process.platform === 'win32') {
const { installWindowsCliSignals } = await import('./windows-cli-signals.ts')
await installWindowsCliSignals()
}
const runtimeDir = resolve(import.meta.dirname, '../../../..')
await runDesktopCli(join(dirname(runtimeArchivePath(runtimeDir) ?? runtimeDir), 'runtime'))
}