Files
deepseek-harness/apps/desktop/scripts/smoke-prepared-runtime.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

50 lines
2.6 KiB
TypeScript

/** Check payloads and Host boot with private native-cache and Harness directories. */
import { execFile } from 'node:child_process'
import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
import { promisify } from 'node:util'
import { runtimeArchivePath } from '../../desktop-host/src/cli.ts'
import { desktopNodeEnvironment } from '../src/node-environment.ts'
import type { DesktopRuntimeDescriptor } from '../src/runtime-tree.ts'
import { scrubWindowsSigningEnvironment } from './windows-sign.mjs'
import { smokeDesktopRuntime } from './smoke-runtime.ts'
import { verifyRuntimeArchive } from './verify-runtime-archive.ts'
/**
* Exercise real runtime files and Host composition, including an ASAR root when packaged.
* @param root Prepared or archived dsh directory.
* @param node Target Electron executable.
* @param resourcesRuntime External runtime directory beside the archive.
* @param descriptor Runtime descriptor already verified against the selected target, which may differ from the build host.
* @returns Resolves after archive integrity, payload checks, Host startup, Office conversion and teardown.
*/
export async function smokePreparedRuntime(
root: string, node: string, resourcesRuntime: string, descriptor: DesktopRuntimeDescriptor,
): Promise<void> {
const cache = await mkdtemp(join(tmpdir(), 'desktop-native-smoke-'))
const environment = { ...scrubWindowsSigningEnvironment(process.env), NODE_OPTIONS: '',
NARB_NATIVE_CACHE_DIR: cache, NARB_DISABLE_NATIVE_CACHE: '0' }
try {
const archive = runtimeArchivePath(root)
if (archive !== undefined) await verifyRuntimeArchive(archive, descriptor)
const { stdout } = await promisify(execFile)(node, [
'--expose-internals', resolve(import.meta.dirname, '../tests/fixtures/runtime-payload-smoke.mjs'), root, resourcesRuntime,
], { timeout: 120_000, windowsHide: true,
env: desktopNodeEnvironment(node, join(resourcesRuntime, 'bin'), environment) }).catch((error: unknown) => {
if (error instanceof Error) {
if ('stdout' in error && typeof error.stdout === 'string') process.stdout.write(error.stdout)
if ('stderr' in error && typeof error.stderr === 'string') process.stderr.write(error.stderr)
if ('killed' in error && 'signal' in error) {
process.stderr.write(`runtime payload: killed=${String(error.killed)}, signal=${String(error.signal)}\n`)
}
}
throw error
})
process.stdout.write(stdout)
await smokeDesktopRuntime(root, node, descriptor, environment, resourcesRuntime)
} finally {
await rm(cache, { recursive: true, force: true })
}
}